null+****@clear*****
null+****@clear*****
2012年 3月 4日 (日) 18:38:11 JST
Kouhei Sutou 2012-03-04 18:38:11 +0900 (Sun, 04 Mar 2012)
New Revision: f648722c599420f3eb0c238813da57906c7fa48f
Log:
Ensure casting to uint64_t
TODO: This commit should be reviewed.
Modified files:
lib/groonga_in.h
lib/store.c
Modified: lib/groonga_in.h (+2 -2)
===================================================================
--- lib/groonga_in.h 2012-03-04 18:11:16 +0900 (48e75c7)
+++ lib/groonga_in.h 2012-03-04 18:38:11 +0900 (6a8fa2b)
@@ -431,7 +431,7 @@ typedef int grn_cond;
# elif (defined(__sun) && defined(__SVR4)) /* ATOMIC 64BIT SET */
/* todo */
# define GRN_SET_64BIT(p,v) \
- (void)atomic_swap_64((uint64_t *)(p), (uint64_t)(v))
+ (void)atomic_swap_64(p, v)
# endif /* ATOMIC 64BIT SET */
# ifdef HAVE_MKOSTEMP
@@ -486,7 +486,7 @@ typedef int grn_cond;
# define GRN_BIT_SCAN_REV0 GRN_BIT_SCAN_REV
/* todo */
# define GRN_SET_64BIT(p,v) \
- (void)atomic_swap_64((uint64_t *)(p), (uint64_t)(v))
+ (void)atomic_swap_64(p, v)
# endif /* ATOMIC ADD */
/* todo */
# define GRN_BIT_SCAN_REV(v,r) for (r = 31; r && !((1 << r) & v); r--)
Modified: lib/store.c (+5 -1)
===================================================================
--- lib/store.c 2012-03-04 18:11:16 +0900 (05aa530)
+++ lib/store.c 2012-03-04 18:38:11 +0900 (8aebe5a)
@@ -585,7 +585,11 @@ grn_ja_replace(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_ja_einfo *ei, uint64_t *
goto exit;
}
// smb_wmb();
- GRN_SET_64BIT(&einfo[pos], *ei);
+ {
+ uint64_t *location = (uint64_t *)(einfo + pos);
+ uint64_t value = *((uint64_t *)ei);
+ GRN_SET_64BIT(location, value);
+ }
GRN_IO_SEG_UNREF(ja->io, *pseg);
grn_ja_free(ctx, ja, &eback);
exit :