
8 I Rendering
1 atomic_uint firstFreeCell = gScreenSize ;
2 Data databuf [ gBufferSize ];
3 uint64_t buffer [ gBufferSize + gScreenSize ];
4
5 uint64_t pack ( uint32_t depth , uint32_t next ) {
6 return (( uint64_t) depth << 32) | next ;
7 }
8
9 void insertFrontPack ( x , y , uint32_t depth , data ) {
10 const int fresh = atomicCounterIncrement ( firstFreeCell );
11 databuf [ fresh−gScreenSize ]=data ;
12 buffer [ fresh ]=atomicExchange ( buffer+x+y gScreenW ,
13 pack ( depth , fresh ));
14 }
Listing 1.2. Insertion at the head of a linked list with packing.
1.2.2 Packing depth and next Together
In order to facilitate the understanding of later sections and