ffi-overhead added by mario-goulart on Mon May 28 22:35:46 2018
(import scheme chicken foreign) (foreign-declare "#include \"newplus/plus.c\"") (define current-timestamp (foreign-lambda integer64 current_timestamp)) (define plus (foreign-lambda int plus int int)) (define plus-one (foreign-lambda int plusone int)) (define (run count) (let ((start (current-timestamp))) (let loop ((x 0)) (when (fx< x count) (loop (plus-one x)))) (print (fx- (current-timestamp) start)))) (let ((args (command-line-arguments))) (when (null? args) (print "First arg is required") (exit 1)) (or (and-let* ((count (string->number (car args)))) (when (or (< count 0) (> count 2000000000)) (print "Must be a positive number not exceeding 2 billion.") (exit 1)) (run count)) (begin (print "Input must be a number.") (exit 1))))