fix behavior to be correct on arm (and all other platforms)

This commit is contained in:
Tom Callaway 2013-08-16 10:00:52 -04:00
parent 0c1652a730
commit 9558414a12
2 changed files with 19 additions and 1 deletions

12
R-bitops-armfix.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up bitops/bitops/src/bit-ops.c.armfix bitops/bitops/src/bit-ops.c
--- bitops/bitops/src/bit-ops.c.armfix 2013-08-16 09:54:59.216088912 -0400
+++ bitops/bitops/src/bit-ops.c 2013-08-16 09:55:23.444089276 -0400
@@ -29,7 +29,7 @@ SEXP bitFlip(SEXP a, SEXP bitWidth ) {
if ( !R_FINITE(xa[i]) || logb(xa[i])>31 ) xaflip[i]=NA_REAL ;
else {
- tmp=(unsigned int) xa[i] ;
+ tmp=xa[i] < 0 ? (int) xa[i] : (unsigned) xa[i];
xaflip[i]=(double) ( ~tmp & mask ) ;
}
}

View File

@ -3,13 +3,14 @@
Name: R-%{packname}
Version: 1.0.5
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Functions for Bitwise operations
Group: Applications/Productivity
License: GPLv2+
URL: http://cran.r-project.org/web/packages/bitops/index.html
Source0: http://cran.r-project.org/src/contrib/%{packname}_%{packvers}.tar.gz
Patch0: R-bitops-armfix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: R-core >= 3.0.0
BuildRequires: R-devel >= 3.0.0, tex(latex)
@ -19,6 +20,7 @@ Functions for Bitwise operations on integer vectors.
%prep
%setup -c -q -n %{packname}
%patch0 -p1 -b .armfix
%build
%install
@ -48,6 +50,10 @@ test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
%{_libdir}/R/library/%{packname}/libs
%changelog
* Fri Aug 16 2013 Tom Callaway <spot@fedoraproject.org> - 1.0.5-3
- fix bug on arm where casting double to unsigned is undefined if the value is negative
Many thanks to Florian Weimer.
* Fri Aug 02 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild