Please modify this MS specific C code to compile under gcc on both 32-bit & 64-bit platforma and produce the same output:

#include <stdio.h> #define ALIGN_BITS ( sizeof(void*) >> 1i64 ) #define BIT_BITS 3i64 #define BYTE_BITS 14i64 #define SLOT_BITS ( sizeof( void*) * 8 )-( ALIGN_BITS + BIT_BITS + B +YTE_BITS ) #define BYTES_PER_SLOT 1i64 << BYTE_BITS int check_new( uintptr_t p ) { ptrdiff_t slot = ( p >> (BYTE_BITS + BIT_BITS + ALIGN_BITS) ); ptrdiff_t byte = ( p >> (ALIGN_BITS + BIT_BITS)) & 0x00003fffi64; ptrdiff_t bit = ( p >> ALIGN_BITS) & 0x00000007i64; ptrdiff_t nop = p & 0x3i64; printf( "address: %p slot: %p byte: %4x bit: %4x nop:%x\n", p, slot, byte, bit, nop ); return 1; } void main( void ) { uintptr_t p; for( p = 123456i64; p < ( 1Ui64 << 34 ); p += ( 1Ui64 << 29 ) ) { check_new( p ); } } /* C:\test>tracking address: 000000000001E240 slot: 0000000000000000 byte: 3c4 bit: 4 +nop:0 address: 000000002001E240 slot: 0000000000000100 byte: 3c4 bit: 4 +nop:0 address: 000000004001E240 slot: 0000000000000200 byte: 3c4 bit: 4 +nop:0 address: 000000006001E240 slot: 0000000000000300 byte: 3c4 bit: 4 +nop:0 address: 000000008001E240 slot: 0000000000000400 byte: 3c4 bit: 4 +nop:0 address: 00000000A001E240 slot: 0000000000000500 byte: 3c4 bit: 4 +nop:0 address: 00000000C001E240 slot: 0000000000000600 byte: 3c4 bit: 4 +nop:0 address: 00000000E001E240 slot: 0000000000000700 byte: 3c4 bit: 4 +nop:0 address: 000000010001E240 slot: 0000000000000800 byte: 3c4 bit: 4 +nop:0 address: 000000012001E240 slot: 0000000000000900 byte: 3c4 bit: 4 +nop:0 address: 000000014001E240 slot: 0000000000000A00 byte: 3c4 bit: 4 +nop:0 address: 000000016001E240 slot: 0000000000000B00 byte: 3c4 bit: 4 +nop:0 address: 000000018001E240 slot: 0000000000000C00 byte: 3c4 bit: 4 +nop:0 address: 00000001A001E240 slot: 0000000000000D00 byte: 3c4 bit: 4 +nop:0 address: 00000001C001E240 slot: 0000000000000E00 byte: 3c4 bit: 4 +nop:0 address: 00000001E001E240 slot: 0000000000000F00 byte: 3c4 bit: 4 +nop:0 address: 000000020001E240 slot: 0000000000001000 byte: 3c4 bit: 4 +nop:0 address: 000000022001E240 slot: 0000000000001100 byte: 3c4 bit: 4 +nop:0 address: 000000024001E240 slot: 0000000000001200 byte: 3c4 bit: 4 +nop:0 address: 000000026001E240 slot: 0000000000001300 byte: 3c4 bit: 4 +nop:0 address: 000000028001E240 slot: 0000000000001400 byte: 3c4 bit: 4 +nop:0 address: 00000002A001E240 slot: 0000000000001500 byte: 3c4 bit: 4 +nop:0 address: 00000002C001E240 slot: 0000000000001600 byte: 3c4 bit: 4 +nop:0 address: 00000002E001E240 slot: 0000000000001700 byte: 3c4 bit: 4 +nop:0 address: 000000030001E240 slot: 0000000000001800 byte: 3c4 bit: 4 +nop:0 address: 000000032001E240 slot: 0000000000001900 byte: 3c4 bit: 4 +nop:0 address: 000000034001E240 slot: 0000000000001A00 byte: 3c4 bit: 4 +nop:0 address: 000000036001E240 slot: 0000000000001B00 byte: 3c4 bit: 4 +nop:0 address: 000000038001E240 slot: 0000000000001C00 byte: 3c4 bit: 4 +nop:0 address: 00000003A001E240 slot: 0000000000001D00 byte: 3c4 bit: 4 +nop:0 address: 00000003C001E240 slot: 0000000000001E00 byte: 3c4 bit: 4 +nop:0 address: 00000003E001E240 slot: 0000000000001F00 byte: 3c4 bit: 4 +nop:0 */

Many thanks!


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to 64-bit *nix/gcc expertise required (THIS IS NOT OFF TOPIC!) by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.