File tree 5 files changed +7715
-6033
lines changed
5 files changed +7715
-6033
lines changed Original file line number Diff line number Diff line change @@ -6729,22 +6729,24 @@ let stats_to_string
6729
6729
(String.concat ","
6730
6730
(Array.to_list (Array.map string_of_int bucket_histogram)))
6731
6731
6732
- let string_of_int_as_char i =
6733
- let str = match Char.unsafe_chr i with
6734
- | '\'' -> "\\'"
6735
- | '\\' -> "\\\\"
6736
- | '\n' -> "\\n"
6737
- | '\t' -> "\\t"
6738
- | '\r' -> "\\r"
6739
- | '\b' -> "\\b"
6740
- | ' ' .. '~' as c ->
6741
- let s = (Bytes.create [@doesNotRaise]) 1 in
6742
- Bytes.unsafe_set s 0 c;
6743
- Bytes.unsafe_to_string s
6744
- | _ -> Ext_utf8.encode_codepoint i
6745
- in
6746
- Printf.sprintf "\'%s\'" str
6747
-
6732
+ let string_of_int_as_char (i : int) : string =
6733
+ if i <= 255 && i >= 0 then Format.asprintf "%C" (Char.unsafe_chr i)
6734
+ else
6735
+ let str =
6736
+ match Char.unsafe_chr i with
6737
+ | '\'' -> "\\'"
6738
+ | '\\' -> "\\\\"
6739
+ | '\n' -> "\\n"
6740
+ | '\t' -> "\\t"
6741
+ | '\r' -> "\\r"
6742
+ | '\b' -> "\\b"
6743
+ | ' ' .. '~' as c ->
6744
+ let s = (Bytes.create [@doesNotRaise]) 1 in
6745
+ Bytes.unsafe_set s 0 c;
6746
+ Bytes.unsafe_to_string s
6747
+ | _ -> Ext_utf8.encode_codepoint i
6748
+ in
6749
+ Printf.sprintf "\'%s\'" str
6748
6750
6749
6751
end
6750
6752
module Hash_gen
Original file line number Diff line number Diff line change @@ -6645,22 +6645,24 @@ let stats_to_string
6645
6645
(String.concat ","
6646
6646
(Array.to_list (Array.map string_of_int bucket_histogram)))
6647
6647
6648
- let string_of_int_as_char i =
6649
- let str = match Char.unsafe_chr i with
6650
- | '\'' -> "\\'"
6651
- | '\\' -> "\\\\"
6652
- | '\n' -> "\\n"
6653
- | '\t' -> "\\t"
6654
- | '\r' -> "\\r"
6655
- | '\b' -> "\\b"
6656
- | ' ' .. '~' as c ->
6657
- let s = (Bytes.create [@doesNotRaise]) 1 in
6658
- Bytes.unsafe_set s 0 c;
6659
- Bytes.unsafe_to_string s
6660
- | _ -> Ext_utf8.encode_codepoint i
6661
- in
6662
- Printf.sprintf "\'%s\'" str
6663
-
6648
+ let string_of_int_as_char (i : int) : string =
6649
+ if i <= 255 && i >= 0 then Format.asprintf "%C" (Char.unsafe_chr i)
6650
+ else
6651
+ let str =
6652
+ match Char.unsafe_chr i with
6653
+ | '\'' -> "\\'"
6654
+ | '\\' -> "\\\\"
6655
+ | '\n' -> "\\n"
6656
+ | '\t' -> "\\t"
6657
+ | '\r' -> "\\r"
6658
+ | '\b' -> "\\b"
6659
+ | ' ' .. '~' as c ->
6660
+ let s = (Bytes.create [@doesNotRaise]) 1 in
6661
+ Bytes.unsafe_set s 0 c;
6662
+ Bytes.unsafe_to_string s
6663
+ | _ -> Ext_utf8.encode_codepoint i
6664
+ in
6665
+ Printf.sprintf "\'%s\'" str
6664
6666
6665
6667
end
6666
6668
module Hash_gen
You can’t perform that action at this time.
0 commit comments