this repo has no description
at fixPythonPipStalling 50 lines 932 B view raw
1#include "BinaryIO.h" 2#include <iostream> 3#include <cassert> 4 5#include "ResType.h" 6 7void byte(std::ostream& out, int byte) 8{ 9 out.put((unsigned char)byte); 10} 11void word(std::ostream& out, int word) 12{ 13 byte(out,(word >> 8) & 0xFF); 14 byte(out,word & 0xFF); 15} 16void ostype(std::ostream& out, ResType type) 17{ 18 longword(out, type); 19} 20void longword(std::ostream& out, int longword) 21{ 22 byte(out,(longword >> 24) & 0xFF); 23 byte(out,(longword >> 16) & 0xFF); 24 byte(out,(longword >> 8) & 0xFF); 25 byte(out,longword & 0xFF); 26} 27 28int byte(std::istream& in) 29{ 30 return in.get() & 0xFF; 31} 32int word(std::istream& in) 33{ 34 int a = byte(in); 35 int b = byte(in); 36 return (a << 8) | b; 37} 38ResType ostype(std::istream& in) 39{ 40 return longword(in); 41} 42int longword(std::istream& in) 43{ 44 int a = byte(in); 45 int b = byte(in); 46 int c = byte(in); 47 int d = byte(in); 48 return (a << 24) | (b << 16) | (c << 8) | d; 49} 50