Integers.h++ File Reference

#include <commonc++/Common.h++>
#include <inttypes.h>
#include <stdint.h>
Include dependency graph for Integers.h++:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ccxx

Defines

#define INT64_CONST(I)   (I ## LL)
 Declare a signed 64-bit integer constant I.
#define UINT64_CONST(I)   (I ## ULL)
 Declare an unsigned 64-bit integer constant I.
#define INT8_MIN   (-128)
 The minimum value for a signed 8-bit integer.
#define INT16_MIN   (-32767-1)
 The minimum value for a signed 16-bit integer.
#define INT32_MIN   (-2147483647-1)
 The minimum value for a signed 32-bit integer.
#define INT64_MIN   (INT64_CONST(-9223372036854775807)-1)
 The minimum value for a signed 64-bit integer.
#define INT8_MAX   (127)
 The maximum value for a signed 8-bit integer.
#define INT16_MAX   (32767)
 The maximum value for a signed 16-bit integer.
#define INT32_MAX   (2147483647)
 The maximum value for a signed 32-bit integer.
#define INT64_MAX   (INT64_CONST(9223372036854775807))
 The maximum value for a signed 64-bit integer.
#define UINT8_MAX   (255U)
 The maximum value for an unsigned 8-bit integer.
#define UINT16_MAX   (65535U)
 The maximum value for an unsigned 16-bit integer.
#define UINT32_MAX   (4294967295U)
 The maximum value for an unsigned 32-bit integer.
#define UINT64_MAX   (UINT64_CONST(18446744073709551615))
 The maximum value for an unsigned 64-bit integer.
#define INT64_FMT   "%lld"
 The printf() formatting directive for signed 64-bit integers.
#define UINT64_FMT   "%llu"
 The printf() formatting directive for unsigned 64-bit integers.
#define INT64_P_FMT(W)   "%" #W "lld"
 The parameterized printf() formatting directive for signed 64-bit integers; W indicates the field width.
#define UINT64_P_FMT(W)   "%" #W "llu"
 The parameterized printf() formatting directive for unsigned 64-bit integers; W indicates the field width.
#define INT64_WIDE_FMT   L"%lld"
 The wprintf() (wide string) formatting directive for signed 64-bit integers.
#define UINT64_WIDE_FMT   L"%llu"
 The wprintf() (wide string) formatting directive for unsigned 64-bit integers.
#define INT64_WIDE_P_FMT(W)   L"%" L#W L"lld"
 The parameterized wprintf() (wide string) formatting directive for signed 64-bit integers; W indicates the field width.
#define UINT64_WIDE_P_FMT(W)   L"%" L#W L"llu"
 The parameterized wprintf() (wide string) formatting directive for unsigned 64-bit integers; W indicates the field width.
#define CCXX_BIT_SET(N, BIT)   ((N) |= (1 << (BIT)))
 Set the bit at index BIT (where 0 corresponds to the LSB) in N.
#define CCXX_BIT_CLEAR(N, BIT)   (((N) &= ~(1 << (BIT))))
 Clear the bit at index BIT (where 0 corresponds to the LSB) in N.
#define CCXX_BIT_READ(N, BIT)   ((((N) & (1 << (BIT))) == 0) ? 0 : 1)
 Read the bit at index BIT (where 0 corresponds to the LSB) in N.
#define CCXX_BIT_WRITE(N, BIT, VALUE)   ((VALUE) ? CCXX_BIT_SET((N), (BIT)) : CCXX_BIT_CLEAR((N), (BIT)))
 Write the bit at index BIT (where 0 corresponds to the LSB) in N.
#define CCXX_BIT_TEST(N, BIT)   (((N) & (1 << (BIT))) != 0)
 Test the bit at index BIT (where 0 corresponds to the LSB) in N.

Typedefs

typedef unsigned char byte_t
typedef unsigned int uint_t
typedef int32_t time_s_t
 A time expressed in seconds since the epoch (00:00:00, UTC, January 1, 1970).
typedef int timespan_s_t
 A timespan expressed in seconds.
typedef int64_t time_ms_t
 A time expressed in milliseconds since the epoch (00:00:00, UTC, January 1, 1970).
typedef int timespan_ms_t
 A timespan expressed in milliseconds.

Define Documentation

#define CCXX_BIT_CLEAR ( N,
BIT   )     (((N) &= ~(1 << (BIT))))

Clear the bit at index BIT (where 0 corresponds to the LSB) in N.

The arguments are evaluated only once.

#define CCXX_BIT_READ ( N,
BIT   )     ((((N) & (1 << (BIT))) == 0) ? 0 : 1)

Read the bit at index BIT (where 0 corresponds to the LSB) in N.

Returns 0 or 1. The arguments are evaluated only once.

#define CCXX_BIT_SET ( N,
BIT   )     ((N) |= (1 << (BIT)))

Set the bit at index BIT (where 0 corresponds to the LSB) in N.

The arguments are evaluated only once.

#define CCXX_BIT_TEST ( N,
BIT   )     (((N) & (1 << (BIT))) != 0)

Test the bit at index BIT (where 0 corresponds to the LSB) in N.

Returns true if the bit is set, false otherwise. The arguments are evaluated only once.

#define CCXX_BIT_WRITE ( N,
BIT,
VALUE   )     ((VALUE) ? CCXX_BIT_SET((N), (BIT)) : CCXX_BIT_CLEAR((N), (BIT)))

Write the bit at index BIT (where 0 corresponds to the LSB) in N.

VALUE is zero (or false) to clear the bit, nonzero (or true) to set the bit. The arguments are evaluated only once.

#define INT16_MAX   (32767)

The maximum value for a signed 16-bit integer.

#define INT16_MIN   (-32767-1)

The minimum value for a signed 16-bit integer.

#define INT32_MAX   (2147483647)

The maximum value for a signed 32-bit integer.

#define INT32_MIN   (-2147483647-1)

The minimum value for a signed 32-bit integer.

#define INT64_CONST (  )     (I ## LL)

Declare a signed 64-bit integer constant I.

#define INT64_FMT   "%lld"

The printf() formatting directive for signed 64-bit integers.

#define INT64_MAX   (INT64_CONST(9223372036854775807))

The maximum value for a signed 64-bit integer.

#define INT64_MIN   (INT64_CONST(-9223372036854775807)-1)

The minimum value for a signed 64-bit integer.

#define INT64_P_FMT (  )     "%" #W "lld"

The parameterized printf() formatting directive for signed 64-bit integers; W indicates the field width.

#define INT64_WIDE_FMT   L"%lld"

The wprintf() (wide string) formatting directive for signed 64-bit integers.

#define INT64_WIDE_P_FMT (  )     L"%" L#W L"lld"

The parameterized wprintf() (wide string) formatting directive for signed 64-bit integers; W indicates the field width.

#define INT8_MAX   (127)

The maximum value for a signed 8-bit integer.

#define INT8_MIN   (-128)

The minimum value for a signed 8-bit integer.

#define UINT16_MAX   (65535U)

The maximum value for an unsigned 16-bit integer.

#define UINT32_MAX   (4294967295U)

The maximum value for an unsigned 32-bit integer.

#define UINT64_CONST (  )     (I ## ULL)

Declare an unsigned 64-bit integer constant I.

#define UINT64_FMT   "%llu"

The printf() formatting directive for unsigned 64-bit integers.

#define UINT64_MAX   (UINT64_CONST(18446744073709551615))

The maximum value for an unsigned 64-bit integer.

#define UINT64_P_FMT (  )     "%" #W "llu"

The parameterized printf() formatting directive for unsigned 64-bit integers; W indicates the field width.

#define UINT64_WIDE_FMT   L"%llu"

The wprintf() (wide string) formatting directive for unsigned 64-bit integers.

#define UINT64_WIDE_P_FMT (  )     L"%" L#W L"llu"

The parameterized wprintf() (wide string) formatting directive for unsigned 64-bit integers; W indicates the field width.

#define UINT8_MAX   (255U)

The maximum value for an unsigned 8-bit integer.

Generated on Sat Nov 26 16:49:08 2011 for libcommonc++ by  doxygen 1.6.3