bitClear doesn't work on most significant bit I'm currently working on a project where I read a 32 bit sequence.
The digitalPin is always HIGH when no sequence is received and starts oscilating with about 1kHz when the sequence starts (RC5).
I am setting and clearing bits of an uint32_t depending on which signal is on the digitalPin.
It seems to work very well with every bit except of the MSB.
Here a short code snippet to show what I mean:
const short irPin = 8;
const short msgDelay = 250;

uint32_t data = 0xFFFFFFFF;
long msgArrived = 0;

void setup(){
  Serial.begin(115200);
  pinMode(irPin, INPUT);
}

void loop(){
  long now = millis();

  if( (!(PINB &amp; 1)) &amp;&amp; ((now - msgArrived)&gt; msgDelay)){
    msgArrived = millis();
    bitClear(data, 31);

    Serial.println(data, BIN);
  }
}

This gives me an output of
11111111111111111111111111111111

I have already tried
bitClear(data, 32); -&gt; 11111111111111111111111111111111
bitClear(data, 30); -&gt; 10111111111111111111111111111111

So every output is right, but not the when I try to clear the msb.
Has anyone experienced a similar behaviour?
uint32_t data = 0xFFFFFFFF;
Serial.println(data, BIN);
data = 0xFFFFFFFF;
bitClear(data, 30);
Serial.println(data, BIN);
data = 0xFFFFFFFF;
bitClear(data, 31);
Serial.println(data, BIN);


On my mega outputs:

11111111111111111111111111111111
10111111111111111111111111111111
1111111111111111111111111111111


Are you sure you aren't mistaking the fact that println doesn't print leading 0's for the number being nothing but 1's? Try printing as hex, then all the numbers will be the same width: 

FFFFFFFF
BFFFFFFF
7FFFFFFF