Skip to content

Commit

Permalink
[fix] cactutf.ml: cons function : if negative character, consider it …
Browse files Browse the repository at this point in the history
…character 0
  • Loading branch information
Frederic Ye committed Jan 13, 2012
1 parent 973304b commit 70d9436
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libbase/cactutf.ml
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
(* (*
Copyright © 2011 MLstate Copyright © 2011, 2012 MLstate
This file is part of OPA. This file is part of OPA.
Expand Down Expand Up @@ -349,6 +349,7 @@ let csize n =
*) *)
(*##register cons : int -> string*) (*##register cons : int -> string*)
let cons c = let cons c =
let c = if c < 0 then 0 else c in
let s = csize c in let s = csize c in
let str = String.create s in let str = String.create s in
if (s = 1) then if (s = 1) then
Expand All @@ -369,7 +370,6 @@ let cons c =
str.[2] <- char_of_int(n3 + 128); str.[2] <- char_of_int(n3 + 128);
str str
else else

let n1 = c / 262144 in let n1 = c / 262144 in
let n2 = (c - (n1 * 262144)) / 4096 in let n2 = (c - (n1 * 262144)) / 4096 in
let n3 = (c - (n1 * 262144) - (n2 * 4096)) / 64 in let n3 = (c - (n1 * 262144) - (n2 * 4096)) / 64 in
Expand Down

0 comments on commit 70d9436

Please sign in to comment.