Boost logo

Boost-Commit :

From: zeux_at_[hidden]
Date: 2007-05-17 14:48:46


Author: zeux
Date: 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
New Revision: 4100
URL: http://svn.boost.org/trac/boost/changeset/4100

Log:
Implicit conversion to bool, fast operator!() (is_zero function), MSVC warning fixes, some basic test framework

Added:
   sandbox/SOC/2007/bigint/Jamfile.v2
   sandbox/SOC/2007/bigint/libs/bigint/build/
   sandbox/SOC/2007/bigint/libs/bigint/build/Jamfile.v2
   sandbox/SOC/2007/bigint/libs/bigint/test/
   sandbox/SOC/2007/bigint/libs/bigint/test/Jamfile.v2
   sandbox/SOC/2007/bigint/libs/bigint/test/bigint_simple_test.cpp
Properties modified:
   sandbox/SOC/2007/bigint/ (props changed)
Text files modified:
   sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp | 63 +++++++++++++++++++++++++++++++++++----
   sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp | 5 +++
   sandbox/SOC/2007/bigint/boost/bigint/bigint_util.hpp | 4 +-
   sandbox/SOC/2007/bigint/libs/bigint/todo.txt | 21 +++++++-----
   4 files changed, 75 insertions(+), 18 deletions(-)

Added: sandbox/SOC/2007/bigint/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/Jamfile.v2 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -0,0 +1,476 @@
+# Copyright Vladimir Prus 2002-2006.
+# Copyright Dave Abrahams 2005-2006.
+# Copyright Rene Rivera 2005-2006.
+# Copyright Douglas Gregor 2005.
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# Usage:
+#
+# bjam [options] [install|stage]
+#
+# Builds and installs Boost.
+#
+# Targets and Related Options:
+#
+# install Install headers and compiled library files to the
+# ======= configured locations (below).
+#
+# --prefix=<PREFIX> Install architecture independent files here.
+# Default; C:\Boost on Win32
+# Default; /usr/local on Unix. Linux, etc.
+#
+# --exec-prefix=<EPREFIX> Install architecture dependent files here.
+# Default; <PREFIX>
+#
+# --libdir=<DIR> Install library files here.
+# Default; <EPREFIX>/lib
+#
+# --includedir=<HDRDIR> Install header files here.
+# Default; <PREFIX>/include
+#
+# stage Build and install only compiled library files
+# ===== to the stage directory.
+#
+# --stagedir=<STAGEDIR> Install library files here
+# Default; ./stage
+#
+# Other Options:
+#
+# --builddir=DIR Build in this location instead of building
+# within the distribution tree. Recommended!
+#
+# --toolset=toolset Indicates the toolset to build with.
+#
+# --show-libraries Displays the list of Boost libraries that require
+# build and installation steps, then exit.
+#
+# --layout=<layout> Determines whether to choose library names
+# and header locations such that multiple
+# versions of Boost or multiple compilers can
+# be used on the same system.
+#
+# versioned (default) - Names of boost
+# binaries include the Boost version
+# number and the name and version of the
+# compiler. Boost headers are installed
+# in a subdirectory of <HDRDIR> whose
+# name contains the Boost version
+# number.
+#
+# system - Binaries names do not include
+# the Boost version number or the name
+# and version number of the compiler.
+# Boost headers are installed directly
+# into <HDRDIR>. This option is
+# intended for system integrators who
+# are building distribution packages.
+#
+# --buildid=ID Adds the specified ID to the name of built
+# libraries. The default is to not add anything.
+#
+# --help This message.
+#
+# --with-<library> Build and install the specified <library>
+# If this option is used, only libraries
+# specified using this option will be built.
+#
+# --without-<library> Do not build, stage, or install the specified
+# <library>. By default, all libraries are built.
+
+# TODO:
+# - handle boost version
+# - handle python options such as pydebug
+
+import modules ;
+import set ;
+import stage ;
+import package ;
+import path ;
+import common ;
+import os ;
+import regex ;
+import errors ;
+import "class" : new ;
+import common ;
+
+constant BOOST_VERSION : 1.34.0 ;
+
+local version-tag = [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ] ;
+if $(version-tag[3]) = 0
+{
+ version-tag = $(version-tag[1-2]) ;
+}
+
+constant BOOST_VERSION_TAG : $(version-tag:J="_") ;
+
+local default-build ;
+if $(__file__:D) = ""
+{
+ default-build =
+ debug release
+ <threading>single <threading>multi
+ <link>shared <link>static
+ ;
+
+ if [ os.name ] = NT
+ {
+ default-build += <runtime-link>shared <runtime-link>static ;
+ }
+}
+else
+{
+ default-build =
+ debug
+ ;
+}
+
+
+rule handle-static-runtime ( properties * )
+{
+ # This property combination is dangerous.
+ # Ideally, we'd add constraint to default build,
+ # so that user can build with property combination
+ # by hand. But we don't have any 'constraint' mechanism
+ # for default-build, so disable such builds in requirements.
+
+ # For CW, static runtime is needed so that
+ # std::locale works.
+ if <link>shared in $(properties)
+ && <runtime-link>static in $(properties)
+ && ! ( <toolset>cw in $(properties) )
+ {
+ return <build>no ;
+ }
+}
+
+
+project boost
+ : requirements <include>.
+ # disable auto-linking for all targets here,
+ # primarily because it caused troubles with V2
+ <define>BOOST_ALL_NO_LIB=1
+ # Used to encode variant in target name. See the
+ # 'tag' rule below.
+ <tag>@$(__name__).tag
+ <conditional>@handle-static-runtime
+
+ : usage-requirements <include>.
+ : build-dir bin.v2
+ : default-build $(default-build)
+ ;
+
+# Setup convenient aliases for all libraries.
+
+all-libraries =
+ [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] ]
+ ;
+
+# First, the complicated libraries: where the target name in
+# Jamfile is different from directory name.
+alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
+alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
+alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
+alias bgl-vis : libs/graps/build//bgl-vis ;
+alias serialization : libs/serialization/build//boost_serialization ;
+alias wserialization : libs/serialization/build//boost_wserialization ;
+
+explicit prg_exec_monitor test_exec_monitor unit_test_framework
+ bgl-vis serialization wserialization ;
+
+for local l in $(all-libraries)
+{
+ if ! $(l) in test graph serialization
+ {
+ alias $(l) : libs/$(l)/build//boost_$(l) ;
+ explicit $(l) ;
+ }
+}
+
+alias headers : : : : <include>. ;
+
+
+# Decides which libraries are to be installed by looking at --with-<library>
+# --without-<library> arguments. Returns the list of directories under "libs"
+# which must be built at installed.
+rule libraries-to-install ( existing-libraries * )
+{
+ local argv = [ modules.peek : ARGV ] ;
+ local with-parameter = [ MATCH --with-(.*) : $(argv) ] ;
+ local without-parameter = [ MATCH --without-(.*) : $(argv) ] ;
+
+ # Do some checks
+ if $(with-parameter) && $(without-parameter)
+ {
+ ECHO "error: both --with-<library> and --without-<library> specified" ;
+ EXIT ;
+ }
+
+ local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ;
+ if $(wrong)
+ {
+ ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ;
+ EXIT ;
+ }
+ local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ;
+ if $(wrong)
+ {
+ ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ;
+ EXIT ;
+ }
+
+ if $(with-parameter)
+ {
+ return [ set.intersection $(existing-libraries) : $(with-parameter) ] ;
+ }
+ else
+ {
+ return [ set.difference $(existing-libraries) : $(without-parameter) ] ;
+ }
+}
+
+# what kind of layout are we doing?
+layout = [ MATCH "^--layout=(.*)" : [ modules.peek : ARGV ] ] ;
+layout ?= versioned ;
+layout-$(layout) = true ;
+
+# possible stage only location
+local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
+stage-locate ?= stage ;
+
+path-constant BOOST_STAGE_LOCATE : $(stage-locate) ;
+
+
+# location of python
+local python-root = [ MATCH "^--with-python-root=(.*)" : [ modules.peek : ARGV ] ] ;
+PYTHON_ROOT ?= $(python-root) ;
+
+# Select the libraries to install.
+libraries = [ libraries-to-install $(all-libraries) ] ;
+
+if --show-libraries in [ modules.peek : ARGV ]
+{
+ ECHO "The following libraries require building:" ;
+ for local l in $(libraries)
+ {
+ ECHO " - $(l)" ;
+ }
+ EXIT ;
+}
+
+# Custom build ID.
+local build-id = [ MATCH "^--buildid=(.*)" : [ modules.peek : ARGV ] ] ;
+if $(build-id)
+{
+ constant BUILD_ID : [ regex.replace $(build-id) "[*\\/:.\"\' ]" "_" ] ;
+}
+
+# This rule is called by Boost.Build to determine the name of
+# target. We use it to encode build variant, compiler name and
+# boost version in the target name
+rule tag ( name : type ? : property-set )
+{
+ if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
+ {
+ if $(layout) = versioned
+ {
+ local result = [ common.format-name
+ <base> <toolset> <threading> <runtime> -$(BOOST_VERSION_TAG)
+ -$(BUILD_ID)
+ : $(name) : $(type) : $(property-set) ] ;
+
+ # Optionally add version suffix.
+ # On NT, library with version suffix won't be recognized
+ # by linkers. On CYGWIN, we get strage duplicate symbol
+ # errors when library is generated with version suffix.
+ # On OSX, version suffix is not needed -- the linker expets
+ # libFoo.1.2.3.dylib format.
+ # AIX linkers don't accept version suffixes either.
+ if $(type) = SHARED_LIB &&
+ ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix )
+ {
+ result = $(result).$(BOOST_VERSION) ;
+ }
+
+ return $(result) ;
+ }
+ else
+ {
+ return [ common.format-name
+ <base> <threading> <runtime> -$(BUILD_ID)
+ : $(name) : $(type) : $(property-set) ] ;
+ }
+ }
+}
+
+# Install to system location.
+
+local install-requirements =
+ <install-source-root>boost
+ ;
+if $(layout-versioned)
+{
+ install-requirements += <install-header-subdir>boost-$(BOOST_VERSION_TAG)/boost ;
+}
+else
+{
+ install-requirements += <install-header-subdir>boost ;
+}
+if [ modules.peek : NT ]
+{
+ install-requirements += <install-default-prefix>C:/Boost ;
+}
+else if [ modules.peek : UNIX ]
+{
+ install-requirements += <install-default-prefix>/usr/local ;
+}
+
+local headers =
+ [ path.glob-tree boost : *.hpp *.ipp *.h *.inc : CVS ]
+ [ path.glob-tree boost/compatibility/cpp_c_headers : c* : CVS ]
+ [ path.glob-tree boost/test/utils/runtime : *.cpp : CVS ]
+ [ path.glob-tree boost/spirit/tree :
+ parsetree.dtd : CVS ]
+ [ path.glob-tree boost/tr1/tr1 :
+ algorithm array bitset complex deque exception fstream functional
+ iomanip ios iostream istream iterator limits list locale map
+ memory new numeric ostream queue random regex set sstream stack
+ stdexcept streambuf string strstream tuple type_traits typeinfo
+ utility valarray vector *.SUNWCCh : CVS ]
+ ;
+
+
+# Complete install
+package.install install-proper
+ : $(install-requirements) <install-no-version-symlinks>on
+ :
+ : libs/$(libraries)/build
+ : $(headers)
+ ;
+explicit install-proper ;
+
+# Install just library.
+install stage-proper
+ : libs/$(libraries)/build
+ : <location>$(stage-locate)/lib
+ <install-dependencies>on <install-type>LIB
+ <install-no-version-symlinks>on
+ ;
+explicit stage-proper ;
+
+
+if $(layout-versioned)
+ && ( [ modules.peek : NT ] || [ modules.peek : UNIX ] )
+{
+ rule make-unversioned-links ( project name ? : property-set : sources * )
+ {
+ local result ;
+ local filtered ;
+ local pattern ;
+ local nt = [ modules.peek : NT ] ;
+
+ # Collect the libraries that have the version number in 'filtered'.
+ for local s in $(sources)
+ {
+ local m ;
+ if $(nt)
+ {
+ m = [ MATCH "(.*[.]lib)" : [ $(s).name ] ] ;
+ }
+ else
+ {
+ m = [ MATCH "(.*[.]so[.0-9]+)" "(.*[.]a)" : [ $(s).name ] ] ;
+ }
+ if $(m)
+ {
+ filtered += $(s) ;
+ }
+ }
+
+ # Create hardlinks without version.
+ for local s in $(filtered)
+ {
+ local name = [ $(s).name ] ;
+ local ea = [ $(s).action ] ;
+ local ep = [ $(ea).properties ] ;
+ local a = [
+ new non-scanning-action $(s) : common.hard-link : $(ep) ] ;
+
+ local noversion-file ;
+ if $(nt)
+ {
+ noversion-file = [ MATCH "(.*)-[0-9_]+([.]lib)" : $(name) ] ;
+ }
+ else
+ {
+ noversion-file =
+ [ MATCH "(.*)-[0-9_]+([.]so)[.0-9]*" : $(name) ]
+ [ MATCH "(.*)-[0-9_]+([.]a)" : $(name) ] ;
+ }
+
+ local new-name =
+ $(noversion-file[1])$(noversion-file[2]) ;
+ result += [ new file-target $(new-name) exact : [ $(s).type ] : $(project)
+ : $(a) ] ;
+
+ }
+ return $(result) ;
+ }
+
+ generate stage-unversioned : stage-proper :
+ <generating-rule>@make-unversioned-links ;
+ explicit stage-unversioned ;
+
+ generate install-unversioned : install-proper :
+ <generating-rule>@make-unversioned-links ;
+ explicit install-unversioned ;
+}
+else
+{
+ # Create do-nothing aliases
+ alias stage-unversioned ;
+ alias install-unversioned ;
+}
+
+alias install : install-proper install-unversioned ;
+alias stage : stage-proper stage-unversioned ;
+explicit install ;
+explicit stage ;
+
+
+# Just build the libraries, don't install them anywhere.
+# This is what happens with just "bjam --v2".
+alias build_all : libs/$(libraries)/build ;
+
+# This rule should be called from libraries' Jamfiles and will
+# create two targets, "install" and "stage", that will install
+# or stage that library. The --prefix option is respected, by
+# --with and --without options, naturally, are ignored.
+#
+# - libraries -- list of library targets to install.
+rule boost-install ( libraries * )
+{
+ package.install install
+ : <dependency>/boost//install-headers $(install-requirements)
+ : # No binaries
+ : $(libraries)
+ : # No headers, it's handled by the dependency
+ ;
+
+ install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
+
+ local c = [ project.current ] ;
+ local project-module = [ $(c).project-module ] ;
+ module $(project-module)
+ {
+ explicit stage ;
+ }
+}
+
+# Make project ids of all libraries known.
+for local l in $(libraries)
+{
+ use-project /boost/$(l) : libs/$(l)/build ;
+}

Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -175,13 +175,62 @@
                 return result;
         }
         
- bool operator!() const
- {
- return *this == 0;
- }
-
- // some safe bool conversion operator here - I'm not writing one now because
- // none is portable :) need to steal it from boost::shared_ptr
+ // implicit conversion to "bool"
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
+
+ operator bool () const
+ {
+ return impl;
+ }
+
+#elif defined( _MANAGED )
+
+private:
+ static void unspecified_bool( bigint_base*** )
+ {
+ }
+
+ typedef void (*unspecified_bool_type)( bigint_base*** );
+
+public:
+ operator unspecified_bool_type() const // never throws
+ {
+ return impl.is_zero() ? 0 : unspecified_bool;
+ }
+
+#elif \
+ ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
+ ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) )
+
+private:
+ typedef std::string (bigint_base::*unspecified_bool_type)(int) const;
+
+public:
+ operator unspecified_bool_type() const // never throws
+ {
+ return impl.is_zero() ? 0 : &bigint_base::str;
+ }
+
+#else
+
+private:
+ typedef I* bigint_base::*unspecified_bool_type;
+
+public:
+ operator unspecified_bool_type() const // never throws
+ {
+ return impl.is_zero() ? 0 : &bigint_base::impl;
+ }
+
+#endif
+
+ // operator! is redundant, but some compilers need it
+
+ bool operator! () const // never throws
+ {
+ return impl.is_zero();
+ }
 
         std::string str(int base = 10) const
         {

Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -248,6 +248,11 @@
                 {
                         return mpz_get_si(data);
                 }
+
+ bool is_zero() const
+ {
+ return mpz_sgn(data) == 0;
+ }
                 
                 void abs(const bigint_gmp_implementation& rhs)
                 {

Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint_util.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint_util.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint_util.hpp 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -14,12 +14,12 @@
 
         inline bool isspace(char ch)
         {
- return ::isspace(ch);
+ return ::isspace(ch) != 0;
         }
         
         inline bool isspace(wchar_t ch)
         {
- return ::iswspace(ch);
+ return ::iswspace(ch) != 0;
         }
         
         inline size_t length(const char* str)

Added: sandbox/SOC/2007/bigint/libs/bigint/build/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/bigint/build/Jamfile.v2 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -0,0 +1,9 @@
+##############################################################################
+# Copyright 2007 Arseny Kapoulkine
+# Distributed under the Boost Software License, Version 1.0. (See accompany-
+# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+##############################################################################
+
+project libs/bigint ;
+
+build-project ../test ;

Added: sandbox/SOC/2007/bigint/libs/bigint/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/Jamfile.v2 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -0,0 +1,15 @@
+##############################################################################
+# Copyright 2007 Arseny Kapoulkine
+# Distributed under the Boost Software License, Version 1.0. (See accompany-
+# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+##############################################################################
+
+import testing ;
+
+{
+ test-suite bigint:
+ : [ run bigint_simple_test.cpp
+ : : : : bigint_simple ]
+ ;
+}
+

Added: sandbox/SOC/2007/bigint/libs/bigint/test/bigint_simple_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/bigint_simple_test.cpp 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -0,0 +1,85 @@
+/* Boost bigint_simple_test.cpp test file
+ *
+ * Copyright 2007 Arseny Kapoulkine
+ *
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or
+ * copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <boost/bigint/bigint.hpp>
+
+#include <sstream>
+
+#pragma comment(lib, "libgmp-3.lib")
+
+void test()
+{
+ using boost::bigint;
+
+ bigint d = 1;
+ d += 4;
+
+ d = d + 4;
+ d = d + bigint(4);
+
+ bigint a = bigint("13849832498234928394234");
+ bigint b = bigint("86150167501765071605765");
+
+ bigint c = a + b;
+
+ BOOST_CHECK_EQUAL(c++, bigint("99999999999999999999999"));
+ BOOST_CHECK_EQUAL(c, bigint("100000000000000000000000"));
+
+ b %= a;
+
+ BOOST_CHECK(!(a / b));
+ BOOST_CHECK(a - b);
+
+ BOOST_CHECK_EQUAL(a * b, bigint("42258228219342334666689684483132205000478474"));
+ BOOST_CHECK_EQUAL(!(a / b), 0);
+ BOOST_CHECK_EQUAL(a % b, bigint("1645142448812923432790"));
+
+ BOOST_CHECK_EQUAL(a | b, bigint("13870766920526448295931"));
+ BOOST_CHECK_EQUAL(a & b, bigint("3030238090063981338664"));
+ BOOST_CHECK_EQUAL(a ^ b, bigint("10840528830462466957267"));
+
+ BOOST_CHECK_EQUAL(a << 12323, bigint("54210209824998674960706151957171243776334817615992549286033832481286245106274830183430035889395592421429139828952807123487077092054006867964850440524460972559587769408718171158946497028119023782272098259724152691027872962733955514126021668316226079027055513323024368575084988607770611282498269102675003254352062804123613103837221987914939902110340739604264343039365892061448818559397135613345306938522003803494120751512279929368262990664328617120718740461624884548210663403481351798397716730743376547281832957722999748874728361670364167061164659574539537090121176058332274255169884200640406996554466588956804941503716387500495829665315052731815607862789692277641335464325322615767195011146302817172252379961868212588242741947065364583568723291471751004963530907347999874193186816934579353181408041195080801229409434080706121573961587551916571167934706798462022309293903657749708884314025294000029436115635836381878774958815264983930841350011810794735656320381551019972503379916134197
039200013499971564803048001762960809164762637488021962891398097772313146888407589383735998154442192501165230754898274044006394361249836440929908647042463530462376928313533941666423346007473304923333190289810516791325668708180010939837790292671875407855673469398330145542063611309681313256360971034826170030180373909291169403509612303609989577949821249028435431979570734248293804686082931379639847711011932132921366544233487956494759945107399072700832945099061491784643683597456599800868407795111393137978610252558272046172738440958307179817823202293493567043148504408225728052354115585270281805052806542365810126131655357464895619002653633526617201837910067434195719328525341908783221901491136694060142051394957465738922756111915452802175945697390517424975816802227286258530895733377835898716687001920198998468448201430847634183837881878233754975458803985499341847677648819159077378693806478606120472192735237308089844393639932283785281168904446541985039131642002762335681598179424992803731329137148115030753206917272155723
670778142387185554420058265251870684011332123183650190995767874298206358606115242964147204963162126201886987891018787690434308236836499346656790213359159875159742564637898659613474209293887654355046009422058758292733785348269613356005926577170575989471100266260931914619468078598688997277906838153589503330900090781191812549674167934726480016569418226786749589167504064797728919100656717692969146379870286429802144638044650704314051117635702178907751971885034427049357891080670830078569333035533221376988439363681737385900027509595782280132585647042001663149723427627146024591594850135672147437314944517409695158803844637284046910988011470139667877464442515550125392919619816954413530833557977515808716337194728187777533124153821521284321968370402360778685298742203233491005298326645715923174261708156503501100450193594239326592705866222831356815212029165638741358913759743650671492153263000348503637918221175355027474631738752349630470314508900772920786507743346507015132846776261173136038012599265553669061110476098772194
7987651052200490474467685344315603511565148128907900886854643373305490827988832857965982489788282339573097276547608904545269820140608635061243211688508065865415564489887520878115786887330460859916782610805213428984931292958242857552508803483374776140927180323134713226342853874523978900371318863698471909861423140464604309269071265335210720089276101171746349379219156670536008796216903162551900000164124244707346775377306633500136743133402111070612007697383513998143624055526721057240426797375334222177746493729517389043488959509605784317189782088070297384587362776609016571148764168858304798093182811678055912813300404454752102341916041445631171769468296541125975611633951795548330426208740683150262272"));
+ BOOST_CHECK_EQUAL(a >> 34783, 0);
+
+ BOOST_CHECK_EQUAL(b, bigint("3051172512355501240361"));
+
+ BOOST_CHECK_EQUAL(sqrt(b), bigint("55237419493"));
+
+ BOOST_CHECK_EQUAL(b.can_convert_to<short>(), false);
+
+ boost::uint64_t ee = 0xffffffff;
+ bigint e = bigint::from_number(ee);
+
+ bigint f = ee;
+
+ BOOST_CHECK_EQUAL(e, bigint("4294967295"));
+
+ unsigned short xx = 34;
+ bigint g = xx;
+
+ BOOST_CHECK_EQUAL(bigint(L"11011101", 2), bigint("221"));
+ BOOST_CHECK_EQUAL(bigint("fF", 16), bigint("255"));
+
+ BOOST_CHECK_EQUAL(bigint("5").str(2), "101");
+ BOOST_CHECK(bigint("5").wstr(2) == L"101"); // if we use BOOST_CHECK_EQUAL here it complains about not being able to print log value
+
+ std::ostringstream oss;
+ oss << std::dec << bigint(10) << std::hex << bigint(10) << std::oct << bigint(10);
+
+ BOOST_CHECK_EQUAL(oss.str(), "10a12");
+}
+
+int test_main( int argc, char* argv[] )
+{
+ test();
+
+ return 0;
+}

Modified: sandbox/SOC/2007/bigint/libs/bigint/todo.txt
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/todo.txt (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/todo.txt 2007-05-17 14:48:44 EDT (Thu, 17 May 2007)
@@ -36,14 +36,17 @@
 + wide string support
 Status: implemented ctors, wstr function and proper << >> for streams (including different output/input flags (hex/oct/dec))
 
-- uint64_t / int64_t - is it possible to implement 4 ctors (int/uint + same for 64 bit) to make it always work?
-Status: needs investigation
++ uint64_t / int64_t - is it possible to implement 4 ctors (int/uint + same for 64 bit) to make it always work?
+Status: compiles ok on msvc and gcc
 
-- safe bool conversion
-Status: needs implementing
++ safe bool conversion
+Status: implemented
 
-- extend implementation interface for efficient operator!() and safe bool
-Status: needs implementing
++ extend implementation interface for efficient operator!() and safe bool
+Status: implemented
+
+* make sure it works on a wide range of compilers (test framework setup is needed)
+Status: made some setup, it works for me but: 1. linking gmp is done via a hack, 2. not sure it works for others :/
 
 - converting to/from string - there was a suggestion to use static functions
 My opinion: performance wise it is the same if compiler has NRVO support, and ctors/member functions are more convenient
@@ -54,9 +57,6 @@
 Status: get Jeffs opinion, wait for further community feedback
 Comments: some set of defines is probably needed, like BOOST_BIGINT_HAS_GMP_SUPPORT, etc.
 
-- make sure it works on a wide range of compilers (test framework setup is needed)
-Status: needs implementing
-
 2. GMP implementation
 
 + conversion from string with different bases (2-36, use 26 letters + 10 digits)
@@ -77,6 +77,9 @@
 - check semantics of bitwise and shift operations for negative numbers
 Status: needs investigation
 
+- what if there is not enough memory for the request - what happens then? Investigate.
+Status: needs investigation
+
 - more changes according to interface updates
 Status: waiting for updates
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk