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 BAA03558; Wed, 10 Oct 2001 01:16:51 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA02464 for ; Wed, 10 Oct 2001 01:16:50 +0200 (MET DST) Received: from mta01-svc.ntlworld.com (mta01-svc.ntlworld.com [62.253.162.41]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f99NGn929752 for ; Wed, 10 Oct 2001 01:16:50 +0200 (MET DST) Received: from htec.demon.co.uk ([62.252.180.24]) by mta01-svc.ntlworld.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20011009231648.XGTN15984.mta01-svc.ntlworld.com@htec.demon.co.uk>; Wed, 10 Oct 2001 00:16:48 +0100 Message-ID: <3BC38665.5F0A6729@htec.demon.co.uk> Date: Wed, 10 Oct 2001 00:21:09 +0100 From: Christopher Quinn X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.4.0-test6 i686) X-Accept-Language: en MIME-Version: 1.0 To: Berke Durak CC: caml-list@inria.fr Subject: [Caml-list] Re: Some suggested improvements to the Graphics and Bigarray modules References: <20011009233142.A10140@gogol.zorgol> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > As a palliative a function for > inter-converting portions of Bigarrays and strings would be welcome, > as access to strings is much faster. > If you don't mind giving up a bit of safety the following may help. Chris Q. module UnsafeStringOps = struct (* Warning: No bounds checking!!!! Coredump grade hack *) let ba2str : ('a,'b,'c) Bigarray.Array1.t -> string = fun arr -> Obj.obj (Obj.field (Obj.repr arr) 1) (* Or more properly: external ba2str: ('a,'b,'c) Bigarray.Array1.t -> string ="ba2str" where from C you put: #include value ba2str(value arr){ return Data_bigarray_val(arr); } *) let blit = String.unsafe_blit let fill = String.unsafe_fill let set = String.unsafe_set let get = String.unsafe_get end ------------------- 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