22 #ifndef TEENAGENT_SEGMENT_H 23 #define TEENAGENT_SEGMENT_H 25 #include "common/stream.h" 26 #include "common/endian.h" 35 Segment() : _size(0), _data(0) {}
40 inline byte get_byte(uint32 offset)
const {
41 assert(offset < _size);
45 inline uint16 get_word(uint32 offset)
const {
46 assert(offset + 1 < _size);
47 return READ_LE_UINT16(_data + offset);
50 inline void set_byte(uint32 offset, byte v)
const {
51 assert(offset < _size);
55 inline void set_word(uint32 offset, uint16 v)
const {
56 assert(offset + 1 < _size);
57 return WRITE_LE_UINT16(_data + offset, v);
60 const byte *ptr(uint32 addr)
const {
65 byte *ptr(uint32 addr) {
70 uint size()
const {
return _size; }