<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/f965cfe7869fbbf1d10dcfc9a4ef52ea"
  from="Andrew Lenharth &lt;andrewl@d...&gt;"
  author="Andrew Lenharth"
  date="2003-11-07T03:59:13"
  subject="Re: [Caml-list] A grave bug in logical shift right op?"
  prev="2003/11/944504cb86937958edfda29223507e1c"
  next="2003/11/c476429bdc04d501fe234399b1022dcc"
  prev-in-thread="2003/11/c476429bdc04d501fe234399b1022dcc"
  prev-thread="2003/11/b3c779c49bd7be546f1e9fe0756e7d3d"
  next-thread="2003/11/8bac1133214edc5aaff0c5dae8053b9e"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] A grave bug in logical shift right op?">
<msg 
  url="2003/11/140c9fadd8e2355539503a016bc1e217"
  from="Eray Ozkural &lt;exa@k...&gt;"
  author="Eray Ozkural"
  date="2003-11-07T03:35:12"
  subject="[Caml-list] A grave bug in logical shift right op?">
<msg 
  url="2003/11/6c51cac155fc19a70c332c51f09bb199"
  from="Jed Davis &lt;jdev@p...&gt;"
  author="Jed Davis"
  date="2003-11-07T03:46:32"
  subject="[Caml-list] Re: A grave bug in logical shift right op?">
</msg>
<msg 
  url="2003/11/944504cb86937958edfda29223507e1c"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-11-07T03:53:40"
  subject="Re: [Caml-list] A grave bug in logical shift right op?">
<msg 
  url="2003/11/c476429bdc04d501fe234399b1022dcc"
  from="Eray Ozkural &lt;exa@k...&gt;"
  author="Eray Ozkural"
  date="2003-11-07T06:22:33"
  subject="Re: [Caml-list] A grave bug in logical shift right op?">
</msg>
</msg>
<msg 
  url="2003/11/f965cfe7869fbbf1d10dcfc9a4ef52ea"
  from="Andrew Lenharth &lt;andrewl@d...&gt;"
  author="Andrew Lenharth"
  date="2003-11-07T03:59:13"
  subject="Re: [Caml-list] A grave bug in logical shift right op?">
</msg>
</msg>
</thread>

<contents>
Section 6.2.1 of the manual is useful:
Integer values are integer numbers from -2^30 to 2^30-1, that is -1073741824 to 1073741823. The implementation may support a wider range of integer values: on 64-bit platforms, the current implementation supports integers ranging from -2^62 to 2^62-1.

You are experiencing overflow.  One bit of integers are used for tagging purposes (if I recall correctly).  Int32 is a boxed type.

Andrew Lenharth

On Fri, Nov 07, 2003 at 05:34:59AM +0200, Eray Ozkural wrote:
&gt; I'm using the debian package in testing....
&gt; 
&gt; orion:fealn-attack$ ledit ocaml
&gt;         Objective Caml version 3.07+2
&gt; 
&gt; # Printf.printf "%X" 0xffffffff;;
&gt; 7FFFFFFF- : unit = ()
&gt; # Printf.printf "%lx" (Int32.of_int 0xffffffff);;
&gt; ffffffff- : unit = ()
&gt; # -1 lsr 24;;
&gt; - : int = 127
&gt; # Int32.shift_right_logical (Int32.of_int (-1)) 24;;
&gt; - : int32 = 255l
&gt; 
&gt; What's going on here? Something's eating the most significant bit in
&gt; both hexadecimal output routine and the logical shift right
&gt; operator. Somebody please help me! My cipher isn't working!!!
&gt; 
&gt; Confused,
&gt; 
&gt; -- 
&gt; Eray Ozkural (exa) &lt;erayo@cs.bilkent.edu.tr&gt;
&gt; Comp. Sci. Dept., Bilkent University, Ankara  KDE Project: http://www.kde.org
&gt; www: http://www.cs.bilkent.edu.tr/~erayo  Malfunction: http://mp3.com/ariza
&gt; GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C
&gt; 
&gt; -------------------
&gt; To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
&gt; Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
&gt; Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

-- 
"The reasonable man adapts himself to the world; the unreasonable 
one persists in trying to adapt the world to 
himself. Therefore all progress depends on the unreasonable man."
-- George Bernard Shaw

No matter how cynical you become, it's never enough to keep up.
-- Lily Tomlin

Fools ignore complexity; pragmatists suffer it; experts avoid it; 
geniuses remove it.
-- A. Perlis

-------------------
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

</contents>

</message>

