relay.h: fix strict aliasing warning
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 19 Jun 2009 21:28:29 +0000 (17:28 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 19 Jun 2009 21:28:29 +0000 (17:28 -0400)
submitted by Jan Blunck

libust/relay.h

index 630c4eacc5ebd3e43995d93eb06920b7719a98dc..ba7c1d63aa2d10c35349bf2d86b70e9000228e04 100644 (file)
@@ -215,16 +215,24 @@ static inline struct buf_page *ltt_relay_cache_page(struct rchan_buf *buf,
 //ust// #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  static inline void ltt_relay_do_copy(void *dest, const void *src, size_t len)
 {
+       union {
+               const void *src;
+               const u8 *src8;
+               const u16 *src16;
+               const u32 *src32;
+               const u64 *src64;
+       } u = { .src = src };
+
        switch (len) {
        case 0: break;
-       case 1: *(u8 *)dest = *(const u8 *)src;
+       case 1: *(u8 *)dest = *u.src8;
                break;
-       case 2: *(u16 *)dest = *(const u16 *)src;
+       case 2: *(u16 *)dest = *u.src16;
                break;
-       case 4: *(u32 *)dest = *(const u32 *)src;
+       case 4: *(u32 *)dest = *u.src32;
                break;
 //ust// #if (BITS_PER_LONG == 64)
-       case 8: *(u64 *)dest = *(const u64 *)src;
+       case 8: *(u64 *)dest = *u.src64;
                break;
 //ust// #endif
        default:
This page took 0.030413 seconds and 4 git commands to generate.