projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib list
[lttv.git]
/
ltt
/
branches
/
poly
/
ltt
/
event.c
diff --git
a/ltt/branches/poly/ltt/event.c
b/ltt/branches/poly/ltt/event.c
index 2827cff9aaf7fd1b038f643b0d96088eff671d09..a5b046814027e30f74b3f9410518a85284cebdb0 100644
(file)
--- a/
ltt/branches/poly/ltt/event.c
+++ b/
ltt/branches/poly/ltt/event.c
@@
-614,35
+614,31
@@
gint64 ltt_event_get_long_int(LttEvent *e, LttField *f)
float ltt_event_get_float(LttEvent *e, LttField *f)
{
float ltt_event_get_float(LttEvent *e, LttField *f)
{
- gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
+ g_assert(LTT_HAS_FLOAT(e->tracefile));
+ gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 4);
if(reverse_byte_order == 0) return *(float *)(e->data + f->offset_root);
else{
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 4);
if(reverse_byte_order == 0) return *(float *)(e->data + f->offset_root);
else{
-// guint32 aInt;
void *ptr = e->data + f->offset_root;
void *ptr = e->data + f->offset_root;
-// memcpy((void*)&aInt, e->data + f->offset_root, 4);
-// aInt = bswap_32();
-// return ((float)aInt);
- return *(float*)bswap_32(*(guint32*)ptr);
+ guint32 value = bswap_32(*(guint32*)ptr);
+ return *(float*)&value;
}
}
double ltt_event_get_double(LttEvent *e, LttField *f)
{
}
}
double ltt_event_get_double(LttEvent *e, LttField *f)
{
- gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
+ g_assert(LTT_HAS_FLOAT(e->tracefile));
+ gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 8);
if(reverse_byte_order == 0) return *(double *)(e->data + f->offset_root);
g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 8);
if(reverse_byte_order == 0) return *(double *)(e->data + f->offset_root);
- else{
+ else
{
void *ptr = e->data + f->offset_root;
void *ptr = e->data + f->offset_root;
- return *(double*)bswap_64(*(guint64*)ptr);
- //guint64 aInt;
- //memcpy((void*)&aInt, e->data + f->offset_root, 8);
- //aInt = ___swab64(aInt);
- //return ((double)aInt);
+ guint64 value = bswap_64(*(guint64*)ptr);
+ return *(double*)&value;
}
}
}
}
This page took
0.024119 seconds
and
4
git commands to generate.