# Problem with understanding masking operation

#### zulfi100

Joined Jun 7, 2012
656
Hi,
I have a problem in understanding the following masking operation:

m & n = n if m + 1 = 2 ^ (1+log m) and 0 <= n <= m

where & is the bitwise AND operator and m denotes a bitmask 0xff…f.

I have attached the research paper. Its on page 3.

Zulfi.

#### Attachments

• 557 KB Views: 3

#### zulfi100

Joined Jun 7, 2012
656
Hi,
Okay I got some idea. What ever be the value of n, we get it back due to masking operation.
But can some body explain the part: m + 1 = 2 ^ (1+log m) by giving some example
Zulfi.

#### panic mode

Joined Oct 10, 2011
2,360
if n is less than m and m is a "block of set bits" then m & n = n
block of set bits means all "1" are grouped and on the right, for example m = 7 = binary 00000111
adding one to m would make it one of the binary powers: m+1 = 8 = binary 0001000

#### WBahn

Joined Mar 31, 2012
27,863
Hi,
Okay I got some idea. What ever be the value of n, we get it back due to masking operation.
But can some body explain the part: m + 1 = 2 ^ (1+log m) by giving some example
Zulfi.
What is the log operation? Is it base 2? Does it return the real-values logarithm, or does it floor or ceiling it?

#### zulfi100

Joined Jun 7, 2012
656
What is the log operation? Is it base 2? Does it return the real-values logarithm, or does it floor or ceiling it?
Nothing like this mentioned in the paper. I thing we can consider it as returning the actual value. We can try both ceil and floor operations on it to see their impact. But you are right this is a confusion and its not well expressed.

Zulfi.

#### WBahn

Joined Mar 31, 2012
27,863
Hi,
Okay I got some idea. What ever be the value of n, we get it back due to masking operation.
But can some body explain the part: m + 1 = 2 ^ (1+log m) by giving some example
Zulfi.
Notice that the paper gives a bib reference. Go look at the paper cited.