mirror of
https://github.com/schoebel/mars
synced 2025-01-20 06:20:52 +00:00
infra: round up brick_size to even sizes and addresses
This commit is contained in:
parent
cb517683bb
commit
bd3fa16b64
@ -159,6 +159,7 @@ int generic_brick_init_full(
|
||||
const char **names)
|
||||
{
|
||||
struct generic_brick *brick = data;
|
||||
int brick_size;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
@ -173,8 +174,10 @@ int generic_brick_init_full(
|
||||
status = generic_brick_init(brick_type, brick, names ? *names++ : NULL);
|
||||
if (status)
|
||||
return status;
|
||||
data += brick_type->brick_size;
|
||||
size -= brick_type->brick_size;
|
||||
brick_size = brick_type->brick_size;
|
||||
brick_size = DIV_ROUND_UP(brick_size, sizeof(void *)) * sizeof(void *);
|
||||
data += brick_size;
|
||||
size -= brick_size;
|
||||
if (size < 0) {
|
||||
BRICK_ERR("Not enough MEMORY\n");
|
||||
return -ENOMEM;
|
||||
|
@ -557,6 +557,8 @@ INLINE int generic_size(const struct generic_brick_type *brick_type)
|
||||
{
|
||||
int size = brick_type->brick_size;
|
||||
int i;
|
||||
|
||||
size = DIV_ROUND_UP(size, sizeof(void *)) * sizeof(void *);
|
||||
size += brick_type->max_inputs * sizeof(void*);
|
||||
for (i = 0; i < brick_type->max_inputs; i++) {
|
||||
size += brick_type->default_input_types[i]->input_size;
|
||||
|
@ -2842,7 +2842,9 @@ struct mars_brick *mars_make_brick(struct mars_global *global, struct mars_dent
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = brick_type->brick_size +
|
||||
size = brick_type->brick_size;
|
||||
size = DIV_ROUND_UP(size, sizeof(void *)) * sizeof(void *);
|
||||
size +=
|
||||
(brick_type->max_inputs + brick_type->max_outputs) * sizeof(void*);
|
||||
input_types = brick_type->default_input_types;
|
||||
for (i = 0; i < brick_type->max_inputs; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user