Skip to content

integer API cleanup #70

@jrahlf

Description

@jrahlf

The read/write functions are not symmetric and confusing:

bool cmp_write_integer(cmp_ctx_t *ctx, int64_t d);

bool cmp_read_int(cmp_ctx_t *ctx, int32_t *i);
bool cmp_read_long(cmp_ctx_t *ctx, int64_t *u);
bool cmp_read_integer(cmp_ctx_t *ctx, int64_t *u);

I would suggest the following:

  • remove int/integer duplicate functions
  • uses distinct names for 32-bit and 64-bit types: int/long or maybe int32/int64
  • add dedicated 32-bit write function (read function is already there) -> this is especially advantageous for 32-bit systems, e.g. microcontrollers, where 64-bit ints are emulated in software
bool cmp_write_int(cmp_ctx_t *ctx, int32_t d);
bool cmp_write_long(cmp_ctx_t *ctx, int64_t d);

bool cmp_read_int(cmp_ctx_t *ctx, int32_t *i);
bool cmp_read_long(cmp_ctx_t *ctx, int64_t *d);

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions