Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:30

0001 #pragma once
0002 
0003 /**
0004 sbit_.h : packs and unpacks 8*1bit bools into 8 bits  
0005 -----------------------------------------------------------
0006 
0007 The r variant flips the packing order
0008 
0009 **/
0010 
0011 #define sbit_PACK8( a, b, c, d, e, f, g, h)   ( \
0012        (( (a) & 0x1 ) <<  0 ) | \
0013        (( (b) & 0x1 ) <<  1 ) | \
0014        (( (c) & 0x1 ) <<  2 ) | \
0015        (( (d) & 0x1 ) <<  3 ) | \
0016        (( (e) & 0x1 ) <<  4 ) | \
0017        (( (f) & 0x1 ) <<  5 ) | \
0018        (( (g) & 0x1 ) <<  6 ) | \
0019        (( (h) & 0x1 ) <<  7 )   \
0020                               )
0021 
0022 #define sbit_UNPACK8_0( packed ) (  ((packed) >>  0) & 0x1 )
0023 #define sbit_UNPACK8_1( packed ) (  ((packed) >>  1) & 0x1 )
0024 #define sbit_UNPACK8_2( packed ) (  ((packed) >>  2) & 0x1 )
0025 #define sbit_UNPACK8_3( packed ) (  ((packed) >>  3) & 0x1 )
0026 #define sbit_UNPACK8_4( packed ) (  ((packed) >>  4) & 0x1 )
0027 #define sbit_UNPACK8_5( packed ) (  ((packed) >>  5) & 0x1 )
0028 #define sbit_UNPACK8_6( packed ) (  ((packed) >>  6) & 0x1 )
0029 #define sbit_UNPACK8_7( packed ) (  ((packed) >>  7) & 0x1 )
0030 
0031 
0032 
0033 
0034 #define sbit_rPACK8( a, b, c, d, e, f, g, h)   ( \
0035        (( (a) & 0x1 ) <<  7 ) | \
0036        (( (b) & 0x1 ) <<  6 ) | \
0037        (( (c) & 0x1 ) <<  5 ) | \
0038        (( (d) & 0x1 ) <<  4 ) | \
0039        (( (e) & 0x1 ) <<  3 ) | \
0040        (( (f) & 0x1 ) <<  2 ) | \
0041        (( (g) & 0x1 ) <<  1 ) | \
0042        (( (h) & 0x1 ) <<  0 )   \
0043                               )
0044 
0045 #define sbit_rUNPACK8_0( packed ) (  ((packed) >>  7) & 0x1 )
0046 #define sbit_rUNPACK8_1( packed ) (  ((packed) >>  6) & 0x1 )
0047 #define sbit_rUNPACK8_2( packed ) (  ((packed) >>  5) & 0x1 )
0048 #define sbit_rUNPACK8_3( packed ) (  ((packed) >>  4) & 0x1 )
0049 #define sbit_rUNPACK8_4( packed ) (  ((packed) >>  3) & 0x1 )
0050 #define sbit_rUNPACK8_5( packed ) (  ((packed) >>  2) & 0x1 )
0051 #define sbit_rUNPACK8_6( packed ) (  ((packed) >>  1) & 0x1 )
0052 #define sbit_rUNPACK8_7( packed ) (  ((packed) >>  0) & 0x1 )
0053 
0054