Hi, everyone!
I was using some bit manipulating stocks far more often, then to copy paste them everywhere all the time. I got a handful, and put it into an include file. Hope this set of stocks/functions - gonna add more if get new ones - will help everyone, who needs bit manipulation.
The macros/stocks:
PHP Code:
#define toggle_player_flag(%1,%2)
#define toggle_flag(%1,%2)
#define clear_player_flag(%1,%2)
#define clear_flag(%1,%2)
#define set_player_flag(%1,%2)
#define set_flag(%1,%2)
#define is_player_flag_set(%1,%2)
#define is_flag_set(%1,%2)
stock num_to_binstr(num, dest[], zero_fill = 0)
stock num_to_hexstr(num, dest[], zero_fill = 0)
stock rol(integer, step = 1)
stock ror(integer, step = 1)
stock get_highest(integer, count_type) // COUNT_BIT|COUNT_NIBBLE
stock count_bits(integer)
Last update(dd.mm.yyyy): 03.03.2011.