/*
 *  NekoML Standard Library
 *  Copyright (c)2005 Motion-Twin
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License or the LICENSE file for more details.
 */

type t = int32

function _load(name,nargs) : 'a {
	neko("return $loader.loadprim('std@int32_'+name,nargs)");
}

var of_int : int -> t = _load("new",1);
var	to_int : t -> int = _load("to_int",1);
var compare : t -> t -> int = _load("compare",2);
var add : t -> t -> t = _load("add",2);
var sub : t -> t -> t = _load("sub",2);
var mul : t -> t -> t = _load("mul",2);
var div : t -> t -> t = _load("div",2);
var shl : t -> int -> t = _load("shl",2);
var shr : t -> int -> t = _load("shr",2);
var ushr : t -> int -> t = _load("ushr",2);
var mod : t -> t -> t = _load("mod",2);
var neg : t -> t = _load("neg",1);
var complement : t -> t = _load("complement",1);
var bor : t -> t -> t = _load("or",2);
var band : t -> t -> t = _load("and",2);
var bxor : t -> t -> t = _load("xor",2);

neko("_address = _load('address',1)");

function address( x : 'a ) : t {
	neko "_address(x)"
}

var zero = of_int 0;
var one = of_int 1;
