MCPcopy Create free account
hub / github.com/GJDuck/e9patch / malloc_rotate_left

Function malloc_rotate_left

examples/stdlib.c:1845–1865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1843}
1844
1845static void malloc_rotate_left(struct malloc_pool_s *pool, uint32_t n)
1846{
1847 uint32_t tmp = MA_RIGHT(pool, n);
1848 if ((MA_RIGHT(pool, n) = MA_LEFT(pool, tmp)) != MA_NIL)
1849 MA_PARENT(pool, MA_LEFT(pool, tmp)) = n;
1850 malloc_fix_invariant(pool, n);
1851 if ((MA_PARENT(pool, tmp) = MA_PARENT(pool, n)) != MA_NIL)
1852 {
1853 if (n == MA_LEFT(pool, MA_PARENT(pool, n)))
1854 MA_LEFT(pool, MA_PARENT(pool, n)) = tmp;
1855 else
1856 MA_RIGHT(pool, MA_PARENT(pool, n)) = tmp;
1857 }
1858 else
1859 pool->root = tmp;
1860 MA_LEFT(pool, tmp) = n;
1861 MA_PARENT(pool, n) = tmp;
1862 malloc_fix_invariant(pool, tmp);
1863 if (MA_PARENT(pool, tmp) != MA_NIL)
1864 malloc_fix_invariant(pool, MA_PARENT(pool, tmp));
1865}
1866
1867static void malloc_rotate_right(struct malloc_pool_s *pool, uint32_t n)
1868{

Callers 2

malloc_rebalance_insertFunction · 0.85
malloc_rebalance_removeFunction · 0.85

Calls 1

malloc_fix_invariantFunction · 0.85

Tested by

no test coverage detected