mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
[girepository] Support strict align platforms
Such as Sparc64. https://bugzilla.gnome.org/show_bug.cgi?id=620769
This commit is contained in:
parent
30922b36c1
commit
09afe7361d
@ -64,6 +64,9 @@ g_constant_info_get_type (GIConstantInfo *info)
|
||||
return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
|
||||
}
|
||||
|
||||
#define DO_ALIGNED_COPY(dest_addr, src_addr, type) \
|
||||
memcpy((dest_addr), (src_addr), sizeof(type))
|
||||
|
||||
/**
|
||||
* g_constant_info_get_value: (skip)
|
||||
* @info: a #GIConstantInfo
|
||||
@ -118,16 +121,16 @@ g_constant_info_get_value (GIConstantInfo *info,
|
||||
value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
|
||||
break;
|
||||
case GI_TYPE_TAG_INT64:
|
||||
value->v_int64 = *(gint64*)&rinfo->typelib->data[blob->offset];
|
||||
DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64);
|
||||
break;
|
||||
case GI_TYPE_TAG_UINT64:
|
||||
value->v_uint64 = *(guint64*)&rinfo->typelib->data[blob->offset];
|
||||
DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64);
|
||||
break;
|
||||
case GI_TYPE_TAG_FLOAT:
|
||||
value->v_float = *(gfloat*)&rinfo->typelib->data[blob->offset];
|
||||
DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat);
|
||||
break;
|
||||
case GI_TYPE_TAG_DOUBLE:
|
||||
value->v_double = *(gdouble*)&rinfo->typelib->data[blob->offset];
|
||||
DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user