Married, moved, and getting it together.

Bitmasks 2006 Jul 08

I’m doing work with bitmasks these days, working on system maintenance on a web application I had nothing to do with building. One of the things it does is use Bitmasks to keep track of some customer data states. I’m not sure I like it, but I can’t deny that it’s a way to preserve staus in a very compact way.

Mask (computing) – Wikipedia, the free encyclopedia
The most common mask used, also known as a bitmask, extracts the status of certain bits in a binary string or number. For example, if we have the binary string 100111010 and we want to extract the status of the fifth bit counting along from the most significant bit, we would use a bitmask such as 000010000 and use the bitwise AND operator. Recalling that 1 AND 1 = 1, with 0 otherwise, we find the status of the fifth bit.

Joe Crawford blogged this at 7:34am in 2006 in July. The 8th was a Saturday. You are reading this 13 years later. Comment. There are 2 comments Tweet. Send email. It has hashtags→ .

Comments: 2

we use a bitmask to store permissions on an ACL… works very well. We can aggregate the permissions using bitwise operators to build aggregated permissions for users who have multiple roles in our system.

Bitmasks are always converted to their decimal equivalent prior to entering them and that’s why i like it.

Leave a Reply

Comments Open; Trackbacks Open.