Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:48

0001 #pragma once
0002 /**
0003 st : complete binary tree expressions 
0004 ========================================
0005 
0006 cf with CSG/csg_postorder.h that is used on GPU for these 
0007 
0008 
0009 // tree_nodes_ = lambda height:( (0x1 << (1+(height))) - 1 ) 
0010 
0011 **/
0012 
0013 #include <cstdint>
0014 
0015 struct st
0016 {
0017     static constexpr const uint64_t ONE = 1 ;  
0018     static uint64_t complete_binary_tree_nodes(uint64_t height) ; 
0019 
0020     static constexpr uint64_t MAX_TREE_DEPTH = 64;
0021 };
0022 
0023 inline uint64_t st::complete_binary_tree_nodes(uint64_t height)
0024 {
0025     assert(height < MAX_TREE_DEPTH); // avoid integer overflow
0026     return ( (ONE << (ONE+(height))) - ONE ) ; 
0027 }
0028 
0029