[PATCH] Error in String docs

Jesper Christensen <[email protected]> Tue, 10 Feb 2009 21:00:01 +0100
Newsgroups gmane.comp.lang.ruby.documentation
Message-ID <[email protected]>
Hi!

My first patch. Hope it's correct. :)

Somebody confused "modulo" and "and" in the docs for String.sum
       <i>str</i> modulo <code>2n - 1</code>
It should be
       <i>str</i> modulo <code>2n</code>
or even better
       <i>str</i> modulo <code>2**n</code>

A patch is pasted in below.

Regards,
Jesper

Index: string.c
===================================================================
--- string.c    (revision 22183)
+++ string.c    (working copy)
@@ -6428,7 +6428,7 @@
  *  Returns a basic <em>n</em>-bit checksum of the characters in  
<i>str</i>,
  *  where <em>n</em> is the optional <code>Fixnum</code> parameter,  
defaulting
  *  to 16. The result is simply the sum of the binary value of each
character in
- *  <i>str</i> modulo <code>2n - 1</code>. This is not a particularly  
good
+ *  <i>str</i> modulo <code>2**n</code>. This is not a particularly  
good
  *  checksum.
  */