Merge pull request 'Hoist out skip_whitespace branching in count_hex_chars' (#1) from count_hex_chars into main
Reviewed-on: #1
This commit is contained in:
commit
b770728db5
1 changed files with 5 additions and 5 deletions
8
ohex.ml
8
ohex.ml
|
@ -9,12 +9,12 @@ let is_space = function
|
||||||
| _ -> false
|
| _ -> false
|
||||||
|
|
||||||
let count_hex_chars ?(skip_whitespace = true) src =
|
let count_hex_chars ?(skip_whitespace = true) src =
|
||||||
|
if skip_whitespace then
|
||||||
string_fold (fun r c ->
|
string_fold (fun r c ->
|
||||||
if skip_whitespace && is_space c then
|
if is_space c then r else succ r)
|
||||||
r
|
|
||||||
else
|
|
||||||
succ r)
|
|
||||||
0 src / 2
|
0 src / 2
|
||||||
|
else
|
||||||
|
String.length src / 2
|
||||||
|
|
||||||
let decode_into ?(skip_whitespace = true) src tgt ?(off = 0) () =
|
let decode_into ?(skip_whitespace = true) src tgt ?(off = 0) () =
|
||||||
let fold f acc str =
|
let fold f acc str =
|
||||||
|
|
Loading…
Reference in a new issue