[#33948] Schedule for the 1.8.7 release — "Akinori MUSHA" <knu@...>
Hi, developers,
[#33955] --encoding affects script encoding — sheepman <sheepman@...>
こんばんは sheepman です。
なかだです。
[#33962] Ruby1.9.0でのインタプリタ組み込みについての質問 — Masayuki Yamaguchi <Yamaguchi.Masayuki@...>
山口と申します。
[#33966] Re: [ruby-cvs:22881] Ruby:r15644 (trunk): * test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): test — Tanaka Akira <akr@...>
In article <[email protected]>,
まつもと ゆきひろです
[#33974] Test::Unit::Collector::Dirがtest_*.rb以外集めてくれない — "Ken Date" <itacchi@...>
こんにちは、伊達です。
[#33983] Re: [ruby-cvs:22913] Re: Ruby:r15674 (trunk): * gc.c (add_heap): sort heaps array in ascending order to use — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
In article <[email protected]>,
[#34011] Should --verbose be equal to -v ? — Yugui <yugui@...>
Yuguiです。
まつもと ゆきひろです
西山和広です。
Yuguiです。
[#34020] MurmurHash problem — Nobuyoshi Nakada <nobu@...>
なかだです。
[#34030] uint32_t — KIMURA Koichi <kimura.koichi@...>
木村です。
[#34037] Ruby performance gains on SPARC — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
[#34067] Array#take,take_while,drop,drop_whlie — "Yusuke ENDOH" <mame@...>
遠藤と申します。
[#34068] lgamma_r requires _REENTRANT on Solaris — "Yusuke ENDOH" <mame@...>
遠藤と申します。
[#34077] 異なるエンコーディングだと同じバイト列でも==にならない件 — rubikitch@...
るびきちです。
[#34086] extend spawn to change attributes of child process. — Tanaka Akira <akr@...>
spaen, system, exec, IO.popen で、起動する子プロセスの属性を
[#34093] 拡張ライブラリ初期化中でのmodule_eval — Kouhei Sutou <kou@...>
須藤です。
[#34095] (再送) Cygwin で Resolv.getaddress が失敗する — Kouhei Yanagita <yanagi@...>
こんにちは。柳田です。
こんばんは、植田と申します。
柳田です。
[#34105] rational.rb, complex.rb and mathn.rb — Tadayoshi Funaba <tadf@...>
rational と complex が組み込みになったことで、lib/mathn.rb の意義は薄
現時点で rational.rb と complex.rb を残しているのは、それが無難だから
で、かなり選択肢を絞った叩き台です。
けいじゅ@いしつかです.
原です。
> 私も Complex の組み込みは Rational とは比較にならないくらい、仕様が決め
まつもと ゆきひろです
> Mathモジュールは伝統的にlibmのラッパーであったので、それを逸
原です。
> (1) (-8)**Rational(1,2) は複素数1.0+1.7320508*i
[#34109] LP64: date.rb:321:in `convert': integer 86400000000000 too big to convert to `int' (RangeError) — Tanaka Akira <akr@...>
LP64 なマシンで test-all が動かなくなっています。
[#34144] [質問2点] C からの定数参照 & thread switching コストの低減 — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
[#34158] Complex組み込み — Masahiro TANAKA <masa16.tanaka@...>
Complexが組み込みになるそうですが、これはcomplex.rbを踏襲して、
原です。
> 今までの Complex は、complex.rb にほぼ残して、たとえば Rational 成分
原です。
> そうです。Complex が難しい、という話を書いておくと、
まつもと ゆきひろです
> |僕としては、/ 演算子の振舞いについて前向きに検討してほしいです。
まつもと ゆきひろです
> ふむ。では、/ のふるまいを
まつもと ゆきひろです
> |僕は、quo がいいと思います。
まつもと ゆきひろです
> となるようですが、別の実装として、
田中です。
> 最初に言っておきますが、気を悪くされたのならすみません。
村田です.
[#34159] ruby-trunk Marshal.dump bug — nagachika <rucila@...>
nagachika と申します。
[#34163] Array#shift/unshift の高速化 — wanabe <s.wanabe@...>
ワナベと申します。
[#34189] Re: [ruby-cvs:23106] Re: Ruby:r15866 (trunk): * numeric.c (num_quo): should convert its operand to Rational. — Tadayoshi Funaba <tadf@...>
間違って送ったので、再送。
> > > Log:
[ruby-dev:34026] Re: MurmurHash problem
成瀬です。 というわけで、int32_t, uint32_t, intptr_t, uintptr_t を定義しつつ、 hash() をアライメント考慮させるパッチです。 U.Nakamura wrote: > | あとは int と long の使い分けでしょうか。なんとなく、 > | * int はただの整数。 > | * long は文字列長や文字位置等、ポインタとの演算が行われうるもの。 > | かなぁと思っているのですが、LP64 だとint において 64bit 化の恩恵が受けられず、 > | LLP64 だと int == long != *void なので long を分ける意義がないなぁとか。 > | 後者は intptr_t にしてもよさそうな気もします。 > > longを禁止にすると私が喜ぶような気がします。 > が、世界中の拡張ライブラリ作者が泣くんじゃないですかね。 禁止は「ぎゃっ」どころのさわぎじゃなさそうですが、 Ruby 本体からの追放と非推奨化はできそうですよね。 -- NARUSE, Yui <[email protected]> DBDB A476 FDBD 9450 02CD 0EFC BCE3 C388 472E C1EA
Attachments (1)
--- configure.in (revision 15758)
+++ configure.in (working copy)
@@ -273,6 +273,19 @@ AC_CHECK_SIZEOF(float, 4)
AC_CHECK_SIZEOF(double, 8)
AC_CHECK_SIZEOF(time_t, 0)
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(short, 2)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(long long, 0)
+AC_CHECK_SIZEOF(__int64, 0)
+AC_CHECK_SIZEOF(off_t, 0)
+AC_CHECK_SIZEOF(void*, 4)
+AC_CHECK_SIZEOF(float, 4)
+AC_CHECK_SIZEOF(double, 8)
+AC_CHECK_SIZEOF(time_t, 0)
+
+AC_CHECK_TYPES([int32_t, uint32_t, intptr_t, uintptr_t])
+
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
AC_CHECK_TYPE([$1],
--- include/ruby/defines.h (revision 15758)
+++ include/ruby/defines.h (working copy)
@@ -99,6 +99,51 @@ void xfree(void*);
# define BDIGIT_DBL_SIGNED long
#endif
+/* define additional integer types
+ *
+ * int32_t, uint32_t, intptr_t, uintptr_t is now defined.
+ */
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#ifndef HAVE_INT32_T
+# if SIZEOF_INT == 4
+typedef int int32_t;
+# else
+# error ---->> int32_t is not defined and no available fallbacks. <<----
+# endif
+#endif
+
+#ifndef HAVE_UINT32_T
+# if SIZEOF_INT == 4
+typedef unsigned int uint32_t
+# else
+# error ---->> uint32_t is not defined and no available fallbacks. <<----
+# endif
+#endif
+
+#ifndef HAVE_INTPTR_T
+# if SIZEOF_LONG == SIZEOF_VOIDP
+typedef long intptr_t;
+# elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+typedef long long intptr_t;
+# else
+# error ---->> intptr_t is not defined and no available fallbacks. <<----
+# endif
+#endif
+
+#ifndef HAVE_UINTPTR_T
+# if SIZEOF_LONG == SIZEOF_VOIDP
+typedef unsigned long uintptr_t;
+# elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+typedef unsigned long long uintptr_t;
+# else
+# error ---->> uintptr_t is not defined and no available fallbacks. <<----
+# endif
+#endif
+
#ifdef __CYGWIN__
#undef _WIN32
#endif
--- string.c (revision 15758)
+++ string.c (working copy)
@@ -1686,40 +1686,88 @@ rb_str_concat(VALUE str1, VALUE str2)
}
/* MurmurHash described in http://murmurhash.googlepages.com/ */
-unsigned int
-hash(const unsigned char * data, int len, unsigned int h)
-{
- const unsigned int m = 0x7fd652ad;
- const int r = 16;
+#ifdef WORDS_BIGENDIAN
+#define swap32(x) ((((x)&0xFF)<<24) \
+ |(((x)>>24)&0xFF) \
+ |(((x)&0x0000FF00)<<8) \
+ |(((x)&0x00FF0000)>>8) )
+#define htov32(x) swap32(x)
+#else
+#define htov32(x) x
+#endif
+static uint32_t
+hash(const unsigned char * data, intptr_t len, uint32_t h)
+{
+ const uint32_t m = 0xc6a4a793;
+ const int32_t r = 16;
+ intptr_t align = (intptr_t)data & 3;
h += 0xdeadbeef;
- while(len >= 4) {
- h += *(unsigned int *)data;
- h *= m;
- h ^= h >> r;
+ if (len < 4) {
+ }
+ else if(align) {
+ uint32_t t = 0, d = 0, sl = 8 * (4-align), sr = 8 * align;
+ intptr_t pack;
+
+ switch(align) {
+ case 1: t |= data[2] << 16;
+ case 2: t |= data[1] << 8;
+ case 3: t |= data[0];
+ default:t <<= (8 * align);
+ }
+ data += 4-align;
+ len -= 4-align;
+
+ while (len >= 4) {
+ d = htov32(*(uint32_t *)data);
+ t = (t >> sr) | (d << sl);
+ h += t;
+ h *= m;
+ h ^= h >> r;
+ t = d;
+ data += 4;
+ len -= 4;
+ }
+
+ pack = len < align ? len : align;
+ d = 0;
+ switch(pack) {
+ case 3: d |= data[2] << 16;
+ case 2: d |= data[1] << 8;
+ case 1: d |= data[0];
+ case 0: h += (t >> sr) | (d << sl);
+ h *= m;
+ h ^= h >> r;
+ }
+ data += pack;
+ len -= pack;
+ }
+ else {
+ while (len >= 4) {
+ h += htov32(*(uint32_t *)data);
+ h *= m;
+ h ^= h >> r;
- data += 4;
- len -= 4;
+ data += 4;
+ len -= 4;
+ }
}
- switch(len) {
- case 3:
- h += data[2] << 16;
- case 2:
- h += data[1] << 8;
- case 1:
- h += data[0];
+ switch(len)
+ {
+ case 3: h += data[2] << 16;
+ case 2: h += data[1] << 8;
+ case 1: h += data[0];
h *= m;
h ^= h >> r;
- };
-
+ }
h *= m;
h ^= h >> 10;
h *= m;
h ^= h >> 17;
- return h;
+ return (int32_t)h;
}
int