What is a bitmask?

  1. Home
  2. Knowledge Base
  3. GMS
  4. What is a bitmask?


GMS makes extensive use of bitmasks throughout its configuration. Bitmasks are a very resource friendly means of storing settings. A bitmask makes use of the fact that binary numbers are made up of 1’s and 0’s, each digit in a binary number being equivalent to one bit. This makes binary numbers ideal for use as "switches" to enable or disable certain facilities.

Binary numbers are always read from right to left, and when used as bitmasks the same is true. The rightmost digit is always bit 0, so taking 1010 as an example bit 0 is off, bit 1 is on, bit 2 is off and bit 3 is on.

A good example of bitmask usage is when setting the log levels for a particular service. For example, if you enable all the logging options for the SMTP service you will end up with the SMTPLog variable set to a value of 4382. Converting 4382 to its binary equivalent gives 1000100011110, that is bits 1, 2, 3, 4, 8 and 12 are all set.

If you look at the Logs > Transaction Levels page you will see that there are 6 possible settings for SMTP logging that can be set via the GUI. Each one of these corresponds to one of the bits that are enabled (switched on) above.

Bitmasks are always converted to their decimal equivalent prior to entering them.

Keywords:bitmask bitmap binary

Was this article helpful?

Related Articles