Skip to content

Commit

Permalink
Fixed issue orangeduck#12 with 64 bit compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Holden committed Nov 1, 2012
1 parent d6704c2 commit c71f7bd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -2,7 +2,7 @@

PLATFORM?= $(shell uname)

CC?=gcc
CC=gcc
AR?=ar

LAC_CPPFLAGS= -I./include
Expand Down
10 changes: 5 additions & 5 deletions src/Bool+.c
Expand Up @@ -16,19 +16,19 @@ var Bool = methods {
};

var Bool_Eq(var self, var obj) {
return (var)(self == obj);
return (var)(intptr_t)(self == obj);
}

var Bool_Gt(var self, var obj) {
return (var)(self > obj);
return (var)(intptr_t)(self > obj);
}

var Bool_Lt(var self, var obj) {
return (var)(self < obj);
return (var)(intptr_t)(self < obj);
}

long Bool_Hash(var self) {
return (long)self;
return (long)(intptr_t)self;
}

char Bool_AsChar(var self) {
Expand All @@ -47,7 +47,7 @@ const char* Bool_AsStr(var self) {
}

long Bool_AsLong(var self) {
return (long)self;
return (long)(intptr_t)self;
}

double Bool_AsDouble(var self) {
Expand Down
6 changes: 3 additions & 3 deletions src/Char+.c
Expand Up @@ -34,17 +34,17 @@ var Char_Copy(var self) {

var Char_Eq(var self, var other) {
CharData* cd = cast(self, Char);
return (var)(cd->value == as_char(other));
return (var)(intptr_t)(cd->value == as_char(other));
}

var Char_Gt(var self, var other) {
CharData* cd = cast(self, Char);
return (var)(cd->value > as_char(other));
return (var)(intptr_t)(cd->value > as_char(other));
}

var Char_Lt(var self, var other) {
CharData* cd = cast(self, Char);
return (var)(cd->value < as_char(other));
return (var)(intptr_t)(cd->value < as_char(other));
}

long Char_Hash(var self) {
Expand Down
12 changes: 6 additions & 6 deletions src/Number+.c
Expand Up @@ -81,19 +81,19 @@ var Int_Copy(var self) {
var Int_Eq(var self, var other) {
IntData* io = cast(self, Int);
if (type_implements(type_of(other), AsLong)) {
return (var)(io->value == as_long(other));
return (var)(intptr_t)(io->value == as_long(other));
} else {
return False;
}
}

var Int_Gt(var self, var other) {
IntData* io = cast(self, Int);
return (var)(io->value > as_long(other));
return (var)(intptr_t)(io->value > as_long(other));
}
var Int_Lt(var self, var other) {
IntData* io = cast(self, Int);
return (var)(io->value < as_long(other));
return (var)(intptr_t)(io->value < as_long(other));
}

long Int_Hash(var self) {
Expand Down Expand Up @@ -189,20 +189,20 @@ var Real_Copy(var self) {
var Real_Eq(var self, var other) {
RealData* ro = cast(self, Real);
if (type_implements(type_of(other), AsDouble)) {
return (var)(ro->value == as_double(other));
return (var)(intptr_t)(ro->value == as_double(other));
} else {
return False;
}
}

var Real_Gt(var self, var other) {
RealData* ro = cast(self, Real);
return (var)(ro->value > as_double(other));
return (var)(intptr_t)(ro->value > as_double(other));
}

var Real_Lt(var self, var other) {
RealData* ro = cast(self, Real);
return (var)(ro->value < as_double(other));
return (var)(intptr_t)(ro->value < as_double(other));
}

union interp_cast {
Expand Down
12 changes: 6 additions & 6 deletions src/Prelude+.c
Expand Up @@ -116,7 +116,7 @@ var copy(var self) {
var eq(var lhs, var rhs) {

if (not type_implements(type_of(lhs), Eq)) {
return (var)(lhs == rhs);
return (var)(intptr_t)(lhs == rhs);
}

Eq* ieq = type_class(type_of(lhs), Eq);
Expand All @@ -126,7 +126,7 @@ var eq(var lhs, var rhs) {
}

var neq(var lhs, var rhs) {
return (var)(not eq(lhs, rhs));
return (var)(intptr_t)(not eq(lhs, rhs));
}

var gt(var lhs, var rhs) {
Expand All @@ -142,11 +142,11 @@ var lt(var lhs, var rhs) {
}

var ge(var lhs, var rhs) {
return (var)(not lt(lhs, rhs));
return (var)(intptr_t)(not lt(lhs, rhs));
}

var le(var lhs, var rhs) {
return (var)(not gt(lhs, rhs));
return (var)(intptr_t)(not gt(lhs, rhs));
}

int len(var self) {
Expand All @@ -156,7 +156,7 @@ int len(var self) {
}

var is_empty(var self) {
return (var)(len(self) == 0);
return (var)(intptr_t)(len(self) == 0);
}

void clear(var self) {
Expand Down Expand Up @@ -304,7 +304,7 @@ var pop_front(var self) {
long hash(var self) {

if (not type_implements(type_of(self), Hash)) {
return (long)self;
return (long)(intptr_t)self;
}

Hash* ihash = type_class(type_of(self), Hash);
Expand Down
2 changes: 1 addition & 1 deletion src/String+.c
Expand Up @@ -50,7 +50,7 @@ var String_Copy(var self) {
var String_Eq(var self, var other) {
StringData* fst = cast(self, String);
if (type_implements(type_of(other), AsStr)) {
return (var)(strcmp(fst->value, as_str(other)) == 0);
return (var)(intptr_t)(strcmp(fst->value, as_str(other)) == 0);
} else {
return False;
}
Expand Down

0 comments on commit c71f7bd

Please sign in to comment.