Commit 0cde131c9d5a1f37dffcdd5deb0bcf51d77d9530

Thomas de Grivel 2024-03-07T13:37:33

wip tag_add

diff --git a/libc3/tag_add.c b/libc3/tag_add.c
index d0337ca..b8ce45b 100644
--- a/libc3/tag_add.c
+++ b/libc3/tag_add.c
@@ -312,12 +312,27 @@ s_tag * tag_add (const s_tag *a, const s_tag *b, s_tag *dest)
       }
       complex_clean(&c);
       return dest;
+    case TAG_F32:
+    case TAG_F64:
+    case TAG_F128:
+    case TAG_INTEGER:
+      goto ko;
     case TAG_RATIO:
       if (! ratio_add(&a->data.ratio, &b->data.ratio,
                       &dest->data.ratio))
         return NULL;
       dest->type = TAG_RATIO;
       return dest;
+    case TAG_S8:
+    case TAG_S16:
+    case TAG_S32:
+    case TAG_S64:
+    case TAG_SW:
+    case TAG_U8:
+    case TAG_U16:
+    case TAG_U32:
+    case TAG_U64:
+    case TAG_UW:
     default:
       goto ko;
     }
diff --git a/libc3/tag_sub.c b/libc3/tag_sub.c
index 3440e87..0d9eb72 100644
--- a/libc3/tag_sub.c
+++ b/libc3/tag_sub.c
@@ -409,9 +409,11 @@ s_tag * tag_sub (const s_tag *a, const s_tag *b, s_tag *dest)
   case TAG_U16:
     switch (b->type) {
     case TAG_F32:
-      return tag_init_f32(dest, a->data.u16 - b->data.f32);
+      return tag_init_f32(dest, (f32) a->data.u16 - b->data.f32);
     case TAG_F64:
-      return tag_init_f64(dest, a->data.u16 - b->data.f64);
+      return tag_init_f64(dest, (f64) a->data.u16 - b->data.f64);
+    case TAG_F128:
+      return tag_init_f128(dest, (f128) a->data.u16 - b->data.f128);
     case TAG_INTEGER:
       integer_init_u16(&tmp, a->data.u16);
       dest->type = TAG_INTEGER;