...
lib_mem.h
Prototypes
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
MEM_VAL_COPY_GET_INT08U_BIG(addr_dest, addr_src); MEM_VAL_COPY_GET_INT16U_BIG(addr_dest, addr_src); MEM_VAL_COPY_GET_INT32U_BIG(addr_dest, addr_src); MEM_VAL_COPY_GET_INTU_BIG(addr_dest, addr_src, val_size); MEM_VAL_COPY_GET_INT08U_LITTLE(addr_dest, addr_src); MEM_VAL_COPY_GET_INT16U_LITTLE(addr_dest, addr_src); MEM_VAL_COPY_GET_INT32U_LITTLE(addr_dest, addr_src); MEM_VAL_COPY_GET_INTU_LITTLE(addr_dest, addr_src, val_size); MEM_VAL_COPY_GET_INT08U(addr_dest, addr_src); MEM_VAL_COPY_GET_INT16U(addr_dest, addr_src); MEM_VAL_COPY_GET_INT32U(addr_dest, addr_src); MEM_VAL_COPY_GET_INTU(addr_dest, addr_src, val_size); |
...
MEM_VAL_COPY_GET_xxx()
macros are more efficient than MEM_VAL_GET_xxx()
macros (see section 4-2-4) and are also fully independent of CPU data-word-alignment and should be used whenever possible. Fixed-size copy MEM_VAL_COPY_GET_INTxxU_xxx()
macros are more efficient than dynamic-size copy MEM_VAL_COPY_GET_INTU_xxx()
macros and should be used whenever possible.
...
Since octet-order copy/conversion are inverse operations, MEM_VAL_COPY_GET_xxx()
and MEM_VAL_COPY_SET_xxx()
memory data-copy get/set macros are inverse, but identical, operations and are provided in both forms for semantics and consistency. See also section 4-2-7.
Example Usage
Code Block | |||
---|---|---|---|
Language | C++ | ||
| |||
CPU_INT16U *pmem; CPU_INT16U *pval; CPU_INT08U buf[SIZE]; pmem = &SomeAddr; /* Any CPU address */ pval = &SomeVal; /* Any CPU address */ MEM_VAL_COPY_GET_INT16U(pmem, pval); MEM_VAL_COPY_GET_INTU(&buf[0], pmem, sizeof(buf)); |