<commit_before>require 'rstruct/type'

module Rstruct

  class Byte < Type
    register

    def initialize(name, opts={})
      super(name, 1, "C")
    end
  end

  class Char < Type
    register

    def initialize(name, opts={})
      super(name, 1, "A")
    end
  end


  class Int < Type
    register
    SIZE = [0].pack("i_").size

    def initialize(name, opts={})
      super(name, SIZE, "i_")
    end
  end

  class Uint < Type
    register
    SIZE = [0].pack("I_").size

    def initialize(name, opts={})
      super(name, SIZE, "I_")
    end
  end

  class Short < Type
    register
    SIZE = [0].pack("s_")
    def initialize(name, opts={})
      super(name, SIZE, "s_")
    end
  end

  class Ushort < Type
    register
    SIZE = [0].pack("S_")
    def initialize(name, opts={})
      super(name, SIZE, "S_")
    end
  end

  class Long < Type
    register
    SIZE = [0].pack("l_")
    def initialize(name, opts={})
      super(name, SIZE, "l_")
    end
  end

  class Ulong < Type
    register
    SIZE = [0].pack("L_")
    def initialize(name, opts={})
      super(name, SIZE, "L_")
    end
  end

  class Int16 < Type
    register
    def initialize(name, opts={})
      super(name, 2, "s")
    end
  end

  class Uint16 < Type
    register
    def initialize(name, opts={})
      super(name, 2, "S")
    end
  end

  class Int32 < Type
    register
    def initialize(name, opts={})
      super(name, 4, "l")
    end
  end

  class Uint32 < Type
    register
    def initialize(name, opts={})
      super(name, 4, "L")
    end
  end

  class Int64 < Type
    register
    def initialize(name, opts={})
      super(name, 8, "q")
    end
  end

  class Uint64 < Type
    register
    def initialize(name, opts={})
      super(name, 8, "Q")
    end
  end

end<commit_msg>fix sizes and add le/be variants<commit_after>require 'rstruct/type'

module Rstruct

  class Byte < Type
    register

    def initialize(name, opts={})
      super(name, 1, "C")
    end
  end

  class Char < Type
    register

    def initialize(name, opts={})
      super(name, 1, "A")
    end
  end


  class Int < Type
    register
    SIZE = [0].pack("i_").size

    def initialize(name, opts={})
      super(name, SIZE, "i_")
    end
  end

  class Uint < Type
    register
    SIZE = [0].pack("I_").size

    def initialize(name, opts={})
      super(name, SIZE, "I_")
    end
  end

  class Short < Type
    register
    SIZE = [0].pack("s_").size
    def initialize(name, opts={})
      super(name, SIZE, "s_")
    end
  end

  class Ushort < Type
    register
    SIZE = [0].pack("S_").size
    def initialize(name, opts={})
      super(name, SIZE, "S_")
    end
  end

  class Long < Type
    register
    SIZE = [0].pack("l_").size
    def initialize(name, opts={})
      super(name, SIZE, "l_")
    end
  end

  class Ulong < Type
    register
    SIZE = [0].pack("L_").size
    def initialize(name, opts={})
      super(name, SIZE, "L_")
    end
  end

  class Int16 < Type
    register
    def initialize(name, opts={})
      super(name, 2, "s")
    end
  end

  class Uint16 < Type
    register
    def initialize(name, opts={})
      super(name, 2, "S")
    end
  end

  class Int32 < Type
    register
    def initialize(name, opts={})
      super(name, 4, "l")
    end
  end

  class Uint32 < Type
    register
    def initialize(name, opts={})
      super(name, 4, "L")
    end
  end

  class Int64 < Type
    register
    def initialize(name, opts={})
      super(name, 8, "q")
    end
  end

  class Uint64 < Type
    register
    def initialize(name, opts={})
      super(name, 8, "Q")
    end
  end

  class Uint16le < Type
    register
    def initialize(name, opts={})
      super(name, 8, "v")
    end
  end

  class Uint16be < Type
    register
    def initialize(name, opts={})
      super(name, 8, "n")
    end
  end

  class Uint32le < Type
    register
    def initialize(name, opts={})
      super(name, 8, "V")
    end
  end

  class Uint32be < Type
    register
    def initialize(name, opts={})
      super(name, 8, "N")
    end
  end

end
{'fraction_non_alphanumeric': 0.13111931119311193, 'fraction_numerical': 0.015744157441574414, 'mean_word_length': 2.1592851592851594, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4186015', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1405, 'n_words': 422}