MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / py_check_data_alignment

Function py_check_data_alignment

python/bplustree_c_src/bplustree_module.c:287–304  ·  view source on GitHub ↗

Module-level methods for testing and diagnostics */

Source from the content-addressed store, hash-verified

285
286/* Module-level methods for testing and diagnostics */
287static PyObject *
288py_check_data_alignment(PyObject *self, PyObject *args)
289{
290 unsigned int capacity = DEFAULT_CAPACITY;
291 if (!PyArg_ParseTuple(args, "|I", &capacity)) {
292 return NULL;
293 }
294 BPlusNode *node = node_create(NODE_LEAF, capacity);
295 if (!node) {
296 return NULL;
297 }
298 uintptr_t addr = (uintptr_t)node->data;
299 node_destroy(node);
300 if (addr % CACHE_LINE_SIZE == 0) {
301 Py_RETURN_TRUE;
302 }
303 Py_RETURN_FALSE;
304}
305
306static PyMethodDef module_methods[] = {
307 {"_check_data_alignment", py_check_data_alignment, METH_VARARGS,

Callers

nothing calls this directly

Calls 2

node_createFunction · 0.85
node_destroyFunction · 0.85

Tested by

no test coverage detected