Skip to content

Commit d67a5a4

Browse files
committed
Updated using defined types instead of std::uint types.
1 parent 5fb3759 commit d67a5a4

File tree

4 files changed

+41
-41
lines changed

4 files changed

+41
-41
lines changed

Date.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
#ifndef OCL_GUARD_DATETIME_DATE_HPP
1818
#define OCL_GUARD_DATETIME_DATE_HPP
1919

20-
#include <stdint.h>
20+
#include <cstdint>
2121

2222
namespace ocl
2323
{
@@ -29,13 +29,13 @@ class Date
2929
{
3030
// Types.
3131
public:
32-
typedef uint32_t size_type;
33-
typedef int32_t diff_type;
34-
typedef uint8_t day_type;
35-
typedef uint8_t day_of_week_type;
36-
typedef uint8_t month_type;
37-
typedef uint16_t year_type;
38-
typedef uint32_t serialize_type;
32+
typedef std::uint32_t size_type;
33+
typedef std::int32_t diff_type;
34+
typedef std::uint8_t day_type;
35+
typedef std::uint8_t day_of_week_type;
36+
typedef std::uint8_t month_type;
37+
typedef std::uint16_t year_type;
38+
typedef std::uint32_t serialize_type;
3939

4040
// Constants.
4141
public:
@@ -92,9 +92,9 @@ class Date
9292
/// Convert date to a 32-bit value that can be ordered and stored.
9393
static serialize_type Serialize(day_type day, month_type month, year_type year) throw()
9494
{
95-
uint32_t date = day;
96-
date |= static_cast<uint32_t>(month) << 8U;
97-
date |= static_cast<uint32_t>(year) << 16U;
95+
serialize_type date = day;
96+
date |= static_cast<serialize_type>(month) << 8U;
97+
date |= static_cast<serialize_type>(year) << 16U;
9898
return date;
9999
}
100100

@@ -540,7 +540,7 @@ class Date
540540
}
541541

542542
/// Create Date object from an unsigned 32-bit value.
543-
Date(uint32_t date) throw()
543+
Date(serialize_type date) throw()
544544
{
545545
Deserialize(date, m_day, m_month, m_year);
546546
}
@@ -909,8 +909,8 @@ class Date
909909

910910
int Compare(Date const& date) const throw()
911911
{
912-
uint32_t d1 = Serialize();
913-
uint32_t d2 = date.Serialize();
912+
serialize_type d1 = Serialize();
913+
serialize_type d2 = date.Serialize();
914914
return d1 > d2 ? 1 : (d1 < d2 ? -1 : 0);
915915
}
916916

internal/TimeDefines.hpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
#ifndef OCL_GUARD_DATETIME_INTERNAL_TIMEDEFINES_HPP
1818
#define OCL_GUARD_DATETIME_INTERNAL_TIMEDEFINES_HPP
1919

20-
#include <stdint.h>
20+
#include <cstdint>
2121

2222
namespace ocl
2323
{
@@ -28,27 +28,27 @@ class TimeDefines
2828
public:
2929
// Size types when converting into values larger than the limit
3030
// stored within a time period.
31-
typedef uint64_t nanosecond_size_type;
32-
typedef int64_t nanosecond_diff_type;
33-
typedef uint64_t microsecond_size_type;
34-
typedef int64_t microsecond_diff_type;
35-
typedef uint32_t millisecond_size_type;
36-
typedef int32_t millisecond_diff_type;
37-
typedef uint32_t second_size_type;
38-
typedef int32_t second_diff_type;
39-
typedef uint32_t minute_size_type;
40-
typedef int32_t minute_diff_type;
41-
typedef uint32_t hour_size_type;
42-
typedef int32_t hour_diff_type;
31+
typedef std::uint64_t nanosecond_size_type;
32+
typedef std::int64_t nanosecond_diff_type;
33+
typedef std::uint64_t microsecond_size_type;
34+
typedef std::int64_t microsecond_diff_type;
35+
typedef std::uint32_t millisecond_size_type;
36+
typedef std::int32_t millisecond_diff_type;
37+
typedef std::uint32_t second_size_type;
38+
typedef std::int32_t second_diff_type;
39+
typedef std::uint32_t minute_size_type;
40+
typedef std::int32_t minute_diff_type;
41+
typedef std::uint32_t hour_size_type;
42+
typedef std::int32_t hour_diff_type;
4343

4444
/// Types for hours, minutes, seconds, milliseconds and nanoseconds,
4545
// that don't exceed their limit within a time period.
46-
typedef uint32_t nanosecond_type;
47-
typedef uint32_t microsecond_type;
48-
typedef uint16_t millisecond_type;
49-
typedef uint8_t second_type;
50-
typedef uint8_t minute_type;
51-
typedef uint8_t hour_type;
46+
typedef std::uint32_t nanosecond_type;
47+
typedef std::uint32_t microsecond_type;
48+
typedef std::uint16_t millisecond_type;
49+
typedef std::uint8_t second_type;
50+
typedef std::uint8_t minute_type;
51+
typedef std::uint8_t hour_type;
5252

5353
// Constants.
5454
public:

internal/internalTimeMs.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ limitations under the License.
1919

2020
#include "TimeDefines.hpp"
2121
#include "TimePrecision.hpp"
22-
#include <stdint.h>
22+
#include <cstdint>
2323

2424
namespace ocl
2525
{
@@ -31,7 +31,7 @@ class InternalTimeMs : public TimeDefines
3131
public:
3232
typedef millisecond_size_type size_type;
3333
typedef millisecond_diff_type diff_type;
34-
typedef uint32_t serialize_type;
34+
typedef std::uint32_t serialize_type;
3535
typedef millisecond_type smallest_unit_type;
3636

3737
// Constants.
@@ -254,9 +254,9 @@ class InternalTimeMs : public TimeDefines
254254
serialize_type Serialize() const throw()
255255
{
256256
serialize_type serialize_time = m_milliseconds;
257-
serialize_time |= static_cast<uint32_t>(m_seconds) << 8U;
258-
serialize_time |= static_cast<uint32_t>(m_minutes) << 16U;
259-
serialize_time |= static_cast<uint32_t>(m_hours) << 24U;
257+
serialize_time |= static_cast<serialize_type>(m_seconds) << 8U;
258+
serialize_time |= static_cast<serialize_type>(m_minutes) << 16U;
259+
serialize_time |= static_cast<serialize_type>(m_hours) << 24U;
260260
return serialize_time;
261261
}
262262

@@ -316,7 +316,7 @@ class InternalTimeMs : public TimeDefines
316316
private:
317317
/// Milliseconds are stored as a 10 bit value, 8 bits in m_milliseconds
318318
/// and 2 bits in the top 2 bits of m_seconds.
319-
typedef uint8_t millisecond_internal_type;
319+
typedef std::uint8_t millisecond_internal_type;
320320

321321
/// Masks for handling m_milliseconds and m_seconds.
322322
/// m_seconds bottom two bits contain the top two bits of the 10 bits used for milliseconds.

internal/internalTimeNs.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ limitations under the License.
1919

2020
#include "TimeDefines.hpp"
2121
#include "TimePrecision.hpp"
22-
#include <stdint.h>
22+
#include <cstdint>
2323

2424
namespace ocl
2525
{
@@ -31,7 +31,7 @@ class InternalTimeNs : public TimeDefines
3131
public:
3232
typedef nanosecond_size_type size_type;
3333
typedef nanosecond_diff_type diff_type;
34-
typedef uint64_t serialize_type;
34+
typedef std::uint64_t serialize_type;
3535
typedef nanosecond_type smallest_unit_type;
3636

3737
// Constants.

0 commit comments

Comments
 (0)