English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Suggestion for Int32.rotate
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-06 (21:49)
From: Berke Durak <berke@a...>
Subject: Re: [Caml-list] Suggestion for Int32.rotate
On Wed, Feb 06, 2002 at 07:01:51PM +0100, Xavier Leroy wrote:
> > 2) A syntax extension (or extension to the standard syntax) for
> > entering Int32 and Int64 constants. 
> This has been on my to do list for a while.  The main issue is finding
> a decent syntax...  (All discussions on this list seem to converge on
> syntax these days, that's awful :-) We have three "big integer" types:
> int32, nativeint and int64.  A C-style syntax would be 12345L for
> int32 and 123456789LL for int64; what about nativeint?  12345N ?
> Anything nicer?

I'd suggest lowercase 'l' for 32-bit and uppercase 'L' for 64-bit :

	0xffffffffl = -1	32-bit signed
	0xffffffffffffffffL = -1 (64-bit signed)
	1239884378742340923094029042n   bigint

Maybe 'z' instead of 'n' sound better ?

> > 3) A hack into Printf to remove the need to use Int32.format
> Printf support was added in 3.04: "%ld", "%nd", "%Ld" for int32,
> nativeint and int64 respectively.

Wonderful, that's a good reason to upgrade.

> More generally speaking, I don't think basic ciphers and hash
> functions really benefit from being rewritten in Caml.
> [...] So, why not just interface with existing C
> implementations -- with the additional benefits that someone else
> already debugged and performance-tweaked them?

Granted that Caml doesn't make coding low-level cryptographic
primitives (at least, usual bit-fiddling ones) easier or safer.
However, when you want to implement a new crypto algorithm to do some
empirical cryptanalysis on it (statistical tests etc.) it's painful to
have to implement it in C, then interface C to Caml. I'd rather write
it directly in Caml. Being able to interface to C is an excellent
feature, but I'd also like to be able to do everything reasonably
efficiently in Caml. Further, if I write my algorithms in Caml, one
day if the compiler becomes smart enough it can be as efficient as C.

So, what about the rotate ?
Berke Durak
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr