def pack(val, b)
      Array.new(b) { |i| (val >> (i * 8)) & 0xff }.pack('C*')
    end
def pack(val, b)
      Array.new(b) { |i| (val >> (i * 8)) & 0xff }.pack('C*')
    end
Pack an integer into +b+ bytes.
 Little endian is used.

 @param [Integer] val
   The integer to pack.
   If +val+ contains more than +b+ bytes,
   only lower +b+ bytes in +val+ will be packed.

 @param [Integer] b

 @return [String]
   Packing result with length +b+.

 @example
   Util.pack(0x123, 4)
   #=> "\x23\x01\x00\x00"