| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,40 +76,6 @@ typedef struct { | |||
| 76 | 76 | #define PyStructObject_CAST(op) ((PyStructObject *)(op)) | |
| 77 | 77 | #define PyStruct_Check(op, state) PyObject_TypeCheck(op, (PyTypeObject *)(state)->PyStructType) | |
| 78 | 78 | ||
| 79 | - /* Define various structs to figure out the alignments of types */ | ||
| 80 | - | ||
| 81 | - | ||
| 82 | - typedef struct { char c; short x; } st_short; | ||
| 83 | - typedef struct { char c; int x; } st_int; | ||
| 84 | - typedef struct { char c; long x; } st_long; | ||
| 85 | - typedef struct { char c; float x; } st_float; | ||
| 86 | - typedef struct { char c; double x; } st_double; | ||
| 87 | - #ifdef Py_HAVE_C_COMPLEX | ||
| 88 | - typedef struct { char c; float complex x; } st_float_complex; | ||
| 89 | - typedef struct { char c; double complex x; } st_double_complex; | ||
| 90 | - #endif | ||
| 91 | - typedef struct { char c; void *x; } st_void_p; | ||
| 92 | - typedef struct { char c; size_t x; } st_size_t; | ||
| 93 | - typedef struct { char c; _Bool x; } st_bool; | ||
| 94 | - | ||
| 95 | - #define SHORT_ALIGN (sizeof(st_short) - sizeof(short)) | ||
| 96 | - #define INT_ALIGN (sizeof(st_int) - sizeof(int)) | ||
| 97 | - #define LONG_ALIGN (sizeof(st_long) - sizeof(long)) | ||
| 98 | - #define FLOAT_ALIGN (sizeof(st_float) - sizeof(float)) | ||
| 99 | - #define DOUBLE_ALIGN (sizeof(st_double) - sizeof(double)) | ||
| 100 | - #ifdef Py_HAVE_C_COMPLEX | ||
| 101 | - # define FLOAT_COMPLEX_ALIGN (sizeof(st_float_complex) - sizeof(float complex)) | ||
| 102 | - # define DOUBLE_COMPLEX_ALIGN (sizeof(st_double_complex) - sizeof(double complex)) | ||
| 103 | - #endif | ||
| 104 | - #define VOID_P_ALIGN (sizeof(st_void_p) - sizeof(void *)) | ||
| 105 | - #define SIZE_T_ALIGN (sizeof(st_size_t) - sizeof(size_t)) | ||
| 106 | - #define BOOL_ALIGN (sizeof(st_bool) - sizeof(_Bool)) | ||
| 107 | - | ||
| 108 | - /* We can't support q and Q in native mode unless the compiler does; | ||
| 109 | - in std mode, they're 8 bytes on all platforms. */ | ||
| 110 | - typedef struct { char c; long long x; } s_long_long; | ||
| 111 | - #define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(long long)) | ||
| 112 | - | ||
| 113 | 79 | #ifdef __powerc | |
| 114 | 80 | #pragma options align=reset | |
| 115 | 81 | #endif | |
@@ -898,28 +864,28 @@ static const formatdef native_table[] = { | |||
| 898 | 864 | {'c', sizeof(char), 0, nu_char, np_char}, | |
| 899 | 865 | {'s', sizeof(char), 0, NULL}, | |
| 900 | 866 | {'p', sizeof(char), 0, NULL}, | |
| 901 | - {'h', sizeof(short), SHORT_ALIGN, nu_short, np_short}, | ||
| 902 | - {'H', sizeof(short), SHORT_ALIGN, nu_ushort, np_ushort}, | ||
| 903 | - {'i', sizeof(int), INT_ALIGN, nu_int, np_int}, | ||
| 904 | - {'I', sizeof(int), INT_ALIGN, nu_uint, np_uint}, | ||
| 905 | - {'l', sizeof(long), LONG_ALIGN, nu_long, np_long}, | ||
| 906 | - {'L', sizeof(long), LONG_ALIGN, nu_ulong, np_ulong}, | ||
| 907 | - {'n', sizeof(size_t), SIZE_T_ALIGN, nu_ssize_t, np_ssize_t}, | ||
| 908 | - {'N', sizeof(size_t), SIZE_T_ALIGN, nu_size_t, np_size_t}, | ||
| 909 | - {'q', sizeof(long long), LONG_LONG_ALIGN, nu_longlong, np_longlong}, | ||
| 910 | - {'Q', sizeof(long long), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, | ||
| 911 | - {'?', sizeof(_Bool), BOOL_ALIGN, nu_bool, np_bool}, | ||
| 912 | - {'e', sizeof(short), SHORT_ALIGN, nu_halffloat, np_halffloat}, | ||
| 913 | - {'f', sizeof(float), FLOAT_ALIGN, nu_float, np_float}, | ||
| 914 | - {'d', sizeof(double), DOUBLE_ALIGN, nu_double, np_double}, | ||
| 867 | + {'h', sizeof(short), _Alignof(short), nu_short, np_short}, | ||
| 868 | + {'H', sizeof(short), _Alignof(short), nu_ushort, np_ushort}, | ||
| 869 | + {'i', sizeof(int), _Alignof(int), nu_int, np_int}, | ||
| 870 | + {'I', sizeof(int), _Alignof(int), nu_uint, np_uint}, | ||
| 871 | + {'l', sizeof(long), _Alignof(long), nu_long, np_long}, | ||
| 872 | + {'L', sizeof(long), _Alignof(long), nu_ulong, np_ulong}, | ||
| 873 | + {'n', sizeof(size_t), _Alignof(size_t), nu_ssize_t, np_ssize_t}, | ||
| 874 | + {'N', sizeof(size_t), _Alignof(size_t), nu_size_t, np_size_t}, | ||
| 875 | + {'q', sizeof(long long), _Alignof(long long), nu_longlong, np_longlong}, | ||
| 876 | + {'Q', sizeof(long long), _Alignof(long long), nu_ulonglong,np_ulonglong}, | ||
| 877 | + {'?', sizeof(_Bool), _Alignof(_Bool), nu_bool, np_bool}, | ||
| 878 | + {'e', sizeof(short), _Alignof(short), nu_halffloat, np_halffloat}, | ||
| 879 | + {'f', sizeof(float), _Alignof(float), nu_float, np_float}, | ||
| 880 | + {'d', sizeof(double), _Alignof(double), nu_double, np_double}, | ||
| 915 | 881 | #ifdef Py_HAVE_C_COMPLEX | |
| 916 | - {'F', sizeof(float complex), FLOAT_COMPLEX_ALIGN, nu_float_complex, np_float_complex}, | ||
| 917 | - {'D', sizeof(double complex), DOUBLE_COMPLEX_ALIGN, nu_double_complex, np_double_complex}, | ||
| 882 | + {'F', sizeof(float complex), _Alignof(float complex), nu_float_complex, np_float_complex}, | ||
| 883 | + {'D', sizeof(double complex), _Alignof(double complex), nu_double_complex, np_double_complex}, | ||
| 918 | 884 | #else | |
| 919 | 885 | {'F', 1, 0, nu_complex_stub, np_complex_stub}, | |
| 920 | 886 | {'D', 1, 0, nu_complex_stub, np_complex_stub}, | |
| 921 | 887 | #endif | |
| 922 | - {'P', sizeof(void *), VOID_P_ALIGN, nu_void_p, np_void_p}, | ||
| 888 | + {'P', sizeof(void *), _Alignof(void *), nu_void_p, np_void_p}, | ||
| 923 | 889 | {0} | |
| 924 | 890 | }; | |
| 925 | 891 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments