aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lauxlib.c b/lauxlib.c
index f48060ed..634c85cd 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1131,8 +1131,11 @@ static void warnfon (void *ud, const char *message, int tocont) {
1131/* Size for the buffer in int's, rounded up */ 1131/* Size for the buffer in int's, rounded up */
1132#define BUFSEED ((BUFSEEDB + sizeof(int) - 1) / sizeof(int)) 1132#define BUFSEED ((BUFSEEDB + sizeof(int) - 1) / sizeof(int))
1133 1133
1134 1134/*
1135#define addbuff(b,v) (memcpy(b, &(v), sizeof(v)), b += sizeof(v)) 1135** Copy the contents of variable 'v' into the buffer pointed by 'b'.
1136** (The '&b[0]' disguises 'b' to fix an absurd warning from clang.)
1137*/
1138#define addbuff(b,v) (memcpy(&b[0], &(v), sizeof(v)), b += sizeof(v))
1136 1139
1137 1140
1138static unsigned int luai_makeseed (void) { 1141static unsigned int luai_makeseed (void) {
@@ -1146,7 +1149,7 @@ static unsigned int luai_makeseed (void) {
1146 /* fill (rare but possible) remain of the buffer with zeros */ 1149 /* fill (rare but possible) remain of the buffer with zeros */
1147 memset(b, 0, sizeof(buff) - BUFSEEDB); 1150 memset(b, 0, sizeof(buff) - BUFSEEDB);
1148 res = buff[0]; 1151 res = buff[0];
1149 for (i = 0; i < BUFSEED; i++) 1152 for (i = 1; i < BUFSEED; i++)
1150 res ^= (res >> 3) + (res << 7) + buff[i]; 1153 res ^= (res >> 3) + (res << 7) + buff[i];
1151 return res; 1154 return res;
1152} 1155}