]> oss.titaniummirror.com Git - nesc.git/blobdiff - tools/nesc_nx.h
Pristine nesc-1.3.4
[nesc.git] / tools / nesc_nx.h
index c13392c36ac3502cb2cbfb0af997a2bc4486af52..d269bc5f570f525522434e9e3d63f1da44c11b49 100644 (file)
     unsigned byte_offset = offset >> 3;                                        \
     unsigned bit_offset = offset & 7;                                  \
                                                                        \
-    x = x & ((1 << length) - 1);                                       \
+    x = x & (((uint ## bits ## _t)1 << length) - 1);                                   \
                                                                        \
     /* all in one byte case */                                         \
     if (length + bit_offset <= 8) {                                    \
                                                                        \
     while (count + 8 <= length)                                                \
       {                                                                        \
-       x |= (uint ## bits ## _t)(msg[byte_offset++] << count);         \
+       x |= (uint ## bits ## _t)msg[byte_offset++] << count;           \
        count += 8;                                                     \
       }                                                                        \
                                                                        \
     unsigned bit_offset = offset & 7;                                  \
     unsigned count = 0;                                                        \
                                                                        \
-    x = x & ((1 << length) - 1);                                       \
+    x = x & (((uint ## bits ## _t)1 << length) - 1);                                   \
                                                                        \
     /* all in one byte case */                                         \
     if (length + bit_offset <= 8) {                                    \