Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More erroneous conversions from uint24 and int24 from all other int types #40

Closed
rixed opened this issue Feb 4, 2020 · 0 comments · Fixed by #41
Closed

More erroneous conversions from uint24 and int24 from all other int types #40

rixed opened this issue Feb 4, 2020 · 0 comments · Fixed by #41

Comments

@rixed
Copy link
Contributor

rixed commented Feb 4, 2020

int24_of_* on 64 bits arch because the shift is then wrong, and uint24_of_* because the extranuous shift.

rixed added a commit to rixed/ocaml-stdint that referenced this issue Feb 4, 2020
int24 was wrong on 64bits arch only, whereas uint24 was wrong for all
archs.

Before:

  # Uint24.(of_uint32 (Uint32.of_int 42) |> to_int);;
  - : int = 10752
  # Int24.(of_int32 (Int32.of_int 42) |> to_int);;
  - : int = 10752

After:

  # Uint24.(of_uint32 (Uint32.of_int 42) |> to_int);;
  - : int = 42
  # Uint24.(of_uint32 (Uint32.of_int 42) |> to_int);;
  - : int = 42

Closes andrenth#40
rixed added a commit to rixed/ocaml-stdint that referenced this issue Feb 4, 2020
int24 was wrong on 64bits arch only, whereas uint24 was wrong for all
archs.

Before:

  # Uint24.(of_uint32 (Uint32.of_int 42) |> to_int);;
  - : int = 10752
  # Int24.(of_int32 (Int32.of_int 42) |> to_int);;
  - : int = 10752

After:

  # Uint24.(of_uint32 (Uint32.of_int 42) |> to_int);;
  - : int = 42
  # Uint24.(of_uint32 (Uint32.of_int 42) |> to_int);;
  - : int = 42

Closes andrenth#40

(cherry picked from commit 142ce47)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant