Class: Cul::Handles::Hdl::UnsignedInt

Inherits:
Object
  • Object
show all
Defined in:
lib/cul/handles/hdl.rb

Overview

index of HS_SECKEY value

Class Method Summary collapse

Class Method Details

.asBytes(val) ⇒ Object



95
96
97
# File 'lib/cul/handles/hdl.rb', line 95

def UnsignedInt.asBytes(val)
  [(val&0xff000000)>>24, (val&0xff0000)>>16, (val&0xff00)>>8, val&0xff]
end

.fromBytes(data) ⇒ Object



98
99
100
101
102
103
104
# File 'lib/cul/handles/hdl.rb', line 98

def UnsignedInt.fromBytes(data)
  result = data[-1]
  for i in ((data.length-1)..1)
    result |= (data[i] << (8*i))
  end
  return result
end