How about:
u32 end_time32 = (u32) (end_time >> 24) & 0xFFFFFFFF;
Depending on your definition of first
and last
byte it could also be:
u32 end_time32 = (u32) (end_time >> 8) & 0xFFFFFFFF;
Example:
s64 end_time = 0x1234567890ABCDEF;
u32 end_time32 = (u32) (end_time >> 24) & 0xFFFFFFFF;
// end_time32 is now: 0x34567890
s64 end_time = 0x1234567890ABCDEF;
u32 end_time32 = (u32) (end_time >> 8) & 0xFFFFFFFF;
// end_time32 is now: 0x7890ABCD
Edit
After your updated question:
s64 latency;
fscanf(fp, "%lld", latency); //fp is reading the end_time and storing in latency.
u32 latency32 = (uint32) (latency >> 8) & 0xFFFFFFFF;