Changeset 1176 for trunk/src/lol/math/vector.h
 Timestamp:
 Mar 27, 2012, 9:53:54 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/lol/math/vector.h
r1175 r1176 1124 1124 DECLARE_VEC_3_COERCE_OPS(Vec3, static, type, type, type) 1125 1125 1126 #define DECLARE_ ALL_VECTOR_COERCE_OPS_INNER(tname, tlow, thigh) \1126 #define DECLARE_VEC_ANY_COERCE_OPS(tname, tlow, thigh) \ 1127 1127 DECLARE_BINARY_COERCE_OPS(tname, static, tlow, thigh, thigh) \ 1128 1128 DECLARE_BINARY_COERCE_OPS(tname, static, thigh, tlow, thigh) \ … … 1132 1132 1133 1133 #define DECLARE_ALL_VECTOR_COERCE_OPS(tlow, thigh) \ 1134 DECLARE_ ALL_VECTOR_COERCE_OPS_INNER(Vec2, tlow, thigh) \1135 DECLARE_ ALL_VECTOR_COERCE_OPS_INNER(Vec3, tlow, thigh) \1136 DECLARE_ ALL_VECTOR_COERCE_OPS_INNER(Vec4, tlow, thigh) \1134 DECLARE_VEC_ANY_COERCE_OPS(Vec2, tlow, thigh) \ 1135 DECLARE_VEC_ANY_COERCE_OPS(Vec3, tlow, thigh) \ 1136 DECLARE_VEC_ANY_COERCE_OPS(Vec4, tlow, thigh) \ 1137 1137 \ 1138 1138 DECLARE_VEC_3_COERCE_OPS(Vec3, static, tlow, thigh, thigh) \ 1139 1139 DECLARE_VEC_3_COERCE_OPS(Vec3, static, thigh, tlow, thigh) 1140 1141 DECLARE_ALL_NONVECTOR_OPS(Cmplx) 1142 DECLARE_ALL_NONVECTOR_OPS(Quat) 1140 1143 1141 1144 /* Disable warning about unary operator applied to unsigned type */ … … 1144 1147 # pragma warning(disable: 4146) 1145 1148 #endif 1146 1147 DECLARE_ALL_NONVECTOR_OPS(Cmplx)1148 DECLARE_ALL_NONVECTOR_OPS(Quat)1149 1149 1150 1150 DECLARE_ALL_VECTOR_OPS(half) … … 1179 1179 #endif 1180 1180 1181 /* Apply the same coercion rules as in the C++ standard. However, */ 1182 /* instead of promoting int8_t etc. to int, we apply our own rules. */ 1183 /* FIXME: "half" and "real" are deactivated for now, because we do */ 1184 /* not implement all combinations of operators for these types yet. */ 1181 /* Apply the same coercion rules as in the C++ standard. However, instead 1182 * of always promoting smaller types to int, we allow int8_t op int16_t to 1183 * return an int16_t. */ 1185 1184 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, uint8_t) 1186 1185 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, int16_t) … … 1190 1189 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, int64_t) 1191 1190 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, uint64_t) 1192 /* DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, half) */1193 1191 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, float) 1194 1192 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, double) 1195 1193 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, long double) 1196 /* DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, real) */1197 1194 1198 1195 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, int16_t) … … 1202 1199 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, int64_t) 1203 1200 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, uint64_t) 1204 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, half) */1205 1201 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, float) 1206 1202 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, double) 1207 1203 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, long double) 1208 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, real) */1209 1204 1210 1205 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, uint16_t) … … 1213 1208 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, int64_t) 1214 1209 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, uint64_t) 1215 /* DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, half) */1216 1210 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, float) 1217 1211 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, double) 1218 1212 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, long double) 1219 /* DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, real) */1220 1213 1221 1214 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, int32_t) … … 1223 1216 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, int64_t) 1224 1217 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, uint64_t) 1225 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, half) */1226 1218 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, float) 1227 1219 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, double) 1228 1220 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, long double) 1229 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, real) */1230 1221 1231 1222 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, uint32_t) 1232 1223 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, int64_t) 1233 1224 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, uint64_t) 1234 /* DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, half) */1235 1225 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, float) 1236 1226 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, double) 1237 1227 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, long double) 1238 /* DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, real) */1239 1228 1240 1229 DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, int64_t) 1241 1230 DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, uint64_t) 1242 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, half) */1243 1231 DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, float) 1244 1232 DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, double) 1245 1233 DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, long double) 1246 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, real) */1247 1234 1248 1235 DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, uint64_t) 1249 /* DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, half) */1250 1236 DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, float) 1251 1237 DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, double) 1252 1238 DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, long double) 1253 /* DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, real) */ 1254 1255 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, half) */ 1239 1256 1240 DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, float) 1257 1241 DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, double) 1258 1242 DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, long double) 1259 /* DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, real) */1260 1261 /* DECLARE_ALL_VECTOR_COERCE_OPS(half, float) */1262 /* DECLARE_ALL_VECTOR_COERCE_OPS(half, double) */1263 /* DECLARE_ALL_VECTOR_COERCE_OPS(half, long double) */1264 /* DECLARE_ALL_VECTOR_COERCE_OPS(half, real) */1265 1243 1266 1244 DECLARE_ALL_VECTOR_COERCE_OPS(float, double) 1267 1245 DECLARE_ALL_VECTOR_COERCE_OPS(float, long double) 1268 /* DECLARE_ALL_VECTOR_COERCE_OPS(float, real) */1269 1246 1270 1247 DECLARE_ALL_VECTOR_COERCE_OPS(double, long double) 1271 /* DECLARE_ALL_VECTOR_COERCE_OPS(double, real) */ 1272 1273 /* DECLARE_ALL_VECTOR_COERCE_OPS(long double, real) */ 1248 1249 /* All integer types are promoted to half; all floating point types 1250 * cause half to be promoted. */ 1251 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, half) 1252 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, half) 1253 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, half) 1254 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, half) 1255 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, half) 1256 DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, half) 1257 DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, half) 1258 DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, half) 1259 1260 DECLARE_ALL_VECTOR_COERCE_OPS(half, float) 1261 DECLARE_ALL_VECTOR_COERCE_OPS(half, double) 1262 DECLARE_ALL_VECTOR_COERCE_OPS(half, long double) 1263 1264 /* FIXME: vectors of "real" are deactivated for now, because we do 1265 * not implement all combinations of operators for these types yet. */ 1266 1267 #if 0 1268 /* All types are promoted to real */ 1269 DECLARE_ALL_VECTOR_COERCE_OPS(int8_t, real) 1270 DECLARE_ALL_VECTOR_COERCE_OPS(uint8_t, real) 1271 DECLARE_ALL_VECTOR_COERCE_OPS(int16_t, real) 1272 DECLARE_ALL_VECTOR_COERCE_OPS(uint16_t, real) 1273 DECLARE_ALL_VECTOR_COERCE_OPS(int32_t, real) 1274 DECLARE_ALL_VECTOR_COERCE_OPS(uint32_t, real) 1275 DECLARE_ALL_VECTOR_COERCE_OPS(int64_t, real) 1276 DECLARE_ALL_VECTOR_COERCE_OPS(uint64_t, real) 1277 DECLARE_ALL_VECTOR_COERCE_OPS(half, real) 1278 DECLARE_ALL_VECTOR_COERCE_OPS(float, real) 1279 DECLARE_ALL_VECTOR_COERCE_OPS(double, real) 1280 DECLARE_ALL_VECTOR_COERCE_OPS(long double, real) 1281 #endif 1274 1282 1275 1283 #if defined __GNUC__ && (__GNUC__ >= 4)
Note: See TracChangeset
for help on using the changeset viewer.