Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/qmath.h
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
typedef uint32_t u32q_t; | typedef uint32_t u32q_t; | ||||
typedef int64_t s64q_t; | typedef int64_t s64q_t; | ||||
typedef uint64_t u64q_t; | typedef uint64_t u64q_t; | ||||
/* typedef int128_t s128q_t; Not yet */ | /* typedef int128_t s128q_t; Not yet */ | ||||
/* typedef uint128_t u128q_t; Not yet */ | /* typedef uint128_t u128q_t; Not yet */ | ||||
typedef s64q_t smaxq_t; | typedef s64q_t smaxq_t; | ||||
typedef u64q_t umaxq_t; | typedef u64q_t umaxq_t; | ||||
#if defined(__GNUC__) | |||||
cem: Clang defines `__GNUC__` (yeah, it's gross), so the `#else` is dead code. That's why I… | |||||
/* Ancient GCC hack to de-const, remove when GCC4 is removed. */ | |||||
#define Q_BT(q) __typeof(1 * q) | |||||
#else | |||||
/* The underlying base type of 'q'. */ | /* The underlying base type of 'q'. */ | ||||
#define Q_BT(q) __typeof(q) | #define Q_BT(q) __typeof(q) | ||||
#endif | |||||
/* Type-cast variable 'v' to the same underlying type as 'q'. */ | /* Type-cast variable 'v' to the same underlying type as 'q'. */ | ||||
#define Q_TC(q, v) ((Q_BT(q))(v)) | #define Q_TC(q, v) ((__typeof(q))(v)) | ||||
/* Number of total bits associated with the data type underlying 'q'. */ | /* Number of total bits associated with the data type underlying 'q'. */ | ||||
#define Q_NTBITS(q) ((uint32_t)(sizeof(q) << 3)) | #define Q_NTBITS(q) ((uint32_t)(sizeof(q) << 3)) | ||||
/* Number of LSBs reserved for control data. */ | /* Number of LSBs reserved for control data. */ | ||||
#define Q_NCBITS ((uint32_t)3) | #define Q_NCBITS ((uint32_t)3) | ||||
/* Number of control-encoded bits reserved for fractional component data. */ | /* Number of control-encoded bits reserved for fractional component data. */ | ||||
▲ Show 20 Lines • Show All 559 Lines • Show Last 20 Lines |
Clang defines __GNUC__ (yeah, it's gross), so the #else is dead code. That's why I suggested __GNUC__ > 4 || defined(__clang__) in the first clause of the other version.
#if defined(__GNUC__) && !defined(__clang__) is probably closer to what you intended.