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 EAA14975; Fri, 7 Nov 2003 04:46:32 +0100 (MET) 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 EAA14819 for ; Fri, 7 Nov 2003 04:46:30 +0100 (MET) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hA73kT118900 for ; Fri, 7 Nov 2003 04:46:29 +0100 (MET) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AHxZs-0004wy-00 for ; Fri, 07 Nov 2003 04:46:28 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AHxZr-0004wq-00 for ; Fri, 07 Nov 2003 04:46:27 +0100 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AHxZr-0008VG-00 for ; Fri, 07 Nov 2003 04:46:27 +0100 From: Jed Davis Subject: [Caml-list] Re: A grave bug in logical shift right op? Date: Thu, 06 Nov 2003 22:46:24 -0500 Organization: Chaotic Message-ID: References: <200311070535.00172.exa@kablonet.com.tr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-PGP-Key: http://panix.com/~jdev/pubkey.asc http://cs.oberlin.edu/~jldavis/pubkey.asc User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (darwin) Cancel-Lock: sha1:jdyaIG0wlu85Ytv5Ec2UIrw+Yoo= X-Loop: caml-list@inria.fr X-Spam: no; 0.00; davis:99 grave:01 bug:01 eray:01 ozkural:01 ledit:01 3.07:01 printf:01 printf:01 cipher:01 davis:99 903:99 807:99 -bit:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Eray Ozkural writes: > I'm using the debian package in testing.... > > orion:fealn-attack$ ledit ocaml > Objective Caml version 3.07+2 > > # Printf.printf "%X" 0xffffffff;; > 7FFFFFFF- : unit = () > # Printf.printf "%lx" (Int32.of_int 0xffffffff);; > ffffffff- : unit = () > # -1 lsr 24;; > - : int = 127 > # Int32.shift_right_logical (Int32.of_int (-1)) 24;; > - : int32 = 255l > > What's going on here? Something's eating the most significant bit in > both hexadecimal output routine and the logical shift right > operator. Somebody please help me! My cipher isn't working!!! The size of an int is one bit less than the machine's word size, so 31 bits on a 32-bit arch; this is because the internal representation of an OCaml value uses the LSB to distinguish between an int (stored in the top n-1 bits) and some other kind of object. -- Jed Davis Selling of self: http://panix.com/~jdev/rs/ PGP<-finger A098:903E:9B9A:DEF4:168F:AA09:BF07:807E:F336:59F9 \ "But life wasn't yes-no, on-off. Life was shades of gray, and rainbows /\ not in the order of the spectrum." -- L. E. Modesitt, Jr., _Adiamante_ ------------------- 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