aboutsummaryrefslogtreecommitdiff
path: root/km-set.c
diff options
context:
space:
mode:
Diffstat (limited to 'km-set.c')
-rw-r--r--km-set.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/km-set.c b/km-set.c
index ca028f8..37a7337 100644
--- a/km-set.c
+++ b/km-set.c
@@ -184,21 +184,22 @@ km_set_copy(
km_set_t * const dst,
const km_set_t * const src
) {
- if (src->state != KM_SET_STATE_INIT || src->state != KM_SET_STATE_NORMALIZED) {
+ if (src->state != KM_SET_STATE_INIT && src->state != KM_SET_STATE_NORMALIZED) {
// return failure
+ D("invalid state");
return false;
}
// init dst set
if (!km_set_init(dst, &(src->shape), src->num_rows)) {
// return failure
+ D("km_set_init()");
return false;
}
// copy floats
- const size_t num_floats = src->shape.num_floats;
- if (num_floats > 0) {
- const size_t stride = sizeof(float) * num_floats;
+ if (src->shape.num_floats > 0) {
+ const size_t stride = sizeof(float) * src->shape.num_floats;
// copy floats
memcpy(dst->floats, src->floats, stride * src->num_rows);