32 #ifndef MOVELEM_SOURCE_FILE 33 #define MOVELEM_INLINE inline 35 #define MOVELEM_INLINE extern inline 45 return (bb << 4) | sc;
89 static const char chars[] = {
'F',
'L',
'R',
'U',
'D'};
90 unsigned char bb = elem >> 4;
91 unsigned char sc = elem & 0x0F;
92 fprintf(fp,
"%c,%c", chars[bb], chars[sc]);
MOVELEM_INLINE MovElem MovElem_make(unsigned char bb, unsigned char sc)
Creates a MovElem.
Definition: movelem.h:44
_MovUnits
Constants for making MovElem elements.
Definition: movelem.h:24
MOVELEM_INLINE void MovElem_print(MovElem elem, FILE *fp)
Prints a movement in the format "%c,%c", without leading/trailing spaces.
Definition: movelem.h:88
MOVELEM_INLINE unsigned char MovElem_getBB(MovElem elem)
Returns the movement for the backbone (BB) stored in a MovElem.
Definition: movelem.h:56
MOVELEM_INLINE MovElem MovElem_random()
Returns a uniformly random MovElem.
Definition: movelem.h:50
MOVELEM_INLINE unsigned char MovElem_getSC(MovElem elem)
Returns the movement for the side chain (SC) stored in a MovElem.
Definition: movelem.h:62
MOVELEM_INLINE unsigned char MovElem_to_number(MovElem elem)
Convert a MovElem to a number.
Definition: movelem.h:70
RANDOM_INLINE unsigned int urandom_max(unsigned int max)
Returns an unsigned integer within [0,max)
Definition: random.h:24
MOVELEM_INLINE MovElem MovElem_from_number(unsigned char num)
Convert a number to MovElem.
Definition: movelem.h:80
unsigned char MovElem
Type that holds 2 movements, one for the backbone and one for the side chain.
Definition: movelem.h:21
Routines for random number generation.