src/macros.h
changeset 6083 6594951c3d7e
parent 5919 2b58160d667d
child 6253 23983700e3d7
equal deleted inserted replaced
6082:35923f392ade 6083:6594951c3d7e
     1 /* $Id$ */
     1 /* $Id$ */
     2 
     2 
     3 #ifndef MACROS_H
     3 #ifndef MACROS_H
     4 #define MACROS_H
     4 #define MACROS_H
     5 
       
     6 #include "map.h"
       
     7 
     5 
     8 /// Fetch n bits starting at bit s from x
     6 /// Fetch n bits starting at bit s from x
     9 #define GB(x, s, n) (((x) >> (s)) & ((1U << (n)) - 1))
     7 #define GB(x, s, n) (((x) >> (s)) & ((1U << (n)) - 1))
    10 /// Set n bits starting at bit s in x to d
     8 /// Set n bits starting at bit s in x to d
    11 #define SB(x, s, n, d) ((x) = ((x) & ~(((1U << (n)) - 1) << (s))) | ((d) << (s)))
     9 #define SB(x, s, n, d) ((x) = ((x) & ~(((1U << (n)) - 1) << (s))) | ((d) << (s)))