diff --git a/tools/qfcc/include/type.h b/tools/qfcc/include/type.h index a864fcb82..34fc519d4 100644 --- a/tools/qfcc/include/type.h +++ b/tools/qfcc/include/type.h @@ -111,6 +111,10 @@ extern type_t type_bool; extern type_t type_bvec2; extern type_t type_bvec3; 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_invalid; extern type_t type_floatfield; diff --git a/tools/qfcc/source/expr_unary.c b/tools/qfcc/source/expr_unary.c index b4080a705..a22895f04 100644 --- a/tools/qfcc/source/expr_unary.c +++ b/tools/qfcc/source/expr_unary.c @@ -372,7 +372,7 @@ static unary_type_t ushort_u[] = { static unary_type_t double_u[] = { { .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 = QC_REVERSE, .process = algebra_reverse, }, { .op = QC_DUAL, .process = algebra_dual, }, @@ -382,9 +382,9 @@ static unary_type_t double_u[] = { }; static unary_type_t long_u[] = { - { .op = '-', .result_type = &type_long, .constant = ulong_negate, }, - { .op = '!', .result_type = &type_bool, .constant = ulong_not, }, - { .op = '~', .result_type = &type_long, .constant = ulong_bitnot, }, + { .op = '-', .result_type = &type_long, .constant = ulong_negate, }, + { .op = '!', .result_type = &type_lbool, .constant = ulong_not, }, + { .op = '~', .result_type = &type_long, .constant = ulong_bitnot, }, { .op = QC_REVERSE, .process = algebra_reverse, }, { .op = QC_DUAL, .process = algebra_dual, }, { .op = QC_UNDUAL, .process = algebra_undual, }, @@ -394,7 +394,7 @@ static unary_type_t long_u[] = { static unary_type_t ulong_u[] = { { .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 = QC_REVERSE, .process = algebra_reverse, }, { .op = QC_DUAL, .process = algebra_dual, }, diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index 0edf63526..b765e7ffe 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -140,6 +140,38 @@ type_t type_bvec4 = { .columns = 1, .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 MAT_TYPE(type_name, base_type, cols, align_as) &type_##type_name, @@ -149,6 +181,10 @@ static type_t *matrix_types[] = { &type_bvec2, &type_bvec3, &type_bvec4, + &type_lbool, + &type_lbvec2, + &type_lbvec3, + &type_lbvec4, #include "tools/qfcc/include/mat_types.h" 0 }; @@ -795,7 +831,7 @@ bool_type (const type_t *base) if (type_size (base) == 1) { base = &type_bool; } else if (type_size (base) == 2) { - base = &type_long; + base = &type_lbool; } return vector_type (base, width); } @@ -1320,8 +1356,7 @@ is_bool (const type_t *type) if (type->meta != ty_bool) { return 0; } - //FIXME 64-bit bool - return type->type == ev_int; + return type->type == ev_int || type->type == ev_long; } int @@ -1706,6 +1741,10 @@ chain_basic_types (void) chain_type (&type_bvec2); chain_type (&type_bvec3); chain_type (&type_bvec4); + chain_type (&type_lbool); + chain_type (&type_lbvec2); + chain_type (&type_lbvec3); + chain_type (&type_lbvec4); } } }