[前][次][番号順一覧][スレッド一覧]

ruby-changes:42854

From: nobu <ko1@a...>
Date: Fri, 6 May 2016 14:55:59 +0900 (JST)
Subject: [ruby-changes:42854] nobu:r54928 (trunk): random.c: sipseed_keys_t

nobu	2016-05-06 15:52:35 +0900 (Fri, 06 May 2016)

  New Revision: 54928

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54928

  Log:
    random.c: sipseed_keys_t
    
    * random.c (sipseed): separate type of keys to reduce use of the
      magic number.

  Modified files:
    trunk/random.c
Index: random.c
===================================================================
--- random.c	(revision 54927)
+++ random.c	(revision 54928)
@@ -1455,9 +1455,10 @@ random_s_rand(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/random.c#L1455
 #include "siphash.c"
 
 static st_index_t hashseed;
+typedef uint8_t sipseed_keys_t[16];
 static union {
-    uint8_t key[16];
-    uint32_t u32[(16 * sizeof(uint8_t) - 1) / sizeof(uint32_t)];
+    sipseed_keys_t key;
+    uint32_t u32[type_roomof(sipseed_keys_t, uint32_t)];
 } sipseed;
 
 static void

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]