Bug report sent to Franz.
(in-package :cl-user)
#||
#include <limits.h>
unsigned long long ullong(unsigned long long n) { return n == ULLONG_MAX ? n : 42; }
||#
(ff:def-foreign-call (ullong "ullong") ((n :unsigned-nat (unsigned-byte 64))) :returning (:unsigned-nat (unsigned-byte 64)) :call-direct t ; setting this to nil fixes the symptoms. :arg-checking nil :strings-convert nil)
(defun test-ullong () (ullong (1- (expt 2 64))))
;; (ullong (1- (expt 2 64))) => 18446744073709551615 ;; ;; But when :call-direct kicks in: ;; (test-ullong) => -1
Bug report sent to Franz.
(in-package :cl-user)
#||
#include <limits.h>
unsigned long long ullong(unsigned long long n)
{
return n == ULLONG_MAX ? n : 42;
}
||#
(ff:def- foreign- call (ullong "ullong")
((n :unsigned-nat (unsigned-byte 64)))
:returning (:unsigned-nat (unsigned-byte 64))
:call-direct t ; setting this to nil fixes the symptoms.
:arg-checking nil
:strings-convert nil)
(defun test-ullong ()
(ullong (1- (expt 2 64))))
;; (ullong (1- (expt 2 64))) => 184467440737095 51615
;;
;; But when :call-direct kicks in:
;; (test-ullong) => -1