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

Feature wish: representation des nats #8314

Closed
vicuna opened this Issue Oct 5, 2003 · 1 comment

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

commented Oct 5, 2003

Original bug ID: 1867
Reporter: administrator
Status: closed (set by @xavierleroy on 2013-08-31T10:46:14Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 3.11.0
Category: ~DO NOT USE (was: OCaml general)

Bug description

Bonjour,

Serait-il possible d'ajouter des fonctions dans les modules Nats et
Big_int pour acceder à la representation des entiers sous forme de
strings? Vu le code de serialize_nat, c'est trivial.

Je ne peux pas utiliser le système de marshaling de Caml sur mes
structures de données, donc j'ai du refaire tout le parcours et le
marshalling à la main. Pour traiter les Big_int.big_int, je vois deux
solutions actuellement: Marshal.to_string ou Big_int.string_of_big_int. Le
premier introduit un gros en-tete (36 octets pour representer l'entier 0),
le deuxième fait des calculs inutiles et utilise moins de 4 bits par octets.

(Au passage, des précisions sur les restrictions d'utilisation de la
bibliothèque Num mentionnées dans la mailing list m'interessent
également).

Alain

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 27, 2012

Comment author: @xavierleroy

The nth_digit_nat_native and set_digit_nat_native of module Nat, introduced in 3.11.0, make it possible to implement the desired feature with good efficiency. My recommendation, however, is to use the ZArith library instead of the Num standard library: ZArith provides conversions to/from bit strings, and is globally superior to Num.

@vicuna vicuna closed this Aug 31, 2013

@vicuna vicuna added the feature-wish label Mar 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.