Uint32_t

e$BLZB<$G$9!#e(B

[email protected]$1$G$9!#e(B

01:53 Tuesday ruby
Commit by matz :: r15743 /trunk/ (ChangeLog string.c):

* string.c (hash): replaced by MurmurHash described in 

http://murmurhash.googlepages.com/.

[email protected]$N7k2L!"e(Buint32_te$B$d$i$=$NJU$NDj5A$,$J$$%3%s%Q%$%i$Ge(B
e$B%S%k%I$G$-$J$/$J$C$F$$$^$9!#e(B

e$B$?$V$se(B ruby-dev 34026
[email protected]@%$5$s$N%Q%C%A$,E,MQ$5$l$l$P%S%k%I$G$-$k$h$&$Ke(B
e$B$J$k$H;W$$$^$9$,;n$7$F$$$^$;$se(B(uint32_te$B$r<+A0$GDj5A$7$F%S%k%I$G$-$k$N$Oe(B
e$B3NG’$7$F$$$^$9e(B)e$B!#e(B

e$B$=$l$G$O!#e(B

/dev/null
e$B$^$D$b$H$5$s!“4h$J$J$^$G$Ke(Bansi
e$B%9%?%$%k$N4X?t867?$r;H$&$N$r7y$,$C$Fe(B
e$B$$$?$N$K!“e(BC99e$B$N5!G=$r;[email protected]$r$,$7$,$7$7$F$$$F!”%S%k%I$G$-$^$;!<$se(B
e$B$H$$$&$N$,2?2s$b$”$k$H$$$&$N$bHiFy$H$$$&$+$J$s$H$$$&$+!#e(B

e$B$$$d$^$"4X?t867?$He(B C99e$B$H$O4X78$J$$$C$A$c$J$$$G$9$1$Ie(B

[email protected]@%$G$9!#e(B

KIMURA Koichi wrote:

e$B%S%k%I$G$-$J$/$J$C$F$$$^$9!#e(B
e$B$3$N;[email protected]$G$Oe(B uint32_t e$B$G$J$/e(B unsigned int e$B$J$N$G<B:]$Ke(B
uint32_t e$B$K$J$k$N$Oe(B r15760 e$B$G$9$M!#e(B
e$B$J$K$O$H$b$"$le(B r15762
e$B$G%S%k%I$ODL$k$h$&$K$J$C$F$$$k$H;W$$$^$9!#e(B

[email protected]!"e(BMurmurHash e$B$N0U?^$7$F$$$k5!G=$OH/4x$5$l$F$$$J$/$F!“e(B
h e$BEy$be(B unsigned int e$B$G$J$/e(B int32_t
e$B$K$9$kI,MW$,$”$k$H;W$$$^$9!#e(B
e$B$^$?!"e(Bm e$B$N=i4|CM$,:G?7HG$G$Oe(B 0x7fd652ad e$B$+$ie(B
0xc6a4a793 e$B$KJQ99$5$l$F$$$k$N$G!"e(B
e$B$3$l$bDI=>$7$?J}$,$$$$$G$7$g$&!#e(B
e$B$5$i$K!"e(Balign e$B$de(B pack e$B$Oe(B len
e$B$H1i;;$,9T$o$l$k$N$G!"7?$r$=$m$($?J}$,$$$$$+$b$7$l$^$;$s!#e(B

— string.c (revision 15762)
+++ string.c (working copy)
@@ -1697,20 +1697,21 @@ rb_str_concat(VALUE str1, VALUE str2)
#endif

/* MurmurHash described in http://murmurhash.googlepages.com/ */
-unsigned int
-hash(const unsigned char * data, int len, unsigned int h)
+uint32_t
+hash(const unsigned char * data, long len, uint32_t h)
{

  • const unsigned int m = 0x7fd652ad;
  • const unsigned int m = 0xc6a4a793;
    const int r = 16;

    h += 0xdeadbeef;

    if (len >= 4) {
    #if !UNALIGNED_WORD_ACCESS

  •   int align = (VALUE)data & 3;
    
  •   long align = (VALUE)data & 3;
      if (align) {
          uint32_t t = 0, d = 0;
    
  •       int sl, sr, pack;
    
  •       uint32_t sl, sr;
    
  •       long pack;
    
          switch (align) {
    

#ifdef WORDS_BIGENDIAN

e$B$J$!"$3$Ne(B hash() e$B$Oe(B static
e$B$,$D$$$F$$$^$;$s$,!"e(Bintern.h e$B$K$b5-=R$5$l$F$$$^$;$s$7!"e(B
e$BB>$N%U%!%$%k$+$i;[email protected]$b$J$/!"L>A0$,0lHLE
$J$"$?$j$+$i!"e(B
e$BHs8x3+$r0U?^[email protected]$H?dB,$7$?$N$G$9$,!"e(Bstatic
e$B$N$7$?J}$,$$$$$N$G$O$J$$$G$7$g$&$+!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34032] Re: uint32_t”
on Mar.13,2008 17:30:41, [email protected] wrote:
| e$B$3$N;[email protected]$G$Oe(B uint32_t e$B$G$J$/e(B unsigned int e$B$J$N$G<B:]$Ke(B uint32_t e$B$K$J$k$N$Oe(B r15760 e$B$G$9$M!#e(B
| e$B$J$K$O$H$b$"$le(B r15762 e$B$G%S%k%I$ODL$k$h$&$K$J$C$F$$$k$H;W$$$^$9!#e(B

ext/digest/defs.he$B$Ge(Buint32_te$B$re(Btypedefe$B$7$h$&$H$7$F$$$k$;$$$G!"e(B
inttypes.he$B$,$J$$4D6-$G$O%S%k%I$,DL$i$J$$$h$&$K$J$C$F$^$9$,e(B :slight_smile:

e$B$3$l$I$&$7$^$7$g$&$+$M!#e(B
uint8_te$B$He(Buint64_t(e$B2DG=$J$ie(B)e$B$be(Brubye$B$GMQ0U$9$k$h$&$K$7$F$3$NJU$^e(B
e$B$k$4$H>C$9$N$,$$$$$s$G$9$+$M!#e(B

e$B$=$l$G$O!#e(B

成瀬です。

U.Nakamura wrote:

るごと消すのがいいんですかね。
とりあえずこんな感じでどうでしょう。

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34040] Re: uint32_t”
on Mar.14,2008 10:15:29, [email protected] wrote:
| > ext/digest/defs.he$B$Ge(Buint32_te$B$re(Btypedefe$B$7$h$&$H$7$F$$$k$;$$$G!“e(B
| > inttypes.he$B$,$J$$4D6-$G$O%S%k%I$,DL$i$J$$$h$&$K$J$C$F$^$9$,e(B :slight_smile:
| >
| > e$B$3$l$I$&$7$^$7$g$&$+$M!#e(B
| > uint8_te$B$He(Buint64_t(e$B2DG=$J$ie(B)e$B$be(Brubye$B$GMQ0U$9$k$h$&$K$7$F$3$NJU$^e(B
| > e$B$k$4$H>C$9$N$,$$$$$s$G$9$+$M!#e(B
|
| e$B$H$j$”$($:$3$s$J46$8$G$I$&$G$7$g$&!#e(B

Windowse$BB&$NFbMF$KB?>/$NLdBj$,$J$/$b$J$$$G$9$,!"$=$NJU$OF~$C$?e(B
e$B$iD>$9$N$G$$$$$3$H$K$7$^$9!#e(B
e$B$H$$$&$o$1$G!"F~$l$F$[$7$$$G$9!#e(B

e$B$=$l$G$O!#e(B

[email protected]@%$G$9!#e(B

U.Nakamura wrote:

|
| e$B$H$j$"$($:$3$s$J46$8$G$I$&$G$7$g$&!#e(B

Windowse$BB&$NFbMF$KB?>/$NLdBj$,$J$/$b$J$$$G$9$,!"$=$NJU$OF~$C$?e(B
e$B$iD>$9$N$G$$$$$3$H$K$7$^$9!#e(B
e$B$H$$$&$o$1$G!"F~$l$F$[$7$$$G$9!#e(B

e$BF~$l$^$7$?!#e(B

e$B$3$A$i$Ge(BWindows e$BIw$KD>$=$&$+$H$b;W$C$?$N$G$9$,!"e(B
e$B$I$N7?$r;H$($P$$$$$+$o$+$i$J$+$C$?$N$G$h$m$7$/$*$M$,$$$7$^$9!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34043] Re: uint32_t”
on Mar.14,2008 11:01:40, [email protected] wrote:
| > Windowse$BB&$NFbMF$KB?>/$NLdBj$,$J$/$b$J$$$G$9$,!"$=$NJU$OF~$C$?e(B
| > e$B$iD>$9$N$G$$$$$3$H$K$7$^$9!#e(B
| > e$B$H$$$&$o$1$G!"F~$l$F$[$7$$$G$9!#e(B
|
| e$BF~$l$^$7$?!#e(B
|
| e$B$3$A$i$Ge(BWindows e$BIw$KD>$=$&$+$H$b;W$C$?$N$G$9$,!"e(B
| e$B$I$N7?$r;H$($P$$$$$+$o$+$i$J$+$C$?$N$G$h$m$7$/$*$M$,$$$7$^$9!#e(B

e$B$$$d!"C1$K:rF|F~$l$?e(Buint32_te$B$NDj5A$,;D$C$F$k$+$i=EJ#$K$J$C$Fe(B
e$B$?$N$H!“e(Bbcc32/Makefile.sube$B$,%9%k!<$5$l$F$$$?$N$H!”$,LdBj$G$7e(B
e$B$?!#e(B

e$B$"$H!"e(BWindowse$B$Oe(Bintptr_te$B$He(Buintptr_te$B$O;}$C$F$$$ke(B(e$B;}$C$F$$$J$$>le(B
e$B9g$Oe(Bruby.he$B$GMQ0U$7$F$$$ke(B)e$B$N$G$=$NDj5A$b>C$7$^$7$?!#e(B

e$B$=$l$G$O!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs