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
[oliver: Re: [Caml-list] Strings as arrays or lists...]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-04 (16:11)
From: William D. Neumann <wneumann@c...>
Subject: Re: [Caml-list] [RANT] String representation (was: Strings as arrays or lists...)
On Tue, 4 Mar 2003, Diego Olivier Fernandez Pons wrote:

> > - there is a buffer type which is a byte array for low-level
> > operations, and conversion functions between buffers and strings,
> > with several possible encodings;
> Yes... strings.

Unfortunately strings don't act like byte arrays (to the best of my
knowledge anyway -- I'd love to find out I'm wrong).  If you want to do
any low level operations on the bytes, you first need to convert the chars
to ints (and by low level, I'm talking about shifts, rotates, ands, ors,
xors, etc), perform your ops, then convert back to chars before
re-inserting them into the string, and this is slooooow.

Since I do crypto for a living, I run into these problems all the time.
fortunately, they haven't forced me to drop OCaml for C in general, but I
have had to step back into C for a couple of programs that really needed
the extra speed boost.  Efficient byte and word arrays would be wonderful
tools to add to my chest.

William D. Neumann


"Well I could be a genius, if I just put my mind to it.
And I...I could do anything, if only I could get 'round to it.
Oh we were brought up on the space-race, now they expect you to clean toilets.
When you've seen how big the world is, how can you make do with this?
If you want me, I'll be sleeping in - sleeping in throughout these glory days."

	-- Jarvis Cocker

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners