Compare commits

...

11 Commits
f32 ... rawhide

Author SHA1 Message Date
Richard W.M. Jones
70f9a87569 OCaml 4.12.0 build 2021-03-01 23:32:57 +00:00
Fedora Release Engineering
f524a1c7cd - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 22:08:47 +00:00
Jerry James
f707afdca5 Skip 128-bit tests on 32-bit architectures. 2020-12-02 16:29:47 -07:00
Jerry James
33d9317131 Version 0.7.0. Add -lognot and -test patches. 2020-12-02 16:10:55 -07:00
Richard W.M. Jones
8d8de1fed0 OCaml 4.11.1 rebuild 2020-09-01 23:56:08 +01:00
Richard W.M. Jones
3f0c59c45d OCaml 4.11.0 rebuild 2020-08-21 19:43:34 +01:00
Fedora Release Engineering
72ba11007b - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-08-01 06:44:44 +00:00
Fedora Release Engineering
02e832a3ae - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 12:20:13 +00:00
Richard W.M. Jones
8ef86465c3 OCaml 4.11.0+dev2-2020-04-22 rebuild 2020-05-05 15:51:47 +01:00
Richard W.M. Jones
d057f39592 OCaml 4.11.0 pre-release attempt 2 2020-04-22 15:18:54 +01:00
Richard W.M. Jones
efdbcfc2ad Update all OCaml dependencies for RPM 4.16. 2020-04-04 16:27:57 +01:00
4 changed files with 225 additions and 7 deletions

135
ocaml-stdint-lognot.patch Normal file
View File

@ -0,0 +1,135 @@
diff --git a/lib/int40_stubs.c b/lib/int40_stubs.c
index 6a374fe..7f36caa 100644
--- a/lib/int40_stubs.c
+++ b/lib/int40_stubs.c
@@ -29,6 +29,13 @@ int40_div(value v1, value v2)
CAMLreturn (copy_int40((Int64_val(v1) / divisor) << 24));
}
+CAMLprim value
+int40_xor(value v1, value v2)
+{
+ CAMLparam2(v1, v2);
+ CAMLreturn (copy_int40((Int64_val(v1) ^ Int64_val(v2)) & mask));
+}
+
CAMLprim value
int40_shift_right(value v1, value v2)
{
diff --git a/lib/int48_stubs.c b/lib/int48_stubs.c
index 3173e3b..20f7141 100644
--- a/lib/int48_stubs.c
+++ b/lib/int48_stubs.c
@@ -29,6 +29,13 @@ int48_div(value v1, value v2)
CAMLreturn (copy_int48((Int64_val(v1) / divisor) << 16));
}
+CAMLprim value
+int48_xor(value v1, value v2)
+{
+ CAMLparam2(v1, v2);
+ CAMLreturn (copy_int48((Int64_val(v1) ^ Int64_val(v2)) & mask));
+}
+
CAMLprim value
int48_shift_right(value v1, value v2)
{
diff --git a/lib/int56_stubs.c b/lib/int56_stubs.c
index 49e6e81..690cb6a 100644
--- a/lib/int56_stubs.c
+++ b/lib/int56_stubs.c
@@ -29,6 +29,13 @@ int56_div(value v1, value v2)
CAMLreturn (copy_int56((Int64_val(v1) / divisor) << 8));
}
+CAMLprim value
+int56_xor(value v1, value v2)
+{
+ CAMLparam2(v1, v2);
+ CAMLreturn (copy_int56((Int64_val(v1) ^ Int64_val(v2)) & mask));
+}
+
CAMLprim value
int56_shift_right(value v1, value v2)
{
diff --git a/lib/stdint.ml b/lib/stdint.ml
index b53d3d2..b89c83d 100644
--- a/lib/stdint.ml
+++ b/lib/stdint.ml
@@ -434,7 +434,7 @@ module Int40 = struct
external mul : int40 -> int40 -> int40 = "int40_mul"
external div : int40 -> int40 -> int40 = "int40_div"
- external logxor : int40 -> int40 -> int40 = "uint40_xor"
+ external logxor : int40 -> int40 -> int40 = "int40_xor"
external shift_right : int40 -> int -> int40 = "int40_shift_right"
external shift_right_logical : int40 -> int -> int40 = "uint40_shift_right"
@@ -485,9 +485,10 @@ module Int40 = struct
external max_int_fun : unit -> int40 = "int40_max_int"
external min_int_fun : unit -> int40 = "int40_min_int"
let one = of_int 1
+ let minus_one = of_int (-1)
let max_int = max_int_fun ()
let min_int = min_int_fun ()
- let lognot = logxor max_int
+ let lognot = logxor minus_one
let compare = Stdint_stdlib_.compare
let divmod = (fun x y -> div x y, rem x y)
end
@@ -518,7 +519,7 @@ module Int48 = struct
external mul : int48 -> int48 -> int48 = "int48_mul"
external div : int48 -> int48 -> int48 = "int48_div"
- external logxor : int48 -> int48 -> int48 = "uint48_xor"
+ external logxor : int48 -> int48 -> int48 = "int48_xor"
external shift_right : int48 -> int -> int48 = "int48_shift_right"
external shift_right_logical : int48 -> int -> int48 = "uint48_shift_right"
@@ -569,9 +570,10 @@ module Int48 = struct
external max_int_fun : unit -> int48 = "int48_max_int"
external min_int_fun : unit -> int48 = "int48_min_int"
let one = of_int 1
+ let minus_one = of_int (-1)
let max_int = max_int_fun ()
let min_int = min_int_fun ()
- let lognot = logxor max_int
+ let lognot = logxor minus_one
let compare = Stdint_stdlib_.compare
let divmod = (fun x y -> div x y, rem x y)
end
@@ -602,7 +604,7 @@ module Int56 = struct
external mul : int56 -> int56 -> int56 = "int56_mul"
external div : int56 -> int56 -> int56 = "int56_div"
- external logxor : int56 -> int56 -> int56 = "uint56_xor"
+ external logxor : int56 -> int56 -> int56 = "int56_xor"
external shift_right : int56 -> int -> int56 = "int56_shift_right"
external shift_right_logical : int56 -> int -> int56 = "uint56_shift_right"
@@ -653,9 +655,10 @@ module Int56 = struct
external max_int_fun : unit -> int56 = "int56_max_int"
external min_int_fun : unit -> int56 = "int56_min_int"
let one = of_int 1
+ let minus_one = of_int (-1)
let max_int = max_int_fun ()
let min_int = min_int_fun ()
- let lognot = logxor max_int
+ let lognot = logxor minus_one
let compare = Stdint_stdlib_.compare
let divmod = (fun x y -> div x y, rem x y)
end
@@ -742,11 +745,12 @@ module Int128 = struct
let zero = of_int 0
let one = of_int 1
+ let minus_one = of_int (-1)
let succ = add one
let pred x = sub x one
let max_int = max_int_fun ()
let min_int = min_int_fun ()
- let lognot = logxor max_int
+ let lognot = logxor minus_one
let compare = Stdint_stdlib_.compare
let divmod = (fun x y -> div x y, rem x y)

37
ocaml-stdint-test.patch Normal file
View File

@ -0,0 +1,37 @@
--- a/tests/stdint_test.ml
+++ b/tests/stdint_test.ml
@@ -22,7 +22,8 @@ struct
let () = assert (mini < maxi)
let in_range = QCheck.int_range mini maxi
- let pos_int = QCheck.map_same_type abs in_range
+ let pos_range = QCheck.int_range 0 maxi
+ let pos_int = QCheck.map_same_type abs pos_range
let in_range_float =
QCheck.float_range (float_of_int mini) (float_of_int maxi)
end
@@ -60,9 +61,11 @@ struct
test "An integer should perform logical-not correctly"
pos_int (fun x -> lognot (of_int x) = of_int (lnot x)) ;
+ (* Test is broken for Int64, Uint64, Int128, and Uint128
test "An integer should perform left-shifts correctly"
QCheck.(pair in_range (int_bound 31)) (fun (x, y) ->
shift_left (of_int x) y = of_int (x lsl y)) ;
+ *)
test "An integer should perform right-shifts correctly"
QCheck.(pair in_range (int_bound 31)) (fun (x, y) ->
@@ -73,10 +76,12 @@ struct
let v = shift_right min_int i in
(compare min_int zero) *** (compare v zero) >= 0) ;
+ (* Test is broken for Int128
test "Logical shifts must not sign-extend"
QCheck.(int_range 0 200) (fun i ->
let v = shift_right_logical min_int i in
compare v zero >= 0) ;
+ *)
test "An integer should perform float conversions correctly"
in_range_float (fun x ->

View File

@ -5,17 +5,25 @@
%global srcname stdint %global srcname stdint
Name: ocaml-%{srcname} Name: ocaml-%{srcname}
Version: 0.6.0 Version: 0.7.0
Release: 2%{?dist} Release: 3%{?dist}
Summary: Various signed and unsigned integers for OCaml Summary: Various signed and unsigned integers for OCaml
License: MIT License: MIT
URL: https://github.com/andrenth/%{name} URL: https://github.com/andrenth/%{name}
Source0: %{url}/releases/download/%{version}/%{srcname}-%{version}.tbz Source0: %{url}/releases/download/%{version}/%{srcname}-%{version}.tbz
# Fix lognot and logxor for Int40, Int48, Int56, and Int128
# https://github.com/andrenth/ocaml-stdint/pull/60
Patch0: %{name}-lognot.patch
# Fix or disable broken tests
# https://github.com/andrenth/ocaml-stdint/issues/59
Patch1: %{name}-test.patch
BuildRequires: ocaml >= 4.07 BuildRequires: ocaml >= 4.03
BuildRequires: ocaml-dune >= 1.11 BuildRequires: ocaml-dune >= 1.10
BuildRequires: ocaml-odoc BuildRequires: ocaml-odoc
BuildRequires: ocaml-ounit-devel
BuildRequires: ocaml-qcheck-devel
%description %description
The stdint library provides signed and unsigned integer types of various The stdint library provides signed and unsigned integer types of various
@ -45,10 +53,16 @@ BuildArch: noarch
Documentation for %{name}. Documentation for %{name}.
%prep %prep
%autosetup -n %{srcname}-%{version} %autosetup -n %{srcname}-%{version} -p1
# Skip 128-bit tests on 32-bit platforms. The necessary functions are not
# fully implemented.
%if 0%{?__isa_bits} == 32
sed -i '/"Int128.*"/d;/"Uint128.*"/d' tests/stdint_test.ml
%endif
%build %build
dune build %{?_smp_mflags} dune build %{?_smp_mflags} --display=verbose
dune build %{?_smp_mflags} @doc dune build %{?_smp_mflags} @doc
# Relink the stublib with RPM_LD_FLAGS # Relink the stublib with RPM_LD_FLAGS
@ -108,6 +122,38 @@ dune runtest
%license LICENSE %license LICENSE
%changelog %changelog
* Mon Mar 1 23:32:56 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 0.7.0-3
- OCaml 4.12.0 build
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Dec 2 2020 Jerry James <loganjerry@gmail.com> - 0.7.0-1
- Version 0.7.0
- Add -lognot and -test patches
* Tue Sep 01 2020 Richard W.M. Jones <rjones@redhat.com> - 0.6.0-9
- OCaml 4.11.1 rebuild
* Fri Aug 21 2020 Richard W.M. Jones <rjones@redhat.com> - 0.6.0-8
- OCaml 4.11.0 rebuild
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-7
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 05 2020 Richard W.M. Jones <rjones@redhat.com> - 0.6.0-5
- OCaml 4.11.0+dev2-2020-04-22 rebuild
* Wed Apr 22 2020 Richard W.M. Jones <rjones@redhat.com> - 0.6.0-4
- OCaml 4.11.0 pre-release attempt 2
* Sat Apr 04 2020 Richard W.M. Jones <rjones@redhat.com> - 0.6.0-3
- Update all OCaml dependencies for RPM 4.16.
* Wed Mar 4 2020 Jerry James <loganjerry@gmail.com> - 0.6.0-2 * Wed Mar 4 2020 Jerry James <loganjerry@gmail.com> - 0.6.0-2
- OCaml 4.10.0 final - OCaml 4.10.0 final

View File

@ -1 +1 @@
SHA512 (stdint-0.6.0.tbz) = 00d1f864d0f353c4922c4c743df209893e3558a7cee9a1e7e51be5da691657ad5f1d22acf8bee583573c08166f8b2705632fd955e100dd0dea8be4e9d2fbcc48 SHA512 (stdint-0.7.0.tbz) = 9b05b6cf691320b718dd2118b1e3f96a2997e42e6c99a34b470b060c82fc16c50d57c6ee392d1b62bdb8df73094657eea56050da3e74745a4afb0f150a60a584