Sha256: e9483408fd4dcb06dd3976e47797aceaa604a39655a6b840766531fbc254f6eb

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents


module AdditionalImperituroard

  def self.stat_parse_ip_num(ipnum)
    #translated prefix from ip address number
    prefixmask=0

    #translation from ip addresses number to prefix
    if ipnum == 1
      prefixmask=32
    elsif ipnum == 2
      prefixmask = 31
    elsif ipnum>2 && ipnum<=8
      prefixmask=29
    elsif ipnum>8 && ipnum<=16
      prefixmask=28
    elsif ipnum>16 && ipnum <=32
      prefixmask=27
    elsif ipnum>32 && ipnum <=64
      prefixmask=26
    elsif ipnum >64 && ipnum <=128
      prefixmask=25
    elsif ipnum >128 && ipnum <=256
      prefixmask=24
    elsif ipnum >256 && ipnum <=512
      prefixmask=23
    elsif ipnum >512 && ipnum <=1024
      prefixmask=22
    elsif ipnum >1024 && ipnum <=2048
      prefixmask=21
    elsif ipnum >2046 && ipnum <=4094
      prefixmask=20
    elsif ipnum >4094 && ipnum <=8190
      prefixmask=19
    elsif ipnum >8190 && ipnum <=16382
      prefixmask=18
    elsif ipnum >16382 && ipnum <=32766
      prefixmask=17
    elsif ipnum >32766 && ipnum <=65534
      prefixmask=16
    elsif ipnum >65534 && ipnum <=131070
      prefixmask=15
    elsif ipnum >131070 && ipnum <=262142
      prefixmask=14
    elsif ipnum >262142 && ipnum <=524286
      prefixmask=13
    elsif ipnum >524286 && ipnum <=1048574
      prefixmask=12
    elsif ipnum >1048574 && ipnum <=2097150
      prefixmask=11
    elsif ipnum >2097150 && ipnum <=4194302
      prefixmask=10
    elsif ipnum >4194302 && ipnum <=8388606
      prefixmask=9
    elsif ipnum >8388606 && ipnum <=16777214
      prefixmask=8
    end
    ##

    prefixmask

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imperituroard-1.1.25 lib/imperituroard/add_functions/add/additional.rb
imperituroard-1.1.24 lib/imperituroard/add_functions/add/additional.rb