Mercurial > hg > Members > yutaka > manager
view ppe/Sys.cc @ 1:dcd83cefb980
check , ppe_only, show time , function add.
author | yutaka@localhost.localdomain |
---|---|
date | Tue, 06 Apr 2010 22:52:33 +0900 |
parents | 68a98d68d62a |
children | 1e1b0d280427 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "Sys.h" int size_fix(int size, int fix) { //16の倍数にする size = ((size + fix -1) / fix)*fix; return size; } void* allocate(int size) { int alignment = 16; size = size_fix(size, alignment); void *buff; posix_memalign(&buff, alignment, size); return buff; } void fix_type(send_params_t *send_params, void *buff) { char *p; p = (char*)buff; p = p + sizeof(send_params_head_t); send_params->head = (send_params_head_t*)buff; send_params->buff = p; } send_params_t task_allocate(int size) { if (size % 16) { printf("allocate size is not multiple of 16\n"); } int alignment = 16; send_params_t send_params; void *buff; posix_memalign(&buff, alignment, size); fix_type(&send_params, buff); return send_params; }