Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

get_bit

By Daniel · January 4, 2009

Extracts one bit from some number n. bit=0 indicates the least significant bit (worth 1, usually written on the far right), bit=1 indicates the next (worth 2), and so forth; in general terms, bit=p refers to the bit worth 2^p.

See also: set_bit

/* get_bit(n, bit)
 *
 * Extracts one bit from some number n. bit=0 indicates the least significant
 * bit (worth 1, usually written on the far right), bit=1 indicates the next
 * (worth 2), and so forth; in general terms, bit=p refers to the bit worth 2^p.
 */

return (argument0 >> argument1) & 1;

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement