From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA22716 for caml-red; Thu, 31 Aug 2000 20:47:19 +0200 (MET DST) 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 PAA19463 for ; Thu, 31 Aug 2000 15:13:59 +0200 (MET DST) Received: from ropas.kaist.ac.kr (ropas.kaist.ac.kr [143.248.92.105]) by nez-perce.inria.fr (8.10.0/8.10.0) with ESMTP id e7VDDqL25986 for ; Thu, 31 Aug 2000 15:13:53 +0200 (MET DST) Received: from localhost (bskim@localhost) by ropas.kaist.ac.kr (8.9.3/8.9.3) with ESMTP id WAA10442 for ; Thu, 31 Aug 2000 22:13:14 +0900 (KST) Date: Thu, 31 Aug 2000 22:13:14 +0900 (KST) From: Bomshik Kim To: caml-list@inria.fr Subject: How can I treat bits? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis@pauillac.inria.fr In C language, we can define a variable size as a unit of bits. For example, "unsigned int a:1 ;", " unsigned int b:4 ;" .... "colon" is used to set up the number of bits. Can I define OCaml-variables in the same way? Because I want to make some data header by using bits as little as possible. the style that I imagine is... type hd = { flag : int_1 ; on_off : int_1 ; seq_num : int_4 } ;; let header = { flag = 1 ; on_off = 0 ; seq_num = 0101 } ;; Thank you. -BS Kim