<commit_before>module Uint32 = struct

  type t = int32

  let pp ppf t = Format.fprintf ppf "0x%08lX" t

  let of_int i =
    if i < 0 then
      invalid_arg "out of range"
    else if i > 0xFFFFFFFF then
      invalid_arg "out of range"
    else
      Int32.of_int i

  let to_int t =
    if Sys.word_size <= 32 && t < 0l then
      None
    else if t < 0l then
      Some (Int32.(to_int (add t min_int)) + Int32.(to_int max_int) + 1)
    else
      Some (Int32.to_int t)

  external add : t -> t -> t * bool = "caml_uint32_add_overflow"
  external mul : t -> t -> t * bool = "caml_uint32_mul_overflow"
  external sub : t -> t -> t * bool = "caml_uint32_sub_underflow"

  let pred t = sub t 1l
<commit_msg>literal 32bit constant might be broken on 32bit systems, use Int32.max_int instead<commit_after>module Uint32 = struct

  type t = int32

  let pp ppf t = Format.fprintf ppf "0x%08lX" t

  let of_int i =
    if i < 0 then
      invalid_arg "out of range"
    else if i > 2 * Int32.(to_int max_int) + 1 then
      invalid_arg "out of range"
    else
      Int32.of_int i

  let to_int t =
    if Sys.word_size <= 32 && t < 0l then
      None
    else if t < 0l then
      Some (Int32.(to_int (add t min_int)) + Int32.(to_int max_int) + 1)
    else
      Some (Int32.to_int t)

  external add : t -> t -> t * bool = "caml_uint32_add_overflow"
  external mul : t -> t -> t * bool = "caml_uint32_mul_overflow"
  external sub : t -> t -> t * bool = "caml_uint32_sub_underflow"

  let pred t = sub t 1l

{'fraction_non_alphanumeric': 0.09634551495016612, 'fraction_numerical': 0.04451827242524917, 'mean_word_length': 2.3691275167785233, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '1943324', 'n_tokens_mistral': 621, 'n_tokens_neox': 564, 'n_words': 196}