I'm having trouble reading a block of bytes into a vector of short ints. My code is as follows:
int iter = 0;
g_Data[iter] = (shortBuf << 8) | shortBuf;
The relevant block of data starts at offset 2821 in the file. Every two bytes are a signed short integer. What's odd is that it's giving me the correct results only part of the time. At offset 1052421 and 1052422 there are two bytes 40 and 1F that are correctly read in as 8000, but at offset 1052415 and 1052416 bytes 88 and 13 are read in as -120 instead of 5000.
I don't see anything wrong with my code, though, unless I'm misunderstanding completely how to convert an array of two bytes into a single float. Is my method correct? Better still, is there some way to just convert en mass an array of bytes into a vector of signed short ints?