I was trying to set 46th bit in a register which of 64 bits wide using C.How do i go about setting this bit ?
Currently i am doing this:
uint32_t= address ;
uint64_t data =1ULL << 46;
Printing this is showing that bit 14 is getting set.I am not able to set even bit 32. If i set bit 32 it sets bit 0. 33 will set bit 1. Looks like it is doing circular shifting after 0-31 again it starts over with 0.
Register in 64 bit wide.
Any idea how do i go about setting this bit ?
Eg:
reg_addr.val = FEATURE_REG;
printf(stdout, "Programming enable at address %x=%llx\n",
reg_addr.val,reg_addr.val);
data.val = (1ULL << 46);
printf("Data value %llx\n",data.val);}
If you use types as uint32_t or uint64_t printing correctly is done with:
assuming reg_addr.addr is of type uint32_t and type reg_addr.val is of uint64_t.