diff --git a/build.vc10/mpir-tests.sln b/build.vc10/mpir-tests.sln
index 806f7d37..684e92d7 100644
--- a/build.vc10/mpir-tests.sln
+++ b/build.vc10/mpir-tests.sln
@@ -386,6 +386,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpz.get_sx", "mpir-tests\mp
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpz.set_sx", "mpir-tests\mpz.set_sx\mpz.set_sx.vcxproj", "{1B7D1F86-1AB3-DDD9-AC36-2D662F084C74}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpz.get_ux", "mpir-tests\mpz.get_ux\mpz.get_ux.vcxproj", "{8A3E4C00-5F34-9336-1BCB-191297512751}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpz.set_ux", "mpir-tests\mpz.set_ux\mpz.set_ux.vcxproj", "{5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -1468,6 +1472,22 @@ Global
{1B7D1F86-1AB3-DDD9-AC36-2D662F084C74}.Release|Win32.Build.0 = Release|Win32
{1B7D1F86-1AB3-DDD9-AC36-2D662F084C74}.Release|x64.ActiveCfg = Release|x64
{1B7D1F86-1AB3-DDD9-AC36-2D662F084C74}.Release|x64.Build.0 = Release|x64
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Debug|Win32.Build.0 = Debug|Win32
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Debug|x64.ActiveCfg = Debug|x64
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Debug|x64.Build.0 = Debug|x64
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Release|Win32.ActiveCfg = Release|Win32
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Release|Win32.Build.0 = Release|Win32
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Release|x64.ActiveCfg = Release|x64
+ {8A3E4C00-5F34-9336-1BCB-191297512751}.Release|x64.Build.0 = Release|x64
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Debug|Win32.Build.0 = Debug|Win32
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Debug|x64.ActiveCfg = Debug|x64
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Debug|x64.Build.0 = Debug|x64
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Release|Win32.ActiveCfg = Release|Win32
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Release|Win32.Build.0 = Release|Win32
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Release|x64.ActiveCfg = Release|x64
+ {5D22AD36-ABC5-6849-CC50-8F357A9FD0CD}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/build.vc10/mpir-tests/mpz.get_ux/mpz.get_ux.vcxproj b/build.vc10/mpir-tests/mpz.get_ux/mpz.get_ux.vcxproj
new file mode 100644
index 00000000..e46d9473
--- /dev/null
+++ b/build.vc10/mpir-tests/mpz.get_ux/mpz.get_ux.vcxproj
@@ -0,0 +1,161 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ mpz.get_ux
+ Win32Proj
+
+
+
+ Application
+ MultiByte
+
+
+ Application
+ MultiByte
+
+
+ Application
+ MultiByte
+
+
+ Application
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.21006.1
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ Disabled
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ false
+
+
+ MachineX86
+
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ X64
+
+
+ Disabled
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ false
+
+
+ MachineX64
+
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ true
+ true
+ false
+
+
+ MachineX86
+
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ X64
+
+
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ true
+ true
+ false
+
+
+ MachineX64
+
+
+
+
+
+
+
+ {a742d3d1-6956-4f85-bfd6-b0e7b477041d}
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.vc10/mpir-tests/mpz.set_sx/mpz.set_sx.vcxproj b/build.vc10/mpir-tests/mpz.set_sx/mpz.set_sx.vcxproj
index c0cc83b0..9ac8e441 100644
--- a/build.vc10/mpir-tests/mpz.set_sx/mpz.set_sx.vcxproj
+++ b/build.vc10/mpir-tests/mpz.set_sx/mpz.set_sx.vcxproj
@@ -79,7 +79,6 @@
MachineX86
- true
@@ -102,7 +101,6 @@
MachineX64
- true
diff --git a/build.vc10/mpir-tests/mpz.set_ux/mpz.set_ux.vcxproj b/build.vc10/mpir-tests/mpz.set_ux/mpz.set_ux.vcxproj
new file mode 100644
index 00000000..6b9fdfee
--- /dev/null
+++ b/build.vc10/mpir-tests/mpz.set_ux/mpz.set_ux.vcxproj
@@ -0,0 +1,163 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ mpz.set_ux
+ Win32Proj
+
+
+
+ Application
+ MultiByte
+
+
+ Application
+ MultiByte
+
+
+ Application
+ MultiByte
+
+
+ Application
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.21006.1
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ Disabled
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ false
+
+
+ MachineX86
+
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ X64
+
+
+ Disabled
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ false
+
+
+ MachineX64
+
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ Full
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ true
+ true
+ false
+
+
+ MachineX86
+
+
+
+
+ ..\check_config $(Platform) $(Configuration)
+
+
+ X64
+
+
+ Full
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+
+
+ Default
+
+
+ Console
+ true
+ true
+ false
+
+
+ MachineX64
+
+
+
+
+
+
+
+ {a742d3d1-6956-4f85-bfd6-b0e7b477041d}
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mpz/iset_ux.c b/mpz/iset_ux.c
index f9377bed..a79337c2 100644
--- a/mpz/iset_ux.c
+++ b/mpz/iset_ux.c
@@ -31,7 +31,7 @@ MA 02110-1301, USA. */
void
mpz_init_set_ux (mpz_ptr z, uintmax_t v)
-{ uintmax_t i;
+{ uintmax_t i, uv;
z->_mp_d = (mp_ptr) (*__gmp_allocate_func) (MAX(1, NLIMBS) * BYTES_PER_MP_LIMB);
z->_mp_alloc = MAX(1, NLIMBS);
@@ -40,10 +40,10 @@ mpz_init_set_ux (mpz_ptr z, uintmax_t v)
z->_mp_d[0] = (mp_limb_t)v;
z->_mp_size = (v ? NLIMBS : 0);
#else
- for( i = 0 ; i < NLIMBS && v ; ++i )
+ for( i = 0, uv = v ; i < NLIMBS && uv ; ++i )
{
- z->_mp_d[i] = v & GMP_NUMB_MASK;
- v >>= GMP_NUMB_BITS;
+ z->_mp_d[i] = uv & GMP_NUMB_MASK;
+ uv >>= GMP_NUMB_BITS;
}
z->_mp_size = (v ? i : 0);
#endif
diff --git a/mpz/set_ux.c b/mpz/set_ux.c
index a53ac28c..0bcb271c 100644
--- a/mpz/set_ux.c
+++ b/mpz/set_ux.c
@@ -31,7 +31,7 @@ MA 02110-1301, USA. */
void
mpz_set_ux (mpz_ptr z, uintmax_t v)
-{ uintmax_t i;
+{ uintmax_t i, uv;
#if GMP_NUMB_BITS >= 8 * SIZEOF_UINTMAX_T
z->_mp_d[0] = (mp_limb_t)v;
@@ -39,10 +39,10 @@ mpz_set_ux (mpz_ptr z, uintmax_t v)
#else
if(NLIMBS > z->_mp_alloc)
MPZ_REALLOC(z, NLIMBS);
- for( i = 0 ; i < NLIMBS && v ; ++i )
+ for( i = 0, uv = v ; i < NLIMBS && uv ; ++i )
{
- z->_mp_d[i] = v & GMP_NUMB_MASK;
- v >>= GMP_NUMB_BITS;
+ z->_mp_d[i] = uv & GMP_NUMB_MASK;
+ uv >>= GMP_NUMB_BITS;
}
z->_mp_size = (v ? i : 0);
#endif