- /* long is always 32bit on windows */
- unsigned long_size = c_mode & _MS ? 4 : (machine_size < 64 ? 4 : 8);
- unsigned llong_size = machine_size < 32 ? 4 : 8;
-
- props[ATOMIC_TYPE_INT].size = int_size;
- props[ATOMIC_TYPE_INT].alignment = int_size;
- props[ATOMIC_TYPE_UINT].size = int_size;
- props[ATOMIC_TYPE_UINT].alignment = int_size;
- props[ATOMIC_TYPE_LONG].size = long_size;
- props[ATOMIC_TYPE_LONG].alignment = long_size;
- props[ATOMIC_TYPE_ULONG].size = long_size;
- props[ATOMIC_TYPE_ULONG].alignment = long_size;
- props[ATOMIC_TYPE_LONGLONG].size = llong_size;
- props[ATOMIC_TYPE_LONGLONG].alignment = llong_size;
- props[ATOMIC_TYPE_ULONGLONG].size = llong_size;
- props[ATOMIC_TYPE_ULONGLONG].alignment = llong_size;
-
- /* TODO: backend specific, need a way to query the backend for this.
- * The following are good settings for x86 */
- if (machine_size <= 32) {
- props[ATOMIC_TYPE_FLOAT].alignment = 4;
- props[ATOMIC_TYPE_DOUBLE].alignment = 4;
- props[ATOMIC_TYPE_LONG_DOUBLE].alignment = 4;
- props[ATOMIC_TYPE_LONGLONG].alignment = 4;
- props[ATOMIC_TYPE_ULONGLONG].alignment = 4;
- } else {
- props[ATOMIC_TYPE_FLOAT].alignment = 4;
- props[ATOMIC_TYPE_DOUBLE].alignment = 8;
- props[ATOMIC_TYPE_LONG_DOUBLE].alignment = 8;
- props[ATOMIC_TYPE_LONGLONG].alignment = 8;
- props[ATOMIC_TYPE_ULONGLONG].alignment = 8;
- }
-
- if (long_double_size > 0) {
- props[ATOMIC_TYPE_LONG_DOUBLE].size = long_double_size;
- if (is_po2(long_double_size)) {
- props[ATOMIC_TYPE_LONG_DOUBLE].alignment = long_double_size;
- }
- } else {
- props[ATOMIC_TYPE_LONG_DOUBLE] = props[ATOMIC_TYPE_DOUBLE];
+ unsigned long_size = machine_size < 64 ? 4 : 8;
+
+ props[ATOMIC_TYPE_INT].size = int_size;
+ props[ATOMIC_TYPE_INT].alignment = int_size;
+ props[ATOMIC_TYPE_UINT].size = int_size;
+ props[ATOMIC_TYPE_UINT].alignment = int_size;
+ props[ATOMIC_TYPE_LONG].size = long_size;
+ props[ATOMIC_TYPE_LONG].alignment = long_size;
+ props[ATOMIC_TYPE_ULONG].size = long_size;
+ props[ATOMIC_TYPE_ULONG].alignment = long_size;
+
+ pointer_properties.size = long_size;
+ pointer_properties.alignment = long_size;
+ pointer_properties.struct_alignment = long_size;
+
+ props[ATOMIC_TYPE_LONG_DOUBLE] = props[ATOMIC_TYPE_DOUBLE];
+ props[ATOMIC_TYPE_WCHAR_T] = props[ATOMIC_TYPE_INT];
+
+ /* set struct alignments to the same value as alignment */
+ for (size_t i = 0; i != lengthof(atomic_type_properties); ++i) {
+ props[i].struct_alignment = props[i].alignment;