BlinkenArea - GitList
Repositories
Blog
Wiki
flaneth
Code
Commits
Branches
Tags
Search
Tree:
e8658d5
Branches
Tags
master
flaneth
firmware.dartboard
macros.h
initial commit after making CF identify work
Stefan Schuermans
commited
e8658d5
at 2012-04-15 19:57:57
macros.h
Blame
History
Raw
/* flaneth - flash and ethernet - dartboard mod * version 0.1 date 2008-11-09 * Copyright (C) 2007-2008 Stefan Schuermans <stefan@schuermans.info> * Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html * a BlinkenArea project - http://www.blinkenarea.org/ */ #ifndef INC_macros #define INC_macros // minimum and maximum #define min( a, b ) ((a) < (b) ? (a) : (b)) #define max( a, b ) ((a) > (b) ? (a) : (b)) // number of entries in an array #define count( array ) (sizeof( (array) ) / sizeof( (array)[0] )) // waiting #define nop( ) { __asm__ __volatile__ ("nop"::); } // bit manipulation #define bit_set( var, bit ) ((var) |= (1 << (bit))) #define bit_clear( var, bit ) ((var) &= ~(1 << (bit))) #define bit_toggle( var, bit ) ((var) ^= (1 << (bit))) #define is_bit_clear( var, bit ) (!(((var) >> (bit)) & 1)) #define is_bit_set( var, bit ) (((var) >> (bit)) & 1) #endif // #ifndef INC_macros