Next: , Previous: , Up: blocks   [Contents][Index]


6.4 Operations on blocks

Function: void ccmem_block_clean_memory (ccmem_block_t S)

Reset to zero all the characters in the string.

Function: ccmem_block_t ccmem_block_shift (ccmem_block_t B, ssize_t offset, size_t dim)

Imagine that B is referencing a block of memory holding objects of size dim; build and return a new block referencing the object at offset objects forwards or backwards.

#include <complex.h>

cce_location_t  L[1];

ccmem_block_t  B = ccmem_block_new(L, ccmem_standard_allocator,
  3 * sizeof(complex));

ccmem_block_t  X = ccmem_block_shift(B, +2, sizeof(complex));
ccmem_block_t  Y = ccmem_block_shift(X, -1, sizeof(complex));
Function: ccmem_block_t ccmem_block_difference (ccmem_block_t A, ccmem_block_t B)

Build and return a new block representing the difference A - B. If C is the returned block, this means:

C.ptr = A.ptr
C.len = A.len - B.len

A and B must have the same pointer and A must reference a number of octets greater than, or equal to, the one referenced by B, as in the following picture:

                     A
|---------------------------------------|
|-----------------------|---------------|
           B                    C

Next: , Previous: , Up: blocks   [Contents][Index]

This document describes version 0.2.2-devel.3 of CCMemory.