Browse Source

Fix typos

gingerBill 7 years ago
parent
commit
1705ba8069
4 changed files with 17 additions and 8 deletions
  1. 3 3
      src/big_int.cpp
  2. 1 1
      src/check_expr.cpp
  3. 1 1
      src/exact_value.cpp
  4. 12 3
      src/types.cpp

+ 3 - 3
src/big_int.cpp

@@ -96,7 +96,7 @@ void big_int_and    (BigInt *dst, BigInt const *x, BigInt const *y);
 void big_int_and_not(BigInt *dst, BigInt const *x, BigInt const *y);
 void big_int_and_not(BigInt *dst, BigInt const *x, BigInt const *y);
 void big_int_xor    (BigInt *dst, BigInt const *x, BigInt const *y);
 void big_int_xor    (BigInt *dst, BigInt const *x, BigInt const *y);
 void big_int_or     (BigInt *dst, BigInt const *x, BigInt const *y);
 void big_int_or     (BigInt *dst, BigInt const *x, BigInt const *y);
-void big_int_not    (BigInt *dst, BigInt const *x);
+void big_int_not    (BigInt *dst, BigInt const *x, u64 bit_count, bool is_signed);
 
 
 
 
 void big_int_add_eq(BigInt *dst, BigInt const *x);
 void big_int_add_eq(BigInt *dst, BigInt const *x);
@@ -1230,7 +1230,7 @@ void big_int_or(BigInt *dst, BigInt const *x, BigInt const *y) {
 
 
 	if (x->neg == y->neg) {
 	if (x->neg == y->neg) {
 		if (x->neg) {
 		if (x->neg) {
-			// (-x) || (-y) == ~(x-1) | ~(y-1) == ~((x-1) & (y-1)) == -(((x-1) & (y-1)) + 1)
+			// (-x) | (-y) == ~(x-1) | ~(y-1) == ~((x-1) & (y-1)) == -(((x-1) & (y-1)) + 1)
 			BigInt x1 = big_int_make_abs(x);
 			BigInt x1 = big_int_make_abs(x);
 			BigInt y1 = big_int_make_abs(y);
 			BigInt y1 = big_int_make_abs(y);
 			big_int_sub_eq(&x1, &BIG_INT_ONE);
 			big_int_sub_eq(&x1, &BIG_INT_ONE);
@@ -1285,7 +1285,7 @@ void big_int_or(BigInt *dst, BigInt const *x, BigInt const *y) {
 }
 }
 
 
 
 
-void bit_int_not(BigInt *dst, BigInt const *x, u64 bit_count, bool is_signed) {
+void big_int_not(BigInt *dst, BigInt const *x, u64 bit_count, bool is_signed) {
 	if (bit_count == 0) {
 	if (bit_count == 0) {
 		big_int_from_u64(dst, 0);
 		big_int_from_u64(dst, 0);
 		return;
 		return;

+ 1 - 1
src/check_expr.cpp

@@ -2758,8 +2758,8 @@ Entity *check_selector(CheckerContext *c, Operand *operand, Ast *node, Type *typ
 	return entity;
 	return entity;
 }
 }
 
 
+
 bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 id) {
 bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 id) {
-	GB_ASSERT(call->kind == Ast_CallExpr);
 	ast_node(ce, CallExpr, call);
 	ast_node(ce, CallExpr, call);
 	BuiltinProc *bp = &builtin_procs[id];
 	BuiltinProc *bp = &builtin_procs[id];
 	{
 	{

+ 1 - 1
src/exact_value.cpp

@@ -402,7 +402,7 @@ ExactValue exact_unary_operator_value(TokenKind op, ExactValue v, i32 precision,
 		case ExactValue_Integer: {
 		case ExactValue_Integer: {
 			GB_ASSERT(precision != 0);
 			GB_ASSERT(precision != 0);
 			ExactValue i = {ExactValue_Integer};
 			ExactValue i = {ExactValue_Integer};
-			bit_int_not(&i.value_integer, &v.value_integer, precision, !is_unsigned);
+			big_int_not(&i.value_integer, &v.value_integer, precision, !is_unsigned);
 			return i;
 			return i;
 		}
 		}
 		default:
 		default:

+ 12 - 3
src/types.cpp

@@ -67,9 +67,10 @@ enum BasicFlag {
 
 
 	BasicFlag_LLVM        = GB_BIT(10),
 	BasicFlag_LLVM        = GB_BIT(10),
 
 
-	BasicFlag_Numeric      = BasicFlag_Integer | BasicFlag_Float   | BasicFlag_Complex,
-	BasicFlag_Ordered      = BasicFlag_Integer | BasicFlag_Float   | BasicFlag_String  | BasicFlag_Pointer | BasicFlag_Rune,
-	BasicFlag_ConstantType = BasicFlag_Boolean | BasicFlag_Numeric | BasicFlag_String  | BasicFlag_Pointer | BasicFlag_Rune,
+	BasicFlag_Numeric        = BasicFlag_Integer | BasicFlag_Float   | BasicFlag_Complex,
+	BasicFlag_Ordered        = BasicFlag_Integer | BasicFlag_Float   | BasicFlag_String  | BasicFlag_Pointer | BasicFlag_Rune,
+	BasicFlag_OrderedNumeric = BasicFlag_Integer | BasicFlag_Float   | BasicFlag_Rune,
+	BasicFlag_ConstantType   = BasicFlag_Boolean | BasicFlag_Numeric | BasicFlag_String  | BasicFlag_Pointer | BasicFlag_Rune,
 };
 };
 
 
 struct BasicType {
 struct BasicType {
@@ -736,6 +737,14 @@ bool is_type_ordered(Type *t) {
 	}
 	}
 	return false;
 	return false;
 }
 }
+bool is_type_ordered_numeric(Type *t) {
+	t = core_type(t);
+	switch (t->kind) {
+	case Type_Basic:
+		return (t->Basic.flags & BasicFlag_OrderedNumeric) != 0;
+	}
+	return false;
+}
 bool is_type_constant_type(Type *t) {
 bool is_type_constant_type(Type *t) {
 	t = core_type(t);
 	t = core_type(t);
 	if (t->kind == Type_Basic) {
 	if (t->kind == Type_Basic) {