1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can 5 * be found in the LICENSE file. 6 * 7 */ 8 9 #ifndef SKC_ONCE_BLOCK_POOL 10 #define SKC_ONCE_BLOCK_POOL 11 12 // 13 // 14 // 15 16 #include "types.h" 17 18 // 19 // 20 // 21 22 union skc_block_pool_size 23 { 24 skc_uint3 u32v3; 25 26 struct { 27 skc_uint pool_size; // number of blocks 28 skc_uint ring_pow2; // rounded-up pow2 of pool_size 29 skc_uint ring_mask; // ring_pow2 - 1 30 }; 31 }; 32 33 // 34 // 35 // 36 37 union skc_block_pool_atomic 38 { 39 skc_uint2 u32v2; 40 41 skc_uint u32a2[2]; 42 43 struct { 44 skc_uint reads; 45 skc_uint writes; 46 }; 47 }; 48 49 #define SKC_BP_ATOMIC_OFFSET_READS 0 50 #define SKC_BP_ATOMIC_OFFSET_WRITES 1 51 52 // 53 // 54 // 55 56 #endif 57 58 // 59 // 60 // 61