Bitwise shift operators

Hi,

I must be missing something very basic here, but really can’t see what! Below my simple test code that is supposed to shift a bit across a 32-bit unsigned int variable

#include "mbed.h" 

Serial pc(USBTX,USBRX);
DigitalOut led(LED1);

int main()
{

    int i, ii;
    char inVal;
    
    uint32_t test_word = 1;

    // flashing led on startup
    for (i=0; i<10; i+=1) {
        wait (0.1);
        led = !led;
    }
    // init vars
    led = 0;

    pc.baud(57600);
        
    while(true) {
       
        pc.printf("Hit a key ... \n\r");
        fflush(stdout);
        inVal=pc.getc(); // wait for a key press (over serial)    
            
        // debugging
        for ( i=0; i<34; i++ ) {
           pc.printf( " %.3d 0x%.8x \n\r", i , test_word);
           test_word<<1;
        }

        wait (.2); // save some cpu
    }
}

issue is that it doesn’t shift! Here my results:

Hit a key ...
 000 0x00000001
 001 0x00000001
 002 0x00000001
 003 0x00000001
 004 0x00000001
 005 0x00000001
 006 0x00000001
 ...

This is on an L053R8 with MBed2 online compiler.

test_word<<1; is a statement that does nothing because the result of the expression isn’t being stored in any way. You were probably looking for

test_word = test_word<<1;

Yes, of course !! I must have been really tired, to overlook such a mistake!
Thank you