Simply C/C++ problem!

From: Dr Ian Korir <IKorir_at_nnr.co.za>
Date: Wed, 11 Aug 2010 13:18:47 +0200


Dear ROOTers,

I need to perform some simple bit "manipulations" without making use of the TBit ROOT object on a 64 bit variable ULD declared as (supposedly) unsign long long, then get a printout of the same variable using printf. My problem is it does not seem to work or seems to truncate the output to 32 bits. Here is the relevant portion of the code that does this:

   ULong64_t ULD;
   for (Int_t i=0; i<10; i++){

       printf("\n(%3i)", i+1);
        ULD=0;
        ULD|=1<<mem[i][0];
        ULD|=1<<mem[i][1];
        ULD|=1<<mem[i][2];
        ULD|=1<<mem[i][3];
        ULD|=1<<mem[i][4];
        ULD|=1<<mem[i][5];
        ULD>>=1;
        printf("  %llu ", ULD);
     }//for ith

The mem[i][j] is a 2D array of Int_t etc and the process above is meant to set appropriate bits to 1 initialised with all zeros (supposedly), how can one fix this to perform as one might expect?

Uses root version 5.26/00 under OS SL52 environment (HP Z600 64Bit Quad)

Regards,

Ian. Received on Wed Aug 11 2010 - 13:18:00 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 11 2010 - 17:50:01 CEST