I have now tested my assumptions with gcc:

Nigel@PB-IM2424 ~ $ gcc --version gcc.exe (GCC) 4.5.0 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There i +s NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR +POSE. Nigel@PB-IM2424 ~ $ gcc -Wall tracking.c tracking.c: In function 'check_new': tracking.c:22:5: warning: format '%p' expects type 'void *', but argum +ent 2 has type 'uintptr_t' tracking.c:22:5: warning: format '%p' expects type 'void *', but argum +ent 3 has type 'ptrdiff_t' tracking.c: At top level: tracking.c:26:6: warning: return type of 'main' is not 'int' Nigel@PB-IM2424 ~ $ cat tracking.c #include <stdio.h> #define __STDC_LIMIT_MACROS #include <stdint.h> #include <stddef.h> #define ALIGN_BITS ( sizeof(void*) >> __UINT64_C( 1 ) ) #define BIT_BITS __UINT64_C( 3 ) #define BYTE_BITS __UINT64_C( 14 ) #define SLOT_BITS ( sizeof( void*) * 8 ) - ( ALIGN_BITS + BIT_BITS + + BYTE_BITS ) #define BYTES_PER_SLOT __UINT64_C( 1 ) << BYTE_BITS #define TRACKING_SLOTS 8192 // max. 8192 for 4GB/32-bit machine int check_new( uintptr_t p ) { ptrdiff_t slot = ( p >> ( ALIGN_BITS + BIT_BITS + BYTE_BITS ) ); ptrdiff_t byte = ( p >> ( ALIGN_BITS + BIT_BITS)) & ( BYTE_BITS - + 1 ); ptrdiff_t bit = ( p >> ALIGN_BITS) & ( BIT_BITS - + 1 ); ptrdiff_t nop = p & ( ALIGN_BITS - + 1 ); 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 = __UINT64_C( 123456 ); p < ( __UINT64_C( 1 ) << 34 ); p += ( __UINT64_C( 1 ) << 29 ) ) { check_new( p ); } }

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 Re^10: 64-bit *nix/gcc expertise required by BrowserUk
in thread 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.