<commit_before>struct Pointer(T)
  def self.null
    new 0_u64
  end

  def self.malloc(size : Int = 1)
    if size < 0
      raise ArgumentError.new "negative Pointer#malloc size"
    end
    Heap.kalloc(size.to_u32).as T*
  end

  def self.malloc(size : Int, value : T)
    ptr = Pointer(T).malloc size
    size.times { |i| ptr[i] = value }
    ptr
  end

  def self.malloc(size : Int, &block : Int32 -> T)
    ptr = Pointer(T).malloc size
    size.times { |i| ptr[i] = yield i }
    ptr
  end

  def realloc(size : Int)
    HeapAllocator(T).realloc self, size.to_u32
  end

  def memcmp(other : Pointer(T), count : Int)
    LibC.memcmp self, other, (count * sizeof(T)).to_u32
  end

  def +(other : Int)
    self + other.to_i64
  end

  def -(other : Int)
    self + (-other)
  end

  def <(other : Pointer(_))
    address < other.address
  end

  def >(other : Pointer(_))
    address > other.address
  end

  def ==(other : Int)
    address == other.address.to_i64
  end

  def ==(other : Pointer(_))
    address == other.address
  end

  def <=>(other : self)
    address <=> other.address
  end

  def [](offset : Int) : T
    (self + offset).value
  end

  def []=(offset : Int, value : T)
    (self + offset).value = value
  end

  def copy_from(source : Pointer(T), count : Int)
    source.copy_to self, count
  end

  def copy_from(source : Pointer(NoReturn), count : Int)
    raise "Negative count" if count < 0
    self
  end
<commit_msg>Fix integer comparison on pointers<commit_after>struct Pointer(T)
  def self.null
    new 0_u64
  end

  def self.malloc(size : Int = 1)
    if size < 0
      raise ArgumentError.new "negative Pointer#malloc size"
    end
    Heap.kalloc(size.to_u32).as T*
  end

  def self.malloc(size : Int, value : T)
    ptr = Pointer(T).malloc size
    size.times { |i| ptr[i] = value }
    ptr
  end

  def self.malloc(size : Int, &block : Int32 -> T)
    ptr = Pointer(T).malloc size
    size.times { |i| ptr[i] = yield i }
    ptr
  end

  def realloc(size : Int)
    HeapAllocator(T).realloc self, size.to_u32
  end

  def memcmp(other : Pointer(T), count : Int)
    LibC.memcmp self, other, (count * sizeof(T)).to_u32
  end

  def +(other : Int)
    self + other.to_i64
  end

  def -(other : Int)
    self + (-other)
  end

  def <(other : Pointer(_))
    address < other.address
  end

  def >(other : Pointer(_))
    address > other.address
  end

  def ==(other : Int)
    address == other.to_u64
  end

  def ==(other : Pointer(_))
    address == other.address
  end

  def <=>(other : self)
    address <=> other.address
  end

  def [](offset : Int) : T
    (self + offset).value
  end

  def []=(offset : Int, value : T)
    (self + offset).value = value
  end

  def copy_from(source : Pointer(T), count : Int)
    source.copy_to self, count
  end

  def copy_from(source : Pointer(NoReturn), count : Int)
    raise "Negative count" if count < 0
    self
  end

{'fraction_non_alphanumeric': 0.12727272727272726, 'fraction_numerical': 0.012349914236706689, 'mean_word_length': 2.5217391304347827, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '6519218', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1034, 'n_words': 306}