Sorry, I didn’t get that right (serves me right for not testing). This should be better:
for i = 1:1
y = UInt32(read(fid, UInt8)) << 24
y |= UInt32(read(fid, UInt8)) << 16
y |= UInt32(read(fid, UInt8)) << 8
x[i] = (y % Int32) >> 8
end