From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA02889; Tue, 3 Jul 2001 20:22:05 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA02955 for ; Tue, 3 Jul 2001 20:22:04 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f63IM3j01815 for ; Tue, 3 Jul 2001 20:22:03 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id LAA21960; Tue, 3 Jul 2001 11:21:58 -0700 (PDT) Date: Tue, 3 Jul 2001 11:21:58 -0700 (PDT) From: Brian Rogoff To: jarvarvar@airtel.net cc: caml-list@inria.fr Subject: Re: [Caml-list] Using 16 bits integers In-Reply-To: <23ae62237bc3.237bc323ae62@airtel.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>From the manual section on Bigarray: Big arrays can only contain integers and floating-point numbers, while Caml arrays can contain arbitrary Caml data types. However, big arrays provide more space-efficient storage of integer and floating-point elements, in particular because they support ``small'' types such as single-precision floats and 8 and 16-bit integers, in addition to the standard Caml types of double-precision floats and 32 and 64-bit integers. ... type int16_signed_elt type int16_unsigned_elt It's an interesting question in general as to what should be the basic types of the language, should we have modular types, unicode characters, etc. I have similar issues in that a standard file format that I use a lot specifies 32 bit integers and if I want to follow that exactly I need to use the less performant int32 rather than the 31 bit int on 32 bit machines. Fortunately, that problem will be lessened when we enter the 64 bit world. BTW, if you still find the need to go to C, you can use the Bigarray code as a template to start from so that you can link your C into OCaml. -- Brian On Tue, 3 Jul 2001 jarvarvar@airtel.net wrote: > Hello, I'm just new to OCaml. I'm writing a program wich uses a lot of > 16 bits operations, and writes them to a buffer. For writing into the > buffer, it is needed for the data to be in 16 bits, not in 32 bits. > Exactly, the program is like a sound synthesizer, so data cannot be send > to sound card in 32 bits. > My problem with OCaml is: how can I manage 16 bits data, and make > operations with it? I had not seen any type in Ocaml with 16bits lenght > (int is 32 bits in my machine). This will frustate my project if I do > not find a solution, so I will use C if there is no other solution... > but I would not like to do if I can avoid it, because I like very much > Ocaml. > > I'm hopping your answers. Thanks. > > ------------------- > 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 > ------------------- 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