C++ shifting bits
- by Bobby
I am new to shifting bits, but I am trying to debug the following snippet:
if (!(strcmp(arr[i].GetValType(), "f64")))
{
dem_content_buff[BytFldPos] = tmp_data;
dem_content_buff[BytFldPos + 1] = tmp_data >> 8;
dem_content_buff[BytFldPos + 2] = tmp_data >> 16;
dem_content_buff[BytFldPos + 3] = tmp_data >> 24;
dem_content_buff[BytFldPos + 4] = tmp_data >> 32;
dem_content_buff[BytFldPos + 5] = tmp_data >> 40;
dem_content_buff[BytFldPos + 6] = tmp_data >> 48;
dem_content_buff[BytFldPos + 7] = tmp_data >> 56;
}
I am getting a warning saying the lines with "32" to "56" have a shift count that is too large. The "f64" in the predicate just means that the data should be 64bit data.
How should this be done?