String type: complete migration to bitwise position
[babeltrace.git] / formats / ctf / types / float.c
index a26e94cc20760e9fd88088ac464655964a371df0..09a20e3ab991b487a4a1f7e3d8f164023143eca4 100644 (file)
@@ -25,6 +25,7 @@
 #include <babeltrace/ctf/types.h>
 #include <glib.h>
 #include <float.h>     /* C99 floating point definitions */
+#include <limits.h>    /* C99 limits */
 #include <endian.h>
 
 /*
@@ -71,8 +72,10 @@ struct pos_len {
        size_t sign_start, exp_start, mantissa_start, len;
 };
 
-void ctf_float_copy(unsigned char *destp, const struct ctf_float *dest,
-                   const unsigned char *src, const struct ctf_float *src)
+/* TODO */
+
+void ctf_float_copy(unsigned char *destp, const struct type_class_float *dest,
+                   const unsigned char *src, const struct type_class_float *src)
 {
        struct pos_len destpos, srcpos;
        union {
@@ -80,8 +83,8 @@ void ctf_float_copy(unsigned char *destp, const struct ctf_float *dest,
                long long s;
        } tmp;
 
-       destpos.len = dest.exp_len + dest.mantissa_len;
-       if (dest.byte_order == LITTLE_ENDIAN) {
+       destpos.len = dest->exp_len + dest->mantissa_len;
+       if (dest->byte_order == LITTLE_ENDIAN) {
                destpos.sign_start = destpos.len - 1;
                destpos.exp_start = destpos.sign_start - dest->exp_len;
                destpos.mantissa_start = 0;
@@ -91,8 +94,8 @@ void ctf_float_copy(unsigned char *destp, const struct ctf_float *dest,
                destpos.mantissa_start = destpos.exp_start + dest->exp_len;
        }
 
-       srcpos.len = src.exp_len + src.mantissa_len;
-       if (src.byte_order == LITTLE_ENDIAN) {
+       srcpos.len = src->exp_len + src->mantissa_len;
+       if (src->byte_order == LITTLE_ENDIAN) {
                srcpos.sign_start = srcpos.len - 1;
                srcpos.exp_start = srcpos.sign_start - src->exp_len;
                srcpos.mantissa_start = 0;
@@ -123,7 +126,7 @@ void ctf_float_copy(unsigned char *destp, const struct ctf_float *dest,
                                  dest->byte_order, tmp.s);
 }
 
-double ctf_double_read(const unsigned char *ptr, const struct ctf_float *src)
+double ctf_double_read(const unsigned char *ptr, const struct type_class_float *src)
 {
        union doubleIEEE754 u;
        struct ctf_float dest = {
@@ -136,7 +139,7 @@ double ctf_double_read(const unsigned char *ptr, const struct ctf_float *src)
        return u.v;
 }
 
-size_t ctf_double_write(unsigned char *ptr, const struct ctf_float *dest,
+size_t ctf_double_write(unsigned char *ptr, const struct type_class_float *dest,
                        double v)
 {
        union doubleIEEE754 u;
@@ -155,7 +158,7 @@ end:
 }
 
 long double ctf_ldouble_read(const unsigned char *ptr,
-                            const struct ctf_float *src)
+                            const struct type_class_float *src)
 {
        union ldoubleIEEE754 u;
        struct ctf_float dest = {
@@ -168,7 +171,7 @@ long double ctf_ldouble_read(const unsigned char *ptr,
        return u.v;
 }
 
-size_t ctf_ldouble_write(unsigned char *ptr, const struct ctf_float *dest,
+size_t ctf_ldouble_write(unsigned char *ptr, const struct type_class_float *dest,
                         long double v)
 {
        union ldoubleIEEE754 u;
This page took 0.024239 seconds and 4 git commands to generate.