lib/share/network.rb
##
# Converts a integer to multi character network string
#
# @param [Integer, #net_pack_int] int decimal based number
# @param [Integer] size max length of the network string
# @return [String] the int converted to base NET_INT_BASE
Converts a integer to multi character network string
Converts a integer to multi character network string
def net_pack_bigint(int, size)
  sum = ''
  div = size - 1
  (size - 1).times do
    buf = int / ((NET_MAX_INT + 1)**div)
    sum += net_pack_int(buf)
    int = int % ((NET_MAX_INT + 1)**div)
    div -= 1
  end
  sum += net_pack_int(int)
  int /= NET_MAX_INT
  sum
end
def net_pack_bigint ( int , size ) sum = '' div = size - 1 ( size - 1 ) . times do buf = int / ( ( NET_MAX_INT + 1 ) ** div ) sum += net_pack_int ( buf ) int = int % ( ( NET_MAX_INT + 1 ) ** div ) div -= 1 end sum += net_pack_int ( int ) int /= NET_MAX_INT sum end
Converts a integer to multi character network string
Converts a integer to multi character network string
# TODO: check reminder and so on # throw and error when int is too big for size
the int converted to base NET_INT_BASE
the int converted to base NET_INT_BASE
String
int
<not_specific>
size
<not_specific>
<not_specific>
size max length of the network string
size max length of the network string