equal
deleted
inserted
replaced
144 } |
144 } |
145 #endif |
145 #endif |
146 |
146 |
147 /// Fetch n bits starting at bit s from x |
147 /// Fetch n bits starting at bit s from x |
148 #define GB(x, s, n) (((x) >> (s)) & ((1 << (n)) - 1)) |
148 #define GB(x, s, n) (((x) >> (s)) & ((1 << (n)) - 1)) |
149 /// Set n bits in x starting at bit s to d |
149 /// Set n bits starting at bit s in x to d |
150 #define SB(x, s, n, d) ((x) = ((x) & ~(((1 << (n)) - 1) << (s))) | ((d) << (s))) |
150 #define SB(x, s, n, d) ((x) = ((x) & ~(((1 << (n)) - 1) << (s))) | ((d) << (s))) |
|
151 /// Add i to the n bits starting at bit s in x |
|
152 #define AB(x, s, n, i) ((x) = ((x) & ~(((1 << (n)) - 1) << (s))) | (((x) + ((i) << (s))) & (((1 << (n)) - 1) << (s)))) |
151 |
153 |
152 /** |
154 /** |
153 * ROtate x Left/Right by n (must be >= 0) |
155 * ROtate x Left/Right by n (must be >= 0) |
154 * @note Assumes a byte has 8 bits |
156 * @note Assumes a byte has 8 bits |
155 */ |
157 */ |