G3D Innovation Engine http://casual-effects.com/g3d Copyright 2000-2019, Morgan McGuire All rights reserved Available under the BSD License.
More...
|
#define | _BIT(N, K) (((N >> (3*K)) & 1) << K) |
|
#define | _OCT_CODED_BIN(N) |
|
#define | B8__(x) |
|
#define | BIN11(N) _OCT_CODED_BIN(0 ## N ## UL) |
| Create a binary constant up to 11 digits long at compile time. More...
|
|
#define | BIN16(dmsb, dlsb) (((unsigned short)BIN8(dmsb) << 8) + BIN8(dlsb)) |
| Generate a 16-bit constant in binary notation, in 8-bit strings. More...
|
|
#define | BIN32(dmsb, db2, db3, dlsb) |
| Generate a 32-bit constant in binary notation, in 8-bit strings. More...
|
|
#define | BIN8(d) ((unsigned char)B8__(HEX__(d))) |
| Generate a 16-bit constant in binary notation, in 8-bit strings. More...
|
|
#define | HEX__(n) 0x##n##LU |
|
G3D Innovation Engine http://casual-effects.com/g3d Copyright 2000-2019, Morgan McGuire All rights reserved Available under the BSD License.
◆ _BIT
#define _BIT |
( |
|
N, |
|
|
|
K |
|
) |
| (((N >> (3*K)) & 1) << K) |
◆ _OCT_CODED_BIN
#define _OCT_CODED_BIN |
( |
|
N | ) |
|
Value:#define _BIT(N, K)
Definition: BIN.h:12
◆ B8__
Value:((x&0x0000000FLU)?1:0) \
+((x&0x000000F0LU)?2:0) \
+((x&0x00000F00LU)?4:0) \
+((x&0x0000F000LU)?8:0) \
+((x&0x000F0000LU)?16:0) \
+((x&0x00F00000LU)?32:0) \
+((x&0x0F000000LU)?64:0) \
+((x&0xF0000000LU)?128:0)
◆ BIN11
Create a binary constant up to 11 digits long at compile time.
- Referenced Code: By Kaz Kylheku http://www.velocityreviews.com/forums/t620780-mathew-hendrys-macro-for-binary-integer-literals.html
- See also
- BIN8(), BIN11(), BIN16(), BIN32()
◆ BIN16
#define BIN16 |
( |
|
dmsb, |
|
|
|
dlsb |
|
) |
| (((unsigned short)BIN8(dmsb) << 8) + BIN8(dlsb)) |
Generate a 16-bit constant in binary notation, in 8-bit strings.
The most significant byte is first.
unsigned int i =
BIN16(10101010,01010101);
- Referenced Code: Tom Torfs http://groups.google.com/group/comp.arch.embedded/msg/9d430b6d3da12c8f
- See also
- BIN8(), BIN11(), BIN16(), BIN32()
◆ BIN32
#define BIN32 |
( |
|
dmsb, |
|
|
|
db2, |
|
|
|
db3, |
|
|
|
dlsb |
|
) |
| |
Value:(((
unsigned long)
BIN8(dmsb) << 24) + \
((
unsigned long)
BIN8(db2) << 16) + \
((
unsigned long)
BIN8(db3) << 8) + \
#define BIN8(d)
Generate a 16-bit constant in binary notation, in 8-bit strings.
Definition: BIN.h:64
Generate a 32-bit constant in binary notation, in 8-bit strings.
The most significant byte is first.
unsigned int =
BIN32(10000000,11111111,10101010,01010101);
- Referenced Code: Tom Torfs http://groups.google.com/group/comp.arch.embedded/msg/9d430b6d3da12c8f
- See also
- BIN8(), BIN11(), BIN16(), BIN32()
◆ BIN8
#define BIN8 |
( |
|
d | ) |
((unsigned char)B8__(HEX__(d))) |
Generate a 16-bit constant in binary notation, in 8-bit strings.
The most significant byte is first.
unsigned int i =
BIN8(01010101);
- Referenced Code: Tom Torfs http://groups.google.com/group/comp.arch.embedded/msg/9d430b6d3da12c8f
- See also
- BIN8(), BIN11(), BIN16(), BIN32()
◆ HEX__
#define HEX__ |
( |
|
n | ) |
0x##n##LU |