23 #include "kernel_types.h"
24 #include "ndb_limits.h"
32 BlockNumber blockToMain(Uint32
block){
33 assert(block < (1 << 16));
34 return (BlockNumber)(block & ((1 << NDBMT_BLOCK_BITS) - 1));
38 BlockInstance blockToInstance(Uint32 block){
39 assert(block < (1 << 16));
40 return (BlockNumber)(block >> NDBMT_BLOCK_BITS);
44 BlockNumber numberToBlock(Uint32 main, Uint32 instance)
46 assert(main < (1 << NDBMT_BLOCK_BITS) &&
47 instance < (1 << NDBMT_BLOCK_INSTANCE_BITS));
48 return (BlockNumber)(main | (instance << NDBMT_BLOCK_BITS));
55 NodeId refToNode(Uint32 ref){
56 return (NodeId)(ref & ((1 << 16) - 1));
63 BlockNumber refToBlock(Uint32 ref){
64 return (BlockNumber)(ref >> 16);
72 BlockNumber refToMain(Uint32 ref){
73 return (BlockNumber)((ref >> 16) & ((1 << NDBMT_BLOCK_BITS) - 1));
80 BlockInstance refToInstance(Uint32 ref){
81 return (BlockInstance)(ref >> (16 + NDBMT_BLOCK_BITS));
88 BlockReference numberToRef(Uint32 block, Uint32 node){
89 assert(node < (1 << 16) && block < (1 << 16));
90 return (BlockReference)(node | (block << 16));
97 BlockReference numberToRef(Uint32 main, Uint32 instance, Uint32 node){
98 assert(node < (1 << 16) &&
99 main < (1 << NDBMT_BLOCK_BITS) &&
100 instance < (1 << NDBMT_BLOCK_INSTANCE_BITS));
101 return (BlockReference)(node |
103 (instance << (16 + NDBMT_BLOCK_BITS)));