bitmask

Relocation overflow when performing bitwise AND (SPARC Assembly)?

I am trying to perform a bitwise AND on a register, as a bitmask to remove the most significant bit (which happens to be bit 16 when counting from 0). However, when I try to compile my code using gcc, it gives me the following error messages: Assembler messages: 19: Error: relocation overflow My guess is that this has something to do w...

Java Working with bits

Let me start by saying I have never really worked with bits before in programming. I have an object that can be in 3 states and I want to represent those states using a 3 bit array. For example: I have a race car and it can go forward,left, and right at a stand still the bits would be 000 If the car was moving forward the bits would b...

How to read/write full 32 or 64 bits of an int or bigint bitmasked field in TSQL.

Setting the 32nd and 64th bits is tricky. 32-bit Solution: I got it to work for 32-bit fields. The trick is to cast the return value of the POWER function to binary(4) before casting it to int. If you try to cast directly to int, without first casting to binary(4), you will get an arithmetic overflow exception when operating on the 3...