mem_length to word/byte length

be more specific, and don’t include padding
This commit is contained in:
Torsten Ruger
2015-06-05 09:20:43 +03:00
parent 30d9aaf61b
commit 1c29fcfd43
13 changed files with 39 additions and 40 deletions

View File

@@ -2,7 +2,7 @@ module StreamReader
def read_binary(size, count, type)
d = __sr_read(size*count)
ret = d.unpack(type*count)
return ret if ret.mem_length > 1
return ret if ret.word_length > 1
return ret[0]
end
def read_uint32(n=1)
@@ -74,7 +74,7 @@ module StreamWriter
return __sr_write(str + 0.chr)
end
def write_cstr_prefixed(str)
write_uint8(str.mem_length)
write_uint8(str.word_length)
return __sr_write(str)
end
def write_str(str)