mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
[qfcc] Implement 64-bit bool
I'm not certain it's what I want, but this fixes the double.r test which began failing with the non-scalar unary ops change.
This commit is contained in:
parent
8ac4716f67
commit
95eaa4c65e
3 changed files with 51 additions and 8 deletions
|
@ -111,6 +111,10 @@ extern type_t type_bool;
|
||||||
extern type_t type_bvec2;
|
extern type_t type_bvec2;
|
||||||
extern type_t type_bvec3;
|
extern type_t type_bvec3;
|
||||||
extern type_t type_bvec4;
|
extern type_t type_bvec4;
|
||||||
|
extern type_t type_lbool;
|
||||||
|
extern type_t type_lbvec2;
|
||||||
|
extern type_t type_lbvec3;
|
||||||
|
extern type_t type_lbvec4;
|
||||||
extern type_t type_auto;
|
extern type_t type_auto;
|
||||||
extern type_t type_invalid;
|
extern type_t type_invalid;
|
||||||
extern type_t type_floatfield;
|
extern type_t type_floatfield;
|
||||||
|
|
|
@ -372,7 +372,7 @@ static unary_type_t ushort_u[] = {
|
||||||
|
|
||||||
static unary_type_t double_u[] = {
|
static unary_type_t double_u[] = {
|
||||||
{ .op = '-', .result_type = &type_double, .constant = double_negate, },
|
{ .op = '-', .result_type = &type_double, .constant = double_negate, },
|
||||||
{ .op = '!', .result_type = &type_bool, .constant = double_not, },
|
{ .op = '!', .result_type = &type_lbool, .constant = double_not, },
|
||||||
{ .op = '~', .result_type = &type_double, .constant = double_bitnot, },
|
{ .op = '~', .result_type = &type_double, .constant = double_bitnot, },
|
||||||
{ .op = QC_REVERSE, .process = algebra_reverse, },
|
{ .op = QC_REVERSE, .process = algebra_reverse, },
|
||||||
{ .op = QC_DUAL, .process = algebra_dual, },
|
{ .op = QC_DUAL, .process = algebra_dual, },
|
||||||
|
@ -382,9 +382,9 @@ static unary_type_t double_u[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static unary_type_t long_u[] = {
|
static unary_type_t long_u[] = {
|
||||||
{ .op = '-', .result_type = &type_long, .constant = ulong_negate, },
|
{ .op = '-', .result_type = &type_long, .constant = ulong_negate, },
|
||||||
{ .op = '!', .result_type = &type_bool, .constant = ulong_not, },
|
{ .op = '!', .result_type = &type_lbool, .constant = ulong_not, },
|
||||||
{ .op = '~', .result_type = &type_long, .constant = ulong_bitnot, },
|
{ .op = '~', .result_type = &type_long, .constant = ulong_bitnot, },
|
||||||
{ .op = QC_REVERSE, .process = algebra_reverse, },
|
{ .op = QC_REVERSE, .process = algebra_reverse, },
|
||||||
{ .op = QC_DUAL, .process = algebra_dual, },
|
{ .op = QC_DUAL, .process = algebra_dual, },
|
||||||
{ .op = QC_UNDUAL, .process = algebra_undual, },
|
{ .op = QC_UNDUAL, .process = algebra_undual, },
|
||||||
|
@ -394,7 +394,7 @@ static unary_type_t long_u[] = {
|
||||||
|
|
||||||
static unary_type_t ulong_u[] = {
|
static unary_type_t ulong_u[] = {
|
||||||
{ .op = '-', .result_type = &type_ulong, .constant = long_negate, },
|
{ .op = '-', .result_type = &type_ulong, .constant = long_negate, },
|
||||||
{ .op = '!', .result_type = &type_bool, .constant = long_not, },
|
{ .op = '!', .result_type = &type_lbool, .constant = long_not, },
|
||||||
{ .op = '~', .result_type = &type_ulong, .constant = long_bitnot, },
|
{ .op = '~', .result_type = &type_ulong, .constant = long_bitnot, },
|
||||||
{ .op = QC_REVERSE, .process = algebra_reverse, },
|
{ .op = QC_REVERSE, .process = algebra_reverse, },
|
||||||
{ .op = QC_DUAL, .process = algebra_dual, },
|
{ .op = QC_DUAL, .process = algebra_dual, },
|
||||||
|
|
|
@ -140,6 +140,38 @@ type_t type_bvec4 = {
|
||||||
.columns = 1,
|
.columns = 1,
|
||||||
.meta = ty_bool,
|
.meta = ty_bool,
|
||||||
};
|
};
|
||||||
|
type_t type_lbool = {
|
||||||
|
.type = ev_long,
|
||||||
|
.name = "lbool",
|
||||||
|
.alignment = PR_ALIGNOF(long),
|
||||||
|
.width = PR_SIZEOF(long) / PR_SIZEOF (long),
|
||||||
|
.columns = 1,
|
||||||
|
.meta = ty_bool,
|
||||||
|
};
|
||||||
|
type_t type_lbvec2 = {
|
||||||
|
.type = ev_long,
|
||||||
|
.name = "lbvec2",
|
||||||
|
.alignment = PR_ALIGNOF(lvec2),
|
||||||
|
.width = PR_SIZEOF(lvec2) / PR_SIZEOF (long),
|
||||||
|
.columns = 1,
|
||||||
|
.meta = ty_bool,
|
||||||
|
};
|
||||||
|
type_t type_lbvec3 = {
|
||||||
|
.type = ev_long,
|
||||||
|
.name = "lbvec3",
|
||||||
|
.alignment = PR_ALIGNOF(lvec3),
|
||||||
|
.width = PR_SIZEOF(lvec3) / PR_SIZEOF (long),
|
||||||
|
.columns = 1,
|
||||||
|
.meta = ty_bool,
|
||||||
|
};
|
||||||
|
type_t type_lbvec4 = {
|
||||||
|
.type = ev_long,
|
||||||
|
.name = "lbvec4",
|
||||||
|
.alignment = PR_ALIGNOF(lvec4),
|
||||||
|
.width = PR_SIZEOF(lvec4) / PR_SIZEOF (long),
|
||||||
|
.columns = 1,
|
||||||
|
.meta = ty_bool,
|
||||||
|
};
|
||||||
|
|
||||||
#define VEC_TYPE(type_name, base_type) &type_##type_name,
|
#define VEC_TYPE(type_name, base_type) &type_##type_name,
|
||||||
#define MAT_TYPE(type_name, base_type, cols, align_as) &type_##type_name,
|
#define MAT_TYPE(type_name, base_type, cols, align_as) &type_##type_name,
|
||||||
|
@ -149,6 +181,10 @@ static type_t *matrix_types[] = {
|
||||||
&type_bvec2,
|
&type_bvec2,
|
||||||
&type_bvec3,
|
&type_bvec3,
|
||||||
&type_bvec4,
|
&type_bvec4,
|
||||||
|
&type_lbool,
|
||||||
|
&type_lbvec2,
|
||||||
|
&type_lbvec3,
|
||||||
|
&type_lbvec4,
|
||||||
#include "tools/qfcc/include/mat_types.h"
|
#include "tools/qfcc/include/mat_types.h"
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
@ -795,7 +831,7 @@ bool_type (const type_t *base)
|
||||||
if (type_size (base) == 1) {
|
if (type_size (base) == 1) {
|
||||||
base = &type_bool;
|
base = &type_bool;
|
||||||
} else if (type_size (base) == 2) {
|
} else if (type_size (base) == 2) {
|
||||||
base = &type_long;
|
base = &type_lbool;
|
||||||
}
|
}
|
||||||
return vector_type (base, width);
|
return vector_type (base, width);
|
||||||
}
|
}
|
||||||
|
@ -1320,8 +1356,7 @@ is_bool (const type_t *type)
|
||||||
if (type->meta != ty_bool) {
|
if (type->meta != ty_bool) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//FIXME 64-bit bool
|
return type->type == ev_int || type->type == ev_long;
|
||||||
return type->type == ev_int;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1706,6 +1741,10 @@ chain_basic_types (void)
|
||||||
chain_type (&type_bvec2);
|
chain_type (&type_bvec2);
|
||||||
chain_type (&type_bvec3);
|
chain_type (&type_bvec3);
|
||||||
chain_type (&type_bvec4);
|
chain_type (&type_bvec4);
|
||||||
|
chain_type (&type_lbool);
|
||||||
|
chain_type (&type_lbvec2);
|
||||||
|
chain_type (&type_lbvec3);
|
||||||
|
chain_type (&type_lbvec4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue