Displaying 2 results from an estimated 2 matches for "make_int".
Did you mean:
base_int
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...data structure otherwise). Something like this:
enum runtype {
Int;
Float;
Array;
}
struct array {
int length;
box *a;
}
union value {
int n; // 64-bit
float x; // 64-bit
array* u; // >64-bit
}
struct box {
runtype t;
value v;
}
So you'd create an int with:
box make_int(int n) {
box b;
b.t = Int;
b.v.n = n;
return b;
}
Is that right or are values stored as a box*?
I'd rather box everything rather than tag ints to start with. I'll relegate
that to a potential optimization.
What of this can LLVM's optimizer optimize away for me?
So I have to...
2007 Nov 26
2
[LLVMdev] Fibonacci example in OCaml
On Nov 26, 2007, at 00:47, Jon Harrop wrote:
> Here is a complete 104-line native code compiler for a tiny subset
> of OCaml that is expressive enough to compile an external Fibonacci
> program:
>
> [...]
>
> I was kind of hoping that function pointers would just magically
> work, so this:
>
> do (if 1 <= 2 then fib else fib) 40
>
> would run, but