Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/postgres-pr/utils/buffer.rb,
lib/postgres-pr/utils/buffer.rb,
lib/postgres-pr/utils/buffer.rb

Instance Method Summary collapse

Instance Method Details

#get_int16_network(position) ⇒ Object



4
5
6
7
# File 'ext/postgres-pr/utils/string_unpack_single.c', line 4

def get_int16_network(pos)
  byte1, byte2 = getbyte(pos), getbyte(pos+1)
  (byte1 < 128 ? byte1 : byte1 - 256) * 256 + byte2
end

#get_int32_network(position) ⇒ Object



18
19
20
21
22
# File 'ext/postgres-pr/utils/string_unpack_single.c', line 18

def get_int32_network(pos)
  byte1, byte2 = getbyte(pos), getbyte(pos+1)
  byte3, byte4 = getbyte(pos+2), getbyte(pos+3)
  ((((byte1 < 128 ? byte1 : byte1 - 256) * 256 + byte2) * 256) + byte3) * 256 + byte4
end