summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
Diffstat (limited to 'src/target')
-rw-r--r--src/target/algorithm.c2
-rw-r--r--src/target/etb.c4
-rw-r--r--src/target/target.c2
-rw-r--r--src/target/target_request.c8
4 files changed, 8 insertions, 8 deletions
diff --git a/src/target/algorithm.c b/src/target/algorithm.c
index 7643e3cb..76cf48bc 100644
--- a/src/target/algorithm.c
+++ b/src/target/algorithm.c
@@ -43,7 +43,7 @@ void init_reg_param(struct reg_param *param, char *reg_name, uint32_t size, enum
{
param->reg_name = reg_name;
param->size = size;
- param->value = malloc(CEIL(size, 8));
+ param->value = malloc(DIV_ROUND_UP(size, 8));
param->direction = direction;
}
diff --git a/src/target/etb.c b/src/target/etb.c
index 72474cd0..21c375c3 100644
--- a/src/target/etb.c
+++ b/src/target/etb.c
@@ -57,7 +57,7 @@ static int etb_set_instr(struct etb *etb, uint32_t new_instr)
field.tap = tap;
field.num_bits = tap->ir_length;
- field.out_value = calloc(CEIL(field.num_bits, 8), 1);
+ field.out_value = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
field.in_value = NULL;
@@ -78,7 +78,7 @@ static int etb_scann(struct etb *etb, uint32_t new_scan_chain)
field.tap = etb->tap;
field.num_bits = 5;
- field.out_value = calloc(CEIL(field.num_bits, 8), 1);
+ field.out_value = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
buf_set_u32(field.out_value, 0, field.num_bits, new_scan_chain);
field.in_value = NULL;
diff --git a/src/target/target.c b/src/target/target.c
index f5a092a7..c24085f1 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1967,7 +1967,7 @@ COMMAND_HANDLER(handle_reg_command)
/* set register value */
if (argc == 2)
{
- uint8_t *buf = malloc(CEIL(reg->size, 8));
+ uint8_t *buf = malloc(DIV_ROUND_UP(reg->size, 8));
str_to_buf(args[1], strlen(args[1]), buf, reg->size, 0);
struct reg_arch_type *arch_type = register_get_arch_type(reg->arch_type);
diff --git a/src/target/target_request.c b/src/target/target_request.c
index 72151555..be176ca3 100644
--- a/src/target/target_request.c
+++ b/src/target/target_request.c
@@ -40,10 +40,10 @@ static int charmsg_mode = 0;
static int target_asciimsg(struct target *target, uint32_t length)
{
- char *msg = malloc(CEIL(length + 1, 4) * 4);
+ char *msg = malloc(DIV_ROUND_UP(length + 1, 4) * 4);
struct debug_msg_receiver *c = target->dbgmsg;
- target->type->target_request_data(target, CEIL(length, 4), (uint8_t*)msg);
+ target->type->target_request_data(target, DIV_ROUND_UP(length, 4), (uint8_t*)msg);
msg[length] = 0;
LOG_DEBUG("%s", msg);
@@ -66,7 +66,7 @@ static int target_charmsg(struct target *target, uint8_t msg)
static int target_hexmsg(struct target *target, int size, uint32_t length)
{
- uint8_t *data = malloc(CEIL(length * size, 4) * 4);
+ uint8_t *data = malloc(DIV_ROUND_UP(length * size, 4) * 4);
char line[128];
int line_len;
struct debug_msg_receiver *c = target->dbgmsg;
@@ -74,7 +74,7 @@ static int target_hexmsg(struct target *target, int size, uint32_t length)
LOG_DEBUG("size: %i, length: %i", (int)size, (int)length);
- target->type->target_request_data(target, CEIL(length * size, 4), (uint8_t*)data);
+ target->type->target_request_data(target, DIV_ROUND_UP(length * size, 4), (uint8_t*)data);
line_len = 0;
for (i = 0; i < length; i++)