From 85daeb5e16f187030b6d62005b52f897fb7a102d Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 5 Jun 2014 19:09:51 +0000 Subject: Robust async connect tests by temporarely switching off auto continuation. Ticket [13d3af3ad5] --- tests/socket.test | 15 ++++++++++-- unix/tclUnixSock.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++- win/tclWinSock.c | 38 ++++++++++++++++++++++++++++++- 3 files changed, 116 insertions(+), 4 deletions(-) diff --git a/tests/socket.test b/tests/socket.test index 0c9320a..b006cb4 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -67,10 +67,19 @@ namespace import -force ::tcltest::* testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] testConstraint exec [llength [info commands exec]] + # Produce a random port number in the Dynamic/Private range # from 49152 through 65535. proc randport {} { expr {int(rand()*16383+49152)} } +# Check if socket_test option is available +testConstraint sockettest [expr {![catch { + set h [socket -async localhost [randport]] + fconfigure $h -unsupported1 1 + close $h + }]}] + + # Test the latency of tcp connections over the loopback interface. Some OSes # (e.g. NetBSD) seem to use the Nagle algorithm and delayed ACKs, so it takes # up to 200ms for a packet sent to localhost to arrive. We're measuring this @@ -2148,7 +2157,7 @@ test socket-14.10.1 {pending [socket -async] and nonblocking [puts], server is I close $sock } -result {{} ok} test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener, no flush} \ - -constraints {socket} \ + -constraints {socket } \ -body { set sock [socket -async localhost [randport]] fconfigure $sock -blocking 0 @@ -2161,12 +2170,14 @@ test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener unset x } -result {socket is not connected} -returnCodes 1 test socket-14.11.1 {pending [socket -async] and nonblocking [puts], no listener, flush} \ - -constraints {socket} \ + -constraints {socket sockettest} \ -body { set sock [socket -async localhost [randport]] + fconfigure $sock -unsupported1 1 fconfigure $sock -blocking 0 puts $sock ok flush $sock + fconfigure $sock -unsupported1 0 fileevent $sock writable {set x 1} vwait x close $sock diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index a9323c4..cf5d7b9 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -89,6 +89,9 @@ struct TcpState { * flag indicates that reentry is * still pending */ #define TCP_ASYNC_FAILED (1<<5) /* An async connect finally failed */ +#define TCP_ASYNC_TEST_MODE (1<<6) /* Async testing activated + * Do not automatically continue connection + * process */ /* * The following defines the maximum length of the listen queue. This is the @@ -125,6 +128,9 @@ static int TcpClose2Proc(ClientData instanceData, Tcl_Interp *interp, int flags); static int TcpGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); +static int TcpSetOptionProc(ClientData instanceData, + Tcl_Interp *interp, const char *optionName, + const char *value); static int TcpGetOptionProc(ClientData instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); @@ -147,7 +153,7 @@ static const Tcl_ChannelType tcpChannelType = { TcpInputProc, /* Input proc. */ TcpOutputProc, /* Output proc. */ NULL, /* Seek proc. */ - NULL, /* Set option proc. */ + TcpSetOptionProc, /* Set option proc. */ TcpGetOptionProc, /* Get option proc. */ TcpWatchProc, /* Initialize notifier. */ TcpGetHandleProc, /* Get OS handles out of channel. */ @@ -439,6 +445,21 @@ WaitForConnect( if (!(statePtr->flags & TCP_ASYNC_PENDING)) { return 0; } + + /* + * In socket test mode do not continue with the connect + * Exceptions are: + * - Call by recv/send and blocking socket + * (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING) + */ + + if ( (statePtr->flags & TCP_ASYNC_TEST_MODE) + && !(errorCodePtr != NULL && !(statePtr->flags & TCP_NONBLOCKING))) { + if (errorCodePtr != NULL) { + *errorCodePtr = EWOULDBLOCK; + } + return -1; + } if (errorCodePtr == NULL || (statePtr->flags & TCP_NONBLOCKING)) { timeout = 0; @@ -748,6 +769,50 @@ TcpHostPortList( /* *---------------------------------------------------------------------- * + * TcpSetOptionProc -- + * + * Sets Tcp channel specific options. + * + * Results: + * None, unless an error happens. + * + * Side effects: + * Changes attributes of the socket at the system level. + * + *---------------------------------------------------------------------- + */ + +static int +TcpSetOptionProc( + ClientData instanceData, /* Socket state. */ + Tcl_Interp *interp, /* For error reporting - can be NULL. */ + const char *optionName, /* Name of the option to set. */ + const char *value) /* New value for option. */ +{ + TcpState *statePtr = instanceData; + + /* + * Set socket test int value + */ + if (!strcmp(optionName, "-unsupported1")) { + int intValue; + if (Tcl_GetInt(interp, value, &intValue) != TCL_OK) { + return TCL_ERROR; + } + if (intValue & 1) { + SET_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); + } else { + CLEAR_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); + } + return TCL_OK; + } + + return Tcl_BadChannelOption(interp, optionName, ""); +} + +/* + *---------------------------------------------------------------------- + * * TcpGetOptionProc -- * * Computes an option value for a TCP socket based channel, or a list of diff --git a/win/tclWinSock.c b/win/tclWinSock.c index f343f82..2703309 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -191,6 +191,9 @@ struct TcpState { * flag indicates that reentry is * still pending */ #define TCP_ASYNC_FAILED (1<<5) /* An async connect finally failed */ +#define TCP_ASYNC_TEST_MODE (1<<6) /* Async testing activated + * Do not automatically continue connection + * process */ /* * The following structure is what is added to the Tcl event queue when a @@ -602,6 +605,20 @@ WaitForConnect( } /* + * In socket test mode do not continue with the connect + * Exceptions are: + * - Call by recv/send and blocking socket + * (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING) + * - Call by the event queue (errorCodePtr == NULL) + */ + + if ( (statePtr->flags & TCP_ASYNC_TEST_MODE) + && errorCodePtr != NULL && (statePtr->flags & TCP_NONBLOCKING)) { + *errorCodePtr = EWOULDBLOCK; + return -1; + } + + /* * Be sure to disable event servicing so we are truly modal. */ @@ -1123,6 +1140,7 @@ TcpSetOptionProc( const char *optionName, /* Name of the option to set. */ const char *value) /* New value for option. */ { + TcpState *statePtr = instanceData; #ifdef TCL_FEATURE_KEEPALIVE_NAGLE TcpState *statePtr = instanceData; SOCKET sock; @@ -1142,6 +1160,22 @@ TcpSetOptionProc( return TCL_ERROR; } + /* + * Set socket test int value + */ + if (!strcmp(optionName, "-unsupported1")) { + int intValue; + if (Tcl_GetInt(interp, value, &intValue) != TCL_OK) { + return TCL_ERROR; + } + if (intValue & 1) { + SET_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); + } else { + CLEAR_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); + } + return TCL_OK; + } + #ifdef TCL_FEATURE_KEEPALIVE_NAGLE #error "TCL_FEATURE_KEEPALIVE_NAGLE not reviewed for whether to treat statePtr->sockets as single fd or list" sock = statePtr->sockets->fd; @@ -1254,7 +1288,9 @@ TcpGetOptionProc( * Go one step in async connect * If any error is thrown save it as backround error to report eventually below */ - WaitForConnect(statePtr, NULL); + if (! (statePtr->flags & TCP_ASYNC_TEST_MODE) ) { + WaitForConnect(statePtr, NULL); + } sock = statePtr->sockets->fd; if (optionName != NULL) { -- cgit v0.12 From a0256cda63dc8d023a3cd11a73c2cf15c164dfb9 Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 17 Jul 2014 09:53:36 +0000 Subject: Replaced option "-unsupported1" by test command "testsocket debugflags" (thanks Donal, Donald). --- generic/tclTest.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/socket.test | 15 ++++++---- unix/tclUnixSock.c | 67 +++++++++--------------------------------- win/tclWinSock.c | 31 +++++++------------- 4 files changed, 118 insertions(+), 80 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index a27c95a..80a2a37 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -75,6 +75,18 @@ typedef struct TestAsyncHandler { /* Next is list of handlers. */ } TestAsyncHandler; +/* + * Start of the socket driver state structure to acces field testFlags + */ + +typedef struct TcpState TcpState; + +struct TcpState { + Tcl_Channel channel; /* Channel associated with this socket. */ + int testFlags; /* bit field for tests. Is set by testsocket + * test procedure */ +}; + TCL_DECLARE_MUTEX(asyncTestMutex) static TestAsyncHandler *firstHandler = NULL; @@ -362,6 +374,8 @@ static int TestChannelCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); static int TestChannelEventCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); +static int TestSocketCmd(ClientData clientData, + Tcl_Interp *interp, int argc, const char **argv); static int TestFilesystemObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -666,6 +680,8 @@ Tcltest_Init( TestNumUtfCharsCmd, NULL, NULL); Tcl_CreateCommand(interp, "testsetplatform", TestsetplatformCmd, NULL, NULL); + Tcl_CreateCommand(interp, "testsocket", TestSocketCmd, + NULL, NULL); Tcl_CreateCommand(interp, "teststaticpkg", TeststaticpkgCmd, NULL, NULL); Tcl_CreateCommand(interp, "testtranslatefilename", @@ -5970,6 +5986,75 @@ TestChannelEventCmd( /* *---------------------------------------------------------------------- * + * TestSocketCmd -- + * + * Implements the Tcl "testsocket" debugging command and its + * subcommands. This is part of the testing environment. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestSocketCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Interpreter for result. */ + int argc, /* Count of additional args. */ + const char **argv) /* Additional arg strings. */ +{ + const char *cmdName; /* Sub command. */ + size_t len; /* Length of subcommand string. */ + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " subcommand ?additional args..?\"", NULL); + return TCL_ERROR; + } + cmdName = argv[1]; + len = strlen(cmdName); + + if ((cmdName[0] == 't') && (strncmp(cmdName, "testflags", len) == 0)) { + Tcl_Channel hChannel; + int modePtr; + TcpState *statePtr; + /* Set test value in the socket driver + */ + /* Check for argument "channel name" + */ + if (argc < 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " testflags channel flags\"", NULL); + return TCL_ERROR; + } + hChannel = Tcl_GetChannel(interp, argv[2], &modePtr); + if ( NULL == hChannel ) { + Tcl_AppendResult(interp, "unknown channel:", argv[2], NULL); + return TCL_ERROR; + } + statePtr = (TcpState *)Tcl_GetChannelInstanceData(hChannel); + if ( NULL == statePtr) { + Tcl_AppendResult(interp, "No channel instance data:", argv[2], + NULL); + return TCL_ERROR; + } + statePtr->testFlags = atoi(argv[3]); + return TCL_OK; + } + + Tcl_AppendResult(interp, "bad option \"", cmdName, "\": should be " + "testflags", NULL); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * * TestWrongNumArgsObjCmd -- * * Test the Tcl_WrongNumArgs function. diff --git a/tests/socket.test b/tests/socket.test index b006cb4..839e9d2 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -72,10 +72,10 @@ testConstraint exec [llength [info commands exec]] # from 49152 through 65535. proc randport {} { expr {int(rand()*16383+49152)} } -# Check if socket_test option is available -testConstraint sockettest [expr {![catch { +# Check if testsocket testflags is available +testConstraint testsocket_testflags [expr {![catch { set h [socket -async localhost [randport]] - fconfigure $h -unsupported1 1 + testsocket testflags $h 0 close $h }]}] @@ -2170,14 +2170,17 @@ test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener unset x } -result {socket is not connected} -returnCodes 1 test socket-14.11.1 {pending [socket -async] and nonblocking [puts], no listener, flush} \ - -constraints {socket sockettest} \ + -constraints {socket testsocket_testflags} \ -body { set sock [socket -async localhost [randport]] - fconfigure $sock -unsupported1 1 + # Set the socket in async test mode. + # The async connect will not be continued on the following fconfigure + # and puts/flush. Thus, the connect will fail after them. + testsocket testflags $sock 1 fconfigure $sock -blocking 0 puts $sock ok flush $sock - fconfigure $sock -unsupported1 0 + testsocket testflags $sock 0 fileevent $sock writable {set x 1} vwait x close $sock diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index cf5d7b9..fdd4287 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -52,6 +52,8 @@ typedef struct TcpFdList { struct TcpState { Tcl_Channel channel; /* Channel associated with this file. */ + int testFlags; /* bit field for tests. Is set by testsocket + * test procedure */ TcpFdList fds; /* The file descriptors of the sockets. */ int flags; /* ORed combination of the bitfields defined * below. */ @@ -89,7 +91,13 @@ struct TcpState { * flag indicates that reentry is * still pending */ #define TCP_ASYNC_FAILED (1<<5) /* An async connect finally failed */ -#define TCP_ASYNC_TEST_MODE (1<<6) /* Async testing activated + +/* + * These bits may be ORed together into the "testFlags" field of a TcpState + * structure. + */ + +#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated * Do not automatically continue connection * process */ @@ -128,9 +136,6 @@ static int TcpClose2Proc(ClientData instanceData, Tcl_Interp *interp, int flags); static int TcpGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); -static int TcpSetOptionProc(ClientData instanceData, - Tcl_Interp *interp, const char *optionName, - const char *value); static int TcpGetOptionProc(ClientData instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); @@ -153,7 +158,7 @@ static const Tcl_ChannelType tcpChannelType = { TcpInputProc, /* Input proc. */ TcpOutputProc, /* Output proc. */ NULL, /* Seek proc. */ - TcpSetOptionProc, /* Set option proc. */ + NULL, /* Set option proc. */ TcpGetOptionProc, /* Get option proc. */ TcpWatchProc, /* Initialize notifier. */ TcpGetHandleProc, /* Get OS handles out of channel. */ @@ -453,11 +458,9 @@ WaitForConnect( * (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING) */ - if ( (statePtr->flags & TCP_ASYNC_TEST_MODE) - && !(errorCodePtr != NULL && !(statePtr->flags & TCP_NONBLOCKING))) { - if (errorCodePtr != NULL) { - *errorCodePtr = EWOULDBLOCK; - } + if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE) + && ! (errorCodePtr != NULL && ! (statePtr->flags & TCP_NONBLOCKING))) { + *errorCodePtr = EWOULDBLOCK; return -1; } @@ -769,50 +772,6 @@ TcpHostPortList( /* *---------------------------------------------------------------------- * - * TcpSetOptionProc -- - * - * Sets Tcp channel specific options. - * - * Results: - * None, unless an error happens. - * - * Side effects: - * Changes attributes of the socket at the system level. - * - *---------------------------------------------------------------------- - */ - -static int -TcpSetOptionProc( - ClientData instanceData, /* Socket state. */ - Tcl_Interp *interp, /* For error reporting - can be NULL. */ - const char *optionName, /* Name of the option to set. */ - const char *value) /* New value for option. */ -{ - TcpState *statePtr = instanceData; - - /* - * Set socket test int value - */ - if (!strcmp(optionName, "-unsupported1")) { - int intValue; - if (Tcl_GetInt(interp, value, &intValue) != TCL_OK) { - return TCL_ERROR; - } - if (intValue & 1) { - SET_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); - } else { - CLEAR_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); - } - return TCL_OK; - } - - return Tcl_BadChannelOption(interp, optionName, ""); -} - -/* - *---------------------------------------------------------------------- - * * TcpGetOptionProc -- * * Computes an option value for a TCP socket based channel, or a list of diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 2703309..d6c8e3a 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -133,6 +133,8 @@ typedef struct TcpFdList { struct TcpState { Tcl_Channel channel; /* Channel associated with this socket. */ + int testFlags; /* bit field for tests. Is set by testsocket + * test procedure */ struct TcpFdList *sockets; /* Windows SOCKET handle. */ int flags; /* Bit field comprised of the flags described * below. */ @@ -191,7 +193,13 @@ struct TcpState { * flag indicates that reentry is * still pending */ #define TCP_ASYNC_FAILED (1<<5) /* An async connect finally failed */ -#define TCP_ASYNC_TEST_MODE (1<<6) /* Async testing activated + +/* + * These bits may be ORed together into the "testFlags" field of a TcpState + * structure. + */ + +#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated * Do not automatically continue connection * process */ @@ -612,7 +620,7 @@ WaitForConnect( * - Call by the event queue (errorCodePtr == NULL) */ - if ( (statePtr->flags & TCP_ASYNC_TEST_MODE) + if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE) && errorCodePtr != NULL && (statePtr->flags & TCP_NONBLOCKING)) { *errorCodePtr = EWOULDBLOCK; return -1; @@ -1140,7 +1148,6 @@ TcpSetOptionProc( const char *optionName, /* Name of the option to set. */ const char *value) /* New value for option. */ { - TcpState *statePtr = instanceData; #ifdef TCL_FEATURE_KEEPALIVE_NAGLE TcpState *statePtr = instanceData; SOCKET sock; @@ -1160,22 +1167,6 @@ TcpSetOptionProc( return TCL_ERROR; } - /* - * Set socket test int value - */ - if (!strcmp(optionName, "-unsupported1")) { - int intValue; - if (Tcl_GetInt(interp, value, &intValue) != TCL_OK) { - return TCL_ERROR; - } - if (intValue & 1) { - SET_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); - } else { - CLEAR_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE); - } - return TCL_OK; - } - #ifdef TCL_FEATURE_KEEPALIVE_NAGLE #error "TCL_FEATURE_KEEPALIVE_NAGLE not reviewed for whether to treat statePtr->sockets as single fd or list" sock = statePtr->sockets->fd; @@ -1288,7 +1279,7 @@ TcpGetOptionProc( * Go one step in async connect * If any error is thrown save it as backround error to report eventually below */ - if (! (statePtr->flags & TCP_ASYNC_TEST_MODE) ) { + if (! (statePtr->testFlags & TCP_ASYNC_TEST_MODE) ) { WaitForConnect(statePtr, NULL); } -- cgit v0.12 From da7cc28446f80fb4051f898b794d7e0f6c847c43 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 18 Jul 2014 10:00:52 +0000 Subject: Make sure the "sockettest" command is available even when running socket.test individually. --- tests/socket.test | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/socket.test b/tests/socket.test index 8ffd86b..29f1015 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -60,8 +60,13 @@ # listening at port 2048. If all fails, a message is printed and the tests # using the remote server are not performed. -package require tcltest 2 -namespace import -force ::tcltest::* +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest + namespace import -force ::tcltest::* +} + +::tcltest::loadTestedCommands +catch [list package require -exact Tcltest [info patchlevel]] # Some tests require the Thread package or exec command testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] -- cgit v0.12 From ee70b22d5958a32d40ebf81b0679d0982b4d1860 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 Nov 2016 10:06:18 +0000 Subject: This is patch.002 from ticket [0b9d3ba2ba3e1e3fc33c97d5a9fa7ef85d11a696|0b9d3ba2ba], as first start of tip-456 implementation --- generic/tclIOCmd.c | 15 ++++++++++++--- unix/tclUnixSock.c | 20 ++++++++++++++++++++ win/tclWinSock.c | 4 ++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index de65da5..9dc8f07 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1485,12 +1485,12 @@ Tcl_SocketObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const socketOptions[] = { - "-async", "-myaddr", "-myport", "-server", NULL + "-async", "-myaddr", "-myport", "-server", "-reuseport", NULL }; enum socketOptions { - SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER + SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER, SKT_REUSEPORT }; - int optionIndex, a, server = 0, port, myport = 0, async = 0; + int optionIndex, a, server = 0, port, myport = 0, async = 0, reuseport = 0; const char *host, *myaddr = NULL; Tcl_Obj *script = NULL; Tcl_Channel chan; @@ -1557,6 +1557,9 @@ Tcl_SocketObjCmd( } script = objv[a]; break; + case SKT_REUSEPORT: + reuseport = 1; + break; default: Tcl_Panic("Tcl_SocketObjCmd: bad option index to SocketOptions"); } @@ -1600,6 +1603,12 @@ Tcl_SocketObjCmd( Tcl_IncrRefCount(script); acceptCallbackPtr->script = script; acceptCallbackPtr->interp = interp; + + /* Hint for Tcl_OpenTcpServer to set socket option REUSEPORT */ + if(reuseport) { + port |= (1 << 16); + } + chan = Tcl_OpenTcpServer(interp, port, host, AcceptCallbackProc, acceptCallbackPtr); if (chan == NULL) { diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 170aea9..d8a33f9 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -113,6 +113,11 @@ struct TcpState { #define SOCKET_BUFSIZE 4096 +#ifdef SO_REUSEPORT +/* Bitmask to check if the setting of SO_REUSEPORT was requested by the caller. */ +#define USE_SOCK_REUSEPORT (1 << 16) +#endif + /* * Static routines for this file: */ @@ -1435,6 +1440,10 @@ Tcl_OpenTcpServer( char channelName[SOCK_CHAN_LENGTH]; const char *errorMsg = NULL; TcpFdList *fds = NULL, *newfds; +#ifdef SO_REUSEPORT + int reuseport = port & USE_SOCK_REUSEPORT; + CLEAR_BITS(port, USE_SOCK_REUSEPORT); +#endif /* * Try to record and return the most meaningful error message, i.e. the @@ -1512,6 +1521,17 @@ Tcl_OpenTcpServer( (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &reuseaddr, sizeof(reuseaddr)); +#ifdef SO_REUSEPORT + /* + * Set up to allows multiple sockets on the same host to bind to the same port. + * The flag can be switched on by setting the lowest bit above the valid maximum port (0xffff). + */ + if(reuseport) { + (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, + (char *) &reuseport, sizeof(reuseport)); + } +#endif + /* * Make sure we use the same port number when opening two server * sockets for IPv4 and IPv6 on a random port. diff --git a/win/tclWinSock.c b/win/tclWinSock.c index ec881d2..af8dda1 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2111,8 +2111,8 @@ Tcl_OpenTcpServer( /* * Bind to the specified port. Note that we must not call - * setsockopt with SO_REUSEADDR because Microsoft allows addresses - * to be reused even if they are still in use. + * setsockopt with SO_REUSEADDR or SO_REUSEPORT because Microsoft + * allows addresses and ports to be reused even if they are still in use. * * Bind should not be affected by the socket having already been * set into nonblocking mode. If there is trouble, this is one -- cgit v0.12 From 6989a199e7390fd525b1b42b4a2afba1e5964252 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 Nov 2016 11:21:00 +0000 Subject: Added stub entry for tip #456. Documentation and tests still missing. Doesn't conform to TIP yet. --- generic/tcl.decls | 11 +++++++++++ generic/tclDecls.h | 8 ++++++++ generic/tclIOCmd.c | 15 +++++---------- generic/tclIOSock.c | 24 ++++++++++++++++++++++++ generic/tclStubInit.c | 1 + unix/tclUnixSock.c | 14 ++++++-------- win/tclWinSock.c | 5 +++-- 7 files changed, 58 insertions(+), 20 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 574b49b..20c3f3e 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2326,6 +2326,17 @@ declare 630 { # ----- BASELINE -- FOR -- 8.6.0 ----- # +# TIP #456 +declare 631 { + Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, int port, + const char *host, int flags, Tcl_TcpAcceptProc *acceptProc, + ClientData callbackData) +} + +# ----- BASELINE -- FOR -- 8.7.0 ----- # + + + ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tclDecls.h b/generic/tclDecls.h index b022d3c..d1c1170 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1816,6 +1816,11 @@ EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp, EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); +/* 631 */ +EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, int port, + const char *host, int flags, + Tcl_TcpAcceptProc *acceptProc, + ClientData callbackData); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2482,6 +2487,7 @@ typedef struct TclStubs { void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */ int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ + Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, int port, const char *host, int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3774,6 +3780,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_FSUnloadFile) /* 629 */ #define Tcl_ZlibStreamSetCompressionDictionary \ (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ +#define Tcl_OpenTcpServerEx \ + (tclStubsPtr->tcl_OpenTcpServerEx) /* 631 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 9dc8f07..883c6b7 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1490,7 +1490,7 @@ Tcl_SocketObjCmd( enum socketOptions { SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER, SKT_REUSEPORT }; - int optionIndex, a, server = 0, port, myport = 0, async = 0, reuseport = 0; + int optionIndex, a, server = 0, port, myport = 0, async = 0, flags = 0; const char *host, *myaddr = NULL; Tcl_Obj *script = NULL; Tcl_Channel chan; @@ -1557,9 +1557,9 @@ Tcl_SocketObjCmd( } script = objv[a]; break; - case SKT_REUSEPORT: - reuseport = 1; - break; + case SKT_REUSEPORT: + flags |= 1; + break; default: Tcl_Panic("Tcl_SocketObjCmd: bad option index to SocketOptions"); } @@ -1604,12 +1604,7 @@ Tcl_SocketObjCmd( acceptCallbackPtr->script = script; acceptCallbackPtr->interp = interp; - /* Hint for Tcl_OpenTcpServer to set socket option REUSEPORT */ - if(reuseport) { - port |= (1 << 16); - } - - chan = Tcl_OpenTcpServer(interp, port, host, AcceptCallbackProc, + chan = Tcl_OpenTcpServerEx(interp, port, host, flags, AcceptCallbackProc, acceptCallbackPtr); if (chan == NULL) { Tcl_DecrRefCount(script); diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 7ed751c..72a0b5a 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -283,6 +283,30 @@ TclCreateSocketAddress( } return 1; } + +/* + *---------------------------------------------------------------------- + * + * Tcl_OpenTcpServer -- + * + * Opens a TCP server socket and creates a channel around it. + * + * Results: + * The channel or NULL if failed. If an error occurred, an error message + * is left in the interp's result if interp is not NULL. + * + * Side effects: + * Opens a server socket and creates a new channel. + * + *---------------------------------------------------------------------- + */ +Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, + const char *host, Tcl_TcpAcceptProc *acceptProc, + ClientData callbackData) +{ + return Tcl_OpenTcpServerEx(interp, port, host, 0, acceptProc, callbackData); +} + /* * Local Variables: diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 2f1bb8b..23da6dc 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1416,6 +1416,7 @@ const TclStubs tclStubs = { Tcl_FindSymbol, /* 628 */ Tcl_FSUnloadFile, /* 629 */ Tcl_ZlibStreamSetCompressionDictionary, /* 630 */ + Tcl_OpenTcpServerEx, /* 631 */ }; /* !END!: Do not edit above this line. */ diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index d8a33f9..6286b2f 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -115,7 +115,7 @@ struct TcpState { #ifdef SO_REUSEPORT /* Bitmask to check if the setting of SO_REUSEPORT was requested by the caller. */ -#define USE_SOCK_REUSEPORT (1 << 16) +#define USE_SOCK_REUSEPORT 1 #endif /* @@ -1410,7 +1410,7 @@ TclpMakeTcpClientChannelMode( /* *---------------------------------------------------------------------- * - * Tcl_OpenTcpServer -- + * Tcl_OpenTcpServerEx -- * * Opens a TCP server socket and creates a channel around it. * @@ -1425,10 +1425,11 @@ TclpMakeTcpClientChannelMode( */ Tcl_Channel -Tcl_OpenTcpServer( +Tcl_OpenTcpServerEx( Tcl_Interp *interp, /* For error reporting - may be NULL. */ int port, /* Port number to open. */ const char *myHost, /* Name of local host. */ + int flags, /* Flags. */ Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ @@ -1440,10 +1441,6 @@ Tcl_OpenTcpServer( char channelName[SOCK_CHAN_LENGTH]; const char *errorMsg = NULL; TcpFdList *fds = NULL, *newfds; -#ifdef SO_REUSEPORT - int reuseport = port & USE_SOCK_REUSEPORT; - CLEAR_BITS(port, USE_SOCK_REUSEPORT); -#endif /* * Try to record and return the most meaningful error message, i.e. the @@ -1526,7 +1523,8 @@ Tcl_OpenTcpServer( * Set up to allows multiple sockets on the same host to bind to the same port. * The flag can be switched on by setting the lowest bit above the valid maximum port (0xffff). */ - if(reuseport) { + if (flags & USE_SOCK_REUSEPORT) { + int reuseport = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *) &reuseport, sizeof(reuseport)); } diff --git a/win/tclWinSock.c b/win/tclWinSock.c index af8dda1..a389d45 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2020,7 +2020,7 @@ Tcl_MakeTcpClientChannel( /* *---------------------------------------------------------------------- * - * Tcl_OpenTcpServer -- + * Tcl_OpenTcpServerEx -- * * Opens a TCP server socket and creates a channel around it. * @@ -2035,10 +2035,11 @@ Tcl_MakeTcpClientChannel( */ Tcl_Channel -Tcl_OpenTcpServer( +Tcl_OpenTcpServerEx( Tcl_Interp *interp, /* For error reporting - may be NULL. */ int port, /* Port number to open. */ const char *myHost, /* Name of local host. */ + int flags, /* Flags (not used) */ Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ -- cgit v0.12 From 32f810fc3b6dc0ff270d295e623bacb4d766522c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 Nov 2016 11:24:48 +0000 Subject: Fix indenting --- unix/tclUnixSock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 6286b2f..4767522 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -1519,15 +1519,15 @@ Tcl_OpenTcpServerEx( (char *) &reuseaddr, sizeof(reuseaddr)); #ifdef SO_REUSEPORT - /* - * Set up to allows multiple sockets on the same host to bind to the same port. - * The flag can be switched on by setting the lowest bit above the valid maximum port (0xffff). - */ - if (flags & USE_SOCK_REUSEPORT) { + /* + * Set up to allows multiple sockets on the same host to bind to the same port. + * The flag can be switched on by setting the lowest bit above the valid maximum port (0xffff). + */ + if (flags & USE_SOCK_REUSEPORT) { int reuseport = 1; - (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, - (char *) &reuseport, sizeof(reuseport)); - } + (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, + (char *) &reuseport, sizeof(reuseport)); + } #endif /* -- cgit v0.12 From 18592932556fe3ca6e78e7c4a11af2db03beb6da Mon Sep 17 00:00:00 2001 From: limeboy Date: Thu, 24 Nov 2016 12:47:21 +0000 Subject: Implement the whole TIP 456 specification. Also introduces the `-reuseaddr' and `-reuseport' options for the `socket' command. --- generic/tcl.decls | 2 +- generic/tcl.h | 7 +++++++ generic/tclDecls.h | 4 ++-- generic/tclIOCmd.c | 23 ++++++++++++++++++----- generic/tclIOSock.c | 6 +++--- unix/tclUnixSock.c | 41 ++++++++++++++++++++--------------------- win/tclWinSock.c | 2 +- 7 files changed, 52 insertions(+), 33 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 20c3f3e..af496b3 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2329,7 +2329,7 @@ declare 630 { # TIP #456 declare 631 { Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, int port, - const char *host, int flags, Tcl_TcpAcceptProc *acceptProc, + const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData) } diff --git a/generic/tcl.h b/generic/tcl.h index eb53c70..75a947a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2371,6 +2371,13 @@ typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp, /* *---------------------------------------------------------------------------- + * Definitions needed for the Tcl_OpenTcpServerEx function. [TIP #456] + */ +#define TCL_TCPSERVER_REUSEADDR (1<<0) +#define TCL_TCPSERVER_REUSEPORT (1<<1) + +/* + *---------------------------------------------------------------------------- * Single public declaration for NRE. */ diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d1c1170..4810c51 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1818,7 +1818,7 @@ EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_Obj *compressionDictionaryObj); /* 631 */ EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, int port, - const char *host, int flags, + const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); @@ -2487,7 +2487,7 @@ typedef struct TclStubs { void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */ int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ - Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, int port, const char *host, int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ + Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, int port, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ } TclStubs; extern const TclStubs *tclStubsPtr; diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 883c6b7..b4696fd 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1485,12 +1485,15 @@ Tcl_SocketObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const socketOptions[] = { - "-async", "-myaddr", "-myport", "-server", "-reuseport", NULL + "-async", "-myaddr", "-myport", "-server", "-reuseaddr", "-reuseport", + NULL }; enum socketOptions { - SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER, SKT_REUSEPORT + SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER, SKT_REUSEADDR, + SKT_REUSEPORT }; - int optionIndex, a, server = 0, port, myport = 0, async = 0, flags = 0; + int optionIndex, a, server = 0, port, myport = 0, async = 0; + unsigned int flags = 0; const char *host, *myaddr = NULL; Tcl_Obj *script = NULL; Tcl_Channel chan; @@ -1557,8 +1560,11 @@ Tcl_SocketObjCmd( } script = objv[a]; break; + case SKT_REUSEADDR: + flags |= TCL_TCPSERVER_REUSEADDR; + break; case SKT_REUSEPORT: - flags |= 1; + flags |= TCL_TCPSERVER_REUSEPORT; break; default: Tcl_Panic("Tcl_SocketObjCmd: bad option index to SocketOptions"); @@ -1583,7 +1589,14 @@ Tcl_SocketObjCmd( "?-myaddr addr? ?-myport myport? ?-async? host port"); iPtr->flags |= INTERP_ALTERNATE_WRONG_ARGS; Tcl_WrongNumArgs(interp, 1, objv, - "-server command ?-myaddr addr? port"); + "-server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"); + return TCL_ERROR; + } + + if (!server && flags != 0) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "options -reuseaddr and -reuseport are only valid for servers", + -1)); return TCL_ERROR; } diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 72a0b5a..b6e99ba 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -283,7 +283,7 @@ TclCreateSocketAddress( } return 1; } - + /* *---------------------------------------------------------------------- * @@ -304,9 +304,9 @@ Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, const char *host, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData) { - return Tcl_OpenTcpServerEx(interp, port, host, 0, acceptProc, callbackData); + return Tcl_OpenTcpServerEx(interp, port, host, TCL_TCPSERVER_REUSEADDR, + acceptProc, callbackData); } - /* * Local Variables: diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 4767522..bb75ed3 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -113,11 +113,6 @@ struct TcpState { #define SOCKET_BUFSIZE 4096 -#ifdef SO_REUSEPORT -/* Bitmask to check if the setting of SO_REUSEPORT was requested by the caller. */ -#define USE_SOCK_REUSEPORT 1 -#endif - /* * Static routines for this file: */ @@ -1429,13 +1424,13 @@ Tcl_OpenTcpServerEx( Tcl_Interp *interp, /* For error reporting - may be NULL. */ int port, /* Port number to open. */ const char *myHost, /* Name of local host. */ - int flags, /* Flags. */ + unsigned int flags, /* Flags. */ Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ ClientData acceptProcData) /* Data for the callback. */ { - int status = 0, sock = -1, reuseaddr = 1, chosenport; + int status = 0, sock = -1, optvalue, chosenport; struct addrinfo *addrlist = NULL, *addrPtr; /* socket address */ TcpState *statePtr = NULL; char channelName[SOCK_CHAN_LENGTH]; @@ -1511,24 +1506,28 @@ Tcl_OpenTcpServerEx( TclSockMinimumBuffers(INT2PTR(sock), SOCKET_BUFSIZE); /* - * Set up to reuse server addresses automatically and bind to the - * specified port. + * Set up to reuse server addresses and/or ports if requested. */ - (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *) &reuseaddr, sizeof(reuseaddr)); - -#ifdef SO_REUSEPORT - /* - * Set up to allows multiple sockets on the same host to bind to the same port. - * The flag can be switched on by setting the lowest bit above the valid maximum port (0xffff). - */ - if (flags & USE_SOCK_REUSEPORT) { - int reuseport = 1; - (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, - (char *) &reuseport, sizeof(reuseport)); + if (flags & TCL_TCPSERVER_REUSEADDR) { + optvalue = 1; + (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + (char *) &optvalue, sizeof(optvalue)); } + + if (flags & TCL_TCPSERVER_REUSEPORT) { +#ifndef SO_REUSEPORT + /* + * If the platform doesn't support the SO_REUSEPORT flag we can't do + * much beside erroring out. + */ + errorMsg = "SO_REUSEPORT isn't supported by this platform"; + goto error; #endif + optvalue = 1; + (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, + (char *) &optvalue, sizeof(optvalue)); + } /* * Make sure we use the same port number when opening two server diff --git a/win/tclWinSock.c b/win/tclWinSock.c index a389d45..b228730 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2039,7 +2039,7 @@ Tcl_OpenTcpServerEx( Tcl_Interp *interp, /* For error reporting - may be NULL. */ int port, /* Port number to open. */ const char *myHost, /* Name of local host. */ - int flags, /* Flags (not used) */ + unsigned int flags, /* Flags (not used) */ Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ -- cgit v0.12 From 842d6d00f1e11ebdf17ec934d7c7d49381a456c0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 24 Nov 2016 13:18:10 +0000 Subject: Fix compile error if SO_REUSEPORT not supported. Put command options in alphabetical order --- generic/tclIOCmd.c | 6 +++--- unix/tclUnixSock.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index b4696fd..930f5a3 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1485,12 +1485,12 @@ Tcl_SocketObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const socketOptions[] = { - "-async", "-myaddr", "-myport", "-server", "-reuseaddr", "-reuseport", + "-async", "-myaddr", "-myport", "-reuseaddr", "-reuseport", "-server", NULL }; enum socketOptions { - SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER, SKT_REUSEADDR, - SKT_REUSEPORT + SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_REUSEADDR, SKT_REUSEPORT, + SKT_SERVER }; int optionIndex, a, server = 0, port, myport = 0, async = 0; unsigned int flags = 0; diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index bb75ed3..187c157 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -1523,10 +1523,11 @@ Tcl_OpenTcpServerEx( */ errorMsg = "SO_REUSEPORT isn't supported by this platform"; goto error; -#endif +#else optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *) &optvalue, sizeof(optvalue)); +#endif } /* -- cgit v0.12 From 15b2687d3cc301f3e63f0f9953948cf2a258b883 Mon Sep 17 00:00:00 2001 From: limeboy Date: Thu, 24 Nov 2016 15:00:36 +0000 Subject: Adjust the tests and add a handful of new ones. --- tests/socket.test | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tests/socket.test b/tests/socket.test index d43c41c..82dc800 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -265,13 +265,13 @@ test socket_$af-1.1 {arg parsing for socket command} -constraints [list socket s } -returnCodes error -result {no argument given for -server option} test socket_$af-1.2 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -server foo -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} test socket_$af-1.3 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myaddr } -returnCodes error -result {no argument given for -myaddr option} test socket_$af-1.4 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myaddr $localhost -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} test socket_$af-1.5 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myport } -returnCodes error -result {no argument given for -myport option} @@ -280,19 +280,19 @@ test socket_$af-1.6 {arg parsing for socket command} -constraints [list socket s } -returnCodes error -result {expected integer but got "xxxx"} test socket_$af-1.7 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myport 2522 -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} test socket_$af-1.8 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -froboz -} -returnCodes error -result {bad option "-froboz": must be -async, -myaddr, -myport, or -server} +} -returnCodes error -result {bad option "-froboz": must be -async, -myaddr, -myport, -server, -reuseaddr, or -reuseport} test socket_$af-1.9 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -server foo -myport 2521 3333 } -returnCodes error -result {option -myport is not valid for servers} test socket_$af-1.10 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket host 2528 -junk -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} test socket_$af-1.11 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -server callback 2520 -- -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} test socket_$af-1.12 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket foo badport } -returnCodes error -result {expected integer but got "badport"} @@ -302,6 +302,12 @@ test socket_$af-1.13 {arg parsing for socket command} -constraints [list socket test socket_$af-1.14 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -server foo -async } -returnCodes error -result {cannot set -async option for server sockets} +test socket_$af-1.15 {arg parsing for socket command} -constraints [list socket supported_$af] -body { + socket -reuseaddr 4242 +} -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} +test socket_$af-1.16 {arg parsing for socket command} -constraints [list socket supported_$af] -body { + socket -reuseport 4242 +} -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} set path(script) [makeFile {} script] @@ -2360,6 +2366,19 @@ test socket-14.18 {bug c6ed4acfd8: running async socket connect made other conne catch {close $csock2} } -result {} +test socket-14.19 {tip 456 -- introduce the -reuseport option} \ + -constraints {socket} \ + -body { + proc accept {channel address port} {} + set port [randport] + set ssock1 [socket -server accept -reuseport $port] + set ssock2 [socket -server accept -reuseport $port] + return ok +} -cleanup { + catch {close $ssock1} + catch {close $ssock2} + } -result ok + set num 0 set x {localhost {socket} 127.0.0.1 {supported_inet} ::1 {supported_inet6}} -- cgit v0.12 From 1b0d436cc7b557e2feaf5131923ce17fb84622eb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 24 Nov 2016 16:20:05 +0000 Subject: Starting implementing the "package files" command. TIP still to be written. --- generic/tclInt.h | 1 + generic/tclLoad.c | 8 ++++- generic/tclPkg.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++------ tests/package.test | 2 +- 4 files changed, 92 insertions(+), 11 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 4257ea1..bfcd002 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3100,6 +3100,7 @@ MODULE_SCOPE int TclpObjChdir(Tcl_Obj *pathPtr); MODULE_SCOPE Tcl_Channel TclpOpenTemporaryFile(Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); +MODULE_SCOPE void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName); MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_PathPart portion); MODULE_SCOPE char * TclpReadlink(const char *fileName, diff --git a/generic/tclLoad.c b/generic/tclLoad.c index be296b3..184c158 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -397,6 +397,12 @@ Tcl_LoadObjCmd( goto done; } + if (target == interp) { + /* Only register the file if the load is done in the + * current interpreter */ + TclPkgFileSeen(target, Tcl_GetString(objv[1])); + } + /* * Create a new record to describe this package. */ @@ -998,7 +1004,7 @@ Tcl_StaticPackage( } /* - * Package isn't loade in the current interp yet. Mark it as now being + * Package isn't loaded in the current interp yet. Mark it as now being * loaded. */ diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 244eb94..3d052a6 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -32,6 +32,17 @@ typedef struct PkgAvail { * same package. */ } PkgAvail; +typedef struct PkgName { + struct PkgName *nextPtr; /* Next in list of package names being initialized. */ + char name[1]; +} PkgName; + +typedef struct PkgFiles { + PkgName *names; /* Package names being initialized. */ + Tcl_HashTable table; /* Table which contains files for each package */ +} PkgFiles; + + /* * For each package that is known in any way to an interpreter, there is one * record of the following type. These records are stored in the @@ -81,7 +92,7 @@ static const char * PkgRequireCore(Tcl_Interp *interp, const char *name, ((v) = ckalloc(len), memcpy((v),(s),(len))) #define DupString(v,s) \ do { \ - unsigned local__len = (unsigned) (strlen(s) + 1); \ + size_t local__len = strlen(s) + 1; \ DupBlock((v),(s),local__len); \ } while (0) @@ -189,6 +200,29 @@ Tcl_PkgProvideEx( *---------------------------------------------------------------------- */ +static void PkgFilesCleanupProc(ClientData clientData, + Tcl_Interp *interp) +{ + PkgFiles *pkgFiles = (PkgFiles *) clientData; + + while (pkgFiles->names) { + PkgName *name = pkgFiles->names; + pkgFiles->names = name->nextPtr; + ckfree(name); + } + Tcl_DeleteHashTable(&pkgFiles->table); + return; +} + +void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName) +{ + PkgFiles *pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL); + if (pkgFiles) { + const char *name = pkgFiles->names->name; + printf("Seen %s for package %s\n", fileName, name); + } +} + #undef Tcl_PkgRequire const char * Tcl_PkgRequire( @@ -489,12 +523,31 @@ PkgRequireCore( */ char *versionToProvide = bestPtr->version; + PkgFiles *pkgFiles; + PkgName *pkgName; script = bestPtr->script; pkgPtr->clientData = versionToProvide; - Tcl_Preserve(script); Tcl_Preserve(versionToProvide); + Tcl_Preserve(script); + /* If assocdata "tclPkgFiles" doesn't exist yet, create it */ + pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL); + if (!pkgFiles) { + pkgFiles = ckalloc(sizeof(PkgFiles)); + pkgFiles->names = NULL; + Tcl_InitHashTable(&pkgFiles->table, TCL_STRING_KEYS); + Tcl_SetAssocData(interp, "tclPkgFiles", PkgFilesCleanupProc, pkgFiles); + } + /* Push "ifneeded" package name in "tclPkgFiles" assocdata. */ + pkgName = ckalloc(sizeof(PkgName) + strlen(name)); + pkgName->nextPtr = pkgFiles->names; + strcpy(pkgName->name, name); + pkgFiles->names = pkgName; code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); + /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/ + pkgName = pkgFiles->names; + pkgFiles->names = pkgFiles->names->nextPtr; + ckfree(pkgName); Tcl_Release(script); pkgPtr = FindPackage(interp, name); @@ -764,14 +817,14 @@ Tcl_PackageObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const pkgOptions[] = { - "forget", "ifneeded", "names", "prefer", "present", - "provide", "require", "unknown", "vcompare", "versions", - "vsatisfies", NULL + "files", "forget", "ifneeded", "names", "prefer", + "present", "provide", "require", "unknown", "vcompare", + "versions", "vsatisfies", NULL }; enum pkgOptions { - PKG_FORGET, PKG_IFNEEDED, PKG_NAMES, PKG_PREFER, PKG_PRESENT, - PKG_PROVIDE, PKG_REQUIRE, PKG_UNKNOWN, PKG_VCOMPARE, PKG_VERSIONS, - PKG_VSATISFIES + PKG_FILES, PKG_FORGET, PKG_IFNEEDED, PKG_NAMES, PKG_PREFER, + PKG_PRESENT, PKG_PROVIDE, PKG_REQUIRE, PKG_UNKNOWN, PKG_VCOMPARE, + PKG_VERSIONS, PKG_VSATISFIES }; Interp *iPtr = (Interp *) interp; int optionIndex, exact, i, satisfies; @@ -794,6 +847,27 @@ Tcl_PackageObjCmd( return TCL_ERROR; } switch ((enum pkgOptions) optionIndex) { + case PKG_FILES: { + const char *keyString; + Tcl_Obj *result = Tcl_NewObj(); + + for (i = 2; i < objc; i++) { + keyString = TclGetString(objv[i]); + hPtr = Tcl_FindHashEntry(&iPtr->packageTable, keyString); + if (hPtr == NULL) { + continue; + } + pkgPtr = Tcl_GetHashValue(hPtr); + availPtr = pkgPtr->availPtr; + while (availPtr != NULL) { + Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(availPtr->script, -1)); + availPtr = availPtr->nextPtr; + } + ckfree(pkgPtr); + } + Tcl_SetObjResult(interp, result); + break; + } case PKG_FORGET: { const char *keyString; @@ -1220,7 +1294,7 @@ FindPackage( void TclFreePackageInfo( - Interp *iPtr) /* Interpereter that is being deleted. */ + Interp *iPtr) /* Interpreter that is being deleted. */ { Package *pkgPtr; Tcl_HashSearch search; diff --git a/tests/package.test b/tests/package.test index 49346d8..99f9f06 100644 --- a/tests/package.test +++ b/tests/package.test @@ -832,7 +832,7 @@ test package-4.52 {Tcl_PackageCmd procedure, "vsatisfies" option} { } {0} test package-4.53 {Tcl_PackageCmd procedure, "versions" option} -body { package foo -} -returnCodes error -result {bad option "foo": must be forget, ifneeded, names, prefer, present, provide, require, unknown, vcompare, versions, or vsatisfies} +} -returnCodes error -result {bad option "foo": must be files, forget, ifneeded, names, prefer, present, provide, require, unknown, vcompare, versions, or vsatisfies} test package-4.54 {Tcl_PackageCmd procedure, "vsatisfies" option} -body { package vsatisfies 2.1 2.1-3.2-4.5 } -returnCodes error -result {expected versionMin-versionMax but got "2.1-3.2-4.5"} -- cgit v0.12 From 07020d6350987f39307fa3f60dd7d3414edb04ef Mon Sep 17 00:00:00 2001 From: limeboy Date: Thu, 24 Nov 2016 20:28:42 +0000 Subject: First round of documentation update. --- doc/OpenTcp.3 | 13 ++++++++++++- doc/socket.n | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/OpenTcp.3 b/doc/OpenTcp.3 index 4a7dc1e..040a8e2 100644 --- a/doc/OpenTcp.3 +++ b/doc/OpenTcp.3 @@ -9,7 +9,7 @@ .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME -Tcl_OpenTcpClient, Tcl_MakeTcpClientChannel, Tcl_OpenTcpServer \- procedures to open channels using TCP sockets +Tcl_OpenTcpClient, Tcl_MakeTcpClientChannel, Tcl_OpenTcpServer, Tcl_OpenTcpServerEx \- procedures to open channels using TCP sockets .SH SYNOPSIS .nf \fB#include \fR @@ -23,6 +23,9 @@ Tcl_Channel Tcl_Channel \fBTcl_OpenTcpServer\fR(\fIinterp, port, myaddr, proc, clientData\fR) .sp +Tcl_Channel +\fBTcl_OpenTcpServerEx\fR(\fIinterp, port, myaddr, flags, proc, clientData\fR) +.sp .SH ARGUMENTS .AS Tcl_TcpAcceptProc clientData .AP Tcl_Interp *interp in @@ -41,6 +44,9 @@ for the local end of the connection. If NULL, a default interface is chosen. .AP int async in If nonzero, the client socket is connected asynchronously to the server. +.AP "unsigned int" flags in +ORed combination of \fBTCL_TCPSERVER\fR flags that specify additional +informations about the socket being created. .AP ClientData sock in Platform-specific handle for client TCP socket. .AP Tcl_TcpAcceptProc *proc in @@ -158,6 +164,11 @@ register it, use \fBTcl_RegisterChannel\fR. If one of the standard channels, \fBstdin\fR, \fBstdout\fR or \fBstderr\fR was previously closed, the act of creating the new channel also assigns it as a replacement for the standard channel. +.SS TCL_OPENTCPSERVEREX +.PP +\fBTcl_OpenTcpServerEx\fR behaviour is identical to \fBTcl_OpenTcpServer\fR but +gives more flexibility to the user by providing a mean to further customize some +aspects of the socket via the \fIflags\fR parameter. .SH "PLATFORM ISSUES" .PP On Unix platforms, the socket handle is a Unix file descriptor as diff --git a/doc/socket.n b/doc/socket.n index 3efdb37..3d77bab 100644 --- a/doc/socket.n +++ b/doc/socket.n @@ -131,6 +131,16 @@ wildcard address so that it can accept connections from any interface. If \fIaddr\fR is a domain name that resolves to multiple IP addresses that are available on the local machine, the socket will listen on all of them. +.TP +\fB\-reuseaddr\fI boolean\fR +. +Tells the kernel whether to reuse the local address if there's no active socket +listening on it. This is the default on Windows. +.TP +\fB\-reuseport\fI boolean\fR +. +Tells the kernel whether to allow the binding of multiple sockets to the same +socket address. This is the default on Windows. .PP Server channels cannot be used for input or output; their sole use is to accept new client connections. The channels created for each incoming -- cgit v0.12 From 467b6eeb8e37745e3e02deb72d0833995109cc50 Mon Sep 17 00:00:00 2001 From: limeboy Date: Thu, 24 Nov 2016 21:01:43 +0000 Subject: Allow a boolean argument to be passed. --- generic/tclIOCmd.c | 42 +++++++++++++++++++++++++++++++++++------- tests/socket.test | 18 +++++++++--------- unix/tclUnixSock.c | 3 ++- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index b4696fd..49c7c06 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1485,14 +1485,14 @@ Tcl_SocketObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const socketOptions[] = { - "-async", "-myaddr", "-myport", "-server", "-reuseaddr", "-reuseport", + "-async", "-myaddr", "-myport", "-reuseaddr", "-reuseport", "server", NULL }; enum socketOptions { - SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER, SKT_REUSEADDR, - SKT_REUSEPORT + SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_REUSEADDR, SKT_REUSEPORT, + SKT_SERVER }; - int optionIndex, a, server = 0, port, myport = 0, async = 0; + int optionIndex, a, server = 0, port, myport = 0, async = 0, boolTmp; unsigned int flags = 0; const char *host, *myaddr = NULL; Tcl_Obj *script = NULL; @@ -1552,6 +1552,7 @@ Tcl_SocketObjCmd( return TCL_ERROR; } server = 1; + flags = TCL_TCPSERVER_REUSEADDR; a++; if (a >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1561,10 +1562,36 @@ Tcl_SocketObjCmd( script = objv[a]; break; case SKT_REUSEADDR: - flags |= TCL_TCPSERVER_REUSEADDR; + a++; + if (a >= objc) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "no argument given for -reuseaddr option", -1)); + return TCL_ERROR; + } + if (Tcl_GetBooleanFromObj(interp, objv[a], &boolTmp) != TCL_OK) { + return TCL_ERROR; + } + if (boolTmp) { + flags |= TCL_TCPSERVER_REUSEADDR; + } else { + flags &= ~TCL_TCPSERVER_REUSEADDR; + } break; case SKT_REUSEPORT: - flags |= TCL_TCPSERVER_REUSEPORT; + a++; + if (a >= objc) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "no argument given for -reuseport option", -1)); + return TCL_ERROR; + } + if (Tcl_GetBooleanFromObj(interp, objv[a], &boolTmp) != TCL_OK) { + return TCL_ERROR; + } + if (boolTmp) { + flags |= TCL_TCPSERVER_REUSEPORT; + } else { + flags &= ~TCL_TCPSERVER_REUSEPORT; + } break; default: Tcl_Panic("Tcl_SocketObjCmd: bad option index to SocketOptions"); @@ -1589,7 +1616,8 @@ Tcl_SocketObjCmd( "?-myaddr addr? ?-myport myport? ?-async? host port"); iPtr->flags |= INTERP_ALTERNATE_WRONG_ARGS; Tcl_WrongNumArgs(interp, 1, objv, - "-server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"); + "-server command ?-reuseaddr boolean? ?-reuseport boolean? " + "?-myaddr addr? port"); return TCL_ERROR; } diff --git a/tests/socket.test b/tests/socket.test index 82dc800..387e08e 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -265,13 +265,13 @@ test socket_$af-1.1 {arg parsing for socket command} -constraints [list socket s } -returnCodes error -result {no argument given for -server option} test socket_$af-1.2 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -server foo -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr boolean? ?-reuseport boolean? ?-myaddr addr? port"} test socket_$af-1.3 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myaddr } -returnCodes error -result {no argument given for -myaddr option} test socket_$af-1.4 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myaddr $localhost -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr boolean? ?-reuseport boolean? ?-myaddr addr? port"} test socket_$af-1.5 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myport } -returnCodes error -result {no argument given for -myport option} @@ -280,7 +280,7 @@ test socket_$af-1.6 {arg parsing for socket command} -constraints [list socket s } -returnCodes error -result {expected integer but got "xxxx"} test socket_$af-1.7 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -myport 2522 -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr boolean? ?-reuseport boolean? ?-myaddr addr? port"} test socket_$af-1.8 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -froboz } -returnCodes error -result {bad option "-froboz": must be -async, -myaddr, -myport, -server, -reuseaddr, or -reuseport} @@ -289,10 +289,10 @@ test socket_$af-1.9 {arg parsing for socket command} -constraints [list socket s } -returnCodes error -result {option -myport is not valid for servers} test socket_$af-1.10 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket host 2528 -junk -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr boolean? ?-reuseport boolean? ?-myaddr addr? port"} test socket_$af-1.11 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -server callback 2520 -- -} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr? ?-reuseport? ?-myaddr addr? port"} +} -returnCodes error -result {wrong # args: should be "socket ?-myaddr addr? ?-myport myport? ?-async? host port" or "socket -server command ?-reuseaddr boolean? ?-reuseport boolean? ?-myaddr addr? port"} test socket_$af-1.12 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket foo badport } -returnCodes error -result {expected integer but got "badport"} @@ -303,10 +303,10 @@ test socket_$af-1.14 {arg parsing for socket command} -constraints [list socket socket -server foo -async } -returnCodes error -result {cannot set -async option for server sockets} test socket_$af-1.15 {arg parsing for socket command} -constraints [list socket supported_$af] -body { - socket -reuseaddr 4242 + socket -reuseaddr yes 4242 } -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} test socket_$af-1.16 {arg parsing for socket command} -constraints [list socket supported_$af] -body { - socket -reuseport 4242 + socket -reuseport yes 4242 } -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} set path(script) [makeFile {} script] @@ -2371,8 +2371,8 @@ test socket-14.19 {tip 456 -- introduce the -reuseport option} \ -body { proc accept {channel address port} {} set port [randport] - set ssock1 [socket -server accept -reuseport $port] - set ssock2 [socket -server accept -reuseport $port] + set ssock1 [socket -server accept -reuseport yes $port] + set ssock2 [socket -server accept -reuseport yes $port] return ok } -cleanup { catch {close $ssock1} diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index bb75ed3..187c157 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -1523,10 +1523,11 @@ Tcl_OpenTcpServerEx( */ errorMsg = "SO_REUSEPORT isn't supported by this platform"; goto error; -#endif +#else optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *) &optvalue, sizeof(optvalue)); +#endif } /* -- cgit v0.12 From 3d5c28f5270e4958bcec2e6e52425a5fae5f8cc4 Mon Sep 17 00:00:00 2001 From: limeboy Date: Fri, 25 Nov 2016 13:27:56 +0000 Subject: Minor documentation touchups. --- doc/socket.n | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/socket.n b/doc/socket.n index 3d77bab..532ea2e 100644 --- a/doc/socket.n +++ b/doc/socket.n @@ -134,13 +134,13 @@ listen on all of them. .TP \fB\-reuseaddr\fI boolean\fR . -Tells the kernel whether to reuse the local address if there's no active socket -listening on it. This is the default on Windows. +Tells the kernel whether to reuse the local address if there is no socket +actively listening on it. This is the default on Windows. .TP \fB\-reuseport\fI boolean\fR . Tells the kernel whether to allow the binding of multiple sockets to the same -socket address. This is the default on Windows. +address and port as long as all of them specify the \fB-reuseport\fR option. .PP Server channels cannot be used for input or output; their sole use is to accept new client connections. The channels created for each incoming -- cgit v0.12 From 8fe50e3f91ec232823ba032f24dabbaa7c9f298c Mon Sep 17 00:00:00 2001 From: limeboy Date: Fri, 25 Nov 2016 14:53:20 +0000 Subject: Windows support and minor touchups to the documentation. --- doc/socket.n | 2 +- win/tclWinSock.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/socket.n b/doc/socket.n index 532ea2e..823dbd5 100644 --- a/doc/socket.n +++ b/doc/socket.n @@ -140,7 +140,7 @@ actively listening on it. This is the default on Windows. \fB\-reuseport\fI boolean\fR . Tells the kernel whether to allow the binding of multiple sockets to the same -address and port as long as all of them specify the \fB-reuseport\fR option. +address and port. .PP Server channels cannot be used for input or output; their sole use is to accept new client connections. The channels created for each incoming diff --git a/win/tclWinSock.c b/win/tclWinSock.c index b228730..af22cf8 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2039,7 +2039,7 @@ Tcl_OpenTcpServerEx( Tcl_Interp *interp, /* For error reporting - may be NULL. */ int port, /* Port number to open. */ const char *myHost, /* Name of local host. */ - unsigned int flags, /* Flags (not used) */ + unsigned int flags, /* Flags. */ Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ @@ -2053,6 +2053,7 @@ Tcl_OpenTcpServerEx( char channelName[SOCK_CHAN_LENGTH]; u_long flag = 1; /* Indicates nonblocking mode. */ const char *errorMsg = NULL; + int optvalue; if (TclpHasSockets(interp) != TCL_OK) { return NULL; @@ -2111,9 +2112,17 @@ Tcl_OpenTcpServerEx( } /* - * Bind to the specified port. Note that we must not call - * setsockopt with SO_REUSEADDR or SO_REUSEPORT because Microsoft - * allows addresses and ports to be reused even if they are still in use. + * The SO_REUSEADDR option on Windows behaves like SO_REUSEPORT on unix + * systems. + */ + if (flags & TCL_TCPSERVER_REUSEPORT) { + optvalue = 1; + (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + (char *) &optvalue, sizeof(optvalue)); + } + + /* + * Bind to the specified port. * * Bind should not be affected by the socket having already been * set into nonblocking mode. If there is trouble, this is one -- cgit v0.12 From cdb6b73776ae7e1c7680e33cbf9ea809a7bc5825 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 25 Nov 2016 15:44:43 +0000 Subject: =?UTF-8?q?Implementation=20of=20improved=20notifier=20from=20Luci?= =?UTF-8?q?o=20Andr=C3=A9s=20Illanes=20Albornoz.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unix/configure | 60 ++++ unix/configure.ac | 28 ++ unix/tclUnixNotfy.c | 768 ++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 800 insertions(+), 56 deletions(-) diff --git a/unix/configure b/unix/configure index baea1f1..14f88f3 100755 --- a/unix/configure +++ b/unix/configure @@ -8439,6 +8439,66 @@ $as_echo "#define NO_FD_SET 1" >>confdefs.h fi +#----------------------------------------------------------------------------- +# Options for the notifier. Checks for epoll(7) on Linux, and kqueue(2) +# on FreeBSD. +#----------------------------------------------------------------------------- + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for advanced notifier support" >&5 +$as_echo_n "checking for advanced notifier support... " >&6; } +case x`uname -s` in + xLinux) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: epoll(7)" >&5 +$as_echo "epoll(7)" >&6; } + for ac_header in sys/epoll.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/epoll.h" "ac_cv_header_sys_epoll_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_epoll_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_EPOLL_H 1 +_ACEOF + +$as_echo "#define HAVE_EPOLL 1" >>confdefs.h + +fi + +done +;; + xFreeBSD) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: kqueue(2)" >&5 +$as_echo "kqueue(2)" >&6; } + # Messy because we want to check if *all* the headers are present, and not + # just *any* + tcl_kqueue_headers=x + for ac_header in sys/types.h sys/event.h sys/time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + tcl_kqueue_headers=${tcl_kqueue_headers}y +fi + +done + + if test $tcl_kqueue_headers = xyyy; then : + + +$as_echo "#define HAVE_KQUEUE 1" >>confdefs.h + +fi;; + xDarwin) + # Assume that we've got CoreFoundation present (checked elsewhere because + # of wider impact). + { $as_echo "$as_me:${as_lineno-$LINENO}: result: OSX" >&5 +$as_echo "OSX" >&6; };; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; };; +esac + #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ diff --git a/unix/configure.ac b/unix/configure.ac index bafb970..2389ab0 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -300,6 +300,34 @@ if test $tcl_ok = no; then AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?]) fi +#----------------------------------------------------------------------------- +# Options for the notifier. Checks for epoll(7) on Linux, and kqueue(2) +# on FreeBSD. +#----------------------------------------------------------------------------- + +AC_MSG_CHECKING([for advanced notifier support]) +case x`uname -s` in + xLinux) + AC_MSG_RESULT([epoll(7)]) + AC_CHECK_HEADERS([sys/epoll.h], + [AC_DEFINE(HAVE_EPOLL, [1], [Is epoll(7) supported?])]);; + xFreeBSD) + AC_MSG_RESULT([kqueue(2)]) + # Messy because we want to check if *all* the headers are present, and not + # just *any* + tcl_kqueue_headers=x + AC_CHECK_HEADERS([sys/types.h sys/event.h sys/time.h], + [tcl_kqueue_headers=${tcl_kqueue_headers}y]) + AS_IF([test $tcl_kqueue_headers = xyyy], [ + AC_DEFINE(HAVE_KQUEUE, [1], [Is kqueue(2) supported?])]);; + xDarwin) + # Assume that we've got CoreFoundation present (checked elsewhere because + # of wider impact). + AC_MSG_RESULT([OSX]);; + *) + AC_MSG_RESULT([none]);; +esac + #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index e37962d..485f6f7 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1,9 +1,10 @@ /* * tclUnixNotfy.c -- * - * This file contains the implementation of the select()-based - * Unix-specific notifier, which is the lowest-level part of the Tcl - * event loop. This file works together with generic/tclNotify.c. + * This file contains the implementation of the Unix-specific notifier, + * based on select()/epoll()/kqueue() depending on platform, which is the + * lowest-level part of the Tcl event loop. This file works together with + * generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * @@ -15,12 +16,25 @@ #ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is * in tclMacOSXNotify.c */ #include +#if defined(HAVE_EPOLL) +# include +#elif defined(HAVE_KQUEUE) +# include +# include +# include +#endif /* * This structure is used to keep track of the notifier info for a registered * file. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +struct PlatformEventData; +#undef USE_SELECT_FOR_NOTIFIER +#else +#define USE_SELECT_FOR_NOTIFIER 1 +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ typedef struct FileHandler { int fd; int mask; /* Mask of desired events: TCL_READABLE, @@ -32,8 +46,41 @@ typedef struct FileHandler { * Tcl_CreateFileHandler. */ ClientData clientData; /* Argument to pass to proc. */ struct FileHandler *nextPtr;/* Next in list of all files we care about. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + struct PlatformEventData *platformEventData; + /* Pointer associating the platform-specific + * event structures with {file,tsd}Ptrs. */ + int platformReadyMask; /* Platform-specific mask of ready events. */ +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } FileHandler; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +/* + * The following structure is associated with a FileHandler through platform- + * specific event structures (currently either struct epoll_event or kevent) + * whenever Tcl_CreateFileHandler or Tcl_DeleteFileHandler are called. + * It contains a FileHandler and a ThreadSpecificData pointer in order to + * update readyMask and to alert waiting threads. + */ + +struct ThreadSpecificData; +struct PlatformEventData { + FileHandler *filePtr; + struct ThreadSpecificData *tsdPtr; +}; +#else /* !(HAVE_EPOLL || HAVE_KQUEUE) */ +/* + * The following structure contains a set of select() masks to track readable, + * writable, and exception conditions. + */ + +typedef struct { + fd_set readable; + fd_set writable; + fd_set exception; +} SelectMasks; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + /* * The following structure is what is added to the Tcl event queue when file * handlers are ready to fire. @@ -50,17 +97,6 @@ typedef struct { } FileHandlerEvent; /* - * The following structure contains a set of select() masks to track readable, - * writable, and exception conditions. - */ - -typedef struct { - fd_set readable; - fd_set writable; - fd_set exception; -} SelectMasks; - -/* * The following static structure contains the state information for the * select based implementation of the Tcl notifier. One of these structures is * created for each thread that is using the notifier. @@ -69,6 +105,7 @@ typedef struct { typedef struct ThreadSpecificData { FileHandler *firstFileHandlerPtr; /* Pointer to head of file handler list. */ +#ifdef USE_SELECT_FOR_NOTIFIER SelectMasks checkMasks; /* This structure is used to build up the * masks to be used in the next call to * select. Bits are set in response to calls @@ -79,6 +116,7 @@ typedef struct ThreadSpecificData { int numFdBits; /* Number of valid bits in checkMasks (one * more than highest fd for which * Tcl_WatchFile has been called). */ +#endif /* USE_SELECT_FOR_NOTIFIER */ #ifdef TCL_THREADS int onList; /* True if it is in this list */ unsigned int pollState; /* pollState is used to implement a polling @@ -169,10 +207,11 @@ static int notifierThreadRunning = 0; static pthread_cond_t notifierCV = PTHREAD_COND_INITIALIZER; /* - * The pollState bits - * POLL_WANT is set by each thread before it waits on its condition - * variable. It is checked by the notifier before it does select. - * POLL_DONE is set by the notifier if it goes into select after seeing + * The pollState bits. + * + * POLL_WANT: Set by each thread before it waits on its condition variable. + * It is checked by the notifier before it does select. + * POLL_DONE: Set by the notifier if it goes into select after seeing * POLL_WANT. The idea is to ensure it tries a select with the * same bits the initial thread had set. */ @@ -185,8 +224,29 @@ static pthread_cond_t notifierCV = PTHREAD_COND_INITIALIZER; */ static Tcl_ThreadId notifierThread; - #endif /* TCL_THREADS */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +/* + * This is the file descriptor for the platform-specific events mechanism + * (currently either epoll_{ctl,wait} or kevent). + */ + +static int eventsFd; + +/* + * This array reflects the readable/writable/error event conditions that + * were found to exist by the last call to the platform-specific events + * mechanism (currently either epoll_wait or kevent) in NotifierThreadProc. + * maxReadyEvents specifies the maximum number of epoll_events in readyEvents. + */ + +#if defined(HAVE_EPOLL) +static struct epoll_event *readyEvents; +#elif defined(HAVE_KQUEUE) +static struct kevent *readyEvents; +#endif /* HAVE_EPOLL */ +static int maxReadyEvents; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ /* * Static routines defined in this file. @@ -256,6 +316,28 @@ static const WCHAR className[] = L"TclNotifier"; static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, void *wParam, void *lParam); #endif /* TCL_THREADS && __CYGWIN__ */ + +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +#define PLATFORMEVENTSCONTROL_ADD 0x01 +#define PLATFORMEVENTSCONTROL_DEL 0x02 +#define PLATFORMEVENTSCONTROL_MOD 0x04 +#define PLATFORMEVENTSCONTROL_AUTO_MASK 0x10 +static void PlatformEventsControl(FileHandler *filePtr, + ThreadSpecificData *tsdPtr, int op, int mask); +static void PlatformEventsFinalize(void); +static int PlatformEventsGet(int numEvent_last, + int numReadyEvents, int skipFd, int wantFd, + int onList); +static void PlatformEventsInit(void); +static int PlatformEventsTranslate(FileHandler *filePtr); +#if defined(HAVE_EPOLL) +static int PlatformEventsWait(struct epoll_event *events, + int numEvents, struct timeval *timePtr); +#elif defined(HAVE_KQUEUE) +static int PlatformEventsWait(struct kevent *events, + int numEvents, struct timeval *timePtr); +#endif /* HAVE_EPOLL */ +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ #if TCL_THREADS /* @@ -273,8 +355,10 @@ static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, * *---------------------------------------------------------------------- */ + static void -StartNotifierThread(const char *proc) +StartNotifierThread( + const char *proc) { if (!notifierThreadRunning) { pthread_mutex_lock(¬ifierInitMutex); @@ -285,6 +369,7 @@ StartNotifierThread(const char *proc) } pthread_mutex_lock(¬ifierMutex); + /* * Wait for the notifier pipe to be created. */ @@ -325,6 +410,9 @@ Tcl_InitNotifier(void) } else { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + PlatformEventsInit(); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ #ifdef TCL_THREADS tsdPtr->eventReady = 0; @@ -443,6 +531,9 @@ Tcl_FinalizeNotifier( } notifierThreadRunning = 0; } +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + PlatformEventsFinalize(); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } } @@ -571,6 +662,360 @@ Tcl_ServiceModeHook( } } +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +/* + *---------------------------------------------------------------------- + * + * PlatformEventsControl -- + * + * This function abstracts adding, modifying, or deleting a file + * descriptor and its associated FileHandler and ThreadSpecificData + * pointers from an epoll or kqueue fd via either epoll_ctl or kevent. + * + * Results: + * None. + * + * Side effects: + * If successful, a file descriptor is added, deleted, or modified from + * the epoll on Linux and kqueue on FreeBSD fd. + * + *---------------------------------------------------------------------- + */ + +void +PlatformEventsControl( + FileHandler *filePtr, + ThreadSpecificData *tsdPtr, + int op, + int mask) +{ +#if defined(HAVE_EPOLL) + struct epoll_event event; + int epollOp; +#elif defined(HAVE_KQUEUE) + int numEvents; + struct kevent event[2]; + int keventOp; +#endif /* HAVE_EPOLL */ + struct PlatformEventData *platformEventData; + + if (op & PLATFORMEVENTSCONTROL_AUTO_MASK) { + mask = filePtr->mask; + op &= ~PLATFORMEVENTSCONTROL_AUTO_MASK; + } + if (op == PLATFORMEVENTSCONTROL_ADD) { + platformEventData = ckalloc(sizeof(*platformEventData)); + platformEventData->filePtr = filePtr; + platformEventData->tsdPtr = tsdPtr; + filePtr->platformEventData = platformEventData; + } else { + platformEventData = filePtr->platformEventData; + } + filePtr->platformReadyMask = 0; + +#if defined(HAVE_EPOLL) + event.events = EPOLLET; + if (mask & TCL_READABLE) { + event.events |= EPOLLIN; + } + if (mask & TCL_WRITABLE) { + event.events |= EPOLLOUT; + } + if (mask & TCL_EXCEPTION) { + event.events |= EPOLLERR; + } + event.data.ptr = platformEventData; + if (op == PLATFORMEVENTSCONTROL_ADD) { + epollOp = EPOLL_CTL_ADD; + } else if (op == PLATFORMEVENTSCONTROL_DEL) { + epollOp = EPOLL_CTL_DEL; + } else if (op == PLATFORMEVENTSCONTROL_MOD) { + epollOp = EPOLL_CTL_MOD; + } + if (epoll_ctl(eventsFd, epollOp, filePtr->fd, &event) == -1) { + Tcl_Panic("epoll_ctl: %s", strerror(errno)); + } +#elif defined(HAVE_KQUEUE) + + numEvents = 0; + keventOp = 0; + if (op == PLATFORMEVENTSCONTROL_ADD) { + keventOp = EV_ADD; + } else if (op == PLATFORMEVENTSCONTROL_DEL) { + keventOp = EV_DELETE; + } else if (op == PLATFORMEVENTSCONTROL_MOD) { + keventOp = EV_ADD; + } + keventOp |= EV_CLEAR; + if ((mask & TCL_READABLE) || (mask & TCL_EXCEPTION)) { + EV_SET(&event[numEvents], filePtr->fd, EVFILT_READ, keventOp, 0, 0, + platformEventData); + numEvents++; + } + if (mask & TCL_WRITABLE) { + EV_SET(&event[numEvents], filePtr->fd, EVFILT_WRITE, keventOp, 0, 0, + platformEventData); + numEvents++; + } + if (kevent(eventsFd, event, numEvents, NULL, 0, NULL) == -1) { + Tcl_Panic("kevent: %s", strerror(errno)); + } +#endif /* HAVE_EPOLL */ +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsFinalize -- + * + * This function abstracts closing the epoll on Linux and kqueue on + * FreeBSD file descriptor and freeing its associated array of returned + * events. + * + * Results: + * None. + * + * Side effects: + * The epoll or kqueue fd is closed if non-zero. The array of returned + * events is freed if non_NULL. + * + *---------------------------------------------------------------------- + */ + +void +PlatformEventsFinalize(void) +{ + if (eventsFd > 0) { + close(eventsFd); + eventsFd = 0; + } + if (readyEvents) { + ckfree(readyEvents); + maxReadyEvents = 0; + } +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsGet -- + * + * This function abstracts iterating over the array of returned events + * since the last call to PlatformEventsWait(). If skipFd and/or wantFd + * are non-zero, the specified file descriptor will be skipped or hunted + * for respectively. If onList is non-zero, the ThreadSpecificData asso- + * ciated with the current event must specify a non-zero onList flag. + * + * Results: + * Returns -1 if there were no or no eligible events. Returns the index + * of the event in the array of returned events in all other cases. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +PlatformEventsGet( + int numEvent_last, + int numReadyEvents, + int skipFd, + int wantFd, + int onList) +{ + int numEvent; + struct PlatformEventData *platformEventData; + + for (numEvent = numEvent_last; numEvent < numReadyEvents; numEvent++) { +#if defined(HAVE_EPOLL) + platformEventData = readyEvents[numEvent].data.ptr; +#elif defined(HAVE_KQUEUE) + platformEventData = readyEvents[numEvent].udata; +#endif /* HAVE_EPOLL */ + if (!platformEventData) { + continue; + } else if (!platformEventData->filePtr) { + continue; + } else if (!platformEventData->tsdPtr) { + continue; + } else if (skipFd && (platformEventData->filePtr->fd == skipFd)) { + continue; + } else if (wantFd && (platformEventData->filePtr->fd != wantFd)) { + continue; + } else if (onList && !platformEventData->tsdPtr->onList) { + continue; + } else { + return numEvent; + } + } + return -1; +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsInit -- + * This function abstracts creating an epoll fd on Linux and a kqueue + * fd on FreeBSD via epoll_create and kqueue system calls respectively. + * + * Results: + * None. + * + * Side effects: + * The epoll or kqueue fd is created if zero. The array of returned + * events is allocated and initialised with space for 128 events if zero. + * + *---------------------------------------------------------------------- + */ + +void +PlatformEventsInit(void) +{ +#if defined(HAVE_EPOLL) + if (eventsFd <= 0) { + eventsFd = epoll_create1(EPOLL_CLOEXEC); + if (eventsFd == -1) { + Tcl_Panic("epoll_create1: %s", strerror(errno)); + } + } +#elif defined(HAVE_KQUEUE) + if (eventsFd <= 0) { + eventsFd = kqueue(); + if (eventsFd == -1) { + Tcl_Panic("kqueue: %s", strerror(errno)); + } + } +#endif /* HAVE_EPOLL */ + if (!readyEvents) { + maxReadyEvents = 128; + readyEvents = ckalloc(maxReadyEvents * sizeof(readyEvents[0])); + } +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsTranslate -- + * This function translates the platform-specific mask of returned events + * in and specific to a FileHandler to TCL_{READABLE,WRITABLE,EXCEPTION} + * bits. + * + * Results: + * Returns the translated and thus platform-independent mask. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +PlatformEventsTranslate( + FileHandler *filePtr) +{ + int mask; + + mask = 0; +#if defined(HAVE_EPOLL) + if (filePtr->platformReadyMask & EPOLLIN) { + mask |= TCL_READABLE; + } + if (filePtr->platformReadyMask & EPOLLOUT) { + mask |= TCL_WRITABLE; + } + if (filePtr->platformReadyMask & EPOLLERR) { + mask |= TCL_EXCEPTION; + } +#elif defined(HAVE_KQUEUE) + if (filePtr->platformReadyMask & EVFILT_READ) { + mask |= TCL_READABLE; + } + if (filePtr->platformReadyMask & EVFILT_WRITE) { + mask |= TCL_WRITABLE; + } +#endif /* HAVE_EPOLL */ + return mask; +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsWait -- + * This function abstracts waiting for I/O events via either epoll_ctl(2) + * on Linux or kevent(2) on FreeBSD. + * + * Results: + * Returns -1 if epoll_ctl(2)/kevent(2) failed. Returns 0 if polling + * and if no events became available whilst polling. Returns a pointer + * to and the count of all returned events in all other cases. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +PlatformEventsWait( +#if defined(HAVE_EPOLL) + struct epoll_event *events, +#elif defined(HAVE_KQUEUE) + struct kevent *events, +#endif /* HAVE_EPOLL */ + int numEvents, + struct timeval *timePtr) +{ + int numFound; + struct timeval tv0, tv1, tv_delta; +#if defined(HAVE_EPOLL) + int timeout; +#elif defined(HAVE_KQUEUE) + struct timespec timeout, *timeoutPtr; +#endif /* HAVE_EPOLL */ + + bzero(events, numEvents * sizeof(events[0])); +#if defined(HAVE_EPOLL) + if (!timePtr) { + timeout = -1; + } else if (!timePtr->tv_sec && !timePtr->tv_usec) { + timeout = 0; + } else { + timeout = timePtr->tv_sec; + } + gettimeofday(&tv0, NULL); + numFound = epoll_wait(eventsFd, events, numEvents, timeout); + gettimeofday(&tv1, NULL); + +#elif defined(HAVE_KQUEUE) + if (!timePtr) { + timeoutPtr = NULL; + } else if (!timePtr->tv_sec && !timePtr->tv_usec) { + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + timeoutPtr = &timeout; + } else { + timeout.tv_sec = timePtr->tv_sec; + timeout.tv_nsec = timePtr->tv_usec * 1000; + timeoutPtr = &timeout; + } + gettimeofday(&tv0, NULL); + numFound = kevent(eventsFd, NULL, 0, events, numEvents, timeoutPtr); + gettimeofday(&tv1, NULL); +#endif /* HAVE_EPOLL */ + + if (timePtr) { + timersub(&tv1, &tv0, &tv_delta); + timersub(&tv_delta, timePtr, timePtr); + } + if (numFound == -1) { + bzero(events, numEvents * sizeof(events[0])); + return -1; + } + return numFound; +} +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + /* *---------------------------------------------------------------------- * @@ -598,6 +1043,10 @@ Tcl_CreateFileHandler( * event. */ ClientData clientData) /* Arbitrary data to pass to proc. */ { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + int is_new; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + if (tclNotifierHooks.createFileHandlerProc) { tclNotifierHooks.createFileHandlerProc(fd, mask, proc, clientData); return; @@ -617,11 +1066,29 @@ Tcl_CreateFileHandler( filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; tsdPtr->firstFileHandlerPtr = filePtr; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + is_new = 1; + } else { + is_new = 0; +#endif /* HAVE_EPOLL */ } filePtr->proc = proc; filePtr->clientData = clientData; filePtr->mask = mask; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + if (eventsFd) { + if (is_new) { + PlatformEventsControl(filePtr, tsdPtr, + PLATFORMEVENTSCONTROL_ADD + | PLATFORMEVENTSCONTROL_AUTO_MASK, 0); + } else { + PlatformEventsControl(filePtr, tsdPtr, + PLATFORMEVENTSCONTROL_MOD + | PLATFORMEVENTSCONTROL_AUTO_MASK, 0); + } + } +#else /* * Update the check masks for this file. */ @@ -644,6 +1111,7 @@ Tcl_CreateFileHandler( if (tsdPtr->numFdBits <= fd) { tsdPtr->numFdBits = fd+1; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } } @@ -673,7 +1141,9 @@ Tcl_DeleteFileHandler( return; } else { FileHandler *filePtr, *prevPtr; +#ifdef USE_SELECT_FOR_NOTIFIER int i; +#endif /* USE_SELECT_FOR_NOTIFIER */ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); /* @@ -694,6 +1164,15 @@ Tcl_DeleteFileHandler( * Update the check masks for this file. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + if (eventsFd) { + PlatformEventsControl(filePtr, tsdPtr, PLATFORMEVENTSCONTROL_DEL + | PLATFORMEVENTSCONTROL_AUTO_MASK, 0); + } + if (filePtr->platformEventData) { + ckfree(filePtr->platformEventData); + } +#else if (filePtr->mask & TCL_READABLE) { FD_CLR(fd, &tsdPtr->checkMasks.readable); } @@ -721,6 +1200,7 @@ Tcl_DeleteFileHandler( } tsdPtr->numFdBits = numFdBits; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ /* * Clean up information in the callback record. @@ -950,7 +1430,11 @@ Tcl_WaitForEvent( tsdPtr->pollState = POLL_WANT; timePtr = NULL; } else { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + waitForFiles = 1; +#else waitForFiles = (tsdPtr->numFdBits > 0); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ tsdPtr->pollState = 0; } @@ -975,9 +1459,11 @@ Tcl_WaitForEvent( } } +#ifdef USE_SELECT_FOR_NOTIFIER FD_ZERO(&tsdPtr->readyMasks.readable); FD_ZERO(&tsdPtr->readyMasks.writable); FD_ZERO(&tsdPtr->readyMasks.exception); +#endif /* USE_SELECT_FOR_NOTIFIER */ if (!tsdPtr->eventReady) { #ifdef __CYGWIN__ @@ -993,7 +1479,7 @@ Tcl_WaitForEvent( MsgWaitForMultipleObjects(1, &tsdPtr->event, 0, timeout, 1279); pthread_mutex_lock(¬ifierMutex); } -#else +#else /* !__CYGWIN__ */ if (timePtr != NULL) { Tcl_Time now; struct timespec ptime; @@ -1054,6 +1540,10 @@ Tcl_WaitForEvent( } #else +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + tsdPtr->numReadyEvents = PlatformEventsWait(readyEvents, + maxReadyEvents, timeoutPtr); +#else tsdPtr->readyMasks = tsdPtr->checkMasks; numFound = select(tsdPtr->numFdBits, &tsdPtr->readyMasks.readable, &tsdPtr->readyMasks.writable, &tsdPtr->readyMasks.exception, @@ -1069,6 +1559,7 @@ Tcl_WaitForEvent( FD_ZERO(&tsdPtr->readyMasks.writable); FD_ZERO(&tsdPtr->readyMasks.exception); } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ #endif /* TCL_THREADS */ /* @@ -1077,6 +1568,9 @@ Tcl_WaitForEvent( for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL); filePtr = filePtr->nextPtr) { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + mask = PlatformEventsTranslate(filePtr); +#else mask = 0; if (FD_ISSET(filePtr->fd, &tsdPtr->readyMasks.readable)) { mask |= TCL_READABLE; @@ -1087,6 +1581,7 @@ Tcl_WaitForEvent( if (FD_ISSET(filePtr->fd, &tsdPtr->readyMasks.exception)) { mask |= TCL_EXCEPTION; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ if (!mask) { continue; @@ -1106,6 +1601,9 @@ Tcl_WaitForEvent( Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL); } filePtr->readyMask = mask; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + filePtr->platformReadyMask = 0; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } #ifdef TCL_THREADS pthread_mutex_unlock(¬ifierMutex); @@ -1118,6 +1616,56 @@ Tcl_WaitForEvent( /* *---------------------------------------------------------------------- * + * AlertSingleThread -- + * + * Notify a single thread that is waiting on a file descriptor to become + * readable or writable or to have an exception condition. + * notifierMutex must be held. + * + * Result: + * None. + * + * Side effects: + * The condition variable associated with the thread is broadcasted. + * + *---------------------------------------------------------------------- + */ + +static void +AlertSingleThread( + ThreadSpecificData *tsdPtr) +{ + tsdPtr->eventReady = 1; + if (tsdPtr->onList) { + /* + * Remove the ThreadSpecificData structure of this thread + * from the waiting list. This prevents us from + * continuously spining on select until the other threads + * runs and services the file event. + */ + + if (tsdPtr->prevPtr) { + tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; + } else { + waitingListPtr = tsdPtr->nextPtr; + } + if (tsdPtr->nextPtr) { + tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr; + } + tsdPtr->nextPtr = tsdPtr->prevPtr = NULL; + tsdPtr->onList = 0; + tsdPtr->pollState = 0; + } +#ifdef __CYGWIN__ + PostMessageW(tsdPtr->hwnd, 1024, 0, 0); +#else /* __CYGWIN__ */ + pthread_cond_broadcast(&tsdPtr->waitCV); +#endif /* __CYGWIN__ */ +} + +/* + *---------------------------------------------------------------------- + * * NotifierThreadProc -- * * This routine is the initial (and only) function executed by the @@ -1144,14 +1692,23 @@ NotifierThreadProc( ClientData clientData) /* Not used. */ { ThreadSpecificData *tsdPtr; +#ifdef USE_SELECT_FOR_NOTIFIER fd_set readableMask; fd_set writableMask; fd_set exceptionMask; - int fds[2]; - int i, numFdBits = 0, receivePipe; +#endif /* USE_SELECT_FOR_NOTIFIER */ + int i; + int fds[2], receivePipe; long found; struct timeval poll = {0., 0.}, *timePtr; char buf[2]; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + int numReadyEvents, numEvent; + FileHandler *filePtr_rP; + struct PlatformEventData *eventDataPtr; +#else + int numFdBits = 0; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ if (pipe(fds) != 0) { Tcl_Panic("NotifierThreadProc: %s", "could not create trigger pipe"); @@ -1183,6 +1740,19 @@ NotifierThreadProc( pthread_mutex_lock(¬ifierMutex); triggerPipe = fds[1]; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + /* + * Set up the epoll/kqueue fd to include the receive pipe. + */ + + filePtr_rP = ckalloc(sizeof(*filePtr_rP)); + filePtr_rP->fd = receivePipe; + tsdPtr = TCL_TSD_INIT(&dataKey); + PlatformEventsControl(filePtr_rP, tsdPtr, PLATFORMEVENTSCONTROL_ADD, + TCL_READABLE); + tsdPtr = NULL; +#endif /* HAVE_EPOLL || HAVE_KQUEUE*/ + /* * Signal any threads that are waiting. */ @@ -1195,12 +1765,28 @@ NotifierThreadProc( */ while (1) { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + pthread_mutex_lock(¬ifierMutex); + timePtr = NULL; + for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) { + if (tsdPtr->pollState & POLL_WANT) { + /* + * Here we make sure we go through select() with the same mask + * bits that were present when the thread tried to poll. + */ + + tsdPtr->pollState |= POLL_DONE; + timePtr = &poll; + } + } + pthread_mutex_unlock(¬ifierMutex); +#else FD_ZERO(&readableMask); FD_ZERO(&writableMask); FD_ZERO(&exceptionMask); /* - * Compute the logical OR of the select masks from all the waiting + * Compute the logical OR of the masks from all the waiting * notifiers. */ @@ -1232,16 +1818,29 @@ NotifierThreadProc( } } pthread_mutex_unlock(¬ifierMutex); - +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ +#ifdef USE_SELECT_FOR_NOTIFIER /* - * Set up the select mask to include the receive pipe. + * Set up the mask to include the receive pipe. */ if (receivePipe >= numFdBits) { numFdBits = receivePipe + 1; } FD_SET(receivePipe, &readableMask); +#endif /* USE_SELECT_FOR_NOTIFIER */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + numReadyEvents = PlatformEventsWait(readyEvents, maxReadyEvents, + timePtr); + if (numReadyEvents == -1) { + /* + * Try again immediately on an error. + */ + numReadyEvents = 0; + continue; + } +#else if (select(numFdBits, &readableMask, &writableMask, &exceptionMask, timePtr) == -1) { /* @@ -1250,12 +1849,53 @@ NotifierThreadProc( continue; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE*/ /* * Alert any threads that are waiting on a ready file descriptor. */ pthread_mutex_lock(¬ifierMutex); + numEvent = 0; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) { + if (tsdPtr->pollState & POLL_DONE) { + AlertSingleThread(tsdPtr); + } + } + while (1) { + numEvent = PlatformEventsGet(numEvent, numReadyEvents, + receivePipe, 0, 1); + if (numEvent == -1) { + break; + } +#if defined(HAVE_EPOLL) + eventDataPtr = readyEvents[numEvent].data.ptr; + eventDataPtr->filePtr->platformReadyMask = + readyEvents[numEvent].events; +#elif defined(HAVE_KQUEUE) + eventDataPtr = readyEvents[numEvent].udata; + if (readyEvents[numEvent].filter == EVFILT_READ) { + if (readyEvents[numEvent].flags & (EV_EOF | EV_ERROR)) { + eventDataPtr->filePtr->platformReadyMask |= EV_ERROR; + } else { + eventDataPtr->filePtr->platformReadyMask + |= EVFILT_READ; + } + } + if (readyEvents[numEvent].filter == EVFILT_WRITE) { + if (readyEvents[numEvent].flags & (EV_EOF | EV_ERROR)) { + eventDataPtr->filePtr->platformReadyMask |= EV_ERROR; + } else { + eventDataPtr->filePtr->platformReadyMask + |= EVFILT_WRITE; + } + } +#endif /* HAVE_EPOLL */ + numEvent++; + found = 1; + tsdPtr = eventDataPtr->tsdPtr; +#else for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) { found = 0; @@ -1276,34 +1916,10 @@ NotifierThreadProc( found = 1; } } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ if (found || (tsdPtr->pollState & POLL_DONE)) { - tsdPtr->eventReady = 1; - if (tsdPtr->onList) { - /* - * Remove the ThreadSpecificData structure of this thread - * from the waiting list. This prevents us from - * continuously spining on select until the other threads - * runs and services the file event. - */ - - if (tsdPtr->prevPtr) { - tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; - } else { - waitingListPtr = tsdPtr->nextPtr; - } - if (tsdPtr->nextPtr) { - tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr; - } - tsdPtr->nextPtr = tsdPtr->prevPtr = NULL; - tsdPtr->onList = 0; - tsdPtr->pollState = 0; - } -#ifdef __CYGWIN__ - PostMessageW(tsdPtr->hwnd, 1024, 0, 0); -#else /* __CYGWIN__ */ - pthread_cond_broadcast(&tsdPtr->waitCV); -#endif /* __CYGWIN__ */ + AlertSingleThread(tsdPtr); } } pthread_mutex_unlock(¬ifierMutex); @@ -1314,7 +1930,40 @@ NotifierThreadProc( * avoid a race condition we only read one at a time. */ - if (FD_ISSET(receivePipe, &readableMask)) { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + found = 0; + numEvent = 0; + while (1) { + numEvent = PlatformEventsGet(numEvent, numReadyEvents, 0, + receivePipe, 0); + if (numEvent == -1) { + break; + } +#if defined(HAVE_EPOLL) + eventDataPtr = readyEvents[numEvent].data.ptr; + eventDataPtr->filePtr->platformReadyMask = + readyEvents[numEvent].events; +#elif defined(HAVE_KQUEUE) + eventDataPtr = readyEvents[numEvent].udata; + eventDataPtr->filePtr->platformReadyMask = + readyEvents[numEvent].filter; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + if (eventDataPtr->filePtr->fd == receivePipe) { + found = 1; + break; + } + numEvent++; + } +#if defined(HAVE_EPOLL) + if (found && readyEvents[numEvent].events & EPOLLIN) +#elif defined(HAVE_KQUEUE) + if (found && (readyEvents[numEvent].filter == EVFILT_READ) + && !(readyEvents[numEvent].flags & (EV_EOF | EV_ERROR))) +#else + if (FD_ISSET(receivePipe, &readableMask)) +#endif /* HAVE_EPOLL */ + { +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ i = read(receivePipe, buf, 1); if ((i == 0) || ((i == 1) && (buf[0] == 'q'))) { @@ -1334,6 +1983,10 @@ NotifierThreadProc( * termination of the notifier thread. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + PlatformEventsControl(filePtr_rP, tsdPtr, PLATFORMEVENTSCONTROL_DEL, + TCL_READABLE); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ close(receivePipe); pthread_mutex_lock(¬ifierMutex); triggerPipe = -1; @@ -1371,32 +2024,35 @@ AtForkChild(void) pthread_cond_init(¬ifierCV, NULL); /* - * notifierThreadRunning == 1: thread is running, (there might be data in notifier lists) + * notifierThreadRunning == 1: thread is running, (there might be data in + * notifier lists) * atForkInit == 0: InitNotifier was never called * notifierCount != 0: unbalanced InitNotifier() / FinalizeNotifier calls * waitingListPtr != 0: there are threads currently waiting for events. */ if (atForkInit == 1) { - notifierCount = 0; if (notifierThreadRunning == 1) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - notifierThreadRunning = 0; + notifierThreadRunning = 0; close(triggerPipe); triggerPipe = -1; + /* * The waitingListPtr might contain event info from multiple * threads, which are invalid here, so setting it to NULL is not * unreasonable. */ + waitingListPtr = NULL; /* * The tsdPtr from before the fork is copied as well. But since * we are paranoic, we don't trust its condvar and reset it. */ + #ifdef __CYGWIN__ DestroyWindow(tsdPtr->hwnd); tsdPtr->hwnd = CreateWindowExW(NULL, className, -- cgit v0.12 From ee6806b80d84376e44d904884d5afc001ba9a4de Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 26 Nov 2016 17:47:27 +0000 Subject: Add "package files" testcase, which doesn give the right answer. So still work to do --- tests/load.test | 4 ++-- tests/package.test | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/load.test b/tests/load.test index 7c4b47f..94451e9 100644 --- a/tests/load.test +++ b/tests/load.test @@ -197,14 +197,14 @@ test load-8.2 {TclGetLoadedPackages procedure} -body { } -returnCodes error -result {could not find interpreter "gorp"} test load-8.3a {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] { lsort -index 1 [info loaded {}] -} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] {*}$alreadyLoaded]] +} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {*}$alreadyLoaded]] test load-8.3b {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] { lsort -index 1 [info loaded child] } [lsort -index 1 [list {{} Test} [list [file join $testDir pkgb$ext] Pkgb]]] test load-8.4 {TclGetLoadedPackages procedure} [list $dll $loaded teststaticpkg] { load [file join $testDir pkgb$ext] pkgb list [lsort -index 1 [info loaded {}]] [lsort [info commands pkgb_*]] -} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}] +} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}] interp delete child test load-9.1 {Tcl_StaticPackage, load already-loaded package into another interp} \ diff --git a/tests/package.test b/tests/package.test index 99f9f06..7e8a42d 100644 --- a/tests/package.test +++ b/tests/package.test @@ -55,8 +55,8 @@ test package-1.7 {pkg::create gives correct output for 1 direct source} { ::pkg::create -name foo -version 1.0 -source test.tcl } {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]} test package-1.8 {pkg::create gives correct output for 2 direct sources} { - ::pkg::create -name foo -version 1.0 -source test.tcl -source test2.tcl -} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]} + list [::pkg::create -name foo -version 1.0 -source test.tcl -source test2.tcl] [package files foo] +} {{package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]} {}} test package-1.9 {pkg::create gives correct output for 1 direct load} { ::pkg::create -name foo -version 1.0 -load test.so } {package ifneeded foo 1.0 [list load [file join $dir test.so]]} @@ -870,6 +870,14 @@ test package-5.2 {TclFreePackageInfo procedure} -body { } foo eval package require x 3.1 } -returnCodes error -match glob -result * +test package-5.3 {package files} -body { + interp create foo + foo eval { + package ifneeded t 2.4 {package provide t 2.4;package require http} + } + foo eval package require t 2.4 + foo eval {list [package files http] [package files t]} +} -result "[list {}] [file join $tcl_library http http.tcl]" test package-6.1 {CheckVersion procedure} { package vcompare 1 2.1 -- cgit v0.12 From b7e862c5654df82b0f5cff5fc9ab501022bfe4dd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 28 Nov 2016 13:17:47 +0000 Subject: Complete implementation, tests and documentation --- doc/info.n | 7 +-- doc/package.n | 8 ++++ generic/tclCmdMZ.c | 27 ++++++++++- generic/tclInt.h | 1 + generic/tclInterp.c | 19 +++++++- generic/tclPkg.c | 24 ++++++---- library/init.tcl | 2 +- library/package.tcl | 2 +- library/tclIndex | 134 ++++++++++++++++++++++++++-------------------------- tests/package.test | 2 +- 10 files changed, 140 insertions(+), 86 deletions(-) diff --git a/doc/info.n b/doc/info.n index 477e272..01ca10b 100644 --- a/doc/info.n +++ b/doc/info.n @@ -297,10 +297,11 @@ scripts are stored. This is actually the value of the \fBtcl_library\fR variable and may be changed by setting \fBtcl_library\fR. .TP -\fBinfo loaded \fR?\fIinterp\fR? +\fBinfo loaded \fR?\fIinterp\fR? \fR?\fIpackage\fR? . -Returns a list describing all of the packages that have been loaded into -\fIinterp\fR with the \fBload\fR command. +Returns the filename loaded as part of \fIpackage\fR. If \fIpackage\fR +is not specified, returns a list describing all of the packages +that have been loaded into \fIinterp\fR with the \fBload\fR command. Each list element is a sub-list with two elements consisting of the name of the file from which the package was loaded and the name of the package. diff --git a/doc/package.n b/doc/package.n index 47b2aa6..5687480 100644 --- a/doc/package.n +++ b/doc/package.n @@ -12,6 +12,7 @@ package \- Facilities for package loading and version control .SH SYNOPSIS .nf +\fBpackage files\fR \fIpackage\fR \fBpackage forget\fR ?\fIpackage package ...\fR? \fBpackage ifneeded \fIpackage version\fR ?\fIscript\fR? \fBpackage names\fR @@ -43,6 +44,13 @@ primarily by system scripts that maintain the package database. The behavior of the \fBpackage\fR command is determined by its first argument. The following forms are permitted: .TP +\fBpackage files\fR \fIpackage\fR +. +Lists all files forming part of \fIpackage\fR. Auto-loaded files are not +included in this list, only files which were directly sourced during package +initialization. The list order corresponds with the order in which the +files were sourced. +.TP \fBpackage forget\fR ?\fIpackage package ...\fR? . Removes all information about each specified package from this interpreter, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ed3d9a5..7f2a2f3 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -989,8 +989,11 @@ TclNRSourceObjCmd( { const char *encodingName = NULL; Tcl_Obj *fileName; + int result; + void **pkgFiles = NULL; + void *names = NULL; - if (objc != 2 && objc !=4) { + if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName"); return TCL_ERROR; } @@ -1008,8 +1011,28 @@ TclNRSourceObjCmd( return TCL_ERROR; } encodingName = TclGetString(objv[2]); + } else if (objc == 3) { + static const char *const nopkgoptions[] = { + "-nopkg", NULL + }; + int index; + + if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1], nopkgoptions, + "option", TCL_EXACT, &index)) { + return TCL_ERROR; + } + pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL); + /* Make sure that during the following TclNREvalFile no filenames + * are recorded for inclusion in the "package files" command */ + names = *pkgFiles; + *pkgFiles = NULL; } - return TclNREvalFile(interp, fileName, encodingName); + result = TclNREvalFile(interp, fileName, encodingName); + if (pkgFiles) { + /* restore "tclPkgFiles" assocdata to how it was. */ + *pkgFiles = names; + } + return result; } /* diff --git a/generic/tclInt.h b/generic/tclInt.h index bfcd002..9422a03 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3101,6 +3101,7 @@ MODULE_SCOPE Tcl_Channel TclpOpenTemporaryFile(Tcl_Obj *dirObj, Tcl_Obj *basenameObj, Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj); MODULE_SCOPE void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName); +MODULE_SCOPE void *TclInitPkgFiles(Tcl_Interp *interp); MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_PathPart portion); MODULE_SCOPE char * TclpReadlink(const char *fileName, diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 1bfe76a..7874de9 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -331,13 +331,24 @@ TclSetPreInitScript( *---------------------------------------------------------------------- */ +typedef struct PkgName { + struct PkgName *nextPtr; /* Next in list of package names being initialized. */ + char name[4]; +} PkgName; + int Tcl_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { + PkgName pkgName = {NULL, "Tcl"}; + PkgName **names = TclInitPkgFiles(interp); + int result = TCL_ERROR; + + pkgName.nextPtr = *names; + *names = &pkgName; if (tclPreInitScript != NULL) { if (Tcl_EvalEx(interp, tclPreInitScript, -1, 0) == TCL_ERROR) { - return TCL_ERROR; + goto end; } } @@ -382,7 +393,7 @@ Tcl_Init( * alternate tclInit command before calling Tcl_Init(). */ - return Tcl_EvalEx(interp, + result = Tcl_EvalEx(interp, "if {[namespace which -command tclInit] eq \"\"} {\n" " proc tclInit {} {\n" " global tcl_libPath tcl_library env tclDefaultLibrary\n" @@ -445,6 +456,10 @@ Tcl_Init( " }\n" "}\n" "tclInit", -1, 0); + +end: + *names = (*names)->nextPtr; + return result; } /* diff --git a/generic/tclPkg.c b/generic/tclPkg.c index c258987..c3cc54e 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -38,7 +38,7 @@ typedef struct PkgName { } PkgName; typedef struct PkgFiles { - PkgName *names; /* Package names being initialized. */ + PkgName *names; /* Package names being initialized. Must be first field*/ Tcl_HashTable table; /* Table which contains files for each package */ } PkgFiles; @@ -222,6 +222,19 @@ static void PkgFilesCleanupProc(ClientData clientData, return; } +void *TclInitPkgFiles(Tcl_Interp *interp) +{ + /* If assocdata "tclPkgFiles" doesn't exist yet, create it */ + PkgFiles *pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL); + if (!pkgFiles) { + pkgFiles = ckalloc(sizeof(PkgFiles)); + pkgFiles->names = NULL; + Tcl_InitHashTable(&pkgFiles->table, TCL_STRING_KEYS); + Tcl_SetAssocData(interp, "tclPkgFiles", PkgFilesCleanupProc, pkgFiles); + } + return pkgFiles; +} + void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName) { PkgFiles *pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL); @@ -549,14 +562,7 @@ PkgRequireCore( pkgPtr->clientData = versionToProvide; Tcl_Preserve(versionToProvide); Tcl_Preserve(script); - /* If assocdata "tclPkgFiles" doesn't exist yet, create it */ - pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL); - if (!pkgFiles) { - pkgFiles = ckalloc(sizeof(PkgFiles)); - pkgFiles->names = NULL; - Tcl_InitHashTable(&pkgFiles->table, TCL_STRING_KEYS); - Tcl_SetAssocData(interp, "tclPkgFiles", PkgFilesCleanupProc, pkgFiles); - } + pkgFiles = TclInitPkgFiles(interp); /* Push "ifneeded" package name in "tclPkgFiles" assocdata. */ pkgName = ckalloc(sizeof(PkgName) + strlen(name)); pkgName->nextPtr = pkgFiles->names; diff --git a/library/init.tcl b/library/init.tcl index 544ea77..bac6270 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -483,7 +483,7 @@ proc auto_load_index {} { set dir [lindex $auto_path $i] set f "" if {$issafe} { - catch {source [file join $dir tclIndex]} + catch {source -nopkg [file join $dir tclIndex]} } elseif {[catch {set f [open [file join $dir tclIndex]]}]} { continue } else { diff --git a/library/package.tcl b/library/package.tcl index 44e3b28..cb1bea6 100644 --- a/library/package.tcl +++ b/library/package.tcl @@ -488,7 +488,7 @@ proc tclPkgUnknown {name args} { set dir [file dirname $file] if {![info exists procdDirs($dir)]} { try { - source $file + source -nopkg $file } trap {POSIX EACCES} {} { # $file was not readable; silently ignore continue diff --git a/library/tclIndex b/library/tclIndex index 26603c1..2762ce4 100644 --- a/library/tclIndex +++ b/library/tclIndex @@ -1,75 +1,75 @@ # Tcl autoload index file, version 2.0 # -*- tcl -*- # This file is generated by the "auto_mkindex" command -# and sourced to set up indexing information for one or +# and source -nopkgd to set up indexing information for one or # more commands. Typically each line is a command that # sets an element in the auto_index array, where the # element name is the name of a command and the value is # a script that loads the command. -set auto_index(auto_reset) [list source [file join $dir auto.tcl]] -set auto_index(tcl_findLibrary) [list source [file join $dir auto.tcl]] -set auto_index(auto_mkindex) [list source [file join $dir auto.tcl]] -set auto_index(auto_mkindex_old) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::init) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::cleanup) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::mkindex) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::hook) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::slavehook) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::command) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::commandInit) [list source [file join $dir auto.tcl]] -set auto_index(::auto_mkindex_parser::fullname) [list source [file join $dir auto.tcl]] -set auto_index(history) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistAdd) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistKeep) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistClear) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistInfo) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistRedo) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistIndex) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistEvent) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistChange) [list source [file join $dir history.tcl]] -set auto_index(pkg_mkIndex) [list source [file join $dir package.tcl]] -set auto_index(tclPkgSetup) [list source [file join $dir package.tcl]] -set auto_index(tclPkgUnknown) [list source [file join $dir package.tcl]] -set auto_index(::tcl::MacOSXPkgUnknown) [list source [file join $dir package.tcl]] -set auto_index(::pkg::create) [list source [file join $dir package.tcl]] -set auto_index(parray) [list source [file join $dir parray.tcl]] -set auto_index(::safe::InterpStatics) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpNested) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpCreate) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpInit) [list source [file join $dir safe.tcl]] -set auto_index(::safe::CheckInterp) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpConfigure) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpCreate) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpSetConfig) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpFindInAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpAddToAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpInit) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AddSubDirs) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpDelete) [list source [file join $dir safe.tcl]] -set auto_index(::safe::setLogCmd) [list source [file join $dir safe.tcl]] -set auto_index(::safe::SyncAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::PathToken) [list source [file join $dir safe.tcl]] -set auto_index(::safe::TranslatePath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::Log) [list source [file join $dir safe.tcl]] -set auto_index(::safe::CheckFileName) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasGlob) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasSource) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasLoad) [list source [file join $dir safe.tcl]] -set auto_index(::safe::FileInAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::DirInAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::Subset) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasSubset) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasEncoding) [list source [file join $dir safe.tcl]] -set auto_index(tcl_wordBreakAfter) [list source [file join $dir word.tcl]] -set auto_index(tcl_wordBreakBefore) [list source [file join $dir word.tcl]] -set auto_index(tcl_endOfWord) [list source [file join $dir word.tcl]] -set auto_index(tcl_startOfNextWord) [list source [file join $dir word.tcl]] -set auto_index(tcl_startOfPreviousWord) [list source [file join $dir word.tcl]] -set auto_index(::tcl::tm::add) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::remove) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::list) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::Defaults) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::UnknownHandler) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::roots) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::path) [list source [file join $dir tm.tcl]] +set auto_index(auto_reset) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(tcl_findLibrary) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(auto_mkindex) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(auto_mkindex_old) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::init) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::cleanup) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::mkindex) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::hook) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::slavehook) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::command) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::commandInit) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::fullname) [list source -nopkg [file join $dir auto.tcl]] +set auto_index(history) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistAdd) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistKeep) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistClear) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistInfo) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistRedo) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistIndex) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistEvent) [list source -nopkg [file join $dir history.tcl]] +set auto_index(::tcl::HistChange) [list source -nopkg [file join $dir history.tcl]] +set auto_index(pkg_mkIndex) [list source -nopkg [file join $dir package.tcl]] +set auto_index(tclPkgSetup) [list source -nopkg [file join $dir package.tcl]] +set auto_index(tclPkgUnknown) [list source -nopkg [file join $dir package.tcl]] +set auto_index(::tcl::MacOSXPkgUnknown) [list source -nopkg [file join $dir package.tcl]] +set auto_index(::pkg::create) [list source -nopkg [file join $dir package.tcl]] +set auto_index(parray) [list source -nopkg [file join $dir parray.tcl]] +set auto_index(::safe::InterpStatics) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::InterpNested) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::interpCreate) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::interpInit) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::CheckInterp) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::interpConfigure) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::InterpCreate) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::InterpSetConfig) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::interpFindInAccessPath) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::interpAddToAccessPath) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::InterpInit) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::AddSubDirs) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::interpDelete) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::setLogCmd) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::SyncAccessPath) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::PathToken) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::TranslatePath) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::Log) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::CheckFileName) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::AliasGlob) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::AliasSource) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::AliasLoad) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::FileInAccessPath) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::DirInAccessPath) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::Subset) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::AliasSubset) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(::safe::AliasEncoding) [list source -nopkg [file join $dir safe.tcl]] +set auto_index(tcl_wordBreakAfter) [list source -nopkg [file join $dir word.tcl]] +set auto_index(tcl_wordBreakBefore) [list source -nopkg [file join $dir word.tcl]] +set auto_index(tcl_endOfWord) [list source -nopkg [file join $dir word.tcl]] +set auto_index(tcl_startOfNextWord) [list source -nopkg [file join $dir word.tcl]] +set auto_index(tcl_startOfPreviousWord) [list source -nopkg [file join $dir word.tcl]] +set auto_index(::tcl::tm::add) [list source -nopkg [file join $dir tm.tcl]] +set auto_index(::tcl::tm::remove) [list source -nopkg [file join $dir tm.tcl]] +set auto_index(::tcl::tm::list) [list source -nopkg [file join $dir tm.tcl]] +set auto_index(::tcl::tm::Defaults) [list source -nopkg [file join $dir tm.tcl]] +set auto_index(::tcl::tm::UnknownHandler) [list source -nopkg [file join $dir tm.tcl]] +set auto_index(::tcl::tm::roots) [list source -nopkg [file join $dir tm.tcl]] +set auto_index(::tcl::tm::path) [list source -nopkg [file join $dir tm.tcl]] diff --git a/tests/package.test b/tests/package.test index 7e8a42d..55bba8a 100644 --- a/tests/package.test +++ b/tests/package.test @@ -877,7 +877,7 @@ test package-5.3 {package files} -body { } foo eval package require t 2.4 foo eval {list [package files http] [package files t]} -} -result "[list {}] [file join $tcl_library http http.tcl]" +} -result {{} {}} test package-6.1 {CheckVersion procedure} { package vcompare 1 2.1 -- cgit v0.12 From 1df184e86080a75782e405775728a47498d90595 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 28 Nov 2016 15:29:36 +0000 Subject: slightly simpler --- generic/tclPkg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index c3cc54e..c8f418c 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -570,8 +570,7 @@ PkgRequireCore( pkgFiles->names = pkgName; code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/ - pkgName = pkgFiles->names; - pkgFiles->names = pkgFiles->names->nextPtr; + pkgFiles->names = pkgName->nextPtr; ckfree(pkgName); Tcl_Release(script); -- cgit v0.12 From 804199d4b7c8ed967e5136c796a658fbbcfbb7c2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Nov 2016 09:45:20 +0000 Subject: Implement the "package forget" part, which was still missing. Handle the case that a filename contains spaces. --- generic/tclPkg.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index c8f418c..42dd08d 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -243,15 +243,16 @@ void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName) Tcl_HashTable *table = &pkgFiles->table; int new; Tcl_HashEntry *entry = Tcl_CreateHashEntry(table, name, &new); - Tcl_Obj *obj = Tcl_NewStringObj(fileName, -1); + Tcl_Obj *list; if (new) { - Tcl_SetHashValue(entry, obj); - Tcl_IncrRefCount(obj); + list = Tcl_NewObj(); + Tcl_SetHashValue(entry, list); + Tcl_IncrRefCount(list); } else { - Tcl_Obj *list = Tcl_GetHashValue(entry); - Tcl_ListObjAppendElement(interp, list, obj); + list = Tcl_GetHashValue(entry); } + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(fileName, -1)); } } @@ -889,9 +890,19 @@ Tcl_PackageObjCmd( } case PKG_FORGET: { const char *keyString; + PkgFiles *pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL); for (i = 2; i < objc; i++) { keyString = TclGetString(objv[i]); + if (pkgFiles) { + hPtr = Tcl_FindHashEntry(&pkgFiles->table, keyString); + if (hPtr) { + Tcl_Obj *obj = Tcl_GetHashValue(hPtr); + Tcl_DeleteHashEntry(hPtr); + Tcl_DecrRefCount(obj); + } + } + hPtr = Tcl_FindHashEntry(&iPtr->packageTable, keyString); if (hPtr == NULL) { continue; -- cgit v0.12 From 2e467a4c9a0cb63cb152e21bb05eb3493ea3ca14 Mon Sep 17 00:00:00 2001 From: limeboy Date: Wed, 14 Dec 2016 15:49:27 +0000 Subject: Make OpenTcpServerEx accept a 'service' string parameter instead of a port. --- generic/tcl.decls | 2 +- generic/tclDecls.h | 7 ++++--- generic/tclIOCmd.c | 25 +++++++++++++++---------- unix/tclUnixSock.c | 9 +++++++-- win/tclWinSock.c | 9 +++++++-- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index af496b3..ba047a0 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2328,7 +2328,7 @@ declare 630 { # TIP #456 declare 631 { - Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, int port, + Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData) } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 4810c51..49ac440 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1817,8 +1817,9 @@ EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 631 */ -EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, int port, - const char *host, unsigned int flags, +EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, + const char *service, const char *host, + unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); @@ -2487,7 +2488,7 @@ typedef struct TclStubs { void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */ int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ - Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, int port, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ + Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ } TclStubs; extern const TclStubs *tclStubsPtr; diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index d6637a0..951fb5a 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1492,9 +1492,9 @@ Tcl_SocketObjCmd( SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_REUSEADDR, SKT_REUSEPORT, SKT_SERVER }; - int optionIndex, a, server = 0, port, myport = 0, async = 0, boolTmp; + int optionIndex, a, server = 0, myport = 0, async = 0, boolTmp; unsigned int flags = 0; - const char *host, *myaddr = NULL; + const char *host, *port, *myaddr = NULL; Tcl_Obj *script = NULL; Tcl_Channel chan; @@ -1628,15 +1628,14 @@ Tcl_SocketObjCmd( return TCL_ERROR; } - if (a == objc-1) { - if (TclSockGetPort(interp, TclGetString(objv[a]), "tcp", - &port) != TCL_OK) { - return TCL_ERROR; - } - } else { + // All the arguments should have been parsed by now, 'a' points to the last + // one, the port number. + if (a != objc-1) { goto wrongNumArgs; } + port = TclGetString(objv[a]); + if (server) { AcceptCallback *acceptCallbackPtr = ckalloc(sizeof(AcceptCallback)); @@ -1646,7 +1645,7 @@ Tcl_SocketObjCmd( acceptCallbackPtr->interp = interp; chan = Tcl_OpenTcpServerEx(interp, port, host, flags, AcceptCallbackProc, - acceptCallbackPtr); + acceptCallbackPtr); if (chan == NULL) { Tcl_DecrRefCount(script); ckfree(acceptCallbackPtr); @@ -1670,7 +1669,13 @@ Tcl_SocketObjCmd( Tcl_CreateCloseHandler(chan, TcpServerCloseProc, acceptCallbackPtr); } else { - chan = Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async); + int portNum; + + if (TclSockGetPort(interp, port, "tcp", &portNum) != TCL_OK) { + return TCL_ERROR; + } + + chan = Tcl_OpenTcpClient(interp, portNum, host, myaddr, myport, async); if (chan == NULL) { return TCL_ERROR; } diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 187c157..8e97543 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -1422,7 +1422,7 @@ TclpMakeTcpClientChannelMode( Tcl_Channel Tcl_OpenTcpServerEx( Tcl_Interp *interp, /* For error reporting - may be NULL. */ - int port, /* Port number to open. */ + const char *service, /* Port number to open. */ const char *myHost, /* Name of local host. */ unsigned int flags, /* Flags. */ Tcl_TcpAcceptProc *acceptProc, @@ -1430,7 +1430,7 @@ Tcl_OpenTcpServerEx( * clients. */ ClientData acceptProcData) /* Data for the callback. */ { - int status = 0, sock = -1, optvalue, chosenport; + int status = 0, sock = -1, optvalue, port, chosenport; struct addrinfo *addrlist = NULL, *addrPtr; /* socket address */ TcpState *statePtr = NULL; char channelName[SOCK_CHAN_LENGTH]; @@ -1476,6 +1476,11 @@ Tcl_OpenTcpServerEx( retry++; chosenport = 0; + if (TclSockGetPort(interp, service, "tcp", &port) != TCL_OK) { + errorMsg = "invalid port number"; + goto error; + } + if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) { my_errno = errno; goto error; diff --git a/win/tclWinSock.c b/win/tclWinSock.c index af22cf8..5e0d7c8 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2037,7 +2037,7 @@ Tcl_MakeTcpClientChannel( Tcl_Channel Tcl_OpenTcpServerEx( Tcl_Interp *interp, /* For error reporting - may be NULL. */ - int port, /* Port number to open. */ + const char *service, /* Port number to open. */ const char *myHost, /* Name of local host. */ unsigned int flags, /* Flags. */ Tcl_TcpAcceptProc *acceptProc, @@ -2053,7 +2053,7 @@ Tcl_OpenTcpServerEx( char channelName[SOCK_CHAN_LENGTH]; u_long flag = 1; /* Indicates nonblocking mode. */ const char *errorMsg = NULL; - int optvalue; + int optvalue, port; if (TclpHasSockets(interp) != TCL_OK) { return NULL; @@ -2073,6 +2073,11 @@ Tcl_OpenTcpServerEx( * Construct the addresses for each end of the socket. */ + if (TclSockGetPort(interp, service, "tcp", &port) != TCL_OK) { + errorMsg = "invalid port number"; + goto error; + } + if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) { goto error; } -- cgit v0.12 From caf8932e2eb878f8cf7c759009c944475d513325 Mon Sep 17 00:00:00 2001 From: limeboy Date: Wed, 14 Dec 2016 15:52:21 +0000 Subject: Fix for the argument parsing phase in the [socket] command. --- generic/tclIOCmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 951fb5a..0eb8f99 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1493,7 +1493,7 @@ Tcl_SocketObjCmd( SKT_SERVER }; int optionIndex, a, server = 0, myport = 0, async = 0, boolTmp; - unsigned int flags = 0; + unsigned int flags = TCL_TCPSERVER_REUSEADDR; const char *host, *port, *myaddr = NULL; Tcl_Obj *script = NULL; Tcl_Channel chan; @@ -1552,7 +1552,6 @@ Tcl_SocketObjCmd( return TCL_ERROR; } server = 1; - flags = TCL_TCPSERVER_REUSEADDR; a++; if (a >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( -- cgit v0.12 From cbe4a7dae5d19875cc5634ba423e5a2942191946 Mon Sep 17 00:00:00 2001 From: limeboy Date: Wed, 14 Dec 2016 15:59:43 +0000 Subject: Adjust OpenTcpServer for the latest changes to OpenTcpServerEx --- generic/tclIOSock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index b6e99ba..8ad268a 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -304,7 +304,11 @@ Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, const char *host, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData) { - return Tcl_OpenTcpServerEx(interp, port, host, TCL_TCPSERVER_REUSEADDR, + char portbuf[TCL_INTEGER_SPACE]; + + TclFormatInt(portbuf, port); + + return Tcl_OpenTcpServerEx(interp, portbuf, host, TCL_TCPSERVER_REUSEADDR, acceptProc, callbackData); } -- cgit v0.12 From dfbc8a629679c709f7f7661bbdc2094f8bb43ff7 Mon Sep 17 00:00:00 2001 From: limeboy Date: Wed, 14 Dec 2016 16:03:53 +0000 Subject: Update the documentation --- doc/OpenTcp.3 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/OpenTcp.3 b/doc/OpenTcp.3 index a39f6f6..10a4815 100644 --- a/doc/OpenTcp.3 +++ b/doc/OpenTcp.3 @@ -24,7 +24,7 @@ Tcl_Channel \fBTcl_OpenTcpServer\fR(\fIinterp, port, myaddr, proc, clientData\fR) .sp Tcl_Channel -\fBTcl_OpenTcpServerEx\fR(\fIinterp, port, myaddr, flags, proc, clientData\fR) +\fBTcl_OpenTcpServerEx\fR(\fIinterp, service, myaddr, flags, proc, clientData\fR) .sp .SH ARGUMENTS .AS Tcl_TcpAcceptProc clientData @@ -33,6 +33,9 @@ Tcl interpreter to use for error reporting. If non-NULL and an error occurs, an error message is left in the interpreter's result. .AP int port in A port number to connect to as a client or to listen on as a server. +.AP "const char" *service in +A string specifying the port number to connect to as a client or to listen on as + a server. .AP "const char" *host in A string specifying a host name or address for the remote end of the connection. .AP int myport in -- cgit v0.12 From e574cfbc71e0788597182949c37f951c56c1d506 Mon Sep 17 00:00:00 2001 From: limeboy Date: Tue, 20 Dec 2016 10:22:22 +0000 Subject: Correct the handling of -server and its options. --- generic/tclIOCmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 0eb8f99..fb37ff6 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1493,7 +1493,7 @@ Tcl_SocketObjCmd( SKT_SERVER }; int optionIndex, a, server = 0, myport = 0, async = 0, boolTmp; - unsigned int flags = TCL_TCPSERVER_REUSEADDR; + unsigned int flags = 0; const char *host, *port, *myaddr = NULL; Tcl_Obj *script = NULL; Tcl_Channel chan; @@ -1552,6 +1552,7 @@ Tcl_SocketObjCmd( return TCL_ERROR; } server = 1; + flags |= TCL_TCPSERVER_REUSEADDR; a++; if (a >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( -- cgit v0.12 From f208386ff790200bd00384f9387957738c69479e Mon Sep 17 00:00:00 2001 From: limeboy Date: Tue, 20 Dec 2016 10:56:53 +0000 Subject: Decouple the switch handling. --- generic/tclIOCmd.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index fb37ff6..e64e31d 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1492,7 +1492,8 @@ Tcl_SocketObjCmd( SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_REUSEADDR, SKT_REUSEPORT, SKT_SERVER }; - int optionIndex, a, server = 0, myport = 0, async = 0, boolTmp; + int optionIndex, a, server = 0, myport = 0, async = 0, reusep = 0, + reusea = 0; unsigned int flags = 0; const char *host, *port, *myaddr = NULL; Tcl_Obj *script = NULL; @@ -1552,7 +1553,8 @@ Tcl_SocketObjCmd( return TCL_ERROR; } server = 1; - flags |= TCL_TCPSERVER_REUSEADDR; + /* [TIP#456] Set for backward-compatibility. */ + reusea = 1; a++; if (a >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1568,14 +1570,9 @@ Tcl_SocketObjCmd( "no argument given for -reuseaddr option", -1)); return TCL_ERROR; } - if (Tcl_GetBooleanFromObj(interp, objv[a], &boolTmp) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[a], &reusea) != TCL_OK) { return TCL_ERROR; } - if (boolTmp) { - flags |= TCL_TCPSERVER_REUSEADDR; - } else { - flags &= ~TCL_TCPSERVER_REUSEADDR; - } break; case SKT_REUSEPORT: a++; @@ -1584,14 +1581,9 @@ Tcl_SocketObjCmd( "no argument given for -reuseport option", -1)); return TCL_ERROR; } - if (Tcl_GetBooleanFromObj(interp, objv[a], &boolTmp) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[a], &reusep) != TCL_OK) { return TCL_ERROR; } - if (boolTmp) { - flags |= TCL_TCPSERVER_REUSEPORT; - } else { - flags &= ~TCL_TCPSERVER_REUSEPORT; - } break; default: Tcl_Panic("Tcl_SocketObjCmd: bad option index to SocketOptions"); @@ -1621,13 +1613,16 @@ Tcl_SocketObjCmd( return TCL_ERROR; } - if (!server && flags != 0) { + if (!server && (reusea != 0 || reusep != 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "options -reuseaddr and -reuseport are only valid for servers", -1)); return TCL_ERROR; } + flags |= reusea ? TCL_TCPSERVER_REUSEADDR : 0; + flags |= reusep ? TCL_TCPSERVER_REUSEPORT : 0; + // All the arguments should have been parsed by now, 'a' points to the last // one, the port number. if (a != objc-1) { -- cgit v0.12 From aba0a7a6cd1bcf03d86534287dfe32ab48b646fe Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 20 Dec 2016 12:35:33 +0000 Subject: Make options -reuseaddr/-reuseport forbidden without -server, no matter the value being true or false. Some additional test-cases. --- generic/tclIOCmd.c | 12 +++++------- tests/socket.test | 12 ++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index e64e31d..682eaf4 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1492,8 +1492,8 @@ Tcl_SocketObjCmd( SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_REUSEADDR, SKT_REUSEPORT, SKT_SERVER }; - int optionIndex, a, server = 0, myport = 0, async = 0, reusep = 0, - reusea = 0; + int optionIndex, a, server = 0, myport = 0, async = 0, reusep = -1, + reusea = -1; unsigned int flags = 0; const char *host, *port, *myaddr = NULL; Tcl_Obj *script = NULL; @@ -1553,8 +1553,6 @@ Tcl_SocketObjCmd( return TCL_ERROR; } server = 1; - /* [TIP#456] Set for backward-compatibility. */ - reusea = 1; a++; if (a >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1613,15 +1611,15 @@ Tcl_SocketObjCmd( return TCL_ERROR; } - if (!server && (reusea != 0 || reusep != 0)) { + if (!server && (reusea != -1 || reusep != -1)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "options -reuseaddr and -reuseport are only valid for servers", -1)); return TCL_ERROR; } - flags |= reusea ? TCL_TCPSERVER_REUSEADDR : 0; - flags |= reusep ? TCL_TCPSERVER_REUSEPORT : 0; + if (reusea!=0) flags |= TCL_TCPSERVER_REUSEADDR; + if (reusep==1) flags |= TCL_TCPSERVER_REUSEPORT; // All the arguments should have been parsed by now, 'a' points to the last // one, the port number. diff --git a/tests/socket.test b/tests/socket.test index c1076eb..80b0251 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -306,8 +306,20 @@ test socket_$af-1.15 {arg parsing for socket command} -constraints [list socket socket -reuseaddr yes 4242 } -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} test socket_$af-1.16 {arg parsing for socket command} -constraints [list socket supported_$af] -body { + socket -reuseaddr no 4242 +} -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} +test socket_$af-1.17 {arg parsing for socket command} -constraints [list socket supported_$af] -body { + socket -reuseaddr +} -returnCodes error -result {no argument given for -reuseaddr option} +test socket_$af-1.18 {arg parsing for socket command} -constraints [list socket supported_$af] -body { socket -reuseport yes 4242 } -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} +test socket_$af-1.19 {arg parsing for socket command} -constraints [list socket supported_$af] -body { + socket -reuseport no 4242 +} -returnCodes error -result {options -reuseaddr and -reuseport are only valid for servers} +test socket_$af-1.20 {arg parsing for socket command} -constraints [list socket supported_$af] -body { + socket -reuseport +} -returnCodes error -result {no argument given for -reuseport option} set path(script) [makeFile {} script] -- cgit v0.12 From a2c66d61f0e05792f61868e5e1228672b38d555f Mon Sep 17 00:00:00 2001 From: limeboy Date: Sun, 1 Jan 2017 22:19:26 +0000 Subject: Make the code slightly more pleasing to the eyes. --- generic/tclIOCmd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 682eaf4..1bd3fe7 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1618,8 +1618,16 @@ Tcl_SocketObjCmd( return TCL_ERROR; } - if (reusea!=0) flags |= TCL_TCPSERVER_REUSEADDR; - if (reusep==1) flags |= TCL_TCPSERVER_REUSEPORT; + // Set the options to their default value if the user didn't override their + // value. + if (reusep == -1) reusep = 0; + if (reusea == -1) reusea = 1; + + // Build the bitset with the flags values. + if (reusea) + flags |= TCL_TCPSERVER_REUSEADDR; + if (reusep) + flags |= TCL_TCPSERVER_REUSEPORT; // All the arguments should have been parsed by now, 'a' points to the last // one, the port number. -- cgit v0.12 From acdb5b20262439ca91321aa76c93346f29891eb5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Jan 2017 13:51:26 +0000 Subject: Fix 2 test-cases, due to changed command options. --- tests/info.test | 4 ++-- tests/package.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/info.test b/tests/info.test index a6a5919..fd89b47 100644 --- a/tests/info.test +++ b/tests/info.test @@ -397,8 +397,8 @@ test info-10.3 {info library option} -body { set tcl_library $savedLibrary; unset savedLibrary test info-11.1 {info loaded option} -body { - info loaded a b -} -returnCodes error -result {wrong # args: should be "info loaded ?interp?"} + info loaded a b c +} -returnCodes error -result {wrong # args: should be "info loaded ?interp? ?packageName?"} test info-11.2 {info loaded option} -body { info loaded {}; info loaded gorp } -returnCodes error -result {could not find interpreter "gorp"} diff --git a/tests/package.test b/tests/package.test index 49346d8..99f9f06 100644 --- a/tests/package.test +++ b/tests/package.test @@ -832,7 +832,7 @@ test package-4.52 {Tcl_PackageCmd procedure, "vsatisfies" option} { } {0} test package-4.53 {Tcl_PackageCmd procedure, "versions" option} -body { package foo -} -returnCodes error -result {bad option "foo": must be forget, ifneeded, names, prefer, present, provide, require, unknown, vcompare, versions, or vsatisfies} +} -returnCodes error -result {bad option "foo": must be files, forget, ifneeded, names, prefer, present, provide, require, unknown, vcompare, versions, or vsatisfies} test package-4.54 {Tcl_PackageCmd procedure, "vsatisfies" option} -body { package vsatisfies 2.1 2.1-3.2-4.5 } -returnCodes error -result {expected versionMin-versionMax but got "2.1-3.2-4.5"} -- cgit v0.12 From 2e108cd831c0768e78523e91979084cad3655df6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Jan 2017 15:16:31 +0000 Subject: Fix safe.tcl test-cases: "source -nopkg" is not necessary here: "source" is an alias for "::safe::AliasSource", which doesn't use "source" --- library/init.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/init.tcl b/library/init.tcl index 65a19aa..e3d4ef0 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -486,7 +486,7 @@ proc auto_load_index {} { set dir [lindex $auto_path $i] set f "" if {$issafe} { - catch {source -nopkg [file join $dir tclIndex]} + catch {source [file join $dir tclIndex]} } elseif {[catch {set f [open [file join $dir tclIndex]]}]} { continue } else { -- cgit v0.12 From 5e02396d5e59a51aa2c1e0cc1adf72c84783b268 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Jan 2017 16:23:23 +0000 Subject: In stead of "source -nopkg" use a ::tcl::Pkg::source utility function. --- generic/tclCmdMZ.c | 28 ++---------- library/init.tcl | 24 ++++++++++- library/package.tcl | 2 +- library/tclIndex | 120 +++++++++++++++++++++++++++++----------------------- 4 files changed, 92 insertions(+), 82 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index fbc9d8f..23e6bd1 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -989,11 +989,8 @@ TclNRSourceObjCmd( { const char *encodingName = NULL; Tcl_Obj *fileName; - int result; - void **pkgFiles = NULL; - void *names = NULL; - if (objc < 2 || objc > 4) { + if (objc != 2 && objc !=4) { Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName"); return TCL_ERROR; } @@ -1011,28 +1008,9 @@ TclNRSourceObjCmd( return TCL_ERROR; } encodingName = TclGetString(objv[2]); - } else if (objc == 3) { - static const char *const nopkgoptions[] = { - "-nopkg", NULL - }; - int index; - - if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1], nopkgoptions, - "option", TCL_EXACT, &index)) { - return TCL_ERROR; - } - pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL); - /* Make sure that during the following TclNREvalFile no filenames - * are recorded for inclusion in the "package files" command */ - names = *pkgFiles; - *pkgFiles = NULL; - } - result = TclNREvalFile(interp, fileName, encodingName); - if (pkgFiles) { - /* restore "tclPkgFiles" assocdata to how it was. */ - *pkgFiles = names; } - return result; + + return TclNREvalFile(interp, fileName, encodingName); } /* diff --git a/library/init.tcl b/library/init.tcl index e3d4ef0..9101e35 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -46,8 +46,6 @@ if {![info exists auto_path]} { } } -source [file join $::tcl_library auto.tcl] - namespace eval tcl { variable Dir foreach Dir [list $::tcl_library [file dirname $::tcl_library]] { @@ -115,6 +113,8 @@ namespace eval tcl { } } +namespace eval tcl::Pkg {} + # Windows specific end of initialization if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} { @@ -460,6 +460,26 @@ proc auto_load {cmd {namespace {}}} { return 0 } +# ::tcl::Pkg::source -- +# This procedure provides an alternative "source" command, which doesn't +# register the file for the "package files" command. Safe interpreters +# don't have to do anything special. +# +# Arguments: +# filename + +proc ::tcl::Pkg::source {filename} { + if {[interp issafe]} { + uplevel 1 [list ::source $filename] + } else { + set f [open $filename] + fconfigure $f -eofchar \032 + set contents [read $f] + close $f + uplevel 1 [list eval $contents] + } +} + # auto_load_index -- # Loads the contents of tclIndex files on the auto_path directory # list. This is usually invoked within auto_load to load the index diff --git a/library/package.tcl b/library/package.tcl index cb1bea6..1cb2d3d 100644 --- a/library/package.tcl +++ b/library/package.tcl @@ -488,7 +488,7 @@ proc tclPkgUnknown {name args} { set dir [file dirname $file] if {![info exists procdDirs($dir)]} { try { - source -nopkg $file + ::tcl::Pkg::source $file } trap {POSIX EACCES} {} { # $file was not readable; silently ignore continue diff --git a/library/tclIndex b/library/tclIndex index 09aba56..87a2814 100644 --- a/library/tclIndex +++ b/library/tclIndex @@ -7,57 +7,69 @@ # element name is the name of a command and the value is # a script that loads the command. -set auto_index(history) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistAdd) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistKeep) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistClear) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistInfo) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistRedo) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistIndex) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistEvent) [list source [file join $dir history.tcl]] -set auto_index(::tcl::HistChange) [list source [file join $dir history.tcl]] -set auto_index(pkg_mkIndex) [list source [file join $dir package.tcl]] -set auto_index(tclPkgSetup) [list source [file join $dir package.tcl]] -set auto_index(tclPkgUnknown) [list source [file join $dir package.tcl]] -set auto_index(::tcl::MacOSXPkgUnknown) [list source [file join $dir package.tcl]] -set auto_index(::pkg::create) [list source [file join $dir package.tcl]] -set auto_index(parray) [list source [file join $dir parray.tcl]] -set auto_index(::safe::InterpStatics) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpNested) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpCreate) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpInit) [list source [file join $dir safe.tcl]] -set auto_index(::safe::CheckInterp) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpConfigure) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpCreate) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpSetConfig) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpFindInAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpAddToAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::InterpInit) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AddSubDirs) [list source [file join $dir safe.tcl]] -set auto_index(::safe::interpDelete) [list source [file join $dir safe.tcl]] -set auto_index(::safe::setLogCmd) [list source [file join $dir safe.tcl]] -set auto_index(::safe::SyncAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::PathToken) [list source [file join $dir safe.tcl]] -set auto_index(::safe::TranslatePath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::Log) [list source [file join $dir safe.tcl]] -set auto_index(::safe::CheckFileName) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasGlob) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasSource) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasLoad) [list source [file join $dir safe.tcl]] -set auto_index(::safe::FileInAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::DirInAccessPath) [list source [file join $dir safe.tcl]] -set auto_index(::safe::Subset) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasSubset) [list source [file join $dir safe.tcl]] -set auto_index(::safe::AliasEncoding) [list source [file join $dir safe.tcl]] -set auto_index(tcl_wordBreakAfter) [list source [file join $dir word.tcl]] -set auto_index(tcl_wordBreakBefore) [list source [file join $dir word.tcl]] -set auto_index(tcl_endOfWord) [list source [file join $dir word.tcl]] -set auto_index(tcl_startOfNextWord) [list source [file join $dir word.tcl]] -set auto_index(tcl_startOfPreviousWord) [list source [file join $dir word.tcl]] -set auto_index(::tcl::tm::add) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::remove) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::list) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::Defaults) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::UnknownHandler) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::roots) [list source [file join $dir tm.tcl]] -set auto_index(::tcl::tm::path) [list source [file join $dir tm.tcl]] +set auto_index(auto_reset) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(tcl_findLibrary) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(auto_mkindex) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(auto_mkindex_old) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::init) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::cleanup) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::mkindex) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::hook) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::slavehook) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::command) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::commandInit) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::fullname) [list ::tcl::Pkg::source [file join $dir auto.tcl]] +set auto_index(history) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistAdd) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistKeep) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistClear) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistInfo) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistRedo) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistIndex) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistEvent) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(::tcl::HistChange) [list ::tcl::Pkg::source [file join $dir history.tcl]] +set auto_index(pkg_mkIndex) [list ::tcl::Pkg::source [file join $dir package.tcl]] +set auto_index(tclPkgSetup) [list ::tcl::Pkg::source [file join $dir package.tcl]] +set auto_index(tclPkgUnknown) [list ::tcl::Pkg::source [file join $dir package.tcl]] +set auto_index(::tcl::MacOSXPkgUnknown) [list ::tcl::Pkg::source [file join $dir package.tcl]] +set auto_index(::pkg::create) [list ::tcl::Pkg::source [file join $dir package.tcl]] +set auto_index(parray) [list ::tcl::Pkg::source [file join $dir parray.tcl]] +set auto_index(::safe::InterpStatics) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::InterpNested) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::interpCreate) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::interpInit) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::CheckInterp) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::interpConfigure) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::InterpCreate) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::InterpSetConfig) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::interpFindInAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::interpAddToAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::InterpInit) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AddSubDirs) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::interpDelete) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::setLogCmd) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::SyncAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::PathToken) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::TranslatePath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::Log) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::CheckFileName) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasGlob) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasSource) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasLoad) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::FileInAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::DirInAccessPath) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::Subset) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasSubset) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(::safe::AliasEncoding) [list ::tcl::Pkg::source [file join $dir safe.tcl]] +set auto_index(tcl_wordBreakAfter) [list ::tcl::Pkg::source [file join $dir word.tcl]] +set auto_index(tcl_wordBreakBefore) [list ::tcl::Pkg::source [file join $dir word.tcl]] +set auto_index(tcl_endOfWord) [list ::tcl::Pkg::source [file join $dir word.tcl]] +set auto_index(tcl_startOfNextWord) [list ::tcl::Pkg::source [file join $dir word.tcl]] +set auto_index(tcl_startOfPreviousWord) [list ::tcl::Pkg::source [file join $dir word.tcl]] +set auto_index(::tcl::tm::add) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::remove) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::list) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::Defaults) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::UnknownHandler) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::roots) [list ::tcl::Pkg::source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::path) [list ::tcl::Pkg::source [file join $dir tm.tcl]] -- cgit v0.12 From 8da19e064b1726cad087cc00da596da9c09704c5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 5 Jan 2017 13:09:26 +0000 Subject: One more ::tcl::Pkg::source, for the Mac --- library/package.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/package.tcl b/library/package.tcl index 5257cd6..c72fbfb 100644 --- a/library/package.tcl +++ b/library/package.tcl @@ -590,7 +590,7 @@ proc tcl::MacOSXPkgUnknown {original name args} { set dir [file dirname $file] if {![info exists procdDirs($dir)]} { try { - source $file + ::tcl::Pkg::source $file } trap {POSIX EACCES} {} { # $file was not readable; silently ignore continue -- cgit v0.12 From 570a13bc17e30542ae39ec77fe3b3cdc37a1979c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 5 Jan 2017 14:27:20 +0000 Subject: Fix [7c7d3b4481d4e4e86420b54031f4abd1df18d64|7c7d3b4481]: load test failures. There's a difference between "" and NULL as interpreter name. --- generic/tclCmdIL.c | 3 --- generic/tclLoad.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index ec85741..a7a5f43 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1728,9 +1728,6 @@ InfoLoadedCmd( interpName = NULL; } else { /* Get pkgs just in specified interp. */ interpName = TclGetString(objv[1]); - if (!interpName[0]) { - interpName = NULL; - } } if (objc < 3) { /* Get loaded files in all packages. */ packageName = NULL; diff --git a/generic/tclLoad.c b/generic/tclLoad.c index aabe3bb..44085d6 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -1051,7 +1051,7 @@ TclGetLoadedPackagesEx( * otherwise, just return info about this * interpreter. */ const char *packageName) /* Package name or NULL. If NULL, return info - * all packages. + * for all packages. */ { Tcl_Interp *target; @@ -1060,26 +1060,6 @@ TclGetLoadedPackagesEx( Tcl_Obj *resultObj, *pkgDesc[2]; if (targetName == NULL) { - /* - * Return information about all of the available packages. - */ - if (packageName) { - resultObj = NULL; - Tcl_MutexLock(&packageMutex); - for (pkgPtr = firstPackagePtr; pkgPtr != NULL; - pkgPtr = pkgPtr->nextPtr) { - if (!strcmp(packageName, pkgPtr->packageName)) { - resultObj = Tcl_NewStringObj(pkgPtr->fileName, -1); - break; - } - } - Tcl_MutexUnlock(&packageMutex); - if (resultObj) { - Tcl_SetObjResult(interp, resultObj); - } - return TCL_OK; - } - resultObj = Tcl_NewObj(); Tcl_MutexLock(&packageMutex); for (pkgPtr = firstPackagePtr; pkgPtr != NULL; @@ -1095,6 +1075,26 @@ TclGetLoadedPackagesEx( } /* + * Return information about all of the available packages. + */ + if (packageName) { + resultObj = NULL; + Tcl_MutexLock(&packageMutex); + for (pkgPtr = firstPackagePtr; pkgPtr != NULL; + pkgPtr = pkgPtr->nextPtr) { + if (!strcmp(packageName, pkgPtr->packageName)) { + resultObj = Tcl_NewStringObj(pkgPtr->fileName, -1); + break; + } + } + Tcl_MutexUnlock(&packageMutex); + if (resultObj) { + Tcl_SetObjResult(interp, resultObj); + } + return TCL_OK; + } + + /* * Return information about only the packages that are loaded in a given * interpreter. */ -- cgit v0.12 From 03d119a9373a169ec5f9dc263d5bca02a2759b1b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 5 Jan 2017 15:13:58 +0000 Subject: Make TclGetLoadedPackagesEx() work with other than the only current interpreter (didn't really think about that earlier ... ). Actually slightly more correct. --- generic/tclLoad.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 44085d6..bcda420 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -1074,20 +1074,27 @@ TclGetLoadedPackagesEx( return TCL_OK; } + target = Tcl_GetSlave(interp, targetName); + if (target == NULL) { + return TCL_ERROR; + } + ipPtr = Tcl_GetAssocData(target, "tclLoad", NULL); + /* * Return information about all of the available packages. */ if (packageName) { resultObj = NULL; - Tcl_MutexLock(&packageMutex); - for (pkgPtr = firstPackagePtr; pkgPtr != NULL; - pkgPtr = pkgPtr->nextPtr) { + + for (; ipPtr != NULL; ipPtr = ipPtr->nextPtr) { + pkgPtr = ipPtr->pkgPtr; + if (!strcmp(packageName, pkgPtr->packageName)) { resultObj = Tcl_NewStringObj(pkgPtr->fileName, -1); break; } } - Tcl_MutexUnlock(&packageMutex); + if (resultObj) { Tcl_SetObjResult(interp, resultObj); } @@ -1099,11 +1106,6 @@ TclGetLoadedPackagesEx( * interpreter. */ - target = Tcl_GetSlave(interp, targetName); - if (target == NULL) { - return TCL_ERROR; - } - ipPtr = Tcl_GetAssocData(target, "tclLoad", NULL); resultObj = Tcl_NewObj(); for (; ipPtr != NULL; ipPtr = ipPtr->nextPtr) { pkgPtr = ipPtr->pkgPtr; -- cgit v0.12 From 2de37edd0d18facf3d79f7db22020c7fd3df5ab9 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 9 Jan 2017 19:09:49 +0000 Subject: New performance measurement routine "timerate" in opposition to "time" the execution limited by fixed time (in milliseconds) instead of repetition count (more precise results, to prevent very long execution time it is no more necessary to estimate repetition count) Syntax: timerate ?-direct? ?-calibrate? ?-overhead double? command ?time? --- generic/tclBasic.c | 1 + generic/tclCmdMZ.c | 333 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 333 insertions(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 81b3513..dec26b4 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -286,6 +286,7 @@ static const CmdInfo builtInCmds[] = { {"source", Tcl_SourceObjCmd, NULL, TclNRSourceObjCmd, 0}, {"tell", Tcl_TellObjCmd, NULL, NULL, CMD_IS_SAFE}, {"time", Tcl_TimeObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"timerate", Tcl_TimeRateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"unload", Tcl_UnloadObjCmd, NULL, NULL, 0}, {"update", Tcl_UpdateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"vwait", Tcl_VwaitObjCmd, NULL, NULL, CMD_IS_SAFE}, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 23e6bd1..c660596 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -17,6 +17,7 @@ */ #include "tclInt.h" +#include "tclCompile.h" #include "tclRegexp.h" #include "tclStringTrim.h" @@ -3984,7 +3985,7 @@ Tcl_TimeObjCmd( start = TclpGetWideClicks(); #endif while (i-- > 0) { - result = Tcl_EvalObjEx(interp, objPtr, 0); + result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); if (result != TCL_OK) { return result; } @@ -4024,6 +4025,336 @@ Tcl_TimeObjCmd( /* *---------------------------------------------------------------------- * + * Tcl_TimeRateObjCmd -- + * + * This object-based procedure is invoked to process the "timerate" Tcl + * command. + * This is similar to command "time", except the execution limited by + * given time (in milliseconds) instead of repetition count. + * + * Example: + * timerate {after 5} 1000 ; # equivalent for `time {after 5} [expr 1000/5]` + * + * Results: + * A standard Tcl object result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_TimeRateObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + static + double measureOverhead = 0; /* global measure-overhead */ + double overhead = -1; /* given measure-overhead */ + register Tcl_Obj *objPtr; + register int result, i; + Tcl_Obj *calibrate = NULL, *direct = NULL; + Tcl_WideInt count = 0; /* Holds repetition count */ + Tcl_WideInt maxms = -0x7FFFFFFFFFFFFFFFL; + /* Maximal running time (in milliseconds) */ + Tcl_WideInt threshold = 1; /* Current threshold for check time (faster + * repeat count without time check) */ + Tcl_WideInt maxIterTm = 1; /* Max time of some iteration as max threshold + * additionally avoid divide to zero (never < 1) */ + register Tcl_WideInt start, middle, stop; +#ifndef TCL_WIDE_CLICKS + Tcl_Time now; +#endif + + static const char *const options[] = { + "-direct", "-overhead", "-calibrate", "--", NULL + }; + enum options { + TMRT_EV_DIRECT, TMRT_OVERHEAD, TMRT_CALIBRATE, TMRT_LAST + }; + + NRE_callback *rootPtr; + ByteCode *codePtr = NULL; + + for (i = 1; i < objc - 1; i++) { + int index; + if (Tcl_GetIndexFromObj(NULL, objv[i], options, "option", TCL_EXACT, + &index) != TCL_OK) { + break; + } + if (index == TMRT_LAST) { + i++; + break; + } + switch ((enum options) index) { + case TMRT_EV_DIRECT: + direct = objv[i]; + break; + case TMRT_OVERHEAD: + if (++i >= objc - 1) { + goto usage; + } + if (Tcl_GetDoubleFromObj(interp, objv[i], &overhead) != TCL_OK) { + return TCL_ERROR; + } + break; + case TMRT_CALIBRATE: + calibrate = objv[i]; + break; + } + } + + if (i >= objc || i < objc-2) { +usage: + Tcl_WrongNumArgs(interp, 1, objv, "?-direct? ?-calibrate? ?-overhead double? command ?time?"); + return TCL_ERROR; + } + objPtr = objv[i++]; + if (i < objc) { + result = TclGetWideIntFromObj(interp, objv[i], &maxms); + if (result != TCL_OK) { + return result; + } + } + + /* if calibrate */ + if (calibrate) { + + /* if no time specified for the calibration */ + if (maxms == -0x7FFFFFFFFFFFFFFFL) { + Tcl_Obj *clobjv[6]; + Tcl_WideInt maxCalTime = 5000; + double lastMeasureOverhead = measureOverhead; + + clobjv[0] = objv[0]; + i = 1; + if (direct) { + clobjv[i++] = direct; + } + clobjv[i++] = objPtr; + + /* reset last measurement overhead */ + measureOverhead = (double)0; + + /* self-call with 100 milliseconds to warm-up, + * before entering the calibration cycle */ + TclNewLongObj(clobjv[i], 100); + Tcl_IncrRefCount(clobjv[i]); + result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); + Tcl_DecrRefCount(clobjv[i]); + if (result != TCL_OK) { + return result; + } + + i--; + clobjv[i++] = calibrate; + clobjv[i++] = objPtr; + + /* set last measurement overhead to max */ + measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; + + /* calibration cycle until it'll be preciser */ + maxms = -1000; + do { + lastMeasureOverhead = measureOverhead; + TclNewLongObj(clobjv[i], (int)maxms); + Tcl_IncrRefCount(clobjv[i]); + result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); + Tcl_DecrRefCount(clobjv[i]); + if (result != TCL_OK) { + return result; + } + maxCalTime += maxms; + /* increase maxms for preciser calibration */ + maxms -= (-maxms / 4); + /* as long as new value more as 0.05% better */ + } while ( (measureOverhead >= lastMeasureOverhead + || measureOverhead / lastMeasureOverhead <= 0.9995) + && maxCalTime > 0 + ); + + return result; + } + if (maxms == 0) { + /* reset last measurement overhead */ + measureOverhead = 0; + Tcl_SetObjResult(interp, Tcl_NewLongObj(0)); + return TCL_OK; + } + + /* if time is negative - make current overhead more precise */ + if (maxms > 0) { + /* set last measurement overhead to max */ + measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; + } else { + maxms = -maxms; + } + + } + + if (maxms == -0x7FFFFFFFFFFFFFFFL) { + maxms = 1000; + } + if (overhead == -1) { + overhead = measureOverhead; + } + + /* be sure that resetting of result will not smudge the further measurement */ + Tcl_ResetResult(interp); + + /* compile object */ + if (!direct) { + if (TclInterpReady(interp) != TCL_OK) { + return TCL_ERROR; + } + codePtr = TclCompileObj(interp, objPtr, NULL, 0); + TclPreserveByteCode(codePtr); + } + + /* get start and stop time */ +#ifndef TCL_WIDE_CLICKS + Tcl_GetTime(&now); + start = now.sec; start *= 1000000; start += now.usec; +#else + start = TclpGetWideClicks(); +#endif + + /* start measurement */ + stop = start + maxms * 1000; + middle = start; + while (1) { + /* eval single iteration */ + count++; + + if (!direct) { + /* precompiled */ + rootPtr = TOP_CB(interp); + result = TclNRExecuteByteCode(interp, codePtr); + result = TclNRRunCallbacks(interp, result, rootPtr); + } else { + /* eval */ + result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); + } + if (result != TCL_OK) { + goto done; + } + + /* don't check time up to threshold */ + if (--threshold > 0) continue; + + /* check stop time reached, estimate new threshold */ + #ifndef TCL_WIDE_CLICKS + Tcl_GetTime(&now); + middle = now.sec; middle *= 1000000; middle += now.usec; + #else + middle = TclpGetWideClicks(); + #endif + if (middle >= stop) { + break; + } + /* average iteration time in microsecs */ + threshold = (middle - start) / count; + if (threshold > maxIterTm) { + maxIterTm = threshold; + } + /* as relation between remaining time and time since last check */ + threshold = ((stop - middle) / maxIterTm) / 4; + if (threshold > 100000) { /* fix for too large threshold */ + threshold = 100000; + } + } + + { + Tcl_Obj *objarr[8], **objs = objarr; + Tcl_WideInt val; + const char *fmt; + + middle -= start; /* execution time in microsecs */ + + /* if not calibrate */ + if (!calibrate) { + /* minimize influence of measurement overhead */ + if (overhead > 0) { + /* estimate the time of overhead (microsecs) */ + Tcl_WideInt curOverhead = overhead * count; + if (middle > curOverhead) { + middle -= curOverhead; + } else { + middle = 1; + } + } + } else { + /* calibration - obtaining new measurement overhead */ + if (measureOverhead > (double)middle / count) { + measureOverhead = (double)middle / count; + } + objs[0] = Tcl_NewDoubleObj(measureOverhead); + TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */ + objs += 2; + } + + val = middle / count; /* microsecs per iteration */ + if (val >= 1000000) { + objs[0] = Tcl_NewWideIntObj(val); + } else { + if (val < 10) { fmt = "%.6f"; } else + if (val < 100) { fmt = "%.4f"; } else + if (val < 1000) { fmt = "%.3f"; } else + if (val < 10000) { fmt = "%.2f"; } else + { fmt = "%.1f"; }; + objs[0] = Tcl_ObjPrintf(fmt, ((double)middle)/count); + } + + objs[2] = Tcl_NewWideIntObj(count); /* iterations */ + + /* calculate speed as rate (count) per sec */ + if (!middle) middle++; /* +1 ms, just to avoid divide by zero */ + if (count < (0x7FFFFFFFFFFFFFFFL / 1000000)) { + val = (count * 1000000) / middle; + if (val < 100000) { + if (val < 100) { fmt = "%.3f"; } else + if (val < 1000) { fmt = "%.2f"; } else + { fmt = "%.1f"; }; + objs[4] = Tcl_ObjPrintf(fmt, ((double)(count * 1000000)) / middle); + } else { + objs[4] = Tcl_NewWideIntObj(val); + } + } else { + objs[4] = Tcl_NewWideIntObj((count / middle) * 1000000); + } + + /* estimated net execution time (in millisecs) */ + if (!calibrate) { + objs[6] = Tcl_ObjPrintf("%.3f", (double)middle / 1000); + TclNewLiteralStringObj(objs[7], "nett-ms"); + } + + /* + * Construct the result as a list because many programs have always parsed + * as such (extracting the first element, typically). + */ + + TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#"); /* mics/# */ + TclNewLiteralStringObj(objs[3], "#"); + TclNewLiteralStringObj(objs[5], "#/sec"); + Tcl_SetObjResult(interp, Tcl_NewListObj(8, objarr)); + } + +done: + + if (codePtr != NULL) { + TclReleaseByteCode(codePtr); + } + + return result; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_TryObjCmd, TclNRTryObjCmd -- * * This procedure is invoked to process the "try" Tcl command. See the -- cgit v0.12 From 704f3a5483fa3c45aaf38ddf4a83ac4d4f6c7733 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 9 Jan 2017 19:31:08 +0000 Subject: missing entry of tclInt.h added --- generic/tclInt.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generic/tclInt.h b/generic/tclInt.h index dd0c11a..1b37d84 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3461,6 +3461,9 @@ MODULE_SCOPE int Tcl_ThrowObjCmd(ClientData dummy, Tcl_Interp *interp, MODULE_SCOPE int Tcl_TimeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_TimeRateObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE int Tcl_TraceObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -- cgit v0.12 From 6aed9a663094ff9d4bd540007174aff66479b0c2 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 9 Jan 2017 19:33:23 +0000 Subject: [win] load win-registry library also in development environment (uninstalled) --- library/reg/pkgIndex.tcl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index b1fe234..ab022ab 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,9 +1,19 @@ if {([info commands ::tcl::pkgconfig] eq "") - || ([info sharedlibextension] ne ".dll")} return + || ([info sharedlibextension] ne ".dll")} return if {[::tcl::pkgconfig get debug]} { + if {[info exists [file join $dir tclreg13g.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13g.dll] registry] + } else { + package ifneeded registry 1.3.2 \ + [list load tclreg13g registry] + } } else { + if {[info exists [file join $dir tclreg13.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13.dll] registry] + } else { + package ifneeded registry 1.3.2 \ + [list load tclreg13 registry] + } } -- cgit v0.12 -- cgit v0.12 From a3433951b0a141acbb0fd911aefffcbd34e3b0b3 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 21:57:06 +0000 Subject: 1st try to rewrite clock in C --- generic/tclClock.c | 253 ++++++++++++++++++++++++++++++++++++++++------------- library/clock.tcl | 6 +- library/init.tcl | 28 +++--- 3 files changed, 212 insertions(+), 75 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 27009fd..e9a59f3 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -69,6 +69,7 @@ typedef enum ClockLiteral { LIT_MONTH, LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, LIT_YEAR, + LIT_FREESCAN, LIT__END } ClockLiteral; static const char *const literals[] = { @@ -84,7 +85,8 @@ static const char *const literals[] = { "julianDay", "localSeconds", "month", "seconds", "tzName", "tzOffset", - "year" + "year", + "::tcl::clock::FreeScan" }; /* @@ -190,6 +192,9 @@ static int ClockParseformatargsObjCmd( static int ClockSecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockScanObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); static struct tm * ThreadSafeLocalTime(const time_t *); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); @@ -202,7 +207,7 @@ struct ClockCommand { const char *name; /* The tail of the command name. The full name * is "::tcl::clock::". When NULL marks * the end of the table. */ - Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This + Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This * will always have the ClockClientData sent * to it, but may well ignore this data. */ }; @@ -213,6 +218,7 @@ static const struct ClockCommand clockCommands[] = { { "microseconds", ClockMicrosecondsObjCmd }, { "milliseconds", ClockMillisecondsObjCmd }, { "seconds", ClockSecondsObjCmd }, + { "scan", ClockScanObjCmd }, { "Oldscan", TclClockOldscanObjCmd }, { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, { "GetDateFields", ClockGetdatefieldsObjCmd }, @@ -466,6 +472,9 @@ ClockGetdatefieldsObjCmd( GetMonthDay(&fields); GetYearWeekDay(&fields, changeover); + +/************* split to use structured version from here ************/ + dict = Tcl_NewDictObj(); Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS], Tcl_NewWideIntObj(fields.localSeconds)); @@ -1507,9 +1516,9 @@ GetJulianDayFromEraYearMonthDay( * See above bug for details. The casts are necessary. */ if (ym1 >= 0) - ym1o4 = ym1 / 4; + ym1o4 = ym1 / 4; else { - ym1o4 = - (int) (((unsigned int) -ym1) / 4); + ym1o4 = - (int) (((unsigned int) -ym1) / 4); } #endif if (ym1 % 4 < 0) { @@ -1843,6 +1852,96 @@ ClockMicrosecondsObjCmd( return TCL_OK; } + +typedef struct _ClockFmtScnArgs { + Tcl_Obj *formatObj; /* Format */ + Tcl_Obj *localeObj; /* Locale */ + Tcl_Obj *timezoneObj; /* Timezone */ + Tcl_Obj *baseObj; /* Base (scan only) */ +} _ClockFmtScnArgs; + +static int +_ClockParseFmtScnArgs( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[], /* Parameter vector */ + _ClockFmtScnArgs *resOpts, /* Result vector: format, locale, timezone... */ + int forScan /* Flag to differentiate between format and scan */ +) { + ClockClientData *dataPtr = clientData; + Tcl_Obj **litPtr = dataPtr->literals; + int gmtFlag = 0; + static const char *const options[2][6] = { + { /* Format command line options */ + "-format", "-gmt", "-locale", + "-timezone", NULL }, + { /* Scan command line options */ + "-format", "-gmt", "-locale", + "-timezone", "-base", NULL } + }; + enum optionInd { + CLOCK_FORMAT_FORMAT, CLOCK_FORMAT_GMT, CLOCK_FORMAT_LOCALE, + CLOCK_FORMAT_TIMEZONE, CLOCK_FORMAT_BASE + }; + int optionIndex; /* Index of an option. */ + int saw = 0; /* Flag == 1 if option was seen already. */ + int i; + + /* + * Extract values for the keywords. + */ + + resOpts->formatObj = NULL; + resOpts->localeObj = NULL; + resOpts->timezoneObj = NULL; + resOpts->baseObj = NULL; + for (i = 2; i < objc; i+=2) { + if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[i]), NULL); + return TCL_ERROR; + } + switch (optionIndex) { + case CLOCK_FORMAT_FORMAT: + resOpts->formatObj = objv[i+1]; + break; + case CLOCK_FORMAT_GMT: + if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ + return TCL_ERROR; + } + break; + case CLOCK_FORMAT_LOCALE: + resOpts->localeObj = objv[i+1]; + break; + case CLOCK_FORMAT_TIMEZONE: + resOpts->timezoneObj = objv[i+1]; + break; + case CLOCK_FORMAT_BASE: + resOpts->baseObj = objv[i+1]; + break; + } + saw |= 1 << optionIndex; + } + + /* + * Check options. + */ + + if ((saw & (1 << CLOCK_FORMAT_GMT)) + && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { + Tcl_SetObjResult(interp, litPtr[LIT_CANNOT_USE_GMT_AND_TIMEZONE]); + Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); + return TCL_ERROR; + } + if (gmtFlag) { + resOpts->timezoneObj = litPtr[LIT_GMT]; + } + + return TCL_OK; +} + /* *----------------------------------------------------------------------------- * @@ -1870,22 +1969,9 @@ ClockParseformatargsObjCmd( { ClockClientData *dataPtr = clientData; Tcl_Obj **litPtr = dataPtr->literals; - Tcl_Obj *results[3]; /* Format, locale and timezone */ -#define formatObj results[0] -#define localeObj results[1] -#define timezoneObj results[2] - int gmtFlag = 0; - static const char *const options[] = { /* Command line options expected */ - "-format", "-gmt", "-locale", - "-timezone", NULL }; - enum optionInd { - CLOCK_FORMAT_FORMAT, CLOCK_FORMAT_GMT, CLOCK_FORMAT_LOCALE, - CLOCK_FORMAT_TIMEZONE - }; - int optionIndex; /* Index of an option. */ - int saw = 0; /* Flag == 1 if option was seen already. */ + _ClockFmtScnArgs resOpts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ - int i; + int ret; /* * Args consist of a time followed by keyword-value pairs. @@ -1903,33 +1989,10 @@ ClockParseformatargsObjCmd( * Extract values for the keywords. */ - formatObj = litPtr[LIT__DEFAULT_FORMAT]; - localeObj = litPtr[LIT_C]; - timezoneObj = litPtr[LIT__NIL]; - for (i = 2; i < objc; i+=2) { - if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, - &optionIndex) != TCL_OK) { - Tcl_SetErrorCode(interp, "CLOCK", "badOption", - Tcl_GetString(objv[i]), NULL); - return TCL_ERROR; - } - switch (optionIndex) { - case CLOCK_FORMAT_FORMAT: - formatObj = objv[i+1]; - break; - case CLOCK_FORMAT_GMT: - if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ - return TCL_ERROR; - } - break; - case CLOCK_FORMAT_LOCALE: - localeObj = objv[i+1]; - break; - case CLOCK_FORMAT_TIMEZONE: - timezoneObj = objv[i+1]; - break; - } - saw |= 1 << optionIndex; + ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, + &resOpts, 0); + if (ret != TCL_OK) { + return ret; } /* @@ -1939,26 +2002,98 @@ ClockParseformatargsObjCmd( if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { return TCL_ERROR; } - if ((saw & (1 << CLOCK_FORMAT_GMT)) - && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { - Tcl_SetObjResult(interp, litPtr[LIT_CANNOT_USE_GMT_AND_TIMEZONE]); - Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); - return TCL_ERROR; - } - if (gmtFlag) { - timezoneObj = litPtr[LIT_GMT]; - } + if (resOpts.formatObj == NULL) + resOpts.formatObj = litPtr[LIT__DEFAULT_FORMAT]; + if (resOpts.localeObj == NULL) + resOpts.localeObj = litPtr[LIT_C]; + if (resOpts.timezoneObj == NULL) + resOpts.timezoneObj = litPtr[LIT__NIL]; /* * Return options as a list. */ - Tcl_SetObjResult(interp, Tcl_NewListObj(3, results)); + Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts)); return TCL_OK; +} + +/*---------------------------------------------------------------------- + * + * ClockScanObjCmd - + * + *---------------------------------------------------------------------- + */ + +int +ClockScanObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter values */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **litPtr = dataPtr->literals; + + Tcl_Time retClock; + char *string, *format = NULL; + int gmt, ret = 0; + char *locale; + _ClockFmtScnArgs opts; /* Format, locale, timezone and base */ + Tcl_WideInt baseVal; /* Base value */ + + if ((objc & 1) == 1) { + Tcl_WrongNumArgs(interp, 1, objv, "string " + "?-base seconds? " + "?-format string? " + "?-gmt boolean? " + "?-locale LOCALE? ?-timezone ZONE?"); + Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); + return TCL_ERROR; + } + + /* + * Extract values for the keywords. + */ + + ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, + &opts, 1); + if (ret != TCL_OK) { + return ret; + } + + if (opts.baseObj != NULL) { + if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { + return TCL_ERROR; + } + } else { + Tcl_Time now; + Tcl_GetTime(&now); + baseVal = (Tcl_WideInt) now.sec; + } + + /* if free scan */ + if (opts.formatObj == NULL) { + Tcl_Obj *callargs[5]; + /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ + if (opts.localeObj != NULL) { + Tcl_SetResult(interp, + "legacy [clock scan] does not support -locale", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); + return TCL_ERROR; + } + callargs[0] = litPtr[LIT_FREESCAN]; + callargs[1] = objv[1]; + callargs[2] = opts.baseObj != NULL ? opts.baseObj : Tcl_NewWideIntObj(baseVal); + callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : litPtr[LIT__NIL]; + callargs[4] = opts.localeObj != NULL ? opts.localeObj : litPtr[LIT_C]; + return Tcl_EvalObjv(interp, 5, callargs, 0); + } -#undef timezoneObj -#undef localeObj -#undef formatObj + // **** + string = TclGetString(objv[1]); + // **** timezone = GetSystemTimeZone() + + return TCL_OK; } /*---------------------------------------------------------------------- diff --git a/library/clock.tcl b/library/clock.tcl index 535a67d..5b48eb3 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -1178,7 +1178,7 @@ proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} { # #---------------------------------------------------------------------- -proc ::tcl::clock::scan { args } { +proc ::tcl::clock::__org_scan { args } { set format {} @@ -1300,7 +1300,9 @@ proc ::tcl::clock::FreeScan { string base timezone locale } { variable TZData # Get the data for time changes in the given zone - + if {$timezone eq {}} { + set timezone [GetSystemTimeZone] + } try { SetupTimeZone $timezone } on error {retval opts} { diff --git a/library/init.tcl b/library/init.tcl index 544ea77..e6df12b 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -66,12 +66,12 @@ namespace eval tcl { } if {![interp issafe]} { - variable Path [encoding dirs] - set Dir [file join $::tcl_library encoding] - if {$Dir ni $Path} { + variable Path [encoding dirs] + set Dir [file join $::tcl_library encoding] + if {$Dir ni $Path} { lappend Path $Dir encoding dirs $Path - } + } } # TIP #255 min and max functions @@ -171,14 +171,14 @@ if {[interp issafe]} { proc clock args { namespace eval ::tcl::clock [list namespace ensemble create -command \ - [uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \ - -subcommands { - add clicks format microseconds milliseconds scan seconds - }] + [uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \ + -subcommands { + add clicks format microseconds milliseconds scan seconds + }] # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format scan} { + foreach cmd {add format FreeScan} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] @@ -600,12 +600,12 @@ proc auto_import {pattern} { auto_load_index foreach pattern $patternList { - foreach name [array names auto_index $pattern] { - if {([namespace which -command $name] eq "") + foreach name [array names auto_index $pattern] { + if {([namespace which -command $name] eq "") && ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} { - namespace eval :: $auto_index($name) - } - } + namespace eval :: $auto_index($name) + } + } } } -- cgit v0.12 From 9e52bb21b79848250f66adb912c1195cc9da2c56 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 21:58:33 +0000 Subject: [temp-commit]: clock scan with several optimization porting, still not-ready --- generic/tclClock.c | 520 +++++++++++++++++++++++++++++++++++++++++++++++---- generic/tclDate.c | 497 +++++++++++++++++++++++------------------------- generic/tclDate.h | 77 ++++++++ generic/tclGetDate.y | 134 ++++++------- library/clock.tcl | 19 +- library/init.tcl | 2 +- win/makefile.vc | 4 +- 7 files changed, 870 insertions(+), 383 deletions(-) create mode 100644 generic/tclDate.h diff --git a/generic/tclClock.c b/generic/tclClock.c index e9a59f3..24ed095 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -14,6 +14,7 @@ */ #include "tclInt.h" +#include "tclDate.h" /* * Windows has mktime. The configurators do not check. @@ -28,6 +29,7 @@ */ #define JULIAN_DAY_POSIX_EPOCH 2440588 +#define GREGORIAN_CHANGE_DATE 2361222 #define SECONDS_PER_DAY 86400 #define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ * SECONDS_PER_DAY) @@ -69,7 +71,14 @@ typedef enum ClockLiteral { LIT_MONTH, LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, LIT_YEAR, + LIT_CURRENTYEARCENTURY, + LIT_YEAROFCENTURYSWITCH, + LIT_TZDATA, + LIT_GETSYSTEMTIMEZONE, + LIT_SETUPTIMEZONE, +#if 0 LIT_FREESCAN, +#endif LIT__END } ClockLiteral; static const char *const literals[] = { @@ -86,9 +95,18 @@ static const char *const literals[] = { "month", "seconds", "tzName", "tzOffset", "year", + "::tcl::clock::CurrentYearCentury", + "::tcl::clock::YearOfCenturySwitch", + "::tcl::clock::TZData", + "::tcl::clock::GetSystemTimeZone", + "::tcl::clock::SetupTimeZone", +#if 0 "::tcl::clock::FreeScan" +#endif }; +#define CurrentYearCentury 2000 + /* * Structure containing the client data for [clock] */ @@ -168,6 +186,10 @@ static int ClockClicksObjCmd( static int ClockConvertlocaltoutcObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); + +static int ClockGetDateFields(Tcl_Interp *interp, + TclDateFields *fields, Tcl_Obj *tzdata, + int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -195,6 +217,10 @@ static int ClockSecondsObjCmd( static int ClockScanObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockFreeScan( + ClientData clientData, Tcl_Interp *interp, + Tcl_Obj *strObj, Tcl_WideInt baseVal, + Tcl_Obj *timezoneObj, Tcl_Obj *locale); static struct tm * ThreadSafeLocalTime(const time_t *); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); @@ -296,6 +322,123 @@ TclClockInit( /* *---------------------------------------------------------------------- + */ +inline Tcl_Obj* +ClockGetTZData( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *timezoneObj) /* Name of the timezone */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + + return Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], + timezoneObj, TCL_LEAVE_ERR_MSG); +} +/* + *---------------------------------------------------------------------- + */ +static Tcl_Obj * +ClockGetSystemTimeZone( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + + if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMTIMEZONE], 0) != TCL_OK) { + return NULL; + } + return Tcl_GetObjResult(interp); +} +/* + *---------------------------------------------------------------------- + */ +static int +ClockSetupTimeZone( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *timezoneObj) +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj *callargs[2]; + + callargs[0] = literals[LIT_SETUPTIMEZONE]; + callargs[1] = timezoneObj; + return Tcl_EvalObjv(interp, 2, callargs, 0); +} +/* + *---------------------------------------------------------------------- + * ClockFormatNumericTimeZone - + * + * Formats a time zone as +hhmmss + * + * Parameters: + * z - Time zone in seconds east of Greenwich + * + * Results: + * Returns the time zone object (formatted in a numeric form) + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +ClockFormatNumericTimeZone(int z) { + char sign = '+'; + int h, m; + if ( z < 0 ) { + z = -z; + sign = '-'; + } + h = z / 3600; + z %= 3600; + m = z / 60; + z %= 60; + if (z != 0) { + return Tcl_ObjPrintf("%c%02d%02d%02d", sign, h, m, z); + } + return Tcl_ObjPrintf("%c%02d%02d", sign, h, m); +} + +/* + *---------------------------------------------------------------------- + * [SB] TODO: make constans cacheable (once per second, etc.) ... + */ +inline int +ClockCurrentYearCentury( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + int year = 2000; + + Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + return year; +} +inline int +ClockGetYearOfCenturySwitch( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + int year = 37; + + Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + return year; +} + +/* + *---------------------------------------------------------------------- * * ClockConvertlocaltoutcObjCmd -- * @@ -426,6 +569,8 @@ ClockGetdatefieldsObjCmd( Tcl_Obj *const *literals = data->literals; int changeover; + fields.tzName = NULL; + /* * Check params. */ @@ -449,31 +594,14 @@ ClockGetdatefieldsObjCmd( return TCL_ERROR; } - /* - * Convert UTC time to local. - */ + /* Extract fields */ - if (ConvertUTCToLocal(interp, &fields, objv[2], changeover) != TCL_OK) { + if (ClockGetDateFields(interp, &fields, objv[2], changeover) + != TCL_OK) { return TCL_ERROR; } - /* - * Extract Julian day. - */ - - fields.julianDay = (int) ((fields.localSeconds + JULIAN_SEC_POSIX_EPOCH) - / SECONDS_PER_DAY); - - /* - * Convert to Julian or Gregorian calendar. - */ - - GetGregorianEraYearDay(&fields, changeover); - GetMonthDay(&fields); - GetYearWeekDay(&fields, changeover); - - -/************* split to use structured version from here ************/ + /* Make dict of fields */ dict = Tcl_NewDictObj(); Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS], @@ -511,6 +639,59 @@ ClockGetdatefieldsObjCmd( /* *---------------------------------------------------------------------- + */ +int +ClockGetDateFields( + Tcl_Interp *interp, /* Tcl interpreter */ + TclDateFields *fields, /* Pointer to result fields, where + * fields->seconds contains date to extract */ + Tcl_Obj *tzdata, /* Time zone data object or NULL for gmt */ + int changeover) /* Julian Day Number */ +{ + /* + * Convert UTC time to local. + */ + + if (ConvertUTCToLocal(interp, fields, tzdata, changeover) != TCL_OK) { + return TCL_ERROR; + } + + /* + * Extract Julian day. + */ + + fields->julianDay = (int) ((fields->localSeconds + JULIAN_SEC_POSIX_EPOCH) + / SECONDS_PER_DAY); + + /* + * Convert to Julian or Gregorian calendar. + */ + + GetGregorianEraYearDay(fields, changeover); + GetMonthDay(fields); + GetYearWeekDay(fields, changeover); + + return TCL_OK; +} + +inline +SetDateFieldsTimeZone( + TclDateFields *fields, + Tcl_Obj *timezoneObj) +{ + if (fields->tzName != timezoneObj) { + if (timezoneObj) { + Tcl_IncrRefCount(timezoneObj); + } + if (fields->tzName != NULL) { + Tcl_DecrRefCount(fields->tzName); + } + fields->tzName = timezoneObj; + } +} + +/* + *---------------------------------------------------------------------- * * ClockGetjuliandayfromerayearmonthdayObjCmd -- * @@ -1013,8 +1194,7 @@ ConvertUTCToLocalUsingTable( * Convert the time. */ - fields->tzName = cellv[3]; - Tcl_IncrRefCount(fields->tzName); + SetDateFieldsTimeZone(fields, cellv[3]); fields->localSeconds = fields->seconds + fields->tzOffset; return TCL_OK; } @@ -1107,8 +1287,7 @@ ConvertUTCToLocalUsingC( if (diff > 0) { sprintf(buffer+5, "%02d", diff); } - fields->tzName = Tcl_NewStringObj(buffer, -1); - Tcl_IncrRefCount(fields->tzName); + SetDateFieldsTimeZone(fields, Tcl_NewStringObj(buffer, -1)); return TCL_OK; } @@ -1968,7 +2147,7 @@ ClockParseformatargsObjCmd( Tcl_Obj *const objv[]) /* Parameter vector */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; + Tcl_Obj **literals = dataPtr->literals; _ClockFmtScnArgs resOpts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ int ret; @@ -2003,11 +2182,11 @@ ClockParseformatargsObjCmd( return TCL_ERROR; } if (resOpts.formatObj == NULL) - resOpts.formatObj = litPtr[LIT__DEFAULT_FORMAT]; + resOpts.formatObj = literals[LIT__DEFAULT_FORMAT]; if (resOpts.localeObj == NULL) - resOpts.localeObj = litPtr[LIT_C]; + resOpts.localeObj = literals[LIT_C]; if (resOpts.timezoneObj == NULL) - resOpts.timezoneObj = litPtr[LIT__NIL]; + resOpts.timezoneObj = literals[LIT__NIL]; /* * Return options as a list. @@ -2032,7 +2211,7 @@ ClockScanObjCmd( Tcl_Obj *const objv[]) /* Parameter values */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; + Tcl_Obj **literals = dataPtr->literals; Tcl_Time retClock; char *string, *format = NULL; @@ -2071,8 +2250,10 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - /* if free scan */ + /* If free scan */ if (opts.formatObj == NULL) { +#if 0 + /* Tcled FreeScan proc - */ Tcl_Obj *callargs[5]; /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { @@ -2081,18 +2262,287 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - callargs[0] = litPtr[LIT_FREESCAN]; + callargs[0] = literals[LIT_FREESCAN]; callargs[1] = objv[1]; callargs[2] = opts.baseObj != NULL ? opts.baseObj : Tcl_NewWideIntObj(baseVal); - callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : litPtr[LIT__NIL]; - callargs[4] = opts.localeObj != NULL ? opts.localeObj : litPtr[LIT_C]; + callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : literals[LIT__NIL]; + callargs[4] = opts.localeObj != NULL ? opts.localeObj : literals[LIT_C]; return Tcl_EvalObjv(interp, 5, callargs, 0); +#else + /* Use compiled version of FreeScan - */ + + + /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ + if (opts.localeObj != NULL) { + Tcl_SetResult(interp, + "legacy [clock scan] does not support -locale", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); + return TCL_ERROR; + } + return ClockFreeScan(clientData, interp, objv[1], baseVal, + opts.timezoneObj, opts.localeObj); +#endif } + // **** string = TclGetString(objv[1]); - // **** timezone = GetSystemTimeZone() + // **** timezone = ClockGetSystemTimeZone(clientData, interp) + /* + if (timezoneObj == NULL) { + goto done; + } + */ + + return TCL_OK; +} + +/*---------------------------------------------------------------------- + */ +int +ClockFreeScan( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *strObj, /* String containing the time to scan */ + Tcl_WideInt baseVal, /* Base time, expressed in seconds from the Epoch */ + Tcl_Obj *timezoneObj, /* Default time zone in which the time will be expressed */ + Tcl_Obj *locale) /* (Unused) Name of the locale where the time will be scanned. */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + + DateInfo yy; /* parse structure of TclClockFreeScan */ + TclDateFields date; /* date fields used for converting from seconds */ + Tcl_Obj *tzdata; + int secondOfDay; /* Seconds of day (time only calculation) */ + Tcl_WideInt seconds; + int ret = TCL_ERROR; + Tcl_Obj *cleanUpList = Tcl_NewObj(); + + date.tzName = NULL; + + /* If time zone not specified use system time zone */ + if (timezoneObj == NULL || + TclGetString(timezoneObj) == NULL || timezoneObj->length == 0) { + timezoneObj = ClockGetSystemTimeZone(clientData, interp); + if (timezoneObj == NULL) { + goto done; + } + Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + } + + /* Get the data for time changes in the given zone */ + + if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + goto done; + } + + /* + * Extract year, month and day from the base time for the parser to use as + * defaults + */ + + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + goto done; + } + date.seconds = baseVal; + if (ClockGetDateFields(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + + secondOfDay = date.localSeconds % 86400; + + /* + * Parse the date. The parser will fill a structure "yy" with date, time, + * time zone, relative month/day/seconds, relative weekday, ordinal month. + */ + yy.dateInput = Tcl_GetString(strObj); + + yy.dateYear = date.year; + yy.dateMonth = date.month; + yy.dateDay = date.dayOfMonth; + + if (TclClockFreeScan(interp, &yy) != TCL_OK) { + Tcl_Obj *msg = Tcl_NewObj(); + Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"", + yy.dateInput, "\":", + TclGetString(Tcl_GetObjResult(interp))); + Tcl_SetObjResult(interp, msg); + goto done; + } + + /* + * If the caller supplied a date in the string, update the date with + * the value. If the caller didn't specify a time with the date, default to + * midnight. + */ + + if (yy.dateHaveDate) { + if (yy.dateYear < 100) { + yy.dateYear += ClockCurrentYearCentury(clientData, interp); + if (yy.dateYear > ClockGetYearOfCenturySwitch(clientData, interp)) { + yy.dateYear -= 100; + } + } + date.era = CE; + date.year = yy.dateYear; + date.month = yy.dateMonth; + date.dayOfMonth = yy.dateDay; + if (yy.dateHaveTime == 0) { + yy.dateHaveTime = -1; + } + } + + /* + * If the caller supplied a time zone in the string, make it into a time + * zone indicator of +-hhmm and setup this time zone. + */ + + if (yy.dateHaveZone) { + int minEast = -yy.dateTimezone; + int dstFlag = 1 - yy.dateDSTmode; + timezoneObj = ClockFormatNumericTimeZone( + 60 * minEast + 3600 * dstFlag); + Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + goto done; + } + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + goto done; + } + } + + SetDateFieldsTimeZone(&date, timezoneObj); + + /* Assemble date, time, zone into seconds-from-epoch */ + + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + + if (yy.dateHaveTime == -1) { + secondOfDay = 0; + } + else + if (yy.dateHaveTime) { + secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, + yy.dateSeconds, yy.dateMeridian); + } + else + if ( (yy.dateHaveDay && !yy.dateHaveDate) + || yy.dateHaveOrdinalMonth + || ( yy.dateHaveRel + && ( yy.dateRelMonth != 0 + || yy.dateRelDay != 0 ) ) + ) { + secondOfDay = 0; + } + + date.localSeconds = + -210866803200L + + ( 86400 * (Tcl_WideInt)date.julianDay ) + + secondOfDay; + + SetDateFieldsTimeZone(&date, timezoneObj); + if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + + seconds = date.seconds; + + /* + * Do relative times + */ + + if (yy.dateHaveRel) { + + /* [SB] TODO: rewrite it in C: * / + seconds = [add $seconds \ + yy.dateRelMonth months yy.dateRelDay days yy.dateRelMonthSecond seconds \ + -timezone $timezone -locale $locale] + */ + } + + /* + * Do relative weekday + */ + + if (yy.dateHaveDay && !yy.dateHaveDate) { + TclDateFields date2; + date2.tzName = NULL; + + SetDateFieldsTimeZone(&date2, timezoneObj); + + date2.seconds = date.seconds; + if (ClockGetDateFields(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + SetDateFieldsTimeZone(&date2, NULL); + goto done; + } + date2.era = CE; + date2.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date2.julianDay + 6) + + 7 * yy.dateDayOrdinal; + if (yy.dateDayOrdinal > 0) { + date2.julianDay -= 7; + } + secondOfDay = date2.localSeconds % 86400; + date2.localSeconds = + -210866803200 + + ( 86400 * (Tcl_WideInt)date2.julianDay ) + + secondOfDay; + + SetDateFieldsTimeZone(&date2, timezoneObj); + if (ConvertLocalToUTC(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + SetDateFieldsTimeZone(&date2, NULL); + goto done; + } + SetDateFieldsTimeZone(&date2, NULL); + + seconds = date2.seconds; + } + + /* + * Do relative month + */ + + if (yy.dateHaveOrdinalMonth) { + int monthDiff; + if (yy.dateMonthOrdinal > 0) { + monthDiff = yy.dateMonth - date.month; + if (monthDiff <= 0) { + monthDiff += 12; + } + yy.dateMonthOrdinal--; + } else { + monthDiff = date.month - yy.dateMonth; + if (monthDiff >= 0) { + monthDiff -= 12; + } + yy.dateMonthOrdinal++; + } + /* [SB] TODO: rewrite it in C: * / + seconds = [add $seconds $yy.dateMonthOrdinal years $monthDiff months \ + -timezone $timezone -locale $locale] + */ + } + + ret = TCL_OK; + +done: + + if (date.tzName != NULL) { + Tcl_DecrRefCount(date.tzName); + } + Tcl_DecrRefCount(cleanUpList); + + if (ret != TCL_OK) { + return ret; + } + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(seconds)); return TCL_OK; } diff --git a/generic/tclDate.c b/generic/tclDate.c index e4dd000..a31e0fc 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -1,24 +1,22 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +27,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,65 +53,24 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse TclDateparse -#define yylex TclDatelex -#define yyerror TclDateerror -#define yylval TclDatelval -#define yychar TclDatechar -#define yydebug TclDatedebug -#define yynerrs TclDatenerrs -#define yylloc TclDatelloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - tAGO = 258, - tDAY = 259, - tDAYZONE = 260, - tID = 261, - tMERIDIAN = 262, - tMONTH = 263, - tMONTH_UNIT = 264, - tSTARDATE = 265, - tSEC_UNIT = 266, - tSNUMBER = 267, - tUNUMBER = 268, - tZONE = 269, - tEPOCH = 270, - tDST = 271, - tISOBASE = 272, - tDAY_UNIT = 273, - tNEXT = 274 - }; -#endif -/* Tokens. */ -#define tAGO 258 -#define tDAY 259 -#define tDAYZONE 260 -#define tID 261 -#define tMERIDIAN 262 -#define tMONTH 263 -#define tMONTH_UNIT 264 -#define tSTARDATE 265 -#define tSEC_UNIT 266 -#define tSNUMBER 267 -#define tUNUMBER 268 -#define tZONE 269 -#define tEPOCH 270 -#define tDST 271 -#define tISOBASE 272 -#define tDAY_UNIT 273 -#define tNEXT 274 - - - +#define yyparse TclDateparse +#define yylex TclDatelex +#define yyerror TclDateerror +#define yylval TclDatelval +#define yychar TclDatechar +#define yydebug TclDatedebug +#define yynerrs TclDatenerrs +#define yylloc TclDatelloc /* Copy the first part of user declarations. */ @@ -129,6 +86,7 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * */ #include "tclInt.h" @@ -146,44 +104,7 @@ * parsed fields will be returned. */ -typedef struct DateInfo { - - Tcl_Obj* messages; /* Error messages */ - const char* separatrix; /* String separating messages */ - - time_t dateYear; - time_t dateMonth; - time_t dateDay; - int dateHaveDate; - - time_t dateHour; - time_t dateMinutes; - time_t dateSeconds; - int dateMeridian; - int dateHaveTime; - - time_t dateTimezone; - int dateDSTmode; - int dateHaveZone; - - time_t dateRelMonth; - time_t dateRelDay; - time_t dateRelSeconds; - int dateHaveRel; - - time_t dateMonthOrdinal; - int dateHaveOrdinalMonth; - - time_t dateDayOrdinal; - time_t dateDayNumber; - int dateHaveDay; - - const char *dateStart; - const char *dateInput; - time_t *dateRelPointer; - - int dateDigitCount; -} DateInfo; +#include "tclDate.h" #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) @@ -246,13 +167,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; @@ -274,19 +188,49 @@ typedef enum _MERIDIAN { # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tAGO = 258, + tDAY = 259, + tDAYZONE = 260, + tID = 261, + tMERIDIAN = 262, + tMONTH = 263, + tMONTH_UNIT = 264, + tSTARDATE = 265, + tSEC_UNIT = 266, + tSNUMBER = 267, + tUNUMBER = 268, + tZONE = 269, + tEPOCH = 270, + tDST = 271, + tISOBASE = 272, + tDAY_UNIT = 273, + tNEXT = 274 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE - { + + time_t Number; enum _MERIDIAN Meridian; -} -/* Line 187 of yacc.c. */ - YYSTYPE; + + +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -316,14 +260,10 @@ static int LookupWord(YYSTYPE* yylvalPtr, char *buff); DateInfo* info, const char *s); static int TclDatelex(YYSTYPE* yylvalPtr, YYLTYPE* location, DateInfo* info); -static time_t ToSeconds(time_t Hours, time_t Minutes, - time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int yyparse(DateInfo*); -/* Line 216 of yacc.c. */ - #ifdef short # undef short @@ -359,15 +299,21 @@ typedef short int yytype_int16; #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ -# else +# elif defined size_t # define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -392,14 +338,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -481,9 +427,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -518,12 +464,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -624,12 +570,12 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 225, 225, 226, 229, 232, 235, 238, 241, 244, - 247, 251, 256, 259, 265, 271, 279, 285, 296, 300, - 304, 310, 314, 318, 322, 326, 332, 336, 341, 346, - 351, 356, 360, 365, 369, 374, 381, 385, 391, 400, - 409, 419, 433, 438, 441, 444, 447, 450, 453, 458, - 461, 466, 470, 474, 480, 498, 501 + 0, 176, 176, 177, 180, 183, 186, 189, 192, 195, + 198, 202, 207, 210, 216, 222, 230, 236, 247, 251, + 255, 261, 265, 269, 273, 277, 283, 287, 292, 297, + 302, 307, 311, 316, 320, 325, 332, 336, 342, 351, + 360, 370, 384, 389, 392, 395, 398, 401, 404, 409, + 412, 417, 421, 425, 431, 449, 452 }; #endif @@ -783,9 +729,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -842,7 +797,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -961,17 +916,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, info) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1007,11 +965,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, info) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , info); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1295,10 +1253,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, info) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1317,10 +1273,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1344,88 +1299,97 @@ yyparse (info) #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL + +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -1464,6 +1428,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1485,9 +1450,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1508,6 +1473,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1516,16 +1484,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1557,20 +1525,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2062,7 +2026,6 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ default: break; } @@ -2139,7 +2102,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -2156,7 +2119,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2214,14 +2177,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -2246,7 +2206,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2257,7 +2217,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, info); /* Do not reclaim the symbols of the rule which action triggered @@ -2513,7 +2473,7 @@ TclDateerror( infoPtr->separatrix = "\n"; } -static time_t +time_t ToSeconds( time_t Hours, time_t Minutes, @@ -2680,7 +2640,7 @@ TclDatelex( location->first_column = yyInput - info->dateStart; for ( ; ; ) { - while (TclIsSpaceProc(*yyInput)) { + while (isspace(UCHAR(*yyInput))) { yyInput++; } @@ -2740,36 +2700,20 @@ TclDatelex( } while (Count > 0); } } - + int -TclClockOldscanObjCmd( - ClientData clientData, /* Unused */ +TclClockFreeScan( Tcl_Interp *interp, /* Tcl interpreter */ - int objc, /* Count of paraneters */ - Tcl_Obj *const *objv) /* Parameters */ + DateInfo *info) /* Input and result parameters */ { - Tcl_Obj *result, *resultElement; - int yr, mo, da; - DateInfo dateInfo; - DateInfo* info = &dateInfo; int status; - if (objc != 5) { - Tcl_WrongNumArgs(interp, 1, objv, - "stringToParse baseYear baseMonth baseDay" ); - return TCL_ERROR; - } - - yyInput = Tcl_GetString( objv[1] ); - dateInfo.dateStart = yyInput; + /* + * yyInput = stringToParse; + * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + */ yyHaveDate = 0; - if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { - return TCL_ERROR; - } - yyYear = yr; yyMonth = mo; yyDay = da; yyHaveTime = 0; yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; @@ -2786,19 +2730,20 @@ TclClockOldscanObjCmd( yyHaveRel = 0; yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; - dateInfo.messages = Tcl_NewObj(); - dateInfo.separatrix = ""; - Tcl_IncrRefCount(dateInfo.messages); + info->messages = Tcl_NewObj(); + info->separatrix = ""; + Tcl_IncrRefCount(info->messages); - status = yyparse(&dateInfo); + info->dateStart = yyInput; + status = yyparse(info); if (status == 1) { - Tcl_SetObjResult(interp, dateInfo.messages); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_SetObjResult(interp, info->messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL); return TCL_ERROR; } else if (status == 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("memory exhausted", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); return TCL_ERROR; } else if (status != 0) { @@ -2806,11 +2751,11 @@ TclClockOldscanObjCmd( "from date parser. Please " "report this error as a " "bug in Tcl.", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "BUG", NULL); return TCL_ERROR; } - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); if (yyHaveDate > 1) { Tcl_SetObjResult(interp, @@ -2843,6 +2788,40 @@ TclClockOldscanObjCmd( return TCL_ERROR; } + return TCL_OK; +} + +int +TclClockOldscanObjCmd( + ClientData clientData, /* Unused */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Count of paraneters */ + Tcl_Obj *const *objv) /* Parameters */ +{ + Tcl_Obj *result, *resultElement; + int yr, mo, da; + DateInfo dateInfo; + DateInfo* info = &dateInfo; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 1, objv, + "stringToParse baseYear baseMonth baseDay" ); + return TCL_ERROR; + } + + yyInput = Tcl_GetString( objv[1] ); + + if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { + return TCL_ERROR; + } + yyYear = yr; yyMonth = mo; yyDay = da; + + if (TclClockFreeScan(interp, info) != TCL_OK) { + return TCL_ERROR; + } + result = Tcl_NewObj(); resultElement = Tcl_NewObj(); if (yyHaveDate) { diff --git a/generic/tclDate.h b/generic/tclDate.h new file mode 100644 index 0000000..91e677f --- /dev/null +++ b/generic/tclDate.h @@ -0,0 +1,77 @@ +/* + * tclDate.h -- + * + * This header file handles common usage of clock primitives + * between tclDate.c (yacc) and tclClock.c. + * + * Copyright (c) 2014 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLCLOCK_H +#define _TCLCLOCK_H + +/* + * Structure contains return parsed fields. + */ + +typedef struct DateInfo { + + Tcl_Obj* messages; /* Error messages */ + const char* separatrix; /* String separating messages */ + + time_t dateYear; + time_t dateMonth; + time_t dateDay; + int dateHaveDate; + + time_t dateHour; + time_t dateMinutes; + time_t dateSeconds; + int dateMeridian; + int dateHaveTime; + + time_t dateTimezone; + int dateDSTmode; + int dateHaveZone; + + time_t dateRelMonth; + time_t dateRelDay; + time_t dateRelSeconds; + int dateHaveRel; + + time_t dateMonthOrdinal; + int dateHaveOrdinalMonth; + + time_t dateDayOrdinal; + time_t dateDayNumber; + int dateHaveDay; + + const char *dateStart; + const char *dateInput; + time_t *dateRelPointer; + + int dateDigitCount; +} DateInfo; + + +/* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, + time_t Seconds, MERIDIAN Meridian); + +MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); + +#endif /* _TCLCLOCK_H */ diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index da4c3fd..ac781ad 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -50,44 +50,7 @@ * parsed fields will be returned. */ -typedef struct DateInfo { - - Tcl_Obj* messages; /* Error messages */ - const char* separatrix; /* String separating messages */ - - time_t dateYear; - time_t dateMonth; - time_t dateDay; - int dateHaveDate; - - time_t dateHour; - time_t dateMinutes; - time_t dateSeconds; - int dateMeridian; - int dateHaveTime; - - time_t dateTimezone; - int dateDSTmode; - int dateHaveZone; - - time_t dateRelMonth; - time_t dateRelDay; - time_t dateRelSeconds; - int dateHaveRel; - - time_t dateMonthOrdinal; - int dateHaveOrdinalMonth; - - time_t dateDayOrdinal; - time_t dateDayNumber; - int dateHaveDay; - - const char *dateStart; - const char *dateInput; - time_t *dateRelPointer; - - int dateDigitCount; -} DateInfo; +#include "tclDate.h" #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) @@ -150,14 +113,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; - %} %union { @@ -176,8 +131,6 @@ static int LookupWord(YYSTYPE* yylvalPtr, char *buff); DateInfo* info, const char *s); static int TclDatelex(YYSTYPE* yylvalPtr, YYLTYPE* location, DateInfo* info); -static time_t ToSeconds(time_t Hours, time_t Minutes, - time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int yyparse(DateInfo*); %} @@ -730,7 +683,7 @@ TclDateerror( infoPtr->separatrix = "\n"; } -static time_t +time_t ToSeconds( time_t Hours, time_t Minutes, @@ -957,36 +910,20 @@ TclDatelex( } while (Count > 0); } } - + int -TclClockOldscanObjCmd( - ClientData clientData, /* Unused */ +TclClockFreeScan( Tcl_Interp *interp, /* Tcl interpreter */ - int objc, /* Count of paraneters */ - Tcl_Obj *const *objv) /* Parameters */ + DateInfo *info) /* Input and result parameters */ { - Tcl_Obj *result, *resultElement; - int yr, mo, da; - DateInfo dateInfo; - DateInfo* info = &dateInfo; int status; - if (objc != 5) { - Tcl_WrongNumArgs(interp, 1, objv, - "stringToParse baseYear baseMonth baseDay" ); - return TCL_ERROR; - } - - yyInput = Tcl_GetString( objv[1] ); - dateInfo.dateStart = yyInput; + /* + * yyInput = stringToParse; + * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + */ yyHaveDate = 0; - if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { - return TCL_ERROR; - } - yyYear = yr; yyMonth = mo; yyDay = da; yyHaveTime = 0; yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; @@ -1003,19 +940,20 @@ TclClockOldscanObjCmd( yyHaveRel = 0; yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; - dateInfo.messages = Tcl_NewObj(); - dateInfo.separatrix = ""; - Tcl_IncrRefCount(dateInfo.messages); + info->messages = Tcl_NewObj(); + info->separatrix = ""; + Tcl_IncrRefCount(info->messages); - status = yyparse(&dateInfo); + info->dateStart = yyInput; + status = yyparse(info); if (status == 1) { - Tcl_SetObjResult(interp, dateInfo.messages); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_SetObjResult(interp, info->messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL); return TCL_ERROR; } else if (status == 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("memory exhausted", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); return TCL_ERROR; } else if (status != 0) { @@ -1023,11 +961,11 @@ TclClockOldscanObjCmd( "from date parser. Please " "report this error as a " "bug in Tcl.", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "BUG", NULL); return TCL_ERROR; } - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); if (yyHaveDate > 1) { Tcl_SetObjResult(interp, @@ -1060,6 +998,40 @@ TclClockOldscanObjCmd( return TCL_ERROR; } + return TCL_OK; +} + +int +TclClockOldscanObjCmd( + ClientData clientData, /* Unused */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Count of paraneters */ + Tcl_Obj *const *objv) /* Parameters */ +{ + Tcl_Obj *result, *resultElement; + int yr, mo, da; + DateInfo dateInfo; + DateInfo* info = &dateInfo; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 1, objv, + "stringToParse baseYear baseMonth baseDay" ); + return TCL_ERROR; + } + + yyInput = Tcl_GetString( objv[1] ); + + if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { + return TCL_ERROR; + } + yyYear = yr; yyMonth = mo; yyDay = da; + + if (TclClockFreeScan(interp, info) != TCL_OK) { + return TCL_ERROR; + } + result = Tcl_NewObj(); resultElement = Tcl_NewObj(); if (yyHaveDate) { diff --git a/library/clock.tcl b/library/clock.tcl index 5b48eb3..9c3f95c 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -287,6 +287,10 @@ proc ::tcl::clock::Initialize {} { variable FEB_28 58 + # Current year century and year of century switch + variable CurrentYearCentury 2000 + variable YearOfCenturySwitch 37 + # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise # to specify $::env(TCL_TZ) rather than simply depending on the system @@ -1295,7 +1299,7 @@ proc ::tcl::clock::__org_scan { args } { # #---------------------------------------------------------------------- -proc ::tcl::clock::FreeScan { string base timezone locale } { +proc ::tcl::clock::__org_FreeScan { string base timezone locale } { variable TZData @@ -1341,7 +1345,8 @@ proc ::tcl::clock::FreeScan { string base timezone locale } { if { [llength $parseDate] > 0 } { lassign $parseDate y m d if { $y < 100 } { - if { $y >= 39 } { + variable YearOfCenturySwitch + if { $y > $YearOfCenturySwitch } { incr y 1900 } else { incr y 2000 @@ -2719,12 +2724,14 @@ proc ::tcl::clock::ScanWide { str } { proc ::tcl::clock::InterpretTwoDigitYear { date baseTime { twoDigitField yearOfCentury } { fourDigitField year } } { + variable CurrentYearCentury + variable YearOfCenturySwitch set yr [dict get $date $twoDigitField] - if { $yr <= 37 } { - dict set date $fourDigitField [expr { $yr + 2000 }] - } else { - dict set date $fourDigitField [expr { $yr + 1900 }] + incr yr $CurrentYearCentury + if { $yr <= $YearOfCenturySwitch } { + incr yr -100 } + dict set date $fourDigitField $yr return $date } diff --git a/library/init.tcl b/library/init.tcl index e6df12b..4bbce51 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format FreeScan} { + foreach cmd {add format} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/win/makefile.vc b/win/makefile.vc index d6de5e1..26ee669 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -482,7 +482,9 @@ cdebug = $(cdebug) -Zi ### Warnings are too many, can't support warnings into errors. cdebug = -Zi -Od $(DEBUGFLAGS) !else -cdebug = -Zi -WX $(DEBUGFLAGS) +# no -WX option here (error C2220: warning treated as error): +#cdebug = -Zi -WX $(DEBUGFLAGS) +cdebug = -Zi $(DEBUGFLAGS) !endif ### Declarations common to all compiler options -- cgit v0.12 From 736824a25976c9bdf14978f1592078171cb6dd5b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 21:59:59 +0000 Subject: [temp-commit]: ClockFreeScan almost ready, test-performance cases merged --- generic/tclClock.c | 370 +++++++++++++++++++++++++++++++++++++++------- library/clock.tcl | 75 +++++----- library/init.tcl | 2 +- tests-perf/clock.perf.tcl | 59 ++++++++ 4 files changed, 415 insertions(+), 91 deletions(-) create mode 100644 tests-perf/clock.perf.tcl diff --git a/generic/tclClock.c b/generic/tclClock.c index 24ed095..6d619e0 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -81,7 +81,7 @@ typedef enum ClockLiteral { #endif LIT__END } ClockLiteral; -static const char *const literals[] = { +static const char *const Literals[] = { "", "%a %b %d %H:%M:%S %Z %Y", "BCE", "C", @@ -114,6 +114,14 @@ static const char *const literals[] = { typedef struct ClockClientData { size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals. */ + /* Cache for current clock parameters, imparted via "configure" */ + unsigned int LastTZEpoch; + Tcl_Obj *LastSystemTimeZone; + Tcl_Obj *SystemSetupTZData; + Tcl_Obj *GMTSetupTimeZone; + Tcl_Obj *GMTSetupTZData; + Tcl_Obj *LastSetupTimeZone; + Tcl_Obj *LastSetupTZData; } ClockClientData; /* @@ -171,6 +179,8 @@ static int ConvertLocalToUTCUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertLocalToUTCUsingC(Tcl_Interp *, TclDateFields *, int); +static int ClockConfigureObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static Tcl_Obj * LookupLastTransition(Tcl_Interp *, Tcl_WideInt, int, Tcl_Obj *const *); static void GetYearWeekDay(TclDateFields *, int); @@ -222,6 +232,7 @@ static int ClockFreeScan( Tcl_Obj *strObj, Tcl_WideInt baseVal, Tcl_Obj *timezoneObj, Tcl_Obj *locale); static struct tm * ThreadSafeLocalTime(const time_t *); +static unsigned int TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); @@ -245,6 +256,7 @@ static const struct ClockCommand clockCommands[] = { { "milliseconds", ClockMillisecondsObjCmd }, { "seconds", ClockSecondsObjCmd }, { "scan", ClockScanObjCmd }, + { "configure", ClockConfigureObjCmd }, { "Oldscan", TclClockOldscanObjCmd }, { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, { "GetDateFields", ClockGetdatefieldsObjCmd }, @@ -302,9 +314,16 @@ TclClockInit( data->refCount = 0; data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < LIT__END; ++i) { - data->literals[i] = Tcl_NewStringObj(literals[i], -1); + data->literals[i] = Tcl_NewStringObj(Literals[i], -1); Tcl_IncrRefCount(data->literals[i]); } + data->LastTZEpoch = 0; + data->LastSystemTimeZone = NULL; + data->SystemSetupTZData = NULL; + data->GMTSetupTimeZone = NULL; + data->GMTSetupTZData = NULL; + data->LastSetupTimeZone = NULL; + data->LastSetupTZData = NULL; /* * Install the commands. @@ -322,6 +341,191 @@ TclClockInit( /* *---------------------------------------------------------------------- + * + * ClockDeleteCmdProc -- + * + * Remove a reference to the clock client data, and clean up memory + * when it's all gone. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ClockDeleteCmdProc( + ClientData clientData) /* Opaque pointer to the client data */ +{ + ClockClientData *data = clientData; + int i; + + if (data->refCount-- <= 1) { + for (i = 0; i < LIT__END; ++i) { + Tcl_DecrRefCount(data->literals[i]); + } + + if (data->LastSystemTimeZone) { + Tcl_DecrRefCount(data->LastSystemTimeZone); + } + if (data->GMTSetupTimeZone) { + Tcl_DecrRefCount(data->GMTSetupTimeZone); + } + if (data->LastSetupTimeZone) { + Tcl_DecrRefCount(data->LastSetupTimeZone); + } + + ckfree(data->literals); + ckfree(data); + } +} + +/* + *---------------------------------------------------------------------- + */ +inline Tcl_Obj * +NormTimezoneObj( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Obj * timezoneObj) +{ + const char * tz; + if ( timezoneObj == dataPtr->literals[LIT_GMT] + || timezoneObj == dataPtr->LastSystemTimeZone + || timezoneObj == dataPtr->LastSetupTimeZone + ) { + return timezoneObj; + } + + tz = TclGetString(timezoneObj); + if ( + strcmp(tz, Literals[LIT_GMT]) == 0 + ) { + timezoneObj = dataPtr->literals[LIT_GMT]; + } + else + if (dataPtr->LastSystemTimeZone != NULL && + (timezoneObj == dataPtr->LastSystemTimeZone + || strcmp(tz, TclGetString(dataPtr->LastSystemTimeZone)) == 0 + ) + ) { + timezoneObj = dataPtr->LastSystemTimeZone; + } + else + if (dataPtr->LastSetupTimeZone != NULL && + (timezoneObj == dataPtr->LastSetupTimeZone + || strcmp(tz, TclGetString(dataPtr->LastSetupTimeZone)) == 0 + ) + ) { + timezoneObj = dataPtr->LastSetupTimeZone; + } + return timezoneObj; +} + +/* + *---------------------------------------------------------------------- + */ +static int +ClockConfigureObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter vector */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **litPtr = dataPtr->literals; + + static const char *const options[] = { + "-system-tz", "-setup-tz", "-clear", + NULL + }; + enum optionInd { + CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CLEAR_CACHE, + CLOCK_SETUP_GMT, CLOCK_SETUP_NOP + }; + int optionIndex; /* Index of an option. */ + int i; + + for (i = 1; i < objc; i+=2) { + if (Tcl_GetIndexFromObj(interp, objv[i], options, + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[i]), NULL); + return TCL_ERROR; + } + if (optionIndex == CLOCK_SYSTEM_TZ || optionIndex == CLOCK_CLEAR_CACHE) { + if (dataPtr->LastSystemTimeZone) { + Tcl_DecrRefCount(dataPtr->LastSystemTimeZone); + dataPtr->LastSystemTimeZone = NULL; + dataPtr->SystemSetupTZData = NULL; + } + if (optionIndex != CLOCK_CLEAR_CACHE) { + /* validate current tz-epoch */ + unsigned int lastTZEpoch = TzsetGetEpoch(); + if (i+1 < objc) { + Tcl_IncrRefCount( + dataPtr->LastSystemTimeZone = objv[i+1]); + dataPtr->LastTZEpoch = lastTZEpoch; + } else if (dataPtr->LastSystemTimeZone + && dataPtr->LastTZEpoch == lastTZEpoch) { + Tcl_SetObjResult(interp, dataPtr->LastSystemTimeZone); + } + } + } + if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { + Tcl_Obj *timezoneObj = NULL; + /* differentiate GMT and system zones, because used often */ + if (i+1 < objc) { + timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); + if (optionIndex == CLOCK_SETUP_TZ) { + if (timezoneObj == litPtr[LIT_GMT]) { + optionIndex = CLOCK_SETUP_GMT; + } else if (timezoneObj == dataPtr->LastSystemTimeZone) { + optionIndex = CLOCK_SETUP_NOP; + } + } + } + + if (optionIndex == CLOCK_SETUP_GMT || optionIndex == CLOCK_CLEAR_CACHE) { + if (dataPtr->GMTSetupTimeZone) { + Tcl_DecrRefCount(dataPtr->GMTSetupTimeZone); + dataPtr->GMTSetupTimeZone = NULL; + dataPtr->GMTSetupTZData = NULL; + } + if (optionIndex != CLOCK_CLEAR_CACHE) { + if (i+1 < objc) { + Tcl_IncrRefCount( + dataPtr->GMTSetupTimeZone = timezoneObj); + } else if (dataPtr->GMTSetupTimeZone) { + Tcl_SetObjResult(interp, dataPtr->GMTSetupTimeZone); + } + } + } + if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { + if (dataPtr->LastSetupTimeZone) { + Tcl_DecrRefCount(dataPtr->LastSetupTimeZone); + dataPtr->LastSetupTimeZone = NULL; + dataPtr->LastSetupTZData = NULL; + } + if (optionIndex != CLOCK_CLEAR_CACHE) { + if (i+1 < objc) { + Tcl_IncrRefCount( + dataPtr->LastSetupTimeZone = timezoneObj); + } else if (dataPtr->LastSetupTimeZone) { + Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); + } + } + } + } + if (optionIndex == CLOCK_CLEAR_CACHE) { + dataPtr->LastTZEpoch = 0; + } + } + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- */ inline Tcl_Obj* ClockGetTZData( @@ -331,9 +535,38 @@ ClockGetTZData( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj *ret, **out = NULL; + + /* differentiate GMT and system zones, because used often */ + /* simple caching, because almost used the tz-data of last timezone, (unnecessary to + * touch the refCount of it, because it is always referenced in TZData array) + */ + if (timezoneObj == dataPtr->LastSystemTimeZone) { + if (dataPtr->SystemSetupTZData != NULL) + return dataPtr->SystemSetupTZData; + out = &dataPtr->SystemSetupTZData; + } + else + if (timezoneObj == dataPtr->GMTSetupTimeZone) { + if (dataPtr->GMTSetupTZData != NULL) + return dataPtr->GMTSetupTZData; + out = &dataPtr->GMTSetupTZData; + } + else + if (timezoneObj == dataPtr->LastSetupTimeZone) { + if (dataPtr->LastSetupTZData != NULL) { + return dataPtr->LastSetupTZData; + } + out = &dataPtr->LastSetupTZData; + } - return Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], + ret = Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], timezoneObj, TCL_LEAVE_ERR_MSG); + + /* cache using corresponding slot */ + if (ret != NULL && out != NULL) + *out = ret; + return ret; } /* *---------------------------------------------------------------------- @@ -344,7 +577,15 @@ ClockGetSystemTimeZone( Tcl_Interp *interp) /* Tcl interpreter */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj **literals; + + /* if known (cached and same epoch) - return now */ + if (dataPtr->LastSystemTimeZone != NULL + && dataPtr->LastTZEpoch == TzsetGetEpoch()) { + return dataPtr->LastSystemTimeZone; + } + + literals = dataPtr->literals; if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMTIMEZONE], 0) != TCL_OK) { return NULL; @@ -354,7 +595,7 @@ ClockGetSystemTimeZone( /* *---------------------------------------------------------------------- */ -static int +static Tcl_Obj * ClockSetupTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp, /* Tcl interpreter */ @@ -364,9 +605,22 @@ ClockSetupTimeZone( Tcl_Obj **literals = dataPtr->literals; Tcl_Obj *callargs[2]; + /* differentiate GMT and system zones, because used often and already set */ + timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); + if ( timezoneObj == dataPtr->GMTSetupTimeZone + || timezoneObj == dataPtr->LastSystemTimeZone + || timezoneObj == dataPtr->LastSetupTimeZone + ) { + return timezoneObj; + } + callargs[0] = literals[LIT_SETUPTIMEZONE]; callargs[1] = timezoneObj; - return Tcl_EvalObjv(interp, 2, callargs, 0); + + if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { + return NormTimezoneObj(dataPtr, timezoneObj); + } + return NULL; } /* *---------------------------------------------------------------------- @@ -1752,12 +2006,10 @@ static int IsGregorianLeapYear( TclDateFields *fields) /* Date to test */ { - int year; + int year = fields->year; if (fields->era == BCE) { - year = 1 - fields->year; - } else { - year = fields->year; + year = 1 - year; } if (year%4 != 0) { return 0; @@ -2313,13 +2565,15 @@ ClockFreeScan( DateInfo yy; /* parse structure of TclClockFreeScan */ TclDateFields date; /* date fields used for converting from seconds */ + TclDateFields date2; /* date fields used for in-between calculation */ Tcl_Obj *tzdata; int secondOfDay; /* Seconds of day (time only calculation) */ Tcl_WideInt seconds; int ret = TCL_ERROR; - Tcl_Obj *cleanUpList = Tcl_NewObj(); + // Tcl_Obj *cleanUpList = Tcl_NewObj(); date.tzName = NULL; + date2.tzName = NULL; /* If time zone not specified use system time zone */ if (timezoneObj == NULL || @@ -2328,12 +2582,13 @@ ClockFreeScan( if (timezoneObj == NULL) { goto done; } - Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); } /* Get the data for time changes in the given zone */ - if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); + if (timezoneObj == NULL) { goto done; } @@ -2366,9 +2621,8 @@ ClockFreeScan( if (TclClockFreeScan(interp, &yy) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); - Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"", - yy.dateInput, "\":", - TclGetString(Tcl_GetObjResult(interp))); + Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", + Tcl_GetString(strObj), TclGetString(Tcl_GetObjResult(interp))); Tcl_SetObjResult(interp, msg); goto done; } @@ -2405,8 +2659,9 @@ ClockFreeScan( int dstFlag = 1 - yy.dateDSTmode; timezoneObj = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); - if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); + if (timezoneObj == NULL) { goto done; } tzdata = ClockGetTZData(clientData, interp, timezoneObj); @@ -2458,7 +2713,7 @@ ClockFreeScan( if (yy.dateHaveRel) { - /* [SB] TODO: rewrite it in C: * / + /* seconds = [add $seconds \ yy.dateRelMonth months yy.dateRelDay days yy.dateRelMonthSecond seconds \ -timezone $timezone -locale $locale] @@ -2470,17 +2725,21 @@ ClockFreeScan( */ if (yy.dateHaveDay && !yy.dateHaveDate) { - TclDateFields date2; - date2.tzName = NULL; + memcpy(&date2, &date, sizeof(date)); + if (date2.tzName != NULL) { + Tcl_IncrRefCount(date2.tzName); + } + /* SetDateFieldsTimeZone(&date2, timezoneObj); date2.seconds = date.seconds; if (ClockGetDateFields(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) != TCL_OK) { - SetDateFieldsTimeZone(&date2, NULL); goto done; } + */ + date2.era = CE; date2.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date2.julianDay + 6) + 7 * yy.dateDayOrdinal; @@ -2493,13 +2752,12 @@ ClockFreeScan( + ( 86400 * (Tcl_WideInt)date2.julianDay ) + secondOfDay; - SetDateFieldsTimeZone(&date2, timezoneObj); + // check set time zone again may be really necessary here: + // SetDateFieldsTimeZone(&date2, timezoneObj); if (ConvertLocalToUTC(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) != TCL_OK) { - SetDateFieldsTimeZone(&date2, NULL); goto done; } - SetDateFieldsTimeZone(&date2, NULL); seconds = date2.seconds; } @@ -2536,7 +2794,10 @@ done: if (date.tzName != NULL) { Tcl_DecrRefCount(date.tzName); } - Tcl_DecrRefCount(cleanUpList); + if (date2.tzName != NULL) { + Tcl_DecrRefCount(date2.tzName); + } + // Tcl_DecrRefCount(cleanUpList); if (ret != TCL_OK) { return ret; @@ -2599,15 +2860,30 @@ ClockSecondsObjCmd( *---------------------------------------------------------------------- */ -static void -TzsetIfNecessary(void) +static unsigned int +TzsetGetEpoch(void) { static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by - * clockMutex. */ - const char *tzIsNow; /* Current value of TZ */ + * clockMutex. */ + static long tzNextRefresh = 0; /* Latence before next refresh */ + static unsigned int tzWasEpoch = 1; /* Epoch, signals that TZ changed */ + + const char *tzIsNow; /* Current value of TZ */ + + /* fast check whether environment was changed (once per second) */ + Tcl_Time now; + Tcl_GetTime(&now); + if (now.sec < tzNextRefresh) { + return tzWasEpoch; + } + tzNextRefresh = now.sec + 1; + /* check in lock */ Tcl_MutexLock(&clockMutex); - tzIsNow = getenv("TZ"); + tzIsNow = getenv("TCL_TZ"); + if (tzIsNow == NULL) { + tzIsNow = getenv("TZ"); + } if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1) || strcmp(tzIsNow, tzWas) != 0)) { tzset(); @@ -2616,42 +2892,22 @@ TzsetIfNecessary(void) } tzWas = ckalloc(strlen(tzIsNow) + 1); strcpy(tzWas, tzIsNow); + tzWasEpoch++; } else if (tzIsNow == NULL && tzWas != NULL) { tzset(); if (tzWas != INT2PTR(-1)) ckfree(tzWas); tzWas = NULL; + tzWasEpoch++; } Tcl_MutexUnlock(&clockMutex); + + return tzWasEpoch; } - -/* - *---------------------------------------------------------------------- - * - * ClockDeleteCmdProc -- - * - * Remove a reference to the clock client data, and clean up memory - * when it's all gone. - * - * Results: - * None. - * - *---------------------------------------------------------------------- - */ static void -ClockDeleteCmdProc( - ClientData clientData) /* Opaque pointer to the client data */ +TzsetIfNecessary(void) { - ClockClientData *data = clientData; - int i; - - if (data->refCount-- <= 1) { - for (i = 0; i < LIT__END; ++i) { - Tcl_DecrRefCount(data->literals[i]); - } - ckfree(data->literals); - ckfree(data); - } + TzsetGetEpoch(); } /* diff --git a/library/clock.tcl b/library/clock.tcl index 9c3f95c..90b3c69 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -633,10 +633,6 @@ proc ::tcl::clock::Initialize {} { # in the given locales and dictionaries # mapping the numerals to their numeric # values. - # variable CachedSystemTimeZone; # If 'CachedSystemTimeZone' exists, - # it contains the value of the - # system time zone, as determined from - # the environment. variable TimeZoneBad {}; # Dictionary whose keys are time zone # names and whose values are 1 if # the time zone is unknown and 0 @@ -2984,13 +2980,12 @@ proc ::tcl::clock::InterpretHMS { date } { # Returns the system time zone. # # Side effects: -# Stores the sustem time zone in the 'CachedSystemTimeZone' -# variable, since determining it may be an expensive process. +# Stores the sustem time zone in engine configuration, since +# determining it may be an expensive process. # #---------------------------------------------------------------------- proc ::tcl::clock::GetSystemTimeZone {} { - variable CachedSystemTimeZone variable TimeZoneBad if {[set result [getenv TCL_TZ]] ne {}} { @@ -2999,29 +2994,33 @@ proc ::tcl::clock::GetSystemTimeZone {} { set timezone $result } if {![info exists timezone]} { - # Cache the time zone only if it was detected by one of the - # expensive methods. - if { [info exists CachedSystemTimeZone] } { - set timezone $CachedSystemTimeZone - } elseif { $::tcl_platform(platform) eq {windows} } { - set timezone [GuessWindowsTimeZone] - } elseif { [file exists /etc/localtime] - && ![catch {ReadZoneinfoFile \ - Tcl/Localtime /etc/localtime}] } { - set timezone :Tcl/Localtime - } else { - set timezone :localtime + # ask engine for the cached timezone: + set timezone [configure -system-tz] + if { $timezone ne "" } { + return $timezone } - set CachedSystemTimeZone $timezone + if { $::tcl_platform(platform) eq {windows} } { + set timezone [GuessWindowsTimeZone] + } elseif { [file exists /etc/localtime] + && ![catch {ReadZoneinfoFile \ + Tcl/Localtime /etc/localtime}] } { + set timezone :Tcl/Localtime + } else { + set timezone :localtime + } } if { ![dict exists $TimeZoneBad $timezone] } { - dict set TimeZoneBad $timezone [catch {SetupTimeZone $timezone}] + catch {SetupTimeZone $timezone} } - if { [dict get $TimeZoneBad $timezone] } { - return :localtime - } else { - return $timezone + + if { [dict exists $TimeZoneBad $timezone] } { + set timezone :localtime } + + # tell backend - current system timezone: + configure -system-tz $timezone + + return $timezone } #---------------------------------------------------------------------- @@ -3077,6 +3076,13 @@ proc ::tcl::clock::SetupTimeZone { timezone } { variable TZData if {! [info exists TZData($timezone)] } { + + variable TimeZoneBad + if { [dict exists $TimeZoneBad $timezone] } { + return -code error \ + -errorcode [list CLOCK badTimeZone $timezone] \ + "time zone \"$timezone\" not found" + } variable MINWIDE if { $timezone eq {:localtime} } { # Nothing to do, we'll convert using the localtime function @@ -3114,6 +3120,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { LoadZoneinfoFile [string range $timezone 1 end] }] } then { + dict set TimeZoneBad $timezone 1 return -code error \ -errorcode [list CLOCK badTimeZone $timezone] \ "time zone \"$timezone\" not found" @@ -3125,6 +3132,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { if { [lindex [dict get $opts -errorcode] 0] eq {CLOCK} } { dict unset opts -errorinfo } + dict set TimeZoneBad $timezone 1 return -options $opts $data } else { set TZData($timezone) $data @@ -3137,13 +3145,15 @@ proc ::tcl::clock::SetupTimeZone { timezone } { if { [catch { LoadTimeZoneFile $timezone }] && [catch { LoadZoneinfoFile $timezone } - opts] } { dict unset opts -errorinfo + dict set TimeZoneBad $timezone 1 return -options $opts "time zone $timezone not found" } set TZData($timezone) $TZData(:$timezone) } } - return + # tell backend - timezone is initialized: + configure -setup-tz $timezone } #---------------------------------------------------------------------- @@ -3214,12 +3224,12 @@ proc ::tcl::clock::GuessWindowsTimeZone {} { if { [dict exists $WinZoneInfo $data] } { set tzname [dict get $WinZoneInfo $data] if { ! [dict exists $TimeZoneBad $tzname] } { - dict set TimeZoneBad $tzname [catch {SetupTimeZone $tzname}] + catch {SetupTimeZone $tzname} } } else { set tzname {} } - if { $tzname eq {} || [dict get $TimeZoneBad $tzname] } { + if { $tzname eq {} || [dict exists $TimeZoneBad $tzname] } { lassign $data \ bias stdBias dstBias \ stdYear stdMonth stdDayOfWeek stdDayOfMonth \ @@ -4556,8 +4566,6 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { proc ::tcl::clock::ChangeCurrentLocale {args} { variable FormatProc variable LocaleNumeralCache - variable CachedSystemTimeZone - variable TimeZoneBad foreach p [info procs [namespace current]::scanproc'*'current] { rename $p {} @@ -4590,9 +4598,11 @@ proc ::tcl::clock::ChangeCurrentLocale {args} { proc ::tcl::clock::ClearCaches {} { variable FormatProc variable LocaleNumeralCache - variable CachedSystemTimeZone variable TimeZoneBad + # tell backend - should invalidate: + configure -clear + foreach p [info procs [namespace current]::scanproc'*] { rename $p {} } @@ -4600,9 +4610,8 @@ proc ::tcl::clock::ClearCaches {} { rename $p {} } - catch {unset FormatProc} + unset -nocomplain FormatProc set LocaleNumeralCache {} - catch {unset CachedSystemTimeZone} set TimeZoneBad {} InitTZData } diff --git a/library/init.tcl b/library/init.tcl index 4bbce51..5e452b0 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format} { + foreach cmd {add format SetupTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl new file mode 100644 index 0000000..2e77a26 --- /dev/null +++ b/tests-perf/clock.perf.tcl @@ -0,0 +1,59 @@ +#!/usr/bin/tclsh +# ------------------------------------------------------------------------ +# +# test-performance.tcl -- +# +# This file provides common performance tests for comparison of tcl-speed +# degradation by switching between branches. +# (currently for clock ensemble only) +# +# ------------------------------------------------------------------------ +# +# Copyright (c) 2014 Serg G. Brester (aka sebres) +# +# See the file "license.terms" for information on usage and redistribution +# of this file. +# + +proc test-scan {{rep 100000}} { + foreach {comment c} { + "# FreeScan : relative date" + {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} + "# FreeScan : time only with base" + {clock scan "19:18:30" -base 148863600 -gmt 1} + "# FreeScan : time only without base" + {clock scan "19:18:30" -gmt 1} + "# FreeScan : date, system time zone" + {clock scan "05/08/2016 20:18:30"} + "# FreeScan : date, supplied time zone" + {clock scan "05/08/2016 20:18:30" -timezone :CET} + "# FreeScan : date, supplied gmt (equivalent -timezone :GMT)" + {clock scan "05/08/2016 20:18:30" -gmt 1} + "# FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500)" + {clock scan "20:18:30 -0500" -base 148863600 -gmt 1} + "# FreeScan : time only, zone in string (exchange zones between system / gmt)" + {clock scan "19:18:30 GMT" -base 148863600} + } { + puts "\n% $comment\n% $c" + puts [clock format [{*}$c]] + puts [time $c $rep] + } +} + +proc test-other {{rep 100000}} { + foreach {comment c} { + "# Bad zone" + {catch {clock scan "1 day" -timezone BAD_ZONE}} + } { + puts "\n% $comment\n% $c" + puts [if 1 $c] + puts [time $c $rep] + } +} + +if 1 {;# + test-scan 100000 + test-other 50000 + + puts \n**OK** +};# \ No newline at end of file -- cgit v0.12 From 18b31092c654c918fdb833a1bc70f6ee61449ff4 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:01:13 +0000 Subject: [temp-commit]: ClockFreeScan seems to be ready, test case should be checked --- generic/tclClock.c | 171 ++++++++++++++++++++++++++++------------------ tests-perf/clock.perf.tcl | 21 +++++- 2 files changed, 124 insertions(+), 68 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 6d619e0..5710d6d 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2560,12 +2560,13 @@ ClockFreeScan( Tcl_Obj *timezoneObj, /* Default time zone in which the time will be expressed */ Tcl_Obj *locale) /* (Unused) Name of the locale where the time will be scanned. */ { + enum Flags {CL_INVALIDATE = (signed int)0x80000000}; + ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; DateInfo yy; /* parse structure of TclClockFreeScan */ TclDateFields date; /* date fields used for converting from seconds */ - TclDateFields date2; /* date fields used for in-between calculation */ Tcl_Obj *tzdata; int secondOfDay; /* Seconds of day (time only calculation) */ Tcl_WideInt seconds; @@ -2573,7 +2574,6 @@ ClockFreeScan( // Tcl_Obj *cleanUpList = Tcl_NewObj(); date.tzName = NULL; - date2.tzName = NULL; /* If time zone not specified use system time zone */ if (timezoneObj == NULL || @@ -2670,11 +2670,14 @@ ClockFreeScan( } } - SetDateFieldsTimeZone(&date, timezoneObj); + /* on demand (lazy) assemble julianDay using new year, month, etc. */ + date.julianDay = CL_INVALIDATE; - /* Assemble date, time, zone into seconds-from-epoch */ + /* + * Assemble date, time, zone into seconds-from-epoch + */ - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + SetDateFieldsTimeZone(&date, timezoneObj); if (yy.dateHaveTime == -1) { secondOfDay = 0; @@ -2694,80 +2697,79 @@ ClockFreeScan( secondOfDay = 0; } - date.localSeconds = - -210866803200L - + ( 86400 * (Tcl_WideInt)date.julianDay ) - + secondOfDay; - - SetDateFieldsTimeZone(&date, timezoneObj); - if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - - seconds = date.seconds; - /* * Do relative times */ +repeat_rel: + if (yy.dateHaveRel) { - /* - seconds = [add $seconds \ - yy.dateRelMonth months yy.dateRelDay days yy.dateRelMonthSecond seconds \ - -timezone $timezone -locale $locale] - */ - } + /* add months (or years in months) */ - /* - * Do relative weekday - */ + if (yy.dateRelMonth != 0) { + int m, h; - if (yy.dateHaveDay && !yy.dateHaveDate) { + /* if needed extract year, month, etc. again */ + if (date.month == CL_INVALIDATE) { + GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); + GetMonthDay(&date); + GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + } - memcpy(&date2, &date, sizeof(date)); - if (date2.tzName != NULL) { - Tcl_IncrRefCount(date2.tzName); - } - /* - SetDateFieldsTimeZone(&date2, timezoneObj); + /* add the requisite number of months */ + date.month += yy.dateRelMonth - 1; + date.year += date.month / 12; + m = date.month % 12; + date.month = m + 1; - date2.seconds = date.seconds; - if (ClockGetDateFields(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - */ + /* if the day doesn't exist in the current month, repair it */ + h = hath[IsGregorianLeapYear(&date)][m]; + if (date.dayOfMonth > h) { + date.dayOfMonth = h; + } - date2.era = CE; - date2.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date2.julianDay + 6) - + 7 * yy.dateDayOrdinal; - if (yy.dateDayOrdinal > 0) { - date2.julianDay -= 7; + /* on demand (lazy) assemble julianDay using new year, month, etc. */ + date.julianDay = CL_INVALIDATE; + + yy.dateRelMonth = 0; } - secondOfDay = date2.localSeconds % 86400; - date2.localSeconds = - -210866803200 - + ( 86400 * (Tcl_WideInt)date2.julianDay ) - + secondOfDay; - - // check set time zone again may be really necessary here: - // SetDateFieldsTimeZone(&date2, timezoneObj); - if (ConvertLocalToUTC(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; + + /* add days (or other parts aligned to days) */ + if (yy.dateRelDay) { + + /* assemble julianDay using new year, month, etc. */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + date.julianDay += yy.dateRelDay; + + /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ + date.month = CL_INVALIDATE; + + yy.dateRelDay = 0; } - seconds = date2.seconds; + /* relative time (seconds) */ + secondOfDay += yy.dateRelSeconds; + yy.dateRelSeconds = 0; + } /* - * Do relative month + * Do relative (ordinal) month */ if (yy.dateHaveOrdinalMonth) { int monthDiff; + + /* if needed extract year, month, etc. again */ + if (date.month == CL_INVALIDATE) { + GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); + GetMonthDay(&date); + GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + } + if (yy.dateMonthOrdinal > 0) { monthDiff = yy.dateMonth - date.month; if (monthDiff <= 0) { @@ -2781,12 +2783,54 @@ ClockFreeScan( } yy.dateMonthOrdinal++; } - /* [SB] TODO: rewrite it in C: * / - seconds = [add $seconds $yy.dateMonthOrdinal years $monthDiff months \ - -timezone $timezone -locale $locale] - */ + + /* process it further via relative times */ + yy.dateHaveRel++; + date.year += yy.dateMonthOrdinal; + yy.dateRelMonth += monthDiff; + yy.dateHaveOrdinalMonth = 0; + + goto repeat_rel; + } + + /* + * Do relative weekday + */ + + if (yy.dateHaveDay && !yy.dateHaveDate) { + + /* if needed assemble julianDay now */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + + date.era = CE; + date.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date.julianDay + 6) + + 7 * yy.dateDayOrdinal; + if (yy.dateDayOrdinal > 0) { + date.julianDay -= 7; + } + } + + /* If needed assemble julianDay using new year, month, etc. */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + + /* Local seconds to UTC */ + + date.localSeconds = + -210866803200L + + ( 86400 * (Tcl_WideInt)date.julianDay ) + + ( secondOfDay % 86400 ); + + if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; } + seconds = date.seconds; + ret = TCL_OK; done: @@ -2794,9 +2838,6 @@ done: if (date.tzName != NULL) { Tcl_DecrRefCount(date.tzName); } - if (date2.tzName != NULL) { - Tcl_DecrRefCount(date2.tzName); - } // Tcl_DecrRefCount(cleanUpList); if (ret != TCL_OK) { diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 2e77a26..52bc91f 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -19,6 +19,18 @@ proc test-scan {{rep 100000}} { foreach {comment c} { "# FreeScan : relative date" {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} + "# FreeScan : relative date with relative weekday" + {clock scan "5 years 18 months 385 days Fri" -base 0 -gmt 1} + "# FreeScan : relative date with ordinal month" + {clock scan "5 years 18 months 385 days next 1 January" -base 0 -gmt 1} + "# FreeScan : relative date with ordinal month and relative weekday" + {clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1} + "# FreeScan : ordinal month" + {clock scan "next January" -base 0 -gmt 1} + "# FreeScan : relative week" + {clock scan "next Fri" -base 0 -gmt 1} + "# FreeScan : relative weekday and week offset " + {clock scan "next January + 2 week" -base 0 -gmt 1} "# FreeScan : time only with base" {clock scan "19:18:30" -base 148863600 -gmt 1} "# FreeScan : time only without base" @@ -34,8 +46,9 @@ proc test-scan {{rep 100000}} { "# FreeScan : time only, zone in string (exchange zones between system / gmt)" {clock scan "19:18:30 GMT" -base 148863600} } { + if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } puts "\n% $comment\n% $c" - puts [clock format [{*}$c]] + puts [clock format [{*}$c] -locale en] puts [time $c $rep] } } @@ -45,15 +58,17 @@ proc test-other {{rep 100000}} { "# Bad zone" {catch {clock scan "1 day" -timezone BAD_ZONE}} } { + if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } puts "\n% $comment\n% $c" puts [if 1 $c] puts [time $c $rep] } } +set factor 10; # 50 if 1 {;# - test-scan 100000 - test-other 50000 + test-scan [expr 10000 * $factor] + test-other [expr 5000 * $factor] puts \n**OK** };# \ No newline at end of file -- cgit v0.12 From 21878028d55c47c9a84ab38e38d69b0a8123dbe3 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:02:10 +0000 Subject: [temp-commit]: ClockFreeScan ready, test case passed (2 failure because of wrong :localtime zone by TZ-switch, to be fixed) --- generic/tclClock.c | 26 +++++-- library/clock.tcl | 198 ++--------------------------------------------------- library/init.tcl | 2 +- tests/clock.test | 12 +++- 4 files changed, 37 insertions(+), 201 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 5710d6d..7256320 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -122,6 +122,7 @@ typedef struct ClockClientData { Tcl_Obj *GMTSetupTZData; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; + Tcl_Obj *LastUsedSetupTimeZone; } ClockClientData; /* @@ -324,6 +325,7 @@ TclClockInit( data->GMTSetupTZData = NULL; data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; + data->LastUsedSetupTimeZone = NULL; /* * Install the commands. @@ -477,6 +479,7 @@ ClockConfigureObjCmd( if (i+1 < objc) { timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); if (optionIndex == CLOCK_SETUP_TZ) { + dataPtr->LastUsedSetupTimeZone = timezoneObj; if (timezoneObj == litPtr[LIT_GMT]) { optionIndex = CLOCK_SETUP_GMT; } else if (timezoneObj == dataPtr->LastSystemTimeZone) { @@ -510,14 +513,15 @@ ClockConfigureObjCmd( if (i+1 < objc) { Tcl_IncrRefCount( dataPtr->LastSetupTimeZone = timezoneObj); - } else if (dataPtr->LastSetupTimeZone) { - Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); + } else if (dataPtr->LastUsedSetupTimeZone) { + Tcl_SetObjResult(interp, dataPtr->LastUsedSetupTimeZone); } } } } if (optionIndex == CLOCK_CLEAR_CACHE) { dataPtr->LastTZEpoch = 0; + dataPtr->LastUsedSetupTimeZone = NULL; } } @@ -605,6 +609,11 @@ ClockSetupTimeZone( Tcl_Obj **literals = dataPtr->literals; Tcl_Obj *callargs[2]; + /* if cached (if already setup this one) */ + if (timezoneObj == dataPtr->LastUsedSetupTimeZone) { + return timezoneObj; + } + /* differentiate GMT and system zones, because used often and already set */ timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); if ( timezoneObj == dataPtr->GMTSetupTimeZone @@ -2546,6 +2555,15 @@ ClockScanObjCmd( } */ + if (1) { + /* TODO: Tcled Scan proc - */ + Tcl_Obj *callargs[10]; + memcpy(callargs, objv, objc * sizeof(*objv)); + callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); + return Tcl_EvalObjv(interp, objc, callargs, 0); + } + // Tcl_SetObjResult(interp, Tcl_NewWideIntObj(10000000)); + return TCL_OK; } @@ -2635,10 +2653,10 @@ ClockFreeScan( if (yy.dateHaveDate) { if (yy.dateYear < 100) { - yy.dateYear += ClockCurrentYearCentury(clientData, interp); - if (yy.dateYear > ClockGetYearOfCenturySwitch(clientData, interp)) { + if (yy.dateYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { yy.dateYear -= 100; } + yy.dateYear += ClockCurrentYearCentury(clientData, interp); } date.era = CE; date.year = yy.dateYear; diff --git a/library/clock.tcl b/library/clock.tcl index 90b3c69..b4a7639 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -289,7 +289,7 @@ proc ::tcl::clock::Initialize {} { # Current year century and year of century switch variable CurrentYearCentury 2000 - variable YearOfCenturySwitch 37 + variable YearOfCenturySwitch 38 # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise @@ -1249,18 +1249,6 @@ proc ::tcl::clock::__org_scan { args } { set timezone :GMT } - if { ![info exists saw(-format)] } { - # Perhaps someday we'll localize the legacy code. Right now, it's not - # localized. - if { [info exists saw(-locale)] } { - return -code error \ - -errorcode [list CLOCK flagWithLegacyFormat] \ - "legacy \[clock scan\] does not support -locale" - - } - return [FreeScan $string $base $timezone $locale] - } - # Change locale if a fresh locale has been given on the command line. EnterLocale $locale @@ -1279,184 +1267,6 @@ proc ::tcl::clock::__org_scan { args } { #---------------------------------------------------------------------- # -# FreeScan -- -# -# Scans a time in free format -# -# Parameters: -# string - String containing the time to scan -# base - Base time, expressed in seconds from the Epoch -# timezone - Default time zone in which the time will be expressed -# locale - (Unused) Name of the locale where the time will be scanned. -# -# Results: -# Returns the date and time extracted from the string in seconds from -# the epoch -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::__org_FreeScan { string base timezone locale } { - - variable TZData - - # Get the data for time changes in the given zone - if {$timezone eq {}} { - set timezone [GetSystemTimeZone] - } - try { - SetupTimeZone $timezone - } on error {retval opts} { - dict unset opts -errorinfo - return -options $opts $retval - } - - # Extract year, month and day from the base time for the parser to use as - # defaults - - set date [GetDateFields $base $TZData($timezone) 2361222] - dict set date secondOfDay [expr { - [dict get $date localSeconds] % 86400 - }] - - # Parse the date. The parser will return a list comprising date, time, - # time zone, relative month/day/seconds, relative weekday, ordinal month. - - try { - set scanned [Oldscan $string \ - [dict get $date year] \ - [dict get $date month] \ - [dict get $date dayOfMonth]] - lassign $scanned \ - parseDate parseTime parseZone parseRel \ - parseWeekday parseOrdinalMonth - } on error message { - return -code error \ - "unable to convert date-time string \"$string\": $message" - } - - # If the caller supplied a date in the string, update the 'date' dict with - # the value. If the caller didn't specify a time with the date, default to - # midnight. - - if { [llength $parseDate] > 0 } { - lassign $parseDate y m d - if { $y < 100 } { - variable YearOfCenturySwitch - if { $y > $YearOfCenturySwitch } { - incr y 1900 - } else { - incr y 2000 - } - } - dict set date era CE - dict set date year $y - dict set date month $m - dict set date dayOfMonth $d - if { $parseTime eq {} } { - set parseTime 0 - } - } - - # If the caller supplied a time zone in the string, it comes back as a - # two-element list; the first element is the number of minutes east of - # Greenwich, and the second is a Daylight Saving Time indicator (1 == yes, - # 0 == no, -1 == unknown). We make it into a time zone indicator of - # +-hhmm. - - if { [llength $parseZone] > 0 } { - lassign $parseZone minEast dstFlag - set timezone [FormatNumericTimeZone \ - [expr { 60 * $minEast + 3600 * $dstFlag }]] - SetupTimeZone $timezone - } - dict set date tzName $timezone - - # Assemble date, time, zone into seconds-from-epoch - - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] 2361222] - if { $parseTime ne {} } { - dict set date secondOfDay $parseTime - } elseif { [llength $parseWeekday] != 0 - || [llength $parseOrdinalMonth] != 0 - || ( [llength $parseRel] != 0 - && ( [lindex $parseRel 0] != 0 - || [lindex $parseRel 1] != 0 ) ) } { - dict set date secondOfDay 0 - } - - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - dict set date tzName $timezone - set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) 2361222] - set seconds [dict get $date seconds] - - # Do relative times - - if { [llength $parseRel] > 0 } { - lassign $parseRel relMonth relDay relSecond - set seconds [add $seconds \ - $relMonth months $relDay days $relSecond seconds \ - -timezone $timezone -locale $locale] - } - - # Do relative weekday - - if { [llength $parseWeekday] > 0 } { - lassign $parseWeekday dayOrdinal dayOfWeek - set date2 [GetDateFields $seconds $TZData($timezone) 2361222] - dict set date2 era CE - set jdwkday [WeekdayOnOrBefore $dayOfWeek [expr { - [dict get $date2 julianDay] + 6 - }]] - incr jdwkday [expr { 7 * $dayOrdinal }] - if { $dayOrdinal > 0 } { - incr jdwkday -7 - } - dict set date2 secondOfDay \ - [expr { [dict get $date2 localSeconds] % 86400 }] - dict set date2 julianDay $jdwkday - dict set date2 localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date2 julianDay]) ) - + [dict get $date secondOfDay] - }] - dict set date2 tzName $timezone - set date2 [ConvertLocalToUTC $date2[set date2 {}] $TZData($timezone) \ - 2361222] - set seconds [dict get $date2 seconds] - - } - - # Do relative month - - if { [llength $parseOrdinalMonth] > 0 } { - lassign $parseOrdinalMonth monthOrdinal monthNumber - if { $monthOrdinal > 0 } { - set monthDiff [expr { $monthNumber - [dict get $date month] }] - if { $monthDiff <= 0 } { - incr monthDiff 12 - } - incr monthOrdinal -1 - } else { - set monthDiff [expr { [dict get $date month] - $monthNumber }] - if { $monthDiff >= 0 } { - incr monthDiff -12 - } - incr monthOrdinal - } - set seconds [add $seconds $monthOrdinal years $monthDiff months \ - -timezone $timezone -locale $locale] - } - - return $seconds -} - - -#---------------------------------------------------------------------- -# # ParseClockScanFormat -- # # Parses a format string given to [clock scan -format] @@ -2723,10 +2533,10 @@ proc ::tcl::clock::InterpretTwoDigitYear { date baseTime variable CurrentYearCentury variable YearOfCenturySwitch set yr [dict get $date $twoDigitField] - incr yr $CurrentYearCentury - if { $yr <= $YearOfCenturySwitch } { + if { $yr >= $YearOfCenturySwitch } { incr yr -100 } + incr yr $CurrentYearCentury dict set date $fourDigitField $yr return $date } @@ -3120,7 +2930,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { LoadZoneinfoFile [string range $timezone 1 end] }] } then { - dict set TimeZoneBad $timezone 1 + dict set TimeZoneBad $timezone 1 return -code error \ -errorcode [list CLOCK badTimeZone $timezone] \ "time zone \"$timezone\" not found" diff --git a/library/init.tcl b/library/init.tcl index 5e452b0..06a9459 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format SetupTimeZone} { + foreach cmd {add format SetupTimeZone GetSystemTimeZone __org_scan} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests/clock.test b/tests/clock.test index 6a0fecd..ecc6f5f 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35662,7 +35662,7 @@ test clock-34.8 {clock scan tests} { } {Oct 23,1992 15:00 GMT} test clock-34.9 {clock scan tests} { list [catch {clock scan "Jan 12" -bad arg} msg] $msg -} {1 {bad option "-bad", must be -base, -format, -gmt, -locale or -timezone}} +} {1 {bad option "-bad": must be -format, -gmt, -locale, -timezone, or -base}} # The following two two tests test the two year date policy test clock-34.10 {clock scan tests} { set time [clock scan "1/1/71" -gmt true] @@ -35672,7 +35672,15 @@ test clock-34.11 {clock scan tests} { set time [clock scan "1/1/37" -gmt true] clock format $time -format {%b %d,%Y %H:%M GMT} -gmt true } {Jan 01,2037 00:00 GMT} - +test clock-34.11.1 {clock scan tests: same century switch} { + set times [clock scan "1/1/37" -gmt true] +} [clock scan "1/1/37" -format "%m/%d/%y" -gmt true] +test clock-34.11.2 {clock scan tests: same century switch} { + set times [clock scan "1/1/38" -gmt true] +} [clock scan "1/1/38" -format "%m/%d/%y" -gmt true] +test clock-34.11.3 {clock scan tests: same century switch} { + set times [clock scan "1/1/39" -gmt true] +} [clock scan "1/1/39" -format "%m/%d/%y" -gmt true] test clock-34.12 {clock scan, relative times} { set time [clock scan "Oct 23, 1992 -1 day"] clock format $time -format {%b %d, %Y} -- cgit v0.12 From 32b5c49ef3414668839b0fab063c85c2583a15e6 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:04:49 +0000 Subject: [temp-commit]: ClockFreeScan back-ported (cherry picked), all tests case passed + several new test-cases for bug fixing implemented here; environment epoch ported, several fixes for the time zone / tzdata caching ported; mem-leak fix + memory leak test cases passed --- generic/tclClock.c | 342 +++++++++++++++++++++++++++------------------- generic/tclDate.h | 13 +- generic/tclEnv.c | 8 ++ library/clock.tcl | 12 +- tests-perf/clock.perf.tcl | 78 +++++++---- tests/clock.test | 21 +++ 6 files changed, 296 insertions(+), 178 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 7256320..e39e032 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -115,14 +115,24 @@ typedef struct ClockClientData { size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals. */ /* Cache for current clock parameters, imparted via "configure" */ - unsigned int LastTZEpoch; - Tcl_Obj *LastSystemTimeZone; + unsigned long LastTZEpoch; + Tcl_Obj *SystemTimeZone; Tcl_Obj *SystemSetupTZData; Tcl_Obj *GMTSetupTimeZone; Tcl_Obj *GMTSetupTZData; + Tcl_Obj *AnySetupTimeZone; + Tcl_Obj *AnySetupTZData; + Tcl_Obj *LastUnnormSetupTimeZone; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; - Tcl_Obj *LastUsedSetupTimeZone; + /* + /* [SB] TODO: back-port (from tclSE) the same date caching ... + * Cache for last date (fast convert if date parsed was the same) * / + struct { + DateInfo yy; + TclDateFields date; + } lastDate; + */ } ClockClientData; /* @@ -233,11 +243,29 @@ static int ClockFreeScan( Tcl_Obj *strObj, Tcl_WideInt baseVal, Tcl_Obj *timezoneObj, Tcl_Obj *locale); static struct tm * ThreadSafeLocalTime(const time_t *); -static unsigned int TzsetGetEpoch(void); +static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); /* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* * Structure containing description of "native" clock commands to create. */ @@ -319,13 +347,15 @@ TclClockInit( Tcl_IncrRefCount(data->literals[i]); } data->LastTZEpoch = 0; - data->LastSystemTimeZone = NULL; + data->SystemTimeZone = NULL; data->SystemSetupTZData = NULL; data->GMTSetupTimeZone = NULL; data->GMTSetupTZData = NULL; + data->AnySetupTimeZone = NULL; + data->AnySetupTZData = NULL; + data->LastUnnormSetupTimeZone = NULL; data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; - data->LastUsedSetupTimeZone = NULL; /* * Install the commands. @@ -356,6 +386,22 @@ TclClockInit( */ static void +ClockConfigureClear( + ClockClientData *data) +{ + data->LastTZEpoch = 0; + Tcl_UnsetObjRef(data->SystemTimeZone); + Tcl_UnsetObjRef(data->SystemSetupTZData); + Tcl_UnsetObjRef(data->GMTSetupTimeZone); + Tcl_UnsetObjRef(data->GMTSetupTZData); + Tcl_UnsetObjRef(data->AnySetupTimeZone); + Tcl_UnsetObjRef(data->AnySetupTZData); + Tcl_UnsetObjRef(data->LastUnnormSetupTimeZone); + Tcl_UnsetObjRef(data->LastSetupTimeZone); + Tcl_UnsetObjRef(data->LastSetupTZData); +} + +static void ClockDeleteCmdProc( ClientData clientData) /* Opaque pointer to the client data */ { @@ -367,15 +413,7 @@ ClockDeleteCmdProc( Tcl_DecrRefCount(data->literals[i]); } - if (data->LastSystemTimeZone) { - Tcl_DecrRefCount(data->LastSystemTimeZone); - } - if (data->GMTSetupTimeZone) { - Tcl_DecrRefCount(data->GMTSetupTimeZone); - } - if (data->LastSetupTimeZone) { - Tcl_DecrRefCount(data->LastSetupTimeZone); - } + ClockConfigureClear(data); ckfree(data->literals); ckfree(data); @@ -391,34 +429,40 @@ NormTimezoneObj( Tcl_Obj * timezoneObj) { const char * tz; - if ( timezoneObj == dataPtr->literals[LIT_GMT] - || timezoneObj == dataPtr->LastSystemTimeZone - || timezoneObj == dataPtr->LastSetupTimeZone + if ( timezoneObj == dataPtr->LastUnnormSetupTimeZone + && dataPtr->LastSetupTimeZone != NULL + ) { + return dataPtr->LastSetupTimeZone; + } + if ( timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->literals[LIT_GMT] + || timezoneObj == dataPtr->SystemTimeZone + || timezoneObj == dataPtr->AnySetupTimeZone ) { return timezoneObj; } tz = TclGetString(timezoneObj); - if ( - strcmp(tz, Literals[LIT_GMT]) == 0 + if (dataPtr->AnySetupTimeZone != NULL && + (timezoneObj == dataPtr->AnySetupTimeZone + || strcmp(tz, TclGetString(dataPtr->AnySetupTimeZone)) == 0 + ) ) { - timezoneObj = dataPtr->literals[LIT_GMT]; + timezoneObj = dataPtr->AnySetupTimeZone; } else - if (dataPtr->LastSystemTimeZone != NULL && - (timezoneObj == dataPtr->LastSystemTimeZone - || strcmp(tz, TclGetString(dataPtr->LastSystemTimeZone)) == 0 + if (dataPtr->SystemTimeZone != NULL && + (timezoneObj == dataPtr->SystemTimeZone + || strcmp(tz, TclGetString(dataPtr->SystemTimeZone)) == 0 ) ) { - timezoneObj = dataPtr->LastSystemTimeZone; + timezoneObj = dataPtr->SystemTimeZone; } else - if (dataPtr->LastSetupTimeZone != NULL && - (timezoneObj == dataPtr->LastSetupTimeZone - || strcmp(tz, TclGetString(dataPtr->LastSetupTimeZone)) == 0 - ) + if ( + strcmp(tz, Literals[LIT_GMT]) == 0 ) { - timezoneObj = dataPtr->LastSetupTimeZone; + timezoneObj = dataPtr->literals[LIT_GMT]; } return timezoneObj; } @@ -454,74 +498,64 @@ ClockConfigureObjCmd( Tcl_GetString(objv[i]), NULL); return TCL_ERROR; } - if (optionIndex == CLOCK_SYSTEM_TZ || optionIndex == CLOCK_CLEAR_CACHE) { - if (dataPtr->LastSystemTimeZone) { - Tcl_DecrRefCount(dataPtr->LastSystemTimeZone); - dataPtr->LastSystemTimeZone = NULL; - dataPtr->SystemSetupTZData = NULL; - } - if (optionIndex != CLOCK_CLEAR_CACHE) { - /* validate current tz-epoch */ - unsigned int lastTZEpoch = TzsetGetEpoch(); - if (i+1 < objc) { - Tcl_IncrRefCount( - dataPtr->LastSystemTimeZone = objv[i+1]); - dataPtr->LastTZEpoch = lastTZEpoch; - } else if (dataPtr->LastSystemTimeZone - && dataPtr->LastTZEpoch == lastTZEpoch) { - Tcl_SetObjResult(interp, dataPtr->LastSystemTimeZone); + switch (optionIndex) { + case CLOCK_SYSTEM_TZ: + if (1) { + /* validate current tz-epoch */ + unsigned long lastTZEpoch = TzsetGetEpoch(); + if (i+1 < objc) { + if (dataPtr->SystemTimeZone != objv[i+1]) { + Tcl_SetObjRef(dataPtr->SystemTimeZone, objv[i+1]); + Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); } + dataPtr->LastTZEpoch = lastTZEpoch; + } + if (dataPtr->SystemTimeZone != NULL + && dataPtr->LastTZEpoch == lastTZEpoch) { + Tcl_SetObjResult(interp, dataPtr->SystemTimeZone); } } - if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { - Tcl_Obj *timezoneObj = NULL; - /* differentiate GMT and system zones, because used often */ + break; + case CLOCK_SETUP_TZ: if (i+1 < objc) { - timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); - if (optionIndex == CLOCK_SETUP_TZ) { - dataPtr->LastUsedSetupTimeZone = timezoneObj; - if (timezoneObj == litPtr[LIT_GMT]) { - optionIndex = CLOCK_SETUP_GMT; - } else if (timezoneObj == dataPtr->LastSystemTimeZone) { - optionIndex = CLOCK_SETUP_NOP; - } + /* differentiate GMT and system zones, because used often */ + Tcl_Obj *timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); + Tcl_SetObjRef(dataPtr->LastUnnormSetupTimeZone, objv[i+1]); + if (dataPtr->LastSetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->LastSetupTZData); } - } - - if (optionIndex == CLOCK_SETUP_GMT || optionIndex == CLOCK_CLEAR_CACHE) { - if (dataPtr->GMTSetupTimeZone) { - Tcl_DecrRefCount(dataPtr->GMTSetupTimeZone); - dataPtr->GMTSetupTimeZone = NULL; - dataPtr->GMTSetupTZData = NULL; + if (timezoneObj == litPtr[LIT_GMT]) { + optionIndex = CLOCK_SETUP_GMT; + } else if (timezoneObj == dataPtr->SystemTimeZone) { + optionIndex = CLOCK_SETUP_NOP; } - if (optionIndex != CLOCK_CLEAR_CACHE) { + switch (optionIndex) { + case CLOCK_SETUP_GMT: if (i+1 < objc) { - Tcl_IncrRefCount( - dataPtr->GMTSetupTimeZone = timezoneObj); - } else if (dataPtr->GMTSetupTimeZone) { - Tcl_SetObjResult(interp, dataPtr->GMTSetupTimeZone); + if (dataPtr->GMTSetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->GMTSetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->GMTSetupTZData); + } } - } - } - if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { - if (dataPtr->LastSetupTimeZone) { - Tcl_DecrRefCount(dataPtr->LastSetupTimeZone); - dataPtr->LastSetupTimeZone = NULL; - dataPtr->LastSetupTZData = NULL; - } - if (optionIndex != CLOCK_CLEAR_CACHE) { + break; + case CLOCK_SETUP_TZ: if (i+1 < objc) { - Tcl_IncrRefCount( - dataPtr->LastSetupTimeZone = timezoneObj); - } else if (dataPtr->LastUsedSetupTimeZone) { - Tcl_SetObjResult(interp, dataPtr->LastUsedSetupTimeZone); - } + if (dataPtr->AnySetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->AnySetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->AnySetupTZData); + } + } + break; } } - } - if (optionIndex == CLOCK_CLEAR_CACHE) { - dataPtr->LastTZEpoch = 0; - dataPtr->LastUsedSetupTimeZone = NULL; + if (dataPtr->LastSetupTimeZone != NULL) { + Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); + } + break; + case CLOCK_CLEAR_CACHE: + ClockConfigureClear(dataPtr); + break; } } @@ -541,11 +575,19 @@ ClockGetTZData( Tcl_Obj **literals = dataPtr->literals; Tcl_Obj *ret, **out = NULL; + /* if cached (if already setup this one) */ + if ( dataPtr->LastSetupTZData != NULL + && ( timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->LastUnnormSetupTimeZone + ) + ) { + return dataPtr->LastSetupTZData; + } + /* differentiate GMT and system zones, because used often */ - /* simple caching, because almost used the tz-data of last timezone, (unnecessary to - * touch the refCount of it, because it is always referenced in TZData array) + /* simple caching, because almost used the tz-data of last timezone */ - if (timezoneObj == dataPtr->LastSystemTimeZone) { + if (timezoneObj == dataPtr->SystemTimeZone) { if (dataPtr->SystemSetupTZData != NULL) return dataPtr->SystemSetupTZData; out = &dataPtr->SystemSetupTZData; @@ -557,19 +599,25 @@ ClockGetTZData( out = &dataPtr->GMTSetupTZData; } else - if (timezoneObj == dataPtr->LastSetupTimeZone) { - if (dataPtr->LastSetupTZData != NULL) { - return dataPtr->LastSetupTZData; + if (timezoneObj == dataPtr->AnySetupTimeZone) { + if (dataPtr->AnySetupTZData != NULL) { + return dataPtr->AnySetupTZData; } - out = &dataPtr->LastSetupTZData; + out = &dataPtr->AnySetupTZData; } ret = Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], timezoneObj, TCL_LEAVE_ERR_MSG); - /* cache using corresponding slot */ - if (ret != NULL && out != NULL) - *out = ret; + /* cache using corresponding slot and as last used */ + if (out != NULL) { + Tcl_SetObjRef(*out, ret); + } + Tcl_SetObjRef(dataPtr->LastSetupTZData, ret); + if (dataPtr->LastSetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->LastUnnormSetupTimeZone); + } return ret; } /* @@ -584,9 +632,9 @@ ClockGetSystemTimeZone( Tcl_Obj **literals; /* if known (cached and same epoch) - return now */ - if (dataPtr->LastSystemTimeZone != NULL + if (dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == TzsetGetEpoch()) { - return dataPtr->LastSystemTimeZone; + return dataPtr->SystemTimeZone; } literals = dataPtr->literals; @@ -610,15 +658,19 @@ ClockSetupTimeZone( Tcl_Obj *callargs[2]; /* if cached (if already setup this one) */ - if (timezoneObj == dataPtr->LastUsedSetupTimeZone) { - return timezoneObj; + if ( dataPtr->LastSetupTimeZone != NULL + && ( timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->LastUnnormSetupTimeZone + ) + ) { + return dataPtr->LastSetupTimeZone; } /* differentiate GMT and system zones, because used often and already set */ timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); if ( timezoneObj == dataPtr->GMTSetupTimeZone - || timezoneObj == dataPtr->LastSystemTimeZone - || timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->SystemTimeZone + || timezoneObj == dataPtr->AnySetupTimeZone ) { return timezoneObj; } @@ -627,7 +679,7 @@ ClockSetupTimeZone( callargs[1] = timezoneObj; if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { - return NormTimezoneObj(dataPtr, timezoneObj); + return dataPtr->LastSetupTimeZone; } return NULL; } @@ -743,6 +795,7 @@ ClockConvertlocaltoutcObjCmd( int created = 0; int status; + fields.tzName = NULL; /* * Check params and convert time. */ @@ -936,22 +989,6 @@ ClockGetDateFields( return TCL_OK; } - -inline -SetDateFieldsTimeZone( - TclDateFields *fields, - Tcl_Obj *timezoneObj) -{ - if (fields->tzName != timezoneObj) { - if (timezoneObj) { - Tcl_IncrRefCount(timezoneObj); - } - if (fields->tzName != NULL) { - Tcl_DecrRefCount(fields->tzName); - } - fields->tzName = timezoneObj; - } -} /* *---------------------------------------------------------------------- @@ -1030,6 +1067,8 @@ ClockGetjuliandayfromerayearmonthdayObjCmd( int status; int era = 0; + fields.tzName = NULL; + /* * Check params. */ @@ -1114,6 +1153,8 @@ ClockGetjuliandayfromerayearweekdayObjCmd( int status; int era = 0; + fields.tzName = NULL; + /* * Check params. */ @@ -1457,7 +1498,7 @@ ConvertUTCToLocalUsingTable( * Convert the time. */ - SetDateFieldsTimeZone(fields, cellv[3]); + Tcl_SetObjRef(fields->tzName, cellv[3]); fields->localSeconds = fields->seconds + fields->tzOffset; return TCL_OK; } @@ -1550,7 +1591,7 @@ ConvertUTCToLocalUsingC( if (diff > 0) { sprintf(buffer+5, "%02d", diff); } - SetDateFieldsTimeZone(fields, Tcl_NewStringObj(buffer, -1)); + Tcl_SetObjRef(fields->tzName, Tcl_NewStringObj(buffer, -1)); return TCL_OK; } @@ -1647,6 +1688,8 @@ GetYearWeekDay( TclDateFields temp; int dayOfFiscalYear; + temp.tzName = NULL; + /* * Find the given date, minus three days, plus one year. That date's * iso8601 year is an upper bound on the ISO8601 year of the given date. @@ -1863,6 +1906,8 @@ GetJulianDayFromEraYearWeekDay( * given year */ TclDateFields firstWeek; + firstWeek.tzName = NULL; + /* * Find January 4 in the ISO8601 year, which will always be in week 1. */ @@ -2557,13 +2602,16 @@ ClockScanObjCmd( if (1) { /* TODO: Tcled Scan proc - */ + int ret; Tcl_Obj *callargs[10]; memcpy(callargs, objv, objc * sizeof(*objv)); callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); - return Tcl_EvalObjv(interp, objc, callargs, 0); + Tcl_IncrRefCount(callargs[0]); + ret = Tcl_EvalObjv(interp, objc, callargs, 0); + Tcl_DecrRefCount(callargs[0]); + return ret; } - // Tcl_SetObjResult(interp, Tcl_NewWideIntObj(10000000)); - + return TCL_OK; } @@ -2589,7 +2637,6 @@ ClockFreeScan( int secondOfDay; /* Seconds of day (time only calculation) */ Tcl_WideInt seconds; int ret = TCL_ERROR; - // Tcl_Obj *cleanUpList = Tcl_NewObj(); date.tzName = NULL; @@ -2600,7 +2647,6 @@ ClockFreeScan( if (timezoneObj == NULL) { goto done; } - // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); } /* Get the data for time changes in the given zone */ @@ -2673,12 +2719,16 @@ ClockFreeScan( */ if (yy.dateHaveZone) { + Tcl_Obj *tzObjStor = NULL; int minEast = -yy.dateTimezone; int dstFlag = 1 - yy.dateDSTmode; - timezoneObj = ClockFormatNumericTimeZone( + tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); - timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); + + timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); + if (tzObjStor != timezoneObj) { + Tcl_DecrRefCount(tzObjStor); + } if (timezoneObj == NULL) { goto done; } @@ -2695,7 +2745,7 @@ ClockFreeScan( * Assemble date, time, zone into seconds-from-epoch */ - SetDateFieldsTimeZone(&date, timezoneObj); + Tcl_SetObjRef(date.tzName, timezoneObj); if (yy.dateHaveTime == -1) { secondOfDay = 0; @@ -2853,10 +2903,7 @@ repeat_rel: done: - if (date.tzName != NULL) { - Tcl_DecrRefCount(date.tzName); - } - // Tcl_DecrRefCount(cleanUpList); + Tcl_UnsetObjRef(date.tzName); if (ret != TCL_OK) { return ret; @@ -2919,23 +2966,30 @@ ClockSecondsObjCmd( *---------------------------------------------------------------------- */ -static unsigned int +static unsigned long TzsetGetEpoch(void) { - static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by - * clockMutex. */ - static long tzNextRefresh = 0; /* Latence before next refresh */ - static unsigned int tzWasEpoch = 1; /* Epoch, signals that TZ changed */ + static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by + * clockMutex. */ + static long tzLastRefresh = 0; /* Used for latency before next refresh */ + static unsigned long tzWasEpoch = 0; /* Epoch, signals that TZ changed */ + static unsigned long tzEnvEpoch = 0; /* Last env epoch, for faster signaling, + that TZ changed via TCL */ - const char *tzIsNow; /* Current value of TZ */ + const char *tzIsNow; /* Current value of TZ */ - /* fast check whether environment was changed (once per second) */ + /* + * Prevent performance regression on some platforms by resolving of system time zone: + * small latency for check whether environment was changed (once per second) + * no latency if environment was chaned with tcl-env (compare both epoch values) + */ Tcl_Time now; Tcl_GetTime(&now); - if (now.sec < tzNextRefresh) { + if (now.sec == tzLastRefresh && tzEnvEpoch == TclEnvEpoch) { return tzWasEpoch; } - tzNextRefresh = now.sec + 1; + tzEnvEpoch = TclEnvEpoch; + tzLastRefresh = now.sec; /* check in lock */ Tcl_MutexLock(&clockMutex); diff --git a/generic/tclDate.h b/generic/tclDate.h index 91e677f..6ba9620 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -19,9 +19,6 @@ typedef struct DateInfo { - Tcl_Obj* messages; /* Error messages */ - const char* separatrix; /* String separating messages */ - time_t dateYear; time_t dateMonth; time_t dateDay; @@ -54,6 +51,9 @@ typedef struct DateInfo { time_t *dateRelPointer; int dateDigitCount; + + Tcl_Obj* messages; /* Error messages */ + const char* separatrix; /* String separating messages */ } DateInfo; @@ -74,4 +74,11 @@ MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); +/* + * Other externals. + */ + +MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment + * (if changed with tcl-env). */ + #endif /* _TCLCLOCK_H */ diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 66ddb57..fd0a8ce 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -17,6 +17,10 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ + +MODULE_SCOPE unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment + * (if changed with tcl-env). */ + static struct { int cacheSize; /* Number of env strings in cache. */ char **cache; /* Array containing all of the environment @@ -371,6 +375,7 @@ Tcl_PutEnv( value[0] = '\0'; TclSetEnv(name, value+1); } + TclEnvEpoch++; Tcl_DStringFree(&nameString); return 0; @@ -579,6 +584,7 @@ EnvTraceProc( if (flags & TCL_TRACE_ARRAY) { TclSetupEnv(interp); + TclEnvEpoch++; return NULL; } @@ -599,6 +605,7 @@ EnvTraceProc( value = Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY); TclSetEnv(name2, value); + TclEnvEpoch++; } /* @@ -622,6 +629,7 @@ EnvTraceProc( if (flags & TCL_TRACE_UNSETS) { TclUnsetEnv(name2); + TclEnvEpoch++; } return NULL; } diff --git a/library/clock.tcl b/library/clock.tcl index b4a7639..ace4176 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -671,7 +671,9 @@ proc ::tcl::clock::format { args } { # Get the data for time changes in the given zone if {$timezone eq ""} { - set timezone [GetSystemTimeZone] + if {[set timezone [configure -system-tz]] eq ""} { + set timezone [GetSystemTimeZone] + } } if {![info exists TZData($timezone)]} { if {[catch {SetupTimeZone $timezone} retval opts]} { @@ -1202,7 +1204,9 @@ proc ::tcl::clock::__org_scan { args } { set format {} set gmt 0 set locale c - set timezone [GetSystemTimeZone] + if {[set timezone [configure -system-tz]] eq ""} { + set timezone [GetSystemTimeZone] + } # Pick up command line options. @@ -4083,7 +4087,9 @@ proc ::tcl::clock::add { clockval args } { set offsets {} set gmt 0 set locale c - set timezone [GetSystemTimeZone] + if {[set timezone [configure -system-tz]] eq ""} { + set timezone [GetSystemTimeZone] + } foreach { a b } $args { if { [string is integer -strict $a] } { diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 52bc91f..7ef70ce 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -15,60 +15,82 @@ # of this file. # +set ::env(TCL_TZ) :CET + +proc {**STOP**} {args} { + return -code error -level 2 "**STOP** in [info level [expr {[info level]-1}]] [join $args { }]" +} + +proc _test_get_commands {lst} { + regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" +} + proc test-scan {{rep 100000}} { - foreach {comment c} { - "# FreeScan : relative date" + foreach c [_test_get_commands { + # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} - "# FreeScan : relative date with relative weekday" + # FreeScan : relative date with relative weekday {clock scan "5 years 18 months 385 days Fri" -base 0 -gmt 1} - "# FreeScan : relative date with ordinal month" + # FreeScan : relative date with ordinal month {clock scan "5 years 18 months 385 days next 1 January" -base 0 -gmt 1} - "# FreeScan : relative date with ordinal month and relative weekday" + # FreeScan : relative date with ordinal month and relative weekday {clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1} - "# FreeScan : ordinal month" + # FreeScan : ordinal month {clock scan "next January" -base 0 -gmt 1} - "# FreeScan : relative week" + # FreeScan : relative week {clock scan "next Fri" -base 0 -gmt 1} - "# FreeScan : relative weekday and week offset " + # FreeScan : relative weekday and week offset {clock scan "next January + 2 week" -base 0 -gmt 1} - "# FreeScan : time only with base" + # FreeScan : time only with base {clock scan "19:18:30" -base 148863600 -gmt 1} - "# FreeScan : time only without base" + # FreeScan : time only without base, gmt {clock scan "19:18:30" -gmt 1} - "# FreeScan : date, system time zone" + # FreeScan : time only without base, system + {clock scan "19:18:30"} + # FreeScan : date, system time zone {clock scan "05/08/2016 20:18:30"} - "# FreeScan : date, supplied time zone" + # FreeScan : date, supplied time zone {clock scan "05/08/2016 20:18:30" -timezone :CET} - "# FreeScan : date, supplied gmt (equivalent -timezone :GMT)" + # FreeScan : date, supplied gmt (equivalent -timezone :GMT) {clock scan "05/08/2016 20:18:30" -gmt 1} - "# FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500)" + # FreeScan : date, supplied time zone gmt + {clock scan "05/08/2016 20:18:30" -timezone :GMT} + # FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500) {clock scan "20:18:30 -0500" -base 148863600 -gmt 1} - "# FreeScan : time only, zone in string (exchange zones between system / gmt)" + # FreeScan : time only, zone in string (exchange zones between system / gmt) {clock scan "19:18:30 GMT" -base 148863600} - } { - if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } - puts "\n% $comment\n% $c" - puts [clock format [{*}$c] -locale en] + # FreeScan : fast switch of zones in cycle - GMT, MST, CET (system) and EST + {clock scan "19:18:30 MST" -base 148863600 -gmt 1 + clock scan "19:18:30 EST" -base 148863600 + } + }] { + puts "% [regsub -all {\n[ \t]*} $c {; }]" + if {[regexp {\s*\#} $c]} continue + puts [clock format [if 1 $c] -locale en] puts [time $c $rep] + puts "" } } proc test-other {{rep 100000}} { - foreach {comment c} { - "# Bad zone" - {catch {clock scan "1 day" -timezone BAD_ZONE}} - } { - if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } - puts "\n% $comment\n% $c" + foreach c [_test_get_commands { + # Bad zone + {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + }] { + puts "% [regsub -all {\n[ \t]*} $c {; }]" + if {[regexp {\s*\#} $c]} continue puts [if 1 $c] puts [time $c $rep] + puts "" } } -set factor 10; # 50 -if 1 {;# +proc test {factor} { + puts "" test-scan [expr 10000 * $factor] test-other [expr 5000 * $factor] puts \n**OK** -};# \ No newline at end of file +} + +test 20; # 50 diff --git a/tests/clock.test b/tests/clock.test index ecc6f5f..477f142 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35803,6 +35803,27 @@ test clock-34.40 {clock scan, next day of week} { clock format [clock scan "next thursday" -base [clock scan 20000112]] \ -format {%b %d, %Y} } "Jan 20, 2000" +test clock-34.40.1 {clock scan, ordinal month after relative date} { + # This will fail without the bug fix (clock.tcl), as still missing + # month/julian day conversion before ordinal month increment + clock format [ \ + clock scan "5 years 18 months 387 days" -base 0 -gmt 1 + ] -format {%a, %b %d, %Y} -gmt 1 -locale en_US_roman +} "Sat, Jul 23, 1977" +test clock-34.40.2 {clock scan, ordinal month after relative date} { + # This will fail without the bug fix (clock.tcl), as still missing + # month/julian day conversion before ordinal month increment + clock format [ \ + clock scan "5 years 18 months 387 days next Jan" -base 0 -gmt 1 + ] -format {%a, %b %d, %Y} -gmt 1 -locale en_US_roman +} "Mon, Jan 23, 1978" +test clock-34.40.3 {clock scan, day of week after ordinal date} { + # This will fail without the bug fix (clock.tcl), because the relative + # week day should be applied after whole date conversion + clock format [ \ + clock scan "5 years 18 months 387 days next January Fri" -base 0 -gmt 1 + ] -format {%a, %b %d, %Y} -gmt 1 -locale en_US_roman +} "Fri, Jan 27, 1978" # weekday specification and base. test clock-34.41 {2nd monday in november} { -- cgit v0.12 From 1f1f1e4dfcb5859424591754a5ecc2bdf25a087b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:07:37 +0000 Subject: [temp-commit]: tclClockFmt.c - 1st try using "timerate" instead "time" by performance measurement tests (more precise and fixed time, so no switch of factor expected) --- generic/tclClock.c | 17 +- generic/tclClockFmt.c | 417 ++++++++++++++++++++++++++++++++++++++++++++++ generic/tclDate.c | 12 +- generic/tclDate.h | 44 ++++- generic/tclGetDate.y | 1 + tests-perf/clock.perf.tcl | 40 +++-- unix/Makefile.in | 4 + win/Makefile.in | 1 + win/makefile.vc | 1 + 9 files changed, 512 insertions(+), 25 deletions(-) create mode 100644 generic/tclClockFmt.c diff --git a/generic/tclClock.c b/generic/tclClock.c index e39e032..c869cf4 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -8,6 +8,7 @@ * Copyright 1991-1995 Karl Lehenbauer and Mark Diekhans. * Copyright (c) 1995 Sun Microsystems, Inc. * Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. + * Copyright (c) 2015 by Sergey G. Brester aka sebres. All rights reserved. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -2600,9 +2601,9 @@ ClockScanObjCmd( } */ - if (1) { + if (0) { /* TODO: Tcled Scan proc - */ - int ret; + int ret; Tcl_Obj *callargs[10]; memcpy(callargs, objv, objc * sizeof(*objv)); callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); @@ -2611,6 +2612,18 @@ ClockScanObjCmd( Tcl_DecrRefCount(callargs[0]); return ret; } + + if (1) { + + ClockFmtScnStorage * fss; + + if ((fss = Tcl_GetClockFrmScnFromObj(interp, opts.formatObj)) == NULL) { + return TCL_ERROR; + }; + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + + } return TCL_OK; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c new file mode 100644 index 0000000..fa89dde --- /dev/null +++ b/generic/tclClockFmt.c @@ -0,0 +1,417 @@ +/* + * tclClockFmt.c -- + * + * Contains the date format (and scan) routines. This code is back-ported + * from the time and date facilities of tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2015 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" +#include "tclDate.h" + +/* + * Miscellaneous forward declarations and functions used within this file + */ + +static void +ClockFmtObj_DupInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +ClockFmtObj_FreeInternalRep(Tcl_Obj *objPtr); +static int +ClockFmtObj_SetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); +static void +ClockFmtObj_UpdateString(Tcl_Obj *objPtr); + + +TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ + +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); + +/* + * Clock scan and format facilities. + */ + +#define TOK_CHAIN_BLOCK_SIZE 8 + +/* + *---------------------------------------------------------------------- + */ + +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + +static struct { + ClockFmtScnStorage *stackPtr; + ClockFmtScnStorage *stackBound; + unsigned int count; +} ClockFmtScnStorage_GC = {NULL, NULL, 0}; + +inline void +ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) +{ + /* add new entry */ + TclSpliceIn(entry, ClockFmtScnStorage_GC.stackPtr); + if (ClockFmtScnStorage_GC.stackBound == NULL) { + ClockFmtScnStorage_GC.stackBound = entry; + } + ClockFmtScnStorage_GC.count++; + + /* if GC ist full */ + if (ClockFmtScnStorage_GC.count > CLOCK_FMT_SCN_STORAGE_GC_SIZE) { + + /* GC stack is LIFO: delete first inserted entry */ + ClockFmtScnStorage *delEnt = ClockFmtScnStorage_GC.stackBound; + ClockFmtScnStorage_GC.stackBound = delEnt->prevPtr; + TclSpliceOut(delEnt, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + delEnt->prevPtr = delEnt->nextPtr = NULL; + /* remove it now */ + ClockFmtScnStorageDelete(delEnt); + } +} +inline void +ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) +{ + TclSpliceOut(entry, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + if (ClockFmtScnStorage_GC.stackBound == entry) { + ClockFmtScnStorage_GC.stackBound = entry->prevPtr; + } + entry->prevPtr = entry->nextPtr = NULL; +} + +#endif + +/* + *---------------------------------------------------------------------- + */ + +static Tcl_HashTable FmtScnHashTable; +static int initFmtScnHashTable = 0; + +inline Tcl_HashEntry * +HashEntry4FmtScn(ClockFmtScnStorage *fss) { + return (Tcl_HashEntry*)(fss + 1); +}; +inline ClockFmtScnStorage * +FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { + return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); +}; + +/* + * Format storage hash (list of formats shared across all threads). + */ + +static Tcl_HashEntry * +ClockFmtScnStorageAllocProc( + Tcl_HashTable *tablePtr, /* Hash table. */ + void *keyPtr) /* Key to store in the hash table entry. */ +{ + ClockFmtScnStorage *fss; + + const char *string = (const char *) keyPtr; + Tcl_HashEntry *hPtr; + unsigned int size, + allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry); + + allocsize += (size = strlen(string) + 1); + if (size > sizeof(hPtr->key)) { + allocsize -= sizeof(hPtr->key); + } + + fss = ckalloc(allocsize); + + /* initialize */ + memset(fss, 0, sizeof(*fss)); + + hPtr = HashEntry4FmtScn(fss); + memcpy(&hPtr->key.string, string, size); + hPtr->clientData = 0; /* currently unused */ + + return hPtr; +} + +static void +ClockFmtScnStorageFreeProc( + Tcl_HashEntry *hPtr) +{ + ClockFmtScnStorage *fss = FmtScn4HashEntry(hPtr); + ClockScanToken *tok; + + tok = fss->firstScnTok; + while (tok != NULL) { + if (tok->nextTok == tok + 1) { + tok++; + /*****************************/ + } else { + tok = tok->nextTok; + } + } + + ckfree(fss); +} + +static void +ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + /* + * This will delete a hash entry and call "ckfree" for storage self, if + * some additionally handling required, freeEntryProc can be used instead + */ + Tcl_DeleteHashEntry(hPtr); +} + + +/* + * Derivation of tclStringHashKeyType with another allocEntryProc + */ + +static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; + + +/* + *---------------------------------------------------------------------- + */ + +static ClockFmtScnStorage * +FindOrCreateFmtScnStorage( + Tcl_Interp *interp, + const char *strFmt) +{ + ClockFmtScnStorage *fss = NULL; + int new; + Tcl_HashEntry *hPtr; + + Tcl_MutexLock(&ClockFmtMutex); + + /* if not yet initialized */ + if (!initFmtScnHashTable) { + /* initialize type */ + memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); + ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; + ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; + initFmtScnHashTable = 1; + + /* initialize hash table */ + Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, + &ClockFmtScnStorageHashKeyType); + } + + /* get or create entry (and alocate storage) */ + hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); + if (hPtr != NULL) { + + fss = FmtScn4HashEntry(hPtr); + + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* unlink if it is currently in GC */ + if (new == 0 && fss->objRefCount == 0) { + ClockFmtScnStorage_GC_Out(fss); + } + #endif + + /* new reference, so increment in lock right now */ + fss->objRefCount++; + } + + Tcl_MutexUnlock(&ClockFmtMutex); + + if (fss == NULL && interp != NULL) { + Tcl_AppendResult(interp, "retrieve clock format failed \"", + strFmt ? strFmt : "", "\"", NULL); + Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); + } + + return fss; +} + + +/* + * Type definition. + */ + +Tcl_ObjType ClockFmtObjType = { + "clock-format", /* name */ + ClockFmtObj_FreeInternalRep, /* freeIntRepProc */ + ClockFmtObj_DupInternalRep, /* dupIntRepProc */ + ClockFmtObj_UpdateString, /* updateStringProc */ + ClockFmtObj_SetFromAny /* setFromAnyProc */ +}; + +#define SetObjClockFmtScn(objPtr, fss) \ + objPtr->internalRep.twoPtrValue.ptr1 = fss +#define ObjClockFmtScn(objPtr) \ + (ClockFmtScnStorage *)objPtr->internalRep.twoPtrValue.ptr1; + +#define SetObjLitStorage(objPtr, lit) \ + objPtr->internalRep.twoPtrValue.ptr2 = lit +#define ObjLitStorage(objPtr) \ + (ClockLitStorage *)objPtr->internalRep.twoPtrValue.ptr2; + +#define ClockFmtObj_SetObjIntRep(objPtr, fss, lit) \ + objPtr->internalRep.twoPtrValue.ptr1 = fss, \ + objPtr->internalRep.twoPtrValue.ptr2 = lit, \ + objPtr->typePtr = &ClockFmtObjType; + +/* + *---------------------------------------------------------------------- + */ +static void +ClockFmtObj_DupInternalRep(srcPtr, copyPtr) + Tcl_Obj *srcPtr; + Tcl_Obj *copyPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(srcPtr); + // ClockLitStorage *lit = ObjLitStorage(srcPtr); + + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + fss->objRefCount++; + Tcl_MutexUnlock(&ClockFmtMutex); + } + + ClockFmtObj_SetObjIntRep(copyPtr, fss, NULL); + + /* if no format representation, dup string representation */ + if (fss == NULL) { + copyPtr->bytes = ckalloc(srcPtr->length + 1); + memcpy(copyPtr->bytes, srcPtr->bytes, srcPtr->length + 1); + copyPtr->length = srcPtr->length; + } +} +/* + *---------------------------------------------------------------------- + */ +static void +ClockFmtObj_FreeInternalRep(objPtr) + Tcl_Obj *objPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + // ClockLitStorage *lit = ObjLitStorage(objPtr); + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + /* decrement object reference count of format/scan storage */ + if (--fss->objRefCount <= 0) { + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* don't remove it right now (may be reusable), just add to GC */ + ClockFmtScnStorageGC_In(fss); + #else + /* remove storage (format representation) */ + ClockFmtScnStorageDelete(fss); + #endif + } + Tcl_MutexUnlock(&ClockFmtMutex); + } + SetObjClockFmtScn(objPtr, NULL); + SetObjLitStorage(objPtr, NULL); + objPtr->typePtr = NULL; +}; +/* + *---------------------------------------------------------------------- + */ +static int +ClockFmtObj_SetFromAny(interp, objPtr) + Tcl_Interp *interp; + Tcl_Obj *objPtr; +{ + ClockFmtScnStorage *fss; + const char *strFmt = TclGetString(objPtr); + + if (!strFmt || (fss = FindOrCreateFmtScnStorage(interp, strFmt)) == NULL) { + return TCL_ERROR; + } + + if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) + objPtr->typePtr->freeIntRepProc(objPtr); + ClockFmtObj_SetObjIntRep(objPtr, fss, NULL); + return TCL_OK; +}; +/* + *---------------------------------------------------------------------- + */ +static void +ClockFmtObj_UpdateString(objPtr) + Tcl_Obj *objPtr; +{ + char *name = "UNKNOWN"; + int len; + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + + if (fss != NULL) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + name = hPtr->key.string; + } + len = strlen(name); + objPtr->length = len, + objPtr->bytes = ckalloc((size_t)++len); + if (objPtr->bytes) + memcpy(objPtr->bytes, name, len); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetClockFrmScnFromObj -- + * + * Returns a clock format/scan representation of (*objPtr), if possible. + * If something goes wrong, NULL is returned, and if interp is non-NULL, + * an error message is written there. + * + * Results: + * Valid representation of type ClockFmtScnStorage. + * + * Side effects: + * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) + * and in global hash table, shared across all threads. + * + *---------------------------------------------------------------------- + */ + +ClockFmtScnStorage * +Tcl_GetClockFrmScnFromObj( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + ClockFmtScnStorage *fss; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + fss = ObjClockFmtScn(objPtr); + + if (fss == NULL) { + const char *strFmt = TclGetString(objPtr); + fss = FindOrCreateFmtScnStorage(interp, strFmt); + } + + return fss; +} + + +static void +Tcl_GetClockFrmScnFinalize() +{ +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* clear GC */ + ClockFmtScnStorage_GC.stackPtr = NULL; + ClockFmtScnStorage_GC.stackBound = NULL; + ClockFmtScnStorage_GC.count = 0; +#endif + if (initFmtScnHashTable) { + Tcl_DeleteHashTable(&FmtScnHashTable); + } + Tcl_MutexFinalize(&ClockFmtMutex); +} +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclDate.c b/generic/tclDate.c index a31e0fc..389b245 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -570,12 +570,12 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 176, 176, 177, 180, 183, 186, 189, 192, 195, - 198, 202, 207, 210, 216, 222, 230, 236, 247, 251, - 255, 261, 265, 269, 273, 277, 283, 287, 292, 297, - 302, 307, 311, 316, 320, 325, 332, 336, 342, 351, - 360, 370, 384, 389, 392, 395, 398, 401, 404, 409, - 412, 417, 421, 425, 431, 449, 452 + 0, 177, 177, 178, 181, 184, 187, 190, 193, 196, + 199, 203, 208, 211, 217, 223, 231, 237, 248, 252, + 256, 262, 266, 270, 274, 278, 284, 288, 293, 298, + 303, 308, 312, 317, 321, 326, 333, 337, 343, 352, + 361, 371, 385, 390, 393, 396, 399, 402, 405, 410, + 413, 418, 422, 426, 432, 450, 453 }; #endif diff --git a/generic/tclDate.h b/generic/tclDate.h index 6ba9620..c3c362a 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -66,13 +66,55 @@ typedef enum _MERIDIAN { } MERIDIAN; /* + * Clock scan and format facilities. + */ + +#define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 + + +typedef struct ClockFormatToken ClockFormatToken; +typedef struct ClockScanToken ClockScanToken; +typedef struct ClockFmtScnStorage ClockFmtScnStorage; + +typedef struct ClockFormatToken { + ClockFormatToken *nextTok; +} ClockFormatToken; + +typedef struct ClockScanToken { + ClockScanToken *nextTok; +} ClockScanToken; + +typedef struct ClockFmtScnStorage { + int objRefCount; /* Reference count shared across threads */ + ClockScanToken *firstScnTok; + ClockFormatToken *firstFmtTok; +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + ClockFmtScnStorage *nextPtr; + ClockFmtScnStorage *prevPtr; +#endif +/* +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, + * stored by offset +sizeof(self) */ +} ClockFmtScnStorage; + +typedef struct ClockLitStorage { + int dummy; +} ClockLitStorage; + +/* * Prototypes of module functions. */ MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); -MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); +MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); + +/* tclClockFmt.c module declarations */ + +MODULE_SCOPE ClockFmtScnStorage * + Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr); + /* * Other externals. diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index ac781ad..d500d6b 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -9,6 +9,7 @@ * * Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans. * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * Copyright (c) 2015 Sergey G. Brester aka sebres. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 7ef70ce..59469fd 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -25,8 +25,12 @@ proc _test_get_commands {lst} { regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" } -proc test-scan {{rep 100000}} { - foreach c [_test_get_commands { +proc test-scan {{reptime 1000}} { + foreach _(c) [_test_get_commands { + # Scan : date + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + #return + #{**STOP** : Wed Nov 25 01:00:00 CET 2015} # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} # FreeScan : relative date with relative weekday @@ -64,33 +68,37 @@ proc test-scan {{rep 100000}} { clock scan "19:18:30 EST" -base 148863600 } }] { - puts "% [regsub -all {\n[ \t]*} $c {; }]" - if {[regexp {\s*\#} $c]} continue - puts [clock format [if 1 $c] -locale en] - puts [time $c $rep] + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {\s*\#} $_(c)]} continue + puts [clock format [if 1 $_(c)] -locale en] + puts [timerate $_(c) $reptime] puts "" } } -proc test-other {{rep 100000}} { - foreach c [_test_get_commands { +proc test-other {{reptime 1000}} { + foreach _(c) [_test_get_commands { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} + # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 50; time { clock scan "[incr i -1] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} }] { - puts "% [regsub -all {\n[ \t]*} $c {; }]" - if {[regexp {\s*\#} $c]} continue - puts [if 1 $c] - puts [time $c $rep] + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {\s*\#} $_(c)]} continue + puts [if 1 $_(c)] + puts [timerate $_(c) $reptime] puts "" } } -proc test {factor} { +proc test {{reptime 1000}} { puts "" - test-scan [expr 10000 * $factor] - test-other [expr 5000 * $factor] + test-scan $reptime + test-other $reptime puts \n**OK** } -test 20; # 50 +test 250; # 250 ms diff --git a/unix/Makefile.in b/unix/Makefile.in index c4f6136..b220139 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -396,6 +396,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclBinary.c \ $(GENERIC_DIR)/tclCkalloc.c \ $(GENERIC_DIR)/tclClock.c \ + $(GENERIC_DIR)/tclClockFmt.c \ $(GENERIC_DIR)/tclCmdAH.c \ $(GENERIC_DIR)/tclCmdIL.c \ $(GENERIC_DIR)/tclCmdMZ.c \ @@ -1073,6 +1074,9 @@ tclCkalloc.o: $(GENERIC_DIR)/tclCkalloc.c tclClock.o: $(GENERIC_DIR)/tclClock.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclClock.c +tclClockFmt.o: $(GENERIC_DIR)/tclClockFmt.c + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclClockFmt.c + tclCmdAH.o: $(GENERIC_DIR)/tclCmdAH.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclCmdAH.c diff --git a/win/Makefile.in b/win/Makefile.in index e967ef3..82e5516 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -228,6 +228,7 @@ GENERIC_OBJS = \ tclBinary.$(OBJEXT) \ tclCkalloc.$(OBJEXT) \ tclClock.$(OBJEXT) \ + tclClockFmt.$(OBJEXT) \ tclCmdAH.$(OBJEXT) \ tclCmdIL.$(OBJEXT) \ tclCmdMZ.$(OBJEXT) \ diff --git a/win/makefile.vc b/win/makefile.vc index 26ee669..d6dbf85 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -270,6 +270,7 @@ COREOBJS = \ $(TMP_DIR)\tclBinary.obj \ $(TMP_DIR)\tclCkalloc.obj \ $(TMP_DIR)\tclClock.obj \ + $(TMP_DIR)\tclClockFmt.obj \ $(TMP_DIR)\tclCmdAH.obj \ $(TMP_DIR)\tclCmdIL.obj \ $(TMP_DIR)\tclCmdMZ.obj \ -- cgit v0.12 From 5ab3eafa66c83eedbe4da87a549cb83dfa8abac7 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:09:02 +0000 Subject: [temp-commit]: tclClockFmt.c - 2nd try (with cherry picking of tclSE incompatible facilities) Prepared for common usage of scan command (free scan / format scan) --- generic/tclClock.c | 328 +++++++++++++++++++--------------------------- generic/tclClockFmt.c | 117 +++++++++++++++-- generic/tclDate.h | 63 ++++++++- tests-perf/clock.perf.tcl | 4 +- 4 files changed, 297 insertions(+), 215 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index c869cf4..888757f 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -136,29 +136,6 @@ typedef struct ClockClientData { */ } ClockClientData; -/* - * Structure containing the fields used in [clock format] and [clock scan] - */ - -typedef struct TclDateFields { - Tcl_WideInt seconds; /* Time expressed in seconds from the Posix - * epoch */ - Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds - * from the Posix epoch */ - int tzOffset; /* Time zone offset in seconds east of - * Greenwich */ - Tcl_Obj *tzName; /* Time zone name */ - int julianDay; /* Julian Day Number in local time zone */ - enum {BCE=1, CE=0} era; /* Era */ - int gregorian; /* Flag == 1 if the date is Gregorian */ - int year; /* Year of the era */ - int dayOfYear; /* Day of the year (1 January == 1) */ - int month; /* Month number */ - int dayOfMonth; /* Day of the month */ - int iso8601Year; /* ISO8601 week-based year */ - int iso8601Week; /* ISO8601 week number */ - int dayOfWeek; /* Day of the week */ -} TclDateFields; static const char *const eras[] = { "CE", "BCE", NULL }; /* @@ -241,8 +218,8 @@ static int ClockScanObjCmd( int objc, Tcl_Obj *const objv[]); static int ClockFreeScan( ClientData clientData, Tcl_Interp *interp, - Tcl_Obj *strObj, Tcl_WideInt baseVal, - Tcl_Obj *timezoneObj, Tcl_Obj *locale); + register TclDateFields *date, + Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); static struct tm * ThreadSafeLocalTime(const time_t *); static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); @@ -2339,20 +2316,13 @@ ClockMicrosecondsObjCmd( } -typedef struct _ClockFmtScnArgs { - Tcl_Obj *formatObj; /* Format */ - Tcl_Obj *localeObj; /* Locale */ - Tcl_Obj *timezoneObj; /* Timezone */ - Tcl_Obj *baseObj; /* Base (scan only) */ -} _ClockFmtScnArgs; - static int _ClockParseFmtScnArgs( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ - _ClockFmtScnArgs *resOpts, /* Result vector: format, locale, timezone... */ + ClockFmtScnCmdArgs *resOpts, /* Result vector: format, locale, timezone... */ int forScan /* Flag to differentiate between format and scan */ ) { ClockClientData *dataPtr = clientData; @@ -2455,7 +2425,7 @@ ClockParseformatargsObjCmd( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - _ClockFmtScnArgs resOpts; /* Format, locale and timezone */ + ClockFmtScnCmdArgs resOpts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ int ret; @@ -2520,12 +2490,10 @@ ClockScanObjCmd( ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - Tcl_Time retClock; - char *string, *format = NULL; - int gmt, ret = 0; - char *locale; - _ClockFmtScnArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt baseVal; /* Base value */ + int ret; + ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ + Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ + TclDateFields date; /* Date fields used for converting */ if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " @@ -2547,6 +2515,8 @@ ClockScanObjCmd( return ret; } + ret = TCL_ERROR; + if (opts.baseObj != NULL) { if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; @@ -2557,28 +2527,45 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } + date.tzName = NULL; + + /* If time zone not specified use system time zone */ + if ( opts.timezoneObj == NULL + || TclGetString(opts.timezoneObj) == NULL + || opts.timezoneObj->length == 0 + ) { + opts.timezoneObj = ClockGetSystemTimeZone(clientData, interp); + if (opts.timezoneObj == NULL) { + goto done; + } + } + + /* Get the data for time changes in the given zone */ + + opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); + if (opts.timezoneObj == NULL) { + goto done; + } + + /* + * Extract year, month and day from the base time for the parser to use as + * defaults + */ + + date.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); + if (date.tzData == NULL) { + goto done; + } + date.seconds = baseVal; + if (ClockGetDateFields(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + /* If free scan */ if (opts.formatObj == NULL) { -#if 0 - /* Tcled FreeScan proc - */ - Tcl_Obj *callargs[5]; - /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ - if (opts.localeObj != NULL) { - Tcl_SetResult(interp, - "legacy [clock scan] does not support -locale", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); - return TCL_ERROR; - } - callargs[0] = literals[LIT_FREESCAN]; - callargs[1] = objv[1]; - callargs[2] = opts.baseObj != NULL ? opts.baseObj : Tcl_NewWideIntObj(baseVal); - callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : literals[LIT__NIL]; - callargs[4] = opts.localeObj != NULL ? opts.localeObj : literals[LIT_C]; - return Tcl_EvalObjv(interp, 5, callargs, 0); -#else /* Use compiled version of FreeScan - */ - /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { Tcl_SetResult(interp, @@ -2586,21 +2573,9 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - return ClockFreeScan(clientData, interp, objv[1], baseVal, - opts.timezoneObj, opts.localeObj); -#endif - } - - - // **** - string = TclGetString(objv[1]); - // **** timezone = ClockGetSystemTimeZone(clientData, interp) - /* - if (timezoneObj == NULL) { - goto done; - } - */ - + ret = ClockFreeScan(clientData, interp, &date, objv[1], &opts); + } + else if (0) { /* TODO: Tcled Scan proc - */ int ret; @@ -2612,19 +2587,45 @@ ClockScanObjCmd( Tcl_DecrRefCount(callargs[0]); return ret; } + else { + /* Use compiled version of Scan - */ + + ret = ClockScan(clientData, interp, &date, objv[1], &opts); + } - if (1) { + if (ret != TCL_OK) { + goto done; + } - ClockFmtScnStorage * fss; - if ((fss = Tcl_GetClockFrmScnFromObj(interp, opts.formatObj)) == NULL) { - return TCL_ERROR; - }; + /* If needed assemble julianDay using new year, month, etc. */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + + /* Local seconds to UTC (stored in date.seconds) */ - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + date.localSeconds = + -210866803200L + + ( 86400 * (Tcl_WideInt)date.julianDay ) + + ( date.secondOfDay % 86400 ); + if (ConvertLocalToUTC(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; } - + + ret = TCL_OK; + +done: + + Tcl_UnsetObjRef(date.tzName); + + if (ret != TCL_OK) { + return ret; + } + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(date.seconds)); return TCL_OK; } @@ -2634,57 +2635,17 @@ int ClockFreeScan( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ + register + TclDateFields *date, /* Date fields used for converting */ Tcl_Obj *strObj, /* String containing the time to scan */ - Tcl_WideInt baseVal, /* Base time, expressed in seconds from the Epoch */ - Tcl_Obj *timezoneObj, /* Default time zone in which the time will be expressed */ - Tcl_Obj *locale) /* (Unused) Name of the locale where the time will be scanned. */ + ClockFmtScnCmdArgs *opts) /* Command options */ { - enum Flags {CL_INVALIDATE = (signed int)0x80000000}; - ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; DateInfo yy; /* parse structure of TclClockFreeScan */ - TclDateFields date; /* date fields used for converting from seconds */ - Tcl_Obj *tzdata; - int secondOfDay; /* Seconds of day (time only calculation) */ - Tcl_WideInt seconds; int ret = TCL_ERROR; - date.tzName = NULL; - - /* If time zone not specified use system time zone */ - if (timezoneObj == NULL || - TclGetString(timezoneObj) == NULL || timezoneObj->length == 0) { - timezoneObj = ClockGetSystemTimeZone(clientData, interp); - if (timezoneObj == NULL) { - goto done; - } - } - - /* Get the data for time changes in the given zone */ - - timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); - if (timezoneObj == NULL) { - goto done; - } - - /* - * Extract year, month and day from the base time for the parser to use as - * defaults - */ - - tzdata = ClockGetTZData(clientData, interp, timezoneObj); - if (tzdata == NULL) { - goto done; - } - date.seconds = baseVal; - if (ClockGetDateFields(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - - secondOfDay = date.localSeconds % 86400; /* * Parse the date. The parser will fill a structure "yy" with date, time, @@ -2692,9 +2653,9 @@ ClockFreeScan( */ yy.dateInput = Tcl_GetString(strObj); - yy.dateYear = date.year; - yy.dateMonth = date.month; - yy.dateDay = date.dayOfMonth; + yy.dateYear = date->year; + yy.dateMonth = date->month; + yy.dateDay = date->dayOfMonth; if (TclClockFreeScan(interp, &yy) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); @@ -2717,10 +2678,10 @@ ClockFreeScan( } yy.dateYear += ClockCurrentYearCentury(clientData, interp); } - date.era = CE; - date.year = yy.dateYear; - date.month = yy.dateMonth; - date.dayOfMonth = yy.dateDay; + date->era = CE; + date->year = yy.dateYear; + date->month = yy.dateMonth; + date->dayOfMonth = yy.dateDay; if (yy.dateHaveTime == 0) { yy.dateHaveTime = -1; } @@ -2738,34 +2699,34 @@ ClockFreeScan( tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); - if (tzObjStor != timezoneObj) { + opts->timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); + if (tzObjStor != opts->timezoneObj) { Tcl_DecrRefCount(tzObjStor); } - if (timezoneObj == NULL) { + if (opts->timezoneObj == NULL) { goto done; } - tzdata = ClockGetTZData(clientData, interp, timezoneObj); - if (tzdata == NULL) { + date->tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); + if (date->tzData == NULL) { goto done; } } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date.julianDay = CL_INVALIDATE; + date->julianDay = CL_INVALIDATE; /* * Assemble date, time, zone into seconds-from-epoch */ - Tcl_SetObjRef(date.tzName, timezoneObj); + Tcl_SetObjRef(date->tzName, opts->timezoneObj); if (yy.dateHaveTime == -1) { - secondOfDay = 0; + date->secondOfDay = 0; } else if (yy.dateHaveTime) { - secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, + date->secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, yy.dateSeconds, yy.dateMeridian); } else @@ -2775,7 +2736,10 @@ ClockFreeScan( && ( yy.dateRelMonth != 0 || yy.dateRelDay != 0 ) ) ) { - secondOfDay = 0; + date->secondOfDay = 0; + } + else { + date->secondOfDay = date->localSeconds % 86400; } /* @@ -2792,26 +2756,26 @@ repeat_rel: int m, h; /* if needed extract year, month, etc. again */ - if (date.month == CL_INVALIDATE) { - GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); - GetMonthDay(&date); - GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + if (date->month == CL_INVALIDATE) { + GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); + GetMonthDay(date); + GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); } /* add the requisite number of months */ - date.month += yy.dateRelMonth - 1; - date.year += date.month / 12; - m = date.month % 12; - date.month = m + 1; + date->month += yy.dateRelMonth - 1; + date->year += date->month / 12; + m = date->month % 12; + date->month = m + 1; /* if the day doesn't exist in the current month, repair it */ - h = hath[IsGregorianLeapYear(&date)][m]; - if (date.dayOfMonth > h) { - date.dayOfMonth = h; + h = hath[IsGregorianLeapYear(date)][m]; + if (date->dayOfMonth > h) { + date->dayOfMonth = h; } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date.julianDay = CL_INVALIDATE; + date->julianDay = CL_INVALIDATE; yy.dateRelMonth = 0; } @@ -2820,19 +2784,19 @@ repeat_rel: if (yy.dateRelDay) { /* assemble julianDay using new year, month, etc. */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + if (date->julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); } - date.julianDay += yy.dateRelDay; + date->julianDay += yy.dateRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - date.month = CL_INVALIDATE; + date->month = CL_INVALIDATE; yy.dateRelDay = 0; } /* relative time (seconds) */ - secondOfDay += yy.dateRelSeconds; + date->secondOfDay += yy.dateRelSeconds; yy.dateRelSeconds = 0; } @@ -2845,20 +2809,20 @@ repeat_rel: int monthDiff; /* if needed extract year, month, etc. again */ - if (date.month == CL_INVALIDATE) { - GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); - GetMonthDay(&date); - GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + if (date->month == CL_INVALIDATE) { + GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); + GetMonthDay(date); + GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); } if (yy.dateMonthOrdinal > 0) { - monthDiff = yy.dateMonth - date.month; + monthDiff = yy.dateMonth - date->month; if (monthDiff <= 0) { monthDiff += 12; } yy.dateMonthOrdinal--; } else { - monthDiff = date.month - yy.dateMonth; + monthDiff = date->month - yy.dateMonth; if (monthDiff >= 0) { monthDiff -= 12; } @@ -2867,7 +2831,7 @@ repeat_rel: /* process it further via relative times */ yy.dateHaveRel++; - date.year += yy.dateMonthOrdinal; + date->year += yy.dateMonthOrdinal; yy.dateRelMonth += monthDiff; yy.dateHaveOrdinalMonth = 0; @@ -2881,48 +2845,24 @@ repeat_rel: if (yy.dateHaveDay && !yy.dateHaveDate) { /* if needed assemble julianDay now */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + if (date->julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); } - date.era = CE; - date.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date.julianDay + 6) + date->era = CE; + date->julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date->julianDay + 6) + 7 * yy.dateDayOrdinal; if (yy.dateDayOrdinal > 0) { - date.julianDay -= 7; + date->julianDay -= 7; } } - /* If needed assemble julianDay using new year, month, etc. */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); - } - - /* Local seconds to UTC */ - - date.localSeconds = - -210866803200L - + ( 86400 * (Tcl_WideInt)date.julianDay ) - + ( secondOfDay % 86400 ); - - if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - - seconds = date.seconds; + /* Free scanning completed - date ready */ ret = TCL_OK; done: - Tcl_UnsetObjRef(date.tzName); - - if (ret != TCL_OK) { - return ret; - } - - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(seconds)); return TCL_OK; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index fa89dde..356965d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -35,8 +35,6 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); * Clock scan and format facilities. */ -#define TOK_CHAIN_BLOCK_SIZE 8 - /* *---------------------------------------------------------------------- */ @@ -139,16 +137,16 @@ ClockFmtScnStorageFreeProc( Tcl_HashEntry *hPtr) { ClockFmtScnStorage *fss = FmtScn4HashEntry(hPtr); - ClockScanToken *tok; - - tok = fss->firstScnTok; - while (tok != NULL) { - if (tok->nextTok == tok + 1) { - tok++; - /*****************************/ - } else { - tok = tok->nextTok; - } + + if (fss->scnTok != NULL) { + ckfree(fss->scnTok); + fss->scnTok = NULL; + fss->scnTokC = 0; + } + if (fss->fmtTok != NULL) { + ckfree(fss->fmtTok); + fss->fmtTok = NULL; + fss->fmtTokC = 0; } ckfree(fss); @@ -394,6 +392,101 @@ Tcl_GetClockFrmScnFromObj( } +#define AllocTokenInChain(tok, chain, tokC) \ + if ((tok) >= (chain) + (tokC)) { \ + (char *)(chain) = ckrealloc((char *)(chain), \ + (tokC) + sizeof((**(tok))) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); \ + if ((chain) == NULL) { return NULL; }; \ + (tok) = (chain) + (tokC); \ + (tokC) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } + +const char *ScnSTokenChars = "dmyYHMS"; +static ClockScanToken ScnSTokens[] = { + {CTOKT_DIGIT, 1, 2, 0}, +}; + +/* + *---------------------------------------------------------------------- + */ +ClockScanToken ** +ClockGetOrParseScanFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockScanToken **tok; + + if (formatObj->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, formatObj) != TCL_OK) { + return NULL; + } + } + + fss = ObjClockFmtScn(formatObj); + + if (fss == NULL) { + fss = FindOrCreateFmtScnStorage(interp, TclGetString(formatObj)); + if (fss == NULL) { + return NULL; + } + } + + /* if first time scanning - tokenize format */ + if (fss->scnTok == NULL) { + const char *strFmt; + register const char *p, *e; + + fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; + fss->scnTok = + tok = ckalloc(sizeof(**tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); + (*tok)->type = CTOKT_EOB; + strFmt = TclGetString(formatObj); + for (e = p = strFmt, e += formatObj->length; p != e; p++) { + switch (*p) { + case '%': + if (p+1 >= e) + goto word_tok; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; + // *tok = + break; + case ' ': + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + // *tok = + break; + default: +word_tok: + break; + } + } + } + + return fss->scnTok; +} + +/* + *---------------------------------------------------------------------- + */ +int +ClockScan( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + TclDateFields *date, /* Date fields used for converting */ + Tcl_Obj *strObj, /* String containing the time to scan */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockScanToken **tok; + + if (ClockGetOrParseScanFormat(interp, opts->formatObj) == NULL) { + return TCL_ERROR; + } + + // Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + return TCL_ERROR; +} + + static void Tcl_GetClockFrmScnFinalize() { diff --git a/generic/tclDate.h b/generic/tclDate.h index c3c362a..0329b2c 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -57,6 +57,44 @@ typedef struct DateInfo { } DateInfo; +enum {CL_INVALIDATE = (signed int)0x80000000}; +/* + * Structure containing the command arguments supplied to [clock format] and [clock scan] + */ + +typedef struct ClockFmtScnCmdArgs { + Tcl_Obj *formatObj; /* Format */ + Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ + Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ + Tcl_Obj *baseObj; /* Base (scan only) */ +} ClockFmtScnCmdArgs; + +/* + * Structure containing the fields used in [clock format] and [clock scan] + */ + +typedef struct TclDateFields { + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix + * epoch */ + Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds + * from the Posix epoch */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ + int tzOffset; /* Time zone offset in seconds east of + * Greenwich */ + Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ + Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ + int julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ +} TclDateFields; + /* * Meridian: am, pm, or 24-hour style. */ @@ -71,23 +109,31 @@ typedef enum _MERIDIAN { #define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 +#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 12 + +typedef enum _CLCKTOK_TYPE { + CTOKT_EOB=0, CTOKT_DIGIT, CTOKT_SPACE +} CLCKTOK_TYPE; -typedef struct ClockFormatToken ClockFormatToken; -typedef struct ClockScanToken ClockScanToken; typedef struct ClockFmtScnStorage ClockFmtScnStorage; typedef struct ClockFormatToken { - ClockFormatToken *nextTok; + CLCKTOK_TYPE type; } ClockFormatToken; typedef struct ClockScanToken { - ClockScanToken *nextTok; + unsigned short int type; + unsigned short int minSize; + unsigned short int maxSize; + unsigned short int offs; } ClockScanToken; typedef struct ClockFmtScnStorage { - int objRefCount; /* Reference count shared across threads */ - ClockScanToken *firstScnTok; - ClockFormatToken *firstFmtTok; + int objRefCount; /* Reference count shared across threads */ + ClockScanToken **scnTok; + unsigned int scnTokC; + ClockFormatToken **fmtTok; + unsigned int fmtTokC; #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 ClockFmtScnStorage *nextPtr; ClockFmtScnStorage *prevPtr; @@ -115,6 +161,9 @@ MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); +MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, + TclDateFields *date, Tcl_Obj *strObj, + ClockFmtScnCmdArgs *opts); /* * Other externals. diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 59469fd..7994428 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -28,8 +28,7 @@ proc _test_get_commands {lst} { proc test-scan {{reptime 1000}} { foreach _(c) [_test_get_commands { # Scan : date - {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} - #return + #{clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} #{**STOP** : Wed Nov 25 01:00:00 CET 2015} # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} @@ -80,6 +79,7 @@ proc test-other {{reptime 1000}} { foreach _(c) [_test_get_commands { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + **STOP** # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) -- cgit v0.12 From 898bc97bbea9601d6d2a7ac526e14e9a3b540362 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:10:44 +0000 Subject: [temp-commit]: tclClockFmt.c - amend for 2nd try (with cherry picking of tclSE incompatible facilities) Prepared for common usage of both scan commands - free scan / scan with format (currently faked via eval to __org_scan); test cases passed. --- generic/tclClock.c | 218 +++++++++++++++++++++++++-------------------------- generic/tclDate.c | 51 +++--------- generic/tclDate.h | 93 ++++++++++++++-------- generic/tclGetDate.y | 39 ++------- 4 files changed, 189 insertions(+), 212 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 888757f..3c296b5 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -218,7 +218,7 @@ static int ClockScanObjCmd( int objc, Tcl_Obj *const objv[]); static int ClockFreeScan( ClientData clientData, Tcl_Interp *interp, - register TclDateFields *date, + register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); static struct tm * ThreadSafeLocalTime(const time_t *); static unsigned long TzsetGetEpoch(void); @@ -2492,8 +2492,9 @@ ClockScanObjCmd( int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ - TclDateFields date; /* Date fields used for converting */ + Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ + DateInfo yy; /* Common structure used for parsing */ + DateInfo *info = &yy; if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " @@ -2527,7 +2528,7 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - date.tzName = NULL; + yydate.tzName = NULL; /* If time zone not specified use system time zone */ if ( opts.timezoneObj == NULL @@ -2552,12 +2553,12 @@ ClockScanObjCmd( * defaults */ - date.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); - if (date.tzData == NULL) { + yydate.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); + if (yydate.tzData == NULL) { goto done; } - date.seconds = baseVal; - if (ClockGetDateFields(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + yydate.seconds = baseVal; + if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } @@ -2573,10 +2574,10 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - ret = ClockFreeScan(clientData, interp, &date, objv[1], &opts); + ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } else - if (0) { + if (1) { /* TODO: Tcled Scan proc - */ int ret; Tcl_Obj *callargs[10]; @@ -2585,12 +2586,12 @@ ClockScanObjCmd( Tcl_IncrRefCount(callargs[0]); ret = Tcl_EvalObjv(interp, objc, callargs, 0); Tcl_DecrRefCount(callargs[0]); - return ret; + return ret; } else { /* Use compiled version of Scan - */ - ret = ClockScan(clientData, interp, &date, objv[1], &opts); + ret = ClockScan(clientData, interp, &yydate, objv[1], &opts); } if (ret != TCL_OK) { @@ -2599,18 +2600,18 @@ ClockScanObjCmd( /* If needed assemble julianDay using new year, month, etc. */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + if (yydate.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - /* Local seconds to UTC (stored in date.seconds) */ + /* Local seconds to UTC (stored in yydate.seconds) */ - date.localSeconds = + yydate.localSeconds = -210866803200L - + ( 86400 * (Tcl_WideInt)date.julianDay ) - + ( date.secondOfDay % 86400 ); + + ( 86400 * (Tcl_WideInt)yydate.julianDay ) + + ( yySeconds % 86400 ); - if (ConvertLocalToUTC(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + if (ConvertLocalToUTC(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } @@ -2619,13 +2620,13 @@ ClockScanObjCmd( done: - Tcl_UnsetObjRef(date.tzName); + Tcl_UnsetObjRef(yydate.tzName); if (ret != TCL_OK) { return ret; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(date.seconds)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yydate.seconds)); return TCL_OK; } @@ -2636,28 +2637,28 @@ ClockFreeScan( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ register - TclDateFields *date, /* Date fields used for converting */ + DateInfo *info, /* Date fields used for parsing & converting + * simultaneously a yy-parse structure of the + * TclClockFreeScan */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; + // ClockClientData *dataPtr = clientData; + // Tcl_Obj **literals = dataPtr->literals; - DateInfo yy; /* parse structure of TclClockFreeScan */ int ret = TCL_ERROR; - /* - * Parse the date. The parser will fill a structure "yy" with date, time, - * time zone, relative month/day/seconds, relative weekday, ordinal month. + * Parse the date. The parser will fill a structure "info" with date, + * time, time zone, relative month/day/seconds, relative weekday, ordinal + * month. + * Notice that many yy-defines point to values in the "info" or "date" + * structure, e. g. yySeconds -> info->date.secondOfDay or + * yySeconds -> info->date.month (same as yydate.month) */ - yy.dateInput = Tcl_GetString(strObj); + yyInput = Tcl_GetString(strObj); - yy.dateYear = date->year; - yy.dateMonth = date->month; - yy.dateDay = date->dayOfMonth; - - if (TclClockFreeScan(interp, &yy) != TCL_OK) { + if (TclClockFreeScan(interp, info) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", Tcl_GetString(strObj), TclGetString(Tcl_GetObjResult(interp))); @@ -2671,19 +2672,16 @@ ClockFreeScan( * midnight. */ - if (yy.dateHaveDate) { - if (yy.dateYear < 100) { - if (yy.dateYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { - yy.dateYear -= 100; + if (yyHaveDate) { + if (yyYear < 100) { + if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { + yyYear -= 100; } - yy.dateYear += ClockCurrentYearCentury(clientData, interp); + yyYear += ClockCurrentYearCentury(clientData, interp); } - date->era = CE; - date->year = yy.dateYear; - date->month = yy.dateMonth; - date->dayOfMonth = yy.dateDay; - if (yy.dateHaveTime == 0) { - yy.dateHaveTime = -1; + yydate.era = CE; + if (yyHaveTime == 0) { + yyHaveTime = -1; } } @@ -2692,10 +2690,10 @@ ClockFreeScan( * zone indicator of +-hhmm and setup this time zone. */ - if (yy.dateHaveZone) { + if (yyHaveZone) { Tcl_Obj *tzObjStor = NULL; - int minEast = -yy.dateTimezone; - int dstFlag = 1 - yy.dateDSTmode; + int minEast = -yyTimezone; + int dstFlag = 1 - yyDSTmode; tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); @@ -2706,40 +2704,40 @@ ClockFreeScan( if (opts->timezoneObj == NULL) { goto done; } - date->tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); - if (date->tzData == NULL) { + yydate.tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); + if (yydate.tzData == NULL) { goto done; } } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date->julianDay = CL_INVALIDATE; + yydate.julianDay = CL_INVALIDATE; /* * Assemble date, time, zone into seconds-from-epoch */ - Tcl_SetObjRef(date->tzName, opts->timezoneObj); + Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); - if (yy.dateHaveTime == -1) { - date->secondOfDay = 0; + if (yyHaveTime == -1) { + yySeconds = 0; } else - if (yy.dateHaveTime) { - date->secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, - yy.dateSeconds, yy.dateMeridian); + if (yyHaveTime) { + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); } else - if ( (yy.dateHaveDay && !yy.dateHaveDate) - || yy.dateHaveOrdinalMonth - || ( yy.dateHaveRel - && ( yy.dateRelMonth != 0 - || yy.dateRelDay != 0 ) ) + if ( (yyHaveDay && !yyHaveDate) + || yyHaveOrdinalMonth + || ( yyHaveRel + && ( yyRelMonth != 0 + || yyRelDay != 0 ) ) ) { - date->secondOfDay = 0; + yySeconds = 0; } else { - date->secondOfDay = date->localSeconds % 86400; + yySeconds = yydate.localSeconds % 86400; } /* @@ -2748,56 +2746,56 @@ ClockFreeScan( repeat_rel: - if (yy.dateHaveRel) { + if (yyHaveRel) { /* add months (or years in months) */ - if (yy.dateRelMonth != 0) { + if (yyRelMonth != 0) { int m, h; /* if needed extract year, month, etc. again */ - if (date->month == CL_INVALIDATE) { - GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); - GetMonthDay(date); - GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); + if (yyMonth == CL_INVALIDATE) { + GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + GetMonthDay(&yydate); + GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); } /* add the requisite number of months */ - date->month += yy.dateRelMonth - 1; - date->year += date->month / 12; - m = date->month % 12; - date->month = m + 1; + yyMonth += yyRelMonth - 1; + yyYear += yyMonth / 12; + m = yyMonth % 12; + yyMonth = m + 1; /* if the day doesn't exist in the current month, repair it */ - h = hath[IsGregorianLeapYear(date)][m]; - if (date->dayOfMonth > h) { - date->dayOfMonth = h; + h = hath[IsGregorianLeapYear(&yydate)][m]; + if (yyDay > h) { + yyDay = h; } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date->julianDay = CL_INVALIDATE; + yydate.julianDay = CL_INVALIDATE; - yy.dateRelMonth = 0; + yyRelMonth = 0; } /* add days (or other parts aligned to days) */ - if (yy.dateRelDay) { + if (yyRelDay) { /* assemble julianDay using new year, month, etc. */ - if (date->julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); + if (yydate.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - date->julianDay += yy.dateRelDay; + yydate.julianDay += yyRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - date->month = CL_INVALIDATE; + yyMonth = CL_INVALIDATE; - yy.dateRelDay = 0; + yyRelDay = 0; } /* relative time (seconds) */ - date->secondOfDay += yy.dateRelSeconds; - yy.dateRelSeconds = 0; + yySeconds += yyRelSeconds; + yyRelSeconds = 0; } @@ -2805,35 +2803,35 @@ repeat_rel: * Do relative (ordinal) month */ - if (yy.dateHaveOrdinalMonth) { + if (yyHaveOrdinalMonth) { int monthDiff; /* if needed extract year, month, etc. again */ - if (date->month == CL_INVALIDATE) { - GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); - GetMonthDay(date); - GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); + if (yyMonth == CL_INVALIDATE) { + GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + GetMonthDay(&yydate); + GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); } - if (yy.dateMonthOrdinal > 0) { - monthDiff = yy.dateMonth - date->month; + if (yyMonthOrdinalIncr > 0) { + monthDiff = yyMonthOrdinal - yyMonth; if (monthDiff <= 0) { monthDiff += 12; } - yy.dateMonthOrdinal--; + yyMonthOrdinalIncr--; } else { - monthDiff = date->month - yy.dateMonth; + monthDiff = yyMonth - yyMonthOrdinal; if (monthDiff >= 0) { monthDiff -= 12; } - yy.dateMonthOrdinal++; + yyMonthOrdinalIncr++; } /* process it further via relative times */ - yy.dateHaveRel++; - date->year += yy.dateMonthOrdinal; - yy.dateRelMonth += monthDiff; - yy.dateHaveOrdinalMonth = 0; + yyHaveRel++; + yyYear += yyMonthOrdinalIncr; + yyRelMonth += monthDiff; + yyHaveOrdinalMonth = 0; goto repeat_rel; } @@ -2842,18 +2840,18 @@ repeat_rel: * Do relative weekday */ - if (yy.dateHaveDay && !yy.dateHaveDate) { + if (yyHaveDay && !yyHaveDate) { /* if needed assemble julianDay now */ - if (date->julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); + if (yydate.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - date->era = CE; - date->julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date->julianDay + 6) - + 7 * yy.dateDayOrdinal; - if (yy.dateDayOrdinal > 0) { - date->julianDay -= 7; + yydate.era = CE; + yydate.julianDay = WeekdayOnOrBefore(yyDayNumber, yydate.julianDay + 6) + + 7 * yyDayOrdinal; + if (yyDayOrdinal > 0) { + yydate.julianDay -= 7; } } @@ -2863,7 +2861,7 @@ repeat_rel: done: - return TCL_OK; + return ret; } /*---------------------------------------------------------------------- diff --git a/generic/tclDate.c b/generic/tclDate.c index 389b245..a47f43d 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -109,31 +109,6 @@ #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) -#define yyDSTmode (info->dateDSTmode) -#define yyDayOrdinal (info->dateDayOrdinal) -#define yyDayNumber (info->dateDayNumber) -#define yyMonthOrdinal (info->dateMonthOrdinal) -#define yyHaveDate (info->dateHaveDate) -#define yyHaveDay (info->dateHaveDay) -#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) -#define yyHaveRel (info->dateHaveRel) -#define yyHaveTime (info->dateHaveTime) -#define yyHaveZone (info->dateHaveZone) -#define yyTimezone (info->dateTimezone) -#define yyDay (info->dateDay) -#define yyMonth (info->dateMonth) -#define yyYear (info->dateYear) -#define yyHour (info->dateHour) -#define yyMinutes (info->dateMinutes) -#define yySeconds (info->dateSeconds) -#define yyMeridian (info->dateMeridian) -#define yyRelMonth (info->dateRelMonth) -#define yyRelDay (info->dateRelDay) -#define yyRelSeconds (info->dateRelSeconds) -#define yyRelPointer (info->dateRelPointer) -#define yyInput (info->dateInput) -#define yyDigitCount (info->dateDigitCount) - #define EPOCH 1970 #define START_OF_TIME 1902 #define END_OF_TIME 2037 @@ -570,12 +545,12 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 177, 177, 178, 181, 184, 187, 190, 193, 196, - 199, 203, 208, 211, 217, 223, 231, 237, 248, 252, - 256, 262, 266, 270, 274, 278, 284, 288, 293, 298, - 303, 308, 312, 317, 321, 326, 333, 337, 343, 352, - 361, 371, 385, 390, 393, 396, 399, 402, 405, 410, - 413, 418, 422, 426, 432, 450, 453 + 0, 152, 152, 153, 156, 159, 162, 165, 168, 171, + 174, 178, 183, 186, 192, 198, 206, 212, 223, 227, + 231, 237, 241, 245, 249, 253, 259, 263, 268, 273, + 278, 283, 287, 292, 296, 301, 308, 312, 318, 327, + 336, 346, 360, 365, 368, 371, 374, 377, 380, 385, + 388, 393, 397, 401, 407, 425, 428 }; #endif @@ -1842,16 +1817,16 @@ yyreduce: case 36: { - yyMonthOrdinal = 1; - yyMonth = (yyvsp[(2) - (2)].Number); + yyMonthOrdinalIncr = 1; + yyMonthOrdinal = (yyvsp[(2) - (2)].Number); ;} break; case 37: { - yyMonthOrdinal = (yyvsp[(2) - (3)].Number); - yyMonth = (yyvsp[(3) - (3)].Number); + yyMonthOrdinalIncr = (yyvsp[(2) - (3)].Number); + yyMonthOrdinal = (yyvsp[(3) - (3)].Number); ;} break; @@ -2722,7 +2697,7 @@ TclClockFreeScan( yyTimezone = 0; yyDSTmode = DSTmaybe; yyHaveOrdinalMonth = 0; - yyMonthOrdinal = 0; + yyMonthOrdinalIncr = 0; yyHaveDay = 0; yyDayOrdinal = 0; yyDayNumber = 0; @@ -2873,9 +2848,9 @@ TclClockOldscanObjCmd( resultElement = Tcl_NewObj(); if (yyHaveOrdinalMonth) { Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonthOrdinal)); + Tcl_NewIntObj((int) yyMonthOrdinalIncr)); Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonth)); + Tcl_NewIntObj((int) yyMonthOrdinal)); } Tcl_ListObjAppendElement(interp, result, resultElement); diff --git a/generic/tclDate.h b/generic/tclDate.h index 0329b2c..49420a2 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -14,19 +14,43 @@ #define _TCLCLOCK_H /* + * Structure containing the fields used in [clock format] and [clock scan] + */ + +typedef struct TclDateFields { + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix + * epoch */ + Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds + * from the Posix epoch */ + int tzOffset; /* Time zone offset in seconds east of + * Greenwich */ + Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ + Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ + int julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ + int hour; /* Hours of day (in-between time only calculation) */ + int minutes; /* Minutes of day (in-between time only calculation) */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ +} TclDateFields; + +/* * Structure contains return parsed fields. */ typedef struct DateInfo { - time_t dateYear; - time_t dateMonth; - time_t dateDay; + TclDateFields date; + int dateHaveDate; - time_t dateHour; - time_t dateMinutes; - time_t dateSeconds; int dateMeridian; int dateHaveTime; @@ -39,6 +63,7 @@ typedef struct DateInfo { time_t dateRelSeconds; int dateHaveRel; + time_t dateMonthOrdinalIncr; time_t dateMonthOrdinal; int dateHaveOrdinalMonth; @@ -56,6 +81,36 @@ typedef struct DateInfo { const char* separatrix; /* String separating messages */ } DateInfo; +#define yydate (info->date) /* Date fields used for converting */ + +#define yyDay (info->date.dayOfMonth) +#define yyMonth (info->date.month) +#define yyYear (info->date.year) + +#define yyHour (info->date.hour) +#define yyMinutes (info->date.minutes) +#define yySeconds (info->date.secondOfDay) + +#define yyDSTmode (info->dateDSTmode) +#define yyDayOrdinal (info->dateDayOrdinal) +#define yyDayNumber (info->dateDayNumber) +#define yyMonthOrdinalIncr (info->dateMonthOrdinalIncr) +#define yyMonthOrdinal (info->dateMonthOrdinal) +#define yyHaveDate (info->dateHaveDate) +#define yyHaveDay (info->dateHaveDay) +#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) +#define yyHaveRel (info->dateHaveRel) +#define yyHaveTime (info->dateHaveTime) +#define yyHaveZone (info->dateHaveZone) +#define yyTimezone (info->dateTimezone) +#define yyMeridian (info->dateMeridian) +#define yyRelMonth (info->dateRelMonth) +#define yyRelDay (info->dateRelDay) +#define yyRelSeconds (info->dateRelSeconds) +#define yyRelPointer (info->dateRelPointer) +#define yyInput (info->dateInput) +#define yyDigitCount (info->dateDigitCount) + enum {CL_INVALIDATE = (signed int)0x80000000}; /* @@ -70,32 +125,6 @@ typedef struct ClockFmtScnCmdArgs { } ClockFmtScnCmdArgs; /* - * Structure containing the fields used in [clock format] and [clock scan] - */ - -typedef struct TclDateFields { - Tcl_WideInt seconds; /* Time expressed in seconds from the Posix - * epoch */ - Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds - * from the Posix epoch */ - int secondOfDay; /* Seconds of day (in-between time only calculation) */ - int tzOffset; /* Time zone offset in seconds east of - * Greenwich */ - Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ - Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ - int julianDay; /* Julian Day Number in local time zone */ - enum {BCE=1, CE=0} era; /* Era */ - int gregorian; /* Flag == 1 if the date is Gregorian */ - int year; /* Year of the era */ - int dayOfYear; /* Day of the year (1 January == 1) */ - int month; /* Month number */ - int dayOfMonth; /* Day of the month */ - int iso8601Year; /* ISO8601 week-based year */ - int iso8601Week; /* ISO8601 week number */ - int dayOfWeek; /* Day of the week */ -} TclDateFields; - -/* * Meridian: am, pm, or 24-hour style. */ diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index d500d6b..571b7df 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -56,31 +56,6 @@ #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) -#define yyDSTmode (info->dateDSTmode) -#define yyDayOrdinal (info->dateDayOrdinal) -#define yyDayNumber (info->dateDayNumber) -#define yyMonthOrdinal (info->dateMonthOrdinal) -#define yyHaveDate (info->dateHaveDate) -#define yyHaveDay (info->dateHaveDay) -#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) -#define yyHaveRel (info->dateHaveRel) -#define yyHaveTime (info->dateHaveTime) -#define yyHaveZone (info->dateHaveZone) -#define yyTimezone (info->dateTimezone) -#define yyDay (info->dateDay) -#define yyMonth (info->dateMonth) -#define yyYear (info->dateYear) -#define yyHour (info->dateHour) -#define yyMinutes (info->dateMinutes) -#define yySeconds (info->dateSeconds) -#define yyMeridian (info->dateMeridian) -#define yyRelMonth (info->dateRelMonth) -#define yyRelDay (info->dateRelDay) -#define yyRelSeconds (info->dateRelSeconds) -#define yyRelPointer (info->dateRelPointer) -#define yyInput (info->dateInput) -#define yyDigitCount (info->dateDigitCount) - #define EPOCH 1970 #define START_OF_TIME 1902 #define END_OF_TIME 2037 @@ -331,12 +306,12 @@ date : tUNUMBER '/' tUNUMBER { ; ordMonth: tNEXT tMONTH { - yyMonthOrdinal = 1; - yyMonth = $2; + yyMonthOrdinalIncr = 1; + yyMonthOrdinal = $2; } | tNEXT tUNUMBER tMONTH { - yyMonthOrdinal = $2; - yyMonth = $3; + yyMonthOrdinalIncr = $2; + yyMonthOrdinal = $3; } ; @@ -933,7 +908,7 @@ TclClockFreeScan( yyTimezone = 0; yyDSTmode = DSTmaybe; yyHaveOrdinalMonth = 0; - yyMonthOrdinal = 0; + yyMonthOrdinalIncr = 0; yyHaveDay = 0; yyDayOrdinal = 0; yyDayNumber = 0; @@ -1084,9 +1059,9 @@ TclClockOldscanObjCmd( resultElement = Tcl_NewObj(); if (yyHaveOrdinalMonth) { Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonthOrdinal)); + Tcl_NewIntObj((int) yyMonthOrdinalIncr)); Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonth)); + Tcl_NewIntObj((int) yyMonthOrdinal)); } Tcl_ListObjAppendElement(interp, result, resultElement); -- cgit v0.12 From aba1f29686731df92a81ca76ce22cd65601f4070 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:12:07 +0000 Subject: [temp-commit]: rewrite scan token map handling --- generic/tclClock.c | 2 + generic/tclClockFmt.c | 102 ++++++++++++++++++++++++++++++++++++---------- tests-perf/clock.perf.tcl | 12 +++++- 3 files changed, 93 insertions(+), 23 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 3c296b5..e00d6a2 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2576,6 +2576,7 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } +#if 0 else if (1) { /* TODO: Tcled Scan proc - */ @@ -2588,6 +2589,7 @@ ClockScanObjCmd( Tcl_DecrRefCount(callargs[0]); return ret; } +#endif else { /* Use compiled version of Scan - */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 356965d..93416af 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -392,19 +392,32 @@ Tcl_GetClockFrmScnFromObj( } -#define AllocTokenInChain(tok, chain, tokC) \ - if ((tok) >= (chain) + (tokC)) { \ +#define AllocTokenInChain(tok, chain, tokCnt) \ + if (++(tok) >= (chain) + (tokCnt)) { \ (char *)(chain) = ckrealloc((char *)(chain), \ - (tokC) + sizeof((**(tok))) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); \ - if ((chain) == NULL) { return NULL; }; \ - (tok) = (chain) + (tokC); \ - (tokC) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ - } - -const char *ScnSTokenChars = "dmyYHMS"; -static ClockScanToken ScnSTokens[] = { + (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ + if ((chain) == NULL) { goto done; }; \ + (tok) = (chain) + (tokCnt); \ + (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } \ + *(tok) = NULL; + +const char *ScnSTokenMapChars = + "dmyYHMS"; +static ClockScanToken ScnSTokenMap[] = { + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 4, 0}, + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 2, 0}, {CTOKT_DIGIT, 1, 2, 0}, }; +const char *ScnSpecTokenMapChars = + " %"; +static ClockScanToken ScnSpecTokenMap[] = { + {CTOKT_SPACE, 1, 0xffff, 0}, +}; /* *---------------------------------------------------------------------- @@ -435,31 +448,73 @@ ClockGetOrParseScanFormat( /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { const char *strFmt; - register const char *p, *e; + register const char *p, *e, *cp, *word_start = NULL; + + Tcl_MutexLock(&ClockFmtMutex); fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; fss->scnTok = - tok = ckalloc(sizeof(**tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); - (*tok)->type = CTOKT_EOB; + tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); + *tok = NULL; strFmt = TclGetString(formatObj); for (e = p = strFmt, e += formatObj->length; p != e; p++) { switch (*p) { case '%': - if (p+1 >= e) - goto word_tok; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + if (p+1 >= e) { + word_start = p; + continue; + } p++; - // *tok = + /* try to find modifier: */ + switch (*p) { + case '%': + word_start = p-1; + continue; + break; + case 'E': + goto ext_tok_E; + break; + case 'O': + goto ext_tok_O; + break; + default: + cp = strchr(ScnSTokenMapChars, *p); + if (!cp || *cp == '\0') { + word_start = p-1; + continue; + } + *tok = &ScnSTokenMap[cp - ScnSTokenMapChars]; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + break; + } break; case ' ': + cp = strchr(ScnSpecTokenMapChars, *p); + if (!cp || *cp == '\0') { + p--; + goto word_tok; + } + *tok = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); - // *tok = break; default: word_tok: - break; + + continue; } + + continue; +ext_tok_E: + +ext_tok_O: + + /*******************/ + continue; + } + +done: + Tcl_MutexUnlock(&ClockFmtMutex); } return fss->scnTok; @@ -478,11 +533,16 @@ ClockScan( { ClockScanToken **tok; - if (ClockGetOrParseScanFormat(interp, opts->formatObj) == NULL) { + if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { return TCL_ERROR; } - // Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + //*********************************** + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)tok)); + return TCL_OK; + + return TCL_ERROR; } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 7994428..969e279 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -28,8 +28,16 @@ proc _test_get_commands {lst} { proc test-scan {{reptime 1000}} { foreach _(c) [_test_get_commands { # Scan : date - #{clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} - #{**STOP** : Wed Nov 25 01:00:00 CET 2015} + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} + {**STOP** : Wed Nov 25 01:00:00 CET 2015} + # Scan : long format test (allock chain) + {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} + # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): + {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # Scan : again: + {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} # FreeScan : relative date with relative weekday -- cgit v0.12 From a3c42aef3efed25bc18881155ac08426831649dd Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:15:36 +0000 Subject: [temp-commit]: clock scan tokenizer logic ready (still needs many rules) caching extended (currentYearCentury, yearOfCenturySwitch, lastBaseDate ...) --- generic/tclClock.c | 69 +++++++++++---- generic/tclClockFmt.c | 218 +++++++++++++++++++++++++++++++++++++++------- generic/tclDate.c | 1 - generic/tclDate.h | 88 ++++++++++++------- generic/tclGetDate.y | 1 - tests-perf/clock.perf.tcl | 98 ++++++++++++++++----- 6 files changed, 372 insertions(+), 103 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index e00d6a2..2e7b854 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -117,6 +117,8 @@ typedef struct ClockClientData { Tcl_Obj **literals; /* Pool of object literals. */ /* Cache for current clock parameters, imparted via "configure" */ unsigned long LastTZEpoch; + int currentYearCentury; + int yearOfCenturySwitch; Tcl_Obj *SystemTimeZone; Tcl_Obj *SystemSetupTZData; Tcl_Obj *GMTSetupTimeZone; @@ -126,6 +128,9 @@ typedef struct ClockClientData { Tcl_Obj *LastUnnormSetupTimeZone; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; + /* Cache for last base (fast convert if base/tz not changed) */ + Tcl_Obj *lastBaseTimeZone; + TclDateFields lastBaseDate; /* /* [SB] TODO: back-port (from tclSE) the same date caching ... * Cache for last date (fast convert if date parsed was the same) * / @@ -325,6 +330,8 @@ TclClockInit( Tcl_IncrRefCount(data->literals[i]); } data->LastTZEpoch = 0; + data->currentYearCentury = -1; + data->yearOfCenturySwitch = -1; data->SystemTimeZone = NULL; data->SystemSetupTZData = NULL; data->GMTSetupTimeZone = NULL; @@ -335,6 +342,8 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; + data->lastBaseTimeZone = NULL; + /* * Install the commands. */ @@ -368,6 +377,8 @@ ClockConfigureClear( ClockClientData *data) { data->LastTZEpoch = 0; + data->currentYearCentury = -1; + data->yearOfCenturySwitch = -1; Tcl_UnsetObjRef(data->SystemTimeZone); Tcl_UnsetObjRef(data->SystemSetupTZData); Tcl_UnsetObjRef(data->GMTSetupTimeZone); @@ -708,11 +719,16 @@ ClockCurrentYearCentury( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - int year = 2000; + int year = dataPtr->currentYearCentury; - Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); + if (year == -1) { + Tcl_Obj * yearObj; + year = 2000; + yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + dataPtr->currentYearCentury = year; + } return year; } inline int @@ -722,11 +738,16 @@ ClockGetYearOfCenturySwitch( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - int year = 37; - - Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); + int year = dataPtr->yearOfCenturySwitch; + + if (year == -1) { + Tcl_Obj * yearObj; + year = 37; + yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + dataPtr->yearOfCenturySwitch = year; + } return year; } @@ -2557,12 +2578,27 @@ ClockScanObjCmd( if (yydate.tzData == NULL) { goto done; } - yydate.seconds = baseVal; - if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; + Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); + + /* check cached */ + if ( dataPtr->lastBaseTimeZone == opts.timezoneObj + && dataPtr->lastBaseDate.seconds == baseVal) { + memcpy(&yydate, &dataPtr->lastBaseDate, ClockCacheableDateFieldsSize); + } else { + /* extact fields from base */ + yydate.seconds = baseVal; + if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + /* cache last base */ + memcpy(&dataPtr->lastBaseDate, &yydate, ClockCacheableDateFieldsSize); + dataPtr->lastBaseTimeZone = opts.timezoneObj; } + /* seconds are in localSeconds (relative base date), so reset time here */ + yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; + /* If free scan */ if (opts.formatObj == NULL) { /* Use compiled version of FreeScan - */ @@ -2593,7 +2629,7 @@ ClockScanObjCmd( else { /* Use compiled version of Scan - */ - ret = ClockScan(clientData, interp, &yydate, objv[1], &opts); + ret = ClockScan(clientData, interp, info, objv[1], &opts); } if (ret != TCL_OK) { @@ -2710,6 +2746,9 @@ ClockFreeScan( if (yydate.tzData == NULL) { goto done; } + + Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); + } /* on demand (lazy) assemble julianDay using new year, month, etc. */ @@ -2719,8 +2758,6 @@ ClockFreeScan( * Assemble date, time, zone into seconds-from-epoch */ - Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); - if (yyHaveTime == -1) { yySeconds = 0; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 93416af..b074681 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -400,35 +400,48 @@ Tcl_GetClockFrmScnFromObj( (tok) = (chain) + (tokCnt); \ (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ } \ - *(tok) = NULL; + memset(tok, 0, sizeof(*(tok))); const char *ScnSTokenMapChars = "dmyYHMS"; -static ClockScanToken ScnSTokenMap[] = { - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 4, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, +static ClockScanTokenMap ScnSTokenMap[] = { + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + NULL}, + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), + NULL}, + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), + NULL}, + {CTOKT_DIGIT, CLF_DATE, 1, 4, TclOffset(DateInfo, date.year), + NULL}, + {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), + NULL}, + {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.minutes), + NULL}, + {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.secondOfDay), + NULL}, }; const char *ScnSpecTokenMapChars = - " %"; -static ClockScanToken ScnSpecTokenMap[] = { - {CTOKT_SPACE, 1, 0xffff, 0}, + " "; +static ClockScanTokenMap ScnSpecTokenMap[] = { + {CTOKT_SPACE, 0, 1, 0xffff, 0, + NULL}, +}; + +static ClockScanTokenMap ScnWordTokenMap = { + CTOKT_WORD, 0, 1, 0, 0, + NULL }; /* *---------------------------------------------------------------------- */ -ClockScanToken ** +ClockScanToken * ClockGetOrParseScanFormat( Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *formatObj) /* Format container */ { ClockFmtScnStorage *fss; - ClockScanToken **tok; + ClockScanToken *tok; if (formatObj->typePtr != &ClockFmtObjType) { if (ClockFmtObj_SetFromAny(interp, formatObj) != TCL_OK) { @@ -448,27 +461,30 @@ ClockGetOrParseScanFormat( /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { const char *strFmt; - register const char *p, *e, *cp, *word_start = NULL; + register const char *p, *e, *cp; Tcl_MutexLock(&ClockFmtMutex); fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; fss->scnTok = tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); - *tok = NULL; + memset(tok, 0, sizeof(*(tok))); strFmt = TclGetString(formatObj); for (e = p = strFmt, e += formatObj->length; p != e; p++) { switch (*p) { case '%': if (p+1 >= e) { - word_start = p; - continue; + goto word_tok; } p++; /* try to find modifier: */ switch (*p) { case '%': - word_start = p-1; + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &ScnWordTokenMap; + tok->tokWord.start = tok->tokWord.end = p; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); continue; break; case 'E': @@ -480,10 +496,24 @@ ClockGetOrParseScanFormat( default: cp = strchr(ScnSTokenMapChars, *p); if (!cp || *cp == '\0') { - word_start = p-1; - continue; + p--; + goto word_tok; + } + tok->map = &ScnSTokenMap[cp - ScnSTokenMapChars]; + /* calculate look ahead value by standing together tokens */ + if (tok > fss->scnTok) { + ClockScanToken *prevTok = tok - 1; + unsigned int lookAhead = tok->map->minSize; + + while (prevTok >= fss->scnTok) { + if (prevTok->map->type != tok->map->type) { + break; + } + prevTok->lookAhead += lookAhead; + prevTok--; + } } - *tok = &ScnSTokenMap[cp - ScnSTokenMapChars]; + /* next token */ AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); break; } @@ -494,18 +524,33 @@ ClockGetOrParseScanFormat( p--; goto word_tok; } - *tok = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; + tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); break; default: word_tok: - - continue; + if (1) { + ClockScanToken *wordTok = tok; + if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { + wordTok = tok-1; + } + wordTok->tokWord.end = p; + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &ScnWordTokenMap; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + } + continue; + } } continue; + ext_tok_E: + /*******************/ + continue; + ext_tok_O: /*******************/ @@ -527,23 +572,134 @@ int ClockScan( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ - TclDateFields *date, /* Date fields used for converting */ + register DateInfo *info, /* Date fields used for parsing & converting */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockScanToken **tok; + ClockScanToken *tok; + ClockScanTokenMap *map; + register const char *p, *x, *end; + unsigned short int flags = 0; + int ret = TCL_ERROR; if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { return TCL_ERROR; } + + /* prepare parsing */ + + yyMeridian = MER24; + + /* bypass spaces at begin of string */ + + p = TclGetString(strObj); + end = p + strObj->length; + while (p < end && isspace(UCHAR(*p))) { + p++; + } + info->dateStart = yyInput = p; + + /* parse string */ + for (; tok->map != NULL; yyInput = p, tok++) { + map = tok->map; + switch (map->type) + { + case CTOKT_DIGIT: + if (1) { + unsigned int val = 0; + int size = map->maxSize; + /* greedy find digits (look forward), corresponding pre-calculated lookAhead */ + size += tok->lookAhead; + x = yyInput + size; + while (isdigit(UCHAR(*p)) && p < x) { p++; }; + /* consider reserved (lookAhead) for next tokens */ + p -= tok->lookAhead; + size = p - yyInput; + if (size < map->minSize) { + /* missing input -> error */ + goto done; + } + /* string 2 number */ + p = yyInput; x = p + size; + while (p < x) { + val = val * 10 + (*p++ - '0'); + } + /* put number into info by offset */ + *(time_t *)(((char *)info) + map->offs) = val; + flags |= map->flags; + } + break; + case CTOKT_SPACE: + while (p < end && isspace(UCHAR(*p))) { + p++; + } + break; + case CTOKT_WORD: + x = tok->tokWord.start; + if (x == tok->tokWord.end) { /* single char word */ + if (*p != *x) { + /* no match -> error */ + goto done; + } + p++; + continue; + } + /* multi-char word */ + while (p < end && x < tok->tokWord.end && *p++ == *x++) {}; + if (x < tok->tokWord.end) { + /* no match -> error */ + goto done; + } + break; + } + } - //*********************************** + /* ignore spaces at end */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + /* check end was reached */ + if (p < end) { + /* something after last token - wrong format */ + goto done; + } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)tok)); - return TCL_OK; + /* invalidate result */ + if (flags & CLF_DATE) { + yydate.julianDay = CL_INVALIDATE; + + if (yyYear < 100) { + if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { + yyYear -= 100; + } + yyYear += ClockCurrentYearCentury(clientData, interp); + } + yydate.era = CE; + if (!(flags & CLF_TIME)) { + yydate.localSeconds = 0; + } + } + + if (flags & CLF_TIME) { + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else { + yySeconds = yydate.localSeconds % 86400; + } + + ret = TCL_OK; + +done: + + if (ret != TCL_OK) { + Tcl_SetResult(interp, + "input string does not match supplied format", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + return ret; + } - return TCL_ERROR; + return ret; } diff --git a/generic/tclDate.c b/generic/tclDate.c index a47f43d..97d13b4 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2691,7 +2691,6 @@ TclClockFreeScan( yyHaveDate = 0; yyHaveTime = 0; - yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; yyHaveZone = 0; yyTimezone = 0; yyDSTmode = DSTmaybe; diff --git a/generic/tclDate.h b/generic/tclDate.h index 49420a2..4b0b47e 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -22,60 +22,64 @@ typedef struct TclDateFields { * epoch */ Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds * from the Posix epoch */ - int tzOffset; /* Time zone offset in seconds east of + time_t tzOffset; /* Time zone offset in seconds east of * Greenwich */ + time_t julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + time_t gregorian; /* Flag == 1 if the date is Gregorian */ + time_t year; /* Year of the era */ + time_t dayOfYear; /* Day of the year (1 January == 1) */ + time_t month; /* Month number */ + time_t dayOfMonth; /* Day of the month */ + time_t iso8601Year; /* ISO8601 week-based year */ + time_t iso8601Week; /* ISO8601 week number */ + time_t dayOfWeek; /* Day of the week */ + time_t hour; /* Hours of day (in-between time only calculation) */ + time_t minutes; /* Minutes of day (in-between time only calculation) */ + time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ + Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ - int julianDay; /* Julian Day Number in local time zone */ - enum {BCE=1, CE=0} era; /* Era */ - int gregorian; /* Flag == 1 if the date is Gregorian */ - int year; /* Year of the era */ - int dayOfYear; /* Day of the year (1 January == 1) */ - int month; /* Month number */ - int dayOfMonth; /* Day of the month */ - int iso8601Year; /* ISO8601 week-based year */ - int iso8601Week; /* ISO8601 week number */ - int dayOfWeek; /* Day of the week */ - int hour; /* Hours of day (in-between time only calculation) */ - int minutes; /* Minutes of day (in-between time only calculation) */ - int secondOfDay; /* Seconds of day (in-between time only calculation) */ } TclDateFields; +#define ClockCacheableDateFieldsSize \ + TclOffset(TclDateFields, tzName) + /* * Structure contains return parsed fields. */ typedef struct DateInfo { + const char *dateStart; + const char *dateInput; TclDateFields date; - int dateHaveDate; + time_t dateHaveDate; - int dateMeridian; - int dateHaveTime; + time_t dateMeridian; + time_t dateHaveTime; time_t dateTimezone; - int dateDSTmode; - int dateHaveZone; + time_t dateDSTmode; + time_t dateHaveZone; time_t dateRelMonth; time_t dateRelDay; time_t dateRelSeconds; - int dateHaveRel; + time_t dateHaveRel; time_t dateMonthOrdinalIncr; time_t dateMonthOrdinal; - int dateHaveOrdinalMonth; + time_t dateHaveOrdinalMonth; time_t dateDayOrdinal; time_t dateDayNumber; - int dateHaveDay; + time_t dateHaveDay; - const char *dateStart; - const char *dateInput; time_t *dateRelPointer; - int dateDigitCount; + time_t dateDigitCount; Tcl_Obj* messages; /* Error messages */ const char* separatrix; /* String separating messages */ @@ -140,8 +144,19 @@ typedef enum _MERIDIAN { #define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 12 +typedef struct ClockScanToken ClockScanToken; + + +typedef int ClockScanTokenProc( + DateInfo *info, + ClockScanToken *tok); + + +#define CLF_DATE (1 << 2) +#define CLF_TIME (1 << 3) + typedef enum _CLCKTOK_TYPE { - CTOKT_EOB=0, CTOKT_DIGIT, CTOKT_SPACE + CTOKT_DIGIT = 1, CTOKT_SPACE, CTOKT_WORD } CLCKTOK_TYPE; typedef struct ClockFmtScnStorage ClockFmtScnStorage; @@ -150,18 +165,29 @@ typedef struct ClockFormatToken { CLCKTOK_TYPE type; } ClockFormatToken; -typedef struct ClockScanToken { +typedef struct ClockScanTokenMap { unsigned short int type; + unsigned short int flags; unsigned short int minSize; unsigned short int maxSize; unsigned short int offs; + ClockScanTokenProc *parser; +} ClockScanTokenMap; + +typedef struct ClockScanToken { + ClockScanTokenMap *map; + unsigned int lookAhead; + struct { + const char *start; + const char *end; + } tokWord; } ClockScanToken; typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ - ClockScanToken **scnTok; + ClockScanToken *scnTok; unsigned int scnTokC; - ClockFormatToken **fmtTok; + ClockFormatToken *fmtTok; unsigned int fmtTokC; #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 ClockFmtScnStorage *nextPtr; @@ -191,8 +217,8 @@ MODULE_SCOPE ClockFmtScnStorage * Tcl_Obj *objPtr); MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, - TclDateFields *date, Tcl_Obj *strObj, - ClockFmtScnCmdArgs *opts); + register DateInfo *info, + Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); /* * Other externals. diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 571b7df..54087ca 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -902,7 +902,6 @@ TclClockFreeScan( yyHaveDate = 0; yyHaveTime = 0; - yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; yyHaveZone = 0; yyTimezone = 0; yyDSTmode = DSTmaybe; diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 969e279..93a78e4 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -25,19 +25,82 @@ proc _test_get_commands {lst} { regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" } +proc _test_out_total {} { + upvar _ _ + + puts [string repeat ** 40] + puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] + lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] + lset _(m) 2 [expr [join $_(itcnt) +]] + lset _(m) 4 [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}] + puts $_(m) + puts "Average:" + lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / [llength $_(itcnt)]}]] + lset _(m) 2 [expr {[lindex $_(m) 2] / [llength $_(itcnt)]}] + lset _(m) 4 [expr {[lindex $_(m) 2] * (1000 / $_(reptime))}] + puts $_(m) + puts [string repeat ** 40] + puts "" +} + +proc _test_run {reptime lst {outcmd {puts {$_(r)}}}} { + upvar _ _ + array set _ [list ittm {} itcnt {} itrate {} reptime $reptime] + + foreach _(c) [_test_get_commands $lst] { + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {\s*\#} $_(c)]} continue + set _(r) [if 1 $_(c)] + if {$outcmd ne {}} $outcmd + puts [set _(m) [timerate $_(c) $reptime]] + lappend _(ittm) [lindex $_(m) 0] + lappend _(itcnt) [lindex $_(m) 2] + lappend _(itrate) [lindex $_(m) 4] + puts "" + } + _test_out_total +} + proc test-scan {{reptime 1000}} { - foreach _(c) [_test_get_commands { - # Scan : date + _test_run $reptime { + # Scan : date (in gmt) {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + # Scan : date (system time zone, with base) + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0} + # Scan : date (system time zone, without base) + {clock scan "25.11.2015" -format "%d.%m.%Y"} + # Scan : greedy match + {clock scan "111" -format "%d%m%y" -base 0 -gmt 1} {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} - {**STOP** : Wed Nov 25 01:00:00 CET 2015} - # Scan : long format test (allock chain) - {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} - # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): - {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} - # Scan : again: - {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + {clock scan "11111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111111" -format "%d%m%y" -base 0 -gmt 1} + + # Scan : date-time (in gmt) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0 -gmt 1} + # Scan : date-time (system time zone with base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0} + # Scan : date-time (system time zone without base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S"} + # Scan : dynamic format (cacheable) + {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + + # Scan : zone only + {clock scan "CET" -format "%z"} + {clock scan "EST" -format "%z"} + #{**STOP** : Wed Nov 25 01:00:00 CET 2015} + + # # Scan : long format test (allock chain) + # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} + # # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): + # {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # # Scan : again: + # {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + } {puts [clock format $_(r) -locale en]} +} + +proc test-freescan {{reptime 1000}} { + _test_run $reptime { # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} # FreeScan : relative date with relative weekday @@ -74,17 +137,11 @@ proc test-scan {{reptime 1000}} { {clock scan "19:18:30 MST" -base 148863600 -gmt 1 clock scan "19:18:30 EST" -base 148863600 } - }] { - puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" - if {[regexp {\s*\#} $_(c)]} continue - puts [clock format [if 1 $_(c)] -locale en] - puts [timerate $_(c) $reptime] - puts "" - } + } {puts [clock format $_(r) -locale en]} } proc test-other {{reptime 1000}} { - foreach _(c) [_test_get_commands { + _test_run $reptime { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} **STOP** @@ -92,18 +149,13 @@ proc test-other {{reptime 1000}} { {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 50; time { clock scan "[incr i -1] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} - }] { - puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" - if {[regexp {\s*\#} $_(c)]} continue - puts [if 1 $_(c)] - puts [timerate $_(c) $reptime] - puts "" } } proc test {{reptime 1000}} { puts "" test-scan $reptime + #test-freescan $reptime test-other $reptime puts \n**OK** -- cgit v0.12 From 940c0805c073986447f70bc21a1db6e576911548 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:19:01 +0000 Subject: [temp-commit]: code review, DST-hole mistake by scan with relative time resolved; caching of UTC2Local / Local2UTC cherry picked --- generic/tclClock.c | 394 ++++++++++++++++++++++++++++------------------ generic/tclClockFmt.c | 220 +++++++++++++++++++++----- generic/tclDate.h | 84 +++++++++- library/clock.tcl | 13 +- tests-perf/clock.perf.tcl | 50 +++++- tests/clock.test | 87 ++++++++++ 6 files changed, 638 insertions(+), 210 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 2e7b854..7cc5d86 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -26,22 +26,6 @@ #endif /* - * Constants - */ - -#define JULIAN_DAY_POSIX_EPOCH 2440588 -#define GREGORIAN_CHANGE_DATE 2361222 -#define SECONDS_PER_DAY 86400 -#define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ - * SECONDS_PER_DAY) -#define FOUR_CENTURIES 146097 /* days */ -#define JDAY_1_JAN_1_CE_JULIAN 1721424 -#define JDAY_1_JAN_1_CE_GREGORIAN 1721426 -#define ONE_CENTURY_GREGORIAN 36524 /* days */ -#define FOUR_YEARS 1461 /* days */ -#define ONE_YEAR 365 /* days */ - -/* * Table of the days in each month, leap and common years */ @@ -72,8 +56,6 @@ typedef enum ClockLiteral { LIT_MONTH, LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, LIT_YEAR, - LIT_CURRENTYEARCENTURY, - LIT_YEAROFCENTURYSWITCH, LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, @@ -96,8 +78,6 @@ static const char *const Literals[] = { "month", "seconds", "tzName", "tzOffset", "year", - "::tcl::clock::CurrentYearCentury", - "::tcl::clock::YearOfCenturySwitch", "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", @@ -106,41 +86,6 @@ static const char *const Literals[] = { #endif }; -#define CurrentYearCentury 2000 - -/* - * Structure containing the client data for [clock] - */ - -typedef struct ClockClientData { - size_t refCount; /* Number of live references. */ - Tcl_Obj **literals; /* Pool of object literals. */ - /* Cache for current clock parameters, imparted via "configure" */ - unsigned long LastTZEpoch; - int currentYearCentury; - int yearOfCenturySwitch; - Tcl_Obj *SystemTimeZone; - Tcl_Obj *SystemSetupTZData; - Tcl_Obj *GMTSetupTimeZone; - Tcl_Obj *GMTSetupTZData; - Tcl_Obj *AnySetupTimeZone; - Tcl_Obj *AnySetupTZData; - Tcl_Obj *LastUnnormSetupTimeZone; - Tcl_Obj *LastSetupTimeZone; - Tcl_Obj *LastSetupTZData; - /* Cache for last base (fast convert if base/tz not changed) */ - Tcl_Obj *lastBaseTimeZone; - TclDateFields lastBaseDate; - /* - /* [SB] TODO: back-port (from tclSE) the same date caching ... - * Cache for last date (fast convert if date parsed was the same) * / - struct { - DateInfo yy; - TclDateFields date; - } lastDate; - */ -} ClockClientData; - static const char *const eras[] = { "CE", "BCE", NULL }; /* @@ -161,13 +106,13 @@ TCL_DECLARE_MUTEX(clockMutex) * Function prototypes for local procedures in this file: */ -static int ConvertUTCToLocal(Tcl_Interp *, +static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertUTCToLocalUsingC(Tcl_Interp *, TclDateFields *, int); -static int ConvertLocalToUTC(Tcl_Interp *, +static int ConvertLocalToUTC(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); @@ -191,9 +136,9 @@ static int ClockConvertlocaltoutcObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ClockGetDateFields(Tcl_Interp *interp, - TclDateFields *fields, Tcl_Obj *tzdata, - int changeover); +static int ClockGetDateFields(ClientData clientData, + Tcl_Interp *interp, TclDateFields *fields, + Tcl_Obj *tzdata, int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -330,8 +275,8 @@ TclClockInit( Tcl_IncrRefCount(data->literals[i]); } data->LastTZEpoch = 0; - data->currentYearCentury = -1; - data->yearOfCenturySwitch = -1; + data->currentYearCentury = ClockDefaultYearCentury; + data->yearOfCenturySwitch = ClockDefaultCenturySwitch; data->SystemTimeZone = NULL; data->SystemSetupTZData = NULL; data->GMTSetupTimeZone = NULL; @@ -342,7 +287,10 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; - data->lastBaseTimeZone = NULL; + data->lastBase.TimeZone = NULL; + data->UTC2Local.tzData = NULL; + data->UTC2Local.tzName = NULL; + data->Local2UTC.tzData = NULL; /* * Install the commands. @@ -377,8 +325,6 @@ ClockConfigureClear( ClockClientData *data) { data->LastTZEpoch = 0; - data->currentYearCentury = -1; - data->yearOfCenturySwitch = -1; Tcl_UnsetObjRef(data->SystemTimeZone); Tcl_UnsetObjRef(data->SystemSetupTZData); Tcl_UnsetObjRef(data->GMTSetupTimeZone); @@ -388,6 +334,11 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->LastUnnormSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTZData); + + Tcl_UnsetObjRef(data->lastBase.TimeZone); + Tcl_UnsetObjRef(data->UTC2Local.tzData); + Tcl_UnsetObjRef(data->UTC2Local.tzName); + Tcl_UnsetObjRef(data->Local2UTC.tzData); } static void @@ -397,7 +348,8 @@ ClockDeleteCmdProc( ClockClientData *data = clientData; int i; - if (data->refCount-- <= 1) { + data->refCount--; + if (data->refCount == 0) { for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } @@ -471,10 +423,12 @@ ClockConfigureObjCmd( static const char *const options[] = { "-system-tz", "-setup-tz", "-clear", + "-year-century", "-century-switch", NULL }; enum optionInd { CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CLEAR_CACHE, + CLOCK_YEAR_CENTURY, CLOCK_CENTURY_SWITCH, CLOCK_SETUP_GMT, CLOCK_SETUP_NOP }; int optionIndex; /* Index of an option. */ @@ -542,6 +496,32 @@ ClockConfigureObjCmd( Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); } break; + case CLOCK_YEAR_CENTURY: + if (i+1 < objc) { + int year; + if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + return TCL_ERROR; + } + dataPtr->currentYearCentury = year; + Tcl_SetObjResult(interp, objv[i+1]); + continue; + } + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->currentYearCentury)); + break; + case CLOCK_CENTURY_SWITCH: + if (i+1 < objc) { + int year; + if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + return TCL_ERROR; + } + dataPtr->yearOfCenturySwitch = year; + Tcl_SetObjResult(interp, objv[i+1]); + continue; + } + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); + break; case CLOCK_CLEAR_CACHE: ClockConfigureClear(dataPtr); break; @@ -577,14 +557,16 @@ ClockGetTZData( /* simple caching, because almost used the tz-data of last timezone */ if (timezoneObj == dataPtr->SystemTimeZone) { - if (dataPtr->SystemSetupTZData != NULL) + if (dataPtr->SystemSetupTZData != NULL) { return dataPtr->SystemSetupTZData; + } out = &dataPtr->SystemSetupTZData; } else if (timezoneObj == dataPtr->GMTSetupTimeZone) { - if (dataPtr->GMTSetupTZData != NULL) + if (dataPtr->GMTSetupTZData != NULL) { return dataPtr->GMTSetupTZData; + } out = &dataPtr->GMTSetupTZData; } else @@ -602,11 +584,11 @@ ClockGetTZData( if (out != NULL) { Tcl_SetObjRef(*out, ret); } - Tcl_SetObjRef(dataPtr->LastSetupTZData, ret); + Tcl_SetObjRef(dataPtr->LastSetupTZData, ret); if (dataPtr->LastSetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->LastUnnormSetupTimeZone); - } + } return ret; } /* @@ -710,49 +692,6 @@ ClockFormatNumericTimeZone(int z) { /* *---------------------------------------------------------------------- - * [SB] TODO: make constans cacheable (once per second, etc.) ... - */ -inline int -ClockCurrentYearCentury( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp) /* Tcl interpreter */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - int year = dataPtr->currentYearCentury; - - if (year == -1) { - Tcl_Obj * yearObj; - year = 2000; - yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); - dataPtr->currentYearCentury = year; - } - return year; -} -inline int -ClockGetYearOfCenturySwitch( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp) /* Tcl interpreter */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - int year = dataPtr->yearOfCenturySwitch; - - if (year == -1) { - Tcl_Obj * yearObj; - year = 37; - yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); - dataPtr->yearOfCenturySwitch = year; - } - return year; -} - -/* - *---------------------------------------------------------------------- * * ClockConvertlocaltoutcObjCmd -- * @@ -816,7 +755,7 @@ ClockConvertlocaltoutcObjCmd( if ((Tcl_GetWideIntFromObj(interp, secondsObj, &fields.localSeconds) != TCL_OK) || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) - || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) { + || ConvertLocalToUTC(clientData, interp, &fields, objv[2], changeover)) { return TCL_ERROR; } @@ -911,8 +850,8 @@ ClockGetdatefieldsObjCmd( /* Extract fields */ - if (ClockGetDateFields(interp, &fields, objv[2], changeover) - != TCL_OK) { + if (ClockGetDateFields(clientData, interp, &fields, objv[2], + changeover) != TCL_OK) { return TCL_ERROR; } @@ -957,6 +896,7 @@ ClockGetdatefieldsObjCmd( */ int ClockGetDateFields( + ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Pointer to result fields, where * fields->seconds contains date to extract */ @@ -967,7 +907,8 @@ ClockGetDateFields( * Convert UTC time to local. */ - if (ConvertUTCToLocal(interp, fields, tzdata, changeover) != TCL_OK) { + if (ConvertUTCToLocal(clientData, interp, fields, tzdata, + changeover) != TCL_OK) { return TCL_ERROR; } @@ -1221,15 +1162,33 @@ ClockGetjuliandayfromerayearweekdayObjCmd( static int ConvertLocalToUTC( + ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ Tcl_Obj *tzdata, /* Time zone data */ int changeover) /* Julian Day of the Gregorian transition */ { + ClockClientData *dataPtr = clientData; int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ /* + * Check cacheable conversion could be used + * (last-minute Local2UTC cache with the same TZ) + */ + if ( tzdata == dataPtr->Local2UTC.tzData + && ( fields->localSeconds == dataPtr->Local2UTC.localSeconds + || fields->localSeconds / 60 == dataPtr->Local2UTC.localSeconds / 60 + ) + && changeover == dataPtr->Local2UTC.changeover + ) { + /* the same time zone and offset (UTC time inside the last minute) */ + fields->tzOffset = dataPtr->Local2UTC.tzOffset; + fields->seconds = fields->localSeconds - fields->tzOffset; + return TCL_OK; + } + + /* * Unpack the tz data. */ @@ -1243,10 +1202,22 @@ ConvertLocalToUTC( */ if (rowc == 0) { - return ConvertLocalToUTCUsingC(interp, fields, changeover); + if (ConvertLocalToUTCUsingC(interp, fields, changeover) != TCL_OK) { + return TCL_ERROR; + }; } else { - return ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv); + if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + return TCL_ERROR; + }; } + + /* Cache the last conversion */ + Tcl_SetObjRef(dataPtr->Local2UTC.tzData, tzdata); + dataPtr->Local2UTC.localSeconds = fields->localSeconds; + dataPtr->Local2UTC.changeover = changeover; + dataPtr->Local2UTC.tzOffset = fields->tzOffset; + + return TCL_OK; } /* @@ -1321,6 +1292,40 @@ ConvertLocalToUTCUsingTable( } fields->tzOffset = have[i]; fields->seconds = fields->localSeconds - fields->tzOffset; + +#if 0 + /* + * Convert back from UTC, if local times are different - wrong local time + * (local time seems to be in between DST-hole). + */ + if (fields->tzOffset) { + + int corrOffset; + Tcl_WideInt backCompVal; + /* check DST-hole interval contains UTC time */ + Tcl_GetWideIntFromObj(NULL, cellv[0], &backCompVal); + if ( fields->seconds >= backCompVal - fields->tzOffset + && fields->seconds <= backCompVal + fields->tzOffset + ) { + row = LookupLastTransition(interp, fields->seconds, rowc, rowv); + if (row == NULL || + TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK || + TclGetIntFromObj(interp, cellv[1], &corrOffset) != TCL_OK) { + return TCL_ERROR; + } + if (fields->localSeconds != fields->seconds + corrOffset) { + Tcl_Panic("wrong local time %ld by LocalToUTC conversion," + " local time seems to be in between DST-hole", + fields->localSeconds); + /* correcting offset * / + fields->tzOffset -= corrOffset; + fields->seconds += fields->tzOffset; + */ + } + } + } +#endif + return TCL_OK; } @@ -1424,15 +1429,34 @@ ConvertLocalToUTCUsingC( static int ConvertUTCToLocal( + ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ Tcl_Obj *tzdata, /* Time zone data */ int changeover) /* Julian Day of the Gregorian transition */ { + ClockClientData *dataPtr = clientData; int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ /* + * Check cacheable conversion could be used + * (last-minute UTC2Local cache with the same TZ) + */ + if ( tzdata == dataPtr->UTC2Local.tzData + && ( fields->seconds == dataPtr->UTC2Local.seconds + || fields->seconds / 60 == dataPtr->UTC2Local.seconds / 60 + ) + && changeover == dataPtr->UTC2Local.changeover + ) { + /* the same time zone and offset (UTC time inside the last minute) */ + Tcl_SetObjRef(fields->tzName, dataPtr->UTC2Local.tzName); + fields->tzOffset = dataPtr->UTC2Local.tzOffset; + fields->localSeconds = fields->seconds + fields->tzOffset; + return TCL_OK; + } + + /* * Unpack the tz data. */ @@ -1446,10 +1470,22 @@ ConvertUTCToLocal( */ if (rowc == 0) { - return ConvertUTCToLocalUsingC(interp, fields, changeover); + if (ConvertUTCToLocalUsingC(interp, fields, changeover) != TCL_OK) { + return TCL_ERROR; + } } else { - return ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv); + if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + return TCL_ERROR; + } } + + /* Cache the last conversion */ + Tcl_SetObjRef(dataPtr->UTC2Local.tzData, tzdata); + dataPtr->UTC2Local.seconds = fields->seconds; + dataPtr->UTC2Local.changeover = changeover; + dataPtr->UTC2Local.tzOffset = fields->tzOffset; + Tcl_SetObjRef(dataPtr->UTC2Local.tzName, fields->tzName); + return TCL_OK; } /* @@ -2373,6 +2409,7 @@ _ClockParseFmtScnArgs( resOpts->localeObj = NULL; resOpts->timezoneObj = NULL; resOpts->baseObj = NULL; + resOpts->flags = 0; for (i = 2; i < objc; i+=2) { if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], "option", 0, &optionIndex) != TCL_OK) { @@ -2539,6 +2576,8 @@ ClockScanObjCmd( ret = TCL_ERROR; + info->flags = 0; + if (opts.baseObj != NULL) { if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; @@ -2580,20 +2619,20 @@ ClockScanObjCmd( } Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); - /* check cached */ - if ( dataPtr->lastBaseTimeZone == opts.timezoneObj - && dataPtr->lastBaseDate.seconds == baseVal) { - memcpy(&yydate, &dataPtr->lastBaseDate, ClockCacheableDateFieldsSize); + /* check base fields already cached (by TZ, last-second cache) */ + if ( dataPtr->lastBase.TimeZone == opts.timezoneObj + && dataPtr->lastBase.Date.seconds == baseVal) { + memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); } else { /* extact fields from base */ yydate.seconds = baseVal; - if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) - != TCL_OK) { + if (ClockGetDateFields(clientData, interp, &yydate, yydate.tzData, + GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } /* cache last base */ - memcpy(&dataPtr->lastBaseDate, &yydate, ClockCacheableDateFieldsSize); - dataPtr->lastBaseTimeZone = opts.timezoneObj; + memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); + Tcl_SetObjRef(dataPtr->lastBase.TimeZone, opts.timezoneObj); } /* seconds are in localSeconds (relative base date), so reset time here */ @@ -2612,7 +2651,7 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } -#if 0 +#if 1 else if (1) { /* TODO: Tcled Scan proc - */ @@ -2636,24 +2675,40 @@ ClockScanObjCmd( goto done; } - /* If needed assemble julianDay using new year, month, etc. */ - if (yydate.julianDay == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - + + /* some overflow checks, if not extended */ + if (!(opts.flags & CLF_EXTENDED)) { + if (yydate.julianDay > 5373484) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "requested date too large to represent", -1)); + Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); + ret = TCL_ERROR; + goto done; + } + } + /* Local seconds to UTC (stored in yydate.seconds) */ - yydate.localSeconds = - -210866803200L - + ( 86400 * (Tcl_WideInt)yydate.julianDay ) - + ( yySeconds % 86400 ); + if (info->flags & (CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY)) { + yydate.localSeconds = + -210866803200L + + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + + ( yySeconds % SECONDS_PER_DAY ); + } - if (ConvertLocalToUTC(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) + if (ConvertLocalToUTC(clientData, interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } + /* Increment UTC seconds with relative time */ + + yydate.seconds += yyRelSeconds; + ret = TCL_OK; done: @@ -2681,7 +2736,7 @@ ClockFreeScan( Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - // ClockClientData *dataPtr = clientData; + ClockClientData *dataPtr = clientData; // Tcl_Obj **literals = dataPtr->literals; int ret = TCL_ERROR; @@ -2712,15 +2767,16 @@ ClockFreeScan( if (yyHaveDate) { if (yyYear < 100) { - if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { yyYear -= 100; } - yyYear += ClockCurrentYearCentury(clientData, interp); + yyYear += dataPtr->currentYearCentury; } yydate.era = CE; if (yyHaveTime == 0) { yyHaveTime = -1; } + info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; } /* @@ -2749,22 +2805,22 @@ ClockFreeScan( Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); + info->flags |= CLF_INVALIDATE_SECONDS; } - /* on demand (lazy) assemble julianDay using new year, month, etc. */ - yydate.julianDay = CL_INVALIDATE; - /* * Assemble date, time, zone into seconds-from-epoch */ if (yyHaveTime == -1) { yySeconds = 0; + info->flags |= CLF_INVALIDATE_SECONDS; } else if (yyHaveTime) { yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); + info->flags |= CLF_INVALIDATE_SECONDS; } else if ( (yyHaveDay && !yyHaveDate) @@ -2774,9 +2830,10 @@ ClockFreeScan( || yyRelDay != 0 ) ) ) { yySeconds = 0; + info->flags |= CLF_INVALIDATE_SECONDS; } else { - yySeconds = yydate.localSeconds % 86400; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } /* @@ -2787,16 +2844,24 @@ repeat_rel: if (yyHaveRel) { + /* + * Relative conversion normally possible in UTC time only, because + * of possible wrong local time increment if ignores in-between DST-hole. + * (see test-cases clock-34.53, clock-34.54). + * So increment date in julianDay, but time inside day in UTC (seconds). + */ + /* add months (or years in months) */ if (yyRelMonth != 0) { int m, h; /* if needed extract year, month, etc. again */ - if (yyMonth == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_DATE; } /* add the requisite number of months */ @@ -2812,7 +2877,7 @@ repeat_rel: } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - yydate.julianDay = CL_INVALIDATE; + info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; yyRelMonth = 0; } @@ -2821,21 +2886,33 @@ repeat_rel: if (yyRelDay) { /* assemble julianDay using new year, month, etc. */ - if (yydate.julianDay == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_JULIANDAY; } - yydate.julianDay += yyRelDay; + yydate.julianDay += yyRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - yyMonth = CL_INVALIDATE; + info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; yyRelDay = 0; } - /* relative time (seconds) */ - yySeconds += yyRelSeconds; - yyRelSeconds = 0; - + /* relative time (seconds), if exceeds current date, do the day conversion and + * leave rest of the increment in yyRelSeconds to add it hereafter in UTC seconds */ + if (yyRelSeconds) { + time_t newSecs = yySeconds + yyRelSeconds; + + /* if seconds increment outside of current date, increment day */ + if (newSecs / SECONDS_PER_DAY != yySeconds / SECONDS_PER_DAY) { + + yyRelDay += newSecs / SECONDS_PER_DAY; + yySeconds = 0; + yyRelSeconds = newSecs % SECONDS_PER_DAY; + + goto repeat_rel; + } + } } /* @@ -2846,10 +2923,11 @@ repeat_rel: int monthDiff; /* if needed extract year, month, etc. again */ - if (yyMonth == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_DATE; } if (yyMonthOrdinalIncr > 0) { @@ -2872,6 +2950,8 @@ repeat_rel: yyRelMonth += monthDiff; yyHaveOrdinalMonth = 0; + info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + goto repeat_rel; } @@ -2882,8 +2962,9 @@ repeat_rel: if (yyHaveDay && !yyHaveDate) { /* if needed assemble julianDay now */ - if (yydate.julianDay == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_JULIANDAY; } yydate.era = CE; @@ -2892,6 +2973,7 @@ repeat_rel: if (yyDayOrdinal > 0) { yydate.julianDay -= 7; } + info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; } /* Free scanning completed - date ready */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index b074681..48b9b69 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -35,6 +35,66 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); * Clock scan and format facilities. */ +inline int +_str2int( + time_t *out, + register + const char *p, + const char *e, + int sign) +{ + register time_t val = 0, prev = 0; + if (sign > 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + +inline int +_str2wideInt( + Tcl_WideInt *out, + register + const char *p, + const char *e, + int sign) +{ + register Tcl_WideInt val = 0, prev = 0; + if (sign > 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + /* *---------------------------------------------------------------------- */ @@ -403,22 +463,35 @@ Tcl_GetClockFrmScnFromObj( memset(tok, 0, sizeof(*(tok))); const char *ScnSTokenMapChars = - "dmyYHMS"; + "dmyYHMSJs"; static ClockScanTokenMap ScnSTokenMap[] = { - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + /* %d */ + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, + /* %m */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), NULL}, + /* %y */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), NULL}, + /* %Y */ {CTOKT_DIGIT, CLF_DATE, 1, 4, TclOffset(DateInfo, date.year), NULL}, + /* %H */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), NULL}, + /* %M */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.minutes), NULL}, + /* %S */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, + /* %J */ + {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + NULL}, + /* %s */ + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + NULL}, }; const char *ScnSpecTokenMapChars = " "; @@ -576,6 +649,7 @@ ClockScan( Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { + ClockClientData *dataPtr = clientData; ClockScanToken *tok; ClockScanTokenMap *map; register const char *p, *x, *end; @@ -590,46 +664,100 @@ ClockScan( yyMeridian = MER24; - /* bypass spaces at begin of string */ - p = TclGetString(strObj); end = p + strObj->length; - while (p < end && isspace(UCHAR(*p))) { - p++; + /* in strict mode - bypass spaces at begin / end only (not between tokens) */ + if (opts->flags & CLF_STRICT) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } } info->dateStart = yyInput = p; /* parse string */ - for (; tok->map != NULL; yyInput = p, tok++) { + for (; tok->map != NULL; tok++) { map = tok->map; + /* bypass spaces at begin of input before parsing each token */ + if (!(opts->flags & CLF_STRICT) && map->type != CTOKT_SPACE) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + yyInput = p; + } switch (map->type) { case CTOKT_DIGIT: if (1) { - unsigned int val = 0; int size = map->maxSize; - /* greedy find digits (look forward), corresponding pre-calculated lookAhead */ - size += tok->lookAhead; - x = yyInput + size; - while (isdigit(UCHAR(*p)) && p < x) { p++; }; - /* consider reserved (lookAhead) for next tokens */ - p -= tok->lookAhead; + int sign = 1; + if (map->flags & CLF_SIGNED) { + if (*p == '+') { yyInput = ++p; } + else + if (*p == '-') { yyInput = ++p; sign = -1; }; + } + /* greedy find digits (look for forward digits consider spaces), + * corresponding pre-calculated lookAhead */ + if (size != map->minSize && tok->lookAhead) { + int spcnt = 0; + const char *pe; + size += tok->lookAhead; + x = p + size; if (x > end) { x = end; }; + pe = x; + while (p < x) { + if (isspace(UCHAR(*p))) { + if (pe > p) { pe = p; }; + if (x < end) x++; + p++; + spcnt++; + continue; + } + if (isdigit(UCHAR(*p))) { + p++; + continue; + } + break; + } + /* consider reserved (lookAhead) for next tokens */ + p -= tok->lookAhead + spcnt; + if (p > pe) { + p = pe; + } + } else { + x = p + size; if (x > end) { x = end; }; + while (isdigit(UCHAR(*p)) && p < x) { p++; }; + } size = p - yyInput; if (size < map->minSize) { /* missing input -> error */ - goto done; + goto error; } - /* string 2 number */ + /* string 2 number, put number into info structure by offset */ p = yyInput; x = p + size; - while (p < x) { - val = val * 10 + (*p++ - '0'); + if (!(map->flags & CLF_LOCALSEC)) { + if (_str2int((time_t *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; } - /* put number into info by offset */ - *(time_t *)(((char *)info) + map->offs) = val; flags |= map->flags; } break; case CTOKT_SPACE: + /* at least one space in strict mode */ + if (opts->flags & CLF_STRICT) { + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto error; + } + p++; + } while (p < end && isspace(UCHAR(*p))) { p++; } @@ -639,7 +767,7 @@ ClockScan( if (x == tok->tokWord.end) { /* single char word */ if (*p != *x) { /* no match -> error */ - goto done; + goto error; } p++; continue; @@ -648,7 +776,7 @@ ClockScan( while (p < end && x < tok->tokWord.end && *p++ == *x++) {}; if (x < tok->tokWord.end) { /* no match -> error */ - goto done; + goto error; } break; } @@ -661,43 +789,57 @@ ClockScan( /* check end was reached */ if (p < end) { /* something after last token - wrong format */ - goto done; + goto error; } /* invalidate result */ if (flags & CLF_DATE) { - yydate.julianDay = CL_INVALIDATE; + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; - if (yyYear < 100) { - if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { - yyYear -= 100; + if (yyYear < 100) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; } - yyYear += ClockCurrentYearCentury(clientData, interp); + yydate.era = CE; } - yydate.era = CE; - if (!(flags & CLF_TIME)) { + /* if date but no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_INVALIDATE_SECONDS; yydate.localSeconds = 0; } } if (flags & CLF_TIME) { + info->flags |= CLF_INVALIDATE_SECONDS; yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); - } else { - yySeconds = yydate.localSeconds % 86400; + } else + if (!(flags & CLF_LOCALSEC)) { + info->flags |= CLF_INVALIDATE_SECONDS; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } ret = TCL_OK; + goto done; -done: +overflow: - if (ret != TCL_OK) { - Tcl_SetResult(interp, - "input string does not match supplied format", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); - return ret; - } + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "integer value too large to represent", -1)); + Tcl_SetErrorCode(interp, "CLOCK", "integervalueTooLarge", NULL); + goto done; + +error: + + Tcl_SetResult(interp, + "input string does not match supplied format", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + +done: return ret; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 4b0b47e..47f2a21 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -14,6 +14,28 @@ #define _TCLCLOCK_H /* + * Constants + */ + +#define JULIAN_DAY_POSIX_EPOCH 2440588 +#define GREGORIAN_CHANGE_DATE 2361222 +#define SECONDS_PER_DAY 86400 +#define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ + * SECONDS_PER_DAY) +#define FOUR_CENTURIES 146097 /* days */ +#define JDAY_1_JAN_1_CE_JULIAN 1721424 +#define JDAY_1_JAN_1_CE_GREGORIAN 1721426 +#define ONE_CENTURY_GREGORIAN 36524 /* days */ +#define FOUR_YEARS 1461 /* days */ +#define ONE_YEAR 365 /* days */ + + +/* On demand (lazy) assemble flags */ +#define CLF_INVALIDATE_DATE (1 << 6) /* assemble year, month, etc. using julianDay */ +#define CLF_INVALIDATE_JULIANDAY (1 << 7) /* assemble julianDay using year, month, etc. */ +#define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ + +/* * Structure containing the fields used in [clock format] and [clock scan] */ @@ -52,6 +74,7 @@ typedef struct TclDateFields { typedef struct DateInfo { const char *dateStart; const char *dateInput; + int flags; TclDateFields date; @@ -116,19 +139,71 @@ typedef struct DateInfo { #define yyDigitCount (info->dateDigitCount) -enum {CL_INVALIDATE = (signed int)0x80000000}; /* * Structure containing the command arguments supplied to [clock format] and [clock scan] */ +#define CLF_EXTENDED (1 << 4) +#define CLF_STRICT (1 << 8) + typedef struct ClockFmtScnCmdArgs { Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ Tcl_Obj *baseObj; /* Base (scan only) */ + int flags; /* Flags control scanning */ } ClockFmtScnCmdArgs; /* + * Structure containing the client data for [clock] + */ + +typedef struct ClockClientData { + int refCount; /* Number of live references. */ + Tcl_Obj **literals; /* Pool of object literals. */ + /* Cache for current clock parameters, imparted via "configure" */ + unsigned long LastTZEpoch; + int currentYearCentury; + int yearOfCenturySwitch; + Tcl_Obj *SystemTimeZone; + Tcl_Obj *SystemSetupTZData; + Tcl_Obj *GMTSetupTimeZone; + Tcl_Obj *GMTSetupTZData; + Tcl_Obj *AnySetupTimeZone; + Tcl_Obj *AnySetupTZData; + Tcl_Obj *LastUnnormSetupTimeZone; + Tcl_Obj *LastSetupTimeZone; + Tcl_Obj *LastSetupTZData; + /* Cache for last base (last-second fast convert if base/tz not changed) */ + struct { + Tcl_Obj *TimeZone; + TclDateFields Date; + } lastBase; + /* Las-minute cache for fast UTC2Local conversion */ + struct { + /* keys */ + Tcl_Obj *tzData; + int changeover; + Tcl_WideInt seconds; + /* values */ + time_t tzOffset; + Tcl_Obj *tzName; + } UTC2Local; + /* Las-minute cache for fast Local2UTC conversion */ + struct { + /* keys */ + Tcl_Obj *tzData; + int changeover; + Tcl_WideInt localSeconds; + /* values */ + time_t tzOffset; + } Local2UTC; +} ClockClientData; + +#define ClockDefaultYearCentury 2000 +#define ClockDefaultCenturySwitch 38 + +/* * Meridian: am, pm, or 24-hour style. */ @@ -152,8 +227,11 @@ typedef int ClockScanTokenProc( ClockScanToken *tok); -#define CLF_DATE (1 << 2) -#define CLF_TIME (1 << 3) +#define CLF_DATE (1 << 2) +#define CLF_JULIANDAY (1 << 3) +#define CLF_TIME (1 << 4) +#define CLF_LOCALSEC (1 << 5) +#define CLF_SIGNED (1 << 8) typedef enum _CLCKTOK_TYPE { CTOKT_DIGIT = 1, CTOKT_SPACE, CTOKT_WORD diff --git a/library/clock.tcl b/library/clock.tcl index ace4176..e0de904 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -287,9 +287,10 @@ proc ::tcl::clock::Initialize {} { variable FEB_28 58 - # Current year century and year of century switch - variable CurrentYearCentury 2000 - variable YearOfCenturySwitch 38 + # Default configuration + + # configure -year-century 2000 \ + # -century-switch 38 # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise @@ -2534,13 +2535,11 @@ proc ::tcl::clock::ScanWide { str } { proc ::tcl::clock::InterpretTwoDigitYear { date baseTime { twoDigitField yearOfCentury } { fourDigitField year } } { - variable CurrentYearCentury - variable YearOfCenturySwitch set yr [dict get $date $twoDigitField] - if { $yr >= $YearOfCenturySwitch } { + if { $yr >= [configure -century-switch] } { incr yr -100 } - incr yr $CurrentYearCentury + incr yr [configure -year-century] dict set date $fourDigitField $yr return $date } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 93a78e4..9267684 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -15,10 +15,19 @@ # of this file. # + +## set testing defaults: set ::env(TCL_TZ) :CET +## warm-up (load clock.tcl, system zones, etc.): +clock scan "" -gmt 1 +clock scan "" +clock scan "" -timezone :CET + +## ------------------------------------------ + proc {**STOP**} {args} { - return -code error -level 2 "**STOP** in [info level [expr {[info level]-1}]] [join $args { }]" + return -code error -level 4 "**STOP** in [info level [expr {[info level]-2}]] [join $args { }]" } proc _test_get_commands {lst} { @@ -43,7 +52,7 @@ proc _test_out_total {} { puts "" } -proc _test_run {reptime lst {outcmd {puts {$_(r)}}}} { +proc _test_run {reptime lst {outcmd {puts $_(r)}}} { upvar _ _ array set _ [list ittm {} itcnt {} itrate {} reptime $reptime] @@ -74,6 +83,22 @@ proc test-scan {{reptime 1000}} { {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} {clock scan "11111" -format "%d%m%y" -base 0 -gmt 1} {clock scan "111111" -format "%d%m%y" -base 0 -gmt 1} + # Scan : greedy match (space separated) + {clock scan "1 1 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 11" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "11 11 11" -format "%d%m%y" -base 0 -gmt 1} + + # Scan : time (in gmt) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000 -gmt 1} + # Scan : time (system time zone, with base) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000} + # Scan : time (gmt, without base) + {clock scan "10:35:55" -format "%H:%M:%S" -gmt 1} + # Scan : time (system time zone, without base) + {clock scan "10:35:55" -format "%H:%M:%S"} # Scan : date-time (in gmt) {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0 -gmt 1} @@ -85,6 +110,17 @@ proc test-scan {{reptime 1000}} { # Scan : dynamic format (cacheable) {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + # Scan : julian day in gmt + {clock scan 2451545 -format %J -gmt 1} + # Scan : julian day in system TZ + {clock scan 2451545 -format %J} + # Scan : julian day in other TZ + {clock scan 2451545 -format %J -timezone +0200} + # Scan : julian day with time: + {clock scan "2451545 10:20:30" -format "%J %H:%M:%S"} + # Scan : julian day with time (greedy match): + {clock scan "2451545 102030" -format "%J%H%M%S"} + # Scan : zone only {clock scan "CET" -format "%z"} {clock scan "EST" -format "%z"} @@ -144,6 +180,10 @@ proc test-other {{reptime 1000}} { _test_run $reptime { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + + # Scan : julian day (overflow) + {catch {clock scan 5373485 -format %J}} + **STOP** # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} @@ -154,11 +194,11 @@ proc test-other {{reptime 1000}} { proc test {{reptime 1000}} { puts "" - test-scan $reptime - #test-freescan $reptime + #test-scan $reptime + test-freescan $reptime test-other $reptime puts \n**OK** } -test 250; # 250 ms +test 100; # ms diff --git a/tests/clock.test b/tests/clock.test index 477f142..9e3dbd7 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35917,7 +35917,94 @@ test clock-34.52 {more than one ordinal month} {*}{ -result {unable to convert date-time string "next January next March": more than one ordinal month in string} } +test clock-34.53.1 {relative from base, date switch} { + set base [clock scan "12/31/2016 23:59:59" -gmt 1] + clock format [clock scan "+1 second" \ + -base $base -gmt 1] -gmt 1 -format {%Y-%m-%d %H:%M:%S} +} {2017-01-01 00:00:00} +test clock-34.53.2 {relative time, daylight switch} { + set base [clock scan "03/27/2016" -timezone CET] + set res {} + lappend res [clock format [clock scan "+1 hour" \ + -base $base -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] + lappend res [clock format [clock scan "+2 hour" \ + -base $base -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] +} {{2016-03-27 01:00:00 CET} {2016-03-27 03:00:00 CEST}} + +test clock-34.53.3 {relative time with day increment / daylight switch} { + set base [clock scan "03/27/2016" -timezone CET] + set res {} + lappend res [clock format [clock scan "+5 day +25 hour" \ + -base [expr {$base - 6*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] + lappend res [clock format [clock scan "+5 day +26 hour" \ + -base [expr {$base - 6*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] +} {{2016-03-27 01:00:00 CET} {2016-03-27 03:00:00 CEST}} + +test clock-34.53.4 {relative time with month & day increment / daylight switch} { + set base [clock scan "03/27/2016" -timezone CET] + set res {} + lappend res [clock format [clock scan "next Mar +5 day +25 hour" \ + -base [expr {$base - 35*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] + lappend res [clock format [clock scan "next Mar +5 day +26 hour" \ + -base [expr {$base - 35*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] +} {{2016-03-27 01:00:00 CET} {2016-03-27 03:00:00 CEST}} + +test clock-34.54.1 {check date in DST-hole: daylight switch CET -> CEST} { + set res {} + # forwards + set base 1459033200 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "+$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + lappend res "#--" + # backwards + set base 1459044000 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "-$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + set res +} [split [regsub -all {^\n|\n$} { +1459033200 = 2016-03-27 00:00:00 CET +1459036800 = 2016-03-27 01:00:00 CET +1459040400 = 2016-03-27 03:00:00 CEST +1459044000 = 2016-03-27 04:00:00 CEST +#-- +1459044000 = 2016-03-27 04:00:00 CEST +1459040400 = 2016-03-27 03:00:00 CEST +1459036800 = 2016-03-27 01:00:00 CET +1459033200 = 2016-03-27 00:00:00 CET +} {}] \n] + +test clock-34.54.2 {check date in DST-hole: daylight switch CEST -> CET} { + set res {} + # forwards + set base 1477782000 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "+$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + lappend res "#--" + # backwards + set base 1477792800 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "-$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + set res +} [split [regsub -all {^\n|\n$} { +1477782000 = 2016-10-30 01:00:00 CEST +1477785600 = 2016-10-30 02:00:00 CEST +1477789200 = 2016-10-30 02:00:00 CET +1477792800 = 2016-10-30 03:00:00 CET +#-- +1477792800 = 2016-10-30 03:00:00 CET +1477789200 = 2016-10-30 02:00:00 CET +1477785600 = 2016-10-30 02:00:00 CEST +1477782000 = 2016-10-30 01:00:00 CEST +} {}] \n] # clock seconds test clock-35.1 {clock seconds tests} { -- cgit v0.12 From bcb2a0a181c0de95732c70b66d5040ec6bd4b2b9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:20:25 +0000 Subject: amend for caching of UTC2Local / Local2UTC: * tzdata used internally only (because cached, replaced with timezone object as parameter for several functions) * small improvement (don't need to convert UTC to UTC) --- generic/tclClock.c | 104 ++++++++++++++++++++++++++++++++--------------------- generic/tclDate.h | 14 ++++---- library/clock.tcl | 34 +++++++++--------- 3 files changed, 88 insertions(+), 64 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 7cc5d86..6bd6336 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -107,13 +107,13 @@ TCL_DECLARE_MUTEX(clockMutex) */ static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, - TclDateFields *, Tcl_Obj *, int); + TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertUTCToLocalUsingC(Tcl_Interp *, TclDateFields *, int); static int ConvertLocalToUTC(ClientData clientData, Tcl_Interp *, - TclDateFields *, Tcl_Obj *, int); + TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertLocalToUTCUsingC(Tcl_Interp *, @@ -138,7 +138,7 @@ static int ClockConvertlocaltoutcObjCmd( static int ClockGetDateFields(ClientData clientData, Tcl_Interp *interp, TclDateFields *fields, - Tcl_Obj *tzdata, int changeover); + Tcl_Obj *timezoneObj, int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -287,10 +287,10 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; - data->lastBase.TimeZone = NULL; - data->UTC2Local.tzData = NULL; + data->lastBase.timezoneObj = NULL; + data->UTC2Local.timezoneObj = NULL; data->UTC2Local.tzName = NULL; - data->Local2UTC.tzData = NULL; + data->Local2UTC.timezoneObj = NULL; /* * Install the commands. @@ -335,10 +335,10 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->LastSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTZData); - Tcl_UnsetObjRef(data->lastBase.TimeZone); - Tcl_UnsetObjRef(data->UTC2Local.tzData); + Tcl_UnsetObjRef(data->lastBase.timezoneObj); + Tcl_UnsetObjRef(data->UTC2Local.timezoneObj); Tcl_UnsetObjRef(data->UTC2Local.tzName); - Tcl_UnsetObjRef(data->Local2UTC.tzData); + Tcl_UnsetObjRef(data->Local2UTC.timezoneObj); } static void @@ -699,11 +699,11 @@ ClockFormatNumericTimeZone(int z) { * is available. * * Usage: - * ::tcl::clock::ConvertUTCToLocal dictionary tzdata changeover + * ::tcl::clock::ConvertUTCToLocal dictionary timezone changeover * * Parameters: * dict - Dictionary containing a 'localSeconds' entry. - * tzdata - Time zone data + * timezone - Time zone * changeover - Julian Day of the adoption of the Gregorian calendar. * * Results: @@ -739,7 +739,7 @@ ClockConvertlocaltoutcObjCmd( */ if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "dict tzdata changeover"); + Tcl_WrongNumArgs(interp, 1, objv, "dict timezone changeover"); return TCL_ERROR; } dict = objv[1]; @@ -789,12 +789,11 @@ ClockConvertlocaltoutcObjCmd( * formatting a date, and populates a dictionary with them. * * Usage: - * ::tcl::clock::GetDateFields seconds tzdata changeover + * ::tcl::clock::GetDateFields seconds timezone changeover * * Parameters: * seconds - Time expressed in seconds from the Posix epoch. - * tzdata - Time zone data of the time zone in which time is to be - * expressed. + * timezone - Time zone in which time is to be expressed. * changeover - Julian Day Number at which the current locale adopted * the Gregorian calendar * @@ -830,7 +829,7 @@ ClockGetdatefieldsObjCmd( */ if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "seconds tzdata changeover"); + Tcl_WrongNumArgs(interp, 1, objv, "seconds timezone changeover"); return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK @@ -900,14 +899,14 @@ ClockGetDateFields( Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Pointer to result fields, where * fields->seconds contains date to extract */ - Tcl_Obj *tzdata, /* Time zone data object or NULL for gmt */ + Tcl_Obj *timezoneObj, /* Time zone object or NULL for gmt */ int changeover) /* Julian Day Number */ { /* * Convert UTC time to local. */ - if (ConvertUTCToLocal(clientData, interp, fields, tzdata, + if (ConvertUTCToLocal(clientData, interp, fields, timezoneObj, changeover) != TCL_OK) { return TCL_ERROR; } @@ -1165,18 +1164,26 @@ ConvertLocalToUTC( ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ - Tcl_Obj *tzdata, /* Time zone data */ + Tcl_Obj *timezoneObj, /* Time zone */ int changeover) /* Julian Day of the Gregorian transition */ { ClockClientData *dataPtr = clientData; + Tcl_Obj *tzdata; /* Time zone data */ int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ + /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ + if (timezoneObj == dataPtr->GMTSetupTimeZone && dataPtr->GMTSetupTimeZone != NULL) { + fields->seconds = fields->localSeconds; + fields->tzOffset = 0; + return TCL_OK; + } + /* * Check cacheable conversion could be used * (last-minute Local2UTC cache with the same TZ) */ - if ( tzdata == dataPtr->Local2UTC.tzData + if ( timezoneObj == dataPtr->Local2UTC.timezoneObj && ( fields->localSeconds == dataPtr->Local2UTC.localSeconds || fields->localSeconds / 60 == dataPtr->Local2UTC.localSeconds / 60 ) @@ -1192,6 +1199,11 @@ ConvertLocalToUTC( * Unpack the tz data. */ + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) { return TCL_ERROR; } @@ -1212,7 +1224,7 @@ ConvertLocalToUTC( } /* Cache the last conversion */ - Tcl_SetObjRef(dataPtr->Local2UTC.tzData, tzdata); + Tcl_SetObjRef(dataPtr->Local2UTC.timezoneObj, timezoneObj); dataPtr->Local2UTC.localSeconds = fields->localSeconds; dataPtr->Local2UTC.changeover = changeover; dataPtr->Local2UTC.tzOffset = fields->tzOffset; @@ -1432,18 +1444,34 @@ ConvertUTCToLocal( ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ - Tcl_Obj *tzdata, /* Time zone data */ + Tcl_Obj *timezoneObj, /* Time zone */ int changeover) /* Julian Day of the Gregorian transition */ { ClockClientData *dataPtr = clientData; + Tcl_Obj *tzdata; /* Time zone data */ int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ + /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ + if (timezoneObj == dataPtr->GMTSetupTimeZone + && dataPtr->GMTSetupTimeZone != NULL + && dataPtr->GMTSetupTZData != NULL + ) { + fields->localSeconds = fields->seconds; + fields->tzOffset = 0; + if ( TclListObjGetElements(interp, dataPtr->GMTSetupTZData, &rowc, &rowv) != TCL_OK + || Tcl_ListObjIndex(interp, rowv[0], 3, &fields->tzName) != TCL_OK) { + return TCL_ERROR; + } + Tcl_IncrRefCount(fields->tzName); + return TCL_OK; + } + /* * Check cacheable conversion could be used * (last-minute UTC2Local cache with the same TZ) */ - if ( tzdata == dataPtr->UTC2Local.tzData + if ( timezoneObj == dataPtr->UTC2Local.timezoneObj && ( fields->seconds == dataPtr->UTC2Local.seconds || fields->seconds / 60 == dataPtr->UTC2Local.seconds / 60 ) @@ -1460,6 +1488,11 @@ ConvertUTCToLocal( * Unpack the tz data. */ + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) { return TCL_ERROR; } @@ -1480,7 +1513,7 @@ ConvertUTCToLocal( } /* Cache the last conversion */ - Tcl_SetObjRef(dataPtr->UTC2Local.tzData, tzdata); + Tcl_SetObjRef(dataPtr->UTC2Local.timezoneObj, timezoneObj); dataPtr->UTC2Local.seconds = fields->seconds; dataPtr->UTC2Local.changeover = changeover; dataPtr->UTC2Local.tzOffset = fields->tzOffset; @@ -2607,32 +2640,27 @@ ClockScanObjCmd( if (opts.timezoneObj == NULL) { goto done; } + // Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); /* * Extract year, month and day from the base time for the parser to use as * defaults */ - yydate.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); - if (yydate.tzData == NULL) { - goto done; - } - Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); - /* check base fields already cached (by TZ, last-second cache) */ - if ( dataPtr->lastBase.TimeZone == opts.timezoneObj + if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj && dataPtr->lastBase.Date.seconds == baseVal) { memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); } else { /* extact fields from base */ yydate.seconds = baseVal; - if (ClockGetDateFields(clientData, interp, &yydate, yydate.tzData, + if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } /* cache last base */ memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); - Tcl_SetObjRef(dataPtr->lastBase.TimeZone, opts.timezoneObj); + Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); } /* seconds are in localSeconds (relative base date), so reset time here */ @@ -2700,8 +2728,8 @@ ClockScanObjCmd( + ( yySeconds % SECONDS_PER_DAY ); } - if (ConvertLocalToUTC(clientData, interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) - != TCL_OK) { + if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } @@ -2798,12 +2826,8 @@ ClockFreeScan( if (opts->timezoneObj == NULL) { goto done; } - yydate.tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); - if (yydate.tzData == NULL) { - goto done; - } - Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); + // Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); info->flags |= CLF_INVALIDATE_SECONDS; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 47f2a21..9585258 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -60,8 +60,8 @@ typedef struct TclDateFields { time_t minutes; /* Minutes of day (in-between time only calculation) */ time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ - Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ - Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ + Tcl_Obj *tzName; /* Name (or corresponding DST-abbreviation) of the + * time zone, if set the refCount is incremented */ } TclDateFields; #define ClockCacheableDateFieldsSize \ @@ -176,14 +176,14 @@ typedef struct ClockClientData { Tcl_Obj *LastSetupTZData; /* Cache for last base (last-second fast convert if base/tz not changed) */ struct { - Tcl_Obj *TimeZone; + Tcl_Obj *timezoneObj; TclDateFields Date; } lastBase; /* Las-minute cache for fast UTC2Local conversion */ struct { /* keys */ - Tcl_Obj *tzData; - int changeover; + Tcl_Obj *timezoneObj; + int changeover; Tcl_WideInt seconds; /* values */ time_t tzOffset; @@ -192,8 +192,8 @@ typedef struct ClockClientData { /* Las-minute cache for fast Local2UTC conversion */ struct { /* keys */ - Tcl_Obj *tzData; - int changeover; + Tcl_Obj *timezoneObj; + int changeover; Tcl_WideInt localSeconds; /* values */ time_t tzOffset; diff --git a/library/clock.tcl b/library/clock.tcl index e0de904..ebbecb9 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -677,7 +677,7 @@ proc ::tcl::clock::format { args } { } } if {![info exists TZData($timezone)]} { - if {[catch {SetupTimeZone $timezone} retval opts]} { + if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { dict unset opts -errorinfo return -options $opts $retval } @@ -744,7 +744,7 @@ proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} { { variable TZData set date [GetDateFields $clockval \ - $TZData($timezone) \ + $timezone \ @GREGORIAN_CHANGE_DATE@] }] set formatString {} @@ -1776,7 +1776,7 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { } } append procBody { - ::tcl::clock::SetupTimeZone $timeZone + set timeZone [::tcl::clock::SetupTimeZone $timeZone] } } @@ -1810,7 +1810,7 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { append procBody { set date [::tcl::clock::ConvertLocalToUTC $date[set date {}] \ - $TZData($timeZone) $changeover] + $timeZone $changeover] } } @@ -2572,7 +2572,7 @@ proc ::tcl::clock::AssignBaseYear { date baseTime timezone changeover } { # Find the Julian Day Number corresponding to the base time, and # find the Gregorian year corresponding to that Julian Day. - set date2 [GetDateFields $baseTime $TZData($timezone) $changeover] + set date2 [GetDateFields $baseTime $timezone $changeover] # Store the converted year @@ -2610,7 +2610,7 @@ proc ::tcl::clock::AssignBaseIso8601Year {date baseTime timeZone changeover} { # Find the Julian Day Number corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + set date2 [GetDateFields $baseTime $timeZone $changeover] # Calculate the ISO8601 date and transfer the year @@ -2646,7 +2646,7 @@ proc ::tcl::clock::AssignBaseMonth {date baseTime timezone changeover} { # Find the year and month corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timezone) $changeover] + set date2 [GetDateFields $baseTime $timezone $changeover] dict set date era [dict get $date2 era] dict set date year [dict get $date2 year] dict set date month [dict get $date2 month] @@ -2680,7 +2680,7 @@ proc ::tcl::clock::AssignBaseWeek {date baseTime timeZone changeover} { # Find the Julian Day Number corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + set date2 [GetDateFields $baseTime $timeZone $changeover] # Calculate the ISO8601 date and transfer the year @@ -2716,7 +2716,7 @@ proc ::tcl::clock::AssignBaseJulianDay { date baseTime timeZone changeover } { # Find the Julian Day Number corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + set date2 [GetDateFields $baseTime $timeZone $changeover] dict set date julianDay [dict get $date2 julianDay] return $date @@ -2823,7 +2823,7 @@ proc ::tcl::clock::GetSystemTimeZone {} { } } if { ![dict exists $TimeZoneBad $timezone] } { - catch {SetupTimeZone $timezone} + catch {set timezone [SetupTimeZone $timezone]} } if { [dict exists $TimeZoneBad $timezone] } { @@ -2965,7 +2965,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { } } - # tell backend - timezone is initialized: + # tell backend - timezone is initialized and return shared timezone object: configure -setup-tz $timezone } @@ -3037,7 +3037,7 @@ proc ::tcl::clock::GuessWindowsTimeZone {} { if { [dict exists $WinZoneInfo $data] } { set tzname [dict get $WinZoneInfo $data] if { ! [dict exists $TimeZoneBad $tzname] } { - catch {SetupTimeZone $tzname} + catch {set tzname [SetupTimeZone $tzname]} } } else { set tzname {} @@ -4131,7 +4131,7 @@ proc ::tcl::clock::add { clockval args } { set changeover [mc GREGORIAN_CHANGE_DATE] - if {[catch {SetupTimeZone $timezone} retval opts]} { + if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { dict unset opts -errorinfo return -options $opts $retval } @@ -4215,7 +4215,7 @@ proc ::tcl::clock::AddMonths { months clockval timezone changeover } { # Convert the time to year, month, day, and fraction of day. - set date [GetDateFields $clockval $TZData($timezone) $changeover] + set date [GetDateFields $clockval $timezone $changeover] dict set date secondOfDay [expr { [dict get $date localSeconds] % 86400 }] @@ -4252,7 +4252,7 @@ proc ::tcl::clock::AddMonths { months clockval timezone changeover } { + ( 86400 * wide([dict get $date julianDay]) ) + [dict get $date secondOfDay] }] - set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ + set date [ConvertLocalToUTC $date[set date {}] $timezone \ $changeover] return [dict get $date seconds] @@ -4336,7 +4336,7 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { # Convert the time to Julian Day - set date [GetDateFields $clockval $TZData($timezone) $changeover] + set date [GetDateFields $clockval $timezone $changeover] dict set date secondOfDay [expr { [dict get $date localSeconds] % 86400 }] @@ -4353,7 +4353,7 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { + ( 86400 * wide([dict get $date julianDay]) ) + [dict get $date secondOfDay] }] - set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ + set date [ConvertLocalToUTC $date[set date {}] $timezone \ $changeover] return [dict get $date seconds] -- cgit v0.12 From c5d6cc90d9239f54b212d06b8f98516ff145545b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:21:26 +0000 Subject: several initialize and finalize facilities --- generic/tclClock.c | 16 +++++++++------- generic/tclClockFmt.c | 26 +++++++++++++++++++++----- generic/tclDate.c | 19 +++---------------- generic/tclDate.h | 14 +++++++++++++- generic/tclGetDate.y | 19 +++---------------- 5 files changed, 49 insertions(+), 45 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 6bd6336..a4edb82 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -324,6 +324,8 @@ static void ClockConfigureClear( ClockClientData *data) { + ClockFrmScnClearCaches(); + data->LastTZEpoch = 0; Tcl_UnsetObjRef(data->SystemTimeZone); Tcl_UnsetObjRef(data->SystemSetupTZData); @@ -2609,8 +2611,6 @@ ClockScanObjCmd( ret = TCL_ERROR; - info->flags = 0; - if (opts.baseObj != NULL) { if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; @@ -2621,8 +2621,6 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - yydate.tzName = NULL; - /* If time zone not specified use system time zone */ if ( opts.timezoneObj == NULL || TclGetString(opts.timezoneObj) == NULL @@ -2630,7 +2628,7 @@ ClockScanObjCmd( ) { opts.timezoneObj = ClockGetSystemTimeZone(clientData, interp); if (opts.timezoneObj == NULL) { - goto done; + return TCL_ERROR; } } @@ -2638,8 +2636,12 @@ ClockScanObjCmd( opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); if (opts.timezoneObj == NULL) { - goto done; + return TCL_ERROR; } + + ClockInitDateInfo(info); + yydate.tzName = NULL; + // Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); /* @@ -2679,7 +2681,7 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } -#if 1 +#if 0 else if (1) { /* TODO: Tcled Scan proc - */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 48b9b69..ad04e4b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -31,6 +31,8 @@ TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); +static void ClockFrmScnFinalize(ClientData clientData); + /* * Clock scan and format facilities. */ @@ -148,7 +150,7 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) */ static Tcl_HashTable FmtScnHashTable; -static int initFmtScnHashTable = 0; +static int initialized = 0; inline Tcl_HashEntry * HashEntry4FmtScn(ClockFmtScnStorage *fss) { @@ -246,16 +248,18 @@ FindOrCreateFmtScnStorage( Tcl_MutexLock(&ClockFmtMutex); /* if not yet initialized */ - if (!initFmtScnHashTable) { + if (!initialized) { /* initialize type */ memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; - initFmtScnHashTable = 1; /* initialize hash table */ Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, &ClockFmtScnStorageHashKeyType); + + initialized = 1; + Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); } /* get or create entry (and alocate storage) */ @@ -845,18 +849,30 @@ done: } +MODULE_SCOPE void +ClockFrmScnClearCaches(void) +{ + Tcl_MutexLock(&ClockFmtMutex); + /* clear caches ... */ + Tcl_MutexUnlock(&ClockFmtMutex); +} + static void -Tcl_GetClockFrmScnFinalize() +ClockFrmScnFinalize( + ClientData clientData) /* Not used. */ { + Tcl_MutexLock(&ClockFmtMutex); #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 /* clear GC */ ClockFmtScnStorage_GC.stackPtr = NULL; ClockFmtScnStorage_GC.stackBound = NULL; ClockFmtScnStorage_GC.count = 0; #endif - if (initFmtScnHashTable) { + if (initialized) { Tcl_DeleteHashTable(&FmtScnHashTable); + initialized = 0; } + Tcl_MutexUnlock(&ClockFmtMutex); Tcl_MutexFinalize(&ClockFmtMutex); } /* diff --git a/generic/tclDate.c b/generic/tclDate.c index 97d13b4..5bd96d0 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2685,24 +2685,11 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + * + * ClockInitDateInfo(info) should be executed to pre-init info; */ - yyHaveDate = 0; - - yyHaveTime = 0; - - yyHaveZone = 0; - yyTimezone = 0; yyDSTmode = DSTmaybe; - - yyHaveOrdinalMonth = 0; - yyMonthOrdinalIncr = 0; - - yyHaveDay = 0; - yyDayOrdinal = 0; yyDayNumber = 0; - - yyHaveRel = 0; - yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; + yyDSTmode = DSTmaybe; info->messages = Tcl_NewObj(); info->separatrix = ""; diff --git a/generic/tclDate.h b/generic/tclDate.h index 9585258..2010178 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -40,6 +40,9 @@ */ typedef struct TclDateFields { + + /* Cacheable fields: */ + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix * epoch */ Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds @@ -60,6 +63,8 @@ typedef struct TclDateFields { time_t minutes; /* Minutes of day (in-between time only calculation) */ time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ + /* Non cacheable fields: */ + Tcl_Obj *tzName; /* Name (or corresponding DST-abbreviation) of the * time zone, if set the refCount is incremented */ } TclDateFields; @@ -74,10 +79,11 @@ typedef struct TclDateFields { typedef struct DateInfo { const char *dateStart; const char *dateInput; - int flags; TclDateFields date; + int flags; + time_t dateHaveDate; time_t dateMeridian; @@ -138,6 +144,10 @@ typedef struct DateInfo { #define yyInput (info->dateInput) #define yyDigitCount (info->dateDigitCount) +inline void +ClockInitDateInfo(DateInfo *info) { + memset(info, 0, sizeof(DateInfo)); +} /* * Structure containing the command arguments supplied to [clock format] and [clock scan] @@ -298,6 +308,8 @@ MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); +MODULE_SCOPE void ClockFrmScnClearCaches(void); + /* * Other externals. */ diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 54087ca..9e3623f 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -896,24 +896,11 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + * + * ClockInitDateInfo(info) should be executed to pre-init info; */ - yyHaveDate = 0; - - yyHaveTime = 0; - - yyHaveZone = 0; - yyTimezone = 0; yyDSTmode = DSTmaybe; - - yyHaveOrdinalMonth = 0; - yyMonthOrdinalIncr = 0; - - yyHaveDay = 0; - yyDayOrdinal = 0; yyDayNumber = 0; - - yyHaveRel = 0; - yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; + yyDSTmode = DSTmaybe; info->messages = Tcl_NewObj(); info->separatrix = ""; -- cgit v0.12 From 18dc49dd083ec10211463e17378e1655a791df28 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:23:37 +0000 Subject: [temp-commit]: not ready --- generic/tclClock.c | 167 ++++++++++++++++++++---- generic/tclClockFmt.c | 319 ++++++++++++++++++++++++++++++++++++++-------- generic/tclDate.h | 32 ++++- library/msgcat/msgcat.tcl | 54 +++++++- tests-perf/clock.perf.tcl | 13 +- 5 files changed, 501 insertions(+), 84 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a4edb82..1e9abba 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -59,6 +59,8 @@ typedef enum ClockLiteral { LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, + LIT_GETSYSTEMLOCALE, + LIT_SETUPLOCALE, #if 0 LIT_FREESCAN, #endif @@ -81,6 +83,8 @@ static const char *const Literals[] = { "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", + "::tcl::clock::mclocale", + "::tcl::clock::EnterLocale", #if 0 "::tcl::clock::FreeScan" #endif @@ -176,24 +180,6 @@ static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); /* - * Primitives to safe set, reset and free references. - */ - -#define Tcl_UnsetObjRef(obj) \ - if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } -#define Tcl_InitObjRef(obj, val) \ - obj = val; if (obj) { Tcl_IncrRefCount(obj); } -#define Tcl_SetObjRef(obj, val) \ -if (1) { \ - Tcl_Obj *nval = val; \ - if (obj != nval) { \ - Tcl_Obj *prev = obj; \ - Tcl_InitObjRef(obj, nval); \ - if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ - } \ -} - -/* * Structure containing description of "native" clock commands to create. */ @@ -610,12 +596,18 @@ ClockGetSystemTimeZone( return dataPtr->SystemTimeZone; } + Tcl_UnsetObjRef(dataPtr->SystemTimeZone); + Tcl_UnsetObjRef(data->SystemSetupTZData); + literals = dataPtr->literals; if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMTIMEZONE], 0) != TCL_OK) { return NULL; } - return Tcl_GetObjResult(interp); + if (dataPtr->SystemTimeZone == NULL) { + Tcl_SetObjRef(dataPtr->SystemTimeZone, Tcl_GetObjResult(interp)); + } + return dataPtr->SystemTimeZone; } /* *---------------------------------------------------------------------- @@ -694,6 +686,124 @@ ClockFormatNumericTimeZone(int z) { /* *---------------------------------------------------------------------- + */ +inline Tcl_Obj * +NormLocaleObj( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Obj *localeObj) +{ + const char * tz; + if ( localeObj == dataPtr->LastUnnormSetupLocale + && dataPtr->LastSetupLocale != NULL + ) { + return dataPtr->LastSetupLocale; + } + if ( localeObj == dataPtr->LastSetupLocale + || localeObj == dataPtr->literals[LIT_CLOCALE] + || localeObj == dataPtr->SystemLocale + || localeObj == dataPtr->AnySetupLocale + ) { + return localeObj; + } + + tz = TclGetString(localeObj); + if (dataPtr->AnySetupLocale != NULL && + (localeObj == dataPtr->AnySetupLocale + || strcmp(tz, TclGetString(dataPtr->AnySetupLocale)) == 0 + ) + ) { + localeObj = dataPtr->AnySetupLocale; + } + else + if (dataPtr->SystemLocale != NULL && + (localeObj == dataPtr->SystemLocale + || strcmp(tz, TclGetString(dataPtr->SystemLocale)) == 0 + ) + ) { + localeObj = dataPtr->SystemLocale; + } + else + if ( + strcmp(tz, Literals[LIT_GMT]) == 0 + ) { + localeObj = dataPtr->literals[LIT_GMT]; + } + return localeObj; +} +/* + *---------------------------------------------------------------------- + */ +static Tcl_Obj * +ClockGetSystemLocale( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals; + + /* if known (cached) - return now */ + if (dataPtr->SystemLocale != NULL) { + return dataPtr->SystemLocale; + } + + literals = dataPtr->literals; + + if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMLOCALE], 0) != TCL_OK) { + return NULL; + } + Tcl_SetObjRef(dataPtr->SystemLocale, Tcl_GetObjResult(interp)); + return dataPtr->SystemLocale; +} +/* + *---------------------------------------------------------------------- + */ +static Tcl_Obj * +ClockSetupLocale( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *localeObj) +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj *callargs[2]; + + if (localeObj == NULL || localeObj == dataPtr->SystemLocale) { + if (dataPtr->SystemLocale == NULL) { + return ClockGetSystemLocale(clientData, interp); + } + return dataPtr->SystemLocale; + } + +#if 0 + /* if cached (if already setup this one) */ + if ( dataPtr->LastSetupTimeZone != NULL + && ( localeObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->LastUnnormSetupTimeZone + ) + ) { + return dataPtr->LastSetupTimeZone; + } + + /* differentiate GMT and system zones, because used often and already set */ + timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); + if ( timezoneObj == dataPtr->GMTSetupTimeZone + || timezoneObj == dataPtr->SystemTimeZone + || timezoneObj == dataPtr->AnySetupTimeZone + ) { + return timezoneObj; + } + +#endif + callargs[0] = literals[LIT_SETUPLOCALE]; + callargs[1] = localeObj; + + if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { + return localeObj; // dataPtr->CurrentLocale; + } + return NULL; +} +/* + *---------------------------------------------------------------------- * * ClockConvertlocaltoutcObjCmd -- * @@ -2440,11 +2550,7 @@ _ClockParseFmtScnArgs( * Extract values for the keywords. */ - resOpts->formatObj = NULL; - resOpts->localeObj = NULL; - resOpts->timezoneObj = NULL; - resOpts->baseObj = NULL; - resOpts->flags = 0; + memset(resOpts, 0, sizeof(*resOpts)); for (i = 2; i < objc; i+=2) { if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], "option", 0, &optionIndex) != TCL_OK) { @@ -2488,6 +2594,9 @@ _ClockParseFmtScnArgs( resOpts->timezoneObj = litPtr[LIT_GMT]; } + resOpts->clientData = clientData; + resOpts->interp = interp; + return TCL_OK; } @@ -2562,7 +2671,7 @@ ClockParseformatargsObjCmd( * Return options as a list. */ - Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts)); + Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts.formatObj)); return TCL_OK; } @@ -2632,13 +2741,19 @@ ClockScanObjCmd( } } - /* Get the data for time changes in the given zone */ + /* Setup timezone and locale */ opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); if (opts.timezoneObj == NULL) { return TCL_ERROR; } + opts.localeObj = ClockSetupLocale(clientData, interp, opts.localeObj); + if (opts.localeObj == NULL) { + return TCL_ERROR; + } + + ClockInitDateInfo(info); yydate.tzName = NULL; diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ad04e4b..17181d9 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -454,32 +454,170 @@ Tcl_GetClockFrmScnFromObj( return fss; } + +static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, const char * mcKey, int *val) +{ + Tcl_Obj *callargs[4] = {NULL, NULL, NULL, NULL}, **lstv; + int i, lstc; + Tcl_Obj *valObj = NULL; + int ret = TCL_RETURN; + + /* get msgcat value */ + TclNewLiteralStringObj(callargs[0], "::msgcat::mcget"); + TclNewLiteralStringObj(callargs[1], "::tcl::clock"); + callargs[2] = opts->localeObj; + if (opts->localeObj == NULL) { + TclNewLiteralStringObj(callargs[1], "c"); + } + callargs[3] = Tcl_NewStringObj(mcKey, -1); -#define AllocTokenInChain(tok, chain, tokCnt) \ - if (++(tok) >= (chain) + (tokCnt)) { \ - (char *)(chain) = ckrealloc((char *)(chain), \ - (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ - if ((chain) == NULL) { goto done; }; \ - (tok) = (chain) + (tokCnt); \ - (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ - } \ - memset(tok, 0, sizeof(*(tok))); + for (i = 0; i < 4; i++) { + Tcl_IncrRefCount(callargs[i]); + } + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK) { + goto done; + } + + Tcl_InitObjRef(valObj, Tcl_GetObjResult(opts->interp)); + + /* is a list */ + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { + goto done; + } + + /* search in list */ + for (i = 0; i < lstc; i++) { + const char *s = TclGetString(lstv[i]); + int l = lstv[i]->length; + if ( l <= info->dateEnd - yyInput + && strncasecmp(yyInput, s, l) == 0 + ) { + *val = i; + yyInput += l; + break; + } + } + + ret = TCL_OK; + /* if not found */ + if (i >= lstc) { + ret = TCL_ERROR; + } + +done: + + Tcl_UnsetObjRef(valObj); + + for (i = 0; i < 4; i++) { + Tcl_UnsetObjRef(callargs[i]); + } + + return ret; +} + +static int +StaticListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, const char **lst, int *val) +{ + int len; + const char **s = lst; + while (*s != NULL) { + len = strlen(*s); + if ( len <= info->dateEnd - yyInput + && strncasecmp(yyInput, *s, len) == 0 + ) { + *val = (s - lst); + yyInput += len; + break; + } + s++; + } + if (*s == NULL) { + return TCL_ERROR; + } + + return TCL_OK; +}; + +static int +ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + /* + static const char * months[] = { + /* full * / + "January", "February", "March", + "April", "May", "June", + "July", "August", "September", + "October", "November", "December", + /* abbr * / + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + NULL + }; + int val; + if (StaticListSearch(opts, info, months, &val) != TCL_OK) { + return TCL_ERROR; + } + yyMonth = (val % 12) + 1; + return TCL_OK; + */ + + int val; + int ret = LocaleListSearch(opts, info, "MONTHS_FULL", &val); + if (ret != TCL_OK) { + if (ret == TCL_RETURN) { + return ret; + } + ret = LocaleListSearch(opts, info, "MONTHS_ABBREV", &val); + if (ret != TCL_OK) { + return ret; + } + } + + yyMonth = val + 1; + return TCL_OK; + +} + + +static int +ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int val; + + int ret = LocaleListSearch(opts, info, (char *)tok->map->data, &val); + if (ret != TCL_OK) { + return ret; + } + + *(time_t *)(((char *)info) + tok->map->offs) = val; + + return TCL_OK; +} -const char *ScnSTokenMapChars = - "dmyYHMSJs"; + +static const char *ScnSTokenMapIndex = + "dmbyYHMSJCs"; static ClockScanTokenMap ScnSTokenMap[] = { - /* %d */ + /* %d %e */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, /* %m */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), NULL}, + /* %b %B %h */ + {CTOKT_PARSER, CLF_DATE, 0, 0, 0, + ClockScnToken_Month_Proc}, /* %y */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_DATE, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 4, TclOffset(DateInfo, date.year), NULL}, /* %H */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), @@ -493,11 +631,41 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %J */ {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 1, 0xffff, TclOffset(DateInfo, date.julianDay), NULL}, + /* %C */ + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 2, TclOffset(DateInfo, dateCentury), + NULL}, /* %s */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; -const char *ScnSpecTokenMapChars = +static const char *ScnSTokenWrapMapIndex[2] = { + "eBh", + "dbb" +}; + +static const char *ScnETokenMapIndex = + ""; +static ClockScanTokenMap ScnETokenMap[] = { + {0, 0, 0} +}; +static const char *ScnETokenWrapMapIndex[2] = { + "", + "" +}; + +static const char *ScnOTokenMapIndex = + "d"; +static ClockScanTokenMap ScnOTokenMap[] = { + /* %Od %Oe */ + {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + ClockScnToken_LocaleListMatcher_Proc, "LOCALE_NUMERALS"}, +}; +static const char *ScnOTokenWrapMapIndex[2] = { + "e", + "d" +}; + +static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { {CTOKT_SPACE, 0, 1, 0xffff, 0, @@ -508,6 +676,17 @@ static ClockScanTokenMap ScnWordTokenMap = { CTOKT_WORD, 0, 1, 0, 0, NULL }; + + +#define AllocTokenInChain(tok, chain, tokCnt) \ + if (++(tok) >= (chain) + (tokCnt)) { \ + (char *)(chain) = ckrealloc((char *)(chain), \ + (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ + if ((chain) == NULL) { goto done; }; \ + (tok) = (chain) + (tokCnt); \ + (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } \ + memset(tok, 0, sizeof(*(tok))); /* *---------------------------------------------------------------------- @@ -546,10 +725,14 @@ ClockGetOrParseScanFormat( fss->scnTok = tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); memset(tok, 0, sizeof(*(tok))); - strFmt = TclGetString(formatObj); - for (e = p = strFmt, e += formatObj->length; p != e; p++) { + strFmt = HashEntry4FmtScn(fss)->key.string; + for (e = p = strFmt, e += strlen(strFmt); p != e; p++) { switch (*p) { case '%': + if (1) { + ClockScanTokenMap * maps = ScnSTokenMap; + const char *mapIndex = ScnSTokenMapIndex, + **wrapIndex = ScnSTokenWrapMapIndex; if (p+1 >= e) { goto word_tok; } @@ -565,43 +748,62 @@ ClockGetOrParseScanFormat( continue; break; case 'E': - goto ext_tok_E; + maps = ScnETokenMap, + mapIndex = ScnETokenMapIndex, + wrapIndex = ScnETokenWrapMapIndex; + p++; break; case 'O': - goto ext_tok_O; + maps = ScnOTokenMap, + mapIndex = ScnOTokenMapIndex, + wrapIndex = ScnOTokenWrapMapIndex; + p++; break; - default: - cp = strchr(ScnSTokenMapChars, *p); + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(wrapIndex[0], *p); if (!cp || *cp == '\0') { p--; goto word_tok; } - tok->map = &ScnSTokenMap[cp - ScnSTokenMapChars]; - /* calculate look ahead value by standing together tokens */ - if (tok > fss->scnTok) { - ClockScanToken *prevTok = tok - 1; - unsigned int lookAhead = tok->map->minSize; - - while (prevTok >= fss->scnTok) { - if (prevTok->map->type != tok->map->type) { - break; - } - prevTok->lookAhead += lookAhead; - prevTok--; + cp = strchr(mapIndex, wrapIndex[1][cp - wrapIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; + goto word_tok; + } + } + tok->map = &ScnSTokenMap[cp - mapIndex]; + tok->tokWord.start = p; + /* calculate look ahead value by standing together tokens */ + if (tok > fss->scnTok) { + ClockScanToken *prevTok = tok - 1; + unsigned int lookAhead = tok->map->minSize; + + while (prevTok >= fss->scnTok) { + if (prevTok->map->type != tok->map->type) { + break; } + prevTok->lookAhead += lookAhead; + prevTok--; } - /* next token */ - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); - break; } + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + } break; case ' ': - cp = strchr(ScnSpecTokenMapChars, *p); + cp = strchr(ScnSpecTokenMapIndex, *p); if (!cp || *cp == '\0') { p--; goto word_tok; } - tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; + tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); break; default: @@ -619,20 +821,10 @@ word_tok: } continue; } + break; } continue; - -ext_tok_E: - - /*******************/ - continue; - -ext_tok_O: - - /*******************/ - continue; - } done: @@ -677,17 +869,20 @@ ClockScan( } } info->dateStart = yyInput = p; + info->dateEnd = end; /* parse string */ for (; tok->map != NULL; tok++) { map = tok->map; /* bypass spaces at begin of input before parsing each token */ - if (!(opts->flags & CLF_STRICT) && map->type != CTOKT_SPACE) { + if ( !(opts->flags & CLF_STRICT) + && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) + ) { while (p < end && isspace(UCHAR(*p))) { p++; } - yyInput = p; } + yyInput = p; switch (map->type) { case CTOKT_DIGIT: @@ -753,6 +948,20 @@ ClockScan( flags |= map->flags; } break; + case CTOKT_PARSER: + switch (map->parser(opts, info, tok)) { + case TCL_OK: + break; + case TCL_RETURN: + goto done; + break; + default: + goto error; + break; + }; + p = yyInput; + flags |= map->flags; + break; case CTOKT_SPACE: /* at least one space in strict mode */ if (opts->flags & CLF_STRICT) { @@ -803,10 +1012,14 @@ ClockScan( info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; if (yyYear < 100) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; } - yyYear += dataPtr->currentYearCentury; } yydate.era = CE; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 2010178..d97cd3c 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -36,6 +36,24 @@ #define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ /* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* * Structure containing the fields used in [clock format] and [clock scan] */ @@ -79,6 +97,7 @@ typedef struct TclDateFields { typedef struct DateInfo { const char *dateStart; const char *dateInput; + const char *dateEnd; TclDateFields date; @@ -110,6 +129,8 @@ typedef struct DateInfo { time_t dateDigitCount; + time_t dateCentury; + Tcl_Obj* messages; /* Error messages */ const char* separatrix; /* String separating messages */ } DateInfo; @@ -157,6 +178,9 @@ ClockInitDateInfo(DateInfo *info) { #define CLF_STRICT (1 << 8) typedef struct ClockFmtScnCmdArgs { + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ @@ -233,6 +257,7 @@ typedef struct ClockScanToken ClockScanToken; typedef int ClockScanTokenProc( + ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok); @@ -241,10 +266,11 @@ typedef int ClockScanTokenProc( #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) #define CLF_LOCALSEC (1 << 5) +#define CLF_CENTURY (1 << 6) #define CLF_SIGNED (1 << 8) typedef enum _CLCKTOK_TYPE { - CTOKT_DIGIT = 1, CTOKT_SPACE, CTOKT_WORD + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD } CLCKTOK_TYPE; typedef struct ClockFmtScnStorage ClockFmtScnStorage; @@ -260,6 +286,7 @@ typedef struct ClockScanTokenMap { unsigned short int maxSize; unsigned short int offs; ClockScanTokenProc *parser; + void *data; } ClockScanTokenMap; typedef struct ClockScanToken { @@ -271,6 +298,9 @@ typedef struct ClockScanToken { } tokWord; } ClockScanToken; +#define ClockScnTokenChar(tok) \ + *tok->tokWord.start; + typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ ClockScanToken *scnTok; diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 928474d..7f23568 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -package require Tcl 8.5- +package require Tcl 8.5 # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. package provide msgcat 1.6.0 @@ -225,6 +225,56 @@ proc msgcat::mc {src args} { } } +# msgcat::mcget -- +# +# Find the translation for the given string based on the given +# locale setting. Check the given namespace first, then look in each +# parent namespace until the source is found. If additional args are +# specified, use the format command to work them into the traslated +# string. +# If no catalog item is found, mcunknown is called in the caller frame +# and its result is returned. +# +# Arguments: +# src The string to translate. +# args Args to pass to the format command +# +# Results: +# Returns the translated string. Propagates errors thrown by the +# format command. + +proc msgcat::mcget {ns loc src args} { + variable Msgs + + if {$loc eq {C}} { + set loclist [PackagePreferences $ns] + } else { + variable PackageConfig + # if {![dict exists $PackageConfig $ns $loc]} { + # set loc [mclocale] + # } + set loclist [dict get $PackageConfig locales $ns $loc] + } + for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { + foreach loc $loclist { + if {[dict exists $Msgs $nscur $loc $src]} { + if {[llength $args]} { + return [format [dict get $Msgs $nscur $loc $src] {*}$args] + } else { + return [dict get $Msgs $nscur $loc $src] + } + } + } + } + # call package local or default unknown command + set args [linsert $args 0 $loclist $src] + switch -exact -- [Invoke unknowncmd $args $ns result 1] { + 0 { return [uplevel 1 [linsert $args 0 [namespace origin mcunknown]]] } + 1 { return [DefaultUnknown {*}$args] } + default { return $result } + } +} + # msgcat::mcexists -- # # Check if a catalog item is set or if mc would invoke mcunknown. @@ -488,6 +538,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { set loclist [GetPreferences $locale] set locale [lindex $loclist 0] dict set PackageConfig loclist $ns $loclist + dict set PackageConfig locales $ns $locale $loclist # load eventual missing locales set loadedLocales [dict get $PackageConfig loadedlocales $ns] @@ -521,6 +572,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { [dict get $PackageConfig loadedlocales $ns] $LoadedLocales] dict unset PackageConfig loadedlocales $ns dict unset PackageConfig loclist $ns + dict unset PackageConfig locales $ns # unset keys not in global loaded locales if {[dict exists $Msgs $ns]} { diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 9267684..fd24068 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -121,10 +121,17 @@ proc test-scan {{reptime 1000}} { # Scan : julian day with time (greedy match): {clock scan "2451545 102030" -format "%J%H%M%S"} + # Scan : century, lookup table month + {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} + # Scan : century, lookup table month and day + {clock scan {1970 Jan 02} -format {%C%y %b %Od} -locale en -gmt 1} + + break + # Scan : zone only {clock scan "CET" -format "%z"} {clock scan "EST" -format "%z"} - #{**STOP** : Wed Nov 25 01:00:00 CET 2015} + {**STOP** : Wed Nov 25 01:00:00 CET 2015} # # Scan : long format test (allock chain) # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} @@ -194,8 +201,8 @@ proc test-other {{reptime 1000}} { proc test {{reptime 1000}} { puts "" - #test-scan $reptime - test-freescan $reptime + test-scan $reptime + #test-freescan $reptime test-other $reptime puts \n**OK** -- cgit v0.12 From a4c93085d2edbf7fd16083ac2766eae0c57e6278 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:25:20 +0000 Subject: l10n (with caching) implemented, msgcat package optimized, code review, etc. --- generic/tclClock.c | 448 +++++++++++++++++++++++++++++----------------- generic/tclClockFmt.c | 193 +++++++++++--------- generic/tclDate.h | 45 ++++- library/clock.tcl | 79 +++++--- library/msgcat/msgcat.tcl | 113 +++++++++--- tests-perf/clock.perf.tcl | 31 +++- tests/clock.test | 8 +- 7 files changed, 608 insertions(+), 309 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 1e9abba..166a4b3 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -59,8 +59,7 @@ typedef enum ClockLiteral { LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, - LIT_GETSYSTEMLOCALE, - LIT_SETUPLOCALE, + LIT_MCGET, LIT_TCL_CLOCK, #if 0 LIT_FREESCAN, #endif @@ -83,13 +82,17 @@ static const char *const Literals[] = { "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", - "::tcl::clock::mclocale", - "::tcl::clock::EnterLocale", + "::msgcat::mcget", "::tcl::clock" #if 0 "::tcl::clock::FreeScan" #endif }; +/* Msgcat literals for exact match (mcKey) */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLiterals, ""); +/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); + static const char *const eras[] = { "CE", "BCE", NULL }; /* @@ -257,9 +260,10 @@ TclClockInit( data->refCount = 0; data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < LIT__END; ++i) { - data->literals[i] = Tcl_NewStringObj(Literals[i], -1); - Tcl_IncrRefCount(data->literals[i]); + Tcl_InitObjRef(data->literals[i], Tcl_NewStringObj(Literals[i], -1)); } + data->mcLiterals = NULL; + data->mcLitIdxs = NULL; data->LastTZEpoch = 0; data->currentYearCentury = ClockDefaultYearCentury; data->yearOfCenturySwitch = ClockDefaultCenturySwitch; @@ -273,6 +277,12 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; + data->CurrentLocale = NULL; + data->CurrentLocaleDict = NULL; + data->LastUnnormUsedLocale = NULL; + data->LastUsedLocale = NULL; + data->LastUsedLocaleDict = NULL; + data->lastBase.timezoneObj = NULL; data->UTC2Local.timezoneObj = NULL; data->UTC2Local.tzName = NULL; @@ -323,6 +333,12 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->LastSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTZData); + Tcl_UnsetObjRef(data->CurrentLocale); + Tcl_UnsetObjRef(data->CurrentLocaleDict); + Tcl_UnsetObjRef(data->LastUnnormUsedLocale); + Tcl_UnsetObjRef(data->LastUsedLocale); + Tcl_UnsetObjRef(data->LastUsedLocaleDict); + Tcl_UnsetObjRef(data->lastBase.timezoneObj); Tcl_UnsetObjRef(data->UTC2Local.timezoneObj); Tcl_UnsetObjRef(data->UTC2Local.tzName); @@ -341,6 +357,18 @@ ClockDeleteCmdProc( for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } + if (data->mcLiterals != NULL) { + for (i = 0; i < MCLIT__END; ++i) { + Tcl_DecrRefCount(data->mcLiterals[i]); + } + data->mcLiterals = NULL; + } + if (data->mcLitIdxs != NULL) { + for (i = 0; i < MCLIT__END; ++i) { + Tcl_DecrRefCount(data->mcLitIdxs[i]); + } + data->mcLitIdxs = NULL; + } ClockConfigureClear(data); @@ -355,9 +383,9 @@ ClockDeleteCmdProc( inline Tcl_Obj * NormTimezoneObj( ClockClientData *dataPtr, /* Client data containing literal pool */ - Tcl_Obj * timezoneObj) + Tcl_Obj *timezoneObj) { - const char * tz; + const char *tz; if ( timezoneObj == dataPtr->LastUnnormSetupTimeZone && dataPtr->LastSetupTimeZone != NULL ) { @@ -399,6 +427,208 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- */ +static Tcl_Obj * +NormLocaleObj( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Obj *localeObj, + Tcl_Obj **mcDictObj) +{ + const char *loc; + if ( localeObj == NULL || localeObj == dataPtr->CurrentLocale + || localeObj == dataPtr->literals[LIT_C] + ) { + *mcDictObj = dataPtr->CurrentLocaleDict; + return dataPtr->CurrentLocale; + } + if ( localeObj == dataPtr->LastUsedLocale + || localeObj == dataPtr->LastUnnormUsedLocale + ) { + *mcDictObj = dataPtr->LastUsedLocaleDict; + return dataPtr->LastUsedLocale; + } + + loc = TclGetString(localeObj); + if (dataPtr->CurrentLocale != NULL && + (localeObj == dataPtr->CurrentLocale + || strcmp(loc, TclGetString(dataPtr->CurrentLocale)) == 0 + ) + ) { + *mcDictObj = dataPtr->CurrentLocaleDict; + localeObj = dataPtr->CurrentLocale; + } + else + if (dataPtr->LastUsedLocale != NULL && + (localeObj == dataPtr->LastUsedLocale + || strcmp(loc, TclGetString(dataPtr->LastUsedLocale)) == 0 + ) + ) { + *mcDictObj = dataPtr->LastUsedLocaleDict; + Tcl_SetObjRef(dataPtr->LastUnnormUsedLocale, localeObj); + localeObj = dataPtr->LastUsedLocale; + } + else + if ( + strcmp(loc, Literals[LIT_C]) == 0 + ) { + *mcDictObj = dataPtr->CurrentLocaleDict; + localeObj = dataPtr->CurrentLocale; + } + else + { + *mcDictObj = NULL; + } + return localeObj; +} + +/* + *---------------------------------------------------------------------- + */ +MODULE_SCOPE Tcl_Obj * +ClockMCDict(ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *callargs[3]; + + /* if dict not yet retrieved */ + if (opts->mcDictObj == NULL) { + + /* if locale was not yet used */ + if ( !(opts->flags & CLF_LOCALE_USED) ) { + + opts->localeObj = NormLocaleObj(opts->clientData, + opts->localeObj, &opts->mcDictObj); + + if (opts->localeObj == NULL) { + Tcl_SetResult(opts->interp, + "locale not specified and no default locale set", TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badOption", NULL); + return NULL; + } + opts->flags |= CLF_LOCALE_USED; + + /* check locale literals already available (on demand creation) */ + if (dataPtr->mcLiterals == NULL) { + int i; + dataPtr->mcLiterals = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); + for (i = 0; i < MCLIT__END; ++i) { + Tcl_InitObjRef(dataPtr->mcLiterals[i], + Tcl_NewStringObj(MsgCtLiterals[i], -1)); + } + } + } + + if (opts->mcDictObj == NULL) { + /* get msgcat dictionary - ::msgcat::mcget ::tcl::clock locale */ + callargs[0] = dataPtr->literals[LIT_MCGET]; + callargs[1] = dataPtr->literals[LIT_TCL_CLOCK]; + callargs[2] = opts->localeObj; + + if (Tcl_EvalObjv(opts->interp, 3, callargs, 0) != TCL_OK) { + return NULL; + } + + opts->mcDictObj = Tcl_GetObjResult(opts->interp); + if ( opts->localeObj == dataPtr->CurrentLocale ) { + Tcl_SetObjRef(dataPtr->CurrentLocaleDict, opts->mcDictObj); + } else { + Tcl_SetObjRef(dataPtr->LastUsedLocale, opts->localeObj); + Tcl_UnsetObjRef(dataPtr->LastUnnormUsedLocale); + Tcl_SetObjRef(dataPtr->LastUsedLocaleDict, opts->mcDictObj); + } + } + } + + return opts->mcDictObj; +} + +MODULE_SCOPE Tcl_Obj * +ClockMCGet( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + ClockClientData *dataPtr = opts->clientData; + + Tcl_Obj *valObj = NULL; + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + Tcl_DictObjGet(opts->interp, opts->mcDictObj, + dataPtr->mcLiterals[mcKey], &valObj); + + return valObj; /* or NULL in obscure case if Tcl_DictObjGet failed */ +} + +MODULE_SCOPE Tcl_Obj * +ClockMCGetListIdxDict( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + ClockClientData *dataPtr = opts->clientData; + + Tcl_Obj *valObj = NULL; + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to get indices dictionray, + * if not available - create from list */ + + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + dataPtr->mcLitIdxs[mcKey], &valObj) != TCL_OK + ) { + Tcl_Obj **lstv, *intObj; + int i, lstc; + + if (dataPtr->mcLitIdxs == NULL) { + dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); + for (i = 0; i < MCLIT__END; ++i) { + Tcl_InitObjRef(dataPtr->mcLitIdxs[i], + Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); + } + } + + if (Tcl_DictObjGet(opts->interp, opts->mcDictObj, + dataPtr->mcLiterals[mcKey], &valObj) != TCL_OK) { + return NULL; + }; + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + return NULL; + }; + + valObj = Tcl_NewDictObj(); + for (i = 0; i < lstc; i++) { + intObj = Tcl_NewIntObj(i); + if (Tcl_DictObjPut(opts->interp, valObj, + lstv[i], intObj) != TCL_OK + ) { + Tcl_DecrRefCount(valObj); + Tcl_DecrRefCount(intObj); + return NULL; + } + }; + + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + dataPtr->mcLitIdxs[mcKey], valObj) != TCL_OK + ) { + Tcl_DecrRefCount(valObj); + return NULL; + } + }; + + return valObj; +} + +/* + *---------------------------------------------------------------------- + */ static int ClockConfigureObjCmd( ClientData clientData, /* Client data containing literal pool */ @@ -410,23 +640,25 @@ ClockConfigureObjCmd( Tcl_Obj **litPtr = dataPtr->literals; static const char *const options[] = { - "-system-tz", "-setup-tz", "-clear", + "-system-tz", "-setup-tz", "-default-locale", + "-clear", "-year-century", "-century-switch", NULL }; enum optionInd { - CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CLEAR_CACHE, + CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CURRENT_LOCALE, + CLOCK_CLEAR_CACHE, CLOCK_YEAR_CENTURY, CLOCK_CENTURY_SWITCH, CLOCK_SETUP_GMT, CLOCK_SETUP_NOP }; int optionIndex; /* Index of an option. */ int i; - for (i = 1; i < objc; i+=2) { - if (Tcl_GetIndexFromObj(interp, objv[i], options, + for (i = 1; i < objc; i++) { + if (Tcl_GetIndexFromObj(interp, objv[i++], options, "option", 0, &optionIndex) != TCL_OK) { Tcl_SetErrorCode(interp, "CLOCK", "badOption", - Tcl_GetString(objv[i]), NULL); + Tcl_GetString(objv[i-1]), NULL); return TCL_ERROR; } switch (optionIndex) { @@ -434,24 +666,24 @@ ClockConfigureObjCmd( if (1) { /* validate current tz-epoch */ unsigned long lastTZEpoch = TzsetGetEpoch(); - if (i+1 < objc) { - if (dataPtr->SystemTimeZone != objv[i+1]) { - Tcl_SetObjRef(dataPtr->SystemTimeZone, objv[i+1]); + if (i < objc) { + if (dataPtr->SystemTimeZone != objv[i]) { + Tcl_SetObjRef(dataPtr->SystemTimeZone, objv[i]); Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); } dataPtr->LastTZEpoch = lastTZEpoch; } - if (dataPtr->SystemTimeZone != NULL + if (i+1 >= objc && dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == lastTZEpoch) { Tcl_SetObjResult(interp, dataPtr->SystemTimeZone); } } break; case CLOCK_SETUP_TZ: - if (i+1 < objc) { + if (i < objc) { /* differentiate GMT and system zones, because used often */ - Tcl_Obj *timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); - Tcl_SetObjRef(dataPtr->LastUnnormSetupTimeZone, objv[i+1]); + Tcl_Obj *timezoneObj = NormTimezoneObj(dataPtr, objv[i]); + Tcl_SetObjRef(dataPtr->LastUnnormSetupTimeZone, objv[i]); if (dataPtr->LastSetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->LastSetupTZData); @@ -463,7 +695,7 @@ ClockConfigureObjCmd( } switch (optionIndex) { case CLOCK_SETUP_GMT: - if (i+1 < objc) { + if (i < objc) { if (dataPtr->GMTSetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->GMTSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->GMTSetupTZData); @@ -471,7 +703,7 @@ ClockConfigureObjCmd( } break; case CLOCK_SETUP_TZ: - if (i+1 < objc) { + if (i < objc) { if (dataPtr->AnySetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->AnySetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->AnySetupTZData); @@ -480,35 +712,52 @@ ClockConfigureObjCmd( break; } } - if (dataPtr->LastSetupTimeZone != NULL) { + if (i+1 >= objc && dataPtr->LastSetupTimeZone != NULL) { Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); } break; + case CLOCK_CURRENT_LOCALE: + if (i < objc) { + if (dataPtr->CurrentLocale != objv[i]) { + Tcl_SetObjRef(dataPtr->CurrentLocale, objv[i]); + Tcl_UnsetObjRef(dataPtr->CurrentLocaleDict); + } + } + if (i+1 >= objc && dataPtr->CurrentLocale != NULL) { + Tcl_SetObjResult(interp, dataPtr->CurrentLocale); + } + break; case CLOCK_YEAR_CENTURY: - if (i+1 < objc) { + if (i < objc) { int year; - if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + if (TclGetIntFromObj(interp, objv[i], &year) != TCL_OK) { return TCL_ERROR; } dataPtr->currentYearCentury = year; - Tcl_SetObjResult(interp, objv[i+1]); + if (i+1 >= objc) { + Tcl_SetObjResult(interp, objv[i]); + } continue; - } - Tcl_SetObjResult(interp, - Tcl_NewIntObj(dataPtr->currentYearCentury)); + } + if (i+1 >= objc) { + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->currentYearCentury)); + } break; case CLOCK_CENTURY_SWITCH: - if (i+1 < objc) { + if (i < objc) { int year; - if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + if (TclGetIntFromObj(interp, objv[i], &year) != TCL_OK) { return TCL_ERROR; } dataPtr->yearOfCenturySwitch = year; - Tcl_SetObjResult(interp, objv[i+1]); + Tcl_SetObjResult(interp, objv[i]); continue; - } - Tcl_SetObjResult(interp, - Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); + } + if (i+1 >= objc) { + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); + } break; case CLOCK_CLEAR_CACHE: ClockConfigureClear(dataPtr); @@ -597,7 +846,7 @@ ClockGetSystemTimeZone( } Tcl_UnsetObjRef(dataPtr->SystemTimeZone); - Tcl_UnsetObjRef(data->SystemSetupTZData); + Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); literals = dataPtr->literals; @@ -683,125 +932,6 @@ ClockFormatNumericTimeZone(int z) { } return Tcl_ObjPrintf("%c%02d%02d", sign, h, m); } - -/* - *---------------------------------------------------------------------- - */ -inline Tcl_Obj * -NormLocaleObj( - ClockClientData *dataPtr, /* Client data containing literal pool */ - Tcl_Obj *localeObj) -{ - const char * tz; - if ( localeObj == dataPtr->LastUnnormSetupLocale - && dataPtr->LastSetupLocale != NULL - ) { - return dataPtr->LastSetupLocale; - } - if ( localeObj == dataPtr->LastSetupLocale - || localeObj == dataPtr->literals[LIT_CLOCALE] - || localeObj == dataPtr->SystemLocale - || localeObj == dataPtr->AnySetupLocale - ) { - return localeObj; - } - - tz = TclGetString(localeObj); - if (dataPtr->AnySetupLocale != NULL && - (localeObj == dataPtr->AnySetupLocale - || strcmp(tz, TclGetString(dataPtr->AnySetupLocale)) == 0 - ) - ) { - localeObj = dataPtr->AnySetupLocale; - } - else - if (dataPtr->SystemLocale != NULL && - (localeObj == dataPtr->SystemLocale - || strcmp(tz, TclGetString(dataPtr->SystemLocale)) == 0 - ) - ) { - localeObj = dataPtr->SystemLocale; - } - else - if ( - strcmp(tz, Literals[LIT_GMT]) == 0 - ) { - localeObj = dataPtr->literals[LIT_GMT]; - } - return localeObj; -} -/* - *---------------------------------------------------------------------- - */ -static Tcl_Obj * -ClockGetSystemLocale( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp) /* Tcl interpreter */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals; - - /* if known (cached) - return now */ - if (dataPtr->SystemLocale != NULL) { - return dataPtr->SystemLocale; - } - - literals = dataPtr->literals; - - if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMLOCALE], 0) != TCL_OK) { - return NULL; - } - Tcl_SetObjRef(dataPtr->SystemLocale, Tcl_GetObjResult(interp)); - return dataPtr->SystemLocale; -} -/* - *---------------------------------------------------------------------- - */ -static Tcl_Obj * -ClockSetupLocale( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp, /* Tcl interpreter */ - Tcl_Obj *localeObj) -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - Tcl_Obj *callargs[2]; - - if (localeObj == NULL || localeObj == dataPtr->SystemLocale) { - if (dataPtr->SystemLocale == NULL) { - return ClockGetSystemLocale(clientData, interp); - } - return dataPtr->SystemLocale; - } - -#if 0 - /* if cached (if already setup this one) */ - if ( dataPtr->LastSetupTimeZone != NULL - && ( localeObj == dataPtr->LastSetupTimeZone - || timezoneObj == dataPtr->LastUnnormSetupTimeZone - ) - ) { - return dataPtr->LastSetupTimeZone; - } - - /* differentiate GMT and system zones, because used often and already set */ - timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); - if ( timezoneObj == dataPtr->GMTSetupTimeZone - || timezoneObj == dataPtr->SystemTimeZone - || timezoneObj == dataPtr->AnySetupTimeZone - ) { - return timezoneObj; - } - -#endif - callargs[0] = literals[LIT_SETUPLOCALE]; - callargs[1] = localeObj; - - if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { - return localeObj; // dataPtr->CurrentLocale; - } - return NULL; -} /* *---------------------------------------------------------------------- * @@ -2741,19 +2871,13 @@ ClockScanObjCmd( } } - /* Setup timezone and locale */ + /* Setup timezone (normalize object id needed and load TZ on demand) */ opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); if (opts.timezoneObj == NULL) { return TCL_ERROR; } - opts.localeObj = ClockSetupLocale(clientData, interp, opts.localeObj); - if (opts.localeObj == NULL) { - return TCL_ERROR; - } - - ClockInitDateInfo(info); yydate.tzName = NULL; diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 17181d9..a3c7f20 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -454,45 +454,55 @@ Tcl_GetClockFrmScnFromObj( return fss; } - + +/* + * DetermineGreedySearchLen -- + * + * Determine min/max lengths as exact as possible (speed, greedy match) + * + */ +inline +void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok, int *minLen, int *maxLen) +{ + register const char*p = yyInput; + *minLen = 0; + *maxLen = info->dateEnd - p; + + /* if no tokens anymore */ + if (!(tok+1)->map) { + /* should match to end or first space */ + while (!isspace(UCHAR(*p)) && ++p < info->dateEnd) {}; + *minLen = p - yyInput; + } +} static int LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, const char * mcKey, int *val) + DateInfo *info, int mcKey, int *val, + int minLen, int maxLen) { - Tcl_Obj *callargs[4] = {NULL, NULL, NULL, NULL}, **lstv; - int i, lstc; - Tcl_Obj *valObj = NULL; - int ret = TCL_RETURN; + Tcl_Obj **lstv; + int lstc, i, l; + const char *s; + Tcl_Obj *valObj; /* get msgcat value */ - TclNewLiteralStringObj(callargs[0], "::msgcat::mcget"); - TclNewLiteralStringObj(callargs[1], "::tcl::clock"); - callargs[2] = opts->localeObj; - if (opts->localeObj == NULL) { - TclNewLiteralStringObj(callargs[1], "c"); - } - callargs[3] = Tcl_NewStringObj(mcKey, -1); - - for (i = 0; i < 4; i++) { - Tcl_IncrRefCount(callargs[i]); - } - if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK) { - goto done; + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + return TCL_ERROR; } - Tcl_InitObjRef(valObj, Tcl_GetObjResult(opts->interp)); - /* is a list */ if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { - goto done; + return TCL_ERROR; } /* search in list */ for (i = 0; i < lstc; i++) { - const char *s = TclGetString(lstv[i]); - int l = lstv[i]->length; - if ( l <= info->dateEnd - yyInput + s = TclGetString(lstv[i]); + l = lstv[i]->length; + if ( l >= minLen && l <= maxLen && strncasecmp(yyInput, s, l) == 0 ) { *val = i; @@ -501,21 +511,11 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, } } - ret = TCL_OK; /* if not found */ - if (i >= lstc) { - ret = TCL_ERROR; - } - -done: - - Tcl_UnsetObjRef(valObj); - - for (i = 0; i < 4; i++) { - Tcl_UnsetObjRef(callargs[i]); + if (i < lstc) { + return TCL_OK; } - - return ret; + return TCL_RETURN; } static int @@ -535,12 +535,34 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, } s++; } - if (*s == NULL) { - return TCL_ERROR; + if (*s != NULL) { + return TCL_OK; } - - return TCL_OK; -}; + return TCL_RETURN; +} + +inline const char * +FindWordEnd( + ClockScanToken *tok, + register const char * p, const char * end) +{ + register const char *x = tok->tokWord.start; + if (x == tok->tokWord.end) { /* single char word */ + if (*p != *x) { + /* no match -> error */ + return NULL; + } + return ++p; + } + /* multi-char word */ + while (*p++ == *x++) { + if (x >= tok->tokWord.end || p >= end) { + /* no match -> error */ + return NULL; + } + }; + return p; +} static int ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, @@ -560,19 +582,26 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, }; int val; if (StaticListSearch(opts, info, months, &val) != TCL_OK) { - return TCL_ERROR; + return TCL_RETURN; } yyMonth = (val % 12) + 1; return TCL_OK; */ - int val; - int ret = LocaleListSearch(opts, info, "MONTHS_FULL", &val); + int ret, val; + int minLen; + int maxLen; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + ret = LocaleListSearch(opts, info, MCLIT_MONTHS_FULL, &val, + minLen, maxLen); if (ret != TCL_OK) { + /* if not found */ if (ret == TCL_RETURN) { - return ret; + ret = LocaleListSearch(opts, info, MCLIT_MONTHS_ABBREV, &val, + minLen, maxLen); } - ret = LocaleListSearch(opts, info, "MONTHS_ABBREV", &val); if (ret != TCL_OK) { return ret; } @@ -588,9 +617,14 @@ static int ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { - int val; + int ret, val; + int minLen; + int maxLen; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); - int ret = LocaleListSearch(opts, info, (char *)tok->map->data, &val); + ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, + minLen, maxLen); if (ret != TCL_OK) { return ret; } @@ -639,8 +673,8 @@ static ClockScanTokenMap ScnSTokenMap[] = { NULL}, }; static const char *ScnSTokenWrapMapIndex[2] = { - "eBh", - "dbb" + "eNBh", + "dmbb" }; static const char *ScnETokenMapIndex = @@ -654,11 +688,14 @@ static const char *ScnETokenWrapMapIndex[2] = { }; static const char *ScnOTokenMapIndex = - "d"; + "dm"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.dayOfMonth), - ClockScnToken_LocaleListMatcher_Proc, "LOCALE_NUMERALS"}, + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.month), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenWrapMapIndex[2] = { "e", @@ -730,7 +767,7 @@ ClockGetOrParseScanFormat( switch (*p) { case '%': if (1) { - ClockScanTokenMap * maps = ScnSTokenMap; + ClockScanTokenMap * scnMap = ScnSTokenMap; const char *mapIndex = ScnSTokenMapIndex, **wrapIndex = ScnSTokenWrapMapIndex; if (p+1 >= e) { @@ -748,13 +785,13 @@ ClockGetOrParseScanFormat( continue; break; case 'E': - maps = ScnETokenMap, + scnMap = ScnETokenMap, mapIndex = ScnETokenMapIndex, wrapIndex = ScnETokenWrapMapIndex; p++; break; case 'O': - maps = ScnOTokenMap, + scnMap = ScnOTokenMap, mapIndex = ScnOTokenMapIndex, wrapIndex = ScnOTokenWrapMapIndex; p++; @@ -778,7 +815,7 @@ ClockGetOrParseScanFormat( goto word_tok; } } - tok->map = &ScnSTokenMap[cp - mapIndex]; + tok->map = &scnMap[cp - mapIndex]; tok->tokWord.start = p; /* calculate look ahead value by standing together tokens */ if (tok > fss->scnTok) { @@ -928,7 +965,7 @@ ClockScan( size = p - yyInput; if (size < map->minSize) { /* missing input -> error */ - goto error; + goto not_match; } /* string 2 number, put number into info structure by offset */ p = yyInput; x = p + size; @@ -953,10 +990,10 @@ ClockScan( case TCL_OK: break; case TCL_RETURN: - goto done; + goto not_match; break; default: - goto error; + goto done; break; }; p = yyInput; @@ -967,7 +1004,7 @@ ClockScan( if (opts->flags & CLF_STRICT) { if (!isspace(UCHAR(*p))) { /* unmatched -> error */ - goto error; + goto not_match; } p++; } @@ -976,21 +1013,13 @@ ClockScan( } break; case CTOKT_WORD: - x = tok->tokWord.start; - if (x == tok->tokWord.end) { /* single char word */ - if (*p != *x) { - /* no match -> error */ - goto error; - } - p++; - continue; - } - /* multi-char word */ - while (p < end && x < tok->tokWord.end && *p++ == *x++) {}; - if (x < tok->tokWord.end) { + x = FindWordEnd(tok, p, end); + if (!x) { /* no match -> error */ - goto error; + goto not_match; } + p = x; + continue; break; } } @@ -1002,7 +1031,7 @@ ClockScan( /* check end was reached */ if (p < end) { /* something after last token - wrong format */ - goto error; + goto not_match; } /* invalidate result */ @@ -1045,15 +1074,15 @@ ClockScan( overflow: - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "integer value too large to represent", -1)); - Tcl_SetErrorCode(interp, "CLOCK", "integervalueTooLarge", NULL); + Tcl_SetResult(interp, "requested date too large to represent", + TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); goto done; -error: +not_match: - Tcl_SetResult(interp, - "input string does not match supplied format", TCL_STATIC); + Tcl_SetResult(interp, "input string does not match supplied format", + TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); done: diff --git a/generic/tclDate.h b/generic/tclDate.h index d97cd3c..1c51a02 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -35,6 +35,22 @@ #define CLF_INVALIDATE_JULIANDAY (1 << 7) /* assemble julianDay using year, month, etc. */ #define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ + +/* + * Enumeration of the msgcat literals used in [clock] + */ + +typedef enum ClockMsgCtLiteral { + MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, + MCLIT_LOCALE_NUMERALS, + MCLIT__END +} ClockMsgCtLiteral; + +#define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ + pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ + pref "LOCALE_NUMERALS", \ +} + /* * Primitives to safe set, reset and free references. */ @@ -176,16 +192,19 @@ ClockInitDateInfo(DateInfo *info) { #define CLF_EXTENDED (1 << 4) #define CLF_STRICT (1 << 8) +#define CLF_LOCALE_USED (1 << 15) typedef struct ClockFmtScnCmdArgs { - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp, /* Tcl interpreter */ + ClientData clientData; /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp; /* Tcl interpreter */ Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ Tcl_Obj *baseObj; /* Base (scan only) */ int flags; /* Flags control scanning */ + + Tcl_Obj *mcDictObj; /* Current dictionary of tcl::clock package for given localeObj*/ } ClockFmtScnCmdArgs; /* @@ -194,7 +213,11 @@ typedef struct ClockFmtScnCmdArgs { typedef struct ClockClientData { int refCount; /* Number of live references. */ - Tcl_Obj **literals; /* Pool of object literals. */ + Tcl_Obj **literals; /* Pool of object literals (common, locale independent). */ + Tcl_Obj **mcLiterals; /* Msgcat object literals with mc-keys for search with locale. */ + Tcl_Obj **mcLitIdxs; /* Msgcat object indices prefixed with _IDX_, + * used for quick dictionary search */ + /* Cache for current clock parameters, imparted via "configure" */ unsigned long LastTZEpoch; int currentYearCentury; @@ -208,6 +231,13 @@ typedef struct ClockClientData { Tcl_Obj *LastUnnormSetupTimeZone; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; + + Tcl_Obj *CurrentLocale; + Tcl_Obj *CurrentLocaleDict; + Tcl_Obj *LastUnnormUsedLocale; + Tcl_Obj *LastUsedLocale; + Tcl_Obj *LastUsedLocaleDict; + /* Cache for last base (last-second fast convert if base/tz not changed) */ struct { Tcl_Obj *timezoneObj; @@ -328,6 +358,15 @@ MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); +/* tclClock.c module declarations */ + +MODULE_SCOPE Tcl_Obj * + ClockMCDict(ClockFmtScnCmdArgs *opts); +MODULE_SCOPE Tcl_Obj * + ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE Tcl_Obj * + ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); + /* tclClockFmt.c module declarations */ MODULE_SCOPE ClockFmtScnStorage * diff --git a/library/clock.tcl b/library/clock.tcl index ebbecb9..b4632b1 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -289,8 +289,9 @@ proc ::tcl::clock::Initialize {} { # Default configuration - # configure -year-century 2000 \ - # -century-switch 38 + configure -default-locale [mclocale] + #configure -year-century 2000 \ + # -century-switch 38 # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise @@ -2105,6 +2106,51 @@ proc ::tcl::clock::MakeParseCodeFromFields { dateFields parseActions } { #---------------------------------------------------------------------- # +# GetSystemTimeZone -- +# +# Determines the system time zone, which is the default for the +# 'clock' command if no other zone is supplied. +# +# Parameters: +# None. +# +# Results: +# Returns the system time zone. +# +# Side effects: +# Stores the sustem time zone in engine configuration, since +# determining it may be an expensive process. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::GetSystemLocale {} { + if { $::tcl_platform(platform) ne {windows} } { + # On a non-windows platform, the 'system' locale is the same as + # the 'current' locale + + return [mclocale] + } + + # On a windows platform, the 'system' locale is adapted from the + # 'current' locale by applying the date and time formats from the + # Control Panel. First, load the 'current' locale if it's not yet + # loaded + + mcpackagelocale set [mclocale] + + # Make a new locale string for the system locale, and get the + # Control Panel information + + set locale [mclocale]_windows + if { ! [mcpackagelocale present $locale] } { + LoadWindowsDateTimeFormats $locale + } + + return $locale +} + +#---------------------------------------------------------------------- +# # EnterLocale -- # # Switch [mclocale] to a given locale if necessary @@ -2121,33 +2167,12 @@ proc ::tcl::clock::MakeParseCodeFromFields { dateFields parseActions } { #---------------------------------------------------------------------- proc ::tcl::clock::EnterLocale { locale } { - if { $locale eq {system} } { - if { $::tcl_platform(platform) ne {windows} } { - # On a non-windows platform, the 'system' locale is the same as - # the 'current' locale - - set locale current - } else { - # On a windows platform, the 'system' locale is adapted from the - # 'current' locale by applying the date and time formats from the - # Control Panel. First, load the 'current' locale if it's not yet - # loaded - - mcpackagelocale set [mclocale] - - # Make a new locale string for the system locale, and get the - # Control Panel information - - set locale [mclocale]_windows - if { ! [mcpackagelocale present $locale] } { - LoadWindowsDateTimeFormats $locale - } - } - } - if { $locale eq {current}} { + switch -- $locale system { + set locale [GetSystemLocale] + } current { set locale [mclocale] } - # Eventually load the locale + # Select the locale, eventually load it mcpackagelocale set $locale } diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 7f23568..3fd2cdb 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -227,52 +227,61 @@ proc msgcat::mc {src args} { # msgcat::mcget -- # -# Find the translation for the given string based on the given -# locale setting. Check the given namespace first, then look in each -# parent namespace until the source is found. If additional args are -# specified, use the format command to work them into the traslated -# string. -# If no catalog item is found, mcunknown is called in the caller frame -# and its result is returned. +# Return the translation for the given string based on the given +# locale setting or the whole dictionary object of the package/locale. +# Searching of catalog is similar to "msgcat::mc". +# +# Contrary to "msgcat::mc" may additionally load a package catalog +# on demand. # # Arguments: -# src The string to translate. -# args Args to pass to the format command +# ns The package namespace (as catalog selector). +# loc The locale used for translation. +# {src} The string to translate. +# {args} Args to pass to the format command # # Results: # Returns the translated string. Propagates errors thrown by the # format command. -proc msgcat::mcget {ns loc src args} { +proc msgcat::mcget {ns loc args} { variable Msgs if {$loc eq {C}} { set loclist [PackagePreferences $ns] + set loc [lindex $loclist 0] } else { + set loc [string tolower $loc] variable PackageConfig - # if {![dict exists $PackageConfig $ns $loc]} { - # set loc [mclocale] - # } - set loclist [dict get $PackageConfig locales $ns $loc] + # get locales list for given locale (de_de -> {de_de de {}}) + if {[catch { + set loclist [dict get $PackageConfig locales $ns $loc] + }]} { + # lazy load catalog on demand + mcpackagelocale load $loc $ns + set loclist [dict get $PackageConfig locales $ns $loc] + } } + if {![llength $args]} { + # get whole catalog: + return [msgcat::Merge $ns $loclist] + } + set src [lindex $args 0] + # search translation for each locale (regarding parent namespaces) for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { foreach loc $loclist { if {[dict exists $Msgs $nscur $loc $src]} { - if {[llength $args]} { - return [format [dict get $Msgs $nscur $loc $src] {*}$args] + if {[llength $args] > 1} { + return [format [dict get $Msgs $nscur $loc $src] \ + {*}[lrange $args 1 end]] } else { return [dict get $Msgs $nscur $loc $src] } } } } - # call package local or default unknown command - set args [linsert $args 0 $loclist $src] - switch -exact -- [Invoke unknowncmd $args $ns result 1] { - 0 { return [uplevel 1 [linsert $args 0 [namespace origin mcunknown]]] } - 1 { return [DefaultUnknown {*}$args] } - default { return $result } - } + # get with package default locale + mcget $ns [lindex $loclist 0] {*}$args } # msgcat::mcexists -- @@ -465,6 +474,10 @@ proc msgcat::mcloadedlocales {subcommand} { # items, if the former locale was the default locale. # Returns the normalized set locale. # The default locale is taken, if locale is not given. +# load +# Load a package locale without set it (lazy loading from mcget). +# Returns the normalized set locale. +# The default locale is taken, if locale is not given. # get # Get the locale valid for this package. # isset @@ -492,7 +505,7 @@ proc msgcat::mcloadedlocales {subcommand} { # Results: # Empty string, if not stated differently for the subcommand -proc msgcat::mcpackagelocale {subcommand {locale ""}} { +proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { # todo: implement using an ensemble variable Loclist variable LoadedLocales @@ -512,7 +525,9 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { } set locale [string tolower $locale] } - set ns [uplevel 1 {::namespace current}] + if {$ns eq ""} { + set ns [uplevel 1 {::namespace current}] + } switch -exact -- $subcommand { get { return [lindex [PackagePreferences $ns] 0] } @@ -520,7 +535,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { loaded { return [PackageLocales $ns] } present { return [expr {$locale in [PackageLocales $ns]} ]} isset { return [dict exists $PackageConfig loclist $ns] } - set { # set a package locale or add a package locale + set - load { # set a package locale or add a package locale # Copy the default locale if no package locale set so far if {![dict exists $PackageConfig loclist $ns]} { @@ -530,18 +545,21 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { # Check if changed set loclist [dict get $PackageConfig loclist $ns] - if {! [info exists locale] || $locale eq [lindex $loclist 0] } { + if {[llength [info level 0]] == 2 || $locale eq [lindex $loclist 0] } { return [lindex $loclist 0] } # Change loclist set loclist [GetPreferences $locale] set locale [lindex $loclist 0] - dict set PackageConfig loclist $ns $loclist - dict set PackageConfig locales $ns $locale $loclist + if {$subcommand eq {set}} { + # set loclist + dict set PackageConfig loclist $ns $loclist + } # load eventual missing locales set loadedLocales [dict get $PackageConfig loadedlocales $ns] + dict set PackageConfig locales $ns $locale $loclist if {$locale in $loadedLocales} { return $locale } set loadLocales [ListComplement $loadedLocales $loclist] dict set PackageConfig loadedlocales $ns\ @@ -899,6 +917,39 @@ proc msgcat::Load {ns locales {callbackonly 0}} { return $x } +# msgcat::Merge -- +# +# Merge message catalog dictionaries to one dictionary. +# +# Arguments: +# ns Namespace (equal package) to load the message catalog. +# locales List of locales to merge. +# +# Results: +# Returns the merged dictionary of message catalogs. +proc msgcat::Merge {ns locales} { + variable Merged + if {![catch { + set mrgcat [dict get $Merged $ns [set loc [lindex $locales 0]]] + }]} { + return $mrgcat + } + variable Msgs + # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en): + if {[llength $locales] > 1} { + set mrgcat [msgcat::Merge $ns [lrange $locales 1 end]] + catch { + set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] + } + } else { + catch { + set mrgcat [dict get $Msgs $ns $loc] + } + } + dict set Merged $ns $loc $mrgcat + return $mrgcat +} + # msgcat::Invoke -- # # Invoke a set of registered callbacks. @@ -971,6 +1022,7 @@ proc msgcat::Invoke {index arglist {ns ""} {resultname ""} {failerror 0}} { proc msgcat::mcset {locale src {dest ""}} { variable Msgs + variable Merged if {[llength [info level 0]] == 3} { ;# dest not specified set dest $src } @@ -980,6 +1032,7 @@ proc msgcat::mcset {locale src {dest ""}} { set locale [string tolower $locale] dict set Msgs $ns $locale $src $dest + dict unset Merged $ns return $dest } @@ -1019,6 +1072,7 @@ proc msgcat::mcflset {src {dest ""}} { proc msgcat::mcmset {locale pairs} { variable Msgs + variable Merged set length [llength $pairs] if {$length % 2} { @@ -1032,6 +1086,7 @@ proc msgcat::mcmset {locale pairs} { foreach {src dest} $pairs { dict set Msgs $ns $locale $src $dest } + dict unset Merged $ns return [expr {$length / 2}] } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index fd24068..a005648 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -19,10 +19,11 @@ ## set testing defaults: set ::env(TCL_TZ) :CET -## warm-up (load clock.tcl, system zones, etc.): +## warm-up (load clock.tcl, system zones, locales, etc.): clock scan "" -gmt 1 clock scan "" clock scan "" -timezone :CET +clock scan "" -format "" -locale en ## ------------------------------------------ @@ -37,6 +38,20 @@ proc _test_get_commands {lst} { proc _test_out_total {} { upvar _ _ + if {![llength $_(ittm)]} { + puts "" + return + } + + set mintm 0x7fffffff + set maxtm 0 + set i 0 + foreach tm $_(ittm) { + if {$tm > $maxtm} {set maxtm $tm; set maxi $i} + if {$tm < $mintm} {set mintm $tm; set mini $i} + incr i + } + puts [string repeat ** 40] puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] @@ -48,6 +63,16 @@ proc _test_out_total {} { lset _(m) 2 [expr {[lindex $_(m) 2] / [llength $_(itcnt)]}] lset _(m) 4 [expr {[lindex $_(m) 2] * (1000 / $_(reptime))}] puts $_(m) + puts "Min:" + lset _(m) 0 [lindex $_(ittm) $mini] + lset _(m) 2 [lindex $_(itcnt) $mini] + lset _(m) 2 [lindex $_(itrate) $mini] + puts $_(m) + puts "Max:" + lset _(m) 0 [lindex $_(ittm) $maxi] + lset _(m) 2 [lindex $_(itcnt) $maxi] + lset _(m) 2 [lindex $_(itrate) $maxi] + puts $_(m) puts [string repeat ** 40] puts "" } @@ -123,8 +148,10 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} - # Scan : century, lookup table month and day + # Scan : century, lookup table month and day (both entries are first) {clock scan {1970 Jan 02} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) + {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} break diff --git a/tests/clock.test b/tests/clock.test index 9e3dbd7..22b5bc1 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18553,12 +18553,12 @@ test clock-6.8 {input of seconds} { } 9223372036854775807 test clock-6.9 {input of seconds - overflow} { - list [catch {clock scan -9223372036854775809 -format %s -gmt true} result] $result -} {1 {integer value too large to represent}} + list [catch {clock scan -9223372036854775809 -format %s -gmt true} result] $result $::errorCode +} {1 {requested date too large to represent} {CLOCK dateTooLarge}} test clock-6.10 {input of seconds - overflow} { - list [catch {clock scan 9223372036854775808 -format %s -gmt true} result] $result -} {1 {integer value too large to represent}} + list [catch {clock scan 9223372036854775808 -format %s -gmt true} result] $result $::errorCode +} {1 {requested date too large to represent} {CLOCK dateTooLarge}} test clock-6.11 {input of seconds - two values} { clock scan {1 2} -format {%s %s} -gmt true -- cgit v0.12 From c52322d40935741e19091f547619c69a831515e1 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:28:25 +0000 Subject: improve LocalizeFormat, internal caching of localized formats inside msgcat for locale and format objects smart reference introduced in dict (smart pointer with 0 object reference but increase dict-reference, provide changeable locale dict) --- generic/tclClock.c | 64 ++++++++++++++++++++++-- generic/tclClockFmt.c | 75 ++++++++++++++++++++-------- generic/tclDate.h | 10 ++-- generic/tclDictObj.c | 122 ++++++++++++++++++++++++++++++++++------------ generic/tclInt.h | 1 + library/clock.tcl | 83 ++++++++++++++++++++----------- library/init.tcl | 2 +- library/msgcat/msgcat.tcl | 3 +- 8 files changed, 269 insertions(+), 91 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 166a4b3..e066812 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -60,6 +60,7 @@ typedef enum ClockLiteral { LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, LIT_MCGET, LIT_TCL_CLOCK, + LIT_LOCALIZE_FORMAT, #if 0 LIT_FREESCAN, #endif @@ -82,7 +83,8 @@ static const char *const Literals[] = { "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", - "::msgcat::mcget", "::tcl::clock" + "::msgcat::mcget", "::tcl::clock", + "::tcl::clock::LocalizeFormat" #if 0 "::tcl::clock::FreeScan" #endif @@ -487,7 +489,6 @@ MODULE_SCOPE Tcl_Obj * ClockMCDict(ClockFmtScnCmdArgs *opts) { ClockClientData *dataPtr = opts->clientData; - Tcl_Obj *callargs[3]; /* if dict not yet retrieved */ if (opts->mcDictObj == NULL) { @@ -518,6 +519,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } if (opts->mcDictObj == NULL) { + Tcl_Obj *callargs[3]; /* get msgcat dictionary - ::msgcat::mcget ::tcl::clock locale */ callargs[0] = dataPtr->literals[LIT_MCGET]; callargs[1] = dataPtr->literals[LIT_TCL_CLOCK]; @@ -528,6 +530,11 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } opts->mcDictObj = Tcl_GetObjResult(opts->interp); + /* be sure that object reference not increases (dict changeable) */ + if (opts->mcDictObj->refCount > 0) { + /* smart reference (shared dict as object with no ref-counter) */ + opts->mcDictObj = Tcl_DictObjSmartRef(opts->interp, opts->mcDictObj); + } if ( opts->localeObj == dataPtr->CurrentLocale ) { Tcl_SetObjRef(dataPtr->CurrentLocaleDict, opts->mcDictObj); } else { @@ -535,6 +542,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) Tcl_UnsetObjRef(dataPtr->LastUnnormUsedLocale); Tcl_SetObjRef(dataPtr->LastUsedLocaleDict, opts->mcDictObj); } + Tcl_ResetResult(opts->interp); } } @@ -626,6 +634,56 @@ ClockMCGetListIdxDict( return valObj; } +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + /* call LocalizeFormat locale format fmtkey */ + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + Tcl_DecrRefCount(keyObj); + return NULL; + } + + valObj = Tcl_GetObjResult(opts->interp); + + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + Tcl_DecrRefCount(keyObj); + return NULL; + } + + Tcl_DecrRefCount(keyObj); + Tcl_ResetResult(opts->interp); + } + + return (opts->formatObj = valObj); +} + /* *---------------------------------------------------------------------- */ @@ -2936,7 +2994,7 @@ ClockScanObjCmd( #endif else { /* Use compiled version of Scan - */ - + ret = ClockScan(clientData, interp, info, objv[1], &opts); } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index a3c7f20..184b52a 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -308,14 +308,14 @@ Tcl_ObjType ClockFmtObjType = { #define ObjClockFmtScn(objPtr) \ (ClockFmtScnStorage *)objPtr->internalRep.twoPtrValue.ptr1; -#define SetObjLitStorage(objPtr, lit) \ - objPtr->internalRep.twoPtrValue.ptr2 = lit -#define ObjLitStorage(objPtr) \ - (ClockLitStorage *)objPtr->internalRep.twoPtrValue.ptr2; - -#define ClockFmtObj_SetObjIntRep(objPtr, fss, lit) \ - objPtr->internalRep.twoPtrValue.ptr1 = fss, \ - objPtr->internalRep.twoPtrValue.ptr2 = lit, \ +#define SetObjLocFmtKey(objPtr, key) \ + Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key) +#define ObjLocFmtKey(objPtr) \ + ((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2) + +#define ClockFmtObj_SetObjIntRep(objPtr, fss, key) \ + objPtr->internalRep.twoPtrValue.ptr1 = fss; \ + Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key); \ objPtr->typePtr = &ClockFmtObjType; /* @@ -327,7 +327,6 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_Obj *copyPtr; { ClockFmtScnStorage *fss = ObjClockFmtScn(srcPtr); - // ClockLitStorage *lit = ObjLitStorage(srcPtr); if (fss != NULL) { Tcl_MutexLock(&ClockFmtMutex); @@ -335,7 +334,7 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_MutexUnlock(&ClockFmtMutex); } - ClockFmtObj_SetObjIntRep(copyPtr, fss, NULL); + ClockFmtObj_SetObjIntRep(copyPtr, fss, ObjLocFmtKey(srcPtr)); /* if no format representation, dup string representation */ if (fss == NULL) { @@ -352,7 +351,6 @@ ClockFmtObj_FreeInternalRep(objPtr) Tcl_Obj *objPtr; { ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); - // ClockLitStorage *lit = ObjLitStorage(objPtr); if (fss != NULL) { Tcl_MutexLock(&ClockFmtMutex); /* decrement object reference count of format/scan storage */ @@ -368,7 +366,7 @@ ClockFmtObj_FreeInternalRep(objPtr) Tcl_MutexUnlock(&ClockFmtMutex); } SetObjClockFmtScn(objPtr, NULL); - SetObjLitStorage(objPtr, NULL); + Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); objPtr->typePtr = NULL; }; /* @@ -379,16 +377,18 @@ ClockFmtObj_SetFromAny(interp, objPtr) Tcl_Interp *interp; Tcl_Obj *objPtr; { - ClockFmtScnStorage *fss; - const char *strFmt = TclGetString(objPtr); - - if (!strFmt || (fss = FindOrCreateFmtScnStorage(interp, strFmt)) == NULL) { - return TCL_ERROR; - } - + /* validate string representation before free old internal represenation */ + (void)TclGetString(objPtr); + + /* free old internal represenation */ if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) objPtr->typePtr->freeIntRepProc(objPtr); - ClockFmtObj_SetObjIntRep(objPtr, fss, NULL); + + /* initial state of format object */ + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + objPtr->typePtr = &ClockFmtObjType; + return TCL_OK; }; /* @@ -415,6 +415,33 @@ ClockFmtObj_UpdateString(objPtr) /* *---------------------------------------------------------------------- + */ +MODULE_SCOPE Tcl_Obj* +ClockFrmObjGetLocFmtKey( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + Tcl_Obj *keyObj; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + keyObj = ObjLocFmtKey(objPtr); + if (keyObj) { + return keyObj; + } + + keyObj = Tcl_ObjPrintf("FMT_%s", TclGetString(objPtr)); + SetObjLocFmtKey(objPtr, keyObj); + + return keyObj; +} + +/* + *---------------------------------------------------------------------- * * Tcl_GetClockFrmScnFromObj -- * @@ -731,7 +758,7 @@ static ClockScanTokenMap ScnWordTokenMap = { ClockScanToken * ClockGetOrParseScanFormat( Tcl_Interp *interp, /* Tcl interpreter */ - Tcl_Obj *formatObj) /* Format container */ + Tcl_Obj *formatObj) /* Format container */ { ClockFmtScnStorage *fss; ClockScanToken *tok; @@ -889,6 +916,12 @@ ClockScan( unsigned short int flags = 0; int ret = TCL_ERROR; + /* get localized format */ + + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 1c51a02..62fa693 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -345,10 +345,6 @@ typedef struct ClockFmtScnStorage { * stored by offset +sizeof(self) */ } ClockFmtScnStorage; -typedef struct ClockLitStorage { - int dummy; -} ClockLitStorage; - /* * Prototypes of module functions. */ @@ -366,9 +362,15 @@ MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE Tcl_Obj * + ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); /* tclClockFmt.c module declarations */ +MODULE_SCOPE Tcl_Obj* + ClockFrmObjGetLocFmtKey(Tcl_Interp *interp, + Tcl_Obj *objPtr); + MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 1115999..3944173 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -51,6 +51,8 @@ static int DictSetCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); static int DictSizeCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); +static int DictSmartRefCmd(ClientData dummy, Tcl_Interp *interp, + int objc, Tcl_Obj *const *objv); static int DictUnsetCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); static int DictUpdateCmd(ClientData dummy, Tcl_Interp *interp, @@ -98,6 +100,7 @@ static const EnsembleImplMap implementationMap[] = { {"replace", DictReplaceCmd, NULL, NULL, NULL, 0 }, {"set", DictSetCmd, TclCompileDictSetCmd, NULL, NULL, 0 }, {"size", DictSizeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0 }, + {"smartref",DictSmartRefCmd,NULL, NULL, NULL, 0 }, {"unset", DictUnsetCmd, TclCompileDictUnsetCmd, NULL, NULL, 0 }, {"update", DictUpdateCmd, TclCompileDictUpdateCmd, NULL, NULL, 0 }, {"values", DictValuesCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0 }, @@ -142,7 +145,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - size_t refCount; /* Reference counter (see above) */ + int refcount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -392,7 +395,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refCount = 1; + newDict->refcount = 1; /* * Store in the object. @@ -427,7 +430,8 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - if (dict->refCount-- <= 1) { + dict->refcount--; + if (dict->refcount <= 0) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -712,7 +716,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refCount = 1; + dict->refcount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1116,7 +1120,7 @@ Tcl_DictObjFirst( searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refCount++; + dict->refcount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1230,7 +1234,8 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - if (dict->refCount-- <= 1) { + dict->refcount--; + if (dict->refcount <= 0) { DeleteDict(dict); } } @@ -1382,7 +1387,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refCount = 1; + dict->refcount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1432,7 +1437,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refCount = 1; + dict->refcount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1957,6 +1962,77 @@ DictSizeCmd( /* *---------------------------------------------------------------------- + */ + +Tcl_Obj * +Tcl_DictObjSmartRef( + Tcl_Interp *interp, + Tcl_Obj *dictPtr) +{ + Tcl_Obj *result; + Dict *dict; + + if (dictPtr->typePtr != &tclDictType + && SetDictFromAny(interp, dictPtr) != TCL_OK) { + return NULL; + } + + dict = DICT(dictPtr); + + result = Tcl_NewObj(); + DICT(result) = dict; + dict->refcount++; + result->internalRep.twoPtrValue.ptr2 = NULL; + result->typePtr = &tclDictType; + + return result; +} + +/* + *---------------------------------------------------------------------- + * + * DictSmartRefCmd -- + * + * This function implements the "dict smartref" Tcl command. See the user + * documentation for details on what it does, and TIP#111 for the formal + * specification. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +static int +DictSmartRefCmd( + ClientData dummy, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const *objv) +{ + Tcl_Obj *result; + Dict *dict; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); + return TCL_ERROR; + } + + result = Tcl_DictObjSmartRef(interp, objv[1]); + if (result == NULL) { + return TCL_ERROR; + } + + Tcl_SetObjResult(interp, result); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- * * DictExistsCmd -- * @@ -2280,7 +2356,7 @@ DictAppendCmd( Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr, *resultPtr; - int allocatedDict = 0; + int i, allocatedDict = 0; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?"); @@ -2305,33 +2381,15 @@ DictAppendCmd( if ((objc > 3) || (valuePtr == NULL)) { /* Only go through append activites when something will change. */ - Tcl_Obj *appendObjPtr = NULL; - - if (objc > 3) { - /* Something to append */ - - if (objc == 4) { - appendObjPtr = objv[3]; - } else if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - objc-3, objv+3, &appendObjPtr)) { - return TCL_ERROR; - } - } - if (appendObjPtr == NULL) { - /* => (objc == 3) => (valuePtr == NULL) */ + if (valuePtr == NULL) { TclNewObj(valuePtr); - } else if (valuePtr == NULL) { - valuePtr = appendObjPtr; - appendObjPtr = NULL; + } else if (Tcl_IsShared(valuePtr)) { + valuePtr = Tcl_DuplicateObj(valuePtr); } - if (appendObjPtr) { - if (Tcl_IsShared(valuePtr)) { - valuePtr = Tcl_DuplicateObj(valuePtr); - } - - Tcl_AppendObjToObj(valuePtr, appendObjPtr); + for (i=3 ; i Date: Tue, 10 Jan 2017 22:30:24 +0000 Subject: improve LocalizeFormat, internal caching of localized formats inside msgcat for locale and format objects smart reference introduced in dict (smart pointer with 0 object reference but increase dict-reference, provide changeable locale dict) code review --- generic/tclClock.c | 98 +------------------- generic/tclClockFmt.c | 229 ++++++++++++++++++++++++++++++---------------- generic/tclDate.h | 52 ++++++++++- library/clock.tcl | 19 ++-- tests-perf/clock.perf.tcl | 6 +- 5 files changed, 214 insertions(+), 190 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index e066812..08bc6ef 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -42,53 +42,7 @@ static const int daysInPriorMonths[2][13] = { * Enumeration of the string literals used in [clock] */ -typedef enum ClockLiteral { - LIT__NIL, - LIT__DEFAULT_FORMAT, - LIT_BCE, LIT_C, - LIT_CANNOT_USE_GMT_AND_TIMEZONE, - LIT_CE, - LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, - LIT_ERA, LIT_GMT, LIT_GREGORIAN, - LIT_INTEGER_VALUE_TOO_LARGE, - LIT_ISO8601WEEK, LIT_ISO8601YEAR, - LIT_JULIANDAY, LIT_LOCALSECONDS, - LIT_MONTH, - LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, - LIT_YEAR, - LIT_TZDATA, - LIT_GETSYSTEMTIMEZONE, - LIT_SETUPTIMEZONE, - LIT_MCGET, LIT_TCL_CLOCK, - LIT_LOCALIZE_FORMAT, -#if 0 - LIT_FREESCAN, -#endif - LIT__END -} ClockLiteral; -static const char *const Literals[] = { - "", - "%a %b %d %H:%M:%S %Z %Y", - "BCE", "C", - "cannot use -gmt and -timezone in same call", - "CE", - "dayOfMonth", "dayOfWeek", "dayOfYear", - "era", ":GMT", "gregorian", - "integer value too large to represent", - "iso8601Week", "iso8601Year", - "julianDay", "localSeconds", - "month", - "seconds", "tzName", "tzOffset", - "year", - "::tcl::clock::TZData", - "::tcl::clock::GetSystemTimeZone", - "::tcl::clock::SetupTimeZone", - "::msgcat::mcget", "::tcl::clock", - "::tcl::clock::LocalizeFormat" -#if 0 - "::tcl::clock::FreeScan" -#endif -}; +CLOCK_LITERAL_ARRAY(Literals); /* Msgcat literals for exact match (mcKey) */ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLiterals, ""); @@ -634,56 +588,6 @@ ClockMCGetListIdxDict( return valObj; } -MODULE_SCOPE Tcl_Obj * -ClockLocalizeFormat( - ClockFmtScnCmdArgs *opts) -{ - ClockClientData *dataPtr = opts->clientData; - Tcl_Obj *valObj, *keyObj; - - keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); - - if (opts->mcDictObj == NULL) { - ClockMCDict(opts); - if (opts->mcDictObj == NULL) - return NULL; - } - - /* try to find in cache within mc-catalog */ - if (Tcl_DictObjGet(NULL, opts->mcDictObj, - keyObj, &valObj) != TCL_OK) { - return NULL; - } - if (valObj == NULL) { - Tcl_Obj *callargs[4]; - /* call LocalizeFormat locale format fmtkey */ - callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; - callargs[1] = opts->localeObj; - callargs[2] = opts->formatObj; - callargs[3] = keyObj; - Tcl_IncrRefCount(keyObj); - if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK - ) { - Tcl_DecrRefCount(keyObj); - return NULL; - } - - valObj = Tcl_GetObjResult(opts->interp); - - if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, - keyObj, valObj) != TCL_OK - ) { - Tcl_DecrRefCount(keyObj); - return NULL; - } - - Tcl_DecrRefCount(keyObj); - Tcl_ResetResult(opts->interp); - } - - return (opts->formatObj = valObj); -} - /* *---------------------------------------------------------------------- */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 184b52a..daedb26 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -233,65 +233,6 @@ static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; /* - *---------------------------------------------------------------------- - */ - -static ClockFmtScnStorage * -FindOrCreateFmtScnStorage( - Tcl_Interp *interp, - const char *strFmt) -{ - ClockFmtScnStorage *fss = NULL; - int new; - Tcl_HashEntry *hPtr; - - Tcl_MutexLock(&ClockFmtMutex); - - /* if not yet initialized */ - if (!initialized) { - /* initialize type */ - memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); - ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; - ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; - - /* initialize hash table */ - Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, - &ClockFmtScnStorageHashKeyType); - - initialized = 1; - Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); - } - - /* get or create entry (and alocate storage) */ - hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); - if (hPtr != NULL) { - - fss = FmtScn4HashEntry(hPtr); - - #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 - /* unlink if it is currently in GC */ - if (new == 0 && fss->objRefCount == 0) { - ClockFmtScnStorage_GC_Out(fss); - } - #endif - - /* new reference, so increment in lock right now */ - fss->objRefCount++; - } - - Tcl_MutexUnlock(&ClockFmtMutex); - - if (fss == NULL && interp != NULL) { - Tcl_AppendResult(interp, "retrieve clock format failed \"", - strFmt ? strFmt : "", "\"", NULL); - Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); - } - - return fss; -} - - -/* * Type definition. */ @@ -303,20 +244,11 @@ Tcl_ObjType ClockFmtObjType = { ClockFmtObj_SetFromAny /* setFromAnyProc */ }; -#define SetObjClockFmtScn(objPtr, fss) \ - objPtr->internalRep.twoPtrValue.ptr1 = fss #define ObjClockFmtScn(objPtr) \ - (ClockFmtScnStorage *)objPtr->internalRep.twoPtrValue.ptr1; + (*((ClockFmtScnStorage **)&(objPtr)->internalRep.twoPtrValue.ptr1)) -#define SetObjLocFmtKey(objPtr, key) \ - Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key) #define ObjLocFmtKey(objPtr) \ - ((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2) - -#define ClockFmtObj_SetObjIntRep(objPtr, fss, key) \ - objPtr->internalRep.twoPtrValue.ptr1 = fss; \ - Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key); \ - objPtr->typePtr = &ClockFmtObjType; + (*((Tcl_Obj **)&(objPtr)->internalRep.twoPtrValue.ptr2)) /* *---------------------------------------------------------------------- @@ -334,7 +266,15 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_MutexUnlock(&ClockFmtMutex); } - ClockFmtObj_SetObjIntRep(copyPtr, fss, ObjLocFmtKey(srcPtr)); + ObjClockFmtScn(copyPtr) = fss; + /* regards special case - format not localizable */ + if (ObjLocFmtKey(srcPtr) != srcPtr) { + Tcl_InitObjRef(ObjLocFmtKey(copyPtr), ObjLocFmtKey(srcPtr)); + } else { + ObjLocFmtKey(copyPtr) = copyPtr; + } + copyPtr->typePtr = &ClockFmtObjType; + /* if no format representation, dup string representation */ if (fss == NULL) { @@ -365,8 +305,12 @@ ClockFmtObj_FreeInternalRep(objPtr) } Tcl_MutexUnlock(&ClockFmtMutex); } - SetObjClockFmtScn(objPtr, NULL); - Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); + ObjClockFmtScn(objPtr) = NULL; + if (ObjLocFmtKey(objPtr) != objPtr) { + Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); + } else { + ObjLocFmtKey(objPtr) = NULL; + } objPtr->typePtr = NULL; }; /* @@ -385,8 +329,8 @@ ClockFmtObj_SetFromAny(interp, objPtr) objPtr->typePtr->freeIntRepProc(objPtr); /* initial state of format object */ - objPtr->internalRep.twoPtrValue.ptr1 = NULL; - objPtr->internalRep.twoPtrValue.ptr2 = NULL; + ObjClockFmtScn(objPtr) = NULL; + ObjLocFmtKey(objPtr) = NULL; objPtr->typePtr = &ClockFmtObjType; return TCL_OK; @@ -435,13 +379,74 @@ ClockFrmObjGetLocFmtKey( } keyObj = Tcl_ObjPrintf("FMT_%s", TclGetString(objPtr)); - SetObjLocFmtKey(objPtr, keyObj); + Tcl_InitObjRef(ObjLocFmtKey(objPtr), keyObj); return keyObj; } /* *---------------------------------------------------------------------- + */ + +static ClockFmtScnStorage * +FindOrCreateFmtScnStorage( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + const char *strFmt = TclGetString(objPtr); + ClockFmtScnStorage *fss = NULL; + int new; + Tcl_HashEntry *hPtr; + + Tcl_MutexLock(&ClockFmtMutex); + + /* if not yet initialized */ + if (!initialized) { + /* initialize type */ + memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); + ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; + ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; + + /* initialize hash table */ + Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, + &ClockFmtScnStorageHashKeyType); + + initialized = 1; + Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); + } + + /* get or create entry (and alocate storage) */ + hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); + if (hPtr != NULL) { + + fss = FmtScn4HashEntry(hPtr); + + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* unlink if it is currently in GC */ + if (new == 0 && fss->objRefCount == 0) { + ClockFmtScnStorage_GC_Out(fss); + } + #endif + + /* new reference, so increment in lock right now */ + fss->objRefCount++; + + ObjClockFmtScn(objPtr) = fss; + } + + Tcl_MutexUnlock(&ClockFmtMutex); + + if (fss == NULL && interp != NULL) { + Tcl_AppendResult(interp, "retrieve clock format failed \"", + strFmt ? strFmt : "", "\"", NULL); + Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- * * Tcl_GetClockFrmScnFromObj -- * @@ -475,8 +480,7 @@ Tcl_GetClockFrmScnFromObj( fss = ObjClockFmtScn(objPtr); if (fss == NULL) { - const char *strFmt = TclGetString(objPtr); - fss = FindOrCreateFmtScnStorage(interp, strFmt); + fss = FindOrCreateFmtScnStorage(interp, objPtr); } return fss; @@ -772,7 +776,7 @@ ClockGetOrParseScanFormat( fss = ObjClockFmtScn(formatObj); if (fss == NULL) { - fss = FindOrCreateFmtScnStorage(interp, TclGetString(formatObj)); + fss = FindOrCreateFmtScnStorage(interp, formatObj); if (fss == NULL) { return NULL; } @@ -898,6 +902,72 @@ done: return fss->scnTok; } +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj = NULL, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + /* special case - format object is not localizable */ + if (keyObj == opts->formatObj) { + return opts->formatObj; + } + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within locale mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + + /* call LocalizeFormat locale format fmtkey */ + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + goto clean; + } + + valObj = Tcl_GetObjResult(opts->interp); + + /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + valObj = NULL; + goto clean; + } + + /* check special case - format object is not localizable */ + if (valObj == opts->formatObj) { + /* mark it as unlocalizable, by setting self as key (without refcount incr) */ + if (opts->formatObj->typePtr == &ClockFmtObjType) { + Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); + ObjLocFmtKey(opts->formatObj) = opts->formatObj; + } + } +clean: + + Tcl_UnsetObjRef(keyObj); + Tcl_ResetResult(opts->interp); + } + + return (opts->formatObj = valObj); +} + /* *---------------------------------------------------------------------- */ @@ -917,7 +987,6 @@ ClockScan( int ret = TCL_ERROR; /* get localized format */ - if (ClockLocalizeFormat(opts) == NULL) { return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 62fa693..9f65b1b 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -37,6 +37,53 @@ /* + * Enumeration of the string literals used in [clock] + */ + +typedef enum ClockLiteral { + LIT__NIL, + LIT__DEFAULT_FORMAT, + LIT_BCE, LIT_C, + LIT_CANNOT_USE_GMT_AND_TIMEZONE, + LIT_CE, + LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, + LIT_ERA, LIT_GMT, LIT_GREGORIAN, + LIT_INTEGER_VALUE_TOO_LARGE, + LIT_ISO8601WEEK, LIT_ISO8601YEAR, + LIT_JULIANDAY, LIT_LOCALSECONDS, + LIT_MONTH, + LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, + LIT_YEAR, + LIT_TZDATA, + LIT_GETSYSTEMTIMEZONE, + LIT_SETUPTIMEZONE, + LIT_MCGET, LIT_TCL_CLOCK, + LIT_LOCALIZE_FORMAT, + LIT__END +} ClockLiteral; + +#define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ + "", \ + "%a %b %d %H:%M:%S %Z %Y", \ + "BCE", "C", \ + "cannot use -gmt and -timezone in same call", \ + "CE", \ + "dayOfMonth", "dayOfWeek", "dayOfYear", \ + "era", ":GMT", "gregorian", \ + "integer value too large to represent", \ + "iso8601Week", "iso8601Year", \ + "julianDay", "localSeconds", \ + "month", \ + "seconds", "tzName", "tzOffset", \ + "year", \ + "::tcl::clock::TZData", \ + "::tcl::clock::GetSystemTimeZone", \ + "::tcl::clock::SetupTimeZone", \ + "::msgcat::mcget", "::tcl::clock", \ + "::tcl::clock::LocalizeFormat" \ +} + +/* * Enumeration of the msgcat literals used in [clock] */ @@ -362,8 +409,6 @@ MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); -MODULE_SCOPE Tcl_Obj * - ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); /* tclClockFmt.c module declarations */ @@ -374,7 +419,8 @@ MODULE_SCOPE Tcl_Obj* MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); - +MODULE_SCOPE Tcl_Obj * + ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); diff --git a/library/clock.tcl b/library/clock.tcl index 4173174..a532c0d 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -2365,18 +2365,23 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { dict set LocaleFormats $locale MLST $mlst } - # translate: - set locfmt [string map $mlst $format] - - # Save original format as long as possible, because of internal representation (performance) - if {$locfmt eq $format} { - set locfmt $format - } + # translate copy of format (don't use format object here, because otherwise + # it can lose its internal representation (string map - convert to unicode) + set locfmt [string map $mlst [string range " $format" 1 end]] # cache it: dict set LocaleFormats $locale $fmtkey $locfmt } + # Save original format as long as possible, because of internal + # representation (performance). + # Note that in this case such format will be never localized (also + # using another locales). To prevent this return a duplicate (but + # it may be slower). + if {$locfmt eq $format} { + set locfmt $format + } + return $locfmt } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index a005648..3c69414 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -132,9 +132,6 @@ proc test-scan {{reptime 1000}} { # Scan : date-time (system time zone without base) {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S"} - # Scan : dynamic format (cacheable) - {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} - # Scan : julian day in gmt {clock scan 2451545 -format %J -gmt 1} # Scan : julian day in system TZ @@ -153,6 +150,9 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : dynamic format (cacheable) + {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + break # Scan : zone only -- cgit v0.12 From c51ce8e8796729eba5d0dc8d17ff0d7903bebb20 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:30:49 +0000 Subject: list index logic optimized regarding greedy search (don't stop by first found - try to find longest) --- generic/tclClockFmt.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index daedb26..09cbfa4 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -514,7 +514,7 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, int minLen, int maxLen) { Tcl_Obj **lstv; - int lstc, i, l; + int lstc, i, l, lf = -1; const char *s; Tcl_Obj *valObj; @@ -536,16 +536,27 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, if ( l >= minLen && l <= maxLen && strncasecmp(yyInput, s, l) == 0 ) { + /* found, try to find longest value (greedy search) */ + if (l < maxLen && minLen != maxLen) { + lf = i; + minLen = l + 1; + continue; + } *val = i; yyInput += l; break; } } - /* if not found */ + /* if found */ if (i < lstc) { return TCL_OK; } + if (lf >= 0) { + *val = lf; + yyInput += minLen - 1; + return TCL_OK; + } return TCL_RETURN; } -- cgit v0.12 From caf50ef7eab0d54375a495f8eb9d36ffa264dde2 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:31:12 +0000 Subject: seconds token (%s) take precedence over all other tokens --- generic/tclClockFmt.c | 56 ++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 09cbfa4..ba924fd 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1147,41 +1147,47 @@ ClockScan( goto not_match; } - /* invalidate result */ - if (flags & CLF_DATE) { + /* + * Invalidate result + */ + + /* seconds token (%s) take precedence over all other tokens */ + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { + if (flags & CLF_DATE) { - if (!(flags & CLF_JULIANDAY)) { - info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; - if (yyYear < 100) { - if (!(flags & CLF_CENTURY)) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; } - yyYear += dataPtr->currentYearCentury; - } else { - yyYear += info->dateCentury * 100; } + yydate.era = CE; + } + /* if date but no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_INVALIDATE_SECONDS; + yydate.localSeconds = 0; } - yydate.era = CE; } - /* if date but no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + + if (flags & CLF_TIME) { + info->flags |= CLF_INVALIDATE_SECONDS; + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else + if (!(flags & CLF_LOCALSEC)) { info->flags |= CLF_INVALIDATE_SECONDS; - yydate.localSeconds = 0; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } } - if (flags & CLF_TIME) { - info->flags |= CLF_INVALIDATE_SECONDS; - yySeconds = ToSeconds(yyHour, yyMinutes, - yySeconds, yyMeridian); - } else - if (!(flags & CLF_LOCALSEC)) { - info->flags |= CLF_INVALIDATE_SECONDS; - yySeconds = yydate.localSeconds % SECONDS_PER_DAY; - } - ret = TCL_OK; goto done; -- cgit v0.12 From 6c38124bb987bb10c82631122bcb4a981a47e559 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:31:43 +0000 Subject: %j token as day of year; clear flags implemented (to provide last-wins functionality) --- generic/tclClock.c | 86 ++++++++++++++++++++++++++++++++++++++------------- generic/tclClockFmt.c | 48 +++++++++++++++------------- generic/tclDate.h | 22 +++++++------ 3 files changed, 103 insertions(+), 53 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 08bc6ef..ef0e46b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2313,7 +2313,47 @@ GetJulianDayFromEraYearMonthDay( + ym1o4; } } +/* + *---------------------------------------------------------------------- + */ +static void +GetJulianDayFromEraYearDay( + TclDateFields *fields, /* Date to convert */ + int changeover) /* Gregorian transition date as a Julian Day */ +{ + int year, ym1; + + /* Get absolute year number from the civil year */ + if (fields->era == BCE) { + year = 1 - fields->year; + } else { + year = fields->year; + } + + ym1 = year - 1; + + /* Try the Gregorian calendar first. */ + fields->gregorian = 1; + fields->julianDay = + 1721425 + + fields->dayOfYear + + ( 365 * ym1 ) + + ( ym1 / 4 ) + - ( ym1 / 100 ) + + ( ym1 / 400 ); + + /* If the date is before the Gregorian change, use the Julian calendar. */ + + if ( fields->julianDay < changeover ) { + fields->gregorian = 0; + fields->julianDay = + 1721423 + + fields->dayOfYear + + ( 365 * ym1 ) + + ( ym1 / 4 ); + } +} /* *---------------------------------------------------------------------- * @@ -2906,9 +2946,13 @@ ClockScanObjCmd( goto done; } - /* If needed assemble julianDay using new year, month, etc. */ - if (info->flags & CLF_INVALIDATE_JULIANDAY) { - GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + /* If needed assemble julianDay using year, month, etc. */ + if (info->flags & CLF_ASSEMBLE_JULIANDAY) { + if ((info->flags & CLF_DAYOFMONTH) || !(info->flags & CLF_DAYOFYEAR)) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + } else { + GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + } } /* some overflow checks, if not extended */ @@ -2924,7 +2968,7 @@ ClockScanObjCmd( /* Local seconds to UTC (stored in yydate.seconds) */ - if (info->flags & (CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY)) { + if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY)) { yydate.localSeconds = -210866803200L + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) @@ -3007,7 +3051,7 @@ ClockFreeScan( if (yyHaveTime == 0) { yyHaveTime = -1; } - info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_JULIANDAY|CLF_ASSEMBLE_SECONDS; } /* @@ -3032,7 +3076,7 @@ ClockFreeScan( // Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } /* @@ -3041,13 +3085,13 @@ ClockFreeScan( if (yyHaveTime == -1) { yySeconds = 0; - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } else if (yyHaveTime) { yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } else if ( (yyHaveDay && !yyHaveDate) @@ -3057,7 +3101,7 @@ ClockFreeScan( || yyRelDay != 0 ) ) ) { yySeconds = 0; - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } else { yySeconds = yydate.localSeconds % SECONDS_PER_DAY; @@ -3084,11 +3128,11 @@ repeat_rel: int m, h; /* if needed extract year, month, etc. again */ - if (info->flags & CLF_INVALIDATE_DATE) { + if (info->flags & CLF_ASSEMBLE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_DATE; + info->flags &= ~CLF_ASSEMBLE_DATE; } /* add the requisite number of months */ @@ -3104,7 +3148,7 @@ repeat_rel: } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_JULIANDAY|CLF_ASSEMBLE_SECONDS; yyRelMonth = 0; } @@ -3113,14 +3157,14 @@ repeat_rel: if (yyRelDay) { /* assemble julianDay using new year, month, etc. */ - if (info->flags & CLF_INVALIDATE_JULIANDAY) { + if (info->flags & CLF_ASSEMBLE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_JULIANDAY; + info->flags &= ~CLF_ASSEMBLE_JULIANDAY; } yydate.julianDay += yyRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; yyRelDay = 0; } @@ -3150,11 +3194,11 @@ repeat_rel: int monthDiff; /* if needed extract year, month, etc. again */ - if (info->flags & CLF_INVALIDATE_DATE) { + if (info->flags & CLF_ASSEMBLE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_DATE; + info->flags &= ~CLF_ASSEMBLE_DATE; } if (yyMonthOrdinalIncr > 0) { @@ -3177,7 +3221,7 @@ repeat_rel: yyRelMonth += monthDiff; yyHaveOrdinalMonth = 0; - info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_JULIANDAY|CLF_ASSEMBLE_SECONDS; goto repeat_rel; } @@ -3189,9 +3233,9 @@ repeat_rel: if (yyHaveDay && !yyHaveDate) { /* if needed assemble julianDay now */ - if (info->flags & CLF_INVALIDATE_JULIANDAY) { + if (info->flags & CLF_ASSEMBLE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_JULIANDAY; + info->flags &= ~CLF_ASSEMBLE_JULIANDAY; } yydate.era = CE; @@ -3200,7 +3244,7 @@ repeat_rel: if (yyDayOrdinal > 0) { yydate.julianDay -= 7; } - info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; } /* Free scanning completed - date ready */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ba924fd..2c1dfc1 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -678,40 +678,43 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, static const char *ScnSTokenMapIndex = - "dmbyYHMSJCs"; + "dmbyYHMSJjCs"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, /* %m */ - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), + {CTOKT_DIGIT, CLF_DATE, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ - {CTOKT_PARSER, CLF_DATE, 0, 0, 0, + {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, 0, ClockScnToken_Month_Proc}, /* %y */ - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_DATE, 0, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), NULL}, /* %H */ - {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), NULL}, /* %M */ - {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.minutes), + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.minutes), NULL}, /* %S */ - {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.secondOfDay), + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, /* %J */ - {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + NULL}, + /* %j */ + {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFYEAR, CLF_DAYOFMONTH, 1, 3, TclOffset(DateInfo, date.dayOfYear), NULL}, /* %C */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 2, TclOffset(DateInfo, dateCentury), + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), NULL}, /* %s */ - {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; static const char *ScnSTokenWrapMapIndex[2] = { @@ -733,10 +736,10 @@ static const char *ScnOTokenMapIndex = "dm"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ - {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_PARSER, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.dayOfMonth), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.month), + {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.month), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenWrapMapIndex[2] = { @@ -747,12 +750,12 @@ static const char *ScnOTokenWrapMapIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 1, 0xffff, 0, + {CTOKT_SPACE, 0, 0, 1, 0xffff, 0, NULL}, }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 1, 0, 0, + CTOKT_WORD, 0, 0, 1, 0, 0, NULL }; @@ -1095,7 +1098,7 @@ ClockScan( } p = x; } - flags |= map->flags; + flags = (flags & ~map->clearFlags) | map->flags; } break; case CTOKT_PARSER: @@ -1110,7 +1113,7 @@ ClockScan( break; }; p = yyInput; - flags |= map->flags; + flags = (flags & ~map->clearFlags) | map->flags; break; case CTOKT_SPACE: /* at least one space in strict mode */ @@ -1150,13 +1153,14 @@ ClockScan( /* * Invalidate result */ + info->flags |= flags; /* seconds token (%s) take precedence over all other tokens */ if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { if (flags & CLF_DATE) { if (!(flags & CLF_JULIANDAY)) { - info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; + info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; if (yyYear < 100) { if (!(flags & CLF_CENTURY)) { @@ -1172,18 +1176,18 @@ ClockScan( } /* if date but no time - reset time */ if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; yydate.localSeconds = 0; } } if (flags & CLF_TIME) { - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); } else if (!(flags & CLF_LOCALSEC)) { - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } } diff --git a/generic/tclDate.h b/generic/tclDate.h index 9f65b1b..23fe5b3 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -30,10 +30,18 @@ #define ONE_YEAR 365 /* days */ +#define CLF_DATE (1 << 2) +#define CLF_JULIANDAY (1 << 3) +#define CLF_TIME (1 << 4) +#define CLF_LOCALSEC (1 << 5) +#define CLF_CENTURY (1 << 6) +#define CLF_DAYOFMONTH (1 << 7) +#define CLF_DAYOFYEAR (1 << 8) +#define CLF_SIGNED (1 << 15) /* On demand (lazy) assemble flags */ -#define CLF_INVALIDATE_DATE (1 << 6) /* assemble year, month, etc. using julianDay */ -#define CLF_INVALIDATE_JULIANDAY (1 << 7) /* assemble julianDay using year, month, etc. */ -#define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ +#define CLF_ASSEMBLE_DATE (1 << 28) /* assemble year, month, etc. using julianDay */ +#define CLF_ASSEMBLE_JULIANDAY (1 << 29) /* assemble julianDay using year, month, etc. */ +#define CLF_ASSEMBLE_SECONDS (1 << 30) /* assemble localSeconds (and seconds at end) */ /* @@ -339,13 +347,6 @@ typedef int ClockScanTokenProc( ClockScanToken *tok); -#define CLF_DATE (1 << 2) -#define CLF_JULIANDAY (1 << 3) -#define CLF_TIME (1 << 4) -#define CLF_LOCALSEC (1 << 5) -#define CLF_CENTURY (1 << 6) -#define CLF_SIGNED (1 << 8) - typedef enum _CLCKTOK_TYPE { CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD } CLCKTOK_TYPE; @@ -359,6 +360,7 @@ typedef struct ClockFormatToken { typedef struct ClockScanTokenMap { unsigned short int type; unsigned short int flags; + unsigned short int clearFlags; unsigned short int minSize; unsigned short int maxSize; unsigned short int offs; -- cgit v0.12 From feb62aa2bdc63e80cb401c06a17959af188f14c9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:32:46 +0000 Subject: scan format: several tokens implemented, bug fixing and code review; precedence yyyymmdd over yyyyddd was changed (and re-covered in test-cases also), see http://core.tcl.tk/tcl/tktview/e7a722cd3573fedda5d1e528f95902776f996e06 --- generic/tclClock.c | 25 +-- generic/tclClockFmt.c | 384 +++++++++++++++++++++++++++++++++++++++------- generic/tclDate.h | 21 ++- library/clock.tcl | 37 ++++- library/msgcat/msgcat.tcl | 5 + tests/clock.test | 66 ++++---- 6 files changed, 436 insertions(+), 102 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index ef0e46b..1a5141b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -473,13 +473,12 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } if (opts->mcDictObj == NULL) { - Tcl_Obj *callargs[3]; - /* get msgcat dictionary - ::msgcat::mcget ::tcl::clock locale */ + Tcl_Obj *callargs[2]; + /* get msgcat dictionary - ::tcl::clock::mcget locale */ callargs[0] = dataPtr->literals[LIT_MCGET]; - callargs[1] = dataPtr->literals[LIT_TCL_CLOCK]; - callargs[2] = opts->localeObj; + callargs[1] = opts->localeObj; - if (Tcl_EvalObjv(opts->interp, 3, callargs, 0) != TCL_OK) { + if (Tcl_EvalObjv(opts->interp, 2, callargs, 0) != TCL_OK) { return NULL; } @@ -823,7 +822,7 @@ ClockGetSystemTimeZone( /* *---------------------------------------------------------------------- */ -static Tcl_Obj * +MODULE_SCOPE Tcl_Obj * ClockSetupTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp, /* Tcl interpreter */ @@ -2948,7 +2947,11 @@ ClockScanObjCmd( /* If needed assemble julianDay using year, month, etc. */ if (info->flags & CLF_ASSEMBLE_JULIANDAY) { - if ((info->flags & CLF_DAYOFMONTH) || !(info->flags & CLF_DAYOFYEAR)) { + if ((info->flags & CLF_ISO8601)) { + GetJulianDayFromEraYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); + } + else + if (!(info->flags & CLF_DAYOFYEAR)) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } else { GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); @@ -3065,11 +3068,11 @@ ClockFreeScan( int dstFlag = 1 - yyDSTmode; tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - + Tcl_IncrRefCount(tzObjStor); + opts->timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); - if (tzObjStor != opts->timezoneObj) { - Tcl_DecrRefCount(tzObjStor); - } + + Tcl_DecrRefCount(tzObjStor); if (opts->timezoneObj == NULL) { goto done; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 2c1dfc1..f965a17 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -508,27 +508,14 @@ void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, } } -static int -LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int mcKey, int *val, +inline int +ObjListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int *val, + Tcl_Obj **lstv, int lstc, int minLen, int maxLen) { - Tcl_Obj **lstv; - int lstc, i, l, lf = -1; + int i, l, lf = -1; const char *s; - Tcl_Obj *valObj; - - /* get msgcat value */ - valObj = ClockMCGet(opts, mcKey); - if (valObj == NULL) { - return TCL_ERROR; - } - - /* is a list */ - if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { - return TCL_ERROR; - } - /* search in list */ for (i = 0; i < lstc; i++) { s = TclGetString(lstv[i]); @@ -561,6 +548,31 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, } static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int mcKey, int *val, + int minLen, int maxLen) +{ + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + /* get msgcat value */ + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + return TCL_ERROR; + } + + /* is a list */ + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + } + + /* search in list */ + return ObjListSearch(opts, info, val, lstv, lstc, + minLen, maxLen); +} + +static int StaticListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, const char **lst, int *val) { @@ -631,8 +643,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, */ int ret, val; - int minLen; - int maxLen; + int minLen, maxLen; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -653,15 +664,115 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } + +static int +ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + char curTok = *tok->tokWord.start; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* %u %w %Ou %Ow */ + if ( curTok != 'a' && curTok != 'A' + && ((minLen <= 1 && maxLen >= 1) || (int)tok->map->data) + ) { + + val = -1; + + if (!(int)tok->map->data) { + if (*yyInput >= '0' && *yyInput <= '9') { + val = *yyInput - '0'; + } + } else { + int ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, + minLen, maxLen); + if (ret == TCL_ERROR) { + return ret; + } + } + + if (val != -1) { + if (val == 0) { + val = 7; + } + if (val > 7 && curTok != 'a' && curTok != 'A') { + Tcl_SetResult(opts->interp, "day of week is greater than 7", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); + return TCL_ERROR; + } + info->date.dayOfWeek = val; + yyInput++; + return TCL_OK; + } + + + return TCL_RETURN; + } + + /* %a %A */ + ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_FULL, &val, + minLen, maxLen); + if (ret != TCL_OK) { + /* if not found */ + if (ret == TCL_RETURN) { + ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_ABBREV, &val, + minLen, maxLen); + } + if (ret != TCL_OK) { + return ret; + } + } + + if (val == 0) { + val = 7; + } + info->date.dayOfWeek = val; + return TCL_OK; + +} + +static int +ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + Tcl_Obj *amPmObj[2]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + amPmObj[0] = ClockMCGet(opts, MCLIT_AM); + amPmObj[1] = ClockMCGet(opts, MCLIT_PM); + + if (amPmObj[0] == NULL || amPmObj == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, amPmObj, 2, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val == 0) { + yyMeridian = MERam; + } else { + yyMeridian = MERpm; + } + return TCL_OK; +} static int ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int ret, val; - int minLen; - int maxLen; + int minLen, maxLen; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -675,27 +786,106 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } + +static int +ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + int len = 0; + register const char *p = yyInput; + Tcl_Obj *tzObjStor = NULL; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* numeric timezone */ + if (*p == '+' || *p == '-') { + /* max chars in numeric zone = "+00:00:00" */ + #define MAX_ZONE_LEN 9 + char buf[MAX_ZONE_LEN + 1]; + char *bp = buf; + *bp++ = *p++; len++; + if (maxLen > MAX_ZONE_LEN) + maxLen = MAX_ZONE_LEN; + /* cumulate zone into buf without ':' */ + while (len + 1 < maxLen) { + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (len + 2 < maxLen) { + if (*p == ':') { + *p++; len++; + } + } + } + *bp = '\0'; + + if (len < minLen) { + return TCL_RETURN; + } + #undef MAX_ZONE_LEN + + /* timezone */ + tzObjStor = Tcl_NewStringObj(buf, bp-buf); + } else { + /* legacy (alnum) timezone like CEST, etc. */ + if (maxLen > 4) + maxLen = 4; + while (len < maxLen) { + if ( (*p & 0x80) + || (!isalpha(UCHAR(*p)) && !isdigit(UCHAR(*p))) + ) { /* INTL: ISO only. */ + break; + } + p++; len++; + } + if (len < minLen) { + return TCL_RETURN; + } + + /* timezone */ + tzObjStor = Tcl_NewStringObj(yyInput, p-yyInput); + + /* convert using dict */ + } + + /* try to apply new time zone */ + Tcl_IncrRefCount(tzObjStor); + + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, + tzObjStor); + + Tcl_DecrRefCount(tzObjStor); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } + + yyInput += len; + return TCL_OK; +} + static const char *ScnSTokenMapIndex = - "dmbyYHMSJjCs"; + "dmbyYHMSpJjCgGVazs"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ - {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_DIGIT, CLF_DAYOFMONTH, 0, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, /* %m */ - {CTOKT_DIGIT, CLF_DATE, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.month), + {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ - {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, 0, + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, 0, ClockScnToken_Month_Proc}, /* %y */ - {CTOKT_DIGIT, CLF_DATE, 0, 1, 2, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), NULL}, - /* %H */ + /* %H %k %I %l */ {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), NULL}, /* %M */ @@ -704,22 +894,40 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %S */ {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, + /* %p %P */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockScnToken_amPmInd_Proc, NULL}, /* %J */ - {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + {CTOKT_DIGIT, CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), NULL}, /* %j */ - {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFYEAR, CLF_DAYOFMONTH, 1, 3, TclOffset(DateInfo, date.dayOfYear), + {CTOKT_DIGIT, CLF_DAYOFYEAR, 0, 1, 3, TclOffset(DateInfo, date.dayOfYear), NULL}, /* %C */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), + {CTOKT_DIGIT, CLF_CENTURY|CLF_ISO8601CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), + NULL}, + /* %g */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601, 0, 2, 2, TclOffset(DateInfo, date.iso8601Year), + NULL}, + /* %G */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 1, 4, TclOffset(DateInfo, date.iso8601Year), NULL}, + /* %V */ + {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), + NULL}, + /* %a %A %u %w */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockScnToken_DayOfWeek_Proc, NULL}, + /* %z %Z */ + {CTOKT_PARSER, 0, 0, 0, 0, 0, + ClockScnToken_TimeZone_Proc, NULL}, /* %s */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; static const char *ScnSTokenWrapMapIndex[2] = { - "eNBh", - "dmbb" + "eNBhkIlPAuwZ", + "dmbbHHHpaaaz" }; static const char *ScnETokenMapIndex = @@ -733,18 +941,33 @@ static const char *ScnETokenWrapMapIndex[2] = { }; static const char *ScnOTokenMapIndex = - "dm"; + "dmyHMSu"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ - {CTOKT_PARSER, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateInfo, date.dayOfMonth), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.month), + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateInfo, date.month), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok %OI %Ol */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.hour), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.minutes), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.secondOfDay), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou Ow */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenWrapMapIndex[2] = { - "e", - "d" + "ekIlw", + "dHHHu" }; static const char *ScnSpecTokenMapIndex = @@ -1153,7 +1376,6 @@ ClockScan( /* * Invalidate result */ - info->flags |= flags; /* seconds token (%s) take precedence over all other tokens */ if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { @@ -1162,23 +1384,78 @@ ClockScan( if (!(flags & CLF_JULIANDAY)) { info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; - if (yyYear < 100) { - if (!(flags & CLF_CENTURY)) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; + /* dd precedence below ddd */ + switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { + case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* miss month: ddd over dd (without month) */ + flags &= ~CLF_DAYOFMONTH; + case (CLF_DAYOFYEAR): + /* ddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* both available: mmdd over ddd */ + flags &= ~CLF_DAYOFYEAR; + case (CLF_MONTH|CLF_DAYOFMONTH): + case (CLF_DAYOFMONTH): + /* mmdd / dd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + } + + /* YearWeekDay below YearMonthDay */ + if ( (flags & CLF_ISO8601) + && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) + || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) + ) + ) { + /* yy precedence below yyyy */ + if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { + /* normally precedence of ISO is higher, but no century - so put it down */ + flags &= ~CLF_ISO8601; + } + else + /* yymmdd or yyddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + } + + if (!(flags & CLF_ISO8601)) { + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; + } + } + } else { + if (info->date.iso8601Year < 100) { + if (!(flags & CLF_ISO8601CENTURY)) { + if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { + info->date.iso8601Year -= 100; + } + info->date.iso8601Year += dataPtr->currentYearCentury; + } else { + info->date.iso8601Year += info->dateCentury * 100; } - yyYear += dataPtr->currentYearCentury; - } else { - yyYear += info->dateCentury * 100; } } yydate.era = CE; } - /* if date but no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yydate.localSeconds = 0; - } + } + + /* if no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yydate.localSeconds = 0; } if (flags & CLF_TIME) { @@ -1192,6 +1469,9 @@ ClockScan( } } + /* tell caller which flags were set */ + info->flags |= flags; + ret = TCL_OK; goto done; diff --git a/generic/tclDate.h b/generic/tclDate.h index 23fe5b3..fc922cb 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -30,19 +30,26 @@ #define ONE_YEAR 365 /* days */ -#define CLF_DATE (1 << 2) #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) #define CLF_LOCALSEC (1 << 5) #define CLF_CENTURY (1 << 6) #define CLF_DAYOFMONTH (1 << 7) #define CLF_DAYOFYEAR (1 << 8) +#define CLF_MONTH (1 << 9) +#define CLF_YEAR (1 << 10) +#define CLF_ISO8601YEAR (1 << 12) +#define CLF_ISO8601 (1 << 13) +#define CLF_ISO8601CENTURY (1 << 14) #define CLF_SIGNED (1 << 15) /* On demand (lazy) assemble flags */ #define CLF_ASSEMBLE_DATE (1 << 28) /* assemble year, month, etc. using julianDay */ #define CLF_ASSEMBLE_JULIANDAY (1 << 29) /* assemble julianDay using year, month, etc. */ #define CLF_ASSEMBLE_SECONDS (1 << 30) /* assemble localSeconds (and seconds at end) */ +#define CLF_DATE (CLF_JULIANDAY | CLF_DAYOFMONTH | CLF_DAYOFYEAR | \ + CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | CLF_ISO8601) + /* * Enumeration of the string literals used in [clock] @@ -87,7 +94,7 @@ typedef enum ClockLiteral { "::tcl::clock::TZData", \ "::tcl::clock::GetSystemTimeZone", \ "::tcl::clock::SetupTimeZone", \ - "::msgcat::mcget", "::tcl::clock", \ + "::tcl::clock::mcget", "::tcl::clock", \ "::tcl::clock::LocalizeFormat" \ } @@ -96,13 +103,19 @@ typedef enum ClockLiteral { */ typedef enum ClockMsgCtLiteral { + MCLIT__NIL, /* placeholder */ MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, + MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, + MCLIT_AM, MCLIT_PM, MCLIT_LOCALE_NUMERALS, MCLIT__END } ClockMsgCtLiteral; #define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ + pref "", \ pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ + pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ + pref "AM", pref "PM", \ pref "LOCALE_NUMERALS", \ } @@ -406,6 +419,10 @@ MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); /* tclClock.c module declarations */ MODULE_SCOPE Tcl_Obj * + ClockSetupTimeZone(ClientData clientData, + Tcl_Interp *interp, Tcl_Obj *timezoneObj); + +MODULE_SCOPE Tcl_Obj * ClockMCDict(ClockFmtScnCmdArgs *opts); MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); diff --git a/library/clock.tcl b/library/clock.tcl index a532c0d..d4e29d5 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -629,15 +629,17 @@ proc ::tcl::clock::Initialize {} { # Caches - variable LocaleFormats {}; # Dictionary with localized formats + variable LocaleFormats \ + [dict create]; # Dictionary with localized formats - variable LocaleNumeralCache {}; # Dictionary whose keys are locale + variable LocaleNumeralCache \ + [dict create]; # Dictionary whose keys are locale # names and whose values are pairs # comprising regexes matching numerals # in the given locales and dictionaries # mapping the numerals to their numeric # values. - variable TimeZoneBad {}; # Dictionary whose keys are time zone + variable TimeZoneBad [dict create]; # Dictionary whose keys are time zone # names and whose values are 1 if # the time zone is unknown and 0 # if it is known. @@ -653,6 +655,17 @@ proc ::tcl::clock::Initialize {} { ::tcl::clock::Initialize #---------------------------------------------------------------------- + +proc mcget {locale args} { + switch -- $locale system { + set locale [GetSystemLocale] + } current { + set locale [mclocale] + } + msgcat::mcget ::tcl::clock $locale {*}$args +} + +#---------------------------------------------------------------------- # # clock format -- # @@ -2938,7 +2951,7 @@ proc ::tcl::clock::ConvertLegacyTimeZone { tzname } { # #---------------------------------------------------------------------- -proc ::tcl::clock::SetupTimeZone { timezone } { +proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { variable TZData if {! [info exists TZData($timezone)] } { @@ -3005,6 +3018,19 @@ proc ::tcl::clock::SetupTimeZone { timezone } { } } else { + + variable LegacyTimeZone + + # Check may be a legacy zone: + if { $alias eq {} && ![catch { + set tzname [dict get $LegacyTimeZone [string tolower $timezone]] + }] } { + set tzname [::tcl::clock::SetupTimeZone $tzname $timezone] + set TZData($timezone) $TZData($tzname) + # tell backend - timezone is initialized and return shared timezone object: + return [configure -setup-tz $timezone] + } + # We couldn't parse this as a POSIX time zone. Try again with a # time zone file - this time without a colon @@ -4472,6 +4498,9 @@ proc ::tcl::clock::ClearCaches {} { # tell backend - should invalidate: configure -clear + # clear msgcat cache: + msgcat::ClearCaches ::tcl::clock + foreach p [info procs [namespace current]::scanproc'*] { rename $p {} } diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index a25f6c8..e6452d2 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -951,6 +951,11 @@ proc msgcat::Merge {ns locales} { return [dict smartref $mrgcat] } +proc msgcat::ClearCaches {ns} { + variable Merged + dict unset Merged $ns +} + # msgcat::Invoke -- # # Invoke a set of registered callbacks. diff --git a/tests/clock.test b/tests/clock.test index 22b5bc1..e96dec6 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -21070,78 +21070,78 @@ test clock-10.10 {julian day takes precedence over ccyyddd} { # BEGIN testcases11 -# Test precedence among yyyymmdd and yyyyddd +# Test precedence yyyymmdd over yyyyddd -test clock-11.1 {precedence of ccyyddd and ccyymmdd} { +test clock-11.1 {precedence of ccyymmdd over ccyyddd} { clock scan 19700101002 -format %Y%m%d%j -gmt 1 -} 86400 -test clock-11.2 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.2 {precedence of ccyymmdd over ccyyddd} { clock scan 01197001002 -format %m%Y%d%j -gmt 1 -} 86400 -test clock-11.3 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.3 {precedence of ccyymmdd over ccyyddd} { clock scan 01197001002 -format %d%Y%m%j -gmt 1 -} 86400 -test clock-11.4 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.4 {precedence of ccyymmdd over ccyyddd} { clock scan 00219700101 -format %j%Y%m%d -gmt 1 } 0 -test clock-11.5 {precedence of ccyyddd and ccyymmdd} { +test clock-11.5 {precedence of ccyymmdd over ccyyddd} { clock scan 19700100201 -format %Y%m%j%d -gmt 1 } 0 -test clock-11.6 {precedence of ccyyddd and ccyymmdd} { +test clock-11.6 {precedence of ccyymmdd over ccyyddd} { clock scan 01197000201 -format %m%Y%j%d -gmt 1 } 0 -test clock-11.7 {precedence of ccyyddd and ccyymmdd} { +test clock-11.7 {precedence of ccyymmdd over ccyyddd} { clock scan 01197000201 -format %d%Y%j%m -gmt 1 } 0 -test clock-11.8 {precedence of ccyyddd and ccyymmdd} { +test clock-11.8 {precedence of ccyymmdd over ccyyddd} { clock scan 00219700101 -format %j%Y%d%m -gmt 1 } 0 -test clock-11.9 {precedence of ccyyddd and ccyymmdd} { +test clock-11.9 {precedence of ccyymmdd over ccyyddd} { clock scan 19700101002 -format %Y%d%m%j -gmt 1 -} 86400 -test clock-11.10 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.10 {precedence of ccyymmdd over ccyyddd} { clock scan 01011970002 -format %m%d%Y%j -gmt 1 -} 86400 -test clock-11.11 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.11 {precedence of ccyymmdd over ccyyddd} { clock scan 01011970002 -format %d%m%Y%j -gmt 1 -} 86400 -test clock-11.12 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.12 {precedence of ccyymmdd over ccyyddd} { clock scan 00201197001 -format %j%m%Y%d -gmt 1 } 0 -test clock-11.13 {precedence of ccyyddd and ccyymmdd} { +test clock-11.13 {precedence of ccyymmdd over ccyyddd} { clock scan 19700100201 -format %Y%d%j%m -gmt 1 } 0 -test clock-11.14 {precedence of ccyyddd and ccyymmdd} { +test clock-11.14 {precedence of ccyymmdd over ccyyddd} { clock scan 01010021970 -format %m%d%j%Y -gmt 1 -} 86400 -test clock-11.15 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.15 {precedence of ccyymmdd over ccyyddd} { clock scan 01010021970 -format %d%m%j%Y -gmt 1 -} 86400 -test clock-11.16 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.16 {precedence of ccyymmdd over ccyyddd} { clock scan 00201011970 -format %j%m%d%Y -gmt 1 } 0 -test clock-11.17 {precedence of ccyyddd and ccyymmdd} { +test clock-11.17 {precedence of ccyymmdd over ccyyddd} { clock scan 19700020101 -format %Y%j%m%d -gmt 1 } 0 -test clock-11.18 {precedence of ccyyddd and ccyymmdd} { +test clock-11.18 {precedence of ccyymmdd over ccyyddd} { clock scan 01002197001 -format %m%j%Y%d -gmt 1 } 0 -test clock-11.19 {precedence of ccyyddd and ccyymmdd} { +test clock-11.19 {precedence of ccyymmdd over ccyyddd} { clock scan 01002197001 -format %d%j%Y%m -gmt 1 } 0 -test clock-11.20 {precedence of ccyyddd and ccyymmdd} { +test clock-11.20 {precedence of ccyymmdd over ccyyddd} { clock scan 00201197001 -format %j%d%Y%m -gmt 1 } 0 -test clock-11.21 {precedence of ccyyddd and ccyymmdd} { +test clock-11.21 {precedence of ccyymmdd over ccyyddd} { clock scan 19700020101 -format %Y%j%d%m -gmt 1 } 0 -test clock-11.22 {precedence of ccyyddd and ccyymmdd} { +test clock-11.22 {precedence of ccyymmdd over ccyyddd} { clock scan 01002011970 -format %m%j%d%Y -gmt 1 } 0 -test clock-11.23 {precedence of ccyyddd and ccyymmdd} { +test clock-11.23 {precedence of ccyymmdd over ccyyddd} { clock scan 01002011970 -format %d%j%m%Y -gmt 1 } 0 -test clock-11.24 {precedence of ccyyddd and ccyymmdd} { +test clock-11.24 {precedence of ccyymmdd over ccyyddd} { clock scan 00201011970 -format %j%d%m%Y -gmt 1 } 0 # END testcases11 -- cgit v0.12 From 02b4c1de38afe8c1a068834cbab9ea7f403e0c60 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:33:41 +0000 Subject: repaired system/current locale caching (also for legacy clock format) and legacy timezone cached as last --- generic/tclClock.c | 80 ++++++++++++++++++++++++++++++++++++++++++++------- generic/tclClockFmt.c | 4 ++- generic/tclDate.h | 16 +++++------ library/clock.tcl | 24 +++++++++------- 4 files changed, 93 insertions(+), 31 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 1a5141b..a84300a 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -383,16 +383,52 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- */ +inline Tcl_Obj * +ClockGetSystemLocale( + ClockClientData *dataPtr, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + if (Tcl_EvalObjv(interp, 1, &dataPtr->literals[LIT_GETSYSTEMLOCALE], 0) != TCL_OK) { + return NULL; + } + + return Tcl_GetObjResult(interp); +} +/* + *---------------------------------------------------------------------- + */ +inline Tcl_Obj * +ClockGetCurrentLocale( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + if (Tcl_EvalObjv(interp, 1, &dataPtr->literals[LIT_GETCURRENTLOCALE], 0) != TCL_OK) { + return NULL; + } + + Tcl_SetObjRef(dataPtr->CurrentLocale, Tcl_GetObjResult(interp)); + Tcl_UnsetObjRef(dataPtr->CurrentLocaleDict); + + return dataPtr->CurrentLocale; +} +/* + *---------------------------------------------------------------------- + */ static Tcl_Obj * NormLocaleObj( - ClockClientData *dataPtr, /* Client data containing literal pool */ + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *localeObj, Tcl_Obj **mcDictObj) { const char *loc; if ( localeObj == NULL || localeObj == dataPtr->CurrentLocale - || localeObj == dataPtr->literals[LIT_C] + || localeObj == dataPtr->literals[LIT_C] + || localeObj == dataPtr->literals[LIT_CURRENT] ) { + if (dataPtr->CurrentLocale == NULL) { + ClockGetCurrentLocale(dataPtr, interp); + } *mcDictObj = dataPtr->CurrentLocaleDict; return dataPtr->CurrentLocale; } @@ -404,19 +440,23 @@ NormLocaleObj( } loc = TclGetString(localeObj); - if (dataPtr->CurrentLocale != NULL && - (localeObj == dataPtr->CurrentLocale - || strcmp(loc, TclGetString(dataPtr->CurrentLocale)) == 0 + if ( dataPtr->CurrentLocale != NULL + && ( localeObj == dataPtr->CurrentLocale + || (localeObj->length == dataPtr->CurrentLocale->length + && strcmp(loc, TclGetString(dataPtr->CurrentLocale)) == 0 ) + ) ) { *mcDictObj = dataPtr->CurrentLocaleDict; localeObj = dataPtr->CurrentLocale; } else - if (dataPtr->LastUsedLocale != NULL && - (localeObj == dataPtr->LastUsedLocale - || strcmp(loc, TclGetString(dataPtr->LastUsedLocale)) == 0 + if ( dataPtr->LastUsedLocale != NULL + && ( localeObj == dataPtr->LastUsedLocale + || (localeObj->length == dataPtr->LastUsedLocale->length + && strcmp(loc, TclGetString(dataPtr->LastUsedLocale)) == 0 ) + ) ) { *mcDictObj = dataPtr->LastUsedLocaleDict; Tcl_SetObjRef(dataPtr->LastUnnormUsedLocale, localeObj); @@ -424,12 +464,28 @@ NormLocaleObj( } else if ( - strcmp(loc, Literals[LIT_C]) == 0 + (localeObj->length == 1 /* C */ + && strncasecmp(loc, Literals[LIT_C], localeObj->length) == 0) + || (localeObj->length == 7 /* current */ + && strncasecmp(loc, Literals[LIT_CURRENT], localeObj->length) == 0) ) { + if (dataPtr->CurrentLocale == NULL) { + ClockGetCurrentLocale(dataPtr, interp); + } *mcDictObj = dataPtr->CurrentLocaleDict; localeObj = dataPtr->CurrentLocale; } else + if ( + (localeObj->length == 6 /* system */ + && strncasecmp(loc, Literals[LIT_SYSTEM], localeObj->length) == 0) + ) { + Tcl_SetObjRef(dataPtr->LastUnnormUsedLocale, localeObj); + localeObj = ClockGetSystemLocale(dataPtr, interp); + Tcl_SetObjRef(dataPtr->LastUsedLocale, localeObj); + *mcDictObj = NULL; + } + else { *mcDictObj = NULL; } @@ -450,7 +506,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) /* if locale was not yet used */ if ( !(opts->flags & CLF_LOCALE_USED) ) { - opts->localeObj = NormLocaleObj(opts->clientData, + opts->localeObj = NormLocaleObj(opts->clientData, opts->interp, opts->localeObj, &opts->mcDictObj); if (opts->localeObj == NULL) { @@ -490,6 +546,8 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } if ( opts->localeObj == dataPtr->CurrentLocale ) { Tcl_SetObjRef(dataPtr->CurrentLocaleDict, opts->mcDictObj); + } else if ( opts->localeObj == dataPtr->LastUsedLocale ) { + Tcl_SetObjRef(dataPtr->LastUsedLocaleDict, opts->mcDictObj); } else { Tcl_SetObjRef(dataPtr->LastUsedLocale, opts->localeObj); Tcl_UnsetObjRef(dataPtr->LastUnnormUsedLocale); @@ -2717,7 +2775,7 @@ _ClockParseFmtScnArgs( if ((saw & (1 << CLOCK_FORMAT_GMT)) && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { - Tcl_SetObjResult(interp, litPtr[LIT_CANNOT_USE_GMT_AND_TIMEZONE]); + Tcl_SetResult(interp, "cannot use -gmt and -timezone in same call", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index f965a17..5d3dcaf 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1199,7 +1199,9 @@ ClockLocalizeFormat( clean: Tcl_UnsetObjRef(keyObj); - Tcl_ResetResult(opts->interp); + if (valObj) { + Tcl_ResetResult(opts->interp); + } } return (opts->formatObj = valObj); diff --git a/generic/tclDate.h b/generic/tclDate.h index fc922cb..e78d4f8 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -58,9 +58,8 @@ typedef enum ClockLiteral { LIT__NIL, LIT__DEFAULT_FORMAT, - LIT_BCE, LIT_C, - LIT_CANNOT_USE_GMT_AND_TIMEZONE, - LIT_CE, + LIT_SYSTEM, LIT_CURRENT, + LIT_BCE, LIT_C, LIT_CE, LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, LIT_ERA, LIT_GMT, LIT_GREGORIAN, LIT_INTEGER_VALUE_TOO_LARGE, @@ -72,7 +71,8 @@ typedef enum ClockLiteral { LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, - LIT_MCGET, LIT_TCL_CLOCK, + LIT_MCGET, + LIT_GETSYSTEMLOCALE, LIT_GETCURRENTLOCALE, LIT_LOCALIZE_FORMAT, LIT__END } ClockLiteral; @@ -80,9 +80,8 @@ typedef enum ClockLiteral { #define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ "", \ "%a %b %d %H:%M:%S %Z %Y", \ - "BCE", "C", \ - "cannot use -gmt and -timezone in same call", \ - "CE", \ + "system", "current", \ + "BCE", "C", "CE", \ "dayOfMonth", "dayOfWeek", "dayOfYear", \ "era", ":GMT", "gregorian", \ "integer value too large to represent", \ @@ -94,7 +93,8 @@ typedef enum ClockLiteral { "::tcl::clock::TZData", \ "::tcl::clock::GetSystemTimeZone", \ "::tcl::clock::SetupTimeZone", \ - "::tcl::clock::mcget", "::tcl::clock", \ + "::tcl::clock::mcget", \ + "::tcl::clock::GetSystemLocale", "::tcl::clock::mclocale", \ "::tcl::clock::LocalizeFormat" \ } diff --git a/library/clock.tcl b/library/clock.tcl index d4e29d5..f874e4d 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -2352,7 +2352,7 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { }] } { # message catalog dictionary: - set mcd [::msgcat::mcget ::tcl::clock $locale] + set mcd [mcget $locale] # Handle locale-dependent format groups by mapping them out of the format # string. Note that the order of the [string map] operations is @@ -3021,21 +3021,23 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { variable LegacyTimeZone - # Check may be a legacy zone: - if { $alias eq {} && ![catch { - set tzname [dict get $LegacyTimeZone [string tolower $timezone]] - }] } { - set tzname [::tcl::clock::SetupTimeZone $tzname $timezone] - set TZData($timezone) $TZData($tzname) - # tell backend - timezone is initialized and return shared timezone object: - return [configure -setup-tz $timezone] - } - # We couldn't parse this as a POSIX time zone. Try again with a # time zone file - this time without a colon if { [catch { LoadTimeZoneFile $timezone }] && [catch { LoadZoneinfoFile $timezone } - opts] } { + + # Check may be a legacy zone: + + if { $alias eq {} && ![catch { + set tzname [dict get $LegacyTimeZone [string tolower $timezone]] + }] } { + set tzname [::tcl::clock::SetupTimeZone $tzname $timezone] + set TZData($timezone) $TZData($tzname) + # tell backend - timezone is initialized and return shared timezone object: + return [configure -setup-tz $timezone] + } + dict unset opts -errorinfo dict set TimeZoneBad $timezone 1 return -options $opts "time zone $timezone not found" -- cgit v0.12 From e9177a25c1cbdc5ee7108dbadc69acab26f9abf5 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:34:11 +0000 Subject: bug fix by match word token (FindWordEnd fixed); repaired current locale switch --- generic/tclClockFmt.c | 6 +++--- library/clock.tcl | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 5d3dcaf..a10d05d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -609,12 +609,12 @@ FindWordEnd( return ++p; } /* multi-char word */ - while (*p++ == *x++) { - if (x >= tok->tokWord.end || p >= end) { + do + if (*p++ != *x++) { /* no match -> error */ return NULL; } - }; + while (x <= tok->tokWord.end && p < end); return p; } diff --git a/library/clock.tcl b/library/clock.tcl index f874e4d..ca12f4a 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -739,7 +739,7 @@ proc ::tcl::clock::ParseClockFormatFormat {procName format locale} { # Map away the locale-dependent composite format groups - EnterLocale $locale + set locale [EnterLocale $locale] # Change locale if a fresh locale has been given on the command line. @@ -2189,6 +2189,7 @@ proc ::tcl::clock::EnterLocale { locale } { } # Select the locale, eventually load it mcpackagelocale set $locale + return $locale } #---------------------------------------------------------------------- @@ -3028,7 +3029,7 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { && [catch { LoadZoneinfoFile $timezone } - opts] } { # Check may be a legacy zone: - + if { $alias eq {} && ![catch { set tzname [dict get $LegacyTimeZone [string tolower $timezone]] }] } { @@ -4460,6 +4461,9 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { #---------------------------------------------------------------------- proc ::tcl::clock::ChangeCurrentLocale {args} { + + configure -default-locale [lindex $args 0] + variable FormatProc variable LocaleNumeralCache -- cgit v0.12 From 36d60df82c46ec5b74df8d791793fc94347e7938 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:34:42 +0000 Subject: clock scan almost ready (currently test-case covered tokens only), test cases passed; todo - check other tokens from "clock.tcl" --- generic/tclClockFmt.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++----- generic/tclDate.h | 16 ++++++++++----- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index a10d05d..c8158cc 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -748,7 +748,7 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, amPmObj[0] = ClockMCGet(opts, MCLIT_AM); amPmObj[1] = ClockMCGet(opts, MCLIT_PM); - if (amPmObj[0] == NULL || amPmObj == NULL) { + if (amPmObj[0] == NULL || amPmObj[1] == NULL) { return TCL_ERROR; } @@ -768,6 +768,44 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, } static int +ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + ClockClientData *dataPtr = opts->clientData; + + int ret, val; + int minLen, maxLen; + Tcl_Obj *eraObj[6]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + eraObj[0] = ClockMCGet(opts, MCLIT_BCE); + eraObj[1] = ClockMCGet(opts, MCLIT_CE); + eraObj[2] = dataPtr->mcLiterals[MCLIT_BCE2]; + eraObj[3] = dataPtr->mcLiterals[MCLIT_CE2]; + eraObj[4] = dataPtr->mcLiterals[MCLIT_BCE3]; + eraObj[5] = dataPtr->mcLiterals[MCLIT_CE3]; + + if (eraObj[0] == NULL || eraObj[1] == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, eraObj, 6, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val & 1) { + yydate.era = CE; + } else { + yydate.era = BCE; + } + + return TCL_OK; +} + +static int ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { @@ -782,7 +820,9 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, return ret; } - *(time_t *)(((char *)info) + tok->map->offs) = val; + if (tok->map->offs > 0) { + *(time_t *)(((char *)info) + tok->map->offs) = val; + } return TCL_OK; } @@ -931,9 +971,14 @@ static const char *ScnSTokenWrapMapIndex[2] = { }; static const char *ScnETokenMapIndex = - ""; + "Ey"; static ClockScanTokenMap ScnETokenMap[] = { - {0, 0, 0} + /* %EE */ + {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ey */ + {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnETokenWrapMapIndex[2] = { "", @@ -1450,7 +1495,6 @@ ClockScan( } } } - yydate.era = CE; } } diff --git a/generic/tclDate.h b/generic/tclDate.h index e78d4f8..020fa64 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -58,8 +58,8 @@ typedef enum ClockLiteral { LIT__NIL, LIT__DEFAULT_FORMAT, - LIT_SYSTEM, LIT_CURRENT, - LIT_BCE, LIT_C, LIT_CE, + LIT_SYSTEM, LIT_CURRENT, LIT_C, + LIT_BCE, LIT_CE, LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, LIT_ERA, LIT_GMT, LIT_GREGORIAN, LIT_INTEGER_VALUE_TOO_LARGE, @@ -80,8 +80,8 @@ typedef enum ClockLiteral { #define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ "", \ "%a %b %d %H:%M:%S %Z %Y", \ - "system", "current", \ - "BCE", "C", "CE", \ + "system", "current", "C", \ + "BCE", "CE", \ "dayOfMonth", "dayOfWeek", "dayOfYear", \ "era", ":GMT", "gregorian", \ "integer value too large to represent", \ @@ -107,6 +107,9 @@ typedef enum ClockMsgCtLiteral { MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_AM, MCLIT_PM, + MCLIT_BCE, MCLIT_CE, + MCLIT_BCE2, MCLIT_CE2, + MCLIT_BCE3, MCLIT_CE3, MCLIT_LOCALE_NUMERALS, MCLIT__END } ClockMsgCtLiteral; @@ -115,7 +118,10 @@ typedef enum ClockMsgCtLiteral { pref "", \ pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ - pref "AM", pref "PM", \ + pref "AM", pref "PM", \ + pref "BCE", pref "CE", \ + pref "b.c.e.", pref "c.e.", \ + pref "b.c.", pref "a.d.", \ pref "LOCALE_NUMERALS", \ } -- cgit v0.12 From e130d09c74bdbd2531f7c8bf75f5ede84eb0bdab Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:35:14 +0000 Subject: small optimization (determine min/max length, end distance, etc.) --- generic/tclClockFmt.c | 34 ++++++++++++++++++++++++++++++---- generic/tclDate.h | 3 ++- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index c8158cc..2873ff7 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -498,13 +498,24 @@ void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, { register const char*p = yyInput; *minLen = 0; - *maxLen = info->dateEnd - p; + /* max length to the end regarding distance to end (min-width of following tokens) */ + *maxLen = info->dateEnd - p - tok->endDistance; /* if no tokens anymore */ if (!(tok+1)->map) { /* should match to end or first space */ while (!isspace(UCHAR(*p)) && ++p < info->dateEnd) {}; *minLen = p - yyInput; + } else + /* next token is a word */ + if ((tok+1)->map->type == CTOKT_WORD) { + /* should match at least to the first char of this word */ + while (*p != *((tok+1)->tokWord.start) && ++p < info->dateEnd) {}; + *minLen = p - yyInput; + } + + if (*minLen > *maxLen) { + *maxLen = *minLen; } } @@ -1018,7 +1029,7 @@ static const char *ScnOTokenWrapMapIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 0, 1, 0xffff, 0, + {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, NULL}, }; @@ -1131,9 +1142,9 @@ ClockGetOrParseScanFormat( tok->map = &scnMap[cp - mapIndex]; tok->tokWord.start = p; /* calculate look ahead value by standing together tokens */ - if (tok > fss->scnTok) { - ClockScanToken *prevTok = tok - 1; + if (tok > fss->scnTok && tok->map->minSize) { unsigned int lookAhead = tok->map->minSize; + ClockScanToken *prevTok = tok - 1; while (prevTok >= fss->scnTok) { if (prevTok->map->type != tok->map->type) { @@ -1177,6 +1188,21 @@ word_tok: continue; } + /* calculate end distance value for each tokens */ + if (tok > fss->scnTok) { + unsigned int endDist = 0; + ClockScanToken *prevTok = tok-1; + + while (prevTok >= fss->scnTok) { + prevTok->endDistance = endDist; + if (prevTok->map->type != CTOKT_WORD) { + endDist += prevTok->map->minSize; + } else { + endDist += prevTok->tokWord.end - prevTok->tokWord.start + 1; + } + prevTok--; + } + } done: Tcl_MutexUnlock(&ClockFmtMutex); } diff --git a/generic/tclDate.h b/generic/tclDate.h index 020fa64..00bd234 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -389,7 +389,8 @@ typedef struct ClockScanTokenMap { typedef struct ClockScanToken { ClockScanTokenMap *map; - unsigned int lookAhead; + unsigned short int lookAhead; + unsigned short int endDistance; struct { const char *start; const char *end; -- cgit v0.12 From 717e43f1bd2a2b769c8e2a60db22a98c8690db1a Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:35:34 +0000 Subject: estimate token count by % char and format length (don't use fix TOK_CHAIN_BLOCK_SIZE by creation, minimized memory usage) --- generic/tclClockFmt.c | 26 +++++++++++++++++++++----- generic/tclDate.h | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 2873ff7..ac34e68 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1080,14 +1080,30 @@ ClockGetOrParseScanFormat( const char *strFmt; register const char *p, *e, *cp; + e = strFmt = HashEntry4FmtScn(fss)->key.string; + e += strlen(strFmt); + + /* estimate token count by % char and format length */ + fss->scnTokC = 0; + p = strFmt; + while (p != e) { + if (*p++ == '%') fss->scnTokC++; + } + p = strFmt + fss->scnTokC * 2; + if (p < e) { + if ((e - p) < fss->scnTokC) { + fss->scnTokC += (e - p); + } else { + fss->scnTokC += fss->scnTokC; + } + } + fss->scnTokC++; + Tcl_MutexLock(&ClockFmtMutex); - fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; - fss->scnTok = - tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); + fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); - strFmt = HashEntry4FmtScn(fss)->key.string; - for (e = p = strFmt, e += strlen(strFmt); p != e; p++) { + for (p = strFmt; p != e; p++) { switch (*p) { case '%': if (1) { diff --git a/generic/tclDate.h b/generic/tclDate.h index 00bd234..9e1c506 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -355,7 +355,7 @@ typedef enum _MERIDIAN { #define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 -#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 12 +#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 2 typedef struct ClockScanToken ClockScanToken; -- cgit v0.12 From c5ff074db9dcb68224ba79b0e8a72edcbf63610a Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:36:19 +0000 Subject: cacheable conversions Local2UTC / UTC2Local fixed (some TZ switches time seconds bound) and optimized (last period ranges saved); prepare to back-port clock format --- generic/tclClock.c | 265 +++++++++++++++++++++++++++++++++------------- generic/tclClockFmt.c | 287 +++++++++++++++++++++++++++++++++++++++++++++++++- generic/tclDate.h | 28 ++++- library/clock.tcl | 14 --- 4 files changed, 502 insertions(+), 92 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a84300a..0c08391 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -72,19 +72,21 @@ TCL_DECLARE_MUTEX(clockMutex) static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, - TclDateFields *, int, Tcl_Obj *const[]); + TclDateFields *, int, Tcl_Obj *const[], + Tcl_WideInt rangesVal[2]); static int ConvertUTCToLocalUsingC(Tcl_Interp *, TclDateFields *, int); static int ConvertLocalToUTC(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp *, - TclDateFields *, int, Tcl_Obj *const[]); + TclDateFields *, int, Tcl_Obj *const[], + Tcl_WideInt rangesVal[2]); static int ConvertLocalToUTCUsingC(Tcl_Interp *, TclDateFields *, int); static int ClockConfigureObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static Tcl_Obj * LookupLastTransition(Tcl_Interp *, Tcl_WideInt, - int, Tcl_Obj *const *); + int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); static void GetYearWeekDay(TclDateFields *, int); static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); @@ -1432,6 +1434,7 @@ ConvertLocalToUTC( Tcl_Obj *tzdata; /* Time zone data */ int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ + Tcl_WideInt seconds; /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ if (timezoneObj == dataPtr->GMTSetupTimeZone && dataPtr->GMTSetupTimeZone != NULL) { @@ -1442,17 +1445,37 @@ ConvertLocalToUTC( /* * Check cacheable conversion could be used - * (last-minute Local2UTC cache with the same TZ) + * (last-period Local2UTC cache within the same TZ) */ + seconds = fields->localSeconds - dataPtr->Local2UTC.tzOffset; if ( timezoneObj == dataPtr->Local2UTC.timezoneObj && ( fields->localSeconds == dataPtr->Local2UTC.localSeconds - || fields->localSeconds / 60 == dataPtr->Local2UTC.localSeconds / 60 + || ( seconds >= dataPtr->Local2UTC.rangesVal[0] + && seconds < dataPtr->Local2UTC.rangesVal[1]) ) && changeover == dataPtr->Local2UTC.changeover ) { /* the same time zone and offset (UTC time inside the last minute) */ fields->tzOffset = dataPtr->Local2UTC.tzOffset; - fields->seconds = fields->localSeconds - fields->tzOffset; + fields->seconds = seconds; + return TCL_OK; + } + + /* + * Check cacheable back-conversion could be used + * (last-period UTC2Local cache within the same TZ) + */ + seconds = fields->localSeconds - dataPtr->UTC2Local.tzOffset; + if ( timezoneObj == dataPtr->UTC2Local.timezoneObj + && ( seconds == dataPtr->UTC2Local.seconds + || ( seconds >= dataPtr->UTC2Local.rangesVal[0] + && seconds < dataPtr->UTC2Local.rangesVal[1]) + ) + && changeover == dataPtr->UTC2Local.changeover + ) { + /* the same time zone and offset (UTC time inside the last minute) */ + fields->tzOffset = dataPtr->UTC2Local.tzOffset; + fields->seconds = seconds; return TCL_OK; } @@ -1475,11 +1498,15 @@ ConvertLocalToUTC( */ if (rowc == 0) { + dataPtr->Local2UTC.rangesVal[0] = 0; + dataPtr->Local2UTC.rangesVal[1] = 0; + if (ConvertLocalToUTCUsingC(interp, fields, changeover) != TCL_OK) { return TCL_ERROR; }; } else { - if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv, + dataPtr->Local2UTC.rangesVal) != TCL_OK) { return TCL_ERROR; }; } @@ -1516,7 +1543,8 @@ ConvertLocalToUTCUsingTable( Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Time to convert, with 'seconds' filled in */ int rowc, /* Number of points at which time changes */ - Tcl_Obj *const rowv[]) /* Points at which time changes */ + Tcl_Obj *const rowv[], /* Points at which time changes */ + Tcl_WideInt rangesVal[2]) /* Return bounds for time period */ { Tcl_Obj *row; int cellc; @@ -1540,7 +1568,8 @@ ConvertLocalToUTCUsingTable( fields->tzOffset = 0; fields->seconds = fields->localSeconds; while (!found) { - row = LookupLastTransition(interp, fields->seconds, rowc, rowv); + row = LookupLastTransition(interp, fields->seconds, rowc, rowv, + rangesVal); if ((row == NULL) || TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK @@ -1730,11 +1759,12 @@ ConvertUTCToLocal( /* * Check cacheable conversion could be used - * (last-minute UTC2Local cache with the same TZ) + * (last-period UTC2Local cache within the same TZ) */ if ( timezoneObj == dataPtr->UTC2Local.timezoneObj && ( fields->seconds == dataPtr->UTC2Local.seconds - || fields->seconds / 60 == dataPtr->UTC2Local.seconds / 60 + || ( fields->seconds >= dataPtr->UTC2Local.rangesVal[0] + && fields->seconds < dataPtr->UTC2Local.rangesVal[1]) ) && changeover == dataPtr->UTC2Local.changeover ) { @@ -1764,11 +1794,15 @@ ConvertUTCToLocal( */ if (rowc == 0) { + dataPtr->UTC2Local.rangesVal[0] = 0; + dataPtr->UTC2Local.rangesVal[1] = 0; + if (ConvertUTCToLocalUsingC(interp, fields, changeover) != TCL_OK) { return TCL_ERROR; } } else { - if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, + dataPtr->UTC2Local.rangesVal) != TCL_OK) { return TCL_ERROR; } } @@ -1806,7 +1840,8 @@ ConvertUTCToLocalUsingTable( TclDateFields *fields, /* Fields of the date */ int rowc, /* Number of rows in the conversion table * (>= 1) */ - Tcl_Obj *const rowv[]) /* Rows of the conversion table */ + Tcl_Obj *const rowv[], /* Rows of the conversion table */ + Tcl_WideInt rangesVal[2]) /* Return bounds for time period */ { Tcl_Obj *row; /* Row containing the current information */ int cellc; /* Count of cells in the row (must be 4) */ @@ -1816,7 +1851,7 @@ ConvertUTCToLocalUsingTable( * Look up the nearest transition time. */ - row = LookupLastTransition(interp, fields->seconds, rowc, rowv); + row = LookupLastTransition(interp, fields->seconds, rowc, rowv, rangesVal); if (row == NULL || TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK || TclGetIntFromObj(interp, cellv[1], &fields->tzOffset) != TCL_OK) { @@ -1943,12 +1978,13 @@ LookupLastTransition( Tcl_Interp *interp, /* Interpreter for error messages */ Tcl_WideInt tick, /* Time from the epoch */ int rowc, /* Number of rows of tzdata */ - Tcl_Obj *const *rowv) /* Rows in tzdata */ + Tcl_Obj *const *rowv, /* Rows in tzdata */ + Tcl_WideInt rangesVal[2]) /* Return bounds for time period */ { - int l; + int l = 0; int u; Tcl_Obj *compObj; - Tcl_WideInt compVal; + Tcl_WideInt compVal, fromVal = tick, toVal = tick; /* * Examine the first row to make sure we're in bounds. @@ -1965,14 +2001,13 @@ LookupLastTransition( */ if (tick < compVal) { - return rowv[0]; + goto done; } /* * Binary-search to find the transition. */ - l = 0; u = rowc-1; while (l < u) { int m = (l + u + 1) / 2; @@ -1983,10 +2018,19 @@ LookupLastTransition( } if (tick >= compVal) { l = m; + fromVal = compVal; } else { u = m-1; + toVal = compVal; } } + +done: + + if (rangesVal) { + rangesVal[0] = fromVal; + rangesVal[1] = toVal; + } return rowv[l]; } @@ -2713,7 +2757,7 @@ _ClockParseFmtScnArgs( Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ - ClockFmtScnCmdArgs *resOpts, /* Result vector: format, locale, timezone... */ + ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ int forScan /* Flag to differentiate between format and scan */ ) { ClockClientData *dataPtr = clientData; @@ -2739,7 +2783,7 @@ _ClockParseFmtScnArgs( * Extract values for the keywords. */ - memset(resOpts, 0, sizeof(*resOpts)); + memset(opts, 0, sizeof(*opts)); for (i = 2; i < objc; i+=2) { if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], "option", 0, &optionIndex) != TCL_OK) { @@ -2749,7 +2793,7 @@ _ClockParseFmtScnArgs( } switch (optionIndex) { case CLOCK_FORMAT_FORMAT: - resOpts->formatObj = objv[i+1]; + opts->formatObj = objv[i+1]; break; case CLOCK_FORMAT_GMT: if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ @@ -2757,13 +2801,13 @@ _ClockParseFmtScnArgs( } break; case CLOCK_FORMAT_LOCALE: - resOpts->localeObj = objv[i+1]; + opts->localeObj = objv[i+1]; break; case CLOCK_FORMAT_TIMEZONE: - resOpts->timezoneObj = objv[i+1]; + opts->timezoneObj = objv[i+1]; break; case CLOCK_FORMAT_BASE: - resOpts->baseObj = objv[i+1]; + opts->baseObj = objv[i+1]; break; } saw |= 1 << optionIndex; @@ -2780,11 +2824,30 @@ _ClockParseFmtScnArgs( return TCL_ERROR; } if (gmtFlag) { - resOpts->timezoneObj = litPtr[LIT_GMT]; + opts->timezoneObj = litPtr[LIT_GMT]; + } + + opts->clientData = clientData; + opts->interp = interp; + + /* If time zone not specified use system time zone */ + + if ( opts->timezoneObj == NULL + || TclGetString(opts->timezoneObj) == NULL + || opts->timezoneObj->length == 0 + ) { + opts->timezoneObj = ClockGetSystemTimeZone(clientData, interp); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } } - resOpts->clientData = clientData; - resOpts->interp = interp; + /* Setup timezone (normalize object if needed and load TZ on demand) */ + + opts->timezoneObj = ClockSetupTimeZone(clientData, interp, opts->timezoneObj); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } return TCL_OK; } @@ -2816,7 +2879,7 @@ ClockParseformatargsObjCmd( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - ClockFmtScnCmdArgs resOpts; /* Format, locale and timezone */ + ClockFmtScnCmdArgs opts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ int ret; @@ -2837,7 +2900,7 @@ ClockParseformatargsObjCmd( */ ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &resOpts, 0); + &opts, 0); if (ret != TCL_OK) { return ret; } @@ -2849,18 +2912,110 @@ ClockParseformatargsObjCmd( if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { return TCL_ERROR; } - if (resOpts.formatObj == NULL) - resOpts.formatObj = literals[LIT__DEFAULT_FORMAT]; - if (resOpts.localeObj == NULL) - resOpts.localeObj = literals[LIT_C]; - if (resOpts.timezoneObj == NULL) - resOpts.timezoneObj = literals[LIT__NIL]; + if (opts.formatObj == NULL) + opts.formatObj = literals[LIT__DEFAULT_FORMAT]; + if (opts.localeObj == NULL) + opts.localeObj = literals[LIT_C]; + if (opts.timezoneObj == NULL) + opts.timezoneObj = literals[LIT__NIL]; /* * Return options as a list. */ - Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts.formatObj)); + Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&opts.formatObj)); + return TCL_OK; +} + +/*---------------------------------------------------------------------- + * + * ClockFormatObjCmd - + * + *---------------------------------------------------------------------- + */ + +int +ClockFormatObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter values */ +{ + ClockClientData *dataPtr = clientData; + + int ret; + ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ + Tcl_WideInt clockVal; /* Time, expressed in seconds from the Epoch */ + DateInfo yy; /* Common structure used for parsing */ + DateInfo *info = &yy; + + if ((objc & 1) == 1) { + Tcl_WrongNumArgs(interp, 1, objv, "string " + "?-format string? " + "?-gmt boolean? " + "?-locale LOCALE? ?-timezone ZONE?"); + Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); + return TCL_ERROR; + } + + /* + * Extract values for the keywords. + */ + + ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, + &opts, 0); + if (ret != TCL_OK) { + return ret; + } + + ret = TCL_ERROR; + + if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { + return TCL_ERROR; + } + + + ClockInitDateInfo(info); + yydate.tzName = NULL; + + /* + * Extract year, month and day from the base time for the parser to use as + * defaults + */ + + /* check base fields already cached (by TZ, last-second cache) */ + if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj + && dataPtr->lastBase.Date.seconds == clockVal) { + memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); + } else { + /* extact fields from base */ + yydate.seconds = clockVal; + if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + goto done; + } + /* cache last base */ + memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); + Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); + } + + /* Default format */ + if (opts.formatObj == NULL) { + opts.formatObj = dataPtr->literals[LIT__DEFAULT_FORMAT]; + } + + /* Use compiled version of Format - */ + + ret = ClockFormat(clientData, interp, info, &opts); + +done: + + Tcl_UnsetObjRef(yydate.tzName); + + if (ret != TCL_OK) { + return ret; + } + return TCL_OK; } @@ -2879,7 +3034,6 @@ ClockScanObjCmd( Tcl_Obj *const objv[]) /* Parameter values */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ @@ -2919,29 +3073,9 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - /* If time zone not specified use system time zone */ - if ( opts.timezoneObj == NULL - || TclGetString(opts.timezoneObj) == NULL - || opts.timezoneObj->length == 0 - ) { - opts.timezoneObj = ClockGetSystemTimeZone(clientData, interp); - if (opts.timezoneObj == NULL) { - return TCL_ERROR; - } - } - - /* Setup timezone (normalize object id needed and load TZ on demand) */ - - opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); - if (opts.timezoneObj == NULL) { - return TCL_ERROR; - } - ClockInitDateInfo(info); yydate.tzName = NULL; - // Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); - /* * Extract year, month and day from the base time for the parser to use as * defaults @@ -2979,20 +3113,6 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } -#if 0 - else - if (1) { - /* TODO: Tcled Scan proc - */ - int ret; - Tcl_Obj *callargs[10]; - memcpy(callargs, objv, objc * sizeof(*objv)); - callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); - Tcl_IncrRefCount(callargs[0]); - ret = Tcl_EvalObjv(interp, objc, callargs, 0); - Tcl_DecrRefCount(callargs[0]); - return ret; - } -#endif else { /* Use compiled version of Scan - */ @@ -3073,7 +3193,6 @@ ClockFreeScan( ClockFmtScnCmdArgs *opts) /* Command options */ { ClockClientData *dataPtr = clientData; - // Tcl_Obj **literals = dataPtr->literals; int ret = TCL_ERROR; diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ac34e68..5469ee1 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1091,7 +1091,7 @@ ClockGetOrParseScanFormat( } p = strFmt + fss->scnTokC * 2; if (p < e) { - if ((e - p) < fss->scnTokC) { + if ((unsigned int)(e - p) < fss->scnTokC) { fss->scnTokC += (e - p); } else { fss->scnTokC += fss->scnTokC; @@ -1581,6 +1581,291 @@ done: return ret; } +/* + *---------------------------------------------------------------------- + */ +int +ClockFormat( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + register DateInfo *info, /* Date fields used for parsing & converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockClientData *dataPtr = clientData; + ClockFormatToken *tok; + ClockFormatTokenMap *map; + + /* get localized format */ + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + +/* if ((tok = ClockGetOrParseFmtFormat(interp, opts->formatObj)) == NULL) { + return TCL_ERROR; + } +*/ +#if 0 + /* prepare parsing */ + + yyMeridian = MER24; + + p = TclGetString(strObj); + end = p + strObj->length; + /* in strict mode - bypass spaces at begin / end only (not between tokens) */ + if (opts->flags & CLF_STRICT) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + } + info->dateStart = yyInput = p; + info->dateEnd = end; + + /* parse string */ + for (; tok->map != NULL; tok++) { + map = tok->map; + /* bypass spaces at begin of input before parsing each token */ + if ( !(opts->flags & CLF_STRICT) + && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) + ) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + } + yyInput = p; + switch (map->type) + { + case CTOKT_DIGIT: + if (1) { + int size = map->maxSize; + int sign = 1; + if (map->flags & CLF_SIGNED) { + if (*p == '+') { yyInput = ++p; } + else + if (*p == '-') { yyInput = ++p; sign = -1; }; + } + /* greedy find digits (look for forward digits consider spaces), + * corresponding pre-calculated lookAhead */ + if (size != map->minSize && tok->lookAhead) { + int spcnt = 0; + const char *pe; + size += tok->lookAhead; + x = p + size; if (x > end) { x = end; }; + pe = x; + while (p < x) { + if (isspace(UCHAR(*p))) { + if (pe > p) { pe = p; }; + if (x < end) x++; + p++; + spcnt++; + continue; + } + if (isdigit(UCHAR(*p))) { + p++; + continue; + } + break; + } + /* consider reserved (lookAhead) for next tokens */ + p -= tok->lookAhead + spcnt; + if (p > pe) { + p = pe; + } + } else { + x = p + size; if (x > end) { x = end; }; + while (isdigit(UCHAR(*p)) && p < x) { p++; }; + } + size = p - yyInput; + if (size < map->minSize) { + /* missing input -> error */ + goto not_match; + } + /* string 2 number, put number into info structure by offset */ + p = yyInput; x = p + size; + if (!(map->flags & CLF_LOCALSEC)) { + if (_str2int((time_t *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } + flags = (flags & ~map->clearFlags) | map->flags; + } + break; + case CTOKT_PARSER: + switch (map->parser(opts, info, tok)) { + case TCL_OK: + break; + case TCL_RETURN: + goto not_match; + break; + default: + goto done; + break; + }; + p = yyInput; + flags = (flags & ~map->clearFlags) | map->flags; + break; + case CTOKT_SPACE: + /* at least one space in strict mode */ + if (opts->flags & CLF_STRICT) { + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto not_match; + } + p++; + } + while (p < end && isspace(UCHAR(*p))) { + p++; + } + break; + case CTOKT_WORD: + x = FindWordEnd(tok, p, end); + if (!x) { + /* no match -> error */ + goto not_match; + } + p = x; + continue; + break; + } + } + + /* ignore spaces at end */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + /* check end was reached */ + if (p < end) { + /* something after last token - wrong format */ + goto not_match; + } + + /* + * Invalidate result + */ + + /* seconds token (%s) take precedence over all other tokens */ + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { + if (flags & CLF_DATE) { + + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; + + /* dd precedence below ddd */ + switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { + case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* miss month: ddd over dd (without month) */ + flags &= ~CLF_DAYOFMONTH; + case (CLF_DAYOFYEAR): + /* ddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* both available: mmdd over ddd */ + flags &= ~CLF_DAYOFYEAR; + case (CLF_MONTH|CLF_DAYOFMONTH): + case (CLF_DAYOFMONTH): + /* mmdd / dd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + } + + /* YearWeekDay below YearMonthDay */ + if ( (flags & CLF_ISO8601) + && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) + || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) + ) + ) { + /* yy precedence below yyyy */ + if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { + /* normally precedence of ISO is higher, but no century - so put it down */ + flags &= ~CLF_ISO8601; + } + else + /* yymmdd or yyddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + } + + if (!(flags & CLF_ISO8601)) { + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; + } + } + } else { + if (info->date.iso8601Year < 100) { + if (!(flags & CLF_ISO8601CENTURY)) { + if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { + info->date.iso8601Year -= 100; + } + info->date.iso8601Year += dataPtr->currentYearCentury; + } else { + info->date.iso8601Year += info->dateCentury * 100; + } + } + } + } + } + + /* if no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yydate.localSeconds = 0; + } + + if (flags & CLF_TIME) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else + if (!(flags & CLF_LOCALSEC)) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + } + } + + /* tell caller which flags were set */ + info->flags |= flags; + + ret = TCL_OK; + goto done; + +overflow: + + Tcl_SetResult(interp, "requested date too large to represent", + TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); + goto done; + +not_match: + + Tcl_SetResult(interp, "input string does not match supplied format", + TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + +done: + + return ret; +#endif +} + MODULE_SCOPE void ClockFrmScnClearCaches(void) diff --git a/generic/tclDate.h b/generic/tclDate.h index 9e1c506..112ed31 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -2,7 +2,7 @@ * tclDate.h -- * * This header file handles common usage of clock primitives - * between tclDate.c (yacc) and tclClock.c. + * between tclDate.c (yacc), tclClock.c and tclClockFmt.c. * * Copyright (c) 2014 Serg G. Brester (aka sebres) * @@ -317,22 +317,24 @@ typedef struct ClockClientData { Tcl_Obj *timezoneObj; TclDateFields Date; } lastBase; - /* Las-minute cache for fast UTC2Local conversion */ + /* Las-period cache for fast UTC2Local conversion */ struct { /* keys */ Tcl_Obj *timezoneObj; int changeover; Tcl_WideInt seconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ time_t tzOffset; Tcl_Obj *tzName; } UTC2Local; - /* Las-minute cache for fast Local2UTC conversion */ + /* Las-period cache for fast Local2UTC conversion */ struct { /* keys */ Tcl_Obj *timezoneObj; int changeover; Tcl_WideInt localSeconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ time_t tzOffset; } Local2UTC; @@ -372,8 +374,22 @@ typedef enum _CLCKTOK_TYPE { typedef struct ClockFmtScnStorage ClockFmtScnStorage; +typedef struct ClockFormatTokenMap { + unsigned short int type; + unsigned short int flags; + unsigned short int clearFlags; + unsigned short int minSize; + unsigned short int maxSize; + unsigned short int offs; + ClockScanTokenProc *parser; + void *data; +} ClockFormatTokenMap; typedef struct ClockFormatToken { - CLCKTOK_TYPE type; + ClockFormatTokenMap *map; + struct { + const char *start; + const char *end; + } tokWord; } ClockFormatToken; typedef struct ClockScanTokenMap { @@ -447,10 +463,14 @@ MODULE_SCOPE ClockFmtScnStorage * Tcl_Obj *objPtr); MODULE_SCOPE Tcl_Obj * ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); + MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); +MODULE_SCOPE int ClockFormat(ClientData clientData, Tcl_Interp *interp, + register DateInfo *info, ClockFmtScnCmdArgs *opts); + MODULE_SCOPE void ClockFrmScnClearCaches(void); /* diff --git a/library/clock.tcl b/library/clock.tcl index ca12f4a..c4e698c 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -685,20 +685,6 @@ proc ::tcl::clock::format { args } { set locale [string tolower $locale] set clockval [lindex $args 0] - # Get the data for time changes in the given zone - - if {$timezone eq ""} { - if {[set timezone [configure -system-tz]] eq ""} { - set timezone [GetSystemTimeZone] - } - } - if {![info exists TZData($timezone)]} { - if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { - dict unset opts -errorinfo - return -options $opts $retval - } - } - # Build a procedure to format the result. Cache the built procedure's name # in the 'FormatProc' array to avoid losing its internal representation, # which contains the name resolution. -- cgit v0.12 From 2ba998572c987982e003b6f55f1c51f12bf4b4ce Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:37:40 +0000 Subject: string index tree for fast greedy search of the string (index) by unique string prefix as key; clock scan rewritten to use string index tries search; --- generic/tclClock.c | 74 ++++--- generic/tclClockFmt.c | 444 ++++++++++++++++------------------------- generic/tclDate.h | 22 +- generic/tclStrIdxTree.c | 519 ++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclStrIdxTree.h | 134 +++++++++++++ unix/Makefile.in | 4 + win/Makefile.in | 1 + win/makefile.vc | 1 + 8 files changed, 865 insertions(+), 334 deletions(-) create mode 100644 generic/tclStrIdxTree.c create mode 100644 generic/tclStrIdxTree.h diff --git a/generic/tclClock.c b/generic/tclClock.c index 0c08391..e52b2e7 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -15,6 +15,7 @@ */ #include "tclInt.h" +#include "tclStrIdxTree.h" #include "tclDate.h" /* @@ -140,6 +141,10 @@ static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); +static int ClockTestObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); + /* * Structure containing description of "native" clock commands to create. */ @@ -169,6 +174,7 @@ static const struct ClockCommand clockCommands[] = { { "GetJulianDayFromEraYearWeekDay", ClockGetjuliandayfromerayearweekdayObjCmd }, { "ParseFormatArgs", ClockParseformatargsObjCmd }, + { "_test", TclStrIdxTreeTestObjCmd }, { NULL, NULL } }; @@ -584,7 +590,7 @@ ClockMCGet( } MODULE_SCOPE Tcl_Obj * -ClockMCGetListIdxDict( +ClockMCGetIdx( ClockFmtScnCmdArgs *opts, int mcKey) { @@ -598,53 +604,45 @@ ClockMCGetListIdxDict( return NULL; } - /* try to get indices dictionray, - * if not available - create from list */ + /* try to get indices object */ + if (dataPtr->mcLitIdxs == NULL) { + return NULL; + } if (Tcl_DictObjGet(NULL, opts->mcDictObj, dataPtr->mcLitIdxs[mcKey], &valObj) != TCL_OK ) { - Tcl_Obj **lstv, *intObj; - int i, lstc; + return NULL; + } - if (dataPtr->mcLitIdxs == NULL) { - dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); - for (i = 0; i < MCLIT__END; ++i) { - Tcl_InitObjRef(dataPtr->mcLitIdxs[i], - Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); - } - } + return valObj; +} - if (Tcl_DictObjGet(opts->interp, opts->mcDictObj, - dataPtr->mcLiterals[mcKey], &valObj) != TCL_OK) { - return NULL; - }; - if (TclListObjGetElements(opts->interp, valObj, - &lstc, &lstv) != TCL_OK) { - return NULL; - }; +MODULE_SCOPE int +ClockMCSetIdx( + ClockFmtScnCmdArgs *opts, + int mcKey, Tcl_Obj *valObj) +{ + ClockClientData *dataPtr = opts->clientData; - valObj = Tcl_NewDictObj(); - for (i = 0; i < lstc; i++) { - intObj = Tcl_NewIntObj(i); - if (Tcl_DictObjPut(opts->interp, valObj, - lstv[i], intObj) != TCL_OK - ) { - Tcl_DecrRefCount(valObj); - Tcl_DecrRefCount(intObj); - return NULL; - } - }; + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return TCL_ERROR; + } - if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, - dataPtr->mcLitIdxs[mcKey], valObj) != TCL_OK - ) { - Tcl_DecrRefCount(valObj); - return NULL; + /* if literal storage for indices not yet created */ + if (dataPtr->mcLitIdxs == NULL) { + int i; + dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); + for (i = 0; i < MCLIT__END; ++i) { + Tcl_InitObjRef(dataPtr->mcLitIdxs[i], + Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); } - }; + } - return valObj; + return Tcl_DictObjPut(opts->interp, opts->mcDictObj, + dataPtr->mcLitIdxs[mcKey], valObj); } /* diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 5469ee1..e66c525 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -11,6 +11,7 @@ */ #include "tclInt.h" +#include "tclStrIdxTree.h" #include "tclDate.h" /* @@ -33,6 +34,9 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); static void ClockFrmScnFinalize(ClientData clientData); +/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); + /* * Clock scan and format facilities. */ @@ -583,6 +587,139 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, minLen, maxLen); } +static TclStrIdxTree * +ClockMCGetListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +static TclStrIdxTree * +ClockMCGetMultiListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey, + int *mcKeys) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + while (*mcKeys) { + + valObj = ClockMCGet(opts, *mcKeys); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + mcKeys++; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +inline int +ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, TclStrIdxTree *idxTree, int *val, + int minLen, int maxLen) +{ + const char *f; + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, + yyInput, yyInput + maxLen); + + if (f <= yyInput || (f - yyInput) < minLen) { + /* not found */ + return TCL_RETURN; + } + if (foundItem->value == -1) { + /* ambigous */ + return TCL_RETURN; + } + + *val = foundItem->value; + + /* shift input pointer */ + yyInput = f; + + return TCL_OK; +} + static int StaticListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, const char **lst, int *val) @@ -612,21 +749,19 @@ FindWordEnd( register const char * p, const char * end) { register const char *x = tok->tokWord.start; - if (x == tok->tokWord.end) { /* single char word */ - if (*p != *x) { - /* no match -> error */ - return NULL; + const char *pfnd; + if (x == tok->tokWord.end - 1) { /* fast phase-out for single char word */ + if (*p == *x) { + return ++p; } - return ++p; } /* multi-char word */ - do - if (*p++ != *x++) { - /* no match -> error */ - return NULL; - } - while (x <= tok->tokWord.end && p < end); - return p; + x = TclUtfFindEqualNC(x, tok->tokWord.end, p, end, &pfnd); + if (x < tok->tokWord.end) { + /* no match -> error */ + return NULL; + } + return pfnd; } static int @@ -822,11 +957,18 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, { int ret, val; int minLen, maxLen; + TclStrIdxTree *idxTree; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); - ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, - minLen, maxLen); + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); if (ret != TCL_OK) { return ret; } @@ -1120,7 +1262,8 @@ ClockGetOrParseScanFormat( /* begin new word token - don't join with previous word token, * because current mapping should be "...%%..." -> "...%..." */ tok->map = &ScnWordTokenMap; - tok->tokWord.start = tok->tokWord.end = p; + tok->tokWord.start = p; + tok->tokWord.end = p+1; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); continue; break; @@ -1190,7 +1333,7 @@ word_tok: if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { wordTok = tok-1; } - wordTok->tokWord.end = p; + wordTok->tokWord.end = p+1; if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &ScnWordTokenMap; @@ -1214,7 +1357,7 @@ word_tok: if (prevTok->map->type != CTOKT_WORD) { endDist += prevTok->map->minSize; } else { - endDist += prevTok->tokWord.end - prevTok->tokWord.start + 1; + endDist += prevTok->tokWord.end - prevTok->tokWord.start; } prevTok--; } @@ -1325,6 +1468,11 @@ ClockScan( yyMeridian = MER24; + /* lower case given string into new object */ + strObj = Tcl_NewStringObj(TclGetString(strObj), strObj->length); + Tcl_IncrRefCount(strObj); + strObj->length = Tcl_UtfToLower(TclGetString(strObj)); + p = TclGetString(strObj); end = p + strObj->length; /* in strict mode - bypass spaces at begin / end only (not between tokens) */ @@ -1578,6 +1726,8 @@ not_match: done: + Tcl_DecrRefCount(strObj); + return ret; } @@ -1604,266 +1754,6 @@ ClockFormat( return TCL_ERROR; } */ -#if 0 - /* prepare parsing */ - - yyMeridian = MER24; - - p = TclGetString(strObj); - end = p + strObj->length; - /* in strict mode - bypass spaces at begin / end only (not between tokens) */ - if (opts->flags & CLF_STRICT) { - while (p < end && isspace(UCHAR(*p))) { - p++; - } - } - info->dateStart = yyInput = p; - info->dateEnd = end; - - /* parse string */ - for (; tok->map != NULL; tok++) { - map = tok->map; - /* bypass spaces at begin of input before parsing each token */ - if ( !(opts->flags & CLF_STRICT) - && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) - ) { - while (p < end && isspace(UCHAR(*p))) { - p++; - } - } - yyInput = p; - switch (map->type) - { - case CTOKT_DIGIT: - if (1) { - int size = map->maxSize; - int sign = 1; - if (map->flags & CLF_SIGNED) { - if (*p == '+') { yyInput = ++p; } - else - if (*p == '-') { yyInput = ++p; sign = -1; }; - } - /* greedy find digits (look for forward digits consider spaces), - * corresponding pre-calculated lookAhead */ - if (size != map->minSize && tok->lookAhead) { - int spcnt = 0; - const char *pe; - size += tok->lookAhead; - x = p + size; if (x > end) { x = end; }; - pe = x; - while (p < x) { - if (isspace(UCHAR(*p))) { - if (pe > p) { pe = p; }; - if (x < end) x++; - p++; - spcnt++; - continue; - } - if (isdigit(UCHAR(*p))) { - p++; - continue; - } - break; - } - /* consider reserved (lookAhead) for next tokens */ - p -= tok->lookAhead + spcnt; - if (p > pe) { - p = pe; - } - } else { - x = p + size; if (x > end) { x = end; }; - while (isdigit(UCHAR(*p)) && p < x) { p++; }; - } - size = p - yyInput; - if (size < map->minSize) { - /* missing input -> error */ - goto not_match; - } - /* string 2 number, put number into info structure by offset */ - p = yyInput; x = p + size; - if (!(map->flags & CLF_LOCALSEC)) { - if (_str2int((time_t *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; - } - p = x; - } else { - if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; - } - p = x; - } - flags = (flags & ~map->clearFlags) | map->flags; - } - break; - case CTOKT_PARSER: - switch (map->parser(opts, info, tok)) { - case TCL_OK: - break; - case TCL_RETURN: - goto not_match; - break; - default: - goto done; - break; - }; - p = yyInput; - flags = (flags & ~map->clearFlags) | map->flags; - break; - case CTOKT_SPACE: - /* at least one space in strict mode */ - if (opts->flags & CLF_STRICT) { - if (!isspace(UCHAR(*p))) { - /* unmatched -> error */ - goto not_match; - } - p++; - } - while (p < end && isspace(UCHAR(*p))) { - p++; - } - break; - case CTOKT_WORD: - x = FindWordEnd(tok, p, end); - if (!x) { - /* no match -> error */ - goto not_match; - } - p = x; - continue; - break; - } - } - - /* ignore spaces at end */ - while (p < end && isspace(UCHAR(*p))) { - p++; - } - /* check end was reached */ - if (p < end) { - /* something after last token - wrong format */ - goto not_match; - } - - /* - * Invalidate result - */ - - /* seconds token (%s) take precedence over all other tokens */ - if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { - if (flags & CLF_DATE) { - - if (!(flags & CLF_JULIANDAY)) { - info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; - - /* dd precedence below ddd */ - switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { - case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): - /* miss month: ddd over dd (without month) */ - flags &= ~CLF_DAYOFMONTH; - case (CLF_DAYOFYEAR): - /* ddd over naked weekday */ - if (!(flags & CLF_ISO8601YEAR)) { - flags &= ~CLF_ISO8601; - } - break; - case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): - /* both available: mmdd over ddd */ - flags &= ~CLF_DAYOFYEAR; - case (CLF_MONTH|CLF_DAYOFMONTH): - case (CLF_DAYOFMONTH): - /* mmdd / dd over naked weekday */ - if (!(flags & CLF_ISO8601YEAR)) { - flags &= ~CLF_ISO8601; - } - break; - } - - /* YearWeekDay below YearMonthDay */ - if ( (flags & CLF_ISO8601) - && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) - || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) - ) - ) { - /* yy precedence below yyyy */ - if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { - /* normally precedence of ISO is higher, but no century - so put it down */ - flags &= ~CLF_ISO8601; - } - else - /* yymmdd or yyddd over naked weekday */ - if (!(flags & CLF_ISO8601YEAR)) { - flags &= ~CLF_ISO8601; - } - } - - if (!(flags & CLF_ISO8601)) { - if (yyYear < 100) { - if (!(flags & CLF_CENTURY)) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; - } - yyYear += dataPtr->currentYearCentury; - } else { - yyYear += info->dateCentury * 100; - } - } - } else { - if (info->date.iso8601Year < 100) { - if (!(flags & CLF_ISO8601CENTURY)) { - if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { - info->date.iso8601Year -= 100; - } - info->date.iso8601Year += dataPtr->currentYearCentury; - } else { - info->date.iso8601Year += info->dateCentury * 100; - } - } - } - } - } - - /* if no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yydate.localSeconds = 0; - } - - if (flags & CLF_TIME) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yySeconds = ToSeconds(yyHour, yyMinutes, - yySeconds, yyMeridian); - } else - if (!(flags & CLF_LOCALSEC)) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yySeconds = yydate.localSeconds % SECONDS_PER_DAY; - } - } - - /* tell caller which flags were set */ - info->flags |= flags; - - ret = TCL_OK; - goto done; - -overflow: - - Tcl_SetResult(interp, "requested date too large to represent", - TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); - goto done; - -not_match: - - Tcl_SetResult(interp, "input string does not match supplied format", - TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); - -done: - - return ret; -#endif } diff --git a/generic/tclDate.h b/generic/tclDate.h index 112ed31..2728dd3 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -126,24 +126,6 @@ typedef enum ClockMsgCtLiteral { } /* - * Primitives to safe set, reset and free references. - */ - -#define Tcl_UnsetObjRef(obj) \ - if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } -#define Tcl_InitObjRef(obj, val) \ - obj = val; if (obj) { Tcl_IncrRefCount(obj); } -#define Tcl_SetObjRef(obj, val) \ -if (1) { \ - Tcl_Obj *nval = val; \ - if (obj != nval) { \ - Tcl_Obj *prev = obj; \ - Tcl_InitObjRef(obj, nval); \ - if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ - } \ -} - -/* * Structure containing the fields used in [clock format] and [clock scan] */ @@ -450,7 +432,9 @@ MODULE_SCOPE Tcl_Obj * MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * - ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); + ClockMCGetIdx(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, + Tcl_Obj *valObj); /* tclClockFmt.c module declarations */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c new file mode 100644 index 0000000..f078c7a --- /dev/null +++ b/generic/tclStrIdxTree.c @@ -0,0 +1,519 @@ +/* + * tclStrIdxTree.c -- + * + * Contains the routines for managing string index tries in Tcl. + * + * This code is back-ported from the tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2016 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * ----------------------------------------------------------------------- + * + * String index tries are prepaired structures used for fast greedy search of the string + * (index) by unique string prefix as key. + * + * Index tree build for two lists together can be explained in the following datagram + * + * Lists: + * + * {Januar Februar Maerz April Mai Juni Juli August September Oktober November Dezember} + * {Jnr Fbr Mrz Apr Mai Jni Jli Agt Spt Okt Nvb Dzb} + * + * Index-Tree: + * + * j -1 * ... + * anuar 0 * + * u -1 * a -1 + * ni 5 * pril 3 + * li 6 * ugust 7 + * n -1 * gt 7 + * r 0 * s 8 + * i 5 * eptember 8 + * li 6 * pt 8 + * f 1 * oktober 9 + * ebruar 1 * n 10 + * br 1 * ovember 10 + * m -1 * vb 10 + * a -1 * d 11 + * erz 2 * ezember 11 + * i 4 * zb 11 + * rz 2 * + * ... + * + * Thereby value -1 shows pure group items (corresponding ambigous matches). + * + * StrIdxTree's are very fast, so: + * build of above-mentioned tree takes about 10 microseconds. + * search of string index in this tree takes fewer as 0.1 microseconds. + * + */ + +#include "tclInt.h" +#include "tclStrIdxTree.h" + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeSearch -- + * + * Find largest part of string "start" in indexed tree (case sensitive). + * + * Also used for building of string index tree. + * + * Results: + * Return position of UTF character in start after last equal character + * and found item (with parent). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE const char* +TclStrIdxTreeSearch( + TclStrIdxTree **foundParent, /* Return value of found sub tree (used for tree build) */ + TclStrIdx **foundItem, /* Return value of found item */ + TclStrIdxTree *tree, /* Index tree will be browsed */ + const char *start, /* UTF string to find in tree */ + const char *end) /* End of string */ +{ + TclStrIdxTree *parent = tree, *prevParent = tree; + TclStrIdx *item = tree->firstPtr, *prevItem = NULL; + const char *s = start, *e, *cin, *preve; + int offs = 0; + + if (item == NULL) { + goto done; + } + + /* search in tree */ + do { + cin = TclGetString(item->key) + offs; + e = TclUtfFindEqual(s, end, cin, cin + item->length); + /* if something was found */ + if (e > s) { + /* if whole string was found */ + if (e >= end) { + start = e; + goto done; + }; + /* set new offset and shift start string */ + offs += (e - s); + s = e; + /* if match item, go deeper as long as possible */ + if (offs >= item->length && item->childTree.firstPtr) { + /* save previuosly found item (if not ambigous) for + * possible fallback (few greedy match) */ + if (item->value != -1) { + preve = e; + prevItem = item; + prevParent = parent; + } + parent = &item->childTree; + item = item->childTree.firstPtr; + continue; + } + /* no children - return this item and current chars found */ + start = e; + goto done; + } + + item = item->nextPtr; + + } while (item != NULL); + + /* fallback (few greedy match) not ambigous (has a value) */ + if (prevItem != NULL) { + item = prevItem; + parent = prevParent; + start = preve; + } + +done: + + if (foundParent) + *foundParent = parent; + if (foundItem) + *foundItem = item; + return start; +} + +MODULE_SCOPE void +TclStrIdxTreeFree( + TclStrIdx *tree) +{ + while (tree != NULL) { + TclStrIdx *t; + Tcl_DecrRefCount(tree->key); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreeFree(tree->childTree.firstPtr); + } + t = tree, tree = tree->nextPtr; + ckfree(t); + } +} + +/* + * Several bidirectional list primitives + */ +inline void +TclStrIdxTreeInsertBranch( + TclStrIdxTree *parent, + register TclStrIdx *item, + register TclStrIdx *child) +{ + if (parent->firstPtr == child) + parent->firstPtr = item; + if (parent->lastPtr == child) + parent->lastPtr = item; + if (item->nextPtr = child->nextPtr) { + item->nextPtr->prevPtr = item; + child->nextPtr = NULL; + } + if (item->prevPtr = child->prevPtr) { + item->prevPtr->nextPtr = item; + child->prevPtr = NULL; + } + item->childTree.firstPtr = child; + item->childTree.lastPtr = child; +} + +inline void +TclStrIdxTreeAppend( + register TclStrIdxTree *parent, + register TclStrIdx *item) +{ + if (parent->lastPtr != NULL) { + parent->lastPtr->nextPtr = item; + } + item->prevPtr = parent->lastPtr; + item->nextPtr = NULL; + parent->lastPtr = item; + if (parent->firstPtr == NULL) { + parent->firstPtr = item; + } +} + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeBuildFromList -- + * + * Build or extend string indexed tree from tcl list. + * + * Important: by multiple lists, optimal tree can be created only if list with + * larger strings used firstly. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE int +TclStrIdxTreeBuildFromList( + TclStrIdxTree *idxTree, + int lstc, + Tcl_Obj **lstv) +{ + Tcl_Obj **lwrv; + int i, ret = TCL_ERROR; + const char *s, *e, *f; + TclStrIdx *item; + + /* create lowercase reflection of the list keys */ + + lwrv = ckalloc(sizeof(Tcl_Obj*) * lstc); + if (lwrv == NULL) { + return TCL_ERROR; + } + for (i = 0; i < lstc; i++) { + lwrv[i] = Tcl_DuplicateObj(lstv[i]); + if (lwrv[i] == NULL) { + return TCL_ERROR; + } + Tcl_IncrRefCount(lwrv[i]); + lwrv[i]->length = Tcl_UtfToLower(TclGetString(lwrv[i])); + } + + /* build index tree of the list keys */ + for (i = 0; i < lstc; i++) { + TclStrIdxTree *foundParent = idxTree; + e = s = TclGetString(lwrv[i]); + e += lwrv[i]->length; + + /* ignore empty values (impossible to index it) */ + if (lwrv[i]->length == 0) continue; + + item = NULL; + if (idxTree->firstPtr != NULL) { + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(&foundParent, &foundItem, + idxTree, s, e); + /* if common prefix was found */ + if (f > s) { + /* ignore element if fulfilled or ambigous */ + if (f == e) { + continue; + } + /* if shortest key was found with the same value, + * just replace its current key with longest key */ + if ( foundItem->value == i + && foundItem->length < lwrv[i]->length + && foundItem->childTree.firstPtr == NULL + ) { + Tcl_SetObjRef(foundItem->key, lwrv[i]); + foundItem->length = lwrv[i]->length; + continue; + } + /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) + * but don't split by fulfilled child of found item ( ii->iii->iiii ) */ + if (foundItem->length != (f - s)) { + /* first split found item (insert one between parent and found + new one) */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + Tcl_InitObjRef(item->key, foundItem->key); + item->length = f - s; + /* set value or mark as ambigous if not the same value of both */ + item->value = (foundItem->value == i) ? i : -1; + /* insert group item between foundParent and foundItem */ + TclStrIdxTreeInsertBranch(foundParent, item, foundItem); + foundParent = &item->childTree; + } else { + /* the new item should be added as child of found item */ + foundParent = &foundItem->childTree; + } + } + } + /* append item at end of found parent */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + item->childTree.lastPtr = item->childTree.firstPtr = NULL; + Tcl_InitObjRef(item->key, lwrv[i]); + item->length = lwrv[i]->length; + item->value = i; + TclStrIdxTreeAppend(foundParent, item); + }; + + ret = TCL_OK; + +done: + + if (lwrv != NULL) { + for (i = 0; i < lstc; i++) { + Tcl_DecrRefCount(lwrv[i]); + } + ckfree(lwrv); + } + + if (ret != TCL_OK) { + if (idxTree->firstPtr != NULL) { + TclStrIdxTreeFree(idxTree->firstPtr); + } + } + + return ret; +} + + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr); +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr); + +Tcl_ObjType StrIdxTreeObjType = { + "str-idx-tree", /* name */ + StrIdxTreeObj_FreeIntRepProc, /* freeIntRepProc */ + StrIdxTreeObj_DupIntRepProc, /* dupIntRepProc */ + StrIdxTreeObj_UpdateStringProc, /* updateStringProc */ + NULL /* setFromAnyProc */ +}; + +MODULE_SCOPE Tcl_Obj* +TclStrIdxTreeNewObj() +{ + Tcl_Obj *objPtr = Tcl_NewObj(); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + objPtr->typePtr = &StrIdxTreeObjType; + /* return tree root in internal representation */ + return objPtr; +} + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) +{ + /* follow links (smart pointers) */ + if ( srcPtr->internalRep.twoPtrValue.ptr1 != NULL + && srcPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; + } + /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ + Tcl_InitObjRef(((Tcl_Obj *)copyPtr->internalRep.twoPtrValue.ptr1), + srcPtr); + copyPtr->internalRep.twoPtrValue.ptr2 = NULL; + copyPtr->typePtr = &StrIdxTreeObjType; +} + +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr) +{ + /* follow links (smart pointers) */ + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + /* is a link */ + Tcl_UnsetObjRef(((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1)); + } else { + /* is a tree */ + TclStrIdxTree *tree = (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; + if (tree->firstPtr != NULL) { + TclStrIdxTreeFree(tree->firstPtr); + } + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + } + objPtr->typePtr = NULL; +}; + +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr) +{ + /* currently only dummy empty string possible */ + objPtr->length = 0; + objPtr->bytes = tclEmptyStringRep; +}; + +MODULE_SCOPE TclStrIdxTree * +TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { + /* follow links (smart pointers) */ + if (objPtr->typePtr != &StrIdxTreeObjType) { + return NULL; + } + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + objPtr = (Tcl_Obj*)objPtr->internalRep.twoPtrValue.ptr1; + } + /* return tree root in internal representation */ + return (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; +} + +/* + * Several debug primitives + */ +#if 1 + +void +TclStrIdxTreePrint( + Tcl_Interp *interp, + TclStrIdx *tree, + int offs) +{ + Tcl_Obj *obj[2]; + const char *s; + Tcl_InitObjRef(obj[0], Tcl_NewStringObj("::puts", -1)); + while (tree != NULL) { + s = TclGetString(tree->key) + offs; + Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", + offs, "", tree->length - offs, s, tree->value)); + Tcl_PutsObjCmd(NULL, interp, 2, obj); + Tcl_UnsetObjRef(obj[1]); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreePrint(interp, tree->childTree.firstPtr, tree->length); + } + tree = tree->nextPtr; + } + Tcl_UnsetObjRef(obj[0]); +} + + +MODULE_SCOPE int +TclStrIdxTreeTestObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + const char *cs, *cin, *ret; + + static const char *const options[] = { + "index", "puts-index", "findequal", + NULL + }; + enum optionInd { + O_INDEX, O_PUTS_INDEX, O_FINDEQUAL + }; + int optionIndex; + + if (objc < 2) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(interp, objv[1], options, + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[1]), NULL); + return TCL_ERROR; + } + switch (optionIndex) { + case O_FINDEQUAL: + if (objc < 4) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + cs = TclGetString(objv[2]); + cin = TclGetString(objv[3]); + ret = TclUtfFindEqual( + cs, cs + objv[1]->length, cin, cin + objv[2]->length); + Tcl_SetObjResult(interp, Tcl_NewIntObj(ret - cs)); + break; + case O_INDEX: + case O_PUTS_INDEX: + + if (1) { + Tcl_Obj **lstv; + int i, lstc; + TclStrIdxTree idxTree = {NULL, NULL}; + i = 1; + while (++i < objc) { + if (TclListObjGetElements(interp, objv[i], + &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + }; + TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv); + } + if (optionIndex == O_PUTS_INDEX) { + TclStrIdxTreePrint(interp, idxTree.firstPtr, 0); + } + TclStrIdxTreeFree(idxTree.firstPtr); + } + break; + } + + return TCL_OK; +} + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h new file mode 100644 index 0000000..e80d3db --- /dev/null +++ b/generic/tclStrIdxTree.h @@ -0,0 +1,134 @@ +/* + * tclStrIdxTree.h -- + * + * Declarations of string index tries and other primitives currently + * back-ported from tclSE. + * + * Copyright (c) 2016 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLSTRIDXTREE_H +#define _TCLSTRIDXTREE_H + + +/* + * Main structures declarations of index tree and entry + */ + +typedef struct TclStrIdxTree { + struct TclStrIdx *firstPtr; + struct TclStrIdx *lastPtr; +} TclStrIdxTree; + +typedef struct TclStrIdx { + struct TclStrIdxTree childTree; + struct TclStrIdx *nextPtr; + struct TclStrIdx *prevPtr; + Tcl_Obj *key; + int length; + int value; +} TclStrIdx; + + +/* + *---------------------------------------------------------------------- + * + * TclUtfFindEqual, TclUtfFindEqualNC -- + * + * Find largest part of string cs in string cin (case sensitive and not). + * + * Results: + * Return position of UTF character in cs after last equal character. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +inline const char * +TclUtfFindEqual( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine) /* End of cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) break; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +inline const char * +TclUtfFindEqualNC( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + ch2 = Tcl_UniCharToLower(ch2); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +/* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE const char* + TclStrIdxTreeSearch(TclStrIdxTree **foundParent, + TclStrIdx **foundItem, TclStrIdxTree *tree, + const char *start, const char *end); + +MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, + int lstc, Tcl_Obj **lstv); + +MODULE_SCOPE Tcl_Obj* + TclStrIdxTreeNewObj(); + +MODULE_SCOPE TclStrIdxTree* + TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr); + +#if 1 + +MODULE_SCOPE int TclStrIdxTreeTestObjCmd(ClientData, Tcl_Interp *, + int, Tcl_Obj *const objv[]); +#endif + +#endif /* _TCLSTRIDXTREE_H */ diff --git a/unix/Makefile.in b/unix/Makefile.in index b220139..19ab6ec 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -451,6 +451,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclScan.c \ $(GENERIC_DIR)/tclStubInit.c \ $(GENERIC_DIR)/tclStringObj.c \ + $(GENERIC_DIR)/tclStrIdxTree.c \ $(GENERIC_DIR)/tclStrToD.c \ $(GENERIC_DIR)/tclTest.c \ $(GENERIC_DIR)/tclTestObj.c \ @@ -1305,6 +1306,9 @@ tclScan.o: $(GENERIC_DIR)/tclScan.c tclStringObj.o: $(GENERIC_DIR)/tclStringObj.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStringObj.c +tclStrIdxTree.o: $(GENERIC_DIR)/tclStrIdxTree.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStrIdxTree.c + tclStrToD.o: $(GENERIC_DIR)/tclStrToD.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStrToD.c diff --git a/win/Makefile.in b/win/Makefile.in index 82e5516..478bbb9 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -291,6 +291,7 @@ GENERIC_OBJS = \ tclResult.$(OBJEXT) \ tclScan.$(OBJEXT) \ tclStringObj.$(OBJEXT) \ + tclStrIdxTree.$(OBJEXT) \ tclStrToD.$(OBJEXT) \ tclStubInit.$(OBJEXT) \ tclThread.$(OBJEXT) \ diff --git a/win/makefile.vc b/win/makefile.vc index d6dbf85..48bacbc 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -333,6 +333,7 @@ COREOBJS = \ $(TMP_DIR)\tclResult.obj \ $(TMP_DIR)\tclScan.obj \ $(TMP_DIR)\tclStringObj.obj \ + $(TMP_DIR)\tclStrIdxTree.obj \ $(TMP_DIR)\tclStrToD.obj \ $(TMP_DIR)\tclStubInit.obj \ $(TMP_DIR)\tclThread.obj \ -- cgit v0.12 From 20ec6252d16fc908dbef8703ac59d9247c043445 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:38:22 +0000 Subject: lowercase on demand, string index tree can search any-case now, clock scan considered utf-8 char length in words by format parsing --- generic/tclClockFmt.c | 17 +++++++---------- generic/tclStrIdxTree.c | 20 ++++++++++---------- generic/tclStrIdxTree.h | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index e66c525..92040d8 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1245,7 +1245,7 @@ ClockGetOrParseScanFormat( fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); - for (p = strFmt; p != e; p++) { + for (p = strFmt; p < e;) { switch (*p) { case '%': if (1) { @@ -1265,6 +1265,7 @@ ClockGetOrParseScanFormat( tok->tokWord.start = p; tok->tokWord.end = p+1; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; continue; break; case 'E': @@ -1315,6 +1316,8 @@ ClockGetOrParseScanFormat( } /* next token */ AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; + continue; } break; case ' ': @@ -1325,6 +1328,8 @@ ClockGetOrParseScanFormat( } tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; + continue; break; default: word_tok: @@ -1339,12 +1344,11 @@ word_tok: wordTok->map = &ScnWordTokenMap; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); } - continue; } break; } - continue; + p = TclUtfNext(p); } /* calculate end distance value for each tokens */ @@ -1468,11 +1472,6 @@ ClockScan( yyMeridian = MER24; - /* lower case given string into new object */ - strObj = Tcl_NewStringObj(TclGetString(strObj), strObj->length); - Tcl_IncrRefCount(strObj); - strObj->length = Tcl_UtfToLower(TclGetString(strObj)); - p = TclGetString(strObj); end = p + strObj->length; /* in strict mode - bypass spaces at begin / end only (not between tokens) */ @@ -1726,8 +1725,6 @@ not_match: done: - Tcl_DecrRefCount(strObj); - return ret; } diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index f078c7a..afb53e5 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -84,7 +84,7 @@ TclStrIdxTreeSearch( { TclStrIdxTree *parent = tree, *prevParent = tree; TclStrIdx *item = tree->firstPtr, *prevItem = NULL; - const char *s = start, *e, *cin, *preve; + const char *s = start, *f, *cin, *cinf, *prevf; int offs = 0; if (item == NULL) { @@ -94,23 +94,23 @@ TclStrIdxTreeSearch( /* search in tree */ do { cin = TclGetString(item->key) + offs; - e = TclUtfFindEqual(s, end, cin, cin + item->length); + f = TclUtfFindEqualNCInLwr(s, end, cin, cin + item->length, &cinf); /* if something was found */ - if (e > s) { + if (f > s) { /* if whole string was found */ - if (e >= end) { - start = e; + if (f >= end) { + start = f; goto done; }; /* set new offset and shift start string */ - offs += (e - s); - s = e; + offs += cinf - cin; + s = f; /* if match item, go deeper as long as possible */ if (offs >= item->length && item->childTree.firstPtr) { /* save previuosly found item (if not ambigous) for * possible fallback (few greedy match) */ if (item->value != -1) { - preve = e; + prevf = f; prevItem = item; prevParent = parent; } @@ -119,7 +119,7 @@ TclStrIdxTreeSearch( continue; } /* no children - return this item and current chars found */ - start = e; + start = f; goto done; } @@ -131,7 +131,7 @@ TclStrIdxTreeSearch( if (prevItem != NULL) { item = prevItem; parent = prevParent; - start = preve; + start = prevf; } done: diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index e80d3db..d2d6f0b 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -89,6 +89,41 @@ TclUtfFindEqualNC( return ret; } +inline const char * +TclUtfFindEqualNCInLwr( + register const char *cs, /* UTF string (in anycase) to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string (in lowercase) will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +inline char * +TclUtfNext( + register const char *src) /* The current location in the string. */ +{ + if (((unsigned char) *(src)) < 0xC0) { + return ++src; + } else { + Tcl_UniChar ch; + return src + TclUtfToUniChar(src, &ch); + } +} + + /* * Primitives to safe set, reset and free references. */ -- cgit v0.12 From 95b63f4c39cdae6600e1b364f58d663c870b1012 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:38:56 +0000 Subject: locale months scan switched to from list seek to index tree; bug fixing --- generic/tclClockFmt.c | 23 +++++++++++++---------- generic/tclDate.h | 4 ++-- generic/tclStrIdxTree.h | 2 +- tests/clock.test | 24 ++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 92040d8..478941b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -682,6 +682,7 @@ ClockMCGetMultiListIdxTree( } ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; }; done: @@ -788,22 +789,24 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; */ + static int monthsKeys[] = {MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, 0}; + int ret, val; int minLen, maxLen; + TclStrIdxTree *idxTree; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); - ret = LocaleListSearch(opts, info, MCLIT_MONTHS_FULL, &val, - minLen, maxLen); + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_MONTHS_COMB, monthsKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); if (ret != TCL_OK) { - /* if not found */ - if (ret == TCL_RETURN) { - ret = LocaleListSearch(opts, info, MCLIT_MONTHS_ABBREV, &val, - minLen, maxLen); - } - if (ret != TCL_OK) { - return ret; - } + return ret; } yyMonth = val + 1; diff --git a/generic/tclDate.h b/generic/tclDate.h index 2728dd3..85bcd35 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -104,7 +104,7 @@ typedef enum ClockLiteral { typedef enum ClockMsgCtLiteral { MCLIT__NIL, /* placeholder */ - MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, + MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_AM, MCLIT_PM, MCLIT_BCE, MCLIT_CE, @@ -116,7 +116,7 @@ typedef enum ClockMsgCtLiteral { #define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ pref "", \ - pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ + pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ pref "AM", pref "PM", \ pref "BCE", pref "CE", \ diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index d2d6f0b..934e28f 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -111,7 +111,7 @@ TclUtfFindEqualNCInLwr( return ret; } -inline char * +inline const char * TclUtfNext( register const char *src) /* The current location in the string. */ { diff --git a/tests/clock.test b/tests/clock.test index e96dec6..1d02f39 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18564,6 +18564,30 @@ test clock-6.11 {input of seconds - two values} { clock scan {1 2} -format {%s %s} -gmt true } 2 +test clock-6.12 {input of unambiguous short locale token (%b)} { + list [clock scan "12 Ja 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] \ + [clock scan "12 Au 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] +} {979257600 997574400} +test clock-6.13 {input of lowercase locale token (%b)} { + list [clock scan "12 ja 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] \ + [clock scan "12 au 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] +} {979257600 997574400} +test clock-6.14 {input of uppercase locale token (%b)} { + list [clock scan "12 JA 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] \ + [clock scan "12 AU 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] +} {979257600 997574400} +test clock-6.15 {input of ambiguous short locale token (%b)} { + list [catch { + clock scan "12 J 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1 + } result] $result $errorCode +} {1 {input string does not match supplied format} {CLOCK badInputString}} +test clock-6.16 {input of ambiguous short locale token (%b)} { + list [catch { + clock scan "12 Ju 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1 + } result] $result $errorCode +} {1 {input string does not match supplied format} {CLOCK badInputString}} + + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true } -210866803200 -- cgit v0.12 From 0f7c885e8c08fc7013f73284498823585b59b2b3 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:39:45 +0000 Subject: other locale scan token switched from list seek to index tree + list search case insensitive now --- generic/tclClockFmt.c | 44 +++++++++++++++++++++++++++----------------- generic/tclDate.h | 8 ++++---- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 478941b..999f191 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -530,20 +530,26 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, int minLen, int maxLen) { int i, l, lf = -1; - const char *s; + const char *s, *f, *sf; /* search in list */ for (i = 0; i < lstc; i++) { s = TclGetString(lstv[i]); l = lstv[i]->length; - if ( l >= minLen && l <= maxLen - && strncasecmp(yyInput, s, l) == 0 + + if ( l >= minLen + && (f = TclUtfFindEqualNC(yyInput, yyInput + maxLen, s, s + l, &sf)) > yyInput ) { + l = f - yyInput; + if (l < minLen) { + continue; + } /* found, try to find longest value (greedy search) */ if (l < maxLen && minLen != maxLen) { lf = i; minLen = l + 1; continue; } + /* max possible - end of search */ *val = i; yyInput += l; break; @@ -818,9 +824,12 @@ static int ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { + static int dowKeys[] = {MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_FULL, 0}; + int ret, val; int minLen, maxLen; char curTok = *tok->tokWord.start; + TclStrIdxTree *idxTree; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -836,9 +845,13 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, val = *yyInput - '0'; } } else { - int ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, - minLen, maxLen); - if (ret == TCL_ERROR) { + idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { return ret; } } @@ -847,7 +860,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if (val == 0) { val = 7; } - if (val > 7 && curTok != 'a' && curTok != 'A') { + if (val > 7) { Tcl_SetResult(opts->interp, "day of week is greater than 7", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); @@ -863,17 +876,14 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, } /* %a %A */ - ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_FULL, &val, - minLen, maxLen); + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_DAYS_OF_WEEK_COMB, dowKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); if (ret != TCL_OK) { - /* if not found */ - if (ret == TCL_RETURN) { - ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_ABBREV, &val, - minLen, maxLen); - } - if (ret != TCL_OK) { - return ret; - } + return ret; } if (val == 0) { diff --git a/generic/tclDate.h b/generic/tclDate.h index 85bcd35..fe38436 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -105,8 +105,8 @@ typedef enum ClockLiteral { typedef enum ClockMsgCtLiteral { MCLIT__NIL, /* placeholder */ MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, - MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, - MCLIT_AM, MCLIT_PM, + MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, + MCLIT_AM, MCLIT_PM, MCLIT_BCE, MCLIT_CE, MCLIT_BCE2, MCLIT_CE2, MCLIT_BCE3, MCLIT_CE3, @@ -117,8 +117,8 @@ typedef enum ClockMsgCtLiteral { #define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ pref "", \ pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ - pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ - pref "AM", pref "PM", \ + pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", pref "DAYS_OF_WEEK_COMB", \ + pref "AM", pref "PM", \ pref "BCE", pref "CE", \ pref "b.c.e.", pref "c.e.", \ pref "b.c.", pref "a.d.", \ -- cgit v0.12 From 9d7b1b2b0319162c58225a5f443a040be63628f8 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:40:16 +0000 Subject: min length of %Y token (year with century) is 4, optional tokens possibility (zone), test cases extended --- generic/tclClockFmt.c | 40 ++++++++++++++++++++++++++++++---------- generic/tclDate.h | 1 + tests-perf/clock.perf.tcl | 7 +++++++ tests/clock.test | 12 ++++++++++++ 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 999f191..9211481 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1089,7 +1089,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 4, 4, TclOffset(DateInfo, date.year), NULL}, /* %H %k %I %l */ {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), @@ -1116,7 +1116,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601, 0, 2, 2, TclOffset(DateInfo, date.iso8601Year), NULL}, /* %G */ - {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 1, 4, TclOffset(DateInfo, date.iso8601Year), + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 4, 4, TclOffset(DateInfo, date.iso8601Year), NULL}, /* %V */ {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), @@ -1125,7 +1125,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, ClockScnToken_DayOfWeek_Proc, NULL}, /* %z %Z */ - {CTOKT_PARSER, 0, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, 0, ClockScnToken_TimeZone_Proc, NULL}, /* %s */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), @@ -1508,6 +1508,10 @@ ClockScan( } } yyInput = p; + /* end of input string */ + if (p >= end) { + break; + } switch (map->type) { case CTOKT_DIGIT: @@ -1553,6 +1557,10 @@ ClockScan( size = p - yyInput; if (size < map->minSize) { /* missing input -> error */ + if ((map->flags & CLF_OPTIONAL)) { + yyInput = p; + continue; + } goto not_match; } /* string 2 number, put number into info structure by offset */ @@ -1578,6 +1586,10 @@ ClockScan( case TCL_OK: break; case TCL_RETURN: + if ((map->flags & CLF_OPTIONAL)) { + yyInput = p; + continue; + } goto not_match; break; default: @@ -1611,15 +1623,23 @@ ClockScan( break; } } - - /* ignore spaces at end */ - while (p < end && isspace(UCHAR(*p))) { - p++; - } /* check end was reached */ if (p < end) { - /* something after last token - wrong format */ - goto not_match; + /* ignore spaces at end */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + if (p < end) { + /* something after last token - wrong format */ + goto not_match; + } + } + /* end of string, check only optional tokens at end, otherwise - not match */ + if (tok->map != NULL) { + if ( !(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE) + || (tok->map->flags & CLF_OPTIONAL)) { + goto not_match; + } } /* diff --git a/generic/tclDate.h b/generic/tclDate.h index fe38436..64135d3 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -30,6 +30,7 @@ #define ONE_YEAR 365 /* days */ +#define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) #define CLF_LOCALSEC (1 << 5) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 3c69414..41cc9e1 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -150,6 +150,13 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : ISO date-time (CEST) + {clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 CEST" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : ISO date-time (UTC) + {clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 UTC" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : dynamic format (cacheable) {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} diff --git a/tests/clock.test b/tests/clock.test index 1d02f39..a4641c6 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18587,6 +18587,18 @@ test clock-6.16 {input of ambiguous short locale token (%b)} { } result] $result $errorCode } {1 {input string does not match supplied format} {CLOCK badInputString}} +test clock-6.17 {spaces are always optional in non-strict mode (default)} { + list [clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00 +02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] \ + [clock scan "2009-06-30T18:30:00 Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] +} {1246379400 1246379400 1246386600 1246386600} + +test clock-6.18 {zone token (%z) is optional} { + list [clock scan "2009-06-30T18:30:00 -01:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ +} {1246390200 1246386600 1246386600} test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true -- cgit v0.12 From 63c8495242fba7a73308cadbe99d5b9baa687aa6 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:41:18 +0000 Subject: [temp-commit]: format almost ready (missing some tokens) --- generic/tclClock.c | 28 +- generic/tclClockFmt.c | 711 +++++++++++++++++++++++++++++++++++++++++--------- generic/tclDate.h | 75 ++++-- library/clock.tcl | 2 +- library/init.tcl | 2 +- tests/clock.test | 5 + 6 files changed, 651 insertions(+), 172 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index e52b2e7..935a347 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -129,6 +129,9 @@ static int ClockParseformatargsObjCmd( static int ClockSecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockFormatObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); static int ClockScanObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -164,6 +167,7 @@ static const struct ClockCommand clockCommands[] = { { "microseconds", ClockMicrosecondsObjCmd }, { "milliseconds", ClockMillisecondsObjCmd }, { "seconds", ClockSecondsObjCmd }, + { "format", ClockFormatObjCmd }, { "scan", ClockScanObjCmd }, { "configure", ClockConfigureObjCmd }, { "Oldscan", TclClockOldscanObjCmd }, @@ -2944,8 +2948,7 @@ ClockFormatObjCmd( int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ Tcl_WideInt clockVal; /* Time, expressed in seconds from the Epoch */ - DateInfo yy; /* Common structure used for parsing */ - DateInfo *info = &yy; + DateFormat dateFmt; /* Common structure used for formatting */ if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " @@ -2972,9 +2975,7 @@ ClockFormatObjCmd( return TCL_ERROR; } - - ClockInitDateInfo(info); - yydate.tzName = NULL; + memset(&dateFmt, 0, sizeof(dateFmt)); /* * Extract year, month and day from the base time for the parser to use as @@ -2984,16 +2985,16 @@ ClockFormatObjCmd( /* check base fields already cached (by TZ, last-second cache) */ if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj && dataPtr->lastBase.Date.seconds == clockVal) { - memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); + memcpy(&dateFmt.date, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); } else { /* extact fields from base */ - yydate.seconds = clockVal; - if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, + dateFmt.date.seconds = clockVal; + if (ClockGetDateFields(clientData, interp, &dateFmt.date, opts.timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } /* cache last base */ - memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); + memcpy(&dataPtr->lastBase.Date, &dateFmt.date, ClockCacheableDateFieldsSize); Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); } @@ -3004,11 +3005,11 @@ ClockFormatObjCmd( /* Use compiled version of Format - */ - ret = ClockFormat(clientData, interp, info, &opts); + ret = ClockFormat(&dateFmt, &opts); done: - Tcl_UnsetObjRef(yydate.tzName); + Tcl_UnsetObjRef(dateFmt.date.tzName); if (ret != TCL_OK) { return ret; @@ -3072,8 +3073,7 @@ ClockScanObjCmd( } ClockInitDateInfo(info); - yydate.tzName = NULL; - + /* * Extract year, month and day from the base time for the parser to use as * defaults @@ -3114,7 +3114,7 @@ ClockScanObjCmd( else { /* Use compiled version of Scan - */ - ret = ClockScan(clientData, interp, info, objv[1], &opts); + ret = ClockScan(info, objv[1], &opts); } if (ret != TCL_OK) { diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 9211481..b46b7bf 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -490,6 +490,74 @@ Tcl_GetClockFrmScnFromObj( return fss; } +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj = NULL, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + /* special case - format object is not localizable */ + if (keyObj == opts->formatObj) { + return opts->formatObj; + } + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within locale mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + + /* call LocalizeFormat locale format fmtkey */ + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + goto clean; + } + + valObj = Tcl_GetObjResult(opts->interp); + + /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + valObj = NULL; + goto clean; + } + + /* check special case - format object is not localizable */ + if (valObj == opts->formatObj) { + /* mark it as unlocalizable, by setting self as key (without refcount incr) */ + if (opts->formatObj->typePtr == &ClockFmtObjType) { + Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); + ObjLocFmtKey(opts->formatObj) = opts->formatObj; + } + } +clean: + + Tcl_UnsetObjRef(keyObj); + if (valObj) { + Tcl_ResetResult(opts->interp); + } + } + + return (opts->formatObj = valObj); +} + /* * DetermineGreedySearchLen -- * @@ -1131,7 +1199,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; -static const char *ScnSTokenWrapMapIndex[2] = { +static const char *ScnSTokenMapAliasIndex[2] = { "eNBhkIlPAuwZ", "dmbbHHHpaaaz" }; @@ -1146,7 +1214,7 @@ static ClockScanTokenMap ScnETokenMap[] = { {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; -static const char *ScnETokenWrapMapIndex[2] = { +static const char *ScnETokenMapAliasIndex[2] = { "", "" }; @@ -1176,7 +1244,7 @@ static ClockScanTokenMap ScnOTokenMap[] = { {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; -static const char *ScnOTokenWrapMapIndex[2] = { +static const char *ScnOTokenMapAliasIndex[2] = { "ekIlw", "dHHHu" }; @@ -1194,6 +1262,29 @@ static ClockScanTokenMap ScnWordTokenMap = { }; +inline unsigned int +EstimateTokenCount( + register const char *fmt, + register const char *end) +{ + register const char *p = fmt; + unsigned int tokcnt; + /* estimate token count by % char and format length */ + tokcnt = 0; + while (p <= end) { + if (*p++ == '%') tokcnt++; + } + p = fmt + tokcnt * 2; + if (p < end) { + if ((unsigned int)(end - p) < tokcnt) { + tokcnt += (end - p); + } else { + tokcnt += tokcnt; + } + } + return ++tokcnt; +} + #define AllocTokenInChain(tok, chain, tokCnt) \ if (++(tok) >= (chain) + (tokCnt)) { \ (char *)(chain) = ckrealloc((char *)(chain), \ @@ -1215,56 +1306,32 @@ ClockGetOrParseScanFormat( ClockFmtScnStorage *fss; ClockScanToken *tok; - if (formatObj->typePtr != &ClockFmtObjType) { - if (ClockFmtObj_SetFromAny(interp, formatObj) != TCL_OK) { - return NULL; - } - } - - fss = ObjClockFmtScn(formatObj); - + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); if (fss == NULL) { - fss = FindOrCreateFmtScnStorage(interp, formatObj); - if (fss == NULL) { - return NULL; - } + return NULL; } /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { - const char *strFmt; register const char *p, *e, *cp; - e = strFmt = HashEntry4FmtScn(fss)->key.string; - e += strlen(strFmt); + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); /* estimate token count by % char and format length */ - fss->scnTokC = 0; - p = strFmt; - while (p != e) { - if (*p++ == '%') fss->scnTokC++; - } - p = strFmt + fss->scnTokC * 2; - if (p < e) { - if ((unsigned int)(e - p) < fss->scnTokC) { - fss->scnTokC += (e - p); - } else { - fss->scnTokC += fss->scnTokC; - } - } - fss->scnTokC++; + fss->scnTokC = EstimateTokenCount(p, e); Tcl_MutexLock(&ClockFmtMutex); fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); - for (p = strFmt; p < e;) { + while (p < e) { switch (*p) { case '%': if (1) { ClockScanTokenMap * scnMap = ScnSTokenMap; const char *mapIndex = ScnSTokenMapIndex, - **wrapIndex = ScnSTokenWrapMapIndex; + **aliasIndex = ScnSTokenMapAliasIndex; if (p+1 >= e) { goto word_tok; } @@ -1284,13 +1351,13 @@ ClockGetOrParseScanFormat( case 'E': scnMap = ScnETokenMap, mapIndex = ScnETokenMapIndex, - wrapIndex = ScnETokenWrapMapIndex; + aliasIndex = ScnETokenMapAliasIndex; p++; break; case 'O': scnMap = ScnOTokenMap, mapIndex = ScnOTokenMapIndex, - wrapIndex = ScnOTokenWrapMapIndex; + aliasIndex = ScnOTokenMapAliasIndex; p++; break; } @@ -1298,17 +1365,17 @@ ClockGetOrParseScanFormat( cp = strchr(mapIndex, *p); if (!cp || *cp == '\0') { /* search wrapper index (multiple chars for same token) */ - cp = strchr(wrapIndex[0], *p); + cp = strchr(aliasIndex[0], *p); if (!cp || *cp == '\0') { - p--; + p--; if (scnMap != ScnSTokenMap) p--; goto word_tok; } - cp = strchr(mapIndex, wrapIndex[1][cp - wrapIndex[0]]); + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); if (!cp || *cp == '\0') { /* unexpected, but ... */ #ifdef DEBUG Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); #endif - p--; + p--; if (scnMap != ScnSTokenMap) p--; goto word_tok; } } @@ -1351,17 +1418,16 @@ word_tok: if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { wordTok = tok-1; } - wordTok->tokWord.end = p+1; if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &ScnWordTokenMap; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); } + p = TclUtfNext(p); + wordTok->tokWord.end = p; } break; } - - p = TclUtfNext(p); } /* calculate end distance value for each tokens */ @@ -1386,86 +1452,16 @@ done: return fss->scnTok; } -MODULE_SCOPE Tcl_Obj * -ClockLocalizeFormat( - ClockFmtScnCmdArgs *opts) -{ - ClockClientData *dataPtr = opts->clientData; - Tcl_Obj *valObj = NULL, *keyObj; - - keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); - - /* special case - format object is not localizable */ - if (keyObj == opts->formatObj) { - return opts->formatObj; - } - - if (opts->mcDictObj == NULL) { - ClockMCDict(opts); - if (opts->mcDictObj == NULL) - return NULL; - } - - /* try to find in cache within locale mc-catalog */ - if (Tcl_DictObjGet(NULL, opts->mcDictObj, - keyObj, &valObj) != TCL_OK) { - return NULL; - } - - /* call LocalizeFormat locale format fmtkey */ - if (valObj == NULL) { - Tcl_Obj *callargs[4]; - callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; - callargs[1] = opts->localeObj; - callargs[2] = opts->formatObj; - callargs[3] = keyObj; - Tcl_IncrRefCount(keyObj); - if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK - ) { - goto clean; - } - - valObj = Tcl_GetObjResult(opts->interp); - - /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ - if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, - keyObj, valObj) != TCL_OK - ) { - valObj = NULL; - goto clean; - } - - /* check special case - format object is not localizable */ - if (valObj == opts->formatObj) { - /* mark it as unlocalizable, by setting self as key (without refcount incr) */ - if (opts->formatObj->typePtr == &ClockFmtObjType) { - Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); - ObjLocFmtKey(opts->formatObj) = opts->formatObj; - } - } -clean: - - Tcl_UnsetObjRef(keyObj); - if (valObj) { - Tcl_ResetResult(opts->interp); - } - } - - return (opts->formatObj = valObj); -} - /* *---------------------------------------------------------------------- */ int ClockScan( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ register DateInfo *info, /* Date fields used for parsing & converting */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; + ClockClientData *dataPtr = opts->clientData; ClockScanToken *tok; ClockScanTokenMap *map; register const char *p, *x, *end; @@ -1477,7 +1473,8 @@ ClockScan( return TCL_ERROR; } - if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { + if ((tok = ClockGetOrParseScanFormat(opts->interp, + opts->formatObj)) == NULL) { return TCL_ERROR; } @@ -1635,11 +1632,14 @@ ClockScan( } } /* end of string, check only optional tokens at end, otherwise - not match */ - if (tok->map != NULL) { - if ( !(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE) - || (tok->map->flags & CLF_OPTIONAL)) { + while (tok->map != NULL) { + if (!(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE)) { + tok++; + } + if (tok->map != NULL && !(tok->map->flags & CLF_OPTIONAL)) { goto not_match; } + tok++; } /* @@ -1745,33 +1745,377 @@ ClockScan( overflow: - Tcl_SetResult(interp, "requested date too large to represent", + Tcl_SetResult(opts->interp, "requested date too large to represent", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); + Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); goto done; not_match: - Tcl_SetResult(interp, "input string does not match supplied format", + Tcl_SetResult(opts->interp, "input string does not match supplied format", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); done: return ret; } + + +inline int +FrmResultAllocate( + register DateFormat *dateFmt, + int len) +{ + int needed = dateFmt->output + len - dateFmt->resEnd; + if (needed >= 0) { /* >= 0 - regards NTS zero */ + int newsize = dateFmt->resEnd - dateFmt->resMem + + needed + MIN_FMT_RESULT_BLOCK_ALLOC; + char *newRes = ckrealloc(dateFmt->resMem, newsize); + if (newRes == NULL) { + return TCL_ERROR; + } + dateFmt->output = newRes + (dateFmt->output - dateFmt->resMem); + dateFmt->resMem = newRes; + dateFmt->resEnd = newRes + newsize; + } + return TCL_OK; +} + +static int +ClockFmtToken_HourAMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; + return TCL_OK; +} + +static int +ClockFmtToken_AMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if ((*val % 84600) < (84600 / 2)) { + mcObj = ClockMCGet(opts, MCLIT_AM); + } else { + mcObj = ClockMCGet(opts, MCLIT_PM); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + if (*tok->tokWord.start == 'p') { + len = Tcl_UtfToUpper(dateFmt->output); + } + dateFmt->output += len; + *dateFmt->output = '\0'; + + return TCL_OK; +} + +static const char *FmtSTokenMapIndex = + "demNbByYCHMSIklpaAugGjJsnt"; +static ClockFormatTokenMap FmtSTokenMap[] = { + /* %d */ + {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %e */ + {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %m */ + {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %N */ + {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %b %h */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_ABBREV}, + /* %B */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_FULL}, + /* %y */ + {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, + /* %Y */ + {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, + /* %C */ + {CFMTT_INT, "%02d", 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, + /* %H */ + {CFMTT_INT, "%02d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %M */ + {CFMTT_INT, "%02d", 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %S */ + {CFMTT_INT, "%02d", 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %I */ + {CFMTT_INT, "%02d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %k */ + {CFMTT_INT, "%2d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %l */ + {CFMTT_INT, "%2d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %p %P */ + {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.localSeconds), + ClockFmtToken_AMPM_Proc, NULL}, + /* %a */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_ABBREV}, + /* %A */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_FULL}, + /* %u */ + {CFMTT_INT, "%1d", 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %g */ + {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %G */ + {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %j */ + {CFMTT_INT, "%03d", 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, + /* %J */ + {CFMTT_INT, "%07d", 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, + /* %s */ + {CFMTT_WIDE, "%ld", 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + /* %n */ + {CFMTT_CHAR, "\n", 0, 0, 0, 0, NULL}, + /* %t */ + {CFMTT_CHAR, "\t", 0, 0, 0, 0, NULL}, + +#if 0 + /* %H %k %I %l */ + {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.hour), + NULL}, + /* %M */ + {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.minutes), + NULL}, + /* %S */ + {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.secondOfDay), + NULL}, + /* %p %P */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, + ClockFmtToken_amPmInd_Proc, NULL}, + /* %J */ + {CFMTT_INT, CLF_JULIANDAY, 1, 0xffff, TclOffset(DateFormat, date.julianDay), + NULL}, + /* %j */ + {CFMTT_INT, CLF_DAYOFYEAR, 1, 3, TclOffset(DateFormat, date.dayOfYear), + NULL}, + /* %g */ + {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601, 2, 2, TclOffset(DateFormat, date.iso8601Year), + NULL}, + /* %G */ + {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 4, 4, TclOffset(DateFormat, date.iso8601Year), + NULL}, + /* %V */ + {CFMTT_INT, CLF_ISO8601, 1, 2, TclOffset(DateFormat, date.iso8601Week), + NULL}, + /* %a %A %u %w */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, + ClockFmtToken_DayOfWeek_Proc, NULL}, + /* %z %Z */ + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, + ClockFmtToken_TimeZone_Proc, NULL}, + /* %s */ + {CFMTT_INT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateFormat, date.localSeconds), + NULL}, +#endif +}; +static const char *FmtSTokenMapAliasIndex[2] = { + "hP", + "bp" +}; + +static const char *FmtETokenMapIndex = +"";// "Ey"; +static ClockFormatTokenMap FmtETokenMap[] = { + {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, +#if 0 + /* %EE */ + {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ey */ + {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, +#endif +}; +static const char *FmtETokenMapAliasIndex[2] = { + "", + "" +}; + +static const char *FmtOTokenMapIndex = +"";// "dmyHMSu"; +static ClockFormatTokenMap FmtOTokenMap[] = { + {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, +#if 0 + /* %Od %Oe */ + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateFormat, date.month), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok %OI %Ol */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.hour), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.minutes), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou Ow */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockFmtToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, +#endif +}; +static const char *FmtOTokenMapAliasIndex[2] = { +"", "" +#if 0 + "ekIlw", + "dHHHu" +#endif +}; + +static ClockFormatTokenMap FmtWordTokenMap = { + CTOKT_WORD, NULL, 0, 0, 0, 0, NULL +}; + +/* + *---------------------------------------------------------------------- + */ +ClockFormatToken * +ClockGetOrParseFmtFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockFormatToken *tok; + + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); + if (fss == NULL) { + return NULL; + } + + /* if first time scanning - tokenize format */ + if (fss->fmtTok == NULL) { + register const char *p, *e, *cp; + + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); + + /* estimate token count by % char and format length */ + fss->fmtTokC = EstimateTokenCount(p, e); + + Tcl_MutexLock(&ClockFmtMutex); + + fss->fmtTok = tok = ckalloc(sizeof(*tok) * fss->fmtTokC); + memset(tok, 0, sizeof(*(tok))); + while (p < e) { + switch (*p) { + case '%': + if (1) { + ClockFormatTokenMap * fmtMap = FmtSTokenMap; + const char *mapIndex = FmtSTokenMapIndex, + **aliasIndex = FmtSTokenMapAliasIndex; + if (p+1 >= e) { + goto word_tok; + } + p++; + /* try to find modifier: */ + switch (*p) { + case '%': + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &FmtWordTokenMap; + tok->tokWord.start = p; + tok->tokWord.end = p+1; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + p++; + continue; + break; + case 'E': + fmtMap = FmtETokenMap, + mapIndex = FmtETokenMapIndex, + aliasIndex = FmtETokenMapAliasIndex; + p++; + break; + case 'O': + fmtMap = FmtOTokenMap, + mapIndex = FmtOTokenMapIndex, + aliasIndex = FmtOTokenMapAliasIndex; + p++; + break; + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(aliasIndex[0], *p); + if (!cp || *cp == '\0') { + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + } + tok->map = &fmtMap[cp - mapIndex]; + tok->tokWord.start = p; + /* next token */ + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + p++; + continue; + } + break; + default: +word_tok: + if (1) { + ClockFormatToken *wordTok = tok; + if (tok > fss->fmtTok && (tok-1)->map == &FmtWordTokenMap) { + wordTok = tok-1; + } + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &FmtWordTokenMap; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + } + p = TclUtfNext(p); + wordTok->tokWord.end = p; + } + break; + } + } + +done: + Tcl_MutexUnlock(&ClockFmtMutex); + } + + return fss->fmtTok; +} /* *---------------------------------------------------------------------- */ int ClockFormat( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ - register DateInfo *info, /* Date fields used for parsing & converting */ - ClockFmtScnCmdArgs *opts) /* Command options */ + register DateFormat *dateFmt, /* Date fields used for parsing & converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; + ClockClientData *dataPtr = opts->clientData; ClockFormatToken *tok; ClockFormatTokenMap *map; @@ -1780,10 +2124,119 @@ ClockFormat( return TCL_ERROR; } -/* if ((tok = ClockGetOrParseFmtFormat(interp, opts->formatObj)) == NULL) { + if ((tok = ClockGetOrParseFmtFormat(opts->interp, + opts->formatObj)) == NULL) { return TCL_ERROR; } -*/ + + dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); /* result container object */ + if (dateFmt->resMem == NULL) { + return TCL_ERROR; + } + dateFmt->output = dateFmt->resMem; + dateFmt->resEnd = dateFmt->resMem + MIN_FMT_RESULT_BLOCK_ALLOC; + *dateFmt->output = '\0'; + + /* do format each token */ + for (; tok->map != NULL; tok++) { + map = tok->map; + switch (map->type) + { + case CFMTT_INT: + if (1) { + int val = (int)*(time_t *)(((char *)dateFmt) + map->offs); + if (map->fmtproc == NULL) { + if (map->flags & CLFMT_DECR) { + val--; + } + if (map->flags & CLFMT_INCR) { + val++; + } + if (map->divider) { + val /= map->divider; + } + if (map->divmod) { + val %= map->divmod; + } + } else { + if (map->fmtproc(opts, dateFmt, tok, &val) != TCL_OK) { + goto done; + } + /* if not calculate only (output inside fmtproc) */ + if (!(map->flags & CLFMT_CALC)) { + continue; + } + } + if (!(map->flags & CLFMT_LOCALE_INDX)) { + if (FrmResultAllocate(dateFmt, 10) != TCL_OK) { goto error; }; + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } else { + const char *s; + Tcl_Obj * mcObj = ClockMCGet(opts, (int)map->data /* mcKey */); + if (mcObj == NULL) { + goto error; + } + if (Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK) { + goto error; + } + s = TclGetString(mcObj); + if (FrmResultAllocate(dateFmt, mcObj->length) != TCL_OK) { goto error; }; + memcpy(dateFmt->output, s, mcObj->length + 1); + dateFmt->output += mcObj->length; + } + } + break; + case CFMTT_WIDE: + if (1) { + Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); + if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { goto error; }; + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } + break; + case CFMTT_CHAR: + if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; + *dateFmt->output++ = *map->tostr; + *dateFmt->output = '\0'; + break; + case CFMTT_PROC: + if (map->fmtproc(opts, dateFmt, tok, NULL) != TCL_OK) { + goto error; + }; + break; + case CTOKT_WORD: + if (1) { + int len = tok->tokWord.end - tok->tokWord.start; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { goto error; }; + memcpy(dateFmt->output, tok->tokWord.start, len); + dateFmt->output += len; + *dateFmt->output = '\0'; + } + break; + } + } + + goto done; + +error: + + ckfree(dateFmt->resMem); + dateFmt->resMem = NULL; + +done: + + if (dateFmt->resMem) { + Tcl_Obj * result = Tcl_NewObj(); + result->length = dateFmt->output - dateFmt->resMem; + result->bytes = NULL; + result->bytes = ckrealloc(dateFmt->resMem, result->length+1); + if (result->bytes == NULL) { + result->bytes = dateFmt->resMem; + } + Tcl_SetObjResult(opts->interp, result); + return TCL_OK; + } + + return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 64135d3..141ad60 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -51,7 +51,6 @@ #define CLF_DATE (CLF_JULIANDAY | CLF_DAYOFMONTH | CLF_DAYOFYEAR | \ CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | CLF_ISO8601) - /* * Enumeration of the string literals used in [clock] */ @@ -352,12 +351,11 @@ typedef int ClockScanTokenProc( typedef enum _CLCKTOK_TYPE { - CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, + CFMTT_INT, CFMTT_WIDE, CFMTT_CHAR, CFMTT_PROC } CLCKTOK_TYPE; -typedef struct ClockFmtScnStorage ClockFmtScnStorage; - -typedef struct ClockFormatTokenMap { +typedef struct ClockScanTokenMap { unsigned short int type; unsigned short int flags; unsigned short int clearFlags; @@ -366,38 +364,62 @@ typedef struct ClockFormatTokenMap { unsigned short int offs; ClockScanTokenProc *parser; void *data; -} ClockFormatTokenMap; -typedef struct ClockFormatToken { - ClockFormatTokenMap *map; +} ClockScanTokenMap; + +typedef struct ClockScanToken { + ClockScanTokenMap *map; + unsigned short int lookAhead; + unsigned short int endDistance; struct { const char *start; const char *end; } tokWord; -} ClockFormatToken; +} ClockScanToken; -typedef struct ClockScanTokenMap { + +#define MIN_FMT_RESULT_BLOCK_ALLOC 200 + +typedef struct DateFormat { + char *resMem; + char *resEnd; + char *output; + + TclDateFields date; +} DateFormat; + +#define CLFMT_INCR (1 << 3) +#define CLFMT_DECR (1 << 4) +#define CLFMT_CALC (1 << 5) +#define CLFMT_LOCALE_INDX (1 << 8) + +typedef struct ClockFormatToken ClockFormatToken; + +typedef int ClockFormatTokenProc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val); + +typedef struct ClockFormatTokenMap { unsigned short int type; + const char *tostr; unsigned short int flags; - unsigned short int clearFlags; - unsigned short int minSize; - unsigned short int maxSize; + unsigned short int divider; + unsigned short int divmod; unsigned short int offs; - ClockScanTokenProc *parser; + ClockFormatTokenProc *fmtproc; void *data; -} ClockScanTokenMap; - -typedef struct ClockScanToken { - ClockScanTokenMap *map; - unsigned short int lookAhead; - unsigned short int endDistance; +} ClockFormatTokenMap; +typedef struct ClockFormatToken { + ClockFormatTokenMap *map; struct { const char *start; const char *end; } tokWord; -} ClockScanToken; +} ClockFormatToken; -#define ClockScnTokenChar(tok) \ - *tok->tokWord.start; + +typedef struct ClockFmtScnStorage ClockFmtScnStorage; typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ @@ -449,12 +471,11 @@ MODULE_SCOPE ClockFmtScnStorage * MODULE_SCOPE Tcl_Obj * ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); -MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, - register DateInfo *info, +MODULE_SCOPE int ClockScan(register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); -MODULE_SCOPE int ClockFormat(ClientData clientData, Tcl_Interp *interp, - register DateInfo *info, ClockFmtScnCmdArgs *opts); +MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, + ClockFmtScnCmdArgs *opts); MODULE_SCOPE void ClockFrmScnClearCaches(void); diff --git a/library/clock.tcl b/library/clock.tcl index c4e698c..06aa10a 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -676,7 +676,7 @@ proc mcget {locale args} { # #---------------------------------------------------------------------- -proc ::tcl::clock::format { args } { +proc ::tcl::clock::__org_format { args } { variable FormatProc variable TZData diff --git a/library/init.tcl b/library/init.tcl index ef0a84a..6f34302 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format LocalizeFormat SetupTimeZone GetSystemTimeZone __org_scan} { + foreach cmd {add LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests/clock.test b/tests/clock.test index a4641c6..b27d2a3 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18600,6 +18600,11 @@ test clock-6.18 {zone token (%z) is optional} { [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ } {1246390200 1246386600 1246386600} +test clock-6.19 {no token parsing} { + list [catch { clock scan "%E%O%" -format "%E%O%" }] \ + [catch { clock scan "...%..." -format "...%%..." }] +} {0 0} + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true } -210866803200 -- cgit v0.12 From d830389b535a333aca4b9f10cf3746317807f2cb Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:42:15 +0000 Subject: [temp-commit]: format almost ready (missing some tokens), sprintf replaced with _itoaw (because "sprintf" too slow) --- generic/tclClock.c | 3 +- generic/tclClockFmt.c | 194 +++++++++++++++++++++++++++++++++++++++----------- generic/tclDate.h | 4 ++ 3 files changed, 157 insertions(+), 44 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 935a347..2e2c44b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -93,7 +93,6 @@ static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); static void GetJulianDayFromEraYearWeekDay(TclDateFields *, int); static void GetJulianDayFromEraYearMonthDay(TclDateFields *, int); -static int IsGregorianLeapYear(TclDateFields *); static int WeekdayOnOrBefore(int, int); static int ClockClicksObjCmd( ClientData clientData, Tcl_Interp *interp, @@ -2471,7 +2470,7 @@ GetJulianDayFromEraYearDay( *---------------------------------------------------------------------- */ -static int +MODULE_SCOPE int IsGregorianLeapYear( TclDateFields *fields) /* Date to test */ { diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index b46b7bf..f1fdf27 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1762,6 +1762,50 @@ done: } +inline char * +_itoaw( + char *buf, + register int val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + unsigned short int sign = 0; + + /* sign = 1 by negative number */ + if (val < 0) + { + sign = 1; + val = -val; + if (!width) width++; + } + /* check resp. recalculate width (regarding sign) */ + width -= sign; + while (width <= 9 && val >= wrange[width]) { + width++; + } + width += sign; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + *p-- = '0' + (val % 10); + val /= 10; + } while (val > 0); + /* sign by 0 padding */ + if (sign && padchar != '0') { *p-- = '-'; sign = 0; } + /* fulling with pad-char */ + while (p >= buf + sign) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (sign) { *p = '-'; } + + return buf + width; +} + + inline int FrmResultAllocate( register DateFormat *dateFmt, @@ -1789,8 +1833,8 @@ ClockFmtToken_HourAMPM_Proc( ClockFormatToken *tok, int *val) { - *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; - return TCL_OK; + *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; + return TCL_OK; } static int @@ -1819,73 +1863,132 @@ ClockFmtToken_AMPM_Proc( len = Tcl_UtfToUpper(dateFmt->output); } dateFmt->output += len; - *dateFmt->output = '\0'; return TCL_OK; } + +static int +ClockFmtToken_StarDate_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) + { + int fractYear; + /* Get day of year, zero based */ + int doy = dateFmt->date.dayOfYear - 1; + + /* Convert day of year to a fractional year */ + if (IsGregorianLeapYear(&dateFmt->date)) { + fractYear = 1000 * doy / 366; + } else { + fractYear = 1000 * doy / 365; + } + + /* Put together the StarDate as "Stardate %02d%03d.%1d" */ + if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, "Stardate ", 9); + dateFmt->output += 9; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.year - RODDENBERRY, '0', 2); + dateFmt->output = _itoaw(dateFmt->output, + fractYear, '0', 3); + *dateFmt->output++ = '.'; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.localSeconds % 86400 / ( 86400 / 10 ), '0', 1); + + return TCL_OK; +} +static int +ClockFmtToken_WeekOfYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int dow = dateFmt->date.dayOfWeek; + if (*tok->tokWord.start == 'U') { + if (dow == 7) { + dow = 0; + } + dow++; + } + *val = ( dateFmt->date.dayOfYear - dow + 7 ) / 7; + return TCL_OK; +} static const char *FmtSTokenMapIndex = - "demNbByYCHMSIklpaAugGjJsnt"; + "demNbByYCHMSIklpaAuwUVgGjJsntQ"; static ClockFormatTokenMap FmtSTokenMap[] = { /* %d */ - {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, /* %e */ - {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, /* %m */ - {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, /* %N */ - {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, /* %b %h */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), NULL, (void *)MCLIT_MONTHS_ABBREV}, /* %B */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), NULL, (void *)MCLIT_MONTHS_FULL}, /* %y */ - {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, /* %Y */ - {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, /* %C */ - {CFMTT_INT, "%02d", 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, + {CFMTT_INT, "0", 2, 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, /* %H */ - {CFMTT_INT, "%02d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, /* %M */ - {CFMTT_INT, "%02d", 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, /* %S */ - {CFMTT_INT, "%02d", 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, /* %I */ - {CFMTT_INT, "%02d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), ClockFmtToken_HourAMPM_Proc, NULL}, /* %k */ - {CFMTT_INT, "%2d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, /* %l */ - {CFMTT_INT, "%2d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), ClockFmtToken_HourAMPM_Proc, NULL}, /* %p %P */ - {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), ClockFmtToken_AMPM_Proc, NULL}, /* %a */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_DAYS_OF_WEEK_ABBREV}, /* %A */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_DAYS_OF_WEEK_FULL}, /* %u */ - {CFMTT_INT, "%1d", 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + {CFMTT_INT, " ", 1, 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %w */ + {CFMTT_INT, " ", 1, 0, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %U %W */ + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), + ClockFmtToken_WeekOfYear_Proc, NULL}, + /* %V */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, /* %g */ - {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, /* %G */ - {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, /* %j */ - {CFMTT_INT, "%03d", 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, + {CFMTT_INT, "0", 3, 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, /* %J */ - {CFMTT_INT, "%07d", 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, + {CFMTT_INT, "0", 7, 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, /* %s */ - {CFMTT_WIDE, "%ld", 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + {CFMTT_WIDE, "%ld", 0, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, /* %n */ - {CFMTT_CHAR, "\n", 0, 0, 0, 0, NULL}, + {CFMTT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, /* %t */ - {CFMTT_CHAR, "\t", 0, 0, 0, 0, NULL}, + {CFMTT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, + /* %Q */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_StarDate_Proc, NULL}, #if 0 /* %H %k %I %l */ @@ -1927,14 +2030,14 @@ static ClockFormatTokenMap FmtSTokenMap[] = { #endif }; static const char *FmtSTokenMapAliasIndex[2] = { - "hP", - "bp" + "hPW", + "bpU" }; static const char *FmtETokenMapIndex = "";// "Ey"; static ClockFormatTokenMap FmtETokenMap[] = { - {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, #if 0 /* %EE */ {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateFormat, date.year), @@ -1952,7 +2055,7 @@ static const char *FmtETokenMapAliasIndex[2] = { static const char *FmtOTokenMapIndex = "";// "dmyHMSu"; static ClockFormatTokenMap FmtOTokenMap[] = { - {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, #if 0 /* %Od %Oe */ {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), @@ -1986,7 +2089,7 @@ static const char *FmtOTokenMapAliasIndex[2] = { }; static ClockFormatTokenMap FmtWordTokenMap = { - CTOKT_WORD, NULL, 0, 0, 0, 0, NULL + CTOKT_WORD, NULL, 0, 0, 0, 0, 0, NULL }; /* @@ -2168,8 +2271,12 @@ ClockFormat( } } if (!(map->flags & CLFMT_LOCALE_INDX)) { - if (FrmResultAllocate(dateFmt, 10) != TCL_OK) { goto error; }; - dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { goto error; }; + if (map->width) { + dateFmt->output = _itoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } } else { const char *s; Tcl_Obj * mcObj = ClockMCGet(opts, (int)map->data /* mcKey */); @@ -2189,14 +2296,13 @@ ClockFormat( case CFMTT_WIDE: if (1) { Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); - if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { goto error; }; + if (FrmResultAllocate(dateFmt, 21) != TCL_OK) { goto error; }; dateFmt->output += sprintf(dateFmt->output, map->tostr, val); } break; case CFMTT_CHAR: if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; *dateFmt->output++ = *map->tostr; - *dateFmt->output = '\0'; break; case CFMTT_PROC: if (map->fmtproc(opts, dateFmt, tok, NULL) != TCL_OK) { @@ -2207,9 +2313,12 @@ ClockFormat( if (1) { int len = tok->tokWord.end - tok->tokWord.start; if (FrmResultAllocate(dateFmt, len) != TCL_OK) { goto error; }; - memcpy(dateFmt->output, tok->tokWord.start, len); - dateFmt->output += len; - *dateFmt->output = '\0'; + if (len == 1) { + *dateFmt->output++ = *tok->tokWord.start; + } else { + memcpy(dateFmt->output, tok->tokWord.start, len); + dateFmt->output += len; + } } break; } @@ -2232,6 +2341,7 @@ done: if (result->bytes == NULL) { result->bytes = dateFmt->resMem; } + result->bytes[result->length] = '\0'; Tcl_SetObjResult(opts->interp, result); return TCL_OK; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 141ad60..c5d7da5 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -29,6 +29,8 @@ #define FOUR_YEARS 1461 /* days */ #define ONE_YEAR 365 /* days */ +#define RODDENBERRY 1946 /* Another epoch (Hi, Jeff!) */ + #define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ #define CLF_JULIANDAY (1 << 3) @@ -403,6 +405,7 @@ typedef int ClockFormatTokenProc( typedef struct ClockFormatTokenMap { unsigned short int type; const char *tostr; + unsigned short int width; unsigned short int flags; unsigned short int divider; unsigned short int divmod; @@ -441,6 +444,7 @@ typedef struct ClockFmtScnStorage { MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); +MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); -- cgit v0.12 From bd20b3429aa04d1c42d1f25a1eaf32008211e1d2 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:43:22 +0000 Subject: porting of clock format completed; all clock test cases passed --- generic/tclClock.c | 30 ++- generic/tclClockFmt.c | 511 +++++++++++++++++++++++++++++++++------------- generic/tclDate.h | 9 + tests-perf/clock.perf.tcl | 75 ++++++- 4 files changed, 478 insertions(+), 147 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 2e2c44b..28a484f 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -70,8 +70,6 @@ TCL_DECLARE_MUTEX(clockMutex) * Function prototypes for local procedures in this file: */ -static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, - TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[], Tcl_WideInt rangesVal[2]); @@ -86,8 +84,6 @@ static int ConvertLocalToUTCUsingC(Tcl_Interp *, TclDateFields *, int); static int ClockConfigureObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static Tcl_Obj * LookupLastTransition(Tcl_Interp *, Tcl_WideInt, - int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); static void GetYearWeekDay(TclDateFields *, int); static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); @@ -1730,7 +1726,7 @@ ConvertLocalToUTCUsingC( *---------------------------------------------------------------------- */ -static int +MODULE_SCOPE int ConvertUTCToLocal( ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ @@ -1974,7 +1970,7 @@ ConvertUTCToLocalUsingC( *---------------------------------------------------------------------- */ -static Tcl_Obj * +MODULE_SCOPE Tcl_Obj * LookupLastTransition( Tcl_Interp *interp, /* Interpreter for error messages */ Tcl_WideInt tick, /* Time from the epoch */ @@ -2950,7 +2946,7 @@ ClockFormatObjCmd( DateFormat dateFmt; /* Common structure used for formatting */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "string " + Tcl_WrongNumArgs(interp, 1, objv, "clockval " "?-format string? " "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); @@ -2974,6 +2970,16 @@ ClockFormatObjCmd( return TCL_ERROR; } + /* + * seconds could be an unsigned number that overflowed. Make sure + * that it isn't. + */ + + if (objv[1]->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + return TCL_ERROR; + } + memset(&dateFmt, 0, sizeof(dateFmt)); /* @@ -3065,6 +3071,16 @@ ClockScanObjCmd( if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; } + /* + * seconds could be an unsigned number that overflowed. Make sure + * that it isn't. + */ + + if (opts.baseObj->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + return TCL_ERROR; + } + } else { Tcl_Time now; Tcl_GetTime(&now); diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index f1fdf27..55e328c 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -101,6 +101,161 @@ _str2wideInt( return TCL_OK; } +inline char * +_itoaw( + char *buf, + register int val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + while (width <= 9 && val >= wrange[width]) { + width++; + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + while (width <= 9 && val <= -wrange[width]) { + width++; + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + +inline char * +_witoaw( + char *buf, + register Tcl_WideInt val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + if (val >= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 >= wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val >= wrange[width]) { + width++; + } + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + if (val <= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 <= -wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val <= -wrange[width]) { + width++; + } + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + /* *---------------------------------------------------------------------- */ @@ -1760,51 +1915,6 @@ done: return ret; } - - -inline char * -_itoaw( - char *buf, - register int val, - char padchar, - unsigned short int width) -{ - register char *p; - static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; - unsigned short int sign = 0; - - /* sign = 1 by negative number */ - if (val < 0) - { - sign = 1; - val = -val; - if (!width) width++; - } - /* check resp. recalculate width (regarding sign) */ - width -= sign; - while (width <= 9 && val >= wrange[width]) { - width++; - } - width += sign; - /* number to string backwards */ - p = buf + width; - *p-- = '\0'; - do { - *p-- = '0' + (val % 10); - val /= 10; - } while (val > 0); - /* sign by 0 padding */ - if (sign && padchar != '0') { *p-- = '-'; sign = 0; } - /* fulling with pad-char */ - while (p >= buf + sign) { - *p-- = padchar; - } - /* sign by non 0 padding */ - if (sign) { *p = '-'; } - - return buf + width; -} - inline int FrmResultAllocate( @@ -1833,7 +1943,7 @@ ClockFmtToken_HourAMPM_Proc( ClockFormatToken *tok, int *val) { - *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; + *val = ( ( ( *val % SECONDS_PER_DAY ) + SECONDS_PER_DAY - 3600 ) / 3600 ) % 12 + 1; return TCL_OK; } @@ -1848,7 +1958,7 @@ ClockFmtToken_AMPM_Proc( const char *s; int len; - if ((*val % 84600) < (84600 / 2)) { + if ((*val % SECONDS_PER_DAY) < (SECONDS_PER_DAY / 2)) { mcObj = ClockMCGet(opts, MCLIT_AM); } else { mcObj = ClockMCGet(opts, MCLIT_PM); @@ -1895,7 +2005,7 @@ ClockFmtToken_StarDate_Proc( fractYear, '0', 3); *dateFmt->output++ = '.'; dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.localSeconds % 86400 / ( 86400 / 10 ), '0', 1); + dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); return TCL_OK; } @@ -1916,9 +2026,162 @@ ClockFmtToken_WeekOfYear_Proc( *val = ( dateFmt->date.dayOfYear - dow + 7 ) / 7; return TCL_OK; } +static int +ClockFmtToken_TimeZone_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + if (*tok->tokWord.start == 'z') { + int z = dateFmt->date.tzOffset; + char sign = '+'; + if ( z < 0 ) { + z = -z; + sign = '-'; + } + if (FrmResultAllocate(dateFmt, 7) != TCL_OK) { return TCL_ERROR; }; + *dateFmt->output++ = sign; + dateFmt->output = _itoaw(dateFmt->output, z / 3600, '0', 2); + z %= 3600; + dateFmt->output = _itoaw(dateFmt->output, z / 60, '0', 2); + z %= 60; + if (z != 0) { + dateFmt->output = _itoaw(dateFmt->output, z, '0', 2); + } + } else { + Tcl_Obj * objPtr; + const char *s; int len; + /* convert seconds to local seconds to obtain tzName object */ + if (ConvertUTCToLocal(opts->clientData, opts->interp, + &dateFmt->date, opts->timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + return TCL_ERROR; + }; + objPtr = dateFmt->date.tzName; + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERA_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if (dateFmt->date.era == BCE) { + mcObj = ClockMCGet(opts, MCLIT_BCE); + } else { + mcObj = ClockMCGet(opts, MCLIT_CE); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERAYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int rowc; + Tcl_Obj **rowv; + + if (dateFmt->localeEra == NULL) { + Tcl_Obj *mcObj = ClockMCGet(opts, MCLIT_LOCALE_ERAS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(opts->interp, mcObj, &rowc, &rowv) != TCL_OK) { + return TCL_ERROR; + } + if (rowc != 0) { + dateFmt->localeEra = LookupLastTransition(opts->interp, + dateFmt->date.localSeconds, rowc, rowv, NULL); + } + if (dateFmt->localeEra == NULL) { + dateFmt->localeEra = (Tcl_Obj*)1; + } + } + + /* if no LOCALE_ERAS in catalog or era not found */ + if (dateFmt->localeEra == (Tcl_Obj*)1) { + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + if (*tok->tokWord.start == 'C') { /* %EC */ + *val = dateFmt->date.year / 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } else { /* %Ey */ + *val = dateFmt->date.year % 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } + } else { + Tcl_Obj *objPtr; + const char *s; + int len; + if (*tok->tokWord.start == 'C') { /* %EC */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 1, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + } else { /* %Ey */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 2, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + if (Tcl_GetIntFromObj(opts->interp, objPtr, val) != TCL_OK) { + return TCL_ERROR; + } + *val = dateFmt->date.year - *val; + /* if year in locale numerals */ + if (*val >= 0 && *val < 100) { + /* year as integer */ + Tcl_Obj * mcObj = ClockMCGet(opts, MCLIT_LOCALE_NUMERALS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (Tcl_ListObjIndex(opts->interp, mcObj, *val, &objPtr) != TCL_OK) { + return TCL_ERROR; + } + } else { + /* year as integer */ + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + return TCL_OK; + } + } + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + static const char *FmtSTokenMapIndex = - "demNbByYCHMSIklpaAuwUVgGjJsntQ"; + "demNbByYCHMSIklpaAuwUVzgGjJsntQ"; static ClockFormatTokenMap FmtSTokenMap[] = { /* %d */ {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, @@ -1941,21 +2204,21 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %C */ {CFMTT_INT, "0", 2, 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, /* %H */ - {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %M */ - {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %S */ - {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %I */ - {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %k */ - {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %l */ - {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %p %P */ - {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_AMPM_Proc, NULL}, /* %a */ {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), @@ -1972,6 +2235,9 @@ static ClockFormatTokenMap FmtSTokenMap[] = { ClockFmtToken_WeekOfYear_Proc, NULL}, /* %V */ {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, + /* %z %Z */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_TimeZone_Proc, NULL}, /* %g */ {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, /* %G */ @@ -1981,7 +2247,7 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %J */ {CFMTT_INT, "0", 7, 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, /* %s */ - {CFMTT_WIDE, "%ld", 0, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, /* %n */ {CFMTT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, /* %t */ @@ -1989,103 +2255,61 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %Q */ {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_StarDate_Proc, NULL}, - -#if 0 - /* %H %k %I %l */ - {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.hour), - NULL}, - /* %M */ - {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.minutes), - NULL}, - /* %S */ - {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.secondOfDay), - NULL}, - /* %p %P */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, - ClockFmtToken_amPmInd_Proc, NULL}, - /* %J */ - {CFMTT_INT, CLF_JULIANDAY, 1, 0xffff, TclOffset(DateFormat, date.julianDay), - NULL}, - /* %j */ - {CFMTT_INT, CLF_DAYOFYEAR, 1, 3, TclOffset(DateFormat, date.dayOfYear), - NULL}, - /* %g */ - {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601, 2, 2, TclOffset(DateFormat, date.iso8601Year), - NULL}, - /* %G */ - {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 4, 4, TclOffset(DateFormat, date.iso8601Year), - NULL}, - /* %V */ - {CFMTT_INT, CLF_ISO8601, 1, 2, TclOffset(DateFormat, date.iso8601Week), - NULL}, - /* %a %A %u %w */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, - ClockFmtToken_DayOfWeek_Proc, NULL}, - /* %z %Z */ - {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, - ClockFmtToken_TimeZone_Proc, NULL}, - /* %s */ - {CFMTT_INT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateFormat, date.localSeconds), - NULL}, -#endif }; static const char *FmtSTokenMapAliasIndex[2] = { - "hPW", - "bpU" + "hPWZ", + "bpUz" }; static const char *FmtETokenMapIndex = -"";// "Ey"; + "Ey"; static ClockFormatTokenMap FmtETokenMap[] = { - {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, -#if 0 /* %EE */ - {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateFormat, date.year), - ClockFmtToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, - /* %Ey */ - {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, -#endif + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), + ClockFmtToken_LocaleERA_Proc, NULL}, + /* %Ey %EC */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleERAYear_Proc, NULL}, }; static const char *FmtETokenMapAliasIndex[2] = { - "", - "" + "C", + "y" }; static const char *FmtOTokenMapIndex = -"";// "dmyHMSu"; + "dmyHIMSuw"; static ClockFormatTokenMap FmtOTokenMap[] = { - {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, -#if 0 /* %Od %Oe */ - {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfMonth), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateFormat, date.month), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Oy */ - {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateFormat, date.year), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, - /* %OH %Ok %OI %Ol */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.hour), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.year), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OI %Ol */ + {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OM */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.minutes), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OS */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, - /* %Ou Ow */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, - ClockFmtToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, -#endif + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ow */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *FmtOTokenMapAliasIndex[2] = { -"", "" -#if 0 - "ekIlw", - "dHHHu" -#endif + "ekl", + "dHI" }; static ClockFormatTokenMap FmtWordTokenMap = { @@ -2232,7 +2456,14 @@ ClockFormat( return TCL_ERROR; } - dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); /* result container object */ + /* prepare formatting */ + dateFmt->date.secondOfDay = (int)(dateFmt->date.localSeconds % SECONDS_PER_DAY); + if (dateFmt->date.secondOfDay < 0) { + dateFmt->date.secondOfDay += SECONDS_PER_DAY; + } + + /* result container object */ + dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); if (dateFmt->resMem == NULL) { return TCL_ERROR; } @@ -2283,7 +2514,9 @@ ClockFormat( if (mcObj == NULL) { goto error; } - if (Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK) { + if ( Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK + || mcObj == NULL + ) { goto error; } s = TclGetString(mcObj); @@ -2297,7 +2530,11 @@ ClockFormat( if (1) { Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); if (FrmResultAllocate(dateFmt, 21) != TCL_OK) { goto error; }; - dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + if (map->width) { + dateFmt->output = _witoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } } break; case CFMTT_CHAR: diff --git a/generic/tclDate.h b/generic/tclDate.h index c5d7da5..7c68b2a 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -109,6 +109,7 @@ typedef enum ClockMsgCtLiteral { MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, MCLIT_AM, MCLIT_PM, + MCLIT_LOCALE_ERAS, MCLIT_BCE, MCLIT_CE, MCLIT_BCE2, MCLIT_CE2, MCLIT_BCE3, MCLIT_CE3, @@ -121,6 +122,7 @@ typedef enum ClockMsgCtLiteral { pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", pref "DAYS_OF_WEEK_COMB", \ pref "AM", pref "PM", \ + pref "LOCALE_ERAS", \ pref "BCE", pref "CE", \ pref "b.c.e.", pref "c.e.", \ pref "b.c.", pref "a.d.", \ @@ -387,6 +389,8 @@ typedef struct DateFormat { char *output; TclDateFields date; + + Tcl_Obj *localeEra; } DateFormat; #define CLFMT_INCR (1 << 3) @@ -445,6 +449,11 @@ typedef struct ClockFmtScnStorage { MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); +MODULE_SCOPE int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, + TclDateFields *, Tcl_Obj *timezoneObj, int); +MODULE_SCOPE Tcl_Obj * + LookupLastTransition(Tcl_Interp *, Tcl_WideInt, + int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 41cc9e1..043d27f 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -56,7 +56,7 @@ proc _test_out_total {} { puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] lset _(m) 2 [expr [join $_(itcnt) +]] - lset _(m) 4 [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}] + lset _(m) 4 [format %.3f [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}]] puts $_(m) puts "Average:" lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / [llength $_(itcnt)]}]] @@ -95,6 +95,74 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { _test_out_total } +proc test-format {{reptime 1000}} { + _test_run $reptime { + # Format : date only (in gmt) + {clock format 1482525936 -format "%Y-%m-%d" -gmt 1} + # Format : date only (system zone) + {clock format 1482525936 -format "%Y-%m-%d"} + # Format : date only (CEST) + {clock format 1482525936 -format "%Y-%m-%d" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M:%S" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M:%S"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M:%S" -timezone :CET} + # Format : default (in gmt) + {clock format 1482525936 -gmt 1} + # Format : default (system zone) + {clock format 1482525936} + # Format : default (CEST) + {clock format 1482525936 -timezone :CET} + # Format : ISO date-time (in gmt, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1} + # Format : ISO date-time (system zone, CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z"} + # Format : ISO date-time (CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -timezone :CET} + # Format : ISO date-time (system zone, CEST) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %Z"} + # Format : julian day with time (in gmt): + {clock format 1246379415 -format "%J %H:%M:%S" -gmt 1} + # Format : julian day with time (system zone): + {clock format 1246379415 -format "%J %H:%M:%S"} + + # Format : locale date-time (en): + {clock format 1246379415 -format "%x %X" -locale en} + # Format : locale date-time (de): + {clock format 1246379415 -format "%x %X" -locale de} + + # Format : locale lookup table month: + {clock format 1246379400 -format "%b" -locale en -gmt 1} + # Format : locale lookup 2 tables - month and day: + {clock format 1246379400 -format "%b %Od" -locale en -gmt 1} + + # Format : dynamic clock value (without converter caches): + {set i 0; continue} + {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} + {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + # Format : dynamic clock value (without any converter caches, zone range overflow): + {set i 0; continue} + {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} + {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + + # Format : dynamic format (cacheable) + {clock format 1246379415 -format [string trim "%d.%m.%Y %H:%M:%S "] -gmt 1} + + # Format : all (in gmt, locale en) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -gmt 1 -locale en} + # Format : all (in CET, locale de) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -timezone :CET -locale de} + } +} + proc test-scan {{reptime 1000}} { _test_run $reptime { # Scan : date (in gmt) @@ -146,7 +214,7 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} # Scan : century, lookup table month and day (both entries are first) - {clock scan {1970 Jan 02} -format {%C%y %b %Od} -locale en -gmt 1} + {clock scan {1970 Jan 01} -format {%C%y %b %Od} -locale en -gmt 1} # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} @@ -235,8 +303,9 @@ proc test-other {{reptime 1000}} { proc test {{reptime 1000}} { puts "" + test-format $reptime test-scan $reptime - #test-freescan $reptime + test-freescan $reptime test-other $reptime puts \n**OK** -- cgit v0.12 From c97ddc73f6481193801401514372fb3df1993939 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:44:30 +0000 Subject: several missing scan tokens added, test cases extended and fixed; token "%s" used for seconds only (time zone independent), additionally "%Es" token added for local seconds (zone dependent seconds); --- generic/tclClock.c | 16 ++--- generic/tclClockFmt.c | 174 ++++++++++++++++++++++++++++++++++++++++---------- generic/tclDate.h | 16 ++++- tests/clock.test | 49 +++++++++++++- 4 files changed, 208 insertions(+), 47 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 28a484f..a3a9332 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -87,8 +87,6 @@ static int ClockConfigureObjCmd(ClientData clientData, static void GetYearWeekDay(TclDateFields *, int); static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); -static void GetJulianDayFromEraYearWeekDay(TclDateFields *, int); -static void GetJulianDayFromEraYearMonthDay(TclDateFields *, int); static int WeekdayOnOrBefore(int, int); static int ClockClicksObjCmd( ClientData clientData, Tcl_Interp *interp, @@ -2266,7 +2264,7 @@ GetMonthDay( *---------------------------------------------------------------------- */ -static void +MODULE_SCOPE void GetJulianDayFromEraYearWeekDay( TclDateFields *fields, /* Date to convert */ int changeover) /* Julian Day Number of the Gregorian @@ -2319,7 +2317,7 @@ GetJulianDayFromEraYearWeekDay( *---------------------------------------------------------------------- */ -static void +MODULE_SCOPE void GetJulianDayFromEraYearMonthDay( TclDateFields *fields, /* Date to convert */ int changeover) /* Gregorian transition date as a Julian Day */ @@ -2415,7 +2413,7 @@ GetJulianDayFromEraYearMonthDay( *---------------------------------------------------------------------- */ -static void +MODULE_SCOPE void GetJulianDayFromEraYearDay( TclDateFields *fields, /* Date to convert */ int changeover) /* Gregorian transition date as a Julian Day */ @@ -3169,9 +3167,11 @@ ClockScanObjCmd( + ( yySeconds % SECONDS_PER_DAY ); } - if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, - GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; + if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY|CLF_LOCALSEC)) { + if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + goto done; + } } /* Increment UTC seconds with relative time */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 55e328c..7a6fa0b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -50,7 +50,7 @@ _str2int( int sign) { register time_t val = 0, prev = 0; - if (sign > 0) { + if (sign >= 0) { while (p < e) { val = val * 10 + (*p++ - '0'); if (val < prev) { @@ -80,7 +80,7 @@ _str2wideInt( int sign) { register Tcl_WideInt val = 0, prev = 0; - if (sign > 0) { + if (sign >= 0) { while (p < e) { val = val * 10 + (*p++ - '0'); if (val < prev) { @@ -1296,13 +1296,91 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } +static int +ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + register const char *p = yyInput, *end; const char *s; + time_t year, fractYear, fractDayDiv, fractDay; + static const char *stardatePref = "stardate "; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + end = yyInput + maxLen; + + /* stardate string */ + p = TclUtfFindEqualNCInLwr(p, end, stardatePref, stardatePref + 9, &s); + if (p >= end || p - yyInput < 9) { + return TCL_RETURN; + } + /* bypass spaces */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + if (p >= end) { + return TCL_RETURN; + } + /* currently positive stardate only */ + if (*p == '+') { p++; }; + s = p; + while (p < end && isdigit(UCHAR(*p))) { + p++; + } + if (p >= end || p - s < 4) { + return TCL_RETURN; + } + if ( _str2int(&year, s, p-3, 1) != TCL_OK + || _str2int(&fractYear, p-3, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + if (*p++ != '.') { + return TCL_RETURN; + } + s = p; + fractDayDiv = 1; + while (p < end && isdigit(UCHAR(*p))) { + fractDayDiv *= 10; + p++; + } + if ( _str2int(&fractDay, s, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + yyInput = p; + + /* Build a date from year and fraction. */ + + yydate.year = year + RODDENBERRY; + yydate.era = CE; + yydate.gregorian = 1; + + if (IsGregorianLeapYear(&yydate)) { + fractYear *= 366; + } else { + fractYear *= 365; + } + yydate.dayOfYear = fractYear / 1000 + 1; + if (fractYear % 1000 >= 500) { + yydate.dayOfYear++; + } + + GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + + yydate.seconds = + -210866803200L + + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + + ( SECONDS_PER_DAY * fractDay / fractDayDiv ); + + return TCL_OK; +} + static const char *ScnSTokenMapIndex = - "dmbyYHMSpJjCgGVazs"; + "dmbyYHMSpJjCgGVazUsntQ"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ {CTOKT_DIGIT, CLF_DAYOFMONTH, 0, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, - /* %m */ + /* %m %N */ {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ @@ -1350,17 +1428,27 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %z %Z */ {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, 0, ClockScnToken_TimeZone_Proc, NULL}, + /* %U %W */ + {CTOKT_DIGIT, CLF_OPTIONAL, 0, 1, 2, 0, /* currently no capture, parse only token */ + NULL}, /* %s */ - {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), NULL}, + /* %n */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, + /* %t */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, + /* %Q */ + {CTOKT_PARSER, CLF_POSIXSEC, 0, 16, 30, 0, + ClockScnToken_StarDate_Proc, NULL}, }; static const char *ScnSTokenMapAliasIndex[2] = { - "eNBhkIlPAuwZ", - "dmbbHHHpaaaz" + "eNBhkIlPAuwZW", + "dmbbHHHpaaazU" }; static const char *ScnETokenMapIndex = - "Ey"; + "Eys"; static ClockScanTokenMap ScnETokenMap[] = { /* %EE */ {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateInfo, date.year), @@ -1368,6 +1456,9 @@ static ClockScanTokenMap ScnETokenMap[] = { /* %Ey */ {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Es */ + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + NULL}, }; static const char *ScnETokenMapAliasIndex[2] = { "", @@ -1427,7 +1518,10 @@ EstimateTokenCount( /* estimate token count by % char and format length */ tokcnt = 0; while (p <= end) { - if (*p++ == '%') tokcnt++; + if (*p++ == '%') { + tokcnt++; + p++; + } } p = fmt + tokcnt * 2; if (p < end) { @@ -1653,7 +1747,9 @@ ClockScan( map = tok->map; /* bypass spaces at begin of input before parsing each token */ if ( !(opts->flags & CLF_STRICT) - && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) + && ( map->type != CTOKT_SPACE + && map->type != CTOKT_WORD + && map->type != CTOKT_CHAR ) ) { while (p < end && isspace(UCHAR(*p))) { p++; @@ -1710,27 +1806,28 @@ ClockScan( if (size < map->minSize) { /* missing input -> error */ if ((map->flags & CLF_OPTIONAL)) { - yyInput = p; continue; } goto not_match; } /* string 2 number, put number into info structure by offset */ - p = yyInput; x = p + size; - if (!(map->flags & CLF_LOCALSEC)) { - if (_str2int((time_t *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; - } - p = x; - } else { - if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; + if (map->offs) { + p = yyInput; x = p + size; + if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { + if (_str2int((time_t *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; } - p = x; + flags = (flags & ~map->clearFlags) | map->flags; } - flags = (flags & ~map->clearFlags) | map->flags; } break; case CTOKT_PARSER: @@ -1771,7 +1868,14 @@ ClockScan( goto not_match; } p = x; - continue; + break; + case CTOKT_CHAR: + x = (char *)map->data; + if (*x != *p) { + /* no match -> error */ + goto not_match; + } + p++; break; } } @@ -1802,7 +1906,7 @@ ClockScan( */ /* seconds token (%s) take precedence over all other tokens */ - if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_POSIXSEC)) { if (flags & CLF_DATE) { if (!(flags & CLF_JULIANDAY)) { @@ -1876,7 +1980,7 @@ ClockScan( } /* if no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + if (!(flags & (CLF_TIME|CLF_LOCALSEC|CLF_POSIXSEC))) { info->flags |= CLF_ASSEMBLE_SECONDS; yydate.localSeconds = 0; } @@ -1886,7 +1990,7 @@ ClockScan( yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); } else - if (!(flags & CLF_LOCALSEC)) { + if (!(flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { info->flags |= CLF_ASSEMBLE_SECONDS; yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } @@ -1996,7 +2100,7 @@ ClockFmtToken_StarDate_Proc( } /* Put together the StarDate as "Stardate %02d%03d.%1d" */ - if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { return TCL_ERROR; }; + if (FrmResultAllocate(dateFmt, 30) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, "Stardate ", 9); dateFmt->output += 9; dateFmt->output = _itoaw(dateFmt->output, @@ -2005,7 +2109,7 @@ ClockFmtToken_StarDate_Proc( fractYear, '0', 3); *dateFmt->output++ = '.'; dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + dateFmt->date.seconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); return TCL_OK; } @@ -2249,9 +2353,9 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %s */ {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, /* %n */ - {CFMTT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, + {CTOKT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, /* %t */ - {CFMTT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, + {CTOKT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, /* %Q */ {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_StarDate_Proc, NULL}, @@ -2262,7 +2366,7 @@ static const char *FmtSTokenMapAliasIndex[2] = { }; static const char *FmtETokenMapIndex = - "Ey"; + "Eys"; static ClockFormatTokenMap FmtETokenMap[] = { /* %EE */ {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), @@ -2270,6 +2374,8 @@ static ClockFormatTokenMap FmtETokenMap[] = { /* %Ey %EC */ {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), ClockFmtToken_LocaleERAYear_Proc, NULL}, + /* %Es */ + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), NULL}, }; static const char *FmtETokenMapAliasIndex[2] = { "C", @@ -2537,7 +2643,7 @@ ClockFormat( } } break; - case CFMTT_CHAR: + case CTOKT_CHAR: if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; *dateFmt->output++ = *map->tostr; break; diff --git a/generic/tclDate.h b/generic/tclDate.h index 7c68b2a..2ce629d 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -33,9 +33,10 @@ #define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ +#define CLF_POSIXSEC (1 << 1) +#define CLF_LOCALSEC (1 << 2) #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) -#define CLF_LOCALSEC (1 << 5) #define CLF_CENTURY (1 << 6) #define CLF_DAYOFMONTH (1 << 7) #define CLF_DAYOFYEAR (1 << 8) @@ -355,8 +356,8 @@ typedef int ClockScanTokenProc( typedef enum _CLCKTOK_TYPE { - CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, - CFMTT_INT, CFMTT_WIDE, CFMTT_CHAR, CFMTT_PROC + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, CTOKT_CHAR, + CFMTT_INT, CFMTT_WIDE, CFMTT_PROC } CLCKTOK_TYPE; typedef struct ClockScanTokenMap { @@ -449,6 +450,15 @@ typedef struct ClockFmtScnStorage { MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); +MODULE_SCOPE void + GetJulianDayFromEraYearWeekDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearMonthDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearDay( + TclDateFields *fields, int changeover); MODULE_SCOPE int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *timezoneObj, int); MODULE_SCOPE Tcl_Obj * diff --git a/tests/clock.test b/tests/clock.test index b27d2a3..4b0587a 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18605,6 +18605,40 @@ test clock-6.19 {no token parsing} { [catch { clock scan "...%..." -format "...%%..." }] } {0 0} +test clock-6.20 {special char tokens %n, %t} { + clock scan "30\t06\t2009\n18\t30" -format "%d%t%m%t%Y%n%H%t%M" -gmt 1 +} 1246386600 + +# Hi, Jeff! +test clock-6.21.0 {Stardate 0 day} { + list [set d [clock format -757382400 -format "%Q" -gmt 1]] \ + [clock scan $d -format "%Q" -gmt 1] +} [list "Stardate 00000.0" -757382400] +test clock-6.21.1 {Stardate} { + list [set d [clock format 1482857280 -format "%Q" -gmt 1]] \ + [clock scan $d -format "%Q" -gmt 1] +} [list "Stardate 70986.7" 1482857280] +test clock-6.21.2 {Stardate next time} { + list [set d [clock format 1482865920 -format "%Q" -gmt 1]] \ + [clock scan $d -format "%Q" -gmt 1] +} [list "Stardate 70986.8" 1482865920] +test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and end of the year)} -body { + set s [clock scan "01.01.2016" -f "%d.%m.%Y" -g 1] + set s [set i [clock scan [clock format $s -f "%Q" -g 1] -g 1]] + set wrong {} + while {[incr i 86400] < $s + 86400*366*2} { + set d [clock format $i -f "%Q" -g 1] + set i2 [clock scan $d -f "%Q" -g 1] + if {$i != $i2} { + lappend wrong "$d -- ($i != $i2) -- [clock format $i -g 1]" + } + } + join $wrong \n +} -result {} -cleanup { + unset -nocomplain wrong i i2 s d +} + + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true } -210866803200 @@ -36080,10 +36114,21 @@ test clock-37.1 {%s gmt testing} { set s [clock seconds] set a [clock format $s -format %s -gmt 0] set b [clock format $s -format %s -gmt 1] + set c [clock scan $s -format %s -gmt 0] + set d [clock scan $s -format %s -gmt 1] # %s, being the difference between local and Greenwich, does not # depend on the time zone. - set c [expr {$b-$a}] -} {0} + list [expr {$b-$a}] [expr {$d-$c}] +} {0 0} +test clock-37.2 {%Es gmt testing} { + set s [clock seconds] + set a [clock format $s -format %Es -timezone CET] + set b [clock format $s -format %Es -gmt 1] + set c [clock scan $s -format %Es -timezone CET] + set d [clock scan $s -format %Es -gmt 1] + # %Es depend on the time zone (local seconds instead of posix seconds). + list [expr {$b-$a}] [expr {$d-$c}] +} {-3600 3600} test clock-38.1 {regression - convertUTCToLocalViaC - east of Greenwich} \ -setup { -- cgit v0.12 From 4600d7c02647505afea5e1fdb0f3ae09ec0a8084 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:44:55 +0000 Subject: performance test cases ready --- tests-perf/clock.perf.tcl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 043d27f..34d9429 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -97,6 +97,12 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { proc test-format {{reptime 1000}} { _test_run $reptime { + # Format : short, week only (in gmt) + {clock format 1482525936 -format "%u" -gmt 1} + # Format : short, week only (system zone) + {clock format 1482525936 -format "%u"} + # Format : short, week only (CEST) + {clock format 1482525936 -format "%u" -timezone :CET} # Format : date only (in gmt) {clock format 1482525936 -format "%Y-%m-%d" -gmt 1} # Format : date only (system zone) @@ -229,12 +235,6 @@ proc test-scan {{reptime 1000}} { {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} break - - # Scan : zone only - {clock scan "CET" -format "%z"} - {clock scan "EST" -format "%z"} - {**STOP** : Wed Nov 25 01:00:00 CET 2015} - # # Scan : long format test (allock chain) # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} # # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): @@ -293,7 +293,6 @@ proc test-other {{reptime 1000}} { # Scan : julian day (overflow) {catch {clock scan 5373485 -format %J}} - **STOP** # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) -- cgit v0.12 From 7a654297a08c44ecc24062e08b31343ffddd2bd6 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:45:29 +0000 Subject: small code review, performance test cases ready. --- generic/tclClock.c | 2 +- generic/tclClockFmt.c | 6 +++--- tests-perf/clock.perf.tcl | 32 ++++++++++++++++++++------------ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a3a9332..7d4263c 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3488,7 +3488,7 @@ ClockSecondsObjCmd( /* *---------------------------------------------------------------------- * - * TzsetIfNecessary -- + * TzsetGetEpoch --, TzsetIfNecessary -- * * Calls the tzset() library function if the contents of the TZ * environment variable has changed. diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 7a6fa0b..307fc28 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1366,7 +1366,7 @@ ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); - yydate.seconds = + yydate.localSeconds = -210866803200L + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + ( SECONDS_PER_DAY * fractDay / fractDayDiv ); @@ -1439,7 +1439,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %t */ {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, /* %Q */ - {CTOKT_PARSER, CLF_POSIXSEC, 0, 16, 30, 0, + {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, ClockScnToken_StarDate_Proc, NULL}, }; static const char *ScnSTokenMapAliasIndex[2] = { @@ -2109,7 +2109,7 @@ ClockFmtToken_StarDate_Proc( fractYear, '0', 3); *dateFmt->output++ = '.'; dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.seconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); return TCL_OK; } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 34d9429..f3b8a10 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -32,7 +32,7 @@ proc {**STOP**} {args} { } proc _test_get_commands {lst} { - regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" + regsub -all {(?:^|\n)[ \t]*(\#[^\n]*|\msetup\M[^\n]*|\mcleanup\M[^\n]*)(?=\n\s*(?:[\{\#]|setup|cleanup))} $lst "\n{\\1}" } proc _test_out_total {} { @@ -83,7 +83,11 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { foreach _(c) [_test_get_commands $lst] { puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" - if {[regexp {\s*\#} $_(c)]} continue + if {[regexp {^\s*\#} $_(c)]} continue + if {[regexp {^\s*(?:setup|cleanup)\s+} $_(c)]} { + puts [if 1 [lindex $_(c) 1]] + continue + } set _(r) [if 1 $_(c)] if {$outcmd ne {}} $outcmd puts [set _(m) [timerate $_(c) $reptime]] @@ -122,11 +126,11 @@ proc test-format {{reptime 1000}} { # Format : time only (CEST) {clock format 1482525936 -format "%H:%M:%S" -timezone :CET} # Format : default (in gmt) - {clock format 1482525936 -gmt 1} + {clock format 1482525936 -gmt 1 -locale en} # Format : default (system zone) - {clock format 1482525936} + {clock format 1482525936 -locale en} # Format : default (CEST) - {clock format 1482525936 -timezone :CET} + {clock format 1482525936 -timezone :CET -locale en} # Format : ISO date-time (in gmt, numeric zone) {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1} # Format : ISO date-time (system zone, CEST, numeric zone) @@ -149,15 +153,19 @@ proc test-format {{reptime 1000}} { {clock format 1246379400 -format "%b" -locale en -gmt 1} # Format : locale lookup 2 tables - month and day: {clock format 1246379400 -format "%b %Od" -locale en -gmt 1} + # Format : locale lookup 3 tables - week, month and day: + {clock format 1246379400 -format "%a %b %Od" -locale en -gmt 1} + # Format : locale lookup 4 tables - week, month, day and year: + {clock format 1246379400 -format "%a %b %Od %Oy" -locale en -gmt 1} # Format : dynamic clock value (without converter caches): - {set i 0; continue} - {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} - {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + setup {set i 0} + {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} # Format : dynamic clock value (without any converter caches, zone range overflow): - {set i 0; continue} - {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} - {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + setup {set i 0} + {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} # Format : dynamic format (cacheable) {clock format 1246379415 -format [string trim "%d.%m.%Y %H:%M:%S "] -gmt 1} @@ -310,4 +318,4 @@ proc test {{reptime 1000}} { puts \n**OK** } -test 100; # ms +test 500; # ms -- cgit v0.12 From 941e45f9078176fa27d4d7b627b2c4e1c6642d06 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:45:59 +0000 Subject: clock.tcl: clean unused resp. obsolete commands --- library/clock.tcl | 2578 +++++------------------------------------------------ library/init.tcl | 2 +- 2 files changed, 213 insertions(+), 2367 deletions(-) diff --git a/library/clock.tcl b/library/clock.tcl index 06aa10a..3caa270 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -389,152 +389,6 @@ proc ::tcl::clock::Initialize {} { {46800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Tongatapu }] - # Groups of fields that specify the date, priorities, and code bursts that - # determine Julian Day Number given those groups. The code in [clock - # scan] will choose the highest priority (lowest numbered) set of fields - # that determines the date. - - variable DateParseActions { - - { seconds } 0 {} - - { julianDay } 1 {} - - { era century yearOfCentury month dayOfMonth } 2 { - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { era century yearOfCentury dayOfYear } 2 { - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - - { century yearOfCentury month dayOfMonth } 3 { - dict set date era CE - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { century yearOfCentury dayOfYear } 3 { - dict set date era CE - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - { iso8601Century iso8601YearOfCentury iso8601Week dayOfWeek } 3 { - dict set date era CE - dict set date iso8601Year \ - [expr { 100 * [dict get $date iso8601Century] - + [dict get $date iso8601YearOfCentury] }] - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - { yearOfCentury month dayOfMonth } 4 { - set date [InterpretTwoDigitYear $date[set date {}] $baseTime] - dict set date era CE - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { yearOfCentury dayOfYear } 4 { - set date [InterpretTwoDigitYear $date[set date {}] $baseTime] - dict set date era CE - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - { iso8601YearOfCentury iso8601Week dayOfWeek } 4 { - set date [InterpretTwoDigitYear \ - $date[set date {}] $baseTime \ - iso8601YearOfCentury iso8601Year] - dict set date era CE - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - { month dayOfMonth } 5 { - set date [AssignBaseYear $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { dayOfYear } 5 { - set date [AssignBaseYear $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - { iso8601Week dayOfWeek } 5 { - set date [AssignBaseIso8601Year $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - { dayOfMonth } 6 { - set date [AssignBaseMonth $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - - { dayOfWeek } 7 { - set date [AssignBaseWeek $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - {} 8 { - set date [AssignBaseJulianDay $date[set date {}] \ - $baseTime $timeZone $changeover] - } - } - - # Groups of fields that specify time of day, priorities, and code that - # processes them - - variable TimeParseActions { - - seconds 1 {} - - { hourAMPM minute second amPmIndicator } 2 { - dict set date secondOfDay [InterpretHMSP $date] - } - { hour minute second } 2 { - dict set date secondOfDay [InterpretHMS $date] - } - - { hourAMPM minute amPmIndicator } 3 { - dict set date second 0 - dict set date secondOfDay [InterpretHMSP $date] - } - { hour minute } 3 { - dict set date second 0 - dict set date secondOfDay [InterpretHMS $date] - } - - { hourAMPM amPmIndicator } 4 { - dict set date minute 0 - dict set date second 0 - dict set date secondOfDay [InterpretHMSP $date] - } - { hour } 4 { - dict set date minute 0 - dict set date second 0 - dict set date secondOfDay [InterpretHMS $date] - } - - { } 5 { - dict set date secondOfDay 0 - } - } - # Legacy time zones, used primarily for parsing RFC822 dates. variable LegacyTimeZone [dict create \ @@ -667,2169 +521,281 @@ proc mcget {locale args} { #---------------------------------------------------------------------- # -# clock format -- -# -# Formats a count of seconds since the Posix Epoch as a time of day. -# -# The 'clock format' command formats times of day for output. Refer to the -# user documentation to see what it does. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::__org_format { args } { - - variable FormatProc - variable TZData - - lassign [ParseFormatArgs {*}$args] format locale timezone - set locale [string tolower $locale] - set clockval [lindex $args 0] - - # Build a procedure to format the result. Cache the built procedure's name - # in the 'FormatProc' array to avoid losing its internal representation, - # which contains the name resolution. - - set procName formatproc'$format'$locale - set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName] - if {[info exists FormatProc($procName)]} { - set procName $FormatProc($procName) - } else { - set FormatProc($procName) \ - [ParseClockFormatFormat $procName $format $locale] - } - - return [$procName $clockval $timezone] - -} - -#---------------------------------------------------------------------- -# -# ParseClockFormatFormat -- -# -# Builds and caches a procedure that formats a time value. -# -# Parameters: -# format -- Format string to use -# locale -- Locale in which the format string is to be interpreted -# -# Results: -# Returns the name of the newly-built procedure. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ParseClockFormatFormat {procName format locale} { - - if {[namespace which $procName] ne {}} { - return $procName - } - - # Map away the locale-dependent composite format groups - - set locale [EnterLocale $locale] - - # Change locale if a fresh locale has been given on the command line. - - try { - return [ParseClockFormatFormat2 $format $locale $procName] - } trap CLOCK {result opts} { - dict unset opts -errorinfo - return -options $opts $result - } -} - -proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} { - set didLocaleEra 0 - set didLocaleNumerals 0 - set preFormatCode \ - [string map [list @GREGORIAN_CHANGE_DATE@ \ - [mc GREGORIAN_CHANGE_DATE]] \ - { - variable TZData - set date [GetDateFields $clockval \ - $timezone \ - @GREGORIAN_CHANGE_DATE@] - }] - set formatString {} - set substituents {} - set state {} - - set format [LocalizeFormat $locale $format] - - foreach char [split $format {}] { - switch -exact -- $state { - {} { - if { [string equal % $char] } { - set state percent - } else { - append formatString $char - } - } - percent { # Character following a '%' character - set state {} - switch -exact -- $char { - % { # A literal character, '%' - append formatString %% - } - a { # Day of week, abbreviated - append formatString %s - append substituents \ - [string map \ - [list @DAYS_OF_WEEK_ABBREV@ \ - [list [mc DAYS_OF_WEEK_ABBREV]]] \ - { [lindex @DAYS_OF_WEEK_ABBREV@ \ - [expr {[dict get $date dayOfWeek] \ - % 7}]]}] - } - A { # Day of week, spelt out. - append formatString %s - append substituents \ - [string map \ - [list @DAYS_OF_WEEK_FULL@ \ - [list [mc DAYS_OF_WEEK_FULL]]] \ - { [lindex @DAYS_OF_WEEK_FULL@ \ - [expr {[dict get $date dayOfWeek] \ - % 7}]]}] - } - b - h { # Name of month, abbreviated. - append formatString %s - append substituents \ - [string map \ - [list @MONTHS_ABBREV@ \ - [list [mc MONTHS_ABBREV]]] \ - { [lindex @MONTHS_ABBREV@ \ - [expr {[dict get $date month]-1}]]}] - } - B { # Name of month, spelt out - append formatString %s - append substituents \ - [string map \ - [list @MONTHS_FULL@ \ - [list [mc MONTHS_FULL]]] \ - { [lindex @MONTHS_FULL@ \ - [expr {[dict get $date month]-1}]]}] - } - C { # Century number - append formatString %02d - append substituents \ - { [expr {[dict get $date year] / 100}]} - } - d { # Day of month, with leading zero - append formatString %02d - append substituents { [dict get $date dayOfMonth]} - } - e { # Day of month, without leading zero - append formatString %2d - append substituents { [dict get $date dayOfMonth]} - } - E { # Format group in a locale-dependent - # alternative era - set state percentE - if {!$didLocaleEra} { - append preFormatCode \ - [string map \ - [list @LOCALE_ERAS@ \ - [list [mc LOCALE_ERAS]]] \ - { - set date [GetLocaleEra \ - $date[set date {}] \ - @LOCALE_ERAS@]}] \n - set didLocaleEra 1 - } - if {!$didLocaleNumerals} { - append preFormatCode \ - [list set localeNumerals \ - [mc LOCALE_NUMERALS]] \n - set didLocaleNumerals 1 - } - } - g { # Two-digit year relative to ISO8601 - # week number - append formatString %02d - append substituents \ - { [expr { [dict get $date iso8601Year] % 100 }]} - } - G { # Four-digit year relative to ISO8601 - # week number - append formatString %02d - append substituents { [dict get $date iso8601Year]} - } - H { # Hour in the 24-hour day, leading zero - append formatString %02d - append substituents \ - { [expr { [dict get $date localSeconds] \ - / 3600 % 24}]} - } - I { # Hour AM/PM, with leading zero - append formatString %02d - append substituents \ - { [expr { ( ( ( [dict get $date localSeconds] \ - % 86400 ) \ - + 86400 \ - - 3600 ) \ - / 3600 ) \ - % 12 + 1 }] } - } - j { # Day of year (001-366) - append formatString %03d - append substituents { [dict get $date dayOfYear]} - } - J { # Julian Day Number - append formatString %07ld - append substituents { [dict get $date julianDay]} - } - k { # Hour (0-23), no leading zero - append formatString %2d - append substituents \ - { [expr { [dict get $date localSeconds] - / 3600 - % 24 }]} - } - l { # Hour (12-11), no leading zero - append formatString %2d - append substituents \ - { [expr { ( ( ( [dict get $date localSeconds] - % 86400 ) - + 86400 - - 3600 ) - / 3600 ) - % 12 + 1 }]} - } - m { # Month number, leading zero - append formatString %02d - append substituents { [dict get $date month]} - } - M { # Minute of the hour, leading zero - append formatString %02d - append substituents \ - { [expr { [dict get $date localSeconds] - / 60 - % 60 }]} - } - n { # A literal newline - append formatString \n - } - N { # Month number, no leading zero - append formatString %2d - append substituents { [dict get $date month]} - } - O { # A format group in the locale's - # alternative numerals - set state percentO - if {!$didLocaleNumerals} { - append preFormatCode \ - [list set localeNumerals \ - [mc LOCALE_NUMERALS]] \n - set didLocaleNumerals 1 - } - } - p { # Localized 'AM' or 'PM' indicator - # converted to uppercase - append formatString %s - append preFormatCode \ - [list set AM [string toupper [mc AM]]] \n \ - [list set PM [string toupper [mc PM]]] \n - append substituents \ - { [expr {(([dict get $date localSeconds] - % 86400) < 43200) ? - $AM : $PM}]} - } - P { # Localized 'AM' or 'PM' indicator - append formatString %s - append preFormatCode \ - [list set am [mc AM]] \n \ - [list set pm [mc PM]] \n - append substituents \ - { [expr {(([dict get $date localSeconds] - % 86400) < 43200) ? - $am : $pm}]} - - } - Q { # Hi, Jeff! - append formatString %s - append substituents { [FormatStarDate $date]} - } - s { # Seconds from the Posix Epoch - append formatString %s - append substituents { [dict get $date seconds]} - } - S { # Second of the minute, with - # leading zero - append formatString %02d - append substituents \ - { [expr { [dict get $date localSeconds] - % 60 }]} - } - t { # A literal tab character - append formatString \t - } - u { # Day of the week (1-Monday, 7-Sunday) - append formatString %1d - append substituents { [dict get $date dayOfWeek]} - } - U { # Week of the year (00-53). The - # first Sunday of the year is the - # first day of week 01 - append formatString %02d - append preFormatCode { - set dow [dict get $date dayOfWeek] - if { $dow == 7 } { - set dow 0 - } - incr dow - set UweekNumber \ - [expr { ( [dict get $date dayOfYear] - - $dow + 7 ) - / 7 }] - } - append substituents { $UweekNumber} - } - V { # The ISO8601 week number - append formatString %02d - append substituents { [dict get $date iso8601Week]} - } - w { # Day of the week (0-Sunday, - # 6-Saturday) - append formatString %1d - append substituents \ - { [expr { [dict get $date dayOfWeek] % 7 }]} - } - W { # Week of the year (00-53). The first - # Monday of the year is the first day - # of week 01. - append preFormatCode { - set WweekNumber \ - [expr { ( [dict get $date dayOfYear] - - [dict get $date dayOfWeek] - + 7 ) - / 7 }] - } - append formatString %02d - append substituents { $WweekNumber} - } - y { # The two-digit year of the century - append formatString %02d - append substituents \ - { [expr { [dict get $date year] % 100 }]} - } - Y { # The four-digit year - append formatString %04d - append substituents { [dict get $date year]} - } - z { # The time zone as hours and minutes - # east (+) or west (-) of Greenwich - append formatString %s - append substituents { [FormatNumericTimeZone \ - [dict get $date tzOffset]]} - } - Z { # The name of the time zone - append formatString %s - append substituents { [dict get $date tzName]} - } - % { # A literal percent character - append formatString %% - } - default { # An unknown escape sequence - append formatString %% $char - } - } - } - percentE { # Character following %E - set state {} - switch -exact -- $char { - E { - append formatString %s - append substituents { } \ - [string map \ - [list @BCE@ [list [mc BCE]] \ - @CE@ [list [mc CE]]] \ - {[dict get {BCE @BCE@ CE @CE@} \ - [dict get $date era]]}] - } - C { # Locale-dependent era - append formatString %s - append substituents { [dict get $date localeEra]} - } - y { # Locale-dependent year of the era - append preFormatCode { - set y [dict get $date localeYear] - if { $y >= 0 && $y < 100 } { - set Eyear [lindex $localeNumerals $y] - } else { - set Eyear $y - } - } - append formatString %s - append substituents { $Eyear} - } - default { # Unknown %E format group - append formatString %%E $char - } - } - } - percentO { # Character following %O - set state {} - switch -exact -- $char { - d - e { # Day of the month in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [dict get $date dayOfMonth]]} - } - H - k { # Hour of the day in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date localSeconds] - / 3600 - % 24 }]]} - } - I - l { # Hour (12-11) AM/PM in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { ( ( ( [dict get $date localSeconds] - % 86400 ) - + 86400 - - 3600 ) - / 3600 ) - % 12 + 1 }]]} - } - m { # Month number in alternative numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals [dict get $date month]]} - } - M { # Minute of the hour in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date localSeconds] - / 60 - % 60 }]]} - } - S { # Second of the minute in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date localSeconds] - % 60 }]]} - } - u { # Day of the week (Monday=1,Sunday=7) - # in alternative numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [dict get $date dayOfWeek]]} - } - w { # Day of the week (Sunday=0,Saturday=6) - # in alternative numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date dayOfWeek] % 7 }]]} - } - y { # Year of the century in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date year] % 100 }]]} - } - default { # Unknown format group - append formatString %%O $char - } - } - } - } - } - - # Clean up any improperly terminated groups - - switch -exact -- $state { - percent { - append formatString %% - } - percentE { - append retval %%E - } - percentO { - append retval %%O - } - } - - proc $procName {clockval timezone} " - $preFormatCode - return \[::format [list $formatString] $substituents\] - " - - # puts [list $procName [info args $procName] [info body $procName]] - - return $procName -} - -#---------------------------------------------------------------------- -# -# clock scan -- -# -# Inputs a count of seconds since the Posix Epoch as a time of day. -# -# The 'clock format' command scans times of day on input. Refer to the user -# documentation to see what it does. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::__org_scan { args } { - - set format {} - - # Check the count of args - - if { [llength $args] < 1 || [llength $args] % 2 != 1 } { - set cmdName "clock scan" - return -code error \ - -errorcode [list CLOCK wrongNumArgs] \ - "wrong \# args: should be\ - \"$cmdName string\ - ?-base seconds?\ - ?-format string? ?-gmt boolean?\ - ?-locale LOCALE? ?-timezone ZONE?\"" - } - - # Set defaults - - set base [clock seconds] - set string [lindex $args 0] - set format {} - set gmt 0 - set locale c - if {[set timezone [configure -system-tz]] eq ""} { - set timezone [GetSystemTimeZone] - } - - # Pick up command line options. - - foreach { flag value } [lreplace $args 0 0] { - set saw($flag) {} - switch -exact -- $flag { - -b - -ba - -bas - -base { - set base $value - } - -f - -fo - -for - -form - -forma - -format { - set format $value - } - -g - -gm - -gmt { - set gmt $value - } - -l - -lo - -loc - -loca - -local - -locale { - set locale [string tolower $value] - } - -t - -ti - -tim - -time - -timez - -timezo - -timezon - -timezone { - set timezone $value - } - default { - return -code error \ - -errorcode [list CLOCK badOption $flag] \ - "bad option \"$flag\",\ - must be -base, -format, -gmt, -locale or -timezone" - } - } - } - - # Check options for validity - - if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { - return -code error \ - -errorcode [list CLOCK gmtWithTimezone] \ - "cannot use -gmt and -timezone in same call" - } - if { [catch { expr { wide($base) } } result] } { - return -code error "expected integer but got \"$base\"" - } - if { ![string is boolean -strict $gmt] } { - return -code error "expected boolean value but got \"$gmt\"" - } elseif { $gmt } { - set timezone :GMT - } - - # Change locale if a fresh locale has been given on the command line. - - EnterLocale $locale - - try { - # Map away the locale-dependent composite format groups - - set scanner [ParseClockScanFormat $format $locale] - return [$scanner $string $base $timezone] - } trap CLOCK {result opts} { - # Conceal location of generation of expected errors - dict unset opts -errorinfo - return -options $opts $result - } -} - -#---------------------------------------------------------------------- -# -# ParseClockScanFormat -- +# GetSystemLocale -- # -# Parses a format string given to [clock scan -format] +# Determines the system locale, which corresponds to "system" +# keyword for locale parameter of 'clock' command. # # Parameters: -# formatString - The format being parsed -# locale - The current locale +# None. # # Results: -# Constructs and returns a procedure that accepts the string being -# scanned, the base time, and the time zone. The procedure will either -# return the scanned time or else throw an error that should be rethrown -# to the caller of [clock scan] +# Returns the system locale. # # Side effects: -# The given procedure is defined in the ::tcl::clock namespace. Scan -# procedures are not deleted once installed. -# -# Why do we parse dates by defining a procedure to parse them? The reason is -# that by doing so, we have one convenient place to cache all the information: -# the regular expressions that match the patterns (which will be compiled), -# the code that assembles the date information, everything lands in one place. -# In this way, when a given format is reused at run time, all the information -# of how to apply it is available in a single place. +# None # #---------------------------------------------------------------------- -proc ::tcl::clock::ParseClockScanFormat {formatString locale} { - # Check whether the format has been parsed previously, and return the - # existing recognizer if it has. - - set procName scanproc'$formatString'$locale - set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName] - if { [namespace which $procName] != {} } { - return $procName - } - - variable DateParseActions - variable TimeParseActions - - # Localize the %x, %X, etc. groups - - set formatString [LocalizeFormat $locale $formatString] - - # Condense whitespace - - regsub -all {[[:space:]]+} $formatString { } formatString - - # Walk through the groups of the format string. In this loop, we - # accumulate: - # - a regular expression that matches the string, - # - the count of capturing brackets in the regexp - # - a set of code that post-processes the fields captured by the regexp, - # - a dictionary whose keys are the names of fields that are present - # in the format string. - - set re {^[[:space:]]*} - set captureCount 0 - set postcode {} - set fieldSet [dict create] - set fieldCount 0 - set postSep {} - set state {} - - foreach c [split $formatString {}] { - switch -exact -- $state { - {} { - if { $c eq "%" } { - set state % - } elseif { $c eq " " } { - append re {[[:space:]]+} - } else { - if { ! [string is alnum $c] } { - append re "\\" - } - append re $c - } - } - % { - set state {} - switch -exact -- $c { - % { - append re % - } - { } { - append re "\[\[:space:\]\]*" - } - a - A { # Day of week, in words - set l {} - foreach \ - i {7 1 2 3 4 5 6} \ - abr [mc DAYS_OF_WEEK_ABBREV] \ - full [mc DAYS_OF_WEEK_FULL] { - dict set l [string tolower $abr] $i - dict set l [string tolower $full] $i - incr i - } - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet dayOfWeek [incr fieldCount] - append postcode "dict set date dayOfWeek \[" \ - "dict get " [list $lookup] " " \ - \[ {string tolower $field} [incr captureCount] \] \ - "\]\n" - } - b - B - h { # Name of month - set i 0 - set l {} - foreach \ - abr [mc MONTHS_ABBREV] \ - full [mc MONTHS_FULL] { - incr i - dict set l [string tolower $abr] $i - dict set l [string tolower $full] $i - } - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet month [incr fieldCount] - append postcode "dict set date month \[" \ - "dict get " [list $lookup] \ - " " \[ {string tolower $field} \ - [incr captureCount] \] \ - "\]\n" - } - C { # Gregorian century - append re \\s*(\\d\\d?) - dict set fieldSet century [incr fieldCount] - append postcode "dict set date century \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - d - e { # Day of month - append re \\s*(\\d\\d?) - dict set fieldSet dayOfMonth [incr fieldCount] - append postcode "dict set date dayOfMonth \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - E { # Prefix for locale-specific codes - set state %E - } - g { # ISO8601 2-digit year - append re \\s*(\\d\\d) - dict set fieldSet iso8601YearOfCentury \ - [incr fieldCount] - append postcode \ - "dict set date iso8601YearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - G { # ISO8601 4-digit year - append re \\s*(\\d\\d)(\\d\\d) - dict set fieldSet iso8601Century [incr fieldCount] - dict set fieldSet iso8601YearOfCentury \ - [incr fieldCount] - append postcode \ - "dict set date iso8601Century \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" \ - "dict set date iso8601YearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - H - k { # Hour of day - append re \\s*(\\d\\d?) - dict set fieldSet hour [incr fieldCount] - append postcode "dict set date hour \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - I - l { # Hour, AM/PM - append re \\s*(\\d\\d?) - dict set fieldSet hourAMPM [incr fieldCount] - append postcode "dict set date hourAMPM \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - j { # Day of year - append re \\s*(\\d\\d?\\d?) - dict set fieldSet dayOfYear [incr fieldCount] - append postcode "dict set date dayOfYear \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - J { # Julian Day Number - append re \\s*(\\d+) - dict set fieldSet julianDay [incr fieldCount] - append postcode "dict set date julianDay \[" \ - "::scan \$field" [incr captureCount] " %ld" \ - "\]\n" - } - m - N { # Month number - append re \\s*(\\d\\d?) - dict set fieldSet month [incr fieldCount] - append postcode "dict set date month \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - M { # Minute - append re \\s*(\\d\\d?) - dict set fieldSet minute [incr fieldCount] - append postcode "dict set date minute \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - n { # Literal newline - append re \\n - } - O { # Prefix for locale numerics - set state %O - } - p - P { # AM/PM indicator - set l [list [string tolower [mc AM]] 0 \ - [string tolower [mc PM]] 1] - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet amPmIndicator [incr fieldCount] - append postcode "dict set date amPmIndicator \[" \ - "dict get " [list $lookup] " \[string tolower " \ - "\$field" \ - [incr captureCount] \ - "\]\]\n" - } - Q { # Hi, Jeff! - append re {Stardate\s+([-+]?\d+)(\d\d\d)[.](\d)} - incr captureCount - dict set fieldSet seconds [incr fieldCount] - append postcode {dict set date seconds } \[ \ - {ParseStarDate $field} [incr captureCount] \ - { $field} [incr captureCount] \ - { $field} [incr captureCount] \ - \] \n - } - s { # Seconds from Posix Epoch - # This next case is insanely difficult, because it's - # problematic to determine whether the field is - # actually within the range of a wide integer. - append re {\s*([-+]?\d+)} - dict set fieldSet seconds [incr fieldCount] - append postcode {dict set date seconds } \[ \ - {ScanWide $field} [incr captureCount] \] \n - } - S { # Second - append re \\s*(\\d\\d?) - dict set fieldSet second [incr fieldCount] - append postcode "dict set date second \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - t { # Literal tab character - append re \\t - } - u - w { # Day number within week, 0 or 7 == Sun - # 1=Mon, 6=Sat - append re \\s*(\\d) - dict set fieldSet dayOfWeek [incr fieldCount] - append postcode {::scan $field} [incr captureCount] \ - { %d dow} \n \ - { - if { $dow == 0 } { - set dow 7 - } elseif { $dow > 7 } { - return -code error \ - -errorcode [list CLOCK badDayOfWeek] \ - "day of week is greater than 7" - } - dict set date dayOfWeek $dow - } - } - U { # Week of year. The first Sunday of - # the year is the first day of week - # 01. No scan rule uses this group. - append re \\s*\\d\\d? - } - V { # Week of ISO8601 year - - append re \\s*(\\d\\d?) - dict set fieldSet iso8601Week [incr fieldCount] - append postcode "dict set date iso8601Week \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - W { # Week of the year (00-53). The first - # Monday of the year is the first day - # of week 01. No scan rule uses this - # group. - append re \\s*\\d\\d? - } - y { # Two-digit Gregorian year - append re \\s*(\\d\\d?) - dict set fieldSet yearOfCentury [incr fieldCount] - append postcode "dict set date yearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - Y { # 4-digit Gregorian year - append re \\s*(\\d\\d)(\\d\\d) - dict set fieldSet century [incr fieldCount] - dict set fieldSet yearOfCentury [incr fieldCount] - append postcode \ - "dict set date century \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" \ - "dict set date yearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - z - Z { # Time zone name - append re {(?:([-+]\d\d(?::?\d\d(?::?\d\d)?)?)|([[:alnum:]]{1,4}))} - dict set fieldSet tzName [incr fieldCount] - append postcode \ - {if } \{ { $field} [incr captureCount] \ - { ne "" } \} { } \{ \n \ - {dict set date tzName $field} \ - $captureCount \n \ - \} { else } \{ \n \ - {dict set date tzName } \[ \ - {ConvertLegacyTimeZone $field} \ - [incr captureCount] \] \n \ - \} \n \ - } - % { # Literal percent character - append re % - } - default { - append re % - if { ! [string is alnum $c] } { - append re \\ - } - append re $c - } - } - } - %E { - switch -exact -- $c { - C { # Locale-dependent era - set d {} - foreach triple [mc LOCALE_ERAS] { - lassign $triple t symbol year - dict set d [string tolower $symbol] $year - } - lassign [UniquePrefixRegexp $d] regex lookup - append re (?: $regex ) - } - E { - set l {} - dict set l [string tolower [mc BCE]] BCE - dict set l [string tolower [mc CE]] CE - dict set l b.c.e. BCE - dict set l c.e. CE - dict set l b.c. BCE - dict set l a.d. CE - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet era [incr fieldCount] - append postcode "dict set date era \["\ - "dict get " [list $lookup] \ - { } \[ {string tolower $field} \ - [incr captureCount] \] \ - "\]\n" - } - y { # Locale-dependent year of the era - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - incr captureCount - } - default { - append re %E - if { ! [string is alnum $c] } { - append re \\ - } - append re $c - } - } - set state {} - } - %O { - switch -exact -- $c { - d - e { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet dayOfMonth [incr fieldCount] - append postcode "dict set date dayOfMonth \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - H - k { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet hour [incr fieldCount] - append postcode "dict set date hour \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - I - l { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet hourAMPM [incr fieldCount] - append postcode "dict set date hourAMPM \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - m { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet month [incr fieldCount] - append postcode "dict set date month \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - M { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet minute [incr fieldCount] - append postcode "dict set date minute \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - S { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet second [incr fieldCount] - append postcode "dict set date second \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - u - w { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet dayOfWeek [incr fieldCount] - append postcode "set dow \[dict get " [list $lookup] \ - { $field} [incr captureCount] \] \n \ - { - if { $dow == 0 } { - set dow 7 - } elseif { $dow > 7 } { - return -code error \ - -errorcode [list CLOCK badDayOfWeek] \ - "day of week is greater than 7" - } - dict set date dayOfWeek $dow - } - } - y { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet yearOfCentury [incr fieldCount] - append postcode {dict set date yearOfCentury } \[ \ - {dict get } [list $lookup] { $field} \ - [incr captureCount] \] \n - } - default { - append re %O - if { ! [string is alnum $c] } { - append re \\ - } - append re $c - } - } - set state {} - } - } - } - - # Clean up any unfinished format groups - - append re $state \\s*\$ - - # Build the procedure - - set procBody {} - append procBody "variable ::tcl::clock::TZData" \n - append procBody "if \{ !\[ regexp -nocase [list $re] \$string ->" - for { set i 1 } { $i <= $captureCount } { incr i } { - append procBody " " field $i - } - append procBody "\] \} \{" \n - append procBody { - return -code error -errorcode [list CLOCK badInputString] \ - {input string does not match supplied format} - } - append procBody \}\n - append procBody "set date \[dict create\]" \n - append procBody {dict set date tzName $timeZone} \n - append procBody $postcode - append procBody [list set changeover [mc GREGORIAN_CHANGE_DATE]] \n - - # Set up the time zone before doing anything with a default base date - # that might need a timezone to interpret it. - - if { ![dict exists $fieldSet seconds] - && ![dict exists $fieldSet starDate] } { - if { [dict exists $fieldSet tzName] } { - append procBody { - set timeZone [dict get $date tzName] - } - } - append procBody { - set timeZone [::tcl::clock::SetupTimeZone $timeZone] - } - } - - # Add code that gets Julian Day Number from the fields. - - append procBody [MakeParseCodeFromFields $fieldSet $DateParseActions] - - # Get time of day - - append procBody [MakeParseCodeFromFields $fieldSet $TimeParseActions] - - # Assemble seconds from the Julian day and second of the day. - # Convert to local time unless epoch seconds or stardate are - # being processed - they're always absolute - - if { ![dict exists $fieldSet seconds] - && ![dict exists $fieldSet starDate] } { - append procBody { - if { [dict get $date julianDay] > 5373484 } { - return -code error -errorcode [list CLOCK dateTooLarge] \ - "requested date too large to represent" - } - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - } - - # Finally, convert the date to local time +proc ::tcl::clock::GetSystemLocale {} { + if { $::tcl_platform(platform) ne {windows} } { + # On a non-windows platform, the 'system' locale is the same as + # the 'current' locale - append procBody { - set date [::tcl::clock::ConvertLocalToUTC $date[set date {}] \ - $timeZone $changeover] - } + return [mclocale] } - # Return result - - append procBody {return [dict get $date seconds]} \n - - proc $procName { string baseTime timeZone } $procBody - - # puts [list proc $procName [list string baseTime timeZone] $procBody] - - return $procName -} + # On a windows platform, the 'system' locale is adapted from the + # 'current' locale by applying the date and time formats from the + # Control Panel. First, load the 'current' locale if it's not yet + # loaded -#---------------------------------------------------------------------- -# -# LocaleNumeralMatcher -- -# -# Composes a regexp that captures the numerals in the given locale, and -# a dictionary to map them to conventional numerals. -# -# Parameters: -# locale - Name of the current locale -# -# Results: -# Returns a two-element list comprising the regexp and the dictionary. -# -# Side effects: -# Caches the result. -# -#---------------------------------------------------------------------- + mcpackagelocale set [mclocale] -proc ::tcl::clock::LocaleNumeralMatcher {l} { - variable LocaleNumeralCache + # Make a new locale string for the system locale, and get the + # Control Panel information - if { ![dict exists $LocaleNumeralCache $l] } { - set d {} - set i 0 - set sep \( - foreach n [mc LOCALE_NUMERALS] { - dict set d $n $i - regsub -all {[^[:alnum:]]} $n \\\\& subex - append re $sep $subex - set sep | - incr i - } - append re \) - dict set LocaleNumeralCache $l [list $re $d] + set locale [mclocale]_windows + if { ! [mcpackagelocale present $locale] } { + LoadWindowsDateTimeFormats $locale } - return [dict get $LocaleNumeralCache $l] -} - - - -#---------------------------------------------------------------------- -# -# UniquePrefixRegexp -- -# -# Composes a regexp that performs unique-prefix matching. The RE -# matches one of a supplied set of strings, or any unique prefix -# thereof. -# -# Parameters: -# data - List of alternating match-strings and values. -# Match-strings with distinct values are considered -# distinct. -# -# Results: -# Returns a two-element list. The first is a regexp that matches any -# unique prefix of any of the strings. The second is a dictionary whose -# keys are match values from the regexp and whose values are the -# corresponding values from 'data'. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::UniquePrefixRegexp { data } { - # The 'successors' dictionary will contain, for each string that is a - # prefix of any key, all characters that may follow that prefix. The - # 'prefixMapping' dictionary will have keys that are prefixes of keys and - # values that correspond to the keys. - - set prefixMapping [dict create] - set successors [dict create {} {}] - - # Walk the key-value pairs - - foreach { key value } $data { - # Construct all prefixes of the key; - - set prefix {} - foreach char [split $key {}] { - set oldPrefix $prefix - dict set successors $oldPrefix $char {} - append prefix $char - - # Put the prefixes in the 'prefixMapping' and 'successors' - # dictionaries - - dict lappend prefixMapping $prefix $value - if { ![dict exists $successors $prefix] } { - dict set successors $prefix {} - } - } - } - - # Identify those prefixes that designate unique values, and those that are - # the full keys - - set uniquePrefixMapping {} - dict for { key valueList } $prefixMapping { - if { [llength $valueList] == 1 } { - dict set uniquePrefixMapping $key [lindex $valueList 0] - } - } - foreach { key value } $data { - dict set uniquePrefixMapping $key $value - } - - # Construct the re. - - return [list \ - [MakeUniquePrefixRegexp $successors $uniquePrefixMapping {}] \ - $uniquePrefixMapping] -} - -#---------------------------------------------------------------------- -# -# MakeUniquePrefixRegexp -- -# -# Service procedure for 'UniquePrefixRegexp' that constructs a regular -# expresison that matches the unique prefixes. -# -# Parameters: -# successors - Dictionary whose keys are all prefixes -# of keys passed to 'UniquePrefixRegexp' and whose -# values are dictionaries whose keys are the characters -# that may follow those prefixes. -# uniquePrefixMapping - Dictionary whose keys are the unique -# prefixes and whose values are not examined. -# prefixString - Current prefix being processed. -# -# Results: -# Returns a constructed regular expression that matches the set of -# unique prefixes beginning with the 'prefixString'. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::MakeUniquePrefixRegexp { successors - uniquePrefixMapping - prefixString } { - - # Get the characters that may follow the current prefix string - - set schars [lsort -ascii [dict keys [dict get $successors $prefixString]]] - if { [llength $schars] == 0 } { - return {} - } - - # If there is more than one successor character, or if the current prefix - # is a unique prefix, surround the generated re with non-capturing - # parentheses. - - set re {} - if { - [dict exists $uniquePrefixMapping $prefixString] - || [llength $schars] > 1 - } then { - append re "(?:" - } - - # Generate a regexp that matches the successors. - - set sep "" - foreach { c } $schars { - set nextPrefix $prefixString$c - regsub -all {[^[:alnum:]]} $c \\\\& rechar - append re $sep $rechar \ - [MakeUniquePrefixRegexp \ - $successors $uniquePrefixMapping $nextPrefix] - set sep | - } - - # If the current prefix is a unique prefix, make all following text - # optional. Otherwise, if there is more than one successor character, - # close the non-capturing parentheses. - - if { [dict exists $uniquePrefixMapping $prefixString] } { - append re ")?" - } elseif { [llength $schars] > 1 } { - append re ")" - } - - return $re -} - -#---------------------------------------------------------------------- -# -# MakeParseCodeFromFields -- -# -# Composes Tcl code to extract the Julian Day Number from a dictionary -# containing date fields. -# -# Parameters: -# dateFields -- Dictionary whose keys are fields of the date, -# and whose values are the rightmost positions -# at which those fields appear. -# parseActions -- List of triples: field set, priority, and -# code to emit. Smaller priorities are better, and -# the list must be in ascending order by priority -# -# Results: -# Returns a burst of code that extracts the day number from the given -# date. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::MakeParseCodeFromFields { dateFields parseActions } { - - set currPrio 999 - set currFieldPos [list] - set currCodeBurst { - error "in ::tcl::clock::MakeParseCodeFromFields: can't happen" - } - - foreach { fieldSet prio parseAction } $parseActions { - # If we've found an answer that's better than any that follow, quit - # now. - - if { $prio > $currPrio } { - break - } - - # Accumulate the field positions that are used in the current field - # grouping. - - set fieldPos [list] - set ok true - foreach field $fieldSet { - if { ! [dict exists $dateFields $field] } { - set ok 0 - break - } - lappend fieldPos [dict get $dateFields $field] - } - - # Quit if we don't have a complete set of fields - if { !$ok } { - continue - } - - # Determine whether the current answer is better than the last. - - set fPos [lsort -integer -decreasing $fieldPos] - - if { $prio == $currPrio } { - foreach currPos $currFieldPos newPos $fPos { - if { - ![string is integer $newPos] - || ![string is integer $currPos] - || $newPos > $currPos - } then { - break - } - if { $newPos < $currPos } { - set ok 0 - break - } - } - } - if { !$ok } { - continue - } - - # Remember the best possibility for extracting date information - - set currPrio $prio - set currFieldPos $fPos - set currCodeBurst $parseAction - } - - return $currCodeBurst -} - -#---------------------------------------------------------------------- -# -# GetSystemTimeZone -- -# -# Determines the system time zone, which is the default for the -# 'clock' command if no other zone is supplied. -# -# Parameters: -# None. -# -# Results: -# Returns the system time zone. -# -# Side effects: -# Stores the sustem time zone in engine configuration, since -# determining it may be an expensive process. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::GetSystemLocale {} { - if { $::tcl_platform(platform) ne {windows} } { - # On a non-windows platform, the 'system' locale is the same as - # the 'current' locale - - return [mclocale] - } - - # On a windows platform, the 'system' locale is adapted from the - # 'current' locale by applying the date and time formats from the - # Control Panel. First, load the 'current' locale if it's not yet - # loaded - - mcpackagelocale set [mclocale] - - # Make a new locale string for the system locale, and get the - # Control Panel information - - set locale [mclocale]_windows - if { ! [mcpackagelocale present $locale] } { - LoadWindowsDateTimeFormats $locale - } - - return $locale -} - -#---------------------------------------------------------------------- -# -# EnterLocale -- -# -# Switch [mclocale] to a given locale if necessary -# -# Parameters: -# locale -- Desired locale -# -# Results: -# Returns the locale that was previously current. -# -# Side effects: -# Does [mclocale]. If necessary, loades the designated locale's files. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::EnterLocale { locale } { - switch -- $locale system { - set locale [GetSystemLocale] - } current { - set locale [mclocale] - } - # Select the locale, eventually load it - mcpackagelocale set $locale - return $locale -} - -#---------------------------------------------------------------------- -# -# LoadWindowsDateTimeFormats -- -# -# Load the date/time formats from the Control Panel in Windows and -# convert them so that they're usable by Tcl. -# -# Parameters: -# locale - Name of the locale in whose message catalog -# the converted formats are to be stored. -# -# Results: -# None. -# -# Side effects: -# Updates the given message catalog with the locale strings. -# -# Presumes that on entry, [mclocale] is set to the current locale, so that -# default strings can be obtained if the Registry query fails. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } { - # Bail out if we can't find the Registry - - variable NoRegistry - if { [info exists NoRegistry] } return - - if { ![catch { - registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ - sShortDate - } string] } { - set quote {} - set datefmt {} - foreach { unquoted quoted } [split $string '] { - append datefmt $quote [string map { - dddd %A - ddd %a - dd %d - d %e - MMMM %B - MMM %b - MM %m - M %N - yyyy %Y - yy %y - y %y - gg {} - } $unquoted] - if { $quoted eq {} } { - set quote ' - } else { - set quote $quoted - } - } - ::msgcat::mcset $locale DATE_FORMAT $datefmt - } - - if { ![catch { - registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ - sLongDate - } string] } { - set quote {} - set ldatefmt {} - foreach { unquoted quoted } [split $string '] { - append ldatefmt $quote [string map { - dddd %A - ddd %a - dd %d - d %e - MMMM %B - MMM %b - MM %m - M %N - yyyy %Y - yy %y - y %y - gg {} - } $unquoted] - if { $quoted eq {} } { - set quote ' - } else { - set quote $quoted - } - } - ::msgcat::mcset $locale LOCALE_DATE_FORMAT $ldatefmt - } - - if { ![catch { - registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ - sTimeFormat - } string] } { - set quote {} - set timefmt {} - foreach { unquoted quoted } [split $string '] { - append timefmt $quote [string map { - HH %H - H %k - hh %I - h %l - mm %M - m %M - ss %S - s %S - tt %p - t %p - } $unquoted] - if { $quoted eq {} } { - set quote ' - } else { - set quote $quoted - } - } - ::msgcat::mcset $locale TIME_FORMAT $timefmt - } - - catch { - ::msgcat::mcset $locale DATE_TIME_FORMAT "$datefmt $timefmt" - } - catch { - ::msgcat::mcset $locale LOCALE_DATE_TIME_FORMAT "$ldatefmt $timefmt" - } - - return - -} - -#---------------------------------------------------------------------- -# -# LocalizeFormat -- -# -# Map away locale-dependent format groups in a clock format. -# -# Parameters: -# locale -- Current [mclocale] locale, supplied to avoid -# an extra call -# format -- Format supplied to [clock scan] or [clock format] -# -# Results: -# Returns the string with locale-dependent composite format groups -# substituted out. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { - variable LocaleFormats - - if { $fmtkey eq {} } { set fmtkey FMT_$format } - if { [catch { - set locfmt [dict get $LocaleFormats $locale $fmtkey] - }] } { - - # get map list cached or build it: - if { [catch { - set mlst [dict get $LocaleFormats $locale MLST] - }] } { - - # message catalog dictionary: - set mcd [mcget $locale] - - # Handle locale-dependent format groups by mapping them out of the format - # string. Note that the order of the [string map] operations is - # significant because later formats can refer to later ones; for example - # %c can refer to %X, which in turn can refer to %T. - - set mlst { - %% %% - %D %m/%d/%Y - %+ {%a %b %e %H:%M:%S %Z %Y} - } - lappend mlst %EY [string map $mlst [dict get $mcd LOCALE_YEAR_FORMAT]] - lappend mlst %T [string map $mlst [dict get $mcd TIME_FORMAT_24_SECS]] - lappend mlst %R [string map $mlst [dict get $mcd TIME_FORMAT_24]] - lappend mlst %r [string map $mlst [dict get $mcd TIME_FORMAT_12]] - lappend mlst %X [string map $mlst [dict get $mcd TIME_FORMAT]] - lappend mlst %EX [string map $mlst [dict get $mcd LOCALE_TIME_FORMAT]] - lappend mlst %x [string map $mlst [dict get $mcd DATE_FORMAT]] - lappend mlst %Ex [string map $mlst [dict get $mcd LOCALE_DATE_FORMAT]] - lappend mlst %c [string map $mlst [dict get $mcd DATE_TIME_FORMAT]] - lappend mlst %Ec [string map $mlst [dict get $mcd LOCALE_DATE_TIME_FORMAT]] - - dict set LocaleFormats $locale MLST $mlst - } - - # translate copy of format (don't use format object here, because otherwise - # it can lose its internal representation (string map - convert to unicode) - set locfmt [string map $mlst [string range " $format" 1 end]] - - # cache it: - dict set LocaleFormats $locale $fmtkey $locfmt - } - - # Save original format as long as possible, because of internal - # representation (performance). - # Note that in this case such format will be never localized (also - # using another locales). To prevent this return a duplicate (but - # it may be slower). - if {$locfmt eq $format} { - set locfmt $format - } - - return $locfmt -} - -#---------------------------------------------------------------------- -# -# FormatNumericTimeZone -- -# -# Formats a time zone as +hhmmss -# -# Parameters: -# z - Time zone in seconds east of Greenwich -# -# Results: -# Returns the time zone formatted in a numeric form -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::FormatNumericTimeZone { z } { - if { $z < 0 } { - set z [expr { - $z }] - set retval - - } else { - set retval + - } - append retval [::format %02d [expr { $z / 3600 }]] - set z [expr { $z % 3600 }] - append retval [::format %02d [expr { $z / 60 }]] - set z [expr { $z % 60 }] - if { $z != 0 } { - append retval [::format %02d $z] - } - return $retval -} - -#---------------------------------------------------------------------- -# -# FormatStarDate -- -# -# Formats a date as a StarDate. -# -# Parameters: -# date - Dictionary containing 'year', 'dayOfYear', and -# 'localSeconds' fields. -# -# Results: -# Returns the given date formatted as a StarDate. -# -# Side effects: -# None. -# -# Jeff Hobbs put this in to support an atrocious pun about Tcl being -# "Enterprise ready." Now we're stuck with it. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::FormatStarDate { date } { - variable Roddenberry - - # Get day of year, zero based - - set doy [expr { [dict get $date dayOfYear] - 1 }] - - # Determine whether the year is a leap year - - set lp [IsGregorianLeapYear $date] - - # Convert day of year to a fractional year - - if { $lp } { - set fractYear [expr { 1000 * $doy / 366 }] - } else { - set fractYear [expr { 1000 * $doy / 365 }] - } - - # Put together the StarDate - - return [::format "Stardate %02d%03d.%1d" \ - [expr { [dict get $date year] - $Roddenberry }] \ - $fractYear \ - [expr { [dict get $date localSeconds] % 86400 - / ( 86400 / 10 ) }]] -} - -#---------------------------------------------------------------------- -# -# ParseStarDate -- -# -# Parses a StarDate -# -# Parameters: -# year - Year from the Roddenberry epoch -# fractYear - Fraction of a year specifiying the day of year. -# fractDay - Fraction of a day -# -# Results: -# Returns a count of seconds from the Posix epoch. -# -# Side effects: -# None. -# -# Jeff Hobbs put this in to support an atrocious pun about Tcl being -# "Enterprise ready." Now we're stuck with it. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ParseStarDate { year fractYear fractDay } { - variable Roddenberry - - # Build a tentative date from year and fraction. - - set date [dict create \ - gregorian 1 \ - era CE \ - year [expr { $year + $Roddenberry }] \ - dayOfYear [expr { $fractYear * 365 / 1000 + 1 }]] - set date [GetJulianDayFromGregorianEraYearDay $date[set date {}]] - - # Determine whether the given year is a leap year - - set lp [IsGregorianLeapYear $date] - - # Reconvert the fractional year according to whether the given year is a - # leap year - - if { $lp } { - dict set date dayOfYear \ - [expr { $fractYear * 366 / 1000 + 1 }] - } else { - dict set date dayOfYear \ - [expr { $fractYear * 365 / 1000 + 1 }] - } - dict unset date julianDay - dict unset date gregorian - set date [GetJulianDayFromGregorianEraYearDay $date[set date {}]] - - return [expr { - 86400 * [dict get $date julianDay] - - 210866803200 - + ( 86400 / 10 ) * $fractDay - }] -} - -#---------------------------------------------------------------------- -# -# ScanWide -- -# -# Scans a wide integer from an input -# -# Parameters: -# str - String containing a decimal wide integer -# -# Results: -# Returns the string as a pure wide integer. Throws an error if the -# string is misformatted or out of range. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ScanWide { str } { - set count [::scan $str {%ld %c} result junk] - if { $count != 1 } { - return -code error -errorcode [list CLOCK notAnInteger $str] \ - "\"$str\" is not an integer" - } - if { [incr result 0] != $str } { - return -code error -errorcode [list CLOCK integervalueTooLarge] \ - "integer value too large to represent" - } - return $result -} - -#---------------------------------------------------------------------- -# -# InterpretTwoDigitYear -- -# -# Given a date that contains only the year of the century, determines -# the target value of a two-digit year. -# -# Parameters: -# date - Dictionary containing fields of the date. -# baseTime - Base time relative to which the date is expressed. -# twoDigitField - Name of the field that stores the two-digit year. -# Default is 'yearOfCentury' -# fourDigitField - Name of the field that will receive the four-digit -# year. Default is 'year' -# -# Results: -# Returns the dictionary augmented with the four-digit year, stored in -# the given key. -# -# Side effects: -# None. -# -# The current rule for interpreting a two-digit year is that the year shall be -# between 1937 and 2037, thus staying within the range of a 32-bit signed -# value for time. This rule may change to a sliding window in future -# versions, so the 'baseTime' parameter (which is currently ignored) is -# provided in the procedure signature. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::InterpretTwoDigitYear { date baseTime - { twoDigitField yearOfCentury } - { fourDigitField year } } { - set yr [dict get $date $twoDigitField] - if { $yr >= [configure -century-switch] } { - incr yr -100 - } - incr yr [configure -year-century] - dict set date $fourDigitField $yr - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseYear -- -# -# Places the number of the current year into a dictionary. -# -# Parameters: -# date - Dictionary value to update -# baseTime - Base time from which to extract the year, expressed -# in seconds from the Posix epoch -# timezone - the time zone in which the date is being scanned -# changeover - the Julian Day on which the Gregorian calendar -# was adopted in the target locale. -# -# Results: -# Returns the dictionary with the current year assigned. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseYear { date baseTime timezone changeover } { - variable TZData - - # Find the Julian Day Number corresponding to the base time, and - # find the Gregorian year corresponding to that Julian Day. - - set date2 [GetDateFields $baseTime $timezone $changeover] - - # Store the converted year - - dict set date era [dict get $date2 era] - dict set date year [dict get $date2 year] - - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseIso8601Year -- -# -# Determines the base year in the ISO8601 fiscal calendar. -# -# Parameters: -# date - Dictionary containing the fields of the date that -# is to be augmented with the base year. -# baseTime - Base time expressed in seconds from the Posix epoch. -# timeZone - Target time zone -# changeover - Julian Day of adoption of the Gregorian calendar in -# the target locale. -# -# Results: -# Returns the given date with "iso8601Year" set to the -# base year. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseIso8601Year {date baseTime timeZone changeover} { - variable TZData - - # Find the Julian Day Number corresponding to the base time - - set date2 [GetDateFields $baseTime $timeZone $changeover] - - # Calculate the ISO8601 date and transfer the year - - dict set date era CE - dict set date iso8601Year [dict get $date2 iso8601Year] - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseMonth -- -# -# Places the number of the current year and month into a -# dictionary. -# -# Parameters: -# date - Dictionary value to update -# baseTime - Time from which the year and month are to be -# obtained, expressed in seconds from the Posix epoch. -# timezone - Name of the desired time zone -# changeover - Julian Day on which the Gregorian calendar was adopted. -# -# Results: -# Returns the dictionary with the base year and month assigned. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseMonth {date baseTime timezone changeover} { - variable TZData - - # Find the year and month corresponding to the base time - - set date2 [GetDateFields $baseTime $timezone $changeover] - dict set date era [dict get $date2 era] - dict set date year [dict get $date2 year] - dict set date month [dict get $date2 month] - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseWeek -- -# -# Determines the base year and week in the ISO8601 fiscal calendar. -# -# Parameters: -# date - Dictionary containing the fields of the date that -# is to be augmented with the base year and week. -# baseTime - Base time expressed in seconds from the Posix epoch. -# changeover - Julian Day on which the Gregorian calendar was adopted -# in the target locale. -# -# Results: -# Returns the given date with "iso8601Year" set to the -# base year and "iso8601Week" to the week number. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseWeek {date baseTime timeZone changeover} { - variable TZData - - # Find the Julian Day Number corresponding to the base time - - set date2 [GetDateFields $baseTime $timeZone $changeover] - - # Calculate the ISO8601 date and transfer the year - dict set date era CE - dict set date iso8601Year [dict get $date2 iso8601Year] - dict set date iso8601Week [dict get $date2 iso8601Week] - return $date + return $locale } #---------------------------------------------------------------------- # -# AssignBaseJulianDay -- +# EnterLocale -- # -# Determines the base day for a time-of-day conversion. +# Switch [mclocale] to a given locale if necessary # # Parameters: -# date - Dictionary that is to get the base day -# baseTime - Base time expressed in seconds from the Posix epoch -# changeover - Julian day on which the Gregorian calendar was -# adpoted in the target locale. +# locale -- Desired locale # # Results: -# Returns the given dictionary augmented with a 'julianDay' field -# that contains the base day. +# Returns the locale that was previously current. # # Side effects: -# None. +# Does [mclocale]. If necessary, loades the designated locale's files. # #---------------------------------------------------------------------- -proc ::tcl::clock::AssignBaseJulianDay { date baseTime timeZone changeover } { - variable TZData - - # Find the Julian Day Number corresponding to the base time - - set date2 [GetDateFields $baseTime $timeZone $changeover] - dict set date julianDay [dict get $date2 julianDay] - - return $date +proc ::tcl::clock::EnterLocale { locale } { + switch -- $locale system { + set locale [GetSystemLocale] + } current { + set locale [mclocale] + } + # Select the locale, eventually load it + mcpackagelocale set $locale + return $locale } #---------------------------------------------------------------------- # -# InterpretHMSP -- +# LoadWindowsDateTimeFormats -- # -# Interprets a time in the form "hh:mm:ss am". +# Load the date/time formats from the Control Panel in Windows and +# convert them so that they're usable by Tcl. # # Parameters: -# date -- Dictionary containing "hourAMPM", "minute", "second" -# and "amPmIndicator" fields. +# locale - Name of the locale in whose message catalog +# the converted formats are to be stored. # # Results: -# Returns the number of seconds from local midnight. +# None. # # Side effects: -# None. +# Updates the given message catalog with the locale strings. +# +# Presumes that on entry, [mclocale] is set to the current locale, so that +# default strings can be obtained if the Registry query fails. # #---------------------------------------------------------------------- -proc ::tcl::clock::InterpretHMSP { date } { - set hr [dict get $date hourAMPM] - if { $hr == 12 } { - set hr 0 +proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } { + # Bail out if we can't find the Registry + + variable NoRegistry + if { [info exists NoRegistry] } return + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sShortDate + } string] } { + set quote {} + set datefmt {} + foreach { unquoted quoted } [split $string '] { + append datefmt $quote [string map { + dddd %A + ddd %a + dd %d + d %e + MMMM %B + MMM %b + MM %m + M %N + yyyy %Y + yy %y + y %y + gg {} + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale DATE_FORMAT $datefmt + } + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sLongDate + } string] } { + set quote {} + set ldatefmt {} + foreach { unquoted quoted } [split $string '] { + append ldatefmt $quote [string map { + dddd %A + ddd %a + dd %d + d %e + MMMM %B + MMM %b + MM %m + M %N + yyyy %Y + yy %y + y %y + gg {} + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale LOCALE_DATE_FORMAT $ldatefmt + } + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sTimeFormat + } string] } { + set quote {} + set timefmt {} + foreach { unquoted quoted } [split $string '] { + append timefmt $quote [string map { + HH %H + H %k + hh %I + h %l + mm %M + m %M + ss %S + s %S + tt %p + t %p + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale TIME_FORMAT $timefmt + } + + catch { + ::msgcat::mcset $locale DATE_TIME_FORMAT "$datefmt $timefmt" } - if { [dict get $date amPmIndicator] } { - incr hr 12 + catch { + ::msgcat::mcset $locale LOCALE_DATE_TIME_FORMAT "$ldatefmt $timefmt" } - dict set date hour $hr - return [InterpretHMS $date[set date {}]] + + return + } #---------------------------------------------------------------------- # -# InterpretHMS -- +# LocalizeFormat -- # -# Interprets a 24-hour time "hh:mm:ss" +# Map away locale-dependent format groups in a clock format. # # Parameters: -# date -- Dictionary containing the "hour", "minute" and "second" -# fields. +# locale -- Current [mclocale] locale, supplied to avoid +# an extra call +# format -- Format supplied to [clock scan] or [clock format] # # Results: -# Returns the given dictionary augmented with a "secondOfDay" -# field containing the number of seconds from local midnight. +# Returns the string with locale-dependent composite format groups +# substituted out. # # Side effects: # None. # #---------------------------------------------------------------------- -proc ::tcl::clock::InterpretHMS { date } { - return [expr { - ( [dict get $date hour] * 60 - + [dict get $date minute] ) * 60 - + [dict get $date second] - }] +proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { + variable LocaleFormats + + if { $fmtkey eq {} } { set fmtkey FMT_$format } + if { [catch { + set locfmt [dict get $LocaleFormats $locale $fmtkey] + }] } { + + # get map list cached or build it: + if { [catch { + set mlst [dict get $LocaleFormats $locale MLST] + }] } { + + # message catalog dictionary: + set mcd [mcget $locale] + + # Handle locale-dependent format groups by mapping them out of the format + # string. Note that the order of the [string map] operations is + # significant because later formats can refer to later ones; for example + # %c can refer to %X, which in turn can refer to %T. + + set mlst { + %% %% + %D %m/%d/%Y + %+ {%a %b %e %H:%M:%S %Z %Y} + } + lappend mlst %EY [string map $mlst [dict get $mcd LOCALE_YEAR_FORMAT]] + lappend mlst %T [string map $mlst [dict get $mcd TIME_FORMAT_24_SECS]] + lappend mlst %R [string map $mlst [dict get $mcd TIME_FORMAT_24]] + lappend mlst %r [string map $mlst [dict get $mcd TIME_FORMAT_12]] + lappend mlst %X [string map $mlst [dict get $mcd TIME_FORMAT]] + lappend mlst %EX [string map $mlst [dict get $mcd LOCALE_TIME_FORMAT]] + lappend mlst %x [string map $mlst [dict get $mcd DATE_FORMAT]] + lappend mlst %Ex [string map $mlst [dict get $mcd LOCALE_DATE_FORMAT]] + lappend mlst %c [string map $mlst [dict get $mcd DATE_TIME_FORMAT]] + lappend mlst %Ec [string map $mlst [dict get $mcd LOCALE_DATE_TIME_FORMAT]] + + dict set LocaleFormats $locale MLST $mlst + } + + # translate copy of format (don't use format object here, because otherwise + # it can lose its internal representation (string map - convert to unicode) + set locfmt [string map $mlst [string range " $format" 1 end]] + + # cache it: + dict set LocaleFormats $locale $fmtkey $locfmt + } + + # Save original format as long as possible, because of internal + # representation (performance). + # Note that in this case such format will be never localized (also + # using another locales). To prevent this return a duplicate (but + # it may be slower). + if {$locfmt eq $format} { + set locfmt $format + } + + return $locfmt } #---------------------------------------------------------------------- @@ -2891,38 +857,6 @@ proc ::tcl::clock::GetSystemTimeZone {} { #---------------------------------------------------------------------- # -# ConvertLegacyTimeZone -- -# -# Given an alphanumeric time zone identifier and the system time zone, -# convert the alphanumeric identifier to an unambiguous time zone. -# -# Parameters: -# tzname - Name of the time zone to convert -# -# Results: -# Returns a time zone name corresponding to tzname, but in an -# unambiguous form, generally +hhmm. -# -# This procedure is implemented primarily to allow the parsing of RFC822 -# date/time strings. Processing a time zone name on input is not recommended -# practice, because there is considerable room for ambiguity; for instance, is -# BST Brazilian Standard Time, or British Summer Time? -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ConvertLegacyTimeZone { tzname } { - variable LegacyTimeZone - - set tzname [string tolower $tzname] - if { ![dict exists $LegacyTimeZone $tzname] } { - return -code error -errorcode [list CLOCK badTZName $tzname] \ - "time zone \"$tzname\" not found" - } - return [dict get $LegacyTimeZone $tzname] -} - -#---------------------------------------------------------------------- -# # SetupTimeZone -- # # Given the name or specification of a time zone, sets up its in-memory @@ -3837,43 +1771,6 @@ proc ::tcl::clock::DeterminePosixDSTTime { z bound y } { #---------------------------------------------------------------------- # -# GetLocaleEra -- -# -# Given local time expressed in seconds from the Posix epoch, -# determine localized era and year within the era. -# -# Parameters: -# date - Dictionary that must contain the keys, 'localSeconds', -# whose value is expressed as the appropriate local time; -# and 'year', whose value is the Gregorian year. -# etable - Value of the LOCALE_ERAS key in the message catalogue -# for the target locale. -# -# Results: -# Returns the dictionary, augmented with the keys, 'localeEra' and -# 'localeYear'. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::GetLocaleEra { date etable } { - set index [BSearch $etable [dict get $date localSeconds]] - if { $index < 0} { - dict set date localeEra \ - [::format %02d [expr { [dict get $date year] / 100 }]] - dict set date localeYear [expr { - [dict get $date year] % 100 - }] - } else { - dict set date localeEra [lindex $etable $index 1] - dict set date localeYear [expr { - [dict get $date year] - [lindex $etable $index 2] - }] - } - return $date -} - -#---------------------------------------------------------------------- -# # GetJulianDayFromEraYearDay -- # # Given a year, month and day on the Gregorian calendar, determines @@ -4051,57 +1948,6 @@ proc ::tcl::clock::WeekdayOnOrBefore { weekday j } { #---------------------------------------------------------------------- # -# BSearch -- -# -# Service procedure that does binary search in several places inside the -# 'clock' command. -# -# Parameters: -# list - List of lists, sorted in ascending order by the -# first elements -# key - Value to search for -# -# Results: -# Returns the index of the greatest element in $list that is less than -# or equal to $key. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::BSearch { list key } { - if {[llength $list] == 0} { - return -1 - } - if { $key < [lindex $list 0 0] } { - return -1 - } - - set l 0 - set u [expr { [llength $list] - 1 }] - - while { $l < $u } { - # At this point, we know that - # $k >= [lindex $list $l 0] - # Either $u == [llength $list] or else $k < [lindex $list $u+1 0] - # We find the midpoint of the interval {l,u} rounded UP, compare - # against it, and set l or u to maintain the invariant. Note that the - # interval shrinks at each step, guaranteeing convergence. - - set m [expr { ( $l + $u + 1 ) / 2 }] - if { $key >= [lindex $list $m 0] } { - set l $m - } else { - set u [expr { $m - 1 }] - } - } - - return $l -} - -#---------------------------------------------------------------------- -# # clock add -- # # Adds an offset to a given time. diff --git a/library/init.tcl b/library/init.tcl index 6f34302..f1f1bb4 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add LocalizeFormat SetupTimeZone GetSystemTimeZone} { + foreach cmd {add mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] -- cgit v0.12 From 866efbc90481ea60325dd2439e321f0d8280c826 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:52:12 +0000 Subject: some greedy matches are fixed (see test cases clock-6.22.11 and clock-6.22.12), involving space count in look ahead and end distance calculation (because spaces are optional in date-time string as well as in scanning format). --- generic/tclClockFmt.c | 121 ++++++++++++++++++++++++++++++++------------------ generic/tclDate.h | 2 + tests/clock.test | 37 +++++++++++++++ 3 files changed, 117 insertions(+), 43 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 307fc28..00ea0ed 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -723,24 +723,36 @@ inline void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok, int *minLen, int *maxLen) { - register const char*p = yyInput; + register const char *p = yyInput, + *end = info->dateEnd; *minLen = 0; - /* max length to the end regarding distance to end (min-width of following tokens) */ - *maxLen = info->dateEnd - p - tok->endDistance; - /* if no tokens anymore */ - if (!(tok+1)->map) { - /* should match to end or first space */ - while (!isspace(UCHAR(*p)) && ++p < info->dateEnd) {}; - *minLen = p - yyInput; - } else - /* next token is a word */ - if ((tok+1)->map->type == CTOKT_WORD) { - /* should match at least to the first char of this word */ - while (*p != *((tok+1)->tokWord.start) && ++p < info->dateEnd) {}; - *minLen = p - yyInput; + /* if still tokens available */ + if ((tok+1)->map) { + end -= tok->endDistance + yySpaceCount; + /* next token is a word */ + switch ((tok+1)->map->type) { + case CTOKT_WORD: + /* should match at least to the first char of this word */ + while (*p != *((tok+1)->tokWord.start) && ++p < end) {}; + *minLen = p - yyInput; + break; + case CTOKT_CHAR: + while (*p != *((char *)(tok+1)->map->data) && ++p < end) {}; + *minLen = p - yyInput; + break; + } } + /* max length to the end regarding distance to end (min-width of following tokens) */ + *maxLen = end - p; + if (*maxLen > tok->map->maxSize) { + *maxLen = tok->map->maxSize; + }; + + if (*minLen < tok->map->minSize) { + *minLen = tok->map->minSize; + } if (*minLen > *maxLen) { *maxLen = *minLen; } @@ -1384,7 +1396,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ - {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, 0, ClockScnToken_Month_Proc}, /* %y */ {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), @@ -1402,7 +1414,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, /* %p %P */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, ClockScnToken_amPmInd_Proc, NULL}, /* %J */ {CTOKT_DIGIT, CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), @@ -1423,10 +1435,10 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), NULL}, /* %a %A %u %w */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, ClockScnToken_DayOfWeek_Proc, NULL}, /* %z %Z */ - {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0xffff, 0, ClockScnToken_TimeZone_Proc, NULL}, /* %U %W */ {CTOKT_DIGIT, CLF_OPTIONAL, 0, 1, 2, 0, /* currently no capture, parse only token */ @@ -1435,9 +1447,9 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), NULL}, /* %n */ - {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, + {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\n"}, /* min=0 - spaces are optional (in yySpaceCount) */ /* %t */ - {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, + {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\t"}, /* min=0 - spaces are optional (in yySpaceCount) */ /* %Q */ {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, ClockScnToken_StarDate_Proc, NULL}, @@ -1451,10 +1463,10 @@ static const char *ScnETokenMapIndex = "Eys"; static ClockScanTokenMap ScnETokenMap[] = { /* %EE */ - {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateInfo, date.year), + {CTOKT_PARSER, 0, 0, 0, 0xffff, TclOffset(DateInfo, date.year), ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ey */ - {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ + {CTOKT_PARSER, 0, 0, 0, 0xffff, 0, /* currently no capture, parse only token */ ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Es */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), @@ -1469,25 +1481,25 @@ static const char *ScnOTokenMapIndex = "dmyHMSu"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ - {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.dayOfMonth), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateInfo, date.month), + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.month), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Oy */ - {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateInfo, date.year), + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0xffff, TclOffset(DateInfo, date.year), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OH %Ok %OI %Ol */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.hour), + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.hour), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OM */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.minutes), + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.minutes), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OS */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.secondOfDay), + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.secondOfDay), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ou Ow */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenMapAliasIndex[2] = { @@ -1498,12 +1510,12 @@ static const char *ScnOTokenMapAliasIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, + {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, /* min=0 - spaces are optional (in yySpaceCount) */ NULL}, }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 0, 1, 0, 0, + CTOKT_WORD, 0, 0, 1, 0xffff, 0, NULL }; @@ -1739,7 +1751,22 @@ ClockScan( p++; } } - info->dateStart = yyInput = p; + yyInput = p; + /* look ahead to count spaces (bypass it by count length and distances) */ + x = end; + while (p < end) { + if (isspace(UCHAR(*p))) { + x = p++; + yySpaceCount++; + continue; + } + x = end; + p++; + } + /* ignore spaces at end */ + yySpaceCount -= (end - x); + end = x; + info->dateStart = p = yyInput; info->dateEnd = end; /* parse string */ @@ -1752,6 +1779,7 @@ ClockScan( && map->type != CTOKT_CHAR ) ) { while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; p++; } } @@ -1764,16 +1792,17 @@ ClockScan( { case CTOKT_DIGIT: if (1) { - int size = map->maxSize; + int minLen, size; int sign = 1; if (map->flags & CLF_SIGNED) { if (*p == '+') { yyInput = ++p; } else if (*p == '-') { yyInput = ++p; sign = -1; }; } + DetermineGreedySearchLen(opts, info, tok, &minLen, &size); /* greedy find digits (look for forward digits consider spaces), * corresponding pre-calculated lookAhead */ - if (size != map->minSize && tok->lookAhead) { + if (size != minLen && tok->lookAhead) { int spcnt = 0; const char *pe; size += tok->lookAhead; @@ -1845,6 +1874,12 @@ ClockScan( goto done; break; }; + /* decrement count for possible spaces in match */ + while (p < yyInput) { + if (isspace(UCHAR(*p++))) { + yySpaceCount--; + } + } p = yyInput; flags = (flags & ~map->clearFlags) | map->flags; break; @@ -1855,9 +1890,11 @@ ClockScan( /* unmatched -> error */ goto not_match; } + yySpaceCount--; p++; } while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; p++; } break; @@ -1875,27 +1912,25 @@ ClockScan( /* no match -> error */ goto not_match; } + if (isspace(UCHAR(*x))) { + yySpaceCount--; + } p++; break; } } /* check end was reached */ if (p < end) { - /* ignore spaces at end */ - while (p < end && isspace(UCHAR(*p))) { - p++; - } - if (p < end) { - /* something after last token - wrong format */ - goto not_match; - } + /* something after last token - wrong format */ + goto not_match; } /* end of string, check only optional tokens at end, otherwise - not match */ while (tok->map != NULL) { if (!(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE)) { tok++; + if (tok->map == NULL) break; } - if (tok->map != NULL && !(tok->map->flags & CLF_OPTIONAL)) { + if (!(tok->map->flags & CLF_OPTIONAL)) { goto not_match; } tok++; diff --git a/generic/tclDate.h b/generic/tclDate.h index 2ce629d..519a3e5 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -204,6 +204,7 @@ typedef struct DateInfo { time_t *dateRelPointer; + time_t dateSpaceCount; time_t dateDigitCount; time_t dateCentury; @@ -241,6 +242,7 @@ typedef struct DateInfo { #define yyRelPointer (info->dateRelPointer) #define yyInput (info->dateInput) #define yyDigitCount (info->dateDigitCount) +#define yySpaceCount (info->dateSpaceCount) inline void ClockInitDateInfo(DateInfo *info) { diff --git a/tests/clock.test b/tests/clock.test index 4b0587a..46a2b29 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18638,6 +18638,43 @@ test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and unset -nocomplain wrong i i2 s d } +test clock-6.22.1 {Greedy match} { + clock format [clock scan "111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 00:00:00 GMT 2001} +test clock-6.22.2 {Greedy match} { + clock format [clock scan "1111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Jan 11 00:00:00 GMT 2001} +test clock-6.22.3 {Greedy match} { + clock format [clock scan "11111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Sun Nov 11 00:00:00 GMT 2001} +test clock-6.22.4 {Greedy match} { + clock format [clock scan "111111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Fri Nov 11 00:00:00 GMT 2011} +test clock-6.22.5 {Greedy match} { + clock format [clock scan "1 1 1" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 00:00:00 GMT 2001} +test clock-6.22.6 {Greedy match} { + clock format [clock scan "111 1" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Jan 11 00:00:00 GMT 2001} +test clock-6.22.7 {Greedy match} { + clock format [clock scan "1 111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Nov 01 00:00:00 GMT 2001} +test clock-6.22.8 {Greedy match} { + clock format [clock scan "1 11 1" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Nov 01 00:00:00 GMT 2001} +test clock-6.22.9 {Greedy match} { + clock format [clock scan "1 11 11" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Tue Nov 01 00:00:00 GMT 2011} +test clock-6.22.10 {Greedy match} { + clock format [clock scan "11 11 11" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Fri Nov 11 00:00:00 GMT 2011} +test clock-6.22.11 {Greedy match} { + clock format [clock scan "1111 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Sat Jan 01 01:02:00 GMT 2011} +test clock-6.22.12 {Greedy match} { + clock format [clock scan "11 1 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 01:02:00 GMT 2001} + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true -- cgit v0.12 From 264cc47fd4ff7109cc19d544d1102b011b6183b0 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:52:44 +0000 Subject: another way to make greedy search more precise, some greedy matches are fixed (see test cases clock-6.22.11 - clock-6.22.20), additionally involving look ahead token of known type into pre-search process. --- generic/tclClockFmt.c | 273 ++++++++++++++++++++++++++++++++++---------------- generic/tclDate.h | 7 +- tests/clock.test | 41 ++++++-- 3 files changed, 224 insertions(+), 97 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 00ea0ed..680e33d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -713,49 +713,127 @@ clean: return (opts->formatObj = valObj); } +static const char * +FindTokenBegin( + register const char *p, + register const char *end, + ClockScanToken *tok) +{ + char c; + if (p < end) { + /* next token a known token type */ + switch (tok->map->type) { + case CTOKT_DIGIT: + /* should match at least one digit */ + while (!isdigit(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_WORD: + c = *(tok->tokWord.start); + /* should match at least to the first char of this word */ + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_SPACE: + while (!isspace(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_CHAR: + c = *((char *)tok->map->data); + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + } + } + return p; +} + /* * DetermineGreedySearchLen -- * * Determine min/max lengths as exact as possible (speed, greedy match) * */ -inline -void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, - DateInfo *info, ClockScanToken *tok, int *minLen, int *maxLen) +static void +DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok, + int *minLenPtr, int *maxLenPtr) { - register const char *p = yyInput, + register int minLen = tok->map->minSize; + register int maxLen; + register const char *p = yyInput + minLen, *end = info->dateEnd; - *minLen = 0; - /* if still tokens available */ + /* if still tokens available, try to correct minimum length */ if ((tok+1)->map) { end -= tok->endDistance + yySpaceCount; - /* next token is a word */ - switch ((tok+1)->map->type) { - case CTOKT_WORD: - /* should match at least to the first char of this word */ - while (*p != *((tok+1)->tokWord.start) && ++p < end) {}; - *minLen = p - yyInput; - break; - case CTOKT_CHAR: - while (*p != *((char *)(tok+1)->map->data) && ++p < end) {}; - *minLen = p - yyInput; - break; + /* find position of next known token */ + p = FindTokenBegin(p, end, tok+1); + if (p < end) { + minLen = p - yyInput; } } /* max length to the end regarding distance to end (min-width of following tokens) */ - *maxLen = end - p; - if (*maxLen > tok->map->maxSize) { - *maxLen = tok->map->maxSize; + maxLen = end - yyInput; + /* several amendments */ + if (maxLen > tok->map->maxSize) { + maxLen = tok->map->maxSize; }; - - if (*minLen < tok->map->minSize) { - *minLen = tok->map->minSize; + if (minLen < tok->map->minSize) { + minLen = tok->map->minSize; } - if (*minLen > *maxLen) { - *maxLen = *minLen; + if (minLen > maxLen) { + maxLen = minLen; + } + if (maxLen > info->dateEnd - yyInput) { + maxLen = info->dateEnd - yyInput; + } + + /* check digits rigth now */ + if (tok->map->type == CTOKT_DIGIT) { + p = yyInput; + end = p + maxLen; + if (end > info->dateEnd) { end = info->dateEnd; }; + while (isdigit(UCHAR(*p)) && p < end) { p++; }; + maxLen = p - yyInput; + } + + /* try to get max length more precise for greedy match, + * check the next ahead token available there */ + if (minLen < maxLen && tok->lookAhTok) { + ClockScanToken *laTok = tok + tok->lookAhTok + 1; + p = yyInput + maxLen; + /* regards all possible spaces here (because they are optional) */ + end = p + tok->lookAhMax + yySpaceCount + 1; + if (end > info->dateEnd) { + end = info->dateEnd; + } + p += tok->lookAhMin; + if (laTok->map && p < end) { + const char *f; + /* try to find laTok between [lookAhMin, lookAhMax] */ + while (minLen < maxLen) { + f = FindTokenBegin(p, end, laTok); + /* if found (not below lookAhMax) */ + if (f < end) { + break; + } + /* try again with fewer length */ + maxLen--; + p--; + end--; + } + } else if (p > end) { + maxLen -= (p - end); + if (maxLen < minLen) { + maxLen = minLen; + } + } } + + *minLenPtr = minLen; + *maxLenPtr = maxLen; } inline int @@ -1447,9 +1525,9 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), NULL}, /* %n */ - {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\n"}, /* min=0 - spaces are optional (in yySpaceCount) */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, /* %t */ - {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\t"}, /* min=0 - spaces are optional (in yySpaceCount) */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, /* %Q */ {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, ClockScnToken_StarDate_Proc, NULL}, @@ -1510,12 +1588,12 @@ static const char *ScnOTokenMapAliasIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, /* min=0 - spaces are optional (in yySpaceCount) */ + {CTOKT_SPACE, 0, 0, 1, 1, 0, NULL}, }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 0, 1, 0xffff, 0, + CTOKT_WORD, 0, 0, 1, 1, 0, NULL }; @@ -1559,7 +1637,7 @@ EstimateTokenCount( /* *---------------------------------------------------------------------- */ -ClockScanToken * +ClockFmtScnStorage * ClockGetOrParseScanFormat( Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *formatObj) /* Format container */ @@ -1574,6 +1652,7 @@ ClockGetOrParseScanFormat( /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { + unsigned int tokCnt; register const char *p, *e, *cp; e = p = HashEntry4FmtScn(fss)->key.string; @@ -1581,11 +1660,14 @@ ClockGetOrParseScanFormat( /* estimate token count by % char and format length */ fss->scnTokC = EstimateTokenCount(p, e); + + fss->scnSpaceCount = 0; Tcl_MutexLock(&ClockFmtMutex); fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; while (p < e) { switch (*p) { case '%': @@ -1605,7 +1687,7 @@ ClockGetOrParseScanFormat( tok->map = &ScnWordTokenMap; tok->tokWord.start = p; tok->tokWord.end = p+1; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; p++; continue; break; @@ -1642,21 +1724,31 @@ ClockGetOrParseScanFormat( } tok->map = &scnMap[cp - mapIndex]; tok->tokWord.start = p; + /* calculate look ahead value by standing together tokens */ - if (tok > fss->scnTok && tok->map->minSize) { - unsigned int lookAhead = tok->map->minSize; + if (tok > fss->scnTok) { ClockScanToken *prevTok = tok - 1; while (prevTok >= fss->scnTok) { if (prevTok->map->type != tok->map->type) { break; } - prevTok->lookAhead += lookAhead; + prevTok->lookAhMin += tok->map->minSize; + prevTok->lookAhMax += tok->map->maxSize; + prevTok->lookAhTok++; prevTok--; } } + + /* increase space count used in format */ + if ( tok->map->type == CTOKT_CHAR + && isspace(UCHAR(*((char *)tok->map->data))) + ) { + fss->scnSpaceCount++; + } + /* next token */ - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; p++; continue; } @@ -1668,7 +1760,10 @@ ClockGetOrParseScanFormat( goto word_tok; } tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + /* increase space count used in format */ + fss->scnSpaceCount++; + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; p++; continue; break; @@ -1679,10 +1774,14 @@ word_tok: if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { wordTok = tok-1; } + /* new word token */ if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &ScnWordTokenMap; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + } + if (isspace(UCHAR(*p))) { + fss->scnSpaceCount++; } p = TclUtfNext(p); wordTok->tokWord.end = p; @@ -1705,12 +1804,22 @@ word_tok: } prevTok--; } - } + } + + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->scnTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->scnTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->scnTok = tok; + } + } + fss->scnTokC = tokCnt; + done: Tcl_MutexUnlock(&ClockFmtMutex); } - return fss->scnTok; + return fss; } /* @@ -1723,6 +1832,7 @@ ClockScan( ClockFmtScnCmdArgs *opts) /* Command options */ { ClockClientData *dataPtr = opts->clientData; + ClockFmtScnStorage *fss; ClockScanToken *tok; ClockScanTokenMap *map; register const char *p, *x, *end; @@ -1734,8 +1844,9 @@ ClockScan( return TCL_ERROR; } - if ((tok = ClockGetOrParseScanFormat(opts->interp, - opts->formatObj)) == NULL) { + if ( !(fss = ClockGetOrParseScanFormat(opts->interp, opts->formatObj)) + || !(tok = fss->scnTok) + ) { return TCL_ERROR; } @@ -1766,6 +1877,11 @@ ClockScan( /* ignore spaces at end */ yySpaceCount -= (end - x); end = x; + /* ignore mandatory spaces used in format */ + yySpaceCount -= fss->scnSpaceCount; + if (yySpaceCount < 0) { + yySpaceCount = 0; + } info->dateStart = p = yyInput; info->dateEnd = end; @@ -1799,39 +1915,9 @@ ClockScan( else if (*p == '-') { yyInput = ++p; sign = -1; }; } + DetermineGreedySearchLen(opts, info, tok, &minLen, &size); - /* greedy find digits (look for forward digits consider spaces), - * corresponding pre-calculated lookAhead */ - if (size != minLen && tok->lookAhead) { - int spcnt = 0; - const char *pe; - size += tok->lookAhead; - x = p + size; if (x > end) { x = end; }; - pe = x; - while (p < x) { - if (isspace(UCHAR(*p))) { - if (pe > p) { pe = p; }; - if (x < end) x++; - p++; - spcnt++; - continue; - } - if (isdigit(UCHAR(*p))) { - p++; - continue; - } - break; - } - /* consider reserved (lookAhead) for next tokens */ - p -= tok->lookAhead + spcnt; - if (p > pe) { - p = pe; - } - } else { - x = p + size; if (x > end) { x = end; }; - while (isdigit(UCHAR(*p)) && p < x) { p++; }; - } - size = p - yyInput; + if (size < map->minSize) { /* missing input -> error */ if ((map->flags & CLF_OPTIONAL)) { @@ -1884,15 +1970,13 @@ ClockScan( flags = (flags & ~map->clearFlags) | map->flags; break; case CTOKT_SPACE: - /* at least one space in strict mode */ - if (opts->flags & CLF_STRICT) { - if (!isspace(UCHAR(*p))) { - /* unmatched -> error */ - goto not_match; - } - yySpaceCount--; - p++; + /* at least one space */ + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto not_match; } + yySpaceCount--; + p++; while (p < end && isspace(UCHAR(*p))) { yySpaceCount--; p++; @@ -2460,7 +2544,7 @@ static ClockFormatTokenMap FmtWordTokenMap = { /* *---------------------------------------------------------------------- */ -ClockFormatToken * +ClockFmtScnStorage * ClockGetOrParseFmtFormat( Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *formatObj) /* Format container */ @@ -2475,6 +2559,7 @@ ClockGetOrParseFmtFormat( /* if first time scanning - tokenize format */ if (fss->fmtTok == NULL) { + unsigned int tokCnt; register const char *p, *e, *cp; e = p = HashEntry4FmtScn(fss)->key.string; @@ -2487,6 +2572,7 @@ ClockGetOrParseFmtFormat( fss->fmtTok = tok = ckalloc(sizeof(*tok) * fss->fmtTokC); memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; while (p < e) { switch (*p) { case '%': @@ -2506,7 +2592,7 @@ ClockGetOrParseFmtFormat( tok->map = &FmtWordTokenMap; tok->tokWord.start = p; tok->tokWord.end = p+1; - AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; p++; continue; break; @@ -2544,7 +2630,7 @@ ClockGetOrParseFmtFormat( tok->map = &fmtMap[cp - mapIndex]; tok->tokWord.start = p; /* next token */ - AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; p++; continue; } @@ -2559,7 +2645,7 @@ word_tok: if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &FmtWordTokenMap; - AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; } p = TclUtfNext(p); wordTok->tokWord.end = p; @@ -2568,11 +2654,20 @@ word_tok: } } + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->fmtTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->fmtTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->fmtTok = tok; + } + } + fss->fmtTokC = tokCnt; + done: Tcl_MutexUnlock(&ClockFmtMutex); } - return fss->fmtTok; + return fss; } /* @@ -2584,6 +2679,7 @@ ClockFormat( ClockFmtScnCmdArgs *opts) /* Command options */ { ClockClientData *dataPtr = opts->clientData; + ClockFmtScnStorage *fss; ClockFormatToken *tok; ClockFormatTokenMap *map; @@ -2592,8 +2688,9 @@ ClockFormat( return TCL_ERROR; } - if ((tok = ClockGetOrParseFmtFormat(opts->interp, - opts->formatObj)) == NULL) { + if ( !(fss = ClockGetOrParseFmtFormat(opts->interp, opts->formatObj)) + || !(tok = fss->fmtTok) + ) { return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 519a3e5..c50753d 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -375,12 +375,14 @@ typedef struct ClockScanTokenMap { typedef struct ClockScanToken { ClockScanTokenMap *map; - unsigned short int lookAhead; - unsigned short int endDistance; struct { const char *start; const char *end; } tokWord; + unsigned short int endDistance; + unsigned short int lookAhMin; + unsigned short int lookAhMax; + unsigned short int lookAhTok; } ClockScanToken; @@ -435,6 +437,7 @@ typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ ClockScanToken *scnTok; unsigned int scnTokC; + unsigned int scnSpaceCount; /* Count of mandatory spaces used in format */ ClockFormatToken *fmtTok; unsigned int fmtTokC; #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 diff --git a/tests/clock.test b/tests/clock.test index 46a2b29..d9c491a 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18588,16 +18588,16 @@ test clock-6.16 {input of ambiguous short locale token (%b)} { } {1 {input string does not match supplied format} {CLOCK badInputString}} test clock-6.17 {spaces are always optional in non-strict mode (default)} { - list [clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan "2009-06-30T18:30:00 +02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] \ - [clock scan "2009-06-30T18:30:00 Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] + list [clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00 +02:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z" -timezone CET] \ + [clock scan "2009-06-30T18:30:00 Z" -format "%Y-%m-%dT%H:%M:%S%z" -timezone CET] } {1246379400 1246379400 1246386600 1246386600} test clock-6.18 {zone token (%z) is optional} { - list [clock scan "2009-06-30T18:30:00 -01:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan "2009-06-30T18:30:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + list [clock scan "2009-06-30T18:30:00 -01:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ } {1246390200 1246386600 1246386600} test clock-6.19 {no token parsing} { @@ -18674,6 +18674,33 @@ test clock-6.22.11 {Greedy match} { test clock-6.22.12 {Greedy match} { clock format [clock scan "11 1 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 } {Mon Jan 01 01:02:00 GMT 2001} +test clock-6.22.13 {Greedy match} { + clock format [clock scan "1 11 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 01:02:00 GMT 2001} +test clock-6.22.14 {Greedy match} { + clock format [clock scan "111120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 01:02:00 GMT 2001} +test clock-6.22.15 {Greedy match} { + clock format [clock scan "1111120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Sat Jan 01 01:02:00 GMT 2011} +test clock-6.22.16 {Greedy match} { + clock format [clock scan "11121120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Thu Dec 01 01:02:00 GMT 2011} +test clock-6.22.17 {Greedy match} { + clock format [clock scan "111213120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Tue Dec 13 01:02:00 GMT 2011} +test clock-6.22.17 {Greedy match (space wins as date-time separator)} { + clock format [clock scan "1112 13120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Sun Jan 02 13:12:00 GMT 2011} +test clock-6.22.18 {Greedy match (second space wins as date-time separator)} { + clock format [clock scan "1112 13 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Tue Dec 13 01:02:00 GMT 2011} +test clock-6.22.19 {Greedy match (space wins as date-time separator)} { + clock format [clock scan "111 213120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 21:31:20 GMT 2001} +test clock-6.22.20 {Greedy match (second space wins as date-time separator)} { + clock format [clock scan "111 2 13120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Sun Jan 02 13:12:00 GMT 2011} test clock-7.1 {Julian Day} { -- cgit v0.12 From 27fd5c0793a7bf5332cd99885869ae7e79d66dfb Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:53:05 +0000 Subject: dict: unused variable removed --- generic/tclDictObj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 3944173..8e11bfe 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2014,7 +2014,6 @@ DictSmartRefCmd( Tcl_Obj *const *objv) { Tcl_Obj *result; - Dict *dict; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); -- cgit v0.12 From d551c0972c261cc3a69b07263ae3c8072d929a50 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:55:00 +0000 Subject: [unix] build for *nix fixed, code clean-ups; missing declarations; unused vars, functions etc; types normalization; --- generic/tclClock.c | 6 +--- generic/tclClockFmt.c | 31 ++++++++++--------- generic/tclDate.c | 8 ++--- generic/tclDate.h | 80 +++++++++++++++++++++++++------------------------ generic/tclGetDate.y | 8 ++--- generic/tclStrIdxTree.c | 8 ++--- generic/tclStrIdxTree.h | 8 ++--- unix/Makefile.in | 4 +-- 8 files changed, 77 insertions(+), 76 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 7d4263c..1b1faae 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -137,10 +137,6 @@ static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); -static int ClockTestObjCmd( - ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); - /* * Structure containing description of "native" clock commands to create. */ @@ -3365,7 +3361,7 @@ repeat_rel: /* relative time (seconds), if exceeds current date, do the day conversion and * leave rest of the increment in yyRelSeconds to add it hereafter in UTC seconds */ if (yyRelSeconds) { - time_t newSecs = yySeconds + yyRelSeconds; + int newSecs = yySeconds + yyRelSeconds; /* if seconds increment outside of current date, increment day */ if (newSecs / SECONDS_PER_DAY != yySeconds / SECONDS_PER_DAY) { diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 680e33d..a5ddd18 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -43,13 +43,13 @@ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); inline int _str2int( - time_t *out, + int *out, register const char *p, const char *e, int sign) { - register time_t val = 0, prev = 0; + register int val = 0, prev = 0; if (sign >= 0) { while (p < e) { val = val * 10 + (*p++ - '0'); @@ -880,6 +880,7 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, } return TCL_RETURN; } +#if 0 static int LocaleListSearch(ClockFmtScnCmdArgs *opts, @@ -905,6 +906,7 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, return ObjListSearch(opts, info, val, lstv, lstc, minLen, maxLen); } +#endif static TclStrIdxTree * ClockMCGetListIdxTree( @@ -1039,6 +1041,7 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, return TCL_OK; } +#if 0 static int StaticListSearch(ClockFmtScnCmdArgs *opts, @@ -1062,6 +1065,7 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, } return TCL_RETURN; } +#endif inline const char * FindWordEnd( @@ -1069,7 +1073,7 @@ FindWordEnd( register const char * p, const char * end) { register const char *x = tok->tokWord.start; - const char *pfnd; + const char *pfnd = p; if (x == tok->tokWord.end - 1) { /* fast phase-out for single char word */ if (*p == *x) { return ++p; @@ -1088,14 +1092,14 @@ static int ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { - /* +#if 0 static const char * months[] = { - /* full * / + /* full */ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", - /* abbr * / + /* abbr */ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL @@ -1106,7 +1110,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, } yyMonth = (val % 12) + 1; return TCL_OK; - */ +#endif static int monthsKeys[] = {MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, 0}; @@ -1300,7 +1304,7 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, } if (tok->map->offs > 0) { - *(time_t *)(((char *)info) + tok->map->offs) = val; + *(int *)(((char *)info) + tok->map->offs) = val; } return TCL_OK; @@ -1334,7 +1338,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, *bp++ = *p++; len++; if (len + 2 < maxLen) { if (*p == ':') { - *p++; len++; + p++; len++; } } } @@ -1392,7 +1396,7 @@ ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, { int minLen, maxLen; register const char *p = yyInput, *end; const char *s; - time_t year, fractYear, fractDayDiv, fractDay; + int year, fractYear, fractDayDiv, fractDay; static const char *stardatePref = "stardate "; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -1626,7 +1630,7 @@ EstimateTokenCount( #define AllocTokenInChain(tok, chain, tokCnt) \ if (++(tok) >= (chain) + (tokCnt)) { \ - (char *)(chain) = ckrealloc((char *)(chain), \ + *((char **)&chain) = ckrealloc((char *)(chain), \ (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ if ((chain) == NULL) { goto done; }; \ (tok) = (chain) + (tokCnt); \ @@ -1929,7 +1933,7 @@ ClockScan( if (map->offs) { p = yyInput; x = p + size; if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { - if (_str2int((time_t *)(((char *)info) + map->offs), + if (_str2int((int *)(((char *)info) + map->offs), p, x, sign) != TCL_OK) { goto overflow; } @@ -2678,7 +2682,6 @@ ClockFormat( register DateFormat *dateFmt, /* Date fields used for parsing & converting */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = opts->clientData; ClockFmtScnStorage *fss; ClockFormatToken *tok; ClockFormatTokenMap *map; @@ -2716,7 +2719,7 @@ ClockFormat( { case CFMTT_INT: if (1) { - int val = (int)*(time_t *)(((char *)dateFmt) + map->offs); + int val = (int)*(int *)(((char *)dateFmt) + map->offs); if (map->fmtproc == NULL) { if (map->flags & CLFMT_DECR) { val--; diff --git a/generic/tclDate.c b/generic/tclDate.c index 5bd96d0..64cb804 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2448,11 +2448,11 @@ TclDateerror( infoPtr->separatrix = "\n"; } -time_t +MODULE_SCOPE int ToSeconds( - time_t Hours, - time_t Minutes, - time_t Seconds, + int Hours, + int Minutes, + int Seconds, MERIDIAN Meridian) { if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) { diff --git a/generic/tclDate.h b/generic/tclDate.h index c50753d..c9c6726 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -142,21 +142,21 @@ typedef struct TclDateFields { * epoch */ Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds * from the Posix epoch */ - time_t tzOffset; /* Time zone offset in seconds east of + int tzOffset; /* Time zone offset in seconds east of * Greenwich */ - time_t julianDay; /* Julian Day Number in local time zone */ + int julianDay; /* Julian Day Number in local time zone */ enum {BCE=1, CE=0} era; /* Era */ - time_t gregorian; /* Flag == 1 if the date is Gregorian */ - time_t year; /* Year of the era */ - time_t dayOfYear; /* Day of the year (1 January == 1) */ - time_t month; /* Month number */ - time_t dayOfMonth; /* Day of the month */ - time_t iso8601Year; /* ISO8601 week-based year */ - time_t iso8601Week; /* ISO8601 week number */ - time_t dayOfWeek; /* Day of the week */ - time_t hour; /* Hours of day (in-between time only calculation) */ - time_t minutes; /* Minutes of day (in-between time only calculation) */ - time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ + int hour; /* Hours of day (in-between time only calculation) */ + int minutes; /* Minutes of day (in-between time only calculation) */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ /* Non cacheable fields: */ @@ -180,34 +180,34 @@ typedef struct DateInfo { int flags; - time_t dateHaveDate; + int dateHaveDate; - time_t dateMeridian; - time_t dateHaveTime; + int dateMeridian; + int dateHaveTime; - time_t dateTimezone; - time_t dateDSTmode; - time_t dateHaveZone; + int dateTimezone; + int dateDSTmode; + int dateHaveZone; - time_t dateRelMonth; - time_t dateRelDay; - time_t dateRelSeconds; - time_t dateHaveRel; + int dateRelMonth; + int dateRelDay; + int dateRelSeconds; + int dateHaveRel; - time_t dateMonthOrdinalIncr; - time_t dateMonthOrdinal; - time_t dateHaveOrdinalMonth; + int dateMonthOrdinalIncr; + int dateMonthOrdinal; + int dateHaveOrdinalMonth; - time_t dateDayOrdinal; - time_t dateDayNumber; - time_t dateHaveDay; + int dateDayOrdinal; + int dateDayNumber; + int dateHaveDay; - time_t *dateRelPointer; + int *dateRelPointer; - time_t dateSpaceCount; - time_t dateDigitCount; + int dateSpaceCount; + int dateDigitCount; - time_t dateCentury; + int dateCentury; Tcl_Obj* messages; /* Error messages */ const char* separatrix; /* String separating messages */ @@ -244,7 +244,7 @@ typedef struct DateInfo { #define yyDigitCount (info->dateDigitCount) #define yySpaceCount (info->dateSpaceCount) -inline void +static inline void ClockInitDateInfo(DateInfo *info) { memset(info, 0, sizeof(DateInfo)); } @@ -314,7 +314,7 @@ typedef struct ClockClientData { Tcl_WideInt seconds; Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ - time_t tzOffset; + int tzOffset; Tcl_Obj *tzName; } UTC2Local; /* Las-period cache for fast Local2UTC conversion */ @@ -325,7 +325,7 @@ typedef struct ClockClientData { Tcl_WideInt localSeconds; Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ - time_t tzOffset; + int tzOffset; } Local2UTC; } ClockClientData; @@ -444,16 +444,18 @@ typedef struct ClockFmtScnStorage { ClockFmtScnStorage *nextPtr; ClockFmtScnStorage *prevPtr; #endif -/* +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, +#if 0 + +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, * stored by offset +sizeof(self) */ +#endif } ClockFmtScnStorage; /* * Prototypes of module functions. */ -MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, - time_t Seconds, MERIDIAN Meridian); +MODULE_SCOPE int ToSeconds(int Hours, int Minutes, + int Seconds, MERIDIAN Meridian); MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); MODULE_SCOPE void GetJulianDayFromEraYearWeekDay( diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 9e3623f..6d6a0d0 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -659,11 +659,11 @@ TclDateerror( infoPtr->separatrix = "\n"; } -time_t +MODULE_SCOPE int ToSeconds( - time_t Hours, - time_t Minutes, - time_t Seconds, + int Hours, + int Minutes, + int Seconds, MERIDIAN Meridian) { if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) { diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index afb53e5..b47b4b7 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -171,11 +171,11 @@ TclStrIdxTreeInsertBranch( parent->firstPtr = item; if (parent->lastPtr == child) parent->lastPtr = item; - if (item->nextPtr = child->nextPtr) { + if ( (item->nextPtr = child->nextPtr) ) { item->nextPtr->prevPtr = item; child->nextPtr = NULL; } - if (item->prevPtr = child->prevPtr) { + if ( (item->prevPtr = child->prevPtr) ) { item->prevPtr->nextPtr = item; child->prevPtr = NULL; } @@ -365,7 +365,7 @@ StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; } /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ - Tcl_InitObjRef(((Tcl_Obj *)copyPtr->internalRep.twoPtrValue.ptr1), + Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), srcPtr); copyPtr->internalRep.twoPtrValue.ptr2 = NULL; copyPtr->typePtr = &StrIdxTreeObjType; @@ -379,7 +379,7 @@ StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr) && objPtr->internalRep.twoPtrValue.ptr2 == NULL ) { /* is a link */ - Tcl_UnsetObjRef(((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1)); + Tcl_UnsetObjRef(*((Tcl_Obj **)&objPtr->internalRep.twoPtrValue.ptr1)); } else { /* is a tree */ TclStrIdxTree *tree = (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index 934e28f..305053c 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -49,7 +49,7 @@ typedef struct TclStrIdx { *---------------------------------------------------------------------- */ -inline const char * +static inline const char * TclUtfFindEqual( register const char *cs, /* UTF string to find in cin. */ register const char *cse, /* End of cs */ @@ -66,7 +66,7 @@ TclUtfFindEqual( return ret; } -inline const char * +static inline const char * TclUtfFindEqualNC( register const char *cs, /* UTF string to find in cin. */ register const char *cse, /* End of cs */ @@ -89,7 +89,7 @@ TclUtfFindEqualNC( return ret; } -inline const char * +static inline const char * TclUtfFindEqualNCInLwr( register const char *cs, /* UTF string (in anycase) to find in cin. */ register const char *cse, /* End of cs */ @@ -111,7 +111,7 @@ TclUtfFindEqualNCInLwr( return ret; } -inline const char * +static inline const char * TclUtfNext( register const char *src) /* The current location in the string. */ { diff --git a/unix/Makefile.in b/unix/Makefile.in index 19ab6ec..9bdcacd 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -292,7 +292,7 @@ XTTEST_OBJS = xtTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclAssembly.o tclAsync.o tclBasic.o tclBinary.o tclCkalloc.o \ - tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o \ + tclClock.o tclClockFmt.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o \ tclCompCmds.o tclCompCmdsGR.o tclCompCmdsSZ.o tclCompExpr.o \ tclCompile.o tclConfig.o tclDate.o tclDictObj.o tclDisassemble.o \ tclEncoding.o tclEnsemble.o \ @@ -304,7 +304,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclObj.o tclOptimize.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o \ tclPkg.o tclPkgConfig.o tclPosixStr.o \ tclPreserve.o tclProc.o tclRegexp.o \ - tclResolve.o tclResult.o tclScan.o tclStringObj.o \ + tclResolve.o tclResult.o tclScan.o tclStringObj.o tclStrIdxTree.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \ tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \ -- cgit v0.12 From bc879a58f2195dd85d8ba603de4a3ae84f1725ec Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:56:13 +0000 Subject: Merge remote-tracking branch 'remotes/fossil/trunk' into sb/trunk-rewrite-clock-in-c; + minor fixes after merge. --- generic/tclClock.c | 3 +-- generic/tclDate.h | 2 +- generic/tclDictObj.c | 50 +++++++++++++++++++++++++++++++---------------- library/msgcat/msgcat.tcl | 2 +- win/makefile.vc | 4 +--- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 1b1faae..a417758 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -309,8 +309,7 @@ ClockDeleteCmdProc( ClockClientData *data = clientData; int i; - data->refCount--; - if (data->refCount == 0) { + if (data->refCount-- <= 1) { for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } diff --git a/generic/tclDate.h b/generic/tclDate.h index c9c6726..cf307a6 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -275,7 +275,7 @@ typedef struct ClockFmtScnCmdArgs { */ typedef struct ClockClientData { - int refCount; /* Number of live references. */ + size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals (common, locale independent). */ Tcl_Obj **mcLiterals; /* Msgcat object literals with mc-keys for search with locale. */ Tcl_Obj **mcLitIdxs; /* Msgcat object indices prefixed with _IDX_, diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 8e11bfe..caebbf1 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -145,7 +145,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - int refcount; /* Reference counter (see above) */ + size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -395,7 +395,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refcount = 1; + newDict->refCount = 1; /* * Store in the object. @@ -430,8 +430,7 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -716,7 +715,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1120,7 +1119,7 @@ Tcl_DictObjFirst( searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refcount++; + dict->refCount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1234,8 +1233,7 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } } @@ -1387,7 +1385,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1437,7 +1435,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1981,7 +1979,7 @@ Tcl_DictObjSmartRef( result = Tcl_NewObj(); DICT(result) = dict; - dict->refcount++; + dict->refCount++; result->internalRep.twoPtrValue.ptr2 = NULL; result->typePtr = &tclDictType; @@ -2355,7 +2353,7 @@ DictAppendCmd( Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr, *resultPtr; - int i, allocatedDict = 0; + int allocatedDict = 0; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?"); @@ -2380,15 +2378,33 @@ DictAppendCmd( if ((objc > 3) || (valuePtr == NULL)) { /* Only go through append activites when something will change. */ + Tcl_Obj *appendObjPtr = NULL; - if (valuePtr == NULL) { + if (objc > 3) { + /* Something to append */ + + if (objc == 4) { + appendObjPtr = objv[3]; + } else if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, + objc-3, objv+3, &appendObjPtr)) { + return TCL_ERROR; + } + } + + if (appendObjPtr == NULL) { + /* => (objc == 3) => (valuePtr == NULL) */ TclNewObj(valuePtr); - } else if (Tcl_IsShared(valuePtr)) { - valuePtr = Tcl_DuplicateObj(valuePtr); + } else if (valuePtr == NULL) { + valuePtr = appendObjPtr; + appendObjPtr = NULL; } - for (i=3 ; i Date: Tue, 10 Jan 2017 22:58:29 +0000 Subject: test-performance: added calibration of `timerate` to minimize influence of the parasitical execution-overhead by extremely fast execution times --- tests-perf/clock.perf.tcl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index f3b8a10..7b522d0 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -19,11 +19,19 @@ ## set testing defaults: set ::env(TCL_TZ) :CET -## warm-up (load clock.tcl, system zones, locales, etc.): +# warm-up interpeter compiler env, clock platform-related features, +# calibrate timerate measurement functionality: +puts -nonewline "Calibration ... "; flush stdout +puts "done: [lrange \ + [timerate -calibrate {}] \ +0 1]" + +## warm-up test-related features (load clock.tcl, system zones, locales, etc.): clock scan "" -gmt 1 clock scan "" clock scan "" -timezone :CET clock scan "" -format "" -locale en +clock scan "" -format "" -locale de ## ------------------------------------------ @@ -239,6 +247,11 @@ proc test-scan {{reptime 1000}} { {clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z"} {clock scan "2009-06-30T18:30:00 UTC" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : locale date-time (en): + {clock scan "06/30/2009 18:30:15" -format "%x %X" -gmt 1 -locale en} + # Scan : locale date-time (de): + {clock scan "30.06.2009 18:30:15" -format "%x %X" -gmt 1 -locale de} + # Scan : dynamic format (cacheable) {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} -- cgit v0.12 From c2ee1525efb460ab0045d454670d0f4b912aebbe Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:59:16 +0000 Subject: [unix] resolving of several warnings (gcc 5.x): - static used in non-static inline function; - x64 int cast on pointer [-Wpointer-to-int-cast]; - (obscure) may be used uninitialized in this function [-Wmaybe-uninitialized]; - TclEnvEpoch initialized and declared extern; --- generic/tclClock.c | 8 ++++---- generic/tclClockFmt.c | 36 ++++++++++++++++++------------------ generic/tclEnv.c | 5 +++-- generic/tclStrIdxTree.c | 2 +- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a417758..a324b65 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -336,7 +336,7 @@ ClockDeleteCmdProc( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj * +static inline Tcl_Obj * NormTimezoneObj( ClockClientData *dataPtr, /* Client data containing literal pool */ Tcl_Obj *timezoneObj) @@ -383,7 +383,7 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj * +static inline Tcl_Obj * ClockGetSystemLocale( ClockClientData *dataPtr, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp) /* Tcl interpreter */ @@ -397,7 +397,7 @@ ClockGetSystemLocale( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj * +static inline Tcl_Obj * ClockGetCurrentLocale( ClockClientData *dataPtr, /* Client data containing literal pool */ Tcl_Interp *interp) /* Tcl interpreter */ @@ -782,7 +782,7 @@ ClockConfigureObjCmd( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj* +static inline Tcl_Obj * ClockGetTZData( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp, /* Tcl interpreter */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index a5ddd18..24c0f1d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -41,7 +41,7 @@ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); * Clock scan and format facilities. */ -inline int +static inline int _str2int( int *out, register @@ -71,7 +71,7 @@ _str2int( return TCL_OK; } -inline int +static inline int _str2wideInt( Tcl_WideInt *out, register @@ -101,7 +101,7 @@ _str2wideInt( return TCL_OK; } -inline char * +static inline char * _itoaw( char *buf, register int val, @@ -169,7 +169,7 @@ _itoaw( return buf + width; } -inline char * +static inline char * _witoaw( char *buf, register Tcl_WideInt val, @@ -268,7 +268,7 @@ static struct { unsigned int count; } ClockFmtScnStorage_GC = {NULL, NULL, 0}; -inline void +static inline void ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) { /* add new entry */ @@ -291,7 +291,7 @@ ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) ClockFmtScnStorageDelete(delEnt); } } -inline void +static inline void ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) { TclSpliceOut(entry, ClockFmtScnStorage_GC.stackPtr); @@ -311,11 +311,11 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) static Tcl_HashTable FmtScnHashTable; static int initialized = 0; -inline Tcl_HashEntry * +static inline Tcl_HashEntry * HashEntry4FmtScn(ClockFmtScnStorage *fss) { return (Tcl_HashEntry*)(fss + 1); }; -inline ClockFmtScnStorage * +static inline ClockFmtScnStorage * FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); }; @@ -836,7 +836,7 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, *maxLenPtr = maxLen; } -inline int +static inline int ObjListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, int *val, Tcl_Obj **lstv, int lstc, @@ -1015,7 +1015,7 @@ done: return idxTree; } -inline int +static inline int ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, TclStrIdxTree *idxTree, int *val, int minLen, int maxLen) @@ -1067,7 +1067,7 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, } #endif -inline const char * +static inline const char * FindWordEnd( ClockScanToken *tok, register const char * p, const char * end) @@ -1152,17 +1152,17 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, /* %u %w %Ou %Ow */ if ( curTok != 'a' && curTok != 'A' - && ((minLen <= 1 && maxLen >= 1) || (int)tok->map->data) + && ((minLen <= 1 && maxLen >= 1) || PTR2INT(tok->map->data)) ) { val = -1; - if (!(int)tok->map->data) { + if (PTR2INT(tok->map->data) == 0) { if (*yyInput >= '0' && *yyInput <= '9') { val = *yyInput - '0'; } } else { - idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); if (idxTree == NULL) { return TCL_ERROR; } @@ -1293,7 +1293,7 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, /* get or create tree in msgcat dict */ - idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); if (idxTree == NULL) { return TCL_ERROR; } @@ -1602,7 +1602,7 @@ static ClockScanTokenMap ScnWordTokenMap = { }; -inline unsigned int +static inline unsigned int EstimateTokenCount( register const char *fmt, register const char *end) @@ -2143,7 +2143,7 @@ done: return ret; } -inline int +static inline int FrmResultAllocate( register DateFormat *dateFmt, int len) @@ -2751,7 +2751,7 @@ ClockFormat( } } else { const char *s; - Tcl_Obj * mcObj = ClockMCGet(opts, (int)map->data /* mcKey */); + Tcl_Obj * mcObj = ClockMCGet(opts, PTR2INT(map->data) /* mcKey */); if (mcObj == NULL) { goto error; } diff --git a/generic/tclEnv.c b/generic/tclEnv.c index fd0a8ce..0041a40 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -18,8 +18,9 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ -MODULE_SCOPE unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment - * (if changed with tcl-env). */ +/* MODULE_SCOPE */ +unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment + * (if changed with tcl-env). */ static struct { int cacheSize; /* Number of env strings in cache. */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index b47b4b7..686c1e4 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -93,7 +93,7 @@ TclStrIdxTreeSearch( /* search in tree */ do { - cin = TclGetString(item->key) + offs; + cinf = cin = TclGetString(item->key) + offs; f = TclUtfFindEqualNCInLwr(s, end, cin, cin + item->length, &cinf); /* if something was found */ if (f > s) { -- cgit v0.12 From 8fa2e7802e55c700d1b4b40bcd58da827584ddde Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:00:05 +0000 Subject: correct output of total resp. average values considering net execution time (overhead considered) --- tests-perf/clock.perf.tcl | 54 +++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 7b522d0..16664b2 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -46,48 +46,62 @@ proc _test_get_commands {lst} { proc _test_out_total {} { upvar _ _ - if {![llength $_(ittm)]} { + set tcnt [llength $_(itm)] + if {!$tcnt} { puts "" return } set mintm 0x7fffffff set maxtm 0 + set nett 0 + set wtm 0 + set wcnt 0 set i 0 - foreach tm $_(ittm) { + foreach tm $_(itm) { + if {[llength $tm] > 6} { + set nett [expr {$nett + [lindex $tm 6]}] + } + set wtm [expr {$wtm + [lindex $tm 0]}] + set wcnt [expr {$wcnt + [lindex $tm 2]}] + set tm [lindex $tm 0] if {$tm > $maxtm} {set maxtm $tm; set maxi $i} if {$tm < $mintm} {set mintm $tm; set mini $i} incr i } puts [string repeat ** 40] - puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] - lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] - lset _(m) 2 [expr [join $_(itcnt) +]] - lset _(m) 4 [format %.3f [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}]] + set s [format "%d cases in %.2f sec." $tcnt [expr {$tcnt * $_(reptime) / 1000.0}]] + if {$nett > 0} { + append s [format " (%.2f nett-sec.)" [expr {$nett / 1000.0}]] + } + puts "Total $s:" + lset _(m) 0 [format %.6f $wtm] + lset _(m) 2 $wcnt + lset _(m) 4 [format %.3f [expr {$wcnt / (($nett ? $nett : ($tcnt * $_(reptime))) / 1000.0)}]] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f $nett] + } puts $_(m) puts "Average:" - lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / [llength $_(itcnt)]}]] - lset _(m) 2 [expr {[lindex $_(m) 2] / [llength $_(itcnt)]}] - lset _(m) 4 [expr {[lindex $_(m) 2] * (1000 / $_(reptime))}] + lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / $tcnt}]] + lset _(m) 2 [expr {[lindex $_(m) 2] / $tcnt}] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f [expr {[lindex $_(m) 6] / $tcnt}]] + lset _(m) 4 [format %.0f [expr {[lindex $_(m) 2] / [lindex $_(m) 6] * 1000}]] + } puts $_(m) puts "Min:" - lset _(m) 0 [lindex $_(ittm) $mini] - lset _(m) 2 [lindex $_(itcnt) $mini] - lset _(m) 2 [lindex $_(itrate) $mini] - puts $_(m) + puts [lindex $_(itm) $mini] puts "Max:" - lset _(m) 0 [lindex $_(ittm) $maxi] - lset _(m) 2 [lindex $_(itcnt) $maxi] - lset _(m) 2 [lindex $_(itrate) $maxi] - puts $_(m) + puts [lindex $_(itm) $maxi] puts [string repeat ** 40] puts "" } proc _test_run {reptime lst {outcmd {puts $_(r)}}} { upvar _ _ - array set _ [list ittm {} itcnt {} itrate {} reptime $reptime] + array set _ [list itm {} reptime $reptime] foreach _(c) [_test_get_commands $lst] { puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" @@ -99,9 +113,7 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { set _(r) [if 1 $_(c)] if {$outcmd ne {}} $outcmd puts [set _(m) [timerate $_(c) $reptime]] - lappend _(ittm) [lindex $_(m) 0] - lappend _(itcnt) [lindex $_(m) 2] - lappend _(itrate) [lindex $_(m) 4] + lappend _(itm) $_(m) puts "" } _test_out_total -- cgit v0.12 From 0a1c05fbb87bf517f2e9a49255351dfde5fc1961 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:01:23 +0000 Subject: code review and inline documentation --- generic/tclClock.c | 262 +++++++++++++++++++++++++++++++++++++++++++++--- generic/tclClockFmt.c | 3 + generic/tclDate.h | 7 -- generic/tclDictObj.c | 32 +++++- generic/tclInt.h | 7 ++ generic/tclStrIdxTree.c | 3 +- 6 files changed, 288 insertions(+), 26 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a324b65..fc7c70c 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -167,7 +167,6 @@ static const struct ClockCommand clockCommands[] = { { "GetJulianDayFromEraYearWeekDay", ClockGetjuliandayfromerayearweekdayObjCmd }, { "ParseFormatArgs", ClockParseformatargsObjCmd }, - { "_test", TclStrIdxTreeTestObjCmd }, { NULL, NULL } }; @@ -262,10 +261,11 @@ TclClockInit( /* *---------------------------------------------------------------------- * - * ClockDeleteCmdProc -- + * ClockConfigureClear -- * - * Remove a reference to the clock client data, and clean up memory - * when it's all gone. + * Clean up cached resp. run-time storages used in clock commands. + * + * Shared usage for clean-up (ClockDeleteCmdProc) and "configure -clear". * * Results: * None. @@ -301,7 +301,20 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->UTC2Local.tzName); Tcl_UnsetObjRef(data->Local2UTC.timezoneObj); } - + +/* + *---------------------------------------------------------------------- + * + * ClockDeleteCmdProc -- + * + * Remove a reference to the clock client data, and clean up memory + * when it's all gone. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ static void ClockDeleteCmdProc( ClientData clientData) /* Opaque pointer to the client data */ @@ -335,7 +348,20 @@ ClockDeleteCmdProc( /* *---------------------------------------------------------------------- + * + * NormTimezoneObj -- + * + * Normalizes the timezone object (used for caching puposes). + * + * If already cached time zone could be found, returns this + * object (last setup or last used, system (current) or gmt). + * + * Results: + * Normalized tcl object pointer. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * NormTimezoneObj( ClockClientData *dataPtr, /* Client data containing literal pool */ @@ -411,9 +437,23 @@ ClockGetCurrentLocale( return dataPtr->CurrentLocale; } + /* *---------------------------------------------------------------------- + * + * NormLocaleObj -- + * + * Normalizes the locale object (used for caching puposes). + * + * If already cached locale could be found, returns this + * object (current, system (OS) or last used locales). + * + * Results: + * Normalized tcl object pointer. + * + *---------------------------------------------------------------------- */ + static Tcl_Obj * NormLocaleObj( ClockClientData *dataPtr, /* Client data containing literal pool */ @@ -494,7 +534,21 @@ NormLocaleObj( /* *---------------------------------------------------------------------- + * + * ClockMCDict -- + * + * Retrieves a localized storage dictionary object for the given + * locale object. + * + * This corresponds with call `::tcl::clock::mcget locale`. + * Cached representation stored in options (for further access). + * + * Results: + * Tcl-object contains smart reference to msgcat dictionary. + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE Tcl_Obj * ClockMCDict(ClockFmtScnCmdArgs *opts) { @@ -560,6 +614,21 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) return opts->mcDictObj; } +/* + *---------------------------------------------------------------------- + * + * ClockMCGet -- + * + * Retrieves a msgcat value for the given literal integer mcKey + * from localized storage (corresponding given locale object) + * by mcLiterals[mcKey] (e. g. MONTHS_FULL). + * + * Results: + * Tcl-object contains localized value. + * + *---------------------------------------------------------------------- + */ + MODULE_SCOPE Tcl_Obj * ClockMCGet( ClockFmtScnCmdArgs *opts, @@ -581,6 +650,21 @@ ClockMCGet( return valObj; /* or NULL in obscure case if Tcl_DictObjGet failed */ } +/* + *---------------------------------------------------------------------- + * + * ClockMCGetIdx -- + * + * Retrieves an indexed msgcat value for the given literal integer mcKey + * from localized storage (corresponding given locale object) + * by mcLitIdxs[mcKey] (e. g. _IDX_MONTHS_FULL). + * + * Results: + * Tcl-object contains localized indexed value. + * + *---------------------------------------------------------------------- + */ + MODULE_SCOPE Tcl_Obj * ClockMCGetIdx( ClockFmtScnCmdArgs *opts, @@ -609,6 +693,21 @@ ClockMCGetIdx( return valObj; } + +/* + *---------------------------------------------------------------------- + * + * ClockMCSetIdx -- + * + * Sets an indexed msgcat value for the given literal integer mcKey + * in localized storage (corresponding given locale object) + * by mcLitIdxs[mcKey] (e. g. _IDX_MONTHS_FULL). + * + * Results: + * Returns a standard Tcl result. + * + *---------------------------------------------------------------------- + */ MODULE_SCOPE int ClockMCSetIdx( @@ -639,7 +738,23 @@ ClockMCSetIdx( /* *---------------------------------------------------------------------- + * + * ClockConfigureObjCmd -- + * + * This function is invoked to process the Tcl "clock configure" command. + * + * Usage: + * ::tcl::clock::configure ?-option ?value?? + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- */ + static int ClockConfigureObjCmd( ClientData clientData, /* Client data containing literal pool */ @@ -781,7 +896,20 @@ ClockConfigureObjCmd( /* *---------------------------------------------------------------------- + * + * ClockGetTZData -- + * + * Retrieves tzdata table for given normalized timezone. + * + * Results: + * Returns a tcl object with tzdata. + * + * Side effects: + * The tzdata can be cached in ClockClientData structure. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * ClockGetTZData( ClientData clientData, /* Opaque pointer to literal pool, etc. */ @@ -839,9 +967,20 @@ ClockGetTZData( } return ret; } + /* *---------------------------------------------------------------------- + * + * ClockGetSystemTimeZone -- + * + * Returns system (current) timezone. + * + * Results: + * Returns normalized timezone object. + * + *---------------------------------------------------------------------- */ + static Tcl_Obj * ClockGetSystemTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ @@ -869,9 +1008,20 @@ ClockGetSystemTimeZone( } return dataPtr->SystemTimeZone; } + /* *---------------------------------------------------------------------- + * + * ClockSetupTimeZone -- + * + * Sets up the timezone. Loads tzdata, etc. + * + * Results: + * Returns normalized timezone object. + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE Tcl_Obj * ClockSetupTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ @@ -908,20 +1058,22 @@ ClockSetupTimeZone( } return NULL; } + /* *---------------------------------------------------------------------- - * ClockFormatNumericTimeZone - * - * Formats a time zone as +hhmmss + * ClockFormatNumericTimeZone -- + * + * Formats a time zone as +hhmmss * * Parameters: - * z - Time zone in seconds east of Greenwich + * z - Time zone in seconds east of Greenwich * * Results: - * Returns the time zone object (formatted in a numeric form) + * Returns the time zone object (formatted in a numeric form) * * Side effects: - * None. + * None. * *---------------------------------------------------------------------- */ @@ -943,6 +1095,7 @@ ClockFormatNumericTimeZone(int z) { } return Tcl_ObjPrintf("%c%02d%02d", sign, h, m); } + /* *---------------------------------------------------------------------- * @@ -1145,7 +1298,20 @@ ClockGetdatefieldsObjCmd( /* *---------------------------------------------------------------------- + * + * ClockGetDateFields -- + * + * Converts given UTC time (seconds in a TclDateFields structure) + * to local time and determines the values that clock routines will + * use in scanning or formatting a date. + * + * Results: + * Date-time values are stored in structure "fields". + * Returns a standard Tcl result. + * + *---------------------------------------------------------------------- */ + int ClockGetDateFields( ClientData clientData, /* Client data of the interpreter */ @@ -1586,6 +1752,7 @@ ConvertLocalToUTCUsingTable( fields->seconds = fields->localSeconds - fields->tzOffset; #if 0 + /* currently unused, test purposes only */ /* * Convert back from UTC, if local times are different - wrong local time * (local time seems to be in between DST-hole). @@ -2404,9 +2571,24 @@ GetJulianDayFromEraYearMonthDay( + ym1o4; } } + /* *---------------------------------------------------------------------- + * + * GetJulianDayFromEraYearDay -- + * + * Given era, year, and dayOfYear (in TclDateFields), and the + * Gregorian transition date, computes the Julian Day Number. + * + * Results: + * None. + * + * Side effects: + * Stores day number in 'julianDay' + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE void GetJulianDayFromEraYearDay( @@ -2740,6 +2922,19 @@ ClockMicrosecondsObjCmd( return TCL_OK; } +/* + *----------------------------------------------------------------------------- + * + * _ClockParseFmtScnArgs -- + * + * Parses the arguments for [clock scan] and [clock format]. + * + * Results: + * Returns a standard Tcl result, and stores parsed options + * (format, the locale, timezone and base) in structure "opts". + * + *----------------------------------------------------------------------------- + */ static int _ClockParseFmtScnArgs( @@ -2853,9 +3048,7 @@ _ClockParseFmtScnArgs( * Returns a standard Tcl result, whose value is a four-element list * comprising the time format, the locale, and the timezone. * - * This function exists because the loop that parses the [clock format] - * options is a known performance "hot spot", and is implemented in an effort - * to speed that particular code up. + * This function exists for backward compatibility purposes. * *----------------------------------------------------------------------------- */ @@ -2919,7 +3112,20 @@ ClockParseformatargsObjCmd( /*---------------------------------------------------------------------- * - * ClockFormatObjCmd - + * ClockFormatObjCmd -- , clock format -- + * + * This function is invoked to process the Tcl "clock format" command. + * + * Formats a count of seconds since the Posix Epoch as a time of day. + * + * The 'clock format' command formats times of day for output. Refer + * to the user documentation to see what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. * *---------------------------------------------------------------------- */ @@ -3018,7 +3224,20 @@ done: /*---------------------------------------------------------------------- * - * ClockScanObjCmd - + * ClockScanObjCmd -- , clock scan -- + * + * This function is invoked to process the Tcl "clock scan" command. + * + * Inputs a count of seconds since the Posix Epoch as a time of day. + * + * The 'clock scan' command scans times of day on input. Refer to the + * user documentation to see what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. * *---------------------------------------------------------------------- */ @@ -3188,7 +3407,20 @@ done: } /*---------------------------------------------------------------------- + * + * ClockFreeScan -- + * + * Used by ClockScanObjCmd for free scanning without format. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- */ + int ClockFreeScan( ClientData clientData, /* Client data containing literal pool */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 24c0f1d..ff16714 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -881,6 +881,7 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, return TCL_RETURN; } #if 0 +/* currently unused */ static int LocaleListSearch(ClockFmtScnCmdArgs *opts, @@ -1042,6 +1043,7 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, return TCL_OK; } #if 0 +/* currently unused */ static int StaticListSearch(ClockFmtScnCmdArgs *opts, @@ -1093,6 +1095,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { #if 0 +/* currently unused, test purposes only */ static const char * months[] = { /* full */ "January", "February", "March", diff --git a/generic/tclDate.h b/generic/tclDate.h index cf307a6..1519842 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -509,11 +509,4 @@ MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, MODULE_SCOPE void ClockFrmScnClearCaches(void); -/* - * Other externals. - */ - -MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment - * (if changed with tcl-env). */ - #endif /* _TCLCLOCK_H */ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index caebbf1..b786c4f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -1960,6 +1960,32 @@ DictSizeCmd( /* *---------------------------------------------------------------------- + * + * Tcl_DictObjSmartRef -- + * + * This function returns new tcl-object with the smart reference to + * dictionary object. + * + * Object returned with this function is a smart reference (pointer), + * so new object of type tclDictType, that directly references given + * dictionary object (with internally increased refCount). + * + * The usage of such pointer objects allows to hold more as one + * reference to the same real dictionary object, allows to make a pointer + * to part of another dictionary, allows to change the dictionary without + * regarding of the "shared" state of the dictionary object. + * + * Prevents "called with shared object" exception if object is multiple + * referenced. + * + * Results: + * The newly create object (contains smart reference) is returned. + * The returned object has a ref count of 0. + * + * Side effects: + * Increases ref count of the referenced dictionary. + * + *---------------------------------------------------------------------- */ Tcl_Obj * @@ -1991,9 +2017,9 @@ Tcl_DictObjSmartRef( * * DictSmartRefCmd -- * - * This function implements the "dict smartref" Tcl command. See the user - * documentation for details on what it does, and TIP#111 for the formal - * specification. + * This function implements the "dict smartref" Tcl command. + * + * See description of Tcl_DictObjSmartRef for details. * * Results: * A standard Tcl result. diff --git a/generic/tclInt.h b/generic/tclInt.h index a569788..15cb355 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4886,6 +4886,13 @@ typedef struct NRE_callback { #define Tcl_Free(ptr) TclpFree(ptr) #endif +/* + * Other externals. + */ + +MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment + * (if changed with tcl-env). */ + #endif /* _TCLINT */ /* diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 686c1e4..773eb6a 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -418,7 +418,8 @@ TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { /* * Several debug primitives */ -#if 1 +#if 0 +/* currently unused, debug resp. test purposes only */ void TclStrIdxTreePrint( -- cgit v0.12 From 01697f2acc39c303ebeedd2f9ebb82380cb388ce Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:02:02 +0000 Subject: "clock add" rewritten in C, using common functionality of "clock scan" (and freescan)... test-performance.tcl: test cases extended to cover "clock add" --- generic/tclClock.c | 735 +++++++++++++++++++++++++++++++--------------- generic/tclDate.h | 2 +- library/clock.tcl | 328 --------------------- library/init.tcl | 2 +- tests-perf/clock.perf.tcl | 39 +++ tests/clock.test | 17 +- 6 files changed, 559 insertions(+), 564 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index fc7c70c..791898b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -116,9 +116,6 @@ static int ClockMicrosecondsObjCmd( static int ClockMillisecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ClockParseformatargsObjCmd( - ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); static int ClockSecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -128,10 +125,17 @@ static int ClockFormatObjCmd( static int ClockScanObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockScanCommit( + ClientData clientData, register DateInfo *info, + register ClockFmtScnCmdArgs *opts); static int ClockFreeScan( - ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); +static int ClockCalcRelTime( + register DateInfo *info, ClockFmtScnCmdArgs *opts); +static int ClockAddObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); static struct tm * ThreadSafeLocalTime(const time_t *); static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); @@ -151,6 +155,7 @@ struct ClockCommand { }; static const struct ClockCommand clockCommands[] = { + { "add", ClockAddObjCmd }, { "clicks", ClockClicksObjCmd }, { "getenv", ClockGetenvObjCmd }, { "microseconds", ClockMicrosecondsObjCmd }, @@ -166,7 +171,6 @@ static const struct ClockCommand clockCommands[] = { ClockGetjuliandayfromerayearmonthdayObjCmd }, { "GetJulianDayFromEraYearWeekDay", ClockGetjuliandayfromerayearweekdayObjCmd }, - { "ParseFormatArgs", ClockParseformatargsObjCmd }, { NULL, NULL } }; @@ -763,7 +767,6 @@ ClockConfigureObjCmd( Tcl_Obj *const objv[]) /* Parameter vector */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; static const char *const options[] = { "-system-tz", "-setup-tz", "-default-locale", @@ -814,7 +817,7 @@ ClockConfigureObjCmd( Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->LastSetupTZData); } - if (timezoneObj == litPtr[LIT_GMT]) { + if (timezoneObj == dataPtr->literals[LIT_GMT]) { optionIndex = CLOCK_SETUP_GMT; } else if (timezoneObj == dataPtr->SystemTimeZone) { optionIndex = CLOCK_SETUP_NOP; @@ -1158,7 +1161,7 @@ ClockConvertlocaltoutcObjCmd( "found in dictionary", -1)); return TCL_ERROR; } - if ((Tcl_GetWideIntFromObj(interp, secondsObj, + if ((TclGetWideIntFromObj(interp, secondsObj, &fields.localSeconds) != TCL_OK) || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) || ConvertLocalToUTC(clientData, interp, &fields, objv[2], changeover)) { @@ -1238,7 +1241,7 @@ ClockGetdatefieldsObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "seconds timezone changeover"); return TCL_ERROR; } - if (Tcl_GetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK + if (TclGetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK || TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) { return TCL_ERROR; } @@ -1762,7 +1765,7 @@ ConvertLocalToUTCUsingTable( int corrOffset; Tcl_WideInt backCompVal; /* check DST-hole interval contains UTC time */ - Tcl_GetWideIntFromObj(NULL, cellv[0], &backCompVal); + TclGetWideIntFromObj(NULL, cellv[0], &backCompVal); if ( fields->seconds >= backCompVal - fields->tzOffset && fields->seconds <= backCompVal + fields->tzOffset ) { @@ -2148,7 +2151,7 @@ LookupLastTransition( */ if (Tcl_ListObjIndex(interp, rowv[0], 0, &compObj) != TCL_OK - || Tcl_GetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { + || TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { return NULL; } @@ -2170,7 +2173,7 @@ LookupLastTransition( int m = (l + u + 1) / 2; if (Tcl_ListObjIndex(interp, rowv[m], 0, &compObj) != TCL_OK || - Tcl_GetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { + TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { return NULL; } if (tick >= compVal) { @@ -2922,10 +2925,21 @@ ClockMicrosecondsObjCmd( return TCL_OK; } +static inline void +ClockInitFmtScnArgs( + ClientData clientData, + Tcl_Interp *interp, + ClockFmtScnCmdArgs *opts) +{ + memset(opts, 0, sizeof(*opts)); + opts->clientData = clientData; + opts->interp = interp; +} + /* *----------------------------------------------------------------------------- * - * _ClockParseFmtScnArgs -- + * ClockParseFmtScnArgs -- * * Parses the arguments for [clock scan] and [clock format]. * @@ -2936,92 +2950,116 @@ ClockMicrosecondsObjCmd( *----------------------------------------------------------------------------- */ +#define CLC_FMT_ARGS (0) +#define CLC_SCN_ARGS (1 << 0) +#define CLC_ADD_ARGS (1 << 1) + static int -_ClockParseFmtScnArgs( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ +ClockParseFmtScnArgs( + register + ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ + TclDateFields *date, /* Extracted date-time corresponding base + * (by scan or add) resp. clockval (by format) */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ - ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ - int forScan /* Flag to differentiate between format and scan */ + int flags /* Flags, differentiates between format, scan, add */ ) { - ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; + Tcl_Interp *interp = opts->interp; + ClockClientData *dataPtr = opts->clientData; int gmtFlag = 0; - static const char *const options[2][6] = { - { /* Format command line options */ - "-format", "-gmt", "-locale", - "-timezone", NULL }, - { /* Scan command line options */ + static const char *const options[] = { "-format", "-gmt", "-locale", - "-timezone", "-base", NULL } + "-timezone", "-base", NULL }; enum optionInd { - CLOCK_FORMAT_FORMAT, CLOCK_FORMAT_GMT, CLOCK_FORMAT_LOCALE, - CLOCK_FORMAT_TIMEZONE, CLOCK_FORMAT_BASE + CLC_ARGS_FORMAT, CLC_ARGS_GMT, CLC_ARGS_LOCALE, + CLC_ARGS_TIMEZONE, CLC_ARGS_BASE }; int optionIndex; /* Index of an option. */ int saw = 0; /* Flag == 1 if option was seen already. */ int i; + Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ + + /* clock value (as current base) */ + if ( !(flags & (CLC_SCN_ARGS)) ) { + opts->baseObj = objv[1]; + saw |= (1 << CLC_ARGS_BASE); + } /* * Extract values for the keywords. */ - memset(opts, 0, sizeof(*opts)); for (i = 2; i < objc; i+=2) { - if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], + /* bypass integers (offsets) by "clock add" */ + if (flags & CLC_ADD_ARGS) { + Tcl_WideInt num; + if (TclGetWideIntFromObj(NULL, objv[i], &num) == TCL_OK) { + continue; + } + } + /* get option */ + if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &optionIndex) != TCL_OK) { - Tcl_SetErrorCode(interp, "CLOCK", "badOption", - Tcl_GetString(objv[i]), NULL); - return TCL_ERROR; + goto badOption; + } + /* if already specified */ + if (saw & (1 << optionIndex)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad option \"%s\": doubly present", + TclGetString(objv[i])) + ); + goto badOption; } switch (optionIndex) { - case CLOCK_FORMAT_FORMAT: + case CLC_ARGS_FORMAT: + if (flags & CLC_ADD_ARGS) { + goto badOptionMsg; + } opts->formatObj = objv[i+1]; break; - case CLOCK_FORMAT_GMT: + case CLC_ARGS_GMT: if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ return TCL_ERROR; } break; - case CLOCK_FORMAT_LOCALE: + case CLC_ARGS_LOCALE: opts->localeObj = objv[i+1]; break; - case CLOCK_FORMAT_TIMEZONE: + case CLC_ARGS_TIMEZONE: opts->timezoneObj = objv[i+1]; break; - case CLOCK_FORMAT_BASE: + case CLC_ARGS_BASE: + if ( !(flags & (CLC_SCN_ARGS)) ) { + goto badOptionMsg; + } opts->baseObj = objv[i+1]; break; } - saw |= 1 << optionIndex; + saw |= (1 << optionIndex); } /* * Check options. */ - if ((saw & (1 << CLOCK_FORMAT_GMT)) - && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { + if ((saw & (1 << CLC_ARGS_GMT)) + && (saw & (1 << CLC_ARGS_TIMEZONE))) { Tcl_SetResult(interp, "cannot use -gmt and -timezone in same call", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } if (gmtFlag) { - opts->timezoneObj = litPtr[LIT_GMT]; + opts->timezoneObj = dataPtr->literals[LIT_GMT]; } - opts->clientData = clientData; - opts->interp = interp; - /* If time zone not specified use system time zone */ if ( opts->timezoneObj == NULL || TclGetString(opts->timezoneObj) == NULL || opts->timezoneObj->length == 0 ) { - opts->timezoneObj = ClockGetSystemTimeZone(clientData, interp); + opts->timezoneObj = ClockGetSystemTimeZone(opts->clientData, interp); if (opts->timezoneObj == NULL) { return TCL_ERROR; } @@ -3029,85 +3067,90 @@ _ClockParseFmtScnArgs( /* Setup timezone (normalize object if needed and load TZ on demand) */ - opts->timezoneObj = ClockSetupTimeZone(clientData, interp, opts->timezoneObj); + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, interp, opts->timezoneObj); if (opts->timezoneObj == NULL) { return TCL_ERROR; } - return TCL_OK; -} - -/* - *----------------------------------------------------------------------------- - * - * ClockParseformatargsObjCmd -- - * - * Parses the arguments for [clock format]. - * - * Results: - * Returns a standard Tcl result, whose value is a four-element list - * comprising the time format, the locale, and the timezone. - * - * This function exists for backward compatibility purposes. - * - *----------------------------------------------------------------------------- - */ + /* Base (by scan or add) or clock value (by format) */ -static int -ClockParseformatargsObjCmd( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ - int objc, /* Parameter count */ - Tcl_Obj *const objv[]) /* Parameter vector */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - ClockFmtScnCmdArgs opts; /* Format, locale and timezone */ - Tcl_WideInt clockVal; /* Clock value - just used to parse. */ - int ret; + if (opts->baseObj != NULL) { + if (TclGetWideIntFromObj(NULL, opts->baseObj, &baseVal) != TCL_OK) { - /* - * Args consist of a time followed by keyword-value pairs. - */ + /* we accept "-now" as current date-time */ + const char *const nowOpts[] = { + "-now", NULL + }; + int idx; + if (Tcl_GetIndexFromObj(NULL, opts->baseObj, nowOpts, "seconds or -now", + TCL_EXACT, &idx) == TCL_OK + ) { + goto baseNow; + } - if (objc < 2 || (objc % 2) != 0) { - Tcl_WrongNumArgs(interp, 0, objv, - "clock format clockval ?-format string? " - "?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"); - Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); - return TCL_ERROR; - } + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "expected integer but got \"%s\"", + Tcl_GetString(opts->baseObj))); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL); + i = 1; + goto badOption; + } + /* + * seconds could be an unsigned number that overflowed. Make sure + * that it isn't. + */ - /* - * Extract values for the keywords. - */ + if (opts->baseObj->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + return TCL_ERROR; + } - ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &opts, 0); - if (ret != TCL_OK) { - return ret; + } else { + +baseNow: + { + Tcl_Time now; + Tcl_GetTime(&now); + baseVal = (Tcl_WideInt) now.sec; + } } /* - * Check options. + * Extract year, month and day from the base time for the parser to use as + * defaults */ - if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { - return TCL_ERROR; + /* check base fields already cached (by TZ, last-second cache) */ + if ( dataPtr->lastBase.timezoneObj == opts->timezoneObj + && dataPtr->lastBase.Date.seconds == baseVal) { + memcpy(date, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); + } else { + /* extact fields from base */ + date->seconds = baseVal; + if (ClockGetDateFields(opts->clientData, interp, date, opts->timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { /* TODO - GREGORIAN_CHANGE_DATE should be locale-dependent */ + return TCL_ERROR; + } + /* cache last base */ + memcpy(&dataPtr->lastBase.Date, date, ClockCacheableDateFieldsSize); + Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts->timezoneObj); } - if (opts.formatObj == NULL) - opts.formatObj = literals[LIT__DEFAULT_FORMAT]; - if (opts.localeObj == NULL) - opts.localeObj = literals[LIT_C]; - if (opts.timezoneObj == NULL) - opts.timezoneObj = literals[LIT__NIL]; - /* - * Return options as a list. - */ - - Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&opts.formatObj)); return TCL_OK; + +badOptionMsg: + + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad option \"%s\": unexpected for command \"%s\"", + TclGetString(objv[i]), TclGetString(objv[0])) + ); + +badOption: + + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + i < objc ? Tcl_GetString(objv[i]) : NULL, NULL); + + return TCL_ERROR; } /*---------------------------------------------------------------------- @@ -3141,11 +3184,11 @@ ClockFormatObjCmd( int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt clockVal; /* Time, expressed in seconds from the Epoch */ DateFormat dateFmt; /* Common structure used for formatting */ + /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval " + Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now " "?-format string? " "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); @@ -3153,53 +3196,17 @@ ClockFormatObjCmd( return TCL_ERROR; } - /* - * Extract values for the keywords. - */ - - ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &opts, 0); - if (ret != TCL_OK) { - return ret; - } - - ret = TCL_ERROR; - - if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { - return TCL_ERROR; - } - - /* - * seconds could be an unsigned number that overflowed. Make sure - * that it isn't. - */ - - if (objv[1]->typePtr == &tclBignumType) { - Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); - return TCL_ERROR; - } - memset(&dateFmt, 0, sizeof(dateFmt)); /* - * Extract year, month and day from the base time for the parser to use as - * defaults + * Extract values for the keywords. */ - /* check base fields already cached (by TZ, last-second cache) */ - if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj - && dataPtr->lastBase.Date.seconds == clockVal) { - memcpy(&dateFmt.date, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); - } else { - /* extact fields from base */ - dateFmt.date.seconds = clockVal; - if (ClockGetDateFields(clientData, interp, &dateFmt.date, opts.timezoneObj, - GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; - } - /* cache last base */ - memcpy(&dataPtr->lastBase.Date, &dateFmt.date, ClockCacheableDateFieldsSize); - Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); + ClockInitFmtScnArgs(clientData, interp, &opts); + ret = ClockParseFmtScnArgs(&opts, &dateFmt.date, objc, objv, + CLC_FMT_ARGS); + if (ret != TCL_OK) { + goto done; } /* Default format */ @@ -3249,14 +3256,12 @@ ClockScanObjCmd( int objc, /* Parameter count */ Tcl_Obj *const objv[]) /* Parameter values */ { - ClockClientData *dataPtr = clientData; - int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ DateInfo yy; /* Common structure used for parsing */ DateInfo *info = &yy; + /* even number of arguments */ if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " "?-base seconds? " @@ -3267,59 +3272,17 @@ ClockScanObjCmd( return TCL_ERROR; } + ClockInitDateInfo(&yy); + /* * Extract values for the keywords. */ - ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &opts, 1); + ClockInitFmtScnArgs(clientData, interp, &opts); + ret = ClockParseFmtScnArgs(&opts, &yy.date, objc, objv, + CLC_SCN_ARGS); if (ret != TCL_OK) { - return ret; - } - - ret = TCL_ERROR; - - if (opts.baseObj != NULL) { - if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { - return TCL_ERROR; - } - /* - * seconds could be an unsigned number that overflowed. Make sure - * that it isn't. - */ - - if (opts.baseObj->typePtr == &tclBignumType) { - Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); - return TCL_ERROR; - } - - } else { - Tcl_Time now; - Tcl_GetTime(&now); - baseVal = (Tcl_WideInt) now.sec; - } - - ClockInitDateInfo(info); - - /* - * Extract year, month and day from the base time for the parser to use as - * defaults - */ - - /* check base fields already cached (by TZ, last-second cache) */ - if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj - && dataPtr->lastBase.Date.seconds == baseVal) { - memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); - } else { - /* extact fields from base */ - yydate.seconds = baseVal; - if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, - GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; - } - /* cache last base */ - memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); - Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); + goto done; } /* seconds are in localSeconds (relative base date), so reset time here */ @@ -3336,18 +3299,54 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); + ret = ClockFreeScan(&yy, objv[1], &opts); } else { /* Use compiled version of Scan - */ - ret = ClockScan(info, objv[1], &opts); + ret = ClockScan(&yy, objv[1], &opts); + } + + /* Convert date info structure into UTC seconds */ + + if (ret == TCL_OK) { + ret = ClockScanCommit(clientData, &yy, &opts); } +done: + + Tcl_UnsetObjRef(yy.date.tzName); + if (ret != TCL_OK) { - goto done; + return ret; } + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yy.date.seconds)); + return TCL_OK; +} + +/*---------------------------------------------------------------------- + * + * ClockScanCommit -- + * + * Converts date info structure into UTC seconds. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +ClockScanCommit( + ClientData clientData, /* Client data containing literal pool */ + register DateInfo *info, /* Clock scan info structure */ + register + ClockFmtScnCmdArgs *opts) /* Format, locale, timezone and base */ +{ /* If needed assemble julianDay using year, month, etc. */ if (info->flags & CLF_ASSEMBLE_JULIANDAY) { if ((info->flags & CLF_ISO8601)) { @@ -3362,13 +3361,12 @@ ClockScanObjCmd( } /* some overflow checks, if not extended */ - if (!(opts.flags & CLF_EXTENDED)) { + if (!(opts->flags & CLF_EXTENDED)) { if (yydate.julianDay > 5373484) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj( "requested date too large to represent", -1)); - Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); - ret = TCL_ERROR; - goto done; + Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); + return TCL_ERROR; } } @@ -3382,9 +3380,9 @@ ClockScanObjCmd( } if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY|CLF_LOCALSEC)) { - if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, + if (ConvertLocalToUTC(clientData, opts->interp, &yydate, opts->timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; + return TCL_ERROR; } } @@ -3392,17 +3390,6 @@ ClockScanObjCmd( yydate.seconds += yyRelSeconds; - ret = TCL_OK; - -done: - - Tcl_UnsetObjRef(yydate.tzName); - - if (ret != TCL_OK) { - return ret; - } - - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yydate.seconds)); return TCL_OK; } @@ -3423,8 +3410,6 @@ done: int ClockFreeScan( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ register DateInfo *info, /* Date fields used for parsing & converting * simultaneously a yy-parse structure of the @@ -3432,7 +3417,8 @@ ClockFreeScan( Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; + Tcl_Interp *interp = opts->interp; + ClockClientData *dataPtr = opts->clientData; int ret = TCL_ERROR; @@ -3487,7 +3473,7 @@ ClockFreeScan( 60 * minEast + 3600 * dstFlag); Tcl_IncrRefCount(tzObjStor); - opts->timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); + opts->timezoneObj = ClockSetupTimeZone(dataPtr, interp, tzObjStor); Tcl_DecrRefCount(tzObjStor); if (opts->timezoneObj == NULL) { @@ -3531,6 +3517,39 @@ ClockFreeScan( * Do relative times */ + ret = ClockCalcRelTime(info, opts); + + /* Free scanning completed - date ready */ + +done: + + return ret; +} + +/*---------------------------------------------------------------------- + * + * ClockCalcRelTime -- + * + * Used for calculating of relative times. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +int +ClockCalcRelTime( + register + DateInfo *info, /* Date fields used for converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + /* + * Because some calculations require in-between conversion of the + * julian day, we can repeat this processing multiple times + */ repeat_rel: if (yyHaveRel) { @@ -3667,13 +3686,267 @@ repeat_rel: info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; } - /* Free scanning completed - date ready */ + return TCL_OK; +} + + +/*---------------------------------------------------------------------- + * + * ClockWeekdaysOffs -- + * + * Get offset in days for the number of week days corresponding the + * given day of week (skipping Saturdays and Sundays). + * + * + * Results: + * Returns a day increment adjusted the given weekdays + * + *---------------------------------------------------------------------- + */ + +static inline int +ClockWeekdaysOffs( + register int dayOfWeek, + register int offs) +{ + register int weeks, resDayOfWeek; + + /* offset in days */ + weeks = offs / 5; + offs = offs % 5; + /* compiler fix for negative offs - wrap (0, -1) -> (-1, 4) */ + if (offs < 0) { + weeks--; + offs = 5 + offs; + } + offs += 7 * weeks; + + /* resulting day of week */ + { + register int day = (offs % 7); + /* compiler fix for negative offs - wrap (0, -1) -> (-1, 6) */ + if (day < 0) { + day = 7 + day; + } + resDayOfWeek = dayOfWeek + day; + } + + /* adjust if we start from a weekend */ + if (dayOfWeek > 5) { + int adj = 5 - dayOfWeek; + offs += adj; + resDayOfWeek += adj; + } + + /* adjust if we end up on a weekend */ + if (resDayOfWeek > 5) { + offs += 2; + } + + return offs; +} + + + +/*---------------------------------------------------------------------- + * + * ClockAddObjCmd -- , clock add -- + * + * Adds an offset to a given time. + * + * Refer to the user documentation to see what it exactly does. + * + * Syntax: + * clock add clockval ?count unit?... ?-option value? + * + * Parameters: + * clockval -- Starting time value + * count -- Amount of a unit of time to add + * unit -- Unit of time to add, must be one of: + * years year months month weeks week + * days day hours hour minutes minute + * seconds second + * + * Options: + * -gmt BOOLEAN + * Flag synonymous with '-timezone :GMT' + * -timezone ZONE + * Name of the time zone in which calculations are to be done. + * -locale NAME + * Name of the locale in which calculations are to be done. + * Used to determine the Gregorian change date. + * + * Results: + * Returns a standard Tcl result with the given time adjusted + * by the given offset(s) in order. + * + * Notes: + * It is possible that adding a number of months or years will adjust the + * day of the month as well. For instance, the time at one month after + * 31 January is either 28 or 29 February, because February has fewer + * than 31 days. + * + *---------------------------------------------------------------------- + */ + +int +ClockAddObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter values */ +{ + ClockClientData *dataPtr = clientData; + int ret; + ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ + DateInfo yy; /* Common structure used for parsing */ + DateInfo *info = &yy; + + /* add "week" to units also (because otherwise ambiguous) */ + static const char *const units[] = { + "years", "months", "week", "weeks", + "days", "weekdays", + "hours", "minutes", "seconds", + NULL + }; + enum unitInd { + CLC_ADD_YEARS, CLC_ADD_MONTHS, CLC_ADD_WEEK, CLC_ADD_WEEKS, + CLC_ADD_DAYS, CLC_ADD_WEEKDAYS, + CLC_ADD_HOURS, CLC_ADD_MINUTES, CLC_ADD_SECONDS + }; + int unitIndex; /* Index of an option. */ + int i; + Tcl_WideInt offs; - ret = TCL_OK; + /* even number of arguments */ + if ((objc & 1) == 1) { + Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now ?number units?..." + "?-gmt boolean? " + "?-locale LOCALE? ?-timezone ZONE?"); + Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); + return TCL_ERROR; + } + + ClockInitDateInfo(&yy); + + /* + * Extract values for the keywords. + */ + + ClockInitFmtScnArgs(clientData, interp, &opts); + ret = ClockParseFmtScnArgs(&opts, &yy.date, objc, objv, + CLC_ADD_ARGS); + if (ret != TCL_OK) { + goto done; + } + + /* time together as seconds of the day */ + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + /* seconds are in localSeconds (relative base date), so reset time here */ + yyHour = 0; yyMinutes = 0; yyMeridian = MER24; + + ret = TCL_ERROR; + + /* + * Find each offset and process date increment + */ + + for (i = 2; i < objc; i+=2) { + /* bypass not integers (options, allready processed above) */ + if (TclGetWideIntFromObj(NULL, objv[i], &offs) != TCL_OK) { + continue; + } + if (objv[i]->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + goto done; + } + /* get unit */ + if (Tcl_GetIndexFromObj(interp, objv[i+1], units, "unit", 0, + &unitIndex) != TCL_OK) { + goto done; + } + + /* nothing to do if zero quantity */ + if (!offs) { + continue; + } + + /* if in-between conversion needed (already have relative date/time), + * correct date info, because the date may be changed, + * so refresh it now */ + + if ( yyHaveRel + && ( unitIndex == CLC_ADD_WEEKDAYS + /* some months can be shorter as another */ + || yyRelMonth || yyRelDay + /* day changed */ + || yySeconds + yyRelSeconds > SECONDS_PER_DAY + || yySeconds + yyRelSeconds < 0 + ) + ) { + if (ClockCalcRelTime(info, &opts) != TCL_OK) { + goto done; + } + } + + /* process increment by offset + unit */ + yyHaveRel++; + switch (unitIndex) { + case CLC_ADD_YEARS: + yyRelMonth += offs * 12; + break; + case CLC_ADD_MONTHS: + yyRelMonth += offs; + break; + case CLC_ADD_WEEK: + case CLC_ADD_WEEKS: + yyRelDay += offs * 7; + break; + case CLC_ADD_DAYS: + yyRelDay += offs; + break; + case CLC_ADD_WEEKDAYS: + /* add number of week days (skipping Saturdays and Sundays) + * to a relative days value. */ + offs = ClockWeekdaysOffs(yy.date.dayOfWeek, offs); + yyRelDay += offs; + break; + case CLC_ADD_HOURS: + yyRelSeconds += offs * 60 * 60; + break; + case CLC_ADD_MINUTES: + yyRelSeconds += offs * 60; + break; + case CLC_ADD_SECONDS: + yyRelSeconds += offs; + break; + } + } + + /* + * Do relative times (if not yet already processed interim): + */ + + if (yyHaveRel) { + if (ClockCalcRelTime(info, &opts) != TCL_OK) { + goto done; + } + } + + /* Convert date info structure into UTC seconds */ + + ret = ClockScanCommit(clientData, &yy, &opts); done: - return ret; + Tcl_UnsetObjRef(yy.date.tzName); + + if (ret != TCL_OK) { + return ret; + } + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yy.date.seconds)); + return TCL_OK; } /*---------------------------------------------------------------------- diff --git a/generic/tclDate.h b/generic/tclDate.h index 1519842..e614f9d 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -264,7 +264,7 @@ typedef struct ClockFmtScnCmdArgs { Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ - Tcl_Obj *baseObj; /* Base (scan only) */ + Tcl_Obj *baseObj; /* Base (scan and add) or clockValue (format) */ int flags; /* Flags control scanning */ Tcl_Obj *mcDictObj; /* Current dictionary of tcl::clock package for given localeObj*/ diff --git a/library/clock.tcl b/library/clock.tcl index 3caa270..ba4676b 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -1948,334 +1948,6 @@ proc ::tcl::clock::WeekdayOnOrBefore { weekday j } { #---------------------------------------------------------------------- # -# clock add -- -# -# Adds an offset to a given time. -# -# Syntax: -# clock add clockval ?count unit?... ?-option value? -# -# Parameters: -# clockval -- Starting time value -# count -- Amount of a unit of time to add -# unit -- Unit of time to add, must be one of: -# years year months month weeks week -# days day hours hour minutes minute -# seconds second -# -# Options: -# -gmt BOOLEAN -# (Deprecated) Flag synonymous with '-timezone :GMT' -# -timezone ZONE -# Name of the time zone in which calculations are to be done. -# -locale NAME -# Name of the locale in which calculations are to be done. -# Used to determine the Gregorian change date. -# -# Results: -# Returns the given time adjusted by the given offset(s) in -# order. -# -# Notes: -# It is possible that adding a number of months or years will adjust the -# day of the month as well. For instance, the time at one month after -# 31 January is either 28 or 29 February, because February has fewer -# than 31 days. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::add { clockval args } { - if { [llength $args] % 2 != 0 } { - set cmdName "clock add" - return -code error \ - -errorcode [list CLOCK wrongNumArgs] \ - "wrong \# args: should be\ - \"$cmdName clockval ?number units?...\ - ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?\"" - } - if { [catch { expr {wide($clockval)} } result] } { - return -code error "expected integer but got \"$clockval\"" - } - - set offsets {} - set gmt 0 - set locale c - if {[set timezone [configure -system-tz]] eq ""} { - set timezone [GetSystemTimeZone] - } - - foreach { a b } $args { - if { [string is integer -strict $a] } { - lappend offsets $a $b - } else { - switch -exact -- $a { - -g - -gm - -gmt { - set gmt $b - } - -l - -lo - -loc - -loca - -local - -locale { - set locale [string tolower $b] - } - -t - -ti - -tim - -time - -timez - -timezo - -timezon - - -timezone { - set timezone $b - } - default { - throw [list CLOCK badOption $a] \ - "bad option \"$a\",\ - must be -gmt, -locale or -timezone" - } - } - } - } - - # Check options for validity - - if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { - return -code error \ - -errorcode [list CLOCK gmtWithTimezone] \ - "cannot use -gmt and -timezone in same call" - } - if { ![string is boolean -strict $gmt] } { - return -code error "expected boolean value but got \"$gmt\"" - } elseif { $gmt } { - set timezone :GMT - } - - EnterLocale $locale - - set changeover [mc GREGORIAN_CHANGE_DATE] - - if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { - dict unset opts -errorinfo - return -options $opts $retval - } - - try { - foreach { quantity unit } $offsets { - switch -exact -- $unit { - years - year { - set clockval [AddMonths [expr { 12 * $quantity }] \ - $clockval $timezone $changeover] - } - months - month { - set clockval [AddMonths $quantity $clockval $timezone \ - $changeover] - } - - weeks - week { - set clockval [AddDays [expr { 7 * $quantity }] \ - $clockval $timezone $changeover] - } - days - day { - set clockval [AddDays $quantity $clockval $timezone \ - $changeover] - } - - weekdays - weekday { - set clockval [AddWeekDays $quantity $clockval $timezone \ - $changeover] - } - - hours - hour { - set clockval [expr { 3600 * $quantity + $clockval }] - } - minutes - minute { - set clockval [expr { 60 * $quantity + $clockval }] - } - seconds - second { - set clockval [expr { $quantity + $clockval }] - } - - default { - throw [list CLOCK badUnit $unit] \ - "unknown unit \"$unit\", must be \ - years, months, weeks, days, hours, minutes or seconds" - } - } - } - return $clockval - } trap CLOCK {result opts} { - # Conceal the innards of [clock] when it's an expected error - dict unset opts -errorinfo - return -options $opts $result - } -} - -#---------------------------------------------------------------------- -# -# AddMonths -- -# -# Add a given number of months to a given clock value in a given -# time zone. -# -# Parameters: -# months - Number of months to add (may be negative) -# clockval - Seconds since the epoch before the operation -# timezone - Time zone in which the operation is to be performed -# -# Results: -# Returns the new clock value as a number of seconds since -# the epoch. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AddMonths { months clockval timezone changeover } { - variable DaysInRomanMonthInCommonYear - variable DaysInRomanMonthInLeapYear - variable TZData - - # Convert the time to year, month, day, and fraction of day. - - set date [GetDateFields $clockval $timezone $changeover] - dict set date secondOfDay [expr { - [dict get $date localSeconds] % 86400 - }] - dict set date tzName $timezone - - # Add the requisite number of months - - set m [dict get $date month] - incr m $months - incr m -1 - set delta [expr { $m / 12 }] - set mm [expr { $m % 12 }] - dict set date month [expr { $mm + 1 }] - dict incr date year $delta - - # If the date doesn't exist in the current month, repair it - - if { [IsGregorianLeapYear $date] } { - set hath [lindex $DaysInRomanMonthInLeapYear $mm] - } else { - set hath [lindex $DaysInRomanMonthInCommonYear $mm] - } - if { [dict get $date dayOfMonth] > $hath } { - dict set date dayOfMonth $hath - } - - # Reconvert to a number of seconds - - set date [GetJulianDayFromEraYearMonthDay \ - $date[set date {}]\ - $changeover] - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - set date [ConvertLocalToUTC $date[set date {}] $timezone \ - $changeover] - - return [dict get $date seconds] - -} - -#---------------------------------------------------------------------- -# -# AddWeekDays -- -# -# Add a given number of week days (skipping Saturdays and Sundays) -# to a given clock value in a given time zone. -# -# Parameters: -# days - Number of days to add (may be negative) -# clockval - Seconds since the epoch before the operation -# timezone - Time zone in which the operation is to be performed -# changeover - Julian Day on which the Gregorian calendar was adopted -# in the target locale. -# -# Results: -# Returns the new clock value as a number of seconds since the epoch. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AddWeekDays { days clockval timezone changeover } { - - if {$days == 0} { - return $clockval - } - - set day [format $clockval -format %u] - - set weeks [expr {$days / 5}] - set rdays [expr {$days % 5}] - set toAdd [expr {7 * $weeks + $rdays}] - set resDay [expr {$day + ($toAdd % 7)}] - - # Adjust if we start from a weekend - if {$day > 5} { - set adj [expr {5 - $day}] - incr toAdd $adj - incr resDay $adj - } - - # Adjust if we end up on a weekend - if {$resDay > 5} { - incr toAdd 2 - } - - AddDays $toAdd $clockval $timezone $changeover -} - -#---------------------------------------------------------------------- -# -# AddDays -- -# -# Add a given number of days to a given clock value in a given time -# zone. -# -# Parameters: -# days - Number of days to add (may be negative) -# clockval - Seconds since the epoch before the operation -# timezone - Time zone in which the operation is to be performed -# changeover - Julian Day on which the Gregorian calendar was adopted -# in the target locale. -# -# Results: -# Returns the new clock value as a number of seconds since the epoch. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AddDays { days clockval timezone changeover } { - variable TZData - - # Convert the time to Julian Day - - set date [GetDateFields $clockval $timezone $changeover] - dict set date secondOfDay [expr { - [dict get $date localSeconds] % 86400 - }] - dict set date tzName $timezone - - # Add the requisite number of days - - dict incr date julianDay $days - - # Reconvert to a number of seconds - - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - set date [ConvertLocalToUTC $date[set date {}] $timezone \ - $changeover] - - return [dict get $date seconds] - -} - -#---------------------------------------------------------------------- -# # ChangeCurrentLocale -- # # The global locale was changed within msgcat. diff --git a/library/init.tcl b/library/init.tcl index f1f1bb4..405a400 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { + foreach cmd {mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 16664b2..733db1a 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -318,6 +318,44 @@ proc test-freescan {{reptime 1000}} { } {puts [clock format $_(r) -locale en]} } +proc test-add {{reptime 1000}} { + _test_run $reptime { + # Add : years + {clock add 1246379415 5 years -gmt 1} + # Add : months + {clock add 1246379415 18 months -gmt 1} + # Add : weeks + {clock add 1246379415 20 weeks -gmt 1} + # Add : days + {clock add 1246379415 385 days -gmt 1} + # Add : weekdays + {clock add 1246379415 3 weekdays -gmt 1} + + # Add : hours + {clock add 1246379415 5 hours -gmt 1} + # Add : minutes + {clock add 1246379415 55 minutes -gmt 1} + # Add : seconds + {clock add 1246379415 100 seconds -gmt 1} + + # Add : +/- in gmt + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -gmt 1} + # Add : +/- in system timezone + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -timezone :CET} + + # Add : gmt + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -gmt 1} + # Add : system timezone + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -timezone :CET} + + # Add : all in gmt + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -gmt 1} + # Add : all in system timezone + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -timezone :CET} + + } {puts [clock format $_(r) -locale en]} +} + proc test-other {{reptime 1000}} { _test_run $reptime { # Bad zone @@ -338,6 +376,7 @@ proc test {{reptime 1000}} { test-format $reptime test-scan $reptime test-freescan $reptime + test-add $reptime test-other $reptime puts \n**OK** diff --git a/tests/clock.test b/tests/clock.test index d9c491a..b540024 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -254,7 +254,7 @@ proc ::testClock::registry { cmd path key } { test clock-1.0 "clock format - wrong # args" { list [catch {clock format} msg] $msg $::errorCode -} {1 {wrong # args: should be "clock format clockval ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} +} {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} test clock-1.1 "clock format - bad time" { list [catch {clock format foo} msg] $msg @@ -270,10 +270,11 @@ test clock-1.3 "clock format - empty val" { test clock-1.4 "clock format - bad flag" {*}{ -body { - list [catch {clock format 0 -oops badflag} msg] $msg $::errorCode + # range error message for possible extensions: + list [catch {clock format 0 -oops badflag} msg] [string range $msg 0 60] $::errorCode } -match glob - -result {1 {bad option "-oops": must be -format, -gmt, -locale, or -timezone} {CLOCK badOption -oops}} + -result {1 {bad option "-oops": must be -format, -gmt, -locale, -timezone} {CLOCK badOption -oops}} } test clock-1.5 "clock format - bad timezone" { @@ -288,6 +289,16 @@ test clock-1.7 "clock format - option abbreviations" { clock format 0 -g true -f "%Y-%m-%d" } 1970-01-01 +test clock-1.8 "clock format -now" { + # give one second more for test (if on boundary of the current second): + set n [clock format [clock seconds] -g 1 -f "%s"] + expr {[clock format -now -g 1 -f "%s"] in [list $n [incr n]]} +} 1 + +test clock-1.9 "clock arguments: option doubly present" { + list [catch {clock format 0 -gmt 1 -gmt 0} result] $result +} {1 {bad option "-gmt": doubly present}} + # BEGIN testcases2 # Test formatting of Gregorian year, month, day, all formats -- cgit v0.12 From df7cbb28e0aaf30b8564ec1636870b0327c2ac21 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:02:14 +0000 Subject: small amend (reset have rel flag) --- generic/tclClock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclClock.c b/generic/tclClock.c index 791898b..efa9120 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3623,6 +3623,8 @@ repeat_rel: goto repeat_rel; } } + + yyHaveRel = 0; } /* -- cgit v0.12 From a841205be9defa27d0eb12214555f45bf141f858 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:09:23 +0000 Subject: amend lost changes after rebase to fossil --- library/clock.tcl | 1 + tests/clock.test | 1 + 2 files changed, 2 insertions(+) diff --git a/library/clock.tcl b/library/clock.tcl index ba4676b..94d2341 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -10,6 +10,7 @@ #---------------------------------------------------------------------- # # Copyright (c) 2004,2005,2006,2007 by Kevin B. Kenny +# Copyright (c) 2015 by Sergey G. Brester aka sebres. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # diff --git a/tests/clock.test b/tests/clock.test index b540024..9e86c97 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -7,6 +7,7 @@ # generates output for errors. No output means no errors were found. # # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. +# Copyright (c) 2015 by Sergey G. Brester aka sebres. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -- cgit v0.12 From 1ebb964dbc71b70763380a8a55c607671151d51c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 11 Jan 2017 16:23:18 +0000 Subject: Use more Tcl_AppendResult(), in order to prevent the use of a (char *) type case. --- generic/tclTest.c | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 85e4a29..faecbc6 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -90,7 +90,7 @@ static Tcl_Trace cmdTrace; * TestdelCmd: */ -typedef struct DelCmd { +typedef struct { Tcl_Interp *interp; /* Interpreter in which command exists. */ char *deleteCmd; /* Script to execute when command is deleted. * Malloc'ed. */ @@ -101,7 +101,7 @@ typedef struct DelCmd { * command. */ -typedef struct TclEncoding { +typedef struct { Tcl_Interp *interp; char *toUtfCmd; char *fromUtfCmd; @@ -124,7 +124,7 @@ static int exitMainLoop = 0; * Event structure used in testing the event queue management procedures. */ -typedef struct TestEvent { +typedef struct { Tcl_Event header; /* Header common to all events */ Tcl_Interp *interp; /* Interpreter that will handle the event */ Tcl_Obj *command; /* Command to evaluate when the event occurs */ @@ -823,7 +823,7 @@ TestasyncCmd( if (argc < 2) { wrongNumArgs: - Tcl_SetResult(interp, (char *)"wrong # args", TCL_STATIC); + Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; } if (strcmp(argv[1], "create") == 0) { @@ -913,7 +913,7 @@ TestasyncCmd( if (Tcl_CreateThread(&threadID, AsyncThreadProc, INT2PTR(id), TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK) { - Tcl_SetResult(interp, (char *)"can't create thread", TCL_STATIC); + Tcl_AppendResult(interp, "can't create thread", NULL); Tcl_MutexUnlock(&asyncTestMutex); return TCL_ERROR; } @@ -1060,7 +1060,7 @@ TestcmdinfoCmd( Tcl_DStringResult(interp, &delString); } else if (strcmp(argv[1], "get") == 0) { if (Tcl_GetCommandInfo(interp, argv[2], &info) ==0) { - Tcl_SetResult(interp, (char *)"??", TCL_STATIC); + Tcl_AppendResult(interp, "??", NULL); return TCL_OK; } if (info.proc == CmdProc1) { @@ -1187,7 +1187,7 @@ TestcmdtokenCmd( token = Tcl_CreateCommand(interp, argv[2], CmdProc1, (ClientData) "original", NULL); sprintf(buf, "%p", (void *)token); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_AppendResult(interp, buf, NULL); } else if (strcmp(argv[1], "name") == 0) { Tcl_Obj *objPtr; @@ -1293,7 +1293,7 @@ TestcmdtraceCmd( result = Tcl_EvalEx(interp, argv[2], -1, 0); Tcl_DeleteTrace(interp, cmdTrace); if (!deleteCalled) { - Tcl_SetResult(interp, (char *)"Delete wasn't called", TCL_STATIC); + Tcl_AppendResult(interp, "Delete wasn't called", NULL); return TCL_ERROR; } else { return result; @@ -1593,7 +1593,7 @@ TestdelCmd( Tcl_Interp *slave; if (argc != 4) { - Tcl_SetResult(interp, (char *)"wrong # args", TCL_STATIC); + Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; } @@ -1798,7 +1798,7 @@ TestdstringCmd( if (argc < 2) { wrongNumArgs: - Tcl_SetResult(interp, (char *)"wrong # args", TCL_STATIC); + Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; } if (strcmp(argv[1], "append") == 0) { @@ -1834,9 +1834,9 @@ TestdstringCmd( goto wrongNumArgs; } if (strcmp(argv[2], "staticsmall") == 0) { - Tcl_SetResult(interp, (char *)"short", TCL_STATIC); + Tcl_AppendResult(interp, "short", NULL); } else if (strcmp(argv[2], "staticlarge") == 0) { - Tcl_SetResult(interp, (char *)"first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", TCL_STATIC); + Tcl_AppendResult(interp, "first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", NULL); } else if (strcmp(argv[2], "free") == 0) { char *s = ckalloc(100); strcpy(s, "This is a malloc-ed string"); @@ -1996,7 +1996,7 @@ EncodingToUtfProc( TclEncoding *encodingPtr; encodingPtr = (TclEncoding *) clientData; - Tcl_EvalEx(encodingPtr->interp,encodingPtr->toUtfCmd,-1,TCL_EVAL_GLOBAL); + Tcl_EvalEx(encodingPtr->interp, encodingPtr->toUtfCmd, -1, TCL_EVAL_GLOBAL); len = strlen(Tcl_GetStringResult(encodingPtr->interp)); if (len > dstLen) { @@ -2028,7 +2028,7 @@ EncodingFromUtfProc( TclEncoding *encodingPtr; encodingPtr = (TclEncoding *) clientData; - Tcl_EvalEx(encodingPtr->interp, encodingPtr->fromUtfCmd,-1,TCL_EVAL_GLOBAL); + Tcl_EvalEx(encodingPtr->interp, encodingPtr->fromUtfCmd, -1, TCL_EVAL_GLOBAL); len = strlen(Tcl_GetStringResult(encodingPtr->interp)); if (len > dstLen) { @@ -2436,7 +2436,7 @@ TestexprlongCmd( " expression\"", NULL); return TCL_ERROR; } - Tcl_SetResult(interp, (char *)"This is a result", TCL_STATIC); + Tcl_AppendResult(interp, "This is a result", NULL); result = Tcl_ExprLong(interp, argv[1], &exprResult); if (result != TCL_OK) { return result; @@ -2478,7 +2478,7 @@ TestexprlongobjCmd( Tcl_WrongNumArgs(interp, 1, objv, "expression"); return TCL_ERROR; } - Tcl_SetResult(interp, (char *)"This is a result", TCL_STATIC); + Tcl_AppendResult(interp, "This is a result", NULL); result = Tcl_ExprLongObj(interp, objv[1], &exprResult); if (result != TCL_OK) { return result; @@ -2521,7 +2521,7 @@ TestexprdoubleCmd( " expression\"", NULL); return TCL_ERROR; } - Tcl_SetResult(interp, (char *)"This is a result", TCL_STATIC); + Tcl_AppendResult(interp, "This is a result", NULL); result = Tcl_ExprDouble(interp, argv[1], &exprResult); if (result != TCL_OK) { return result; @@ -2564,7 +2564,7 @@ TestexprdoubleobjCmd( Tcl_WrongNumArgs(interp, 1, objv, "expression"); return TCL_ERROR; } - Tcl_SetResult(interp, (char *)"This is a result", TCL_STATIC); + Tcl_AppendResult(interp, "This is a result", NULL); result = Tcl_ExprDoubleObj(interp, objv[1], &exprResult); if (result != TCL_OK) { return result; @@ -4486,7 +4486,7 @@ TestseterrorcodeCmd( const char **argv) /* Argument strings. */ { if (argc > 6) { - Tcl_SetResult(interp, (char *)"too many args", TCL_STATIC); + Tcl_AppendResult(interp, "too many args", NULL); return TCL_ERROR; } switch (argc) { @@ -5090,7 +5090,7 @@ TestsetCmd( const char *value; if (argc == 2) { - Tcl_SetResult(interp, (char *)"before get", TCL_STATIC); + Tcl_AppendResult(interp, "before get", NULL); value = Tcl_GetVar2(interp, argv[1], NULL, flags); if (value == NULL) { return TCL_ERROR; @@ -5098,7 +5098,7 @@ TestsetCmd( Tcl_AppendElement(interp, value); return TCL_OK; } else if (argc == 3) { - Tcl_SetResult(interp, (char *)"before set", TCL_STATIC); + Tcl_AppendResult(interp, "before set", NULL); value = Tcl_SetVar2(interp, argv[1], NULL, argv[2], flags); if (value == NULL) { return TCL_ERROR; @@ -5122,7 +5122,7 @@ Testset2Cmd( const char *value; if (argc == 3) { - Tcl_SetResult(interp, (char *)"before get", TCL_STATIC); + Tcl_AppendResult(interp, "before get", NULL); value = Tcl_GetVar2(interp, argv[1], argv[2], flags); if (value == NULL) { return TCL_ERROR; @@ -5130,7 +5130,7 @@ Testset2Cmd( Tcl_AppendElement(interp, value); return TCL_OK; } else if (argc == 4) { - Tcl_SetResult(interp, (char *)"before set", TCL_STATIC); + Tcl_AppendResult(interp, "before set", NULL); value = Tcl_SetVar2(interp, argv[1], argv[2], argv[3], flags); if (value == NULL) { return TCL_ERROR; @@ -5200,7 +5200,7 @@ TestsaveresultCmd( objPtr = NULL; /* Lint. */ switch ((enum options) index) { case RESULT_SMALL: - Tcl_SetResult(interp, (char *)"small result", TCL_VOLATILE); + Tcl_AppendResult(interp, "small result", NULL); break; case RESULT_APPEND: Tcl_AppendResult(interp, "append result", NULL); @@ -5310,7 +5310,7 @@ TestmainthreadCmd( Tcl_SetObjResult(interp, idObj); return TCL_OK; } else { - Tcl_SetResult(interp, (char *)"wrong # args", TCL_STATIC); + Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; } } @@ -6111,7 +6111,7 @@ TestWrongNumArgsObjCmd( * Don't use Tcl_WrongNumArgs here, as that is the function * we want to test! */ - Tcl_SetResult(interp, (char *)"insufficient arguments", TCL_STATIC); + Tcl_AppendResult(interp, "insufficient arguments", NULL); return TCL_ERROR; } @@ -6128,7 +6128,7 @@ TestWrongNumArgsObjCmd( /* * Asked for more arguments than were given. */ - Tcl_SetResult(interp, (char *)"insufficient arguments", TCL_STATIC); + Tcl_AppendResult(interp, "insufficient arguments", NULL); return TCL_ERROR; } @@ -6905,7 +6905,7 @@ TestgetintCmd( const char **argv) { if (argc < 2) { - Tcl_SetResult(interp, (char *)"wrong # args", TCL_STATIC); + Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; } else { int val, i, total=0; -- cgit v0.12 From f03990cd122b2a54155a90896713d3783b343ddd Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 Jan 2017 16:35:41 +0000 Subject: code review: small optimization of msgcat::mcget, prevents infinite loop if at all no translation --- library/msgcat/msgcat.tcl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 1260139..f9f57db 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -245,8 +245,6 @@ proc msgcat::mc {src args} { # format command. proc msgcat::mcget {ns loc args} { - variable Msgs - if {$loc eq {C}} { set loclist [PackagePreferences $ns] set loc [lindex $loclist 0] @@ -270,18 +268,20 @@ proc msgcat::mcget {ns loc args} { # search translation for each locale (regarding parent namespaces) for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { foreach loc $loclist { - if {[dict exists $Msgs $nscur $loc $src]} { - if {[llength $args] > 1} { - return [format [dict get $Msgs $nscur $loc $src] \ - {*}[lrange $args 1 end]] - } else { - return [dict get $Msgs $nscur $loc $src] + set msgs [mcget $nscur $loc] + if {![catch { set val [dict get $msgs $src] }]} { + if {[llength $args] == 1} { + return $val } + return [format $val {*}[lrange $args 1 end]] } } } - # get with package default locale - mcget $ns [lindex $loclist 0] {*}$args + # no translation : + if {[llength $args] == 1} { + return $src + } + return [format $src {*}[lrange $args 1 end]] } # msgcat::mcexists -- @@ -942,8 +942,10 @@ proc msgcat::Merge {ns locales} { set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] } } else { - catch { + if {[catch { set mrgcat [dict get $Msgs $ns $loc] + }]} { + set mrgcat [dict create] } } dict set Merged $ns $loc $mrgcat -- cgit v0.12 From 77481ec3e1c4841e2c18ba404b55e98b2a9995f0 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 Jan 2017 16:36:28 +0000 Subject: code review and inline documentation --- generic/tclClock.c | 27 +++++ generic/tclClockFmt.c | 323 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 323 insertions(+), 27 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index efa9120..c63f425 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -412,7 +412,19 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- + * + * ClockGetSystemLocale -- + * + * Returns system locale. + * + * Executes ::tcl::clock::GetSystemLocale in given interpreter. + * + * Results: + * Returns system locale tcl object. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * ClockGetSystemLocale( ClockClientData *dataPtr, /* Opaque pointer to literal pool, etc. */ @@ -426,7 +438,19 @@ ClockGetSystemLocale( } /* *---------------------------------------------------------------------- + * + * ClockGetCurrentLocale -- + * + * Returns current locale. + * + * Executes ::tcl::clock::mclocale in given interpreter. + * + * Results: + * Returns current locale tcl object. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * ClockGetCurrentLocale( ClockClientData *dataPtr, /* Client data containing literal pool */ @@ -978,6 +1002,9 @@ ClockGetTZData( * * Returns system (current) timezone. * + * If system zone not yet cached, it executes ::tcl::clock::GetSystemTimeZone + * in given interpreter and caches its result. + * * Results: * Returns normalized timezone object. * diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ff16714..d875bd4 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -41,6 +41,24 @@ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); * Clock scan and format facilities. */ +/* + *---------------------------------------------------------------------- + * + * _str2int -- , _str2wideInt -- + * + * Fast inline-convertion of string to signed int or wide int by given + * start/end. + * + * The given string should contain numbers chars only (because already + * pre-validated within parsing routines) + * + * Results: + * Returns a standard Tcl result. + * TCL_OK - by successful conversion, TCL_ERROR by (wide) int overflow + * + *---------------------------------------------------------------------- + */ + static inline int _str2int( int *out, @@ -101,6 +119,22 @@ _str2wideInt( return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * _itoaw -- , _witoaw -- + * + * Fast inline-convertion of signed int or wide int to string, using + * given padding with specified padchar and width (or without padding). + * + * This is a very fast replacement for sprintf("%02d"). + * + * Results: + * Returns position in buffer after end of conversion result. + * + *---------------------------------------------------------------------- + */ + static inline char * _itoaw( char *buf, @@ -257,7 +291,15 @@ _witoaw( } /* - *---------------------------------------------------------------------- + * Global GC as LIFO for released scan/format object storages. + * + * Used to holds last released CLOCK_FMT_SCN_STORAGE_GC_SIZE formats + * (after last reference from Tcl-object will be removed). This is helpful + * to avoid continuous (re)creation and compiling by some dynamically resp. + * variable format objects, that could be often reused. + * + * As long as format storage is used resp. belongs to GC, it takes place in + * FmtScnHashTable also. */ #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 @@ -268,6 +310,24 @@ static struct { unsigned int count; } ClockFmtScnStorage_GC = {NULL, NULL, 0}; +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageGC_In -- + * + * Adds an format storage object to GC. + * + * If current GC is full (size larger as CLOCK_FMT_SCN_STORAGE_GC_SIZE) + * this removes last unused storage at begin of GC stack (LIFO). + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static inline void ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) { @@ -291,6 +351,22 @@ ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) ClockFmtScnStorageDelete(delEnt); } } + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorage_GC_Out -- + * + * Restores (for reusing) given format storage object from GC. + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static inline void ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) { @@ -304,13 +380,19 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) #endif + /* - *---------------------------------------------------------------------- + * Global format storage hash table of type ClockFmtScnStorageHashKeyType + * (contains list of scan/format object storages, shared across all threads). + * + * Used for fast searching by format string. */ - static Tcl_HashTable FmtScnHashTable; static int initialized = 0; +/* + * Wrappers between pointers to hash entry and format storage object + */ static inline Tcl_HashEntry * HashEntry4FmtScn(ClockFmtScnStorage *fss) { return (Tcl_HashEntry*)(fss + 1); @@ -320,8 +402,18 @@ FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); }; -/* - * Format storage hash (list of formats shared across all threads). +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageAllocProc -- + * + * Allocate space for a hash entry containing format storage together + * with the string key. + * + * Results: + * The return value is a pointer to the created entry. + * + *---------------------------------------------------------------------- */ static Tcl_HashEntry * @@ -353,6 +445,19 @@ ClockFmtScnStorageAllocProc( return hPtr; } +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageFreeProc -- + * + * Free format storage object and space of given hash entry. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static void ClockFmtScnStorageFreeProc( Tcl_HashEntry *hPtr) @@ -373,6 +478,19 @@ ClockFmtScnStorageFreeProc( ckfree(fss); } +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageDelete -- + * + * Delete format storage object. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); @@ -392,7 +510,7 @@ static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; /* - * Type definition. + * Type definition of clock-format tcl object type. */ Tcl_ObjType ClockFmtObjType = { @@ -409,9 +527,6 @@ Tcl_ObjType ClockFmtObjType = { #define ObjLocFmtKey(objPtr) \ (*((Tcl_Obj **)&(objPtr)->internalRep.twoPtrValue.ptr2)) -/* - *---------------------------------------------------------------------- - */ static void ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_Obj *srcPtr; @@ -442,9 +557,7 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) copyPtr->length = srcPtr->length; } } -/* - *---------------------------------------------------------------------- - */ + static void ClockFmtObj_FreeInternalRep(objPtr) Tcl_Obj *objPtr; @@ -472,9 +585,7 @@ ClockFmtObj_FreeInternalRep(objPtr) } objPtr->typePtr = NULL; }; -/* - *---------------------------------------------------------------------- - */ + static int ClockFmtObj_SetFromAny(interp, objPtr) Tcl_Interp *interp; @@ -494,9 +605,7 @@ ClockFmtObj_SetFromAny(interp, objPtr) return TCL_OK; }; -/* - *---------------------------------------------------------------------- - */ + static void ClockFmtObj_UpdateString(objPtr) Tcl_Obj *objPtr; @@ -518,7 +627,25 @@ ClockFmtObj_UpdateString(objPtr) /* *---------------------------------------------------------------------- + * + * ClockFrmObjGetLocFmtKey -- + * + * Retrieves format key object used to search localized format. + * + * This is normally stored in second pointer of internal representation. + * If format object is not localizable, it is equal the given format + * pointer and the first pointer of internal representation may be NULL. + * + * Results: + * Returns tcl object with key or format object if not localizable. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the key inside its internal representation. + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE Tcl_Obj* ClockFrmObjGetLocFmtKey( Tcl_Interp *interp, @@ -545,6 +672,25 @@ ClockFrmObjGetLocFmtKey( /* *---------------------------------------------------------------------- + * + * FindOrCreateFmtScnStorage -- + * + * Retrieves format storage for given string format. + * + * This will find the given format in the global storage hash table + * or create a format storage object on demaind and save the + * reference in the first pointer of internal representation of given + * object. + * + * Results: + * Returns scan/format storage pointer to ClockFmtScnStorage. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the format storage reference inside its internal representation. + * Increments objRefCount of the ClockFmtScnStorage reference. + * + *---------------------------------------------------------------------- */ static ClockFmtScnStorage * @@ -609,16 +755,16 @@ FindOrCreateFmtScnStorage( * * Tcl_GetClockFrmScnFromObj -- * - * Returns a clock format/scan representation of (*objPtr), if possible. - * If something goes wrong, NULL is returned, and if interp is non-NULL, - * an error message is written there. + * Returns a clock format/scan representation of (*objPtr), if possible. + * If something goes wrong, NULL is returned, and if interp is non-NULL, + * an error message is written there. * * Results: - * Valid representation of type ClockFmtScnStorage. + * Valid representation of type ClockFmtScnStorage. * * Side effects: - * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) - * and in global hash table, shared across all threads. + * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) + * and in global hash table, shared across all threads. * *---------------------------------------------------------------------- */ @@ -644,7 +790,27 @@ Tcl_GetClockFrmScnFromObj( return fss; } - +/* + *---------------------------------------------------------------------- + * + * ClockLocalizeFormat -- + * + * Wrap the format object in options to the localized format, + * corresponding given locale. + * + * This searches localized format in locale catalog, and if not yet + * exists, it executes ::tcl::clock::LocalizeFormat in given interpreter + * and caches its result in the locale catalog. + * + * Results: + * Localized format object. + * + * Side effects: + * Caches the localized format inside locale catalog. + * + *---------------------------------------------------------------------- + */ + MODULE_SCOPE Tcl_Obj * ClockLocalizeFormat( ClockFmtScnCmdArgs *opts) @@ -713,6 +879,22 @@ clean: return (opts->formatObj = valObj); } +/* + *---------------------------------------------------------------------- + * + * FindTokenBegin -- + * + * Find begin of given scan token in string, corresponding token type. + * + * Results: + * Position of token inside string if found. Otherwise - end of string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + static const char * FindTokenBegin( register const char *p, @@ -748,12 +930,22 @@ FindTokenBegin( return p; } -/* +/* + *---------------------------------------------------------------------- + * * DetermineGreedySearchLen -- * - * Determine min/max lengths as exact as possible (speed, greedy match) + * Determine min/max lengths as exact as possible (speed, greedy match). * + * Results: + * None. Lengths are stored in *minLenPtr, *maxLenPtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- */ + static void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok, @@ -836,6 +1028,23 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, *maxLenPtr = maxLen; } +/* + *---------------------------------------------------------------------- + * + * ObjListSearch -- + * + * Find largest part of the input string from start regarding min and + * max lengths in the given list (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found, TCL_RETURN - not matched, TCL_ERROR in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + static inline int ObjListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, int *val, @@ -909,6 +1118,26 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, } #endif +/* + *---------------------------------------------------------------------- + * + * ClockMCGetListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * given literal index mcKey (and builds it on demand). + * + * Searches localized index in locale catalog, and if not yet exists, + * creates string indexed tree and stores it in the locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + static TclStrIdxTree * ClockMCGetListIdxTree( ClockFmtScnCmdArgs *opts, @@ -960,6 +1189,27 @@ done: return idxTree; } +/* + *---------------------------------------------------------------------- + * + * ClockMCGetMultiListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * multiple lists by literal indices mcKeys (and builds it on demand). + * + * Searches localized index in locale catalog for mcKey, and if not + * yet exists, creates string indexed tree and stores it in the + * locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + static TclStrIdxTree * ClockMCGetMultiListIdxTree( ClockFmtScnCmdArgs *opts, @@ -1016,6 +1266,25 @@ done: return idxTree; } +/* + *---------------------------------------------------------------------- + * + * ClockStrIdxTreeSearch -- + * + * Find largest part of the input string from start regarding lengths + * in the given localized string indexed tree (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found and the index stored in *val, + * TCL_RETURN - not matched or ambigous, + * TCL_ERROR - in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + static inline int ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, TclStrIdxTree *idxTree, int *val, -- cgit v0.12 From 6ecb7aeabf05319bda235ebe45a174137a391447 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 13 Jan 2017 11:17:17 +0000 Subject: Patch from Zoran Vasiljevic, fix for missing proper initialization of the threaded allocator in some situations. --- generic/tclEvent.c | 3 --- generic/tclThreadAlloc.c | 1 + unix/tclUnixThrd.c | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 0eabc13..b0b8188 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1043,9 +1043,6 @@ TclInitSubsystems(void) #if USE_TCLALLOC TclInitAlloc(); /* Process wide mutex init */ #endif -#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) - TclpInitAllocCache(); -#endif #ifdef TCL_MEM_DEBUG TclInitDbCkalloc(); /* Process wide mutex init */ #endif diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 2ee758e..fc281db 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -210,6 +210,7 @@ GetCache(void) 1 << (NBUCKETS - 2 - i) : 1; bucketInfo[i].lockPtr = TclpNewAllocMutex(); } + TclpInitAllocCache(); } Tcl_MutexUnlock(initLockPtr); } diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 7394545..805599d 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -711,9 +711,7 @@ TclpFreeAllocMutex( void TclpInitAllocCache(void) { - pthread_mutex_lock(allocLockPtr); pthread_key_create(&key, NULL); - pthread_mutex_unlock(allocLockPtr); } void -- cgit v0.12 From e7e764dbdf02a4e2a1cec81daa8f25bf2312695a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 17 Jan 2017 12:02:43 +0000 Subject: Implement tag "deprecated" in genStubs.tcl. Will be used in Tk 8.7, for tagging the deprecated function Tk_FreeXId() --- tools/genStubs.tcl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 9f2c6ca..742aa46 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -199,6 +199,13 @@ proc genStubs::declare {args} { set stubs($curName,$platform,lastNum) $index } } + if {$platformList eq "deprecated"} { + set stubs($curName,generic,$index) $decl + if {![info exists stubs($curName,generic,lastNum)] \ + || ($index > $stubs($curName,generic,lastNum))} { + set stubs($curName,$platform,lastNum) $index + } + } } return } @@ -455,10 +462,16 @@ proc genStubs::parseArg {arg} { proc genStubs::makeDecl {name decl index} { variable scspec + variable stubs + variable libraryName lassign $decl rtype fname args append text "/* $index */\n" + if {[info exists stubs($name,deprecated,$index)]} { + set line "[string toupper $libraryName]_DEPRECATED $rtype" + } else { set line "$scspec $rtype" + } set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] set pad [expr {24 - [string length $line]}] @@ -682,7 +695,10 @@ proc genStubs::forAllStubs {name slotProc onAll textVar for {set i 0} {$i <= $lastNum} {incr i} { set slots [array names stubs $name,*,$i] set emit 0 - if {[info exists stubs($name,generic,$i)]} { + if {[info exists stubs($name,deprecated,$i)]} { + append text [$slotProc $name $stubs($name,generic,$i) $i] + set emit 1 + } elseif {[info exists stubs($name,generic,$i)]} { if {[llength $slots] > 1} { puts stderr "conflicting generic and platform entries:\ $name $i" -- cgit v0.12 From 2645c0ef3a6224d21261691e789a43332d87b5e5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 25 Jan 2017 12:22:16 +0000 Subject: If TCL_NO_DEPRECATED is defined, remove the "case" statement, and use much less interp->result. Implementation mostly taken over from "novem". If TCL_NO_DEPRECATED is not defined, nothing changes. --- generic/tclBasic.c | 2 +- generic/tclCmdAH.c | 3 ++- generic/tclDecls.h | 16 +++++++++++++++ generic/tclIO.c | 41 -------------------------------------- generic/tclInt.h | 2 ++ generic/tclResult.c | 55 +++++++++++++++++++++++++++++++++++++++------------ generic/tclStubInit.c | 41 ++++++++++++++++++++++++++++++++++++-- generic/tclTest.c | 20 ++++++++----------- generic/tclUtil.c | 17 ++++++++++++---- tests/case.test | 5 +++++ tests/result.test | 4 ++-- tools/configure | 2 +- 12 files changed, 131 insertions(+), 77 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 37dd699..b4d0a7b 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -203,7 +203,7 @@ static const CmdInfo builtInCmds[] = { {"append", Tcl_AppendObjCmd, TclCompileAppendCmd, NULL, CMD_IS_SAFE}, {"apply", Tcl_ApplyObjCmd, NULL, TclNRApplyObjCmd, CMD_IS_SAFE}, {"break", Tcl_BreakObjCmd, TclCompileBreakCmd, NULL, CMD_IS_SAFE}, -#ifndef EXCLUDE_OBSOLETE_COMMANDS +#ifndef TCL_NO_DEPRECATED {"case", Tcl_CaseObjCmd, NULL, NULL, CMD_IS_SAFE}, #endif {"catch", Tcl_CatchObjCmd, TclCompileCatchCmd, TclNRCatchObjCmd, CMD_IS_SAFE}, diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 4c299f8..9c6f6a1 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -149,7 +149,7 @@ Tcl_BreakObjCmd( * *---------------------------------------------------------------------- */ - +#ifndef TCL_NO_DEPRECATED /* ARGSUSED */ int Tcl_CaseObjCmd( @@ -267,6 +267,7 @@ Tcl_CaseObjCmd( return TCL_OK; } +#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 504af18..0dbf345 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3869,6 +3869,22 @@ extern const TclStubs *tclStubsPtr; #undef Tcl_AddObjErrorInfo #define Tcl_AddObjErrorInfo(interp, message, length) \ Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(message, length)) +#ifdef TCL_NO_DEPRECATED +#undef Tcl_SetResult +#define Tcl_SetResult(interp, result, freeProc) \ + do { \ + char *__result = result; \ + Tcl_FreeProc *__freeProc = freeProc; \ + Tcl_SetObjResult(interp, Tcl_NewStringObj(__result, -1)); \ + if (__result != NULL && __freeProc != NULL && __freeProc != TCL_VOLATILE) { \ + if (__freeProc == TCL_DYNAMIC) { \ + ckfree(__result); \ + } else { \ + (*__freeProc)(__result); \ + } \ + } \ + } while(0) +#endif /* TCL_NO_DEPRECATED */ #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) # if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG) diff --git a/generic/tclIO.c b/generic/tclIO.c index 5c39e19..506e6d5 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -7127,47 +7127,6 @@ Tcl_Tell( /* *--------------------------------------------------------------------------- * - * Tcl_SeekOld, Tcl_TellOld -- - * - * Backward-compatibility versions of the seek/tell interface that do not - * support 64-bit offsets. This interface is not documented or expected - * to be supported indefinitely. - * - * Results: - * As for Tcl_Seek and Tcl_Tell respectively, except truncated to - * whatever value will fit in an 'int'. - * - * Side effects: - * As for Tcl_Seek and Tcl_Tell respectively. - * - *--------------------------------------------------------------------------- - */ - -int -Tcl_SeekOld( - Tcl_Channel chan, /* The channel on which to seek. */ - int offset, /* Offset to seek to. */ - int mode) /* Relative to which location to seek? */ -{ - Tcl_WideInt wOffset, wResult; - - wOffset = Tcl_LongAsWide((long) offset); - wResult = Tcl_Seek(chan, wOffset, mode); - return (int) Tcl_WideAsLong(wResult); -} - -int -Tcl_TellOld( - Tcl_Channel chan) /* The channel to return pos for. */ -{ - Tcl_WideInt wResult = Tcl_Tell(chan); - - return (int) Tcl_WideAsLong(wResult); -} - -/* - *--------------------------------------------------------------------------- - * * Tcl_TruncateChannel -- * * Truncate a channel to the given length. diff --git a/generic/tclInt.h b/generic/tclInt.h index 8516385..5074378 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3219,9 +3219,11 @@ MODULE_SCOPE Tcl_Command TclInitBinaryCmd(Tcl_Interp *interp); MODULE_SCOPE int Tcl_BreakObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +#ifndef TCL_NO_DEPRECATED MODULE_SCOPE int Tcl_CaseObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +#endif MODULE_SCOPE int Tcl_CatchObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); diff --git a/generic/tclResult.c b/generic/tclResult.c index 9d0714c..6346636 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -27,7 +27,9 @@ enum returnKeys { static Tcl_Obj ** GetKeys(void); static void ReleaseKeys(ClientData clientData); static void ResetObjResult(Interp *iPtr); +#ifndef TCL_NO_DEPRECATED static void SetupAppendBuffer(Interp *iPtr, int newSpace); +#endif /* !TCL_NO_DEPRECATED */ /* * This structure is used to take a snapshot of the interpreter state in @@ -35,7 +37,7 @@ static void SetupAppendBuffer(Interp *iPtr, int newSpace); * then back up to the result or the error that was previously in progress. */ -typedef struct InterpState { +typedef struct { int status; /* return code status */ int flags; /* Each remaining field saves the */ int returnLevel; /* corresponding field of the Interp */ @@ -407,6 +409,7 @@ Tcl_DiscardResult( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED void Tcl_SetResult( Tcl_Interp *interp, /* Interpreter with which to associate the @@ -461,6 +464,7 @@ Tcl_SetResult( ResetObjResult(iPtr); } +#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -483,18 +487,21 @@ const char * Tcl_GetStringResult( register Tcl_Interp *interp)/* Interpreter whose result to return. */ { + Interp *iPtr = (Interp *) interp; +#ifdef TCL_NO_DEPRECATED + return Tcl_GetString(iPtr->objResultPtr); +#else /* * If the string result is empty, move the object result to the string * result, then reset the object result. */ - Interp *iPtr = (Interp *) interp; - if (*(iPtr->result) == 0) { Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)), TCL_VOLATILE); } return iPtr->result; +#endif } /* @@ -536,6 +543,7 @@ Tcl_SetObjResult( TclDecrRefCount(oldObjResult); +#ifndef TCL_NO_DEPRECATED /* * Reset the string result since we just set the result object. */ @@ -550,6 +558,7 @@ Tcl_SetObjResult( } iPtr->result = iPtr->resultSpace; iPtr->resultSpace[0] = 0; +#endif } /* @@ -578,6 +587,7 @@ Tcl_GetObjResult( Tcl_Interp *interp) /* Interpreter whose result to return. */ { register Interp *iPtr = (Interp *) interp; +#ifndef TCL_NO_DEPRECATED Tcl_Obj *objResultPtr; int length; @@ -604,6 +614,7 @@ Tcl_GetObjResult( iPtr->result = iPtr->resultSpace; iPtr->result[0] = 0; } +#endif /* !TCL_NO_DEPRECATED */ return iPtr->objResultPtr; } @@ -722,6 +733,21 @@ Tcl_AppendElement( * to result. */ { Interp *iPtr = (Interp *) interp; +#ifdef TCL_NO_DEPRECATED + Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1); + Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr); + const char *bytes; + + if (Tcl_IsShared(iPtr->objResultPtr)) { + Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr)); + } + bytes = TclGetString(iPtr->objResultPtr); + if (TclNeedSpace(bytes, bytes+iPtr->objResultPtr->length)) { + Tcl_AppendToObj(iPtr->objResultPtr, " ", 1); + } + Tcl_AppendObjToObj(iPtr->objResultPtr, listPtr); + Tcl_DecrRefCount(listPtr); +#else char *dst; int size; int flags; @@ -765,6 +791,7 @@ Tcl_AppendElement( flags |= TCL_DONT_QUOTE_HASH; } iPtr->appendUsed += Tcl_ConvertElement(element, dst, flags); +#endif /* !TCL_NO_DEPRECATED */ } /* @@ -786,6 +813,7 @@ Tcl_AppendElement( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED static void SetupAppendBuffer( Interp *iPtr, /* Interpreter whose result is being set up. */ @@ -846,6 +874,7 @@ SetupAppendBuffer( Tcl_FreeResult((Tcl_Interp *) iPtr); iPtr->result = iPtr->appendResult; } +#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -875,6 +904,7 @@ Tcl_FreeResult( { register Interp *iPtr = (Interp *) interp; +#ifndef TCL_NO_DEPRECATED if (iPtr->freeProc != NULL) { if (iPtr->freeProc == TCL_DYNAMIC) { ckfree(iPtr->result); @@ -884,6 +914,7 @@ Tcl_FreeResult( iPtr->freeProc = 0; } +#endif /* !TCL_NO_DEPRECATED */ ResetObjResult(iPtr); } @@ -913,6 +944,7 @@ Tcl_ResetResult( register Interp *iPtr = (Interp *) interp; ResetObjResult(iPtr); +#ifndef TCL_NO_DEPRECATED if (iPtr->freeProc != NULL) { if (iPtr->freeProc == TCL_DYNAMIC) { ckfree(iPtr->result); @@ -923,6 +955,7 @@ Tcl_ResetResult( } iPtr->result = iPtr->resultSpace; iPtr->resultSpace[0] = 0; +#endif /* !TCL_NO_DEPRECATED */ if (iPtr->errorCode) { /* Legacy support */ if (iPtr->flags & ERR_LEGACY_COPY) { @@ -1276,10 +1309,8 @@ TclProcessReturn( Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO], &valuePtr); if (valuePtr != NULL) { - int infoLen; - - (void) TclGetStringFromObj(valuePtr, &infoLen); - if (infoLen) { + (void) TclGetString(valuePtr); + if (valuePtr->length) { iPtr->errorInfo = valuePtr; Tcl_IncrRefCount(iPtr->errorInfo); iPtr->flags |= ERR_ALREADY_LOGGED; @@ -1382,13 +1413,11 @@ TclMergeReturnOptions( Tcl_Obj **keys = GetKeys(); for (; objc > 1; objv += 2, objc -= 2) { - int optLen; - const char *opt = TclGetStringFromObj(objv[0], &optLen); - int compareLen; - const char *compare = - TclGetStringFromObj(keys[KEY_OPTIONS], &compareLen); + const char *opt = TclGetString(objv[0]); + const char *compare = TclGetString(keys[KEY_OPTIONS]); - if ((optLen == compareLen) && (memcmp(opt, compare, optLen) == 0)) { + if ((objv[0]->length == keys[KEY_OPTIONS]->length) + && (memcmp(opt, compare, objv[0]->length) == 0)) { Tcl_DictSearch search; int done = 0; Tcl_Obj *keyPtr; diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 23da6dc..561b9dd 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -290,10 +290,47 @@ static int formatInt(char *buffer, int n){ #endif #else /* UNIX and MAC */ -# define TclpLocaltime_unix TclpLocaltime -# define TclpGmtime_unix TclpGmtime +# ifdef TCL_NO_DEPRECATED +# define TclpLocaltime_unix 0 +# define TclpGmtime_unix 0 +# else +# define TclpLocaltime_unix TclpLocaltime +# define TclpGmtime_unix TclpGmtime +# endif #endif +#ifdef TCL_NO_DEPRECATED +# define Tcl_SeekOld 0 +# define Tcl_TellOld 0 +# undef Tcl_SetResult +# define Tcl_SetResult 0 +#else /* TCL_NO_DEPRECATED */ +# define Tcl_SeekOld seekOld +# define Tcl_TellOld tellOld + +static int +seekOld( + Tcl_Channel chan, /* The channel on which to seek. */ + int offset, /* Offset to seek to. */ + int mode) /* Relative to which location to seek? */ +{ + Tcl_WideInt wOffset, wResult; + + wOffset = Tcl_LongAsWide((long) offset); + wResult = Tcl_Seek(chan, wOffset, mode); + return (int) Tcl_WideAsLong(wResult); +} + +static int +tellOld( + Tcl_Channel chan) /* The channel to return pos for. */ +{ + Tcl_WideInt wResult = Tcl_Tell(chan); + + return (int) Tcl_WideAsLong(wResult); +} +#endif /* !TCL_NO_DEPRECATED */ + /* * WARNING: The contents of this file is automatically generated by the * tools/genStubs.tcl script. Any modifications to the function declarations diff --git a/generic/tclTest.c b/generic/tclTest.c index faecbc6..a9dc1ca 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -290,12 +290,14 @@ static int TestlinkCmd(ClientData dummy, static int TestlocaleCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +#ifndef TCL_NO_DEPRECATED static int TestMathFunc(ClientData clientData, Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr); static int TestMathFunc2(ClientData clientData, Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr); +#endif /* TCL_NO_DEPRECATED */ static int TestmainthreadCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); static int TestsetmainloopCmd(ClientData dummy, @@ -329,12 +331,10 @@ static int TestreturnObjCmd(ClientData dummy, Tcl_Obj *const objv[]); static void TestregexpXflags(const char *string, int length, int *cflagsPtr, int *eflagsPtr); -#ifndef TCL_NO_DEPRECATED static int TestsaveresultCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void TestsaveresultFree(char *blockPtr); -#endif /* TCL_NO_DEPRECATED */ static int TestsetassocdataCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); static int TestsetCmd(ClientData dummy, @@ -555,7 +555,7 @@ Tcltest_Init( } /* TIP #268: Full patchlevel instead of just major.minor */ - if (Tcl_PkgProvide(interp, "Tcltest", TCL_PATCH_LEVEL) == TCL_ERROR) { + if (Tcl_PkgProvideEx(interp, "Tcltest", TCL_PATCH_LEVEL, NULL) == TCL_ERROR) { return TCL_ERROR; } @@ -658,10 +658,8 @@ Tcltest_Init( NULL, NULL); Tcl_CreateObjCommand(interp, "testreturn", TestreturnObjCmd, NULL, NULL); -#ifndef TCL_NO_DEPRECATED Tcl_CreateObjCommand(interp, "testsaveresult", TestsaveresultCmd, NULL, NULL); -#endif /* TCL_NO_DEPRECATED */ Tcl_CreateCommand(interp, "testsetassocdata", TestsetassocdataCmd, NULL, NULL); Tcl_CreateCommand(interp, "testsetnoerr", TestsetCmd, @@ -3341,6 +3339,7 @@ TestlocaleCmd( */ /* ARGSUSED */ +#ifndef TCL_NO_DEPRECATED static int TestMathFunc( ClientData clientData, /* Integer value to return. */ @@ -3460,6 +3459,7 @@ TestMathFunc2( } return result; } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -5144,7 +5144,6 @@ Testset2Cmd( } } -#ifndef TCL_NO_DEPRECATED /* *---------------------------------------------------------------------- * @@ -5197,6 +5196,7 @@ TestsaveresultCmd( return TCL_ERROR; } + freeCount = 0; objPtr = NULL; /* Lint. */ switch ((enum options) index) { case RESULT_SMALL: @@ -5221,7 +5221,6 @@ TestsaveresultCmd( break; } - freeCount = 0; Tcl_SaveResult(interp, &state); if (((enum options) index) == RESULT_OBJECT) { @@ -5239,11 +5238,9 @@ TestsaveresultCmd( switch ((enum options) index) { case RESULT_DYNAMIC: { - int present = iPtr->freeProc == TestsaveresultFree; - int called = freeCount; + int presentOrFreed = (iPtr->freeProc == TestsaveresultFree) ^ freeCount; - Tcl_AppendElement(interp, called ? "called" : "notCalled"); - Tcl_AppendElement(interp, present ? "present" : "missing"); + Tcl_AppendElement(interp, presentOrFreed ? "presentOrFreed" : "missingOrLeak"); break; } case RESULT_OBJECT: @@ -5278,7 +5275,6 @@ TestsaveresultFree( { freeCount++; } -#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 531f386..ba709cc 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2894,7 +2894,6 @@ Tcl_DStringResult( Tcl_DString *dsPtr) /* Dynamic string that is to become the * result of interp. */ { - Tcl_ResetResult(interp); Tcl_SetObjResult(interp, TclDStringToObj(dsPtr)); } @@ -2924,6 +2923,14 @@ Tcl_DStringGetResult( Tcl_DString *dsPtr) /* Dynamic string that is to become the result * of interp. */ { +#ifdef TCL_NO_DEPRECATED + Tcl_Obj *obj = Tcl_GetObjResult(interp); + const char *bytes = TclGetString(obj); + + Tcl_DStringFree(dsPtr); + Tcl_DStringAppend(dsPtr, bytes, obj->length); + Tcl_ResetResult(interp); +#else Interp *iPtr = (Interp *) interp; if (dsPtr->string != dsPtr->staticSpace) { @@ -2932,7 +2939,7 @@ Tcl_DStringGetResult( /* * Do more efficient transfer when we know the result is a Tcl_Obj. When - * there's no st`ring result, we only have to deal with two cases: + * there's no string result, we only have to deal with two cases: * * 1. When the string rep is the empty string, when we don't copy but * instead use the staticSpace in the DString to hold an empty string. @@ -2995,6 +3002,7 @@ Tcl_DStringGetResult( iPtr->result = iPtr->resultSpace; iPtr->resultSpace[0] = 0; +#endif /* !TCL_NO_DEPRECATED */ } /* @@ -3576,7 +3584,7 @@ TclGetIntForIndex( int *indexPtr) /* Location filled in with an integer * representing an index. */ { - int length; + size_t length; char *opPtr; const char *bytes; @@ -3594,7 +3602,8 @@ TclGetIntForIndex( return TCL_OK; } - bytes = TclGetStringFromObj(objPtr, &length); + bytes = TclGetString(objPtr); + length = objPtr->length; /* * Leading whitespace is acceptable in an index. diff --git a/tests/case.test b/tests/case.test index 6d63cea..d7558a9 100644 --- a/tests/case.test +++ b/tests/case.test @@ -11,6 +11,11 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. +if {![llength [info commands case]]} { + # No "case" command? So no need to test + return +} + if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest namespace import -force ::tcltest::* diff --git a/tests/result.test b/tests/result.test index 9e8a66b..859e546 100644 --- a/tests/result.test +++ b/tests/result.test @@ -31,7 +31,7 @@ test result-1.2 {Tcl_SaveInterpResult} {testsaveresult} { } {append result} test result-1.3 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult dynamic {set x 42} 0 -} {dynamic result notCalled present} +} {dynamic result presentOrFreed} test result-1.4 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult object {set x 42} 0 } {object result same} @@ -43,7 +43,7 @@ test result-1.6 {Tcl_SaveInterpResult} {testsaveresult} { } {42} test result-1.7 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult dynamic {set x 42} 1 -} {42 called missing} +} {42 presentOrFreed} test result-1.8 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult object {set x 42} 1 } {42 different} diff --git a/tools/configure b/tools/configure index 7c4d3db..5903cc8 100755 --- a/tools/configure +++ b/tools/configure @@ -1681,7 +1681,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # not, assume that its top-level directory is a sibling of ours. #-------------------------------------------------------------------- -DEF_VER=8.6 +DEF_VER=8.7 # Check whether --with-tcl was given. -- cgit v0.12 From 68275b03de1af80b960d68ceaa5199c33ede1b13 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Jan 2017 14:31:12 +0000 Subject: Some code cleanup: More internal use of size_t, less type casts (because of this). No functional changes. --- generic/tclLink.c | 66 ++++++++++++++++++++++--------------------------------- generic/tclObj.c | 17 +++++++------- generic/tclProc.c | 10 ++++----- 3 files changed, 40 insertions(+), 53 deletions(-) diff --git a/generic/tclLink.c b/generic/tclLink.c index 2ead6df..46471f5 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -67,10 +67,8 @@ typedef struct Link { static char * LinkTraceProc(ClientData clientData,Tcl_Interp *interp, const char *name1, const char *name2, int flags); static Tcl_Obj * ObjValue(Link *linkPtr); -static int GetInvalidIntFromObj(Tcl_Obj *objPtr, - int *intPtr); -static int GetInvalidDoubleFromObj(Tcl_Obj *objPtr, - double *doublePtr); +static int GetInvalidIntFromObj(Tcl_Obj *objPtr, int *intPtr); +static int GetInvalidDoubleFromObj(Tcl_Obj *objPtr, double *doublePtr); /* * Convenience macro for accessing the value of the C variable pointed to by a @@ -263,7 +261,8 @@ LinkTraceProc( int flags) /* Miscellaneous additional information. */ { Link *linkPtr = clientData; - int changed, valueLength; + int changed; + size_t valueLength; const char *value; char **pp; Tcl_Obj *valueObj; @@ -384,8 +383,7 @@ LinkTraceProc( case TCL_LINK_INT: if (Tcl_GetIntFromObj(NULL, valueObj, &linkPtr->lastValue.i) != TCL_OK) { - if (GetInvalidIntFromObj(valueObj, &linkPtr->lastValue.i) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &linkPtr->lastValue.i) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have integer value"; @@ -397,8 +395,7 @@ LinkTraceProc( case TCL_LINK_WIDE_INT: if (Tcl_GetWideIntFromObj(NULL, valueObj, &linkPtr->lastValue.w) != TCL_OK) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have integer value"; @@ -441,8 +438,7 @@ LinkTraceProc( case TCL_LINK_CHAR: if (Tcl_GetIntFromObj(NULL, valueObj, &valueInt) != TCL_OK || valueInt < SCHAR_MIN || valueInt > SCHAR_MAX) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have char value"; @@ -455,8 +451,7 @@ LinkTraceProc( case TCL_LINK_UCHAR: if (Tcl_GetIntFromObj(NULL, valueObj, &valueInt) != TCL_OK || valueInt < 0 || valueInt > UCHAR_MAX) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have unsigned char value"; @@ -469,8 +464,7 @@ LinkTraceProc( case TCL_LINK_SHORT: if (Tcl_GetIntFromObj(NULL, valueObj, &valueInt) != TCL_OK || valueInt < SHRT_MIN || valueInt > SHRT_MAX) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have short value"; @@ -483,8 +477,7 @@ LinkTraceProc( case TCL_LINK_USHORT: if (Tcl_GetIntFromObj(NULL, valueObj, &valueInt) != TCL_OK || valueInt < 0 || valueInt > USHRT_MAX) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have unsigned short value"; @@ -497,8 +490,7 @@ LinkTraceProc( case TCL_LINK_UINT: if (Tcl_GetWideIntFromObj(NULL, valueObj, &valueWide) != TCL_OK || valueWide < 0 || valueWide > UINT_MAX) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have unsigned int value"; @@ -513,8 +505,7 @@ LinkTraceProc( case TCL_LINK_LONG: if (Tcl_GetWideIntFromObj(NULL, valueObj, &valueWide) != TCL_OK || valueWide < LONG_MIN || valueWide > LONG_MAX) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have long value"; @@ -529,8 +520,7 @@ LinkTraceProc( case TCL_LINK_ULONG: if (Tcl_GetWideIntFromObj(NULL, valueObj, &valueWide) != TCL_OK || valueWide < 0 || (Tcl_WideUInt) valueWide > ULONG_MAX) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have unsigned long value"; @@ -547,8 +537,7 @@ LinkTraceProc( * FIXME: represent as a bignum. */ if (Tcl_GetWideIntFromObj(NULL, valueObj, &valueWide) != TCL_OK) { - if (GetInvalidIntFromObj(valueObj, &valueInt) - != TCL_OK) { + if (GetInvalidIntFromObj(valueObj, &valueInt) != TCL_OK) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return (char *) "variable must have unsigned wide int value"; @@ -575,12 +564,12 @@ LinkTraceProc( break; case TCL_LINK_STRING: - value = TclGetStringFromObj(valueObj, &valueLength); - valueLength++; + value = TclGetString(valueObj); + valueLength = valueObj->length + 1; pp = (char **) linkPtr->addr; *pp = ckrealloc(*pp, valueLength); - memcpy(*pp, value, (unsigned) valueLength); + memcpy(*pp, value, valueLength); break; default: @@ -688,17 +677,16 @@ static Tcl_ObjType invalidRealType = { static int SetInvalidRealFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { - int length; const char *str; const char *endPtr; - str = TclGetStringFromObj(objPtr, &length); - if ((length == 1) && (str[0] == '.')){ + str = TclGetString(objPtr); + if ((objPtr->length == 1) && (str[0] == '.')){ objPtr->typePtr = &invalidRealType; objPtr->internalRep.doubleValue = 0.0; return TCL_OK; } - if (TclParseNumber(NULL, objPtr, NULL, str, length, &endPtr, + if (TclParseNumber(NULL, objPtr, NULL, str, objPtr->length, &endPtr, TCL_PARSE_DECIMAL_ONLY) == TCL_OK) { /* If number is followed by [eE][+-]?, then it is an invalid * double, but it could be the start of a valid double. */ @@ -708,7 +696,7 @@ SetInvalidRealFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { if (*endPtr == 0) { double doubleValue = 0.0; Tcl_GetDoubleFromObj(NULL, objPtr, &doubleValue); - if (objPtr->typePtr->freeIntRepProc) objPtr->typePtr->freeIntRepProc(objPtr); + TclFreeIntRep(objPtr); objPtr->typePtr = &invalidRealType; objPtr->internalRep.doubleValue = doubleValue; return TCL_OK; @@ -726,17 +714,15 @@ SetInvalidRealFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { * (upperand lowercase). See bug [39f6304c2e]. */ int -GetInvalidIntFromObj(Tcl_Obj *objPtr, - int *intPtr) +GetInvalidIntFromObj(Tcl_Obj *objPtr, int *intPtr) { - int length; - const char *str = TclGetStringFromObj(objPtr, &length); + const char *str = TclGetString(objPtr); - if ((length == 1) && strchr("+-", str[0])) { + if ((objPtr->length == 1) && strchr("+-", str[0])) { *intPtr = (str[0] == '+'); return TCL_OK; - } else if ((length == 0) || - ((length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) { + } else if ((objPtr->length == 0) || + ((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) { *intPtr = 0; return TCL_OK; } diff --git a/generic/tclObj.c b/generic/tclObj.c index df900ce..d0f7480 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2004,9 +2004,10 @@ static int ParseBoolean( register Tcl_Obj *objPtr) /* The object to parse/convert. */ { - int i, length, newBool; + int newBool; char lowerCase[6]; - const char *str = TclGetStringFromObj(objPtr, &length); + const char *str = TclGetString(objPtr); + size_t i, length = objPtr->length; if ((length == 0) || (length > 5)) { /* @@ -2058,25 +2059,25 @@ ParseBoolean( /* * Checking the 'y' is redundant, but makes the code clearer. */ - if (strncmp(lowerCase, "yes", (size_t) length) == 0) { + if (strncmp(lowerCase, "yes", length) == 0) { newBool = 1; goto goodBoolean; } return TCL_ERROR; case 'n': - if (strncmp(lowerCase, "no", (size_t) length) == 0) { + if (strncmp(lowerCase, "no", length) == 0) { newBool = 0; goto goodBoolean; } return TCL_ERROR; case 't': - if (strncmp(lowerCase, "true", (size_t) length) == 0) { + if (strncmp(lowerCase, "true", length) == 0) { newBool = 1; goto goodBoolean; } return TCL_ERROR; case 'f': - if (strncmp(lowerCase, "false", (size_t) length) == 0) { + if (strncmp(lowerCase, "false", length) == 0) { newBool = 0; goto goodBoolean; } @@ -2085,10 +2086,10 @@ ParseBoolean( if (length < 2) { return TCL_ERROR; } - if (strncmp(lowerCase, "on", (size_t) length) == 0) { + if (strncmp(lowerCase, "on", length) == 0) { newBool = 1; goto goodBoolean; - } else if (strncmp(lowerCase, "off", (size_t) length) == 0) { + } else if (strncmp(lowerCase, "off", length) == 0) { newBool = 0; goto goodBoolean; } diff --git a/generic/tclProc.c b/generic/tclProc.c index bed520a..373192c 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -500,7 +500,8 @@ TclCreateProc( } for (i = 0; i < numArgs; i++) { - int fieldCount, nameLength, valueLength; + int fieldCount, nameLength; + size_t valueLength; const char **fieldValues; /* @@ -602,12 +603,11 @@ TclCreateProc( */ if (localPtr->defValuePtr != NULL) { - int tmpLength; - const char *tmpPtr = TclGetStringFromObj(localPtr->defValuePtr, - &tmpLength); + const char *tmpPtr = TclGetString(localPtr->defValuePtr); + size_t tmpLength = localPtr->defValuePtr->length; if ((valueLength != tmpLength) || - strncmp(fieldValues[1], tmpPtr, (size_t) tmpLength)) { + strncmp(fieldValues[1], tmpPtr, tmpLength)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "procedure \"%s\": formal parameter \"%s\" has " "default value inconsistent with precompiled body", -- cgit v0.12 From 4b357897d532c34fb10a853da41bbd7d273e729f Mon Sep 17 00:00:00 2001 From: ashok Date: Sat, 28 Jan 2017 06:38:22 +0000 Subject: Added assoc, ftype and move as auto_execok shell built-ins on Windows. --- library/init.tcl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index 544ea77..5a9e87c 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -636,8 +636,9 @@ proc auto_execok name { } set auto_execs($name) "" - set shellBuiltins [list cls copy date del dir echo erase md mkdir \ - mklink rd ren rename rmdir start time type ver vol] + set shellBuiltins [list assoc cls copy date del dir echo erase ftype \ + md mkdir mklink move rd ren rename rmdir start \ + time type ver vol] if {[info exists env(PATHEXT)]} { # Add an initial ; to have the {} extension check first. set execExtensions [split ";$env(PATHEXT)" ";"] -- cgit v0.12 From d917353c7e3cca82100ad439880e3c2e4c33d8c7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 3 Feb 2017 11:47:02 +0000 Subject: In TclGetNumberFromObj() macro (tclExecute.c): Don't fill in type if TCL_ERROR is returned: The caller doesn't do anything with this. Don't access (non-const) variable tclEmptyStringRep any more, use its value (&tclEmptyString) directly. Only keep it in tclPkg.c, for error checking. --- generic/tclBasic.c | 2 +- generic/tclDictObj.c | 2 +- generic/tclExecute.c | 4 ++-- generic/tclInt.h | 9 ++++----- generic/tclListObj.c | 16 ++++++++-------- generic/tclObj.c | 5 ++--- generic/tclPathObj.c | 2 +- generic/tclPkg.c | 2 ++ generic/tclResult.c | 4 ++-- generic/tclStringObj.c | 12 ++++++------ generic/tclUtil.c | 6 +++--- unix/tclUnixSock.c | 2 +- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b4d0a7b..63c5590 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6055,7 +6055,7 @@ TclNREvalObjEx( TclNRAddCallback(interp, TEOEx_ListCallback, listPtr, eoFramePtr, objPtr, NULL); - ListObjGetElements(listPtr, objc, objv); + TclListObjGetElements(NULL, listPtr, &objc, &objv); return TclNREvalObjv(interp, objc, objv, flags, NULL); } diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 1115999..970978f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -506,7 +506,7 @@ UpdateStringOfDict( /* Handle empty list case first, simplifies what follows */ if (numElems == 0) { - dictPtr->bytes = tclEmptyStringRep; + dictPtr->bytes = &tclEmptyString; dictPtr->length = 0; return; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index c0dc9c0..c244b08 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -512,7 +512,7 @@ VarHashCreateVar( (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ - ? (*(tPtr) = TCL_NUMBER_LONG),TCL_ERROR : \ + ? TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #else /* !TCL_WIDE_INT_IS_LONG */ #define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \ @@ -532,7 +532,7 @@ VarHashCreateVar( (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ - ? (*(tPtr) = TCL_NUMBER_LONG),TCL_ERROR : \ + ? TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #endif /* TCL_WIDE_INT_IS_LONG */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 5074378..4b87962 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2745,7 +2745,6 @@ MODULE_SCOPE long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS]; * shared by all new objects allocated by Tcl_NewObj. */ -MODULE_SCOPE char * tclEmptyStringRep; MODULE_SCOPE char tclEmptyString; /* @@ -4066,7 +4065,7 @@ typedef const char *TclDTraceStr; TclIncrObjsAllocated(); \ TclAllocObjStorage(objPtr); \ (objPtr)->refCount = 0; \ - (objPtr)->bytes = tclEmptyStringRep; \ + (objPtr)->bytes = &tclEmptyString; \ (objPtr)->length = 0; \ (objPtr)->typePtr = NULL; \ TCL_DTRACE_OBJ_CREATE(objPtr) @@ -4083,7 +4082,7 @@ typedef const char *TclDTraceStr; if (!(objPtr)->typePtr || !(objPtr)->typePtr->freeIntRepProc) { \ TCL_DTRACE_OBJ_FREE(objPtr); \ if ((objPtr)->bytes \ - && ((objPtr)->bytes != tclEmptyStringRep)) { \ + && ((objPtr)->bytes != &tclEmptyString)) { \ ckfree((objPtr)->bytes); \ } \ (objPtr)->length = -1; \ @@ -4244,7 +4243,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, #define TclInitStringRep(objPtr, bytePtr, len) \ if ((len) == 0) { \ - (objPtr)->bytes = tclEmptyStringRep; \ + (objPtr)->bytes = &tclEmptyString; \ (objPtr)->length = 0; \ } else { \ (objPtr)->bytes = (char *) ckalloc((unsigned) ((len) + 1)); \ @@ -4302,7 +4301,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, #define TclInvalidateStringRep(objPtr) \ if ((objPtr)->bytes != NULL) { \ - if ((objPtr)->bytes != tclEmptyStringRep) { \ + if ((objPtr)->bytes != &tclEmptyString) { \ ckfree((objPtr)->bytes); \ } \ (objPtr)->bytes = NULL; \ diff --git a/generic/tclListObj.c b/generic/tclListObj.c index c9fd333..11374cc 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -374,7 +374,7 @@ Tcl_SetListObj( listRepPtr = NewListIntRep(objc, objv, 1); ListSetIntRep(objPtr, listRepPtr); } else { - objPtr->bytes = tclEmptyStringRep; + objPtr->bytes = &tclEmptyString; objPtr->length = 0; } } @@ -465,7 +465,7 @@ Tcl_ListObjGetElements( if (listPtr->typePtr != &tclListType) { int result; - if (listPtr->bytes == tclEmptyStringRep) { + if (listPtr->bytes == &tclEmptyString) { *objcPtr = 0; *objvPtr = NULL; return TCL_OK; @@ -575,7 +575,7 @@ Tcl_ListObjAppendElement( if (listPtr->typePtr != &tclListType) { int result; - if (listPtr->bytes == tclEmptyStringRep) { + if (listPtr->bytes == &tclEmptyString) { Tcl_SetListObj(listPtr, 1, &objPtr); return TCL_OK; } @@ -739,7 +739,7 @@ Tcl_ListObjIndex( if (listPtr->typePtr != &tclListType) { int result; - if (listPtr->bytes == tclEmptyStringRep) { + if (listPtr->bytes == &tclEmptyString) { *objPtrPtr = NULL; return TCL_OK; } @@ -792,7 +792,7 @@ Tcl_ListObjLength( if (listPtr->typePtr != &tclListType) { int result; - if (listPtr->bytes == tclEmptyStringRep) { + if (listPtr->bytes == &tclEmptyString) { *intPtr = 0; return TCL_OK; } @@ -863,7 +863,7 @@ Tcl_ListObjReplace( Tcl_Panic("%s called with shared object", "Tcl_ListObjReplace"); } if (listPtr->typePtr != &tclListType) { - if (listPtr->bytes == tclEmptyStringRep) { + if (listPtr->bytes == &tclEmptyString) { if (!objc) { return TCL_OK; } @@ -1650,7 +1650,7 @@ TclListObjSetElement( if (listPtr->typePtr != &tclListType) { int result; - if (listPtr->bytes == tclEmptyStringRep) { + if (listPtr->bytes == &tclEmptyString) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("list index out of range", -1)); @@ -1979,7 +1979,7 @@ UpdateStringOfList( */ if (numElems == 0) { - listPtr->bytes = tclEmptyStringRep; + listPtr->bytes = &tclEmptyString; listPtr->length = 0; return; } diff --git a/generic/tclObj.c b/generic/tclObj.c index 90df579..1abbb31 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -49,7 +49,6 @@ Tcl_Mutex tclObjMutex; */ char tclEmptyString = '\0'; -char *tclEmptyStringRep = &tclEmptyString; #if defined(TCL_MEM_DEBUG) && defined(TCL_THREADS) /* @@ -1060,7 +1059,7 @@ TclDbInitNewObj( * debugging. */ { objPtr->refCount = 0; - objPtr->bytes = tclEmptyStringRep; + objPtr->bytes = &tclEmptyString; objPtr->length = 0; objPtr->typePtr = NULL; @@ -3395,7 +3394,7 @@ GetBignumFromObj( objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = NULL; if (objPtr->bytes == NULL) { - TclInitStringRep(objPtr, tclEmptyStringRep, 0); + TclInitStringRep(objPtr, &tclEmptyString, 0); } } return TCL_OK; diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 68ec2c4..0053041 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -2608,7 +2608,7 @@ UpdateStringOfFsPath( pathPtr->bytes = TclGetStringFromObj(copy, &cwdLen); pathPtr->length = cwdLen; - copy->bytes = tclEmptyStringRep; + copy->bytes = &tclEmptyString; copy->length = 0; TclDecrRefCount(copy); } diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 42dd08d..2925c34 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -17,6 +17,8 @@ #include "tclInt.h" +MODULE_SCOPE char *tclEmptyStringRep = &tclEmptyString; + /* * Each invocation of the "package ifneeded" command creates a structure of * the following type, which is used to load the package into the interpreter diff --git a/generic/tclResult.c b/generic/tclResult.c index 6346636..ddf764b 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -1015,11 +1015,11 @@ ResetObjResult( Tcl_IncrRefCount(objResultPtr); iPtr->objResultPtr = objResultPtr; } else { - if (objResultPtr->bytes != tclEmptyStringRep) { + if (objResultPtr->bytes != &tclEmptyString) { if (objResultPtr->bytes) { ckfree(objResultPtr->bytes); } - objResultPtr->bytes = tclEmptyStringRep; + objResultPtr->bytes = &tclEmptyString; objResultPtr->length = 0; } TclFreeIntRep(objResultPtr); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index db233b3..c45baa1 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -136,7 +136,7 @@ GrowStringBuffer( char *ptr = NULL; int attempt; - if (objPtr->bytes == tclEmptyStringRep) { + if (objPtr->bytes == &tclEmptyString) { objPtr->bytes = NULL; } if (flag == 0 || stringPtr->allocated > 0) { @@ -767,7 +767,7 @@ Tcl_SetObjLength( /* * Need to enlarge the buffer. */ - if (objPtr->bytes == tclEmptyStringRep) { + if (objPtr->bytes == &tclEmptyString) { objPtr->bytes = ckalloc(length + 1); } else { objPtr->bytes = ckrealloc(objPtr->bytes, length + 1); @@ -873,7 +873,7 @@ Tcl_AttemptSetObjLength( char *newBytes; - if (objPtr->bytes == tclEmptyStringRep) { + if (objPtr->bytes == &tclEmptyString) { newBytes = attemptckalloc(length + 1); } else { newBytes = attemptckrealloc(objPtr->bytes, length + 1); @@ -1202,7 +1202,7 @@ Tcl_AppendObjToObj( * that appending nothing to anything leaves that starting anything... */ - if (appendObjPtr->bytes == tclEmptyStringRep) { + if (appendObjPtr->bytes == &tclEmptyString) { return; } @@ -1213,7 +1213,7 @@ Tcl_AppendObjToObj( * information; this is a special-case optimization only. */ - if ((TclIsPureByteArray(objPtr) || objPtr->bytes == tclEmptyStringRep) + if ((TclIsPureByteArray(objPtr) || objPtr->bytes == &tclEmptyString) && TclIsPureByteArray(appendObjPtr)) { /* @@ -3603,7 +3603,7 @@ UpdateStringOfString( stringPtr->allocated = 0; if (stringPtr->numChars == 0) { - TclInitStringRep(objPtr, tclEmptyStringRep, 0); + TclInitStringRep(objPtr, &tclEmptyString, 0); } else { (void) ExtendStringRepWithUnicode(objPtr, stringPtr->unicode, stringPtr->numChars); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index ba709cc..a4d523a 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1384,7 +1384,7 @@ TclConvertElement( */ if ((src == NULL) || (length == 0) || (*src == '\0' && length == -1)) { - src = tclEmptyStringRep; + src = &tclEmptyString; length = 0; conversion = CONVERT_BRACE; } @@ -2954,7 +2954,7 @@ Tcl_DStringGetResult( if (!iPtr->result[0] && iPtr->objResultPtr && !Tcl_IsShared(iPtr->objResultPtr)) { - if (iPtr->objResultPtr->bytes == tclEmptyStringRep) { + if (iPtr->objResultPtr->bytes == &tclEmptyString) { dsPtr->string = dsPtr->staticSpace; dsPtr->string[0] = 0; dsPtr->length = 0; @@ -2964,7 +2964,7 @@ Tcl_DStringGetResult( dsPtr->length = iPtr->objResultPtr->length; dsPtr->spaceAvl = dsPtr->length + 1; TclFreeIntRep(iPtr->objResultPtr); - iPtr->objResultPtr->bytes = tclEmptyStringRep; + iPtr->objResultPtr->bytes = &tclEmptyString; iPtr->objResultPtr->length = 0; } return; diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 8e97543..9387d05 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -240,7 +240,7 @@ InitializeHostName( } } if (native == NULL) { - native = tclEmptyStringRep; + native = &tclEmptyString; } #else /* !NO_UNAME */ /* -- cgit v0.12 From 19e0981d356c17f1c104a63c10bc913528b315af Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 3 Feb 2017 14:29:50 +0000 Subject: Split tclEmptyStringRep declaration over two lines. Otherwise gcc warning. --- generic/tclPkg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 2925c34..0759faa 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -17,7 +17,9 @@ #include "tclInt.h" -MODULE_SCOPE char *tclEmptyStringRep = &tclEmptyString; +MODULE_SCOPE char *tclEmptyStringRep; + +char *tclEmptyStringRep = &tclEmptyString; /* * Each invocation of the "package ifneeded" command creates a structure of -- cgit v0.12 From 0e31751aedc651ce181d544e5ce13cdef1b135ca Mon Sep 17 00:00:00 2001 From: bch Date: Mon, 6 Feb 2017 21:58:48 +0000 Subject: cherrypick typo fix. --- doc/Eval.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Eval.3 b/doc/Eval.3 index 8661923..191bace 100644 --- a/doc/Eval.3 +++ b/doc/Eval.3 @@ -205,7 +205,7 @@ and sets \fIinterp\fR's result to an error message indicating that the \fBreturn\fR, \fBbreak\fR, or \fBcontinue\fR command was invoked in an inappropriate place. This means that top-level applications should never see a return code -from \fBTcl_EvalObjEx\fR other then \fBTCL_OK\fR or \fBTCL_ERROR\fR. +from \fBTcl_EvalObjEx\fR other than \fBTCL_OK\fR or \fBTCL_ERROR\fR. .SH KEYWORDS execute, file, global, result, script, value -- cgit v0.12 From 8066c6a687d570d513638c2079a6bc8a9a9b364f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Feb 2017 11:42:12 +0000 Subject: FlightAware feedback: "Aside: Any way to find out what the pkgIndex.tcl file a package was defined in was, or does that happen at too high a level?" Answer: Even though the name of the pkgIndex file is available earlier, it is very well possible to remember it and store it with the other files. This commit does exactly that. --- generic/tclPkg.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 0759faa..9ad3cb7 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -32,6 +32,7 @@ typedef struct PkgAvail { char *script; /* Script to invoke to provide this version of * the package. Malloc'ed and protected by * Tcl_Preserve and Tcl_Release. */ + char *pkgIndex; /* Full file name of pkgIndex file */ struct PkgAvail *nextPtr; /* Next in list of available versions of the * same package. */ } PkgAvail; @@ -573,6 +574,9 @@ PkgRequireCore( pkgName->nextPtr = pkgFiles->names; strcpy(pkgName->name, name); pkgFiles->names = pkgName; + if (bestPtr->pkgIndex) { + TclPkgFileSeen(interp, bestPtr->pkgIndex); + } code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/ pkgFiles->names = pkgName->nextPtr; @@ -921,6 +925,9 @@ Tcl_PackageObjCmd( pkgPtr->availPtr = availPtr->nextPtr; Tcl_EventuallyFree(availPtr->version, TCL_DYNAMIC); Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); + if (availPtr->pkgIndex) { + Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + } ckfree(availPtr); } ckfree(pkgPtr); @@ -971,6 +978,9 @@ Tcl_PackageObjCmd( return TCL_OK; } Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); + if (availPtr->pkgIndex) { + Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + } break; } } @@ -981,6 +991,7 @@ Tcl_PackageObjCmd( } if (availPtr == NULL) { availPtr = ckalloc(sizeof(PkgAvail)); + availPtr->pkgIndex = 0; DupBlock(availPtr->version, argv3, (unsigned) length + 1); if (prevPtr == NULL) { @@ -991,6 +1002,10 @@ Tcl_PackageObjCmd( prevPtr->nextPtr = availPtr; } } + if (iPtr->scriptFile) { + argv4 = TclGetStringFromObj(iPtr->scriptFile, &length); + DupBlock(availPtr->pkgIndex, argv4, (unsigned) length + 1); + } argv4 = TclGetStringFromObj(objv[4], &length); DupBlock(availPtr->script, argv4, (unsigned) length + 1); break; @@ -1346,6 +1361,9 @@ TclFreePackageInfo( pkgPtr->availPtr = availPtr->nextPtr; Tcl_EventuallyFree(availPtr->version, TCL_DYNAMIC); Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); + if (availPtr->pkgIndex) { + Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + } ckfree(availPtr); } ckfree(pkgPtr); -- cgit v0.12 From 6db42b86e652e1d29093c8b75793c059b9792dd5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Feb 2017 14:32:13 +0000 Subject: Shortcut in TclParseNumber(): If obj is a dict or list, don't bother to generate the string representation if we know already beforehand that the parsing will fail. Use TCL_NO_DEPRECATED in stead of KILL_OCTAL for removing the (deprecated un-prefixed) octal support. Adapt test-cases, so they work without octal support as well. --- generic/tclHistory.c | 5 ++--- generic/tclStrToD.c | 27 +++++++++++++++++---------- tests/get.test | 8 ++++---- tests/parseExpr.test | 5 ++--- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/generic/tclHistory.c b/generic/tclHistory.c index b08e352..47806d4 100644 --- a/generic/tclHistory.c +++ b/generic/tclHistory.c @@ -62,15 +62,14 @@ Tcl_RecordAndEval( * instead of Tcl_Eval. */ { register Tcl_Obj *cmdPtr; - int length = strlen(cmd); int result; - if (length > 0) { + if (cmd[0]) { /* * Call Tcl_RecordAndEvalObj to do the actual work. */ - cmdPtr = Tcl_NewStringObj(cmd, length); + cmdPtr = Tcl_NewStringObj(cmd, -1); Tcl_IncrRefCount(cmdPtr); result = Tcl_RecordAndEvalObj(interp, cmdPtr, flags); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 6da6df3..77e1839 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -18,13 +18,6 @@ #include /* - * Define KILL_OCTAL to suppress interpretation of numbers with leading zero - * as octal. (Ceterum censeo: numeros octonarios delendos esse.) - */ - -#undef KILL_OCTAL - -/* * This code supports (at least hypothetically), IBM, Cray, VAX and IEEE-754 * floating point; of these, only IEEE-754 can represent NaN. IEEE-754 can be * uniquely determined by radix and by the widths of significand and exponent. @@ -546,6 +539,20 @@ TclParseNumber( */ if (bytes == NULL) { + if (endPtrPtr == NULL) { + if (objPtr->typePtr == &tclDictType) { + /* A dict can never be a (single) number */ + return TCL_ERROR; + } + if (objPtr->typePtr == &tclListType) { + int length; + /* A list can only be a (single) number if its length == 1 */ + TclListObjLength(NULL, objPtr, &length); + if (length != 1) { + return TCL_ERROR; + } + } + } bytes = TclGetString(objPtr); } @@ -657,7 +664,7 @@ TclParseNumber( state = ZERO_O; break; } -#ifdef KILL_OCTAL +#ifdef TCL_NO_DEPRECATED goto decimal; #endif /* FALLTHROUGH */ @@ -740,7 +747,7 @@ TclParseNumber( goto endgame; } -#ifndef KILL_OCTAL +#ifndef TCL_NO_DEPRECATED /* * Scanned a number with a leading zero that contains an 8, 9, @@ -879,7 +886,7 @@ TclParseNumber( * digits. */ -#ifdef KILL_OCTAL +#ifdef TCL_NO_DEPRECATED decimal: #endif acceptState = state; diff --git a/tests/get.test b/tests/get.test index 7aa06c1..d6a7206 100644 --- a/tests/get.test +++ b/tests/get.test @@ -98,17 +98,17 @@ test get-3.2 {Tcl_GetDouble(FromObj), bad numbers} { } {0 1 0 1 1 {expected floating-point number but got "++1.0"} 1 {expected floating-point number but got "+-1.0"} 1 {expected floating-point number but got "-+1.0"} 0 -1 1 {expected floating-point number but got "--1.0"} 1 {expected floating-point number but got "- +1.0"}} # Bug 7114ac6141 test get-3.3 {tcl_GetInt with iffy numbers} testgetint { - lmap x {0 " 0" "0 " " 0 " " 0xa " " 010 " " 0o10 " " 0b10 "} { + lmap x {0 " 0" "0 " " 0 " " 0xa " " 007 " " 0o10 " " 0b10 "} { catch {testgetint 44 $x} x set x } -} {44 44 44 44 54 52 52 46} +} {44 44 44 44 54 51 52 46} test get-3.4 {Tcl_GetDouble with iffy numbers} testdoubleobj { - lmap x {0 0.0 " .0" ".0 " " 0e0 " "09" "- 0" "-0" "0o12" "0b10"} { + lmap x {0 0.0 " .0" ".0 " " 0e0 " "07" "- 0" "-0" "0o12" "0b10"} { catch {testdoubleobj set 1 $x} x set x } -} {0.0 0.0 0.0 0.0 0.0 {expected floating-point number but got "09" (looks like invalid octal number)} {expected floating-point number but got "- 0"} 0.0 10.0 2.0} +} {0.0 0.0 0.0 0.0 0.0 7.0 {expected floating-point number but got "- 0"} 0.0 10.0 2.0} # cleanup ::tcltest::cleanupTests diff --git a/tests/parseExpr.test b/tests/parseExpr.test index fda25b7..47dbec5 100644 --- a/tests/parseExpr.test +++ b/tests/parseExpr.test @@ -1044,9 +1044,8 @@ test parseExpr-22.13 {Bug 3401704} -constraints testexprparser -body { } -result {- {} 0 subexpr naner() 1 operator naner 0 {}} test parseExpr-22.14 {Bug 3401704} -constraints testexprparser -body { - catch {testexprparser 08 -1} m o - dict get $o -errorcode -} -result {TCL PARSE EXPR BADNUMBER OCTAL} + testexprparser 07 -1 +} -result {- {} 0 subexpr 07 1 text 07 0 {}} test parseExpr-22.15 {Bug 3401704} -constraints testexprparser -body { catch {testexprparser 0o8 -1} m o dict get $o -errorcode -- cgit v0.12 From 35539e2f98f007de63a0bef192a769c9f8f9ad91 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 9 Feb 2017 11:34:43 +0000 Subject: =?UTF-8?q?resolve=20warning:=20enumeration=20value=20=E2=80=98TMR?= =?UTF-8?q?T=5FLAST=E2=80=99=20not=20handled=20in=20switch=20(impossible?= =?UTF-8?q?=20to=20handle=20in=20switch=20because=20of=20break);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generic/tclCmdMZ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index c660596..319799c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4089,7 +4089,7 @@ Tcl_TimeRateObjCmd( i++; break; } - switch ((enum options) index) { + switch (index) { case TMRT_EV_DIRECT: direct = objv[i]; break; -- cgit v0.12 From ca98340c4c69feed95b1823e8a83800a1ea8fae3 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 9 Feb 2017 11:36:17 +0000 Subject: [timerate] bug fix: missing scale conversion by Mac OSX on platform where high resolution clicks are not microseconds based; [win] use high resolution timer for the wide clicks and microseconds directly, prevent several forwards/backwards conversions; [win, unix, mac-osx] normalize some functions for common usage in different time units (clicks, micro- and nanoseconds) --- generic/tclClock.c | 9 +-- generic/tclCmdMZ.c | 24 +++++--- generic/tclInt.h | 16 ++++++ unix/tclUnixTime.c | 71 +++++++++++++++++++++++ win/tclWinTime.c | 166 ++++++++++++++++++++++++++++++++++++++++++----------- 5 files changed, 238 insertions(+), 48 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 27009fd..5da9511 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -1760,8 +1760,7 @@ ClockClicksObjCmd( #endif break; case CLICKS_MICROS: - Tcl_GetTime(&now); - clicks = ((Tcl_WideInt) now.sec * 1000000) + now.usec; + clicks = TclpGetMicroseconds(); break; } @@ -1831,15 +1830,11 @@ ClockMicrosecondsObjCmd( int objc, /* Parameter count */ Tcl_Obj *const *objv) /* Parameter values */ { - Tcl_Time now; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } - Tcl_GetTime(&now); - Tcl_SetObjResult(interp, Tcl_NewWideIntObj( - ((Tcl_WideInt) now.sec * 1000000) + now.usec)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclpGetMicroseconds())); return TCL_OK; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 319799c..b0212c3 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4215,16 +4215,19 @@ usage: } /* get start and stop time */ -#ifndef TCL_WIDE_CLICKS +#ifdef TCL_WIDE_CLICKS + start = middle = TclpGetWideClicks(); + /* time to stop execution (in wide clicks) */ + stop = start + (maxms * 1000 / TclpWideClickInMicrosec()); +#else Tcl_GetTime(&now); start = now.sec; start *= 1000000; start += now.usec; -#else - start = TclpGetWideClicks(); + middle = start; + /* time to stop execution (in microsecs) */ + stop = start + maxms * 1000; #endif /* start measurement */ - stop = start + maxms * 1000; - middle = start; while (1) { /* eval single iteration */ count++; @@ -4246,11 +4249,11 @@ usage: if (--threshold > 0) continue; /* check stop time reached, estimate new threshold */ - #ifndef TCL_WIDE_CLICKS + #ifdef TCL_WIDE_CLICKS + middle = TclpGetWideClicks(); + #else Tcl_GetTime(&now); middle = now.sec; middle *= 1000000; middle += now.usec; - #else - middle = TclpGetWideClicks(); #endif if (middle >= stop) { break; @@ -4274,6 +4277,11 @@ usage: middle -= start; /* execution time in microsecs */ + #ifdef TCL_WIDE_CLICKS + /* convert execution time in wide clicks to microsecs */ + middle *= TclpWideClickInMicrosec(); + #endif + /* if not calibrate */ if (!calibrate) { /* minimize influence of measurement overhead */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 1b37d84..fb0bcb7 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3189,7 +3189,23 @@ MODULE_SCOPE void TclFinalizeThreadStorage(void); #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); +MODULE_SCOPE double TclpWideClickInMicrosec(void); +#else +# ifdef _WIN32 +# define TCL_WIDE_CLICKS 1 +MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); +# define TclpWideClicksToNanoseconds(clicks) \ + ((double)(clicks) * 1000) +# define TclpWideClickInMicrosec() (1) +# endif #endif +#ifndef _WIN32 +MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void); +#else +# define TclpGetMicroseconds() \ + TclpGetWideClicks() +#endif + MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr); diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index d634449..8ec6e8a 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -84,6 +84,32 @@ TclpGetSeconds(void) /* *---------------------------------------------------------------------- * + * TclpGetMicroseconds -- + * + * This procedure returns the number of microseconds from the epoch. + * On most Unix systems the epoch is Midnight Jan 1, 1970 GMT. + * + * Results: + * Number of microseconds from the epoch. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_WideInt +TclpGetMicroseconds(void) +{ + Tcl_Time time; + + tclGetTimeProcPtr(&time, tclTimeClientData); + return ((Tcl_WideInt)time.sec)*1000000 + time.usec; +} + +/* + *---------------------------------------------------------------------- + * * TclpGetClicks -- * * This procedure returns a value that represents the highest resolution @@ -216,6 +242,51 @@ TclpWideClicksToNanoseconds( return nsec; } + +/* + *---------------------------------------------------------------------- + * + * TclpWideClickInMicrosec -- + * + * This procedure return scale to convert click values from the + * TclpGetWideClicks native resolution to microsecond resolution + * and back. + * + * Results: + * 1 click in microseconds as double. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +double +TclpWideClickInMicrosec(void) +{ + if (tclGetTimeProcPtr != NativeGetTime) { + return 1.0; + } else { +#ifdef MAC_OSX_TCL + static int initialized = 0; + static double scale = 0.0; + + if (initialized) { + return scale; + } else { + mach_timebase_info_data_t tb; + + mach_timebase_info(&tb); + /* value of tb.numer / tb.denom = 1 click in nanoseconds */ + scale = ((double)tb.numer) / tb.denom / 1000; + initialized = 1; + return scale; + } +#else +#error Wide high-resolution clicks not implemented on this platform +#endif + } +} #endif /* TCL_WIDE_CLICKS */ /* diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 81d9458..06ea6cd 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -123,6 +123,7 @@ static Tcl_WideInt AccumulateSample(Tcl_WideInt perfCounter, Tcl_WideUInt fileTime); static void NativeScaleTime(Tcl_Time* timebuf, ClientData clientData); +static Tcl_WideInt NativeGetMicroseconds(void); static void NativeGetTime(Tcl_Time* timebuf, ClientData clientData); @@ -154,10 +155,19 @@ ClientData tclTimeClientData = NULL; unsigned long TclpGetSeconds(void) { - Tcl_Time t; + Tcl_WideInt usecSincePosixEpoch; - tclGetTimeProcPtr(&t, tclTimeClientData); /* Tcl_GetTime inlined. */ - return t.sec; + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + return usecSincePosixEpoch / 1000000; + } else { + Tcl_Time t; + + tclGetTimeProcPtr(&t, tclTimeClientData); /* Tcl_GetTime inlined. */ + return t.sec; + } } /* @@ -182,19 +192,66 @@ TclpGetSeconds(void) unsigned long TclpGetClicks(void) { - /* - * Use the Tcl_GetTime abstraction to get the time in microseconds, as - * nearly as we can, and return it. - */ + Tcl_WideInt usecSincePosixEpoch; - Tcl_Time now; /* Current Tcl time */ - unsigned long retval; /* Value to return */ + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + return (unsigned long)usecSincePosixEpoch; + } else { + /* + * Use the Tcl_GetTime abstraction to get the time in microseconds, as + * nearly as we can, and return it. + */ - tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */ + Tcl_Time now; /* Current Tcl time */ - retval = (now.sec * 1000000) + now.usec; - return retval; + tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */ + return (unsigned long)(now.sec * 1000000) + now.usec; + } +} + +/* + *---------------------------------------------------------------------- + * + * TclpGetWideClicks -- + * + * This procedure returns a WideInt value that represents the highest + * resolution clock in microseconds available on the system. + * + * Results: + * Number of microseconds (from the epoch). + * + * Side effects: + * This should be used for time-delta resp. for measurement purposes + * only, because on some platforms can return microseconds from some + * start time (not from the epoch). + * + *---------------------------------------------------------------------- + */ + +Tcl_WideInt +TclpGetWideClicks(void) +{ + Tcl_WideInt usecSincePosixEpoch; + + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + return usecSincePosixEpoch; + } else { + /* + * Use the Tcl_GetTime abstraction to get the time in microseconds, as + * nearly as we can, and return it. + */ + + Tcl_Time now; + tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */ + return (((Tcl_WideInt)now.sec) * 1000000) + now.usec; + } } /* @@ -223,7 +280,17 @@ void Tcl_GetTime( Tcl_Time *timePtr) /* Location to store time information. */ { - tclGetTimeProcPtr(timePtr, tclTimeClientData); + Tcl_WideInt usecSincePosixEpoch; + + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + timePtr->sec = (long) (usecSincePosixEpoch / 1000000); + timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); + } else { + tclGetTimeProcPtr(timePtr, tclTimeClientData); + } } /* @@ -256,13 +323,14 @@ NativeScaleTime( /* *---------------------------------------------------------------------- * - * NativeGetTime -- + * NativeGetMicroseconds -- * - * TIP #233: Gets the current system time in seconds and microseconds - * since the beginning of the epoch: 00:00 UCT, January 1, 1970. + * Gets the current system time in microseconds since the beginning + * of the epoch: 00:00 UCT, January 1, 1970. * * Results: - * Returns the current time in timePtr. + * Returns the wide integer with number of microseconds from the epoch, or + * 0 if high resolution timer is not available. * * Side effects: * On the first call, initializes a set of static variables to keep track @@ -275,13 +343,9 @@ NativeScaleTime( *---------------------------------------------------------------------- */ -static void -NativeGetTime( - Tcl_Time *timePtr, - ClientData clientData) +static Tcl_WideInt +NativeGetMicroseconds(void) { - struct _timeb t; - /* * Initialize static storage on the first trip through. * @@ -432,9 +496,7 @@ NativeGetTime( if (curCounter.QuadPart <= perfCounterLastCall.QuadPart) { usecSincePosixEpoch = (fileTimeLastCall.QuadPart - posixEpoch.QuadPart) / 10; - timePtr->sec = (long) (usecSincePosixEpoch / 1000000); - timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); - return; + return usecSincePosixEpoch; } /* @@ -455,19 +517,57 @@ NativeGetTime( * 10000000 / curCounterFreq.QuadPart); usecSincePosixEpoch = (curFileTime - posixEpoch.QuadPart) / 10; - timePtr->sec = (long) (usecSincePosixEpoch / 1000000); - timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); - return; + return usecSincePosixEpoch; } } /* - * High resolution timer is not available. Just use ftime. + * High resolution timer is not available. */ + return 0; +} + +/* + *---------------------------------------------------------------------- + * + * NativeGetTime -- + * + * TIP #233: Gets the current system time in seconds and microseconds + * since the beginning of the epoch: 00:00 UCT, January 1, 1970. + * + * Results: + * Returns the current time in timePtr. + * + * Side effects: + * See NativeGetMicroseconds for more information. + * + *---------------------------------------------------------------------- + */ - _ftime(&t); - timePtr->sec = (long)t.time; - timePtr->usec = t.millitm * 1000; +static void +NativeGetTime( + Tcl_Time *timePtr, + ClientData clientData) +{ + Tcl_WideInt usecSincePosixEpoch; + + /* + * Try to use high resolution timer. + */ + if ( (usecSincePosixEpoch = NativeGetMicroseconds()) ) { + timePtr->sec = (long) (usecSincePosixEpoch / 1000000); + timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); + } else { + /* + * High resolution timer is not available. Just use ftime. + */ + + struct _timeb t; + + _ftime(&t); + timePtr->sec = (long)t.time; + timePtr->usec = t.millitm * 1000; + } } /* -- cgit v0.12 From 8dde174dd4188f1b4d55f6d88a01a1d3887f507b Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 9 Feb 2017 13:45:14 +0000 Subject: =?UTF-8?q?[win]=20accomplished=20winTime=20module=20using=20very?= =?UTF-8?q?=20fast=20wide=20clicks,=20with=20denominator=20scale=20to/from?= =?UTF-8?q?=20microseconds,=20and=20therefore=20more=20precise=20"timerate?= =?UTF-8?q?"=20results=20under=20windows=20(using=20similar=20mechanisms?= =?UTF-8?q?=20as=20by=20Mac=20OSX).=20Especially=20multi-threaded,=20becau?= =?UTF-8?q?se=20it=20works=20without=20lock=20opposite=20to=20microseconds?= =?UTF-8?q?=20(that=20use=20crictical=20section,=20because=20of=20the=20ca?= =?UTF-8?q?libration=20thread).=20The=20reason=20for=20usage=20of=20wide?= =?UTF-8?q?=20clicks=20instead=20microseconds=20explains=20following=20exa?= =?UTF-8?q?mple=20(shows=2020%=20performance=20deference):=20%=20timerate?= =?UTF-8?q?=20-calibrate=20{}=20%=20timerate=20{clock=20microseconds}=2050?= =?UTF-8?q?00=200.297037=20=C2=B5s/#=2014465901=20#=203366585=20#/sec=2042?= =?UTF-8?q?96.906=20nett-ms=20%=20timerate=20{clock=20clicks}=205000=200.2?= =?UTF-8?q?47797=20=C2=B5s/#=2016869084=20#=204035554=20#/sec=204180.116?= =?UTF-8?q?=20nett-ms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generic/tclInt.h | 10 ++---- win/tclWinTime.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 103 insertions(+), 14 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index fb0bcb7..3c21de0 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3186,6 +3186,7 @@ MODULE_SCOPE int TclpLoadMemory(Tcl_Interp *interp, void *buffer, MODULE_SCOPE void TclInitThreadStorage(void); MODULE_SCOPE void TclFinalizeThreadDataThread(void); MODULE_SCOPE void TclFinalizeThreadStorage(void); + #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); @@ -3194,17 +3195,12 @@ MODULE_SCOPE double TclpWideClickInMicrosec(void); # ifdef _WIN32 # define TCL_WIDE_CLICKS 1 MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); +MODULE_SCOPE double TclpWideClickInMicrosec(void); # define TclpWideClicksToNanoseconds(clicks) \ - ((double)(clicks) * 1000) -# define TclpWideClickInMicrosec() (1) + ((double)(clicks) * TclpWideClickInMicrosec() * 1000) # endif #endif -#ifndef _WIN32 MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void); -#else -# define TclpGetMicroseconds() \ - TclpGetWideClicks() -#endif MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 06ea6cd..7cbc1ba 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -110,6 +110,17 @@ static TimeInfo timeInfo = { }; /* + * Scale to convert wide click values from the TclpGetWideClicks native + * resolution to microsecond resolution and back. + */ +static struct { + int initialized; /* 1 if initialized, 0 otherwise */ + int perfCounter; /* 1 if performance counter usable for wide clicks */ + double microsecsScale; /* Denominator scale between clock / microsecs */ +} wideClick = {0, 0.0}; + + +/* * Declarations for functions defined later in this file. */ @@ -221,7 +232,7 @@ TclpGetClicks(void) * resolution clock in microseconds available on the system. * * Results: - * Number of microseconds (from the epoch). + * Number of microseconds (from some start time). * * Side effects: * This should be used for time-delta resp. for measurement purposes @@ -234,6 +245,87 @@ TclpGetClicks(void) Tcl_WideInt TclpGetWideClicks(void) { + LARGE_INTEGER curCounter; + + if (!wideClick.initialized) { + LARGE_INTEGER perfCounterFreq; + + /* + * The frequency of the performance counter is fixed at system boot and + * is consistent across all processors. Therefore, the frequency need + * only be queried upon application initialization. + */ + if (QueryPerformanceFrequency(&perfCounterFreq)) { + wideClick.perfCounter = 1; + wideClick.microsecsScale = 1000000.0 / perfCounterFreq.QuadPart; + } else { + /* fallback using microseconds */ + wideClick.perfCounter = 0; + wideClick.microsecsScale = 1; + } + + wideClick.initialized = 1; + } + if (wideClick.perfCounter) { + if (QueryPerformanceCounter(&curCounter)) { + return (Tcl_WideInt)curCounter.QuadPart; + } + /* fallback using microseconds */ + wideClick.perfCounter = 0; + wideClick.microsecsScale = 1; + return TclpGetMicroseconds(); + } else { + return TclpGetMicroseconds(); + } +} + +/* + *---------------------------------------------------------------------- + * + * TclpWideClickInMicrosec -- + * + * This procedure return scale to convert wide click values from the + * TclpGetWideClicks native resolution to microsecond resolution + * and back. + * + * Results: + * 1 click in microseconds as double. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +double +TclpWideClickInMicrosec(void) +{ + if (!wideClick.initialized) { + (void)TclpGetWideClicks(); /* initialize */ + } + return wideClick.microsecsScale; +} + +/* + *---------------------------------------------------------------------- + * + * TclpGetMicroseconds -- + * + * This procedure returns a WideInt value that represents the highest + * resolution clock in microseconds available on the system. + * + * Results: + * Number of microseconds (from the epoch). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_WideInt +TclpGetMicroseconds(void) +{ Tcl_WideInt usecSincePosixEpoch; /* Try to use high resolution timer */ @@ -346,6 +438,9 @@ NativeScaleTime( static Tcl_WideInt NativeGetMicroseconds(void) { + static LARGE_INTEGER posixEpoch; + /* Posix epoch expressed as 100-ns ticks since + * the windows epoch. */ /* * Initialize static storage on the first trip through. * @@ -356,6 +451,10 @@ NativeGetMicroseconds(void) if (!timeInfo.initialized) { TclpInitLock(); if (!timeInfo.initialized) { + + posixEpoch.LowPart = 0xD53E8000; + posixEpoch.HighPart = 0x019DB1DE; + timeInfo.perfCounterAvailable = QueryPerformanceFrequency(&timeInfo.nominalFreq); @@ -468,15 +567,9 @@ NativeGetMicroseconds(void) /* Current performance counter. */ Tcl_WideInt curFileTime;/* Current estimated time, expressed as 100-ns * ticks since the Windows epoch. */ - static LARGE_INTEGER posixEpoch; - /* Posix epoch expressed as 100-ns ticks since - * the windows epoch. */ Tcl_WideInt usecSincePosixEpoch; /* Current microseconds since Posix epoch. */ - posixEpoch.LowPart = 0xD53E8000; - posixEpoch.HighPart = 0x019DB1DE; - QueryPerformanceCounter(&curCounter); /* -- cgit v0.12 From efa3ec69393a1dee51e76e848dbe10ebaa55603e Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 11 Feb 2017 21:36:36 +0000 Subject: Proposed implementation of [regsub -command]. --- generic/tclCmdMZ.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++---- tests/regexp.test | 22 +++++++++++++- tests/regexpComp.test | 2 +- 3 files changed, 98 insertions(+), 8 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ba1fc41..ffae8b2 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -487,26 +487,28 @@ Tcl_RegsubObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int idx, result, cflags, all, wlen, wsublen, numMatches, offset; - int start, end, subStart, subEnd, match; + int start, end, subStart, subEnd, match, command; Tcl_RegExp regExpr; Tcl_RegExpInfo info; Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; + Tcl_Obj **args = NULL, *parts[2], *cmdObj; Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend; static const char *const options[] = { - "-all", "-nocase", "-expanded", - "-line", "-linestop", "-lineanchor", "-start", + "-all", "-command", "-expanded", "-line", + "-linestop", "-lineanchor", "-nocase", "-start", "--", NULL }; enum options { - REGSUB_ALL, REGSUB_NOCASE, REGSUB_EXPANDED, - REGSUB_LINE, REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_START, + REGSUB_ALL, REGSUB_COMMAND, REGSUB_EXPANDED, REGSUB_LINE, + REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START, REGSUB_LAST }; cflags = TCL_REG_ADVANCED; all = 0; offset = 0; + command = 0; resultPtr = NULL; for (idx = 1; idx < objc; idx++) { @@ -528,6 +530,9 @@ Tcl_RegsubObjCmd( case REGSUB_NOCASE: cflags |= TCL_REG_NOCASE; break; + case REGSUB_COMMAND: + command = 1; + break; case REGSUB_EXPANDED: cflags |= TCL_REG_EXPANDED; break; @@ -585,7 +590,7 @@ Tcl_RegsubObjCmd( } } - if (all && (offset == 0) + if (all && (offset == 0) && (command == 0) && (strpbrk(TclGetString(objv[2]), "&\\") == NULL) && (strpbrk(TclGetString(objv[0]), "*+?{}()[].\\|^$") == NULL)) { /* @@ -737,6 +742,68 @@ Tcl_RegsubObjCmd( Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, start); /* + * In -command mode, the substitutions are added as quoted arguments + * to the subSpec to form a command, that is then executed and the + * result used as the string to substitute in. + */ + + if (command) { + if (args == NULL) { + args = ckalloc(sizeof(Tcl_Obj*) * (info.nsubs + 1)); + } + + for (idx = 0 ; idx <= info.nsubs ; idx++) { + subStart = info.matches[idx].start; + subEnd = info.matches[idx].end; + if ((subStart >= 0) && (subEnd >= 0)) { + args[idx] = Tcl_NewUnicodeObj( + wstring + offset + subStart, subEnd - subStart); + } else { + args[idx] = Tcl_NewObj(); + } + } + parts[0] = subPtr; + parts[1] = Tcl_NewListObj(info.nsubs+1, args); + cmdObj = Tcl_ConcatObj(2, parts); + Tcl_IncrRefCount(cmdObj); + Tcl_DecrRefCount(parts[1]); + + result = Tcl_EvalObjEx(interp, cmdObj, TCL_EVAL_DIRECT); + Tcl_DecrRefCount(cmdObj); + if (result != TCL_OK) { + if (result == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (%s substitution computation script)", + options[REGSUB_COMMAND])); + } + goto done; + } + + Tcl_AppendObjToObj(resultPtr, Tcl_GetObjResult(interp)); + Tcl_ResetResult(interp); + + offset += end; + if (end == 0 || start == end) { + /* + * Always consume at least one character of the input string + * in order to prevent infinite loops, even when we + * technically matched the empty string; we must not match + * again at the same spot. + */ + + if (offset < wlen) { + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); + } + offset++; + } + if (all) { + continue; + } else { + break; + } + } + + /* * Append the subSpec argument to the variable, making appropriate * substitutions. This code is a bit hairy because of the backslash * conventions and because the code saves up ranges of characters in @@ -864,6 +931,9 @@ Tcl_RegsubObjCmd( if (subPtr && (objv[2] == objv[0])) { Tcl_DecrRefCount(subPtr); } + if (args) { + ckfree(args); + } if (resultPtr) { Tcl_DecrRefCount(resultPtr); } diff --git a/tests/regexp.test b/tests/regexp.test index 4ffdbdb..6c77b41 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -453,7 +453,7 @@ test regexp-11.4 {regsub errors} { } {1 {wrong # args: should be "regsub ?-option ...? exp string subSpec ?varName?"}} test regexp-11.5 {regsub errors} { list [catch {regsub -gorp a b c} msg] $msg -} {1 {bad option "-gorp": must be -all, -nocase, -expanded, -line, -linestop, -lineanchor, -start, or --}} +} {1 {bad option "-gorp": must be -all, -command, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --}} test regexp-11.6 {regsub errors} { list [catch {regsub -nocase a( b c d} msg] $msg } {1 {couldn't compile regular expression pattern: parentheses () not balanced}} @@ -1123,6 +1123,26 @@ test regexp-26.12 {regexp with -line option} { test regexp-26.13 {regexp without -line option} { regexp -all -inline -- {a*} "b\n" } {{} {}} + +test regexp-27.1 {regsub -command} { + regsub -command {.x.} {abcxdef} {string length} +} ab3ef +test regexp-27.2 {regsub -command} { + regsub -command {.x.} {abcxdefxghi} {string length} +} ab3efxghi +test regexp-27.3 {regsub -command} { + set x 0 + regsub -all -command {(?=.)} abcde "incr x;#" +} 1a2b3c4d5e +test regexp-27.4 {regsub -command} -body { + regsub -command {.x.} {abcxdef} error +} -returnCodes error -result cxd +test regexp-27.5 {regsub -command} { + regsub -command {(.)(.)} {abcdef} {list ,} +} {, ab a bcdef} +test regexp-27.6 {regsub -command} { + regsub -command -all {(.)(.)} {abcdef} {list ,} +} {, ab a b, cd c d, ef e f} # cleanup ::tcltest::cleanupTests diff --git a/tests/regexpComp.test b/tests/regexpComp.test index b8e64b6..fbf8012 100644 --- a/tests/regexpComp.test +++ b/tests/regexpComp.test @@ -587,7 +587,7 @@ test regexpComp-11.5 {regsub errors} { evalInProc { list [catch {regsub -gorp a b c} msg] $msg } -} {1 {bad option "-gorp": must be -all, -nocase, -expanded, -line, -linestop, -lineanchor, -start, or --}} +} {1 {bad option "-gorp": must be -all, -command, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --}} test regexpComp-11.6 {regsub errors} { evalInProc { list [catch {regsub -nocase a( b c d} msg] $msg -- cgit v0.12 From a13289725c7144cf1453ac5a3674bf763450872c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 14 Feb 2017 14:25:08 +0000 Subject: On Windows, Cygwin and 64-bit platforms, no need to handle 'long' in tclLink.c, since its size is equal to either 'int' or 'Tcl_WideInt'. This enhances interoperabilty between win64 extensions loaded in cygwin64 using Tcl_LinkVar(), whill still being 100% compatible. init.tcl: unnecessary spacing. --- generic/tcl.h | 5 +++++ generic/tclLink.c | 16 ++++++++++++++++ library/init.tcl | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index c0cee27..d678229 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1147,8 +1147,13 @@ typedef struct Tcl_DString { #define TCL_LINK_SHORT 8 #define TCL_LINK_USHORT 9 #define TCL_LINK_UINT 10 +#if defined(TCL_WIDE_INT_IS_LONG) || defined(_WIN32) || defined(__CYGWIN__) +#define TCL_LINK_LONG ((sizeof(long) != sizeof(int)) ? TCL_LINK_WIDE_INT : TCL_LINK_INT) +#define TCL_LINK_ULONG ((sizeof(long) != sizeof(int)) ? TCL_LINK_WIDE_UINT : TCL_LINK_UINT) +#else #define TCL_LINK_LONG 11 #define TCL_LINK_ULONG 12 +#endif #define TCL_LINK_FLOAT 13 #define TCL_LINK_WIDE_UINT 14 #define TCL_LINK_READ_ONLY 0x80 diff --git a/generic/tclLink.c b/generic/tclLink.c index 1507804..a39dfcd 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -36,8 +36,10 @@ typedef struct Link { unsigned int ui; short s; unsigned short us; +#if !defined(TCL_WIDE_INT_IS_LONG) && !defined(_WIN32) && !defined(__CYGWIN__) long l; unsigned long ul; +#endif Tcl_WideInt w; Tcl_WideUInt uw; float f; @@ -129,6 +131,14 @@ Tcl_LinkVar( Tcl_IncrRefCount(linkPtr->varName); linkPtr->addr = addr; linkPtr->type = type & ~TCL_LINK_READ_ONLY; +#if !defined(TCL_NO_DEPRECATED) && (defined(TCL_WIDE_INT_IS_LONG) \ + || defined(_WIN32) || defined(__CYGWIN__)) + if (linkPtr->type == 11 /* legacy TCL_LINK_LONG */) { + linkPtr->type = TCL_LINK_LONG; + } else if (linkPtr->type == 12 /* legacy TCL_LINK_ULONG */) { + linkPtr->type = TCL_LINK_ULONG; + } +#endif if (type & TCL_LINK_READ_ONLY) { linkPtr->flags = LINK_READ_ONLY; } else { @@ -335,12 +345,14 @@ LinkTraceProc( case TCL_LINK_UINT: changed = (LinkedVar(unsigned int) != linkPtr->lastValue.ui); break; +#if !defined(TCL_WIDE_INT_IS_LONG) && !defined(_WIN32) && !defined(__CYGWIN__) case TCL_LINK_LONG: changed = (LinkedVar(long) != linkPtr->lastValue.l); break; case TCL_LINK_ULONG: changed = (LinkedVar(unsigned long) != linkPtr->lastValue.ul); break; +#endif case TCL_LINK_FLOAT: changed = (LinkedVar(float) != linkPtr->lastValue.f); break; @@ -483,6 +495,7 @@ LinkTraceProc( LinkedVar(unsigned int) = linkPtr->lastValue.ui = (unsigned int)valueWide; break; +#if !defined(TCL_WIDE_INT_IS_LONG) && !defined(_WIN32) && !defined(__CYGWIN__) case TCL_LINK_LONG: if ((Tcl_GetWideIntFromObj(NULL, valueObj, &valueWide) != TCL_OK && GetInvalidWideFromObj(valueObj, &valueWide) != TCL_OK) @@ -504,6 +517,7 @@ LinkTraceProc( } LinkedVar(unsigned long) = linkPtr->lastValue.ul = (unsigned long)valueWide; break; +#endif case TCL_LINK_WIDE_UINT: /* @@ -597,12 +611,14 @@ ObjValue( case TCL_LINK_UINT: linkPtr->lastValue.ui = LinkedVar(unsigned int); return Tcl_NewWideIntObj((Tcl_WideInt) linkPtr->lastValue.ui); +#if !defined(TCL_WIDE_INT_IS_LONG) && !defined(_WIN32) && !defined(__CYGWIN__) case TCL_LINK_LONG: linkPtr->lastValue.l = LinkedVar(long); return Tcl_NewWideIntObj((Tcl_WideInt) linkPtr->lastValue.l); case TCL_LINK_ULONG: linkPtr->lastValue.ul = LinkedVar(unsigned long); return Tcl_NewWideIntObj((Tcl_WideInt) linkPtr->lastValue.ul); +#endif case TCL_LINK_FLOAT: linkPtr->lastValue.f = LinkedVar(float); return Tcl_NewDoubleObj(linkPtr->lastValue.f); diff --git a/library/init.tcl b/library/init.tcl index 49a523c..fac1722 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -470,9 +470,9 @@ proc auto_load {cmd {namespace {}}} { proc ::tcl::Pkg::source {filename} { if {[interp issafe]} { - uplevel 1 [list ::source $filename] + uplevel 1 [list ::source $filename] } else { - uplevel 1 [list ::source -nopkg $filename] + uplevel 1 [list ::source -nopkg $filename] } } -- cgit v0.12 From 462ffc792711dc33c7d17b48fc3bdb65bee277de Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 Feb 2017 14:04:15 +0000 Subject: More internal use of size_t in stead of int, e.g. for epoch's --- generic/tclBasic.c | 2 +- generic/tclCompile.h | 2 +- generic/tclEnsemble.c | 2 +- generic/tclIO.c | 2 +- generic/tclIO.h | 2 +- generic/tclInt.h | 12 ++++++------ generic/tclObj.c | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 63c5590..6ff5faa 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4705,7 +4705,7 @@ TEOV_RunEnterTraces( { Interp *iPtr = (Interp *) interp; Command *cmdPtr = *cmdPtrPtr; - int newEpoch, cmdEpoch = cmdPtr->cmdEpoch; + size_t newEpoch, cmdEpoch = cmdPtr->cmdEpoch; int length, traceCode = TCL_OK; const char *command = TclGetStringFromObj(commandPtr, &length); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 5ef154e..5bc3e81 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -425,7 +425,7 @@ typedef struct ByteCode { * compiled. If the code is executed if a * different namespace, it must be * recompiled. */ - int nsEpoch; /* Value of nsPtr->resolverEpoch when this + size_t nsEpoch; /* Value of nsPtr->resolverEpoch when this * ByteCode was compiled. Used to invalidate * code when new namespace resolution rules * are put into effect. */ diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 6ada155..f3e8187 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -92,7 +92,7 @@ static const Tcl_ObjType ensembleCmdType = { */ typedef struct { - int epoch; /* Used to confirm when the data in this + size_t epoch; /* Used to confirm when the data in this * really structure matches up with the * ensemble. */ Command *token; /* Reference to the command for which this diff --git a/generic/tclIO.c b/generic/tclIO.c index 506e6d5..6bf8451 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -321,7 +321,7 @@ static int WillRead(Channel *chanPtr); typedef struct ResolvedChanName { ChannelState *statePtr; /* The saved lookup result */ Tcl_Interp *interp; /* The interp in which the lookup was done. */ - int epoch; /* The epoch of the channel when the lookup + size_t epoch; /* The epoch of the channel when the lookup * was done. Use to verify validity. */ size_t refCount; /* Share this struct among many Tcl_Obj. */ } ResolvedChanName; diff --git a/generic/tclIO.h b/generic/tclIO.h index ffbfa31..07c54fa 100644 --- a/generic/tclIO.h +++ b/generic/tclIO.h @@ -214,7 +214,7 @@ typedef struct ChannelState { * because it happened in the background. The * value is the chanMg, if any. #219's * companion to 'unreportedError'. */ - int epoch; /* Used to test validity of stored channelname + size_t epoch; /* Used to test validity of stored channelname * lookup results. */ } ChannelState; diff --git a/generic/tclInt.h b/generic/tclInt.h index 4b87962..f078d18 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -265,7 +265,7 @@ typedef struct Namespace { * strings; values have type (Namespace *). If * NULL, there are no children. */ #endif - long nsId; /* Unique id for the namespace. */ + size_t nsId; /* Unique id for the namespace. */ Tcl_Interp *interp; /* The interpreter containing this * namespace. */ int flags; /* OR-ed combination of the namespace status @@ -299,12 +299,12 @@ typedef struct Namespace { * registered using "namespace export". */ int maxExportPatterns; /* Mumber of export patterns for which space * is currently allocated. */ - int cmdRefEpoch; /* Incremented if a newly added command + size_t cmdRefEpoch; /* Incremented if a newly added command * shadows a command for which this namespace * has already cached a Command* pointer; this * causes all its cached Command* pointers to * be invalidated. */ - int resolverEpoch; /* Incremented whenever (a) the name + size_t resolverEpoch; /* Incremented whenever (a) the name * resolution rules change for this namespace * or (b) a newly added command shadows a * command that is compiled to bytecodes. This @@ -331,7 +331,7 @@ typedef struct Namespace { * LookupCompiledLocal to resolve variable * references within the namespace at compile * time. */ - int exportLookupEpoch; /* Incremented whenever a command is added to + size_t exportLookupEpoch; /* Incremented whenever a command is added to * a namespace, removed from a namespace or * the exports of a namespace are changed. * Allows TIP#112-driven command lists to be @@ -432,7 +432,7 @@ typedef struct EnsembleConfig { * if the command has been deleted (or never * existed; the global namespace never has an * ensemble command.) */ - int epoch; /* The epoch at which this ensemble's table of + size_t epoch; /* The epoch at which this ensemble's table of * exported commands is valid. */ char **subcommandArrayPtr; /* Array of ensemble subcommand names. At all * consistent points, this will have the same @@ -1639,7 +1639,7 @@ typedef struct Command { * representing a command's name in a ByteCode * instruction sequence. This structure can be * freed when refCount becomes zero. */ - int cmdEpoch; /* Incremented to invalidate any references + size_t cmdEpoch; /* Incremented to invalidate any references * that point to this command when it is * renamed, deleted, hidden, or exposed. */ CompileProc *compileProc; /* Procedure called to compile command. NULL diff --git a/generic/tclObj.c b/generic/tclObj.c index 1abbb31..7ec259f 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -344,17 +344,17 @@ typedef struct ResolvedCmdName { * reference (not the namespace that contains * the referenced command). NULL if the name * is fully qualified.*/ - long refNsId; /* refNsPtr's unique namespace id. Used to + size_t refNsId; /* refNsPtr's unique namespace id. Used to * verify that refNsPtr is still valid (e.g., * it's possible that the cmd's containing * namespace was deleted and a new one created * at the same address). */ - int refNsCmdEpoch; /* Value of the referencing namespace's + size_t refNsCmdEpoch; /* Value of the referencing namespace's * cmdRefEpoch when the pointer was cached. * Before using the cached pointer, we check * if the namespace's epoch was incremented; * if so, this cached pointer is invalid. */ - int cmdEpoch; /* Value of the command's cmdEpoch when this + size_t cmdEpoch; /* Value of the command's cmdEpoch when this * pointer was cached. Before using the cached * pointer, we check if the cmd's epoch was * incremented; if so, the cmd was renamed, -- cgit v0.12 From 3ef7160d4155e52cf26b62290674100b34243e00 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 17 Feb 2017 06:08:18 +0000 Subject: Switch to using command prefixes properly. This is quite a bit faster. --- generic/tclCmdMZ.c | 63 +++++++++++++++++++++++++++++++++++++++--------------- tests/regexp.test | 2 +- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ffae8b2..d6d0152 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -487,11 +487,11 @@ Tcl_RegsubObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int idx, result, cflags, all, wlen, wsublen, numMatches, offset; - int start, end, subStart, subEnd, match, command; + int start, end, subStart, subEnd, match, command, numParts, numArgs; Tcl_RegExp regExpr; Tcl_RegExpInfo info; Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; - Tcl_Obj **args = NULL, *parts[2], *cmdObj; + Tcl_Obj **args = NULL, **parts; Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend; static const char *const options[] = { @@ -666,6 +666,20 @@ Tcl_RegsubObjCmd( return TCL_ERROR; } + if (command) { + /* + * In command-prefix mode, we require that the third non-option + * argument be a list, so we enforce that here. Afterwards, we fetch + * the RE compilation again in case objv[0] and objv[2] are the same + * object. (If they aren't, that's cheap to do.) + */ + + if (Tcl_ListObjLength(interp, objv[2], &numParts) != TCL_OK) { + return TCL_ERROR; + } + regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags); + } + /* * Make sure to avoid problems where the objects are shared. This can * cause RegExpObj <> UnicodeObj shimmering that causes data corruption. @@ -683,7 +697,9 @@ Tcl_RegsubObjCmd( } else { subPtr = objv[2]; } - wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen); + if (!command) { + wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen); + } result = TCL_OK; @@ -742,34 +758,47 @@ Tcl_RegsubObjCmd( Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, start); /* - * In -command mode, the substitutions are added as quoted arguments - * to the subSpec to form a command, that is then executed and the - * result used as the string to substitute in. + * In command-prefix mode, the substitutions are added as quoted + * arguments to the subSpec to form a command, that is then executed + * and the result used as the string to substitute in. Actually, + * everything is passed through Tcl_EvalObjv, as that's much faster. */ if (command) { if (args == NULL) { - args = ckalloc(sizeof(Tcl_Obj*) * (info.nsubs + 1)); + Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts); + numArgs = numParts + info.nsubs + 1; + args = ckalloc(sizeof(Tcl_Obj*) * numArgs); + memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); } for (idx = 0 ; idx <= info.nsubs ; idx++) { subStart = info.matches[idx].start; subEnd = info.matches[idx].end; if ((subStart >= 0) && (subEnd >= 0)) { - args[idx] = Tcl_NewUnicodeObj( + args[idx + numParts] = Tcl_NewUnicodeObj( wstring + offset + subStart, subEnd - subStart); } else { - args[idx] = Tcl_NewObj(); + args[idx + numParts] = Tcl_NewObj(); } + Tcl_IncrRefCount(args[idx + numParts]); + } + + /* + * At this point, we're locally holding the references to the + * argument words we added for this time round the loop, and the + * subPtr is holding the references to the words that the user + * supplied directly. None are zero-refcount, which is important + * because Tcl_EvalObjv is "hairy monster" in terms of refcount + * handling, being able to optionally add references to any of its + * argument words. We'll drop the local refs immediately + * afterwarsds; subPtr is handled in the main exit stanza. + */ + + result = Tcl_EvalObjv(interp, numArgs, args, 0); + for (idx = 0 ; idx <= info.nsubs ; idx++) { + TclDecrRefCount(args[idx + numParts]); } - parts[0] = subPtr; - parts[1] = Tcl_NewListObj(info.nsubs+1, args); - cmdObj = Tcl_ConcatObj(2, parts); - Tcl_IncrRefCount(cmdObj); - Tcl_DecrRefCount(parts[1]); - - result = Tcl_EvalObjEx(interp, cmdObj, TCL_EVAL_DIRECT); - Tcl_DecrRefCount(cmdObj); if (result != TCL_OK) { if (result == TCL_ERROR) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( diff --git a/tests/regexp.test b/tests/regexp.test index 6c77b41..6c3d774 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1132,7 +1132,7 @@ test regexp-27.2 {regsub -command} { } ab3efxghi test regexp-27.3 {regsub -command} { set x 0 - regsub -all -command {(?=.)} abcde "incr x;#" + regsub -all -command {(?=.)} abcde {apply {args {incr ::x}}} } 1a2b3c4d5e test regexp-27.4 {regsub -command} -body { regsub -command {.x.} {abcxdef} error -- cgit v0.12 From 5772e32729279c7caac6968a62a65e0eb3550eb4 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 17 Feb 2017 09:20:49 +0000 Subject: Stop problems with representation smashes. --- generic/tclCmdMZ.c | 7 +++++++ tests/regexp.test | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index d6d0152..110de4c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -811,6 +811,13 @@ Tcl_RegsubObjCmd( Tcl_AppendObjToObj(resultPtr, Tcl_GetObjResult(interp)); Tcl_ResetResult(interp); + /* + * Refetch the unicode, in case the representation was smashed by + * the user code. + */ + + wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen); + offset += end; if (end == 0 || start == end) { /* diff --git a/tests/regexp.test b/tests/regexp.test index 6c3d774..ad770fa 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1143,6 +1143,12 @@ test regexp-27.5 {regsub -command} { test regexp-27.6 {regsub -command} { regsub -command -all {(.)(.)} {abcdef} {list ,} } {, ab a b, cd c d, ef e f} +test regexp-27.7 {regsub -command representation smash} { + set ::s {123=456 789} + regsub -command -all {\d+} $::s {apply {n { + expr {[llength $::s] + $n} + }}} +} {125=458 791} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 82296abf086a1bc70975fe726a9887fe102b0330 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 18 Feb 2017 14:26:34 +0000 Subject: Add more representation smashing testing and a memleak test. --- tests/regexp.test | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/regexp.test b/tests/regexp.test index ad770fa..f1be6eb 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -19,6 +19,20 @@ if {"::tcltest" ni [namespace children]} { unset -nocomplain foo testConstraint exec [llength [info commands exec]] + +# Used for constraining memory leak tests +testConstraint memory [llength [info commands memory]] +if {[testConstraint memory]} { + proc memtest script { + set end [lindex [split [memory info] \n] 3 3] + for {set i 0} {$i < 5} {incr i} { + uplevel 1 $script + set tmp $end + set end [lindex [split [memory info] \n] 3 3] + } + expr {$end - $tmp} + } +} test regexp-1.1 {basic regexp operation} { regexp ab*c abbbc @@ -1149,6 +1163,21 @@ test regexp-27.7 {regsub -command representation smash} { expr {[llength $::s] + $n} }}} } {125=458 791} +test regexp-27.8 {regsub -command representation smash} { + set ::t {apply {n { + expr {[llength [lindex $::t 1 1 1]] + $n} + }}} + regsub -command -all {\d+} "123=456 789" $::t +} {131=464 797} +test regexp-27.9 {regsub -command memory leak testing} memory { + set ::s "123=456 789" + set ::t {apply {n { + expr {[llength [lindex $::t 1 1 1]] + [llength $::s] + $n} + }}} + memtest { + regsub -command -all {\d+} $::s $::t + } +} 0 # cleanup ::tcltest::cleanupTests -- cgit v0.12 From d18329a21ef2b1a00069fd1be86bd9062a97f4cd Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 18 Feb 2017 16:24:09 +0000 Subject: Testing for some error cases. --- generic/tclCmdMZ.c | 8 ++++++++ tests/regexp.test | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 110de4c..d5a6b01 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -677,6 +677,14 @@ Tcl_RegsubObjCmd( if (Tcl_ListObjLength(interp, objv[2], &numParts) != TCL_OK) { return TCL_ERROR; } + if (numParts < 1) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "command prefix must be a list of at least one element", + -1)); + Tcl_SetErrorCode(interp, "TCL", "OPERATION", "REGSUB", + "CMDEMPTY", NULL); + return TCL_ERROR; + } regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags); } diff --git a/tests/regexp.test b/tests/regexp.test index f1be6eb..2686526 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1178,6 +1178,12 @@ test regexp-27.9 {regsub -command memory leak testing} memory { regsub -command -all {\d+} $::s $::t } } 0 +test regexp-27.10 {regsub -command error cases} -returnCodes error -body { + regsub -command . abc "def \{ghi" +} -result {unmatched open brace in list} +test regexp-27.11 {regsub -command error cases} -returnCodes error -body { + regsub -command . abc {} +} -result {command prefix must be a list of at least one element} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 874b8643e02da9a44cbed7f908d260f372420946 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 18 Feb 2017 18:38:52 +0000 Subject: Add documentation of [regsub -command]. --- doc/regsub.n | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclCmdMZ.c | 4 +-- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/doc/regsub.n b/doc/regsub.n index a5b79de..23bbff9 100644 --- a/doc/regsub.n +++ b/doc/regsub.n @@ -68,6 +68,31 @@ and sequences are handled for each substitution using the information from the corresponding match. .TP +\fB\-command\fR +.VS 8.7 +Changes the handling of the substitution string so that it no longer treats +.QW & +and +.QW \e +as special characters, but instead uses them as a non-empty list of words. +Each time a substitution is processed, another complete Tcl word is appended +to that list for each substitution value (the first such argument represents +the overall matched substring, the subsequent arguments will be one per +capturing sub-RE, much as are returned from \fBregexp\fR \fB\-inline\fR) and +the overall list is then evaluated as a Tcl command call. If the command +finishes successfully, the result of command call is substituted into the +resulting string. +.RS +.PP +If \fB\-all\fR is not also given, the command callback will be invoked at most +once (exactly when the regular expression matches). If \fB\-all\fR is given, +the command callback will be invoked for each matched location, in sequence. +The exact location indices that matched are not made available to the script. +.PP +See \fBEXAMPLES\fR below for illustrative cases. +.RE +.VE 8.7 +.TP \fB\-expanded\fR . Enables use of the expanded regular expression syntax where @@ -183,6 +208,53 @@ set substitution {[format \e\e\e\eu%04x [scan "\e\e&" %c]]} set quoted [subst [string map {\en {\e\eu000a}} \e [\fBregsub\fR -all $RE $string $substitution]]] .CE +.PP +.VS 8.7 +The above operation can be done using \fBregsub \-command\fR instead, which is +often faster. (A full pre-computed \fBstring map\fR would be faster still, but +the cost of computing the map for a transformation as complex as this can be +quite large.) +.PP +.CS +# This RE is just a character class for everything "bad" +set RE {[][{};#\e\e\e$\es\eu0080-\euffff]} + +# This encodes what the RE described above matches +proc encodeChar {ch} { + # newline is handled specially since backslash-newline is a + # special sequence. + if {$ch eq "\en"} { + return "\e\eu000a" + } + # No point in writing this as a one-liner + scan $ch %c charNumber + format "\e\eu%04x" $charNumber +} + +set quoted [\fBregsub\fR -all -command $RE $string encodeChar] +.CE +.PP +Decoding a URL-encoded string using \fBregsub \-command\fR, a lambda term and +the \fBapply\fR command. +.PP +.CS +# Match one of the sequences in a URL-encoded string that needs +# fixing, converting + to space and %XX to the right character +# (e.g., %7e becomes ~) +set RE {(\e+)|%([0-9A-Fa-f]{2})} + +# Note that -command uses a command prefix, not a command name +set decoded [\fBregsub\fR -all -command $RE $string {apply {{- p h} { + # + is a special case; handle directly + if {$p eq "+"} { + return " " + } + # convert hex to a char + scan $h %x charNumber + format %c $charNumber +}}}] +.CE +.VE 8.7 .SH "SEE ALSO" regexp(n), re_syntax(n), subst(n), string(n) .SH KEYWORDS diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index d5a6b01..4178ba8 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -500,8 +500,8 @@ Tcl_RegsubObjCmd( "--", NULL }; enum options { - REGSUB_ALL, REGSUB_COMMAND, REGSUB_EXPANDED, REGSUB_LINE, - REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START, + REGSUB_ALL, REGSUB_COMMAND, REGSUB_EXPANDED, REGSUB_LINE, + REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START, REGSUB_LAST }; -- cgit v0.12 From ef3d739cdf66aa26639c9167d6e9da8a2d64a54d Mon Sep 17 00:00:00 2001 From: avl Date: Sun, 5 Mar 2017 15:05:48 +0000 Subject: Fix for Ticket [71c0878b71] + test cases --- generic/tclStrToD.c | 2 +- tests/incr.test | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 77e1839..224ab45 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -539,7 +539,7 @@ TclParseNumber( */ if (bytes == NULL) { - if (endPtrPtr == NULL) { + if (interp == NULL && endPtrPtr == NULL) { if (objPtr->typePtr == &tclDictType) { /* A dict can never be a (single) number */ return TCL_ERROR; diff --git a/tests/incr.test b/tests/incr.test index 9243be0..aa2872a 100644 --- a/tests/incr.test +++ b/tests/incr.test @@ -494,6 +494,18 @@ test incr-2.31 {incr command (compiled): bad increment} { (reading increment) invoked from within "incr x 1a"}} +test incr-2.32 {incr command (compiled): bad pure list increment} { + list [catch {incr x [list 1 2]} msg] $msg $::errorInfo +} {1 {expected integer but got "1 2"} {expected integer but got "1 2" + (reading increment) + invoked from within +"incr x [list 1 2]"}} +test incr-2.33 {incr command (compiled): bad pure dict increment} { + list [catch {incr x [dict create 1 2]} msg] $msg $::errorInfo +} {1 {expected integer but got "1 2"} {expected integer but got "1 2" + (reading increment) + invoked from within +"incr x [dict create 1 2]"}} test incr-3.1 {increment by wide amount: bytecode route} { set x 0 -- cgit v0.12 From aaa76b7a7da0a9f73cef7abc18e26aa92d154e43 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 6 Mar 2017 20:32:54 +0000 Subject: msgcat.test: fixed mcpackagelocale syntax usage test case (msgcat-12.1) --- tests/msgcat.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/msgcat.test b/tests/msgcat.test index 1c3ce58..584e420 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -811,7 +811,7 @@ namespace eval ::msgcat::test { test msgcat-12.1 {mcpackagelocale no subcommand} -body { mcpackagelocale } -returnCodes 1\ - -result {wrong # args: should be "mcpackagelocale subcommand ?locale?"} + -result {wrong # args: should be "mcpackagelocale subcommand ?locale? ?ns?"} test msgcat-12.2 {mclpackagelocale wrong subcommand} -body { mcpackagelocale junk -- cgit v0.12 From fa0de66105f11524c686e70e023dbcdbaa59826e Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 6 Mar 2017 21:01:53 +0000 Subject: tclEmptyStringRep -> &tclEmptyString --- generic/tclStrIdxTree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 773eb6a..d9b5da0 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -397,7 +397,7 @@ StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr) { /* currently only dummy empty string possible */ objPtr->length = 0; - objPtr->bytes = tclEmptyStringRep; + objPtr->bytes = &tclEmptyString; }; MODULE_SCOPE TclStrIdxTree * -- cgit v0.12 From 279bfdeef3577e9767bfafc7102011176f88034f Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 7 Mar 2017 11:35:03 +0000 Subject: timerate: don't calculate threshold by too few iterations, because sometimes first iteration(s) can be too fast (cached, delayed clean up, etc). --- generic/tclCmdMZ.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 14ff5f0..b62ccf8 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4282,6 +4282,13 @@ usage: if (middle >= stop) { break; } + + /* don't calculate threshold by few iterations, because sometimes + * first iteration(s) can be too fast (cached, delayed clean up, etc) */ + if (count < 10) { + threshold = 1; continue; + } + /* average iteration time in microsecs */ threshold = (middle - start) / count; if (threshold > maxIterTm) { -- cgit v0.12 From b2181df698c6eb7d579e90e5690d23e24cd6c730 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Mar 2017 13:56:55 +0000 Subject: Fix compile error on Cygwin, and double definition of TclUnixWaitForFile() --- unix/tclEpollNotfy.c | 2 +- unix/tclUnixChan.c | 160 --------------------------------------------------- unix/tclUnixNotfy.c | 4 +- 3 files changed, 2 insertions(+), 164 deletions(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 7355564..28fc834 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -745,7 +745,7 @@ Tcl_WaitForEvent( * Wait or poll for new events, queue Tcl events for the FileHandlers * corresponding to them, and update the FileHandlers' mask of events * of interest registered by the last call to Tcl_CreateFileHandler(). - * + * * Events for the eventfd(2)/trigger pipe are processed here in order * to facilitate inter-thread IPC. If another thread intends to wake * up this thread whilst it's blocking on PlatformEventsWait(), it diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 6418f48..08b4805 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -1726,166 +1726,6 @@ Tcl_GetOpenFile( return TCL_ERROR; } -#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is - * in tclMacOSXNotify.c */ -/* - *---------------------------------------------------------------------- - * - * TclUnixWaitForFile -- - * - * This function waits synchronously for a file to become readable or - * writable, with an optional timeout. - * - * Results: - * The return value is an OR'ed combination of TCL_READABLE, - * TCL_WRITABLE, and TCL_EXCEPTION, indicating the conditions that are - * present on file at the time of the return. This function will not - * return until either "timeout" milliseconds have elapsed or at least - * one of the conditions given by mask has occurred for file (a return - * value of 0 means that a timeout occurred). No normal events will be - * serviced during the execution of this function. - * - * Side effects: - * Time passes. - * - *---------------------------------------------------------------------- - */ - -int -TclUnixWaitForFile( - int fd, /* Handle for file on which to wait. */ - int mask, /* What to wait for: OR'ed combination of - * TCL_READABLE, TCL_WRITABLE, and - * TCL_EXCEPTION. */ - int timeout) /* Maximum amount of time to wait for one of - * the conditions in mask to occur, in - * milliseconds. A value of 0 means don't wait - * at all, and a value of -1 means wait - * forever. */ -{ - Tcl_Time abortTime = {0, 0}, now; /* silence gcc 4 warning */ - struct timeval blockTime, *timeoutPtr; - int numFound, result = 0; - fd_set readableMask; - fd_set writableMask; - fd_set exceptionMask; - -#ifndef _DARWIN_C_SOURCE - /* - * Sanity check fd. - */ - - if (fd >= FD_SETSIZE) { - Tcl_Panic("TclUnixWaitForFile can't handle file id %d", fd); - /* must never get here, or select masks overrun will occur below */ - } -#endif - - /* - * If there is a non-zero finite timeout, compute the time when we give - * up. - */ - - if (timeout > 0) { - Tcl_GetTime(&now); - abortTime.sec = now.sec + timeout/1000; - abortTime.usec = now.usec + (timeout%1000)*1000; - if (abortTime.usec >= 1000000) { - abortTime.usec -= 1000000; - abortTime.sec += 1; - } - timeoutPtr = &blockTime; - } else if (timeout == 0) { - timeoutPtr = &blockTime; - blockTime.tv_sec = 0; - blockTime.tv_usec = 0; - } else { - timeoutPtr = NULL; - } - - /* - * Initialize the select masks. - */ - - FD_ZERO(&readableMask); - FD_ZERO(&writableMask); - FD_ZERO(&exceptionMask); - - /* - * Loop in a mini-event loop of our own, waiting for either the file to - * become ready or a timeout to occur. - */ - - while (1) { - if (timeout > 0) { - blockTime.tv_sec = abortTime.sec - now.sec; - blockTime.tv_usec = abortTime.usec - now.usec; - if (blockTime.tv_usec < 0) { - blockTime.tv_sec -= 1; - blockTime.tv_usec += 1000000; - } - if (blockTime.tv_sec < 0) { - blockTime.tv_sec = 0; - blockTime.tv_usec = 0; - } - } - - /* - * Setup the select masks for the fd. - */ - - if (mask & TCL_READABLE) { - FD_SET(fd, &readableMask); - } - if (mask & TCL_WRITABLE) { - FD_SET(fd, &writableMask); - } - if (mask & TCL_EXCEPTION) { - FD_SET(fd, &exceptionMask); - } - - /* - * Wait for the event or a timeout. - */ - - numFound = select(fd + 1, &readableMask, &writableMask, - &exceptionMask, timeoutPtr); - if (numFound == 1) { - if (FD_ISSET(fd, &readableMask)) { - SET_BITS(result, TCL_READABLE); - } - if (FD_ISSET(fd, &writableMask)) { - SET_BITS(result, TCL_WRITABLE); - } - if (FD_ISSET(fd, &exceptionMask)) { - SET_BITS(result, TCL_EXCEPTION); - } - result &= mask; - if (result) { - break; - } - } - if (timeout == 0) { - break; - } - if (timeout < 0) { - continue; - } - - /* - * The select returned early, so we need to recompute the timeout. - */ - - Tcl_GetTime(&now); - if ((abortTime.sec < now.sec) - || (abortTime.sec==now.sec && abortTime.usec<=now.usec)) { - break; - } - } - return result; -} -#endif /* HAVE_COREFOUNDATION */ - /* *---------------------------------------------------------------------- * diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 248504b..eb3e8ba 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -322,7 +322,7 @@ AlertSingleThread( * continuously spinning on epoll_wait until the other * threads runs and services the file event. */ - + if (tsdPtr->prevPtr) { tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; } else { @@ -396,8 +396,6 @@ AtForkChild(void) * The tsdPtr from before the fork is copied as well. But since * we are paranoic, we don't trust its condvar and reset it. */ - pthread_cond_destroy(&tsdPtr->waitCV); - pthread_cond_init(&tsdPtr->waitCV, NULL); #ifdef __CYGWIN__ DestroyWindow(tsdPtr->hwnd); tsdPtr->hwnd = CreateWindowExW(NULL, className, -- cgit v0.12 From bed000d72e4b356700d7e2c85ca69971331f827a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Mar 2017 14:32:15 +0000 Subject: A few more end-of-line spacings --- unix/tclKqueueNotfy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index 5522f06..049829e 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -387,7 +387,7 @@ PlatformEventsInit( Tcl_Panic("fcntl: %s", strerror(errno)); } else { fdFl = fcntl(tsdPtr->triggerPipe[i], F_GETFL); - fdFl |= O_NONBLOCK; + fdFl |= O_NONBLOCK; } if (fcntl(tsdPtr->triggerPipe[i], F_SETFL, fdFl) == -1) { Tcl_Panic("fcntl: %s", strerror(errno)); @@ -780,7 +780,7 @@ Tcl_WaitForEvent( * Wait or poll for new events, queue Tcl events for the FileHandlers * corresponding to them, and update the FileHandlers' mask of events * of interest registered by the last call to Tcl_CreateFileHandler(). - * + * * Events for the trigger pipe are processed here in order to facilitate * inter-thread IPC. If another thread intends to wake up this thread * whilst it's blocking on PlatformEventsWait(), it write(2)s to the -- cgit v0.12 From f55296bdf01aad11441825c162f074824f3031b5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Mar 2017 14:50:44 +0000 Subject: minor simplification --- unix/tclUnixNotfy.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index eb3e8ba..d7bbabe 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -127,8 +127,7 @@ Tcl_AlertNotifier( #endif /* TCL_THREADS */ #else ThreadSpecificData *tsdPtr = clientData; -#ifdef NOTIFIER_EPOLL -#ifdef HAVE_EVENTFD +#if defined(NOTIFIER_EPOLL) && defined(HAVE_EVENTFD) eventFdVal = 1; if (write(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)) != sizeof(eventFdVal)) { @@ -136,14 +135,9 @@ Tcl_AlertNotifier( (void *)tsdPtr); #else if (write(tsdPtr->triggerPipe[1], "", 1) != 1) { - Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerEventFd", - (void *)tsdPtr); -#endif -#else - if (write(tsdPtr->triggerPipe[1], "", 1) != 1) { Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerPipe", (void *)tsdPtr); -#endif /* NOTIFIER_EPOLL */ +#endif /* NOTIFIER_EPOLL && HAVE_EVENTFD */ } #endif /* NOTIFIER_SELECT */ } -- cgit v0.12 From c0bedd810fd8cf8ed91641043fb615153a1da6ec Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 12 Mar 2017 18:36:21 +0000 Subject: Add mappings for groff-style character naming, used in experimental branches of Tk. --- tools/tcltk-man2html-utils.tcl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index 9052049..c887edd 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -155,8 +155,16 @@ proc process-text {text} { {\fP} {\fR} \ {\.} . \ {\(bu} "•" \ - {\*(qo} "ô" \ + "\\*(qo" "ô" \ ] + # This might make a few invalid mappings, but we don't use them + foreach c {a e i o u y A E I O U Y} { + foreach {prefix suffix} { + o circ / slash : uml ' acute ^ circ ` grave + } { + lappend charmap "\\\[${prefix}${c}\]" "&${c}${suffix};" + } + } lappend charmap {\-\|\-} -- ; # two hyphens lappend charmap {\-} - ; # a hyphen -- cgit v0.12 From c010901ea91557cfd0e0529eee7e0eeabacb7bbf Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 12 Mar 2017 19:45:00 +0000 Subject: Fix error in formatting in info.n --- doc/info.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/info.n b/doc/info.n index 01ca10b..061e178 100644 --- a/doc/info.n +++ b/doc/info.n @@ -297,7 +297,7 @@ scripts are stored. This is actually the value of the \fBtcl_library\fR variable and may be changed by setting \fBtcl_library\fR. .TP -\fBinfo loaded \fR?\fIinterp\fR? \fR?\fIpackage\fR? +\fBinfo loaded \fR?\fIinterp\fR? \fIpackage\fR? . Returns the filename loaded as part of \fIpackage\fR. If \fIpackage\fR is not specified, returns a list describing all of the packages -- cgit v0.12 From 4ccedfaec494d98f1677ce45925f496c2d7c2b70 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 13 Mar 2017 06:16:45 +0000 Subject: Add back missing significant character --- doc/info.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/info.n b/doc/info.n index 061e178..c3a62c9 100644 --- a/doc/info.n +++ b/doc/info.n @@ -297,7 +297,7 @@ scripts are stored. This is actually the value of the \fBtcl_library\fR variable and may be changed by setting \fBtcl_library\fR. .TP -\fBinfo loaded \fR?\fIinterp\fR? \fIpackage\fR? +\fBinfo loaded \fR?\fIinterp\fR? ?\fIpackage\fR? . Returns the filename loaded as part of \fIpackage\fR. If \fIpackage\fR is not specified, returns a list describing all of the packages -- cgit v0.12 From 6f905e1f0fa598055c516aa33529d41d2fadbe4a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 13 Mar 2017 08:38:18 +0000 Subject: Eliminate internal use of TclNewBooleanObj()/TclSetBooleanObj()/TclSetIntObj(). Replace Tcl_DbNewBooleanObj() with trivial macro. --- generic/tcl.h | 2 +- generic/tclAssembly.c | 2 +- generic/tclDecls.h | 4 ++-- generic/tclExecute.c | 4 ++-- generic/tclInt.h | 26 -------------------------- generic/tclObj.c | 12 +++++++----- generic/tclStubInit.c | 2 ++ 7 files changed, 15 insertions(+), 37 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index c67eafc..1491745 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2538,7 +2538,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); Tcl_DbNewBignumObj(val, __FILE__, __LINE__) # undef Tcl_NewBooleanObj # define Tcl_NewBooleanObj(val) \ - Tcl_DbNewBooleanObj(val, __FILE__, __LINE__) + Tcl_DbNewLongObj((val)!=0, __FILE__, __LINE__) # undef Tcl_NewByteArrayObj # define Tcl_NewByteArrayObj(bytes, len) \ Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 2212d1c..8c6f81a 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -4246,7 +4246,7 @@ AddBasicBlockRangeToErrorInfo( Tcl_AppendObjToErrorInfo(interp, lineNo); Tcl_AddErrorInfo(interp, " and "); if (bbPtr->successor1 != NULL) { - Tcl_SetIntObj(lineNo, bbPtr->successor1->startLine); + TclSetLongObj(lineNo, bbPtr->successor1->startLine); Tcl_AppendObjToErrorInfo(interp, lineNo); } else { Tcl_AddErrorInfo(interp, "end of assembly code"); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 0dbf345..fb7f8bc 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3835,13 +3835,13 @@ extern const TclStubs *tclStubsPtr; sizeof(char *), msg, flags, indexPtr) #undef Tcl_NewBooleanObj #define Tcl_NewBooleanObj(boolValue) \ - Tcl_NewIntObj((boolValue)!=0) + Tcl_NewLongObj((boolValue)!=0) #undef Tcl_DbNewBooleanObj #define Tcl_DbNewBooleanObj(boolValue, file, line) \ Tcl_DbNewLongObj((boolValue)!=0, file, line) #undef Tcl_SetBooleanObj #define Tcl_SetBooleanObj(objPtr, boolValue) \ - Tcl_SetIntObj((objPtr), (boolValue)!=0) + Tcl_SetLongObj((objPtr), (boolValue)!=0) #undef Tcl_SetVar #define Tcl_SetVar(interp, varName, newValue, flags) \ Tcl_SetVar2(interp, varName, NULL, newValue, flags) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index c244b08..e3fa730 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -910,9 +910,9 @@ TclCreateExecEnv( + (size_t) (size-1) * sizeof(Tcl_Obj *)); eePtr->execStackPtr = esPtr; - TclNewBooleanObj(eePtr->constants[0], 0); + TclNewLongObj(eePtr->constants[0], 0); Tcl_IncrRefCount(eePtr->constants[0]); - TclNewBooleanObj(eePtr->constants[1], 1); + TclNewLongObj(eePtr->constants[1], 1); Tcl_IncrRefCount(eePtr->constants[1]); eePtr->interp = interp; eePtr->callbackPtr = NULL; diff --git a/generic/tclInt.h b/generic/tclInt.h index f078d18..9cca14a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4516,9 +4516,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; * core. They should only be called on unshared objects. The ANSI C * "prototypes" for these macros are: * - * MODULE_SCOPE void TclSetIntObj(Tcl_Obj *objPtr, int intValue); * MODULE_SCOPE void TclSetLongObj(Tcl_Obj *objPtr, long longValue); - * MODULE_SCOPE void TclSetBooleanObj(Tcl_Obj *objPtr, long boolValue); * MODULE_SCOPE void TclSetWideIntObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclSetDoubleObj(Tcl_Obj *objPtr, double d); *---------------------------------------------------------------- @@ -4532,19 +4530,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; (objPtr)->typePtr = &tclIntType; \ } while (0) -#define TclSetIntObj(objPtr, l) \ - TclSetLongObj(objPtr, l) - -/* - * NOTE: There is to be no such thing as a "pure" boolean. Boolean values set - * programmatically go straight to being "int" Tcl_Obj's, with value 0 or 1. - * The only "boolean" Tcl_Obj's shall be those holding the cached boolean - * value of strings like: "yes", "no", "true", "false", "on", "off". - */ - -#define TclSetBooleanObj(objPtr, b) \ - TclSetLongObj(objPtr, (b)!=0); - #ifndef TCL_WIDE_INT_IS_LONG #define TclSetWideIntObj(objPtr, w) \ do { \ @@ -4570,7 +4555,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; * the core. The ANSI C "prototypes" for these macros are: * * MODULE_SCOPE void TclNewLongObj(Tcl_Obj *objPtr, long l); - * MODULE_SCOPE void TclNewBooleanObj(Tcl_Obj *objPtr, int b); * MODULE_SCOPE void TclNewWideObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclNewDoubleObj(Tcl_Obj *objPtr, double d); * MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, const char *s, int len); @@ -4591,13 +4575,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; TCL_DTRACE_OBJ_CREATE(objPtr); \ } while (0) -/* - * NOTE: There is to be no such thing as a "pure" boolean. - * See comment above TclSetBooleanObj macro above. - */ -#define TclNewBooleanObj(objPtr, b) \ - TclNewLongObj((objPtr), (b)!=0) - #define TclNewDoubleObj(objPtr, d) \ do { \ TclIncrObjsAllocated(); \ @@ -4623,9 +4600,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #define TclNewLongObj(objPtr, l) \ (objPtr) = Tcl_NewLongObj(l) -#define TclNewBooleanObj(objPtr, b) \ - (objPtr) = Tcl_NewBooleanObj(b) - #define TclNewDoubleObj(objPtr, d) \ (objPtr) = Tcl_NewDoubleObj(d) diff --git a/generic/tclObj.c b/generic/tclObj.c index 7ec259f..bfef5fb 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1732,7 +1732,7 @@ Tcl_InvalidateStringRep( * is coerced to 1. * * When TCL_MEM_DEBUG is defined, this function just returns the result - * of calling the debugging version Tcl_DbNewBooleanObj. + * of calling the debugging version Tcl_DbNewLongObj. * * Results: * The newly created object is returned. This object will have an invalid @@ -1751,7 +1751,7 @@ Tcl_Obj * Tcl_NewBooleanObj( register int boolValue) /* Boolean used to initialize new object. */ { - return Tcl_DbNewBooleanObj(boolValue, "unknown", 0); + return Tcl_DbNewLongObj(boolValue!=0, "unknown", 0); } #else /* if not TCL_MEM_DEBUG */ @@ -1762,7 +1762,7 @@ Tcl_NewBooleanObj( { register Tcl_Obj *objPtr; - TclNewBooleanObj(objPtr, boolValue); + TclNewLongObj(objPtr, boolValue!=0); return objPtr; } #endif /* TCL_MEM_DEBUG */ @@ -1793,6 +1793,7 @@ Tcl_NewBooleanObj( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_DbNewBooleanObj #ifdef TCL_MEM_DEBUG @@ -1827,6 +1828,7 @@ Tcl_DbNewBooleanObj( return Tcl_NewBooleanObj(boolValue); } #endif /* TCL_MEM_DEBUG */ +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -1856,7 +1858,7 @@ Tcl_SetBooleanObj( Tcl_Panic("%s called with shared object", "Tcl_SetBooleanObj"); } - TclSetBooleanObj(objPtr, boolValue); + TclSetLongObj(objPtr, boolValue!=0); } /* @@ -2458,7 +2460,7 @@ Tcl_SetIntObj( Tcl_Panic("%s called with shared object", "Tcl_SetIntObj"); } - TclSetIntObj(objPtr, intValue); + TclSetLongObj(objPtr, intValue); } /* diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 561b9dd..816650e 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -304,6 +304,8 @@ static int formatInt(char *buffer, int n){ # define Tcl_TellOld 0 # undef Tcl_SetResult # define Tcl_SetResult 0 +# undef Tcl_DbNewBooleanObj +# define Tcl_DbNewBooleanObj 0 #else /* TCL_NO_DEPRECATED */ # define Tcl_SeekOld seekOld # define Tcl_TellOld tellOld -- cgit v0.12 From 909f1a1a30d5d11579ff2e40d34529a13d5727ec Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 16 Mar 2017 09:07:19 +0000 Subject: Fixes to docs made possible by recent HTML rendering fixes for Tk. --- doc/re_syntax.n | 6 +++--- tools/tcltk-man2html-utils.tcl | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/re_syntax.n b/doc/re_syntax.n index 7988071..8d732ed 100644 --- a/doc/re_syntax.n +++ b/doc/re_syntax.n @@ -293,12 +293,12 @@ treatment is as if the enclosing delimiters were .QW \fB[.\fR \& and .QW \fB.]\fR .) -For example, if \fBo\fR and \fB\*(qo\fR are the members of an +For example, if \fBo\fR and \fB\[^o]\fR are the members of an equivalence class, then .QW \fB[[=o=]]\fR , -.QW \fB[[=\*(qo=]]\fR , +.QW \fB[[=\[^o]=]]\fR , and -.QW \fB[o\*(qo]\fR \& +.QW \fB[o\[^o]]\fR \& are all synonymous. An equivalence class may not be an endpoint of a range. .RS .PP diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index c887edd..b69e601 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -155,12 +155,11 @@ proc process-text {text} { {\fP} {\fR} \ {\.} . \ {\(bu} "•" \ - "\\*(qo" "ô" \ ] # This might make a few invalid mappings, but we don't use them foreach c {a e i o u y A E I O U Y} { foreach {prefix suffix} { - o circ / slash : uml ' acute ^ circ ` grave + o ring / slash : uml ' acute ^ circ ` grave } { lappend charmap "\\\[${prefix}${c}\]" "&${c}${suffix};" } -- cgit v0.12 From 5617ad7c180796ca3ded40478d67504694057ee6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 Mar 2017 10:57:24 +0000 Subject: If Tcl is compiled with -DTCL_NO_DEPRECATED, make sure that iPtr->(resultSpace|appendResult|appendAvl|appendUsed) are not used any more. --- doc/RecEvalObj.3 | 2 -- generic/tclBasic.c | 10 ++++++++++ generic/tclInt.h | 10 ++++++++++ generic/tclResult.c | 2 +- generic/tclStubInit.c | 19 +++++++++++++++++++ 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/doc/RecEvalObj.3 b/doc/RecEvalObj.3 index 1b0f292..f9550a2 100644 --- a/doc/RecEvalObj.3 +++ b/doc/RecEvalObj.3 @@ -32,8 +32,6 @@ the command at global level instead of the current stack level. .PP \fBTcl_RecordAndEvalObj\fR is invoked to record a command as an event on the history list and then execute it using \fBTcl_EvalObjEx\fR -(or \fBTcl_GlobalEvalObj\fR if the \fBTCL_EVAL_GLOBAL\fR bit is set -in \fIflags\fR). It returns a completion code such as \fBTCL_OK\fR just like \fBTcl_EvalObjEx\fR, as well as a result value containing additional information (a result value or error message) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 32caac5..685e64c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -510,7 +510,11 @@ Tcl_CreateInterp(void) iPtr = ckalloc(sizeof(Interp)); interp = (Tcl_Interp *) iPtr; +#ifdef TCL_NO_DEPRECATED + iPtr->result = &tclEmptyString; +#else iPtr->result = iPtr->resultSpace; +#endif iPtr->freeProc = NULL; iPtr->errorLine = 0; iPtr->objResultPtr = Tcl_NewObj(); @@ -570,9 +574,11 @@ Tcl_CreateInterp(void) iPtr->rootFramePtr = NULL; /* Initialise as soon as :: is available */ iPtr->lookupNsPtr = NULL; +#ifndef TCL_NO_DEPRECATED iPtr->appendResult = NULL; iPtr->appendAvl = 0; iPtr->appendUsed = 0; +#endif Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS); iPtr->packageUnknown = NULL; @@ -602,7 +608,9 @@ Tcl_CreateInterp(void) iPtr->emptyObjPtr = Tcl_NewObj(); /* Another empty object. */ Tcl_IncrRefCount(iPtr->emptyObjPtr); +#ifndef TCL_NO_DEPRECATED iPtr->resultSpace[0] = 0; +#endif iPtr->threadId = Tcl_GetCurrentThread(); /* TIP #378 */ @@ -1535,10 +1543,12 @@ DeleteInterpProc( if (iPtr->returnOpts) { Tcl_DecrRefCount(iPtr->returnOpts); } +#ifndef TCL_NO_DEPRECATED if (iPtr->appendResult != NULL) { ckfree(iPtr->appendResult); iPtr->appendResult = NULL; } +#endif TclFreePackageInfo(iPtr); while (iPtr->tracePtr != NULL) { Tcl_DeleteTrace((Tcl_Interp *) iPtr, (Tcl_Trace) iPtr->tracePtr); diff --git a/generic/tclInt.h b/generic/tclInt.h index 562e895..3845598 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1862,6 +1862,7 @@ typedef struct Interp { * See Tcl_AppendResult code for details. */ +#ifndef TCL_NO_DEPRECATED char *appendResult; /* Storage space for results generated by * Tcl_AppendResult. Ckalloc-ed. NULL means * not yet allocated. */ @@ -1869,6 +1870,11 @@ typedef struct Interp { * partialResult. */ int appendUsed; /* Number of non-null bytes currently stored * at partialResult. */ +#else + char *appendResultDontUse; + int appendAvlDontUse; + int appendUsedDontUse; +#endif /* * Information about packages. Used only in tclPkg.c. @@ -1930,8 +1936,12 @@ typedef struct Interp { * string. Returned by Tcl_ObjSetVar2 when * variable traces change a variable in a * gross way. */ +#ifndef TCL_NO_DEPRECATED char resultSpace[TCL_RESULT_SIZE+1]; /* Static space holding small results. */ +#else + char resultSpaceDontUse[TCL_RESULT_SIZE+1]; +#endif Tcl_Obj *objResultPtr; /* If the last command returned an object * result, this points to it. Should not be * accessed directly; see comment above. */ diff --git a/generic/tclResult.c b/generic/tclResult.c index ddf764b..57a6de5 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -232,6 +232,7 @@ Tcl_DiscardInterpState( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_SaveResult void Tcl_SaveResult( @@ -409,7 +410,6 @@ Tcl_DiscardResult( *---------------------------------------------------------------------- */ -#ifndef TCL_NO_DEPRECATED void Tcl_SetResult( Tcl_Interp *interp, /* Interpreter with which to associate the diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 816650e..121cf59 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -306,6 +306,25 @@ static int formatInt(char *buffer, int n){ # define Tcl_SetResult 0 # undef Tcl_DbNewBooleanObj # define Tcl_DbNewBooleanObj 0 +# undef Tcl_EvalObj +# define Tcl_EvalObj 0 +# undef Tcl_GlobalEvalObj +# define Tcl_GlobalEvalObj 0 +# define Tcl_NewBooleanObj 0 +# undef Tcl_SetBooleanObj +# define Tcl_SetBooleanObj 0 +# undef Tcl_PkgPresent +# define Tcl_PkgPresent 0 +# undef Tcl_PkgProvide +# define Tcl_PkgProvide 0 +# undef Tcl_PkgRequire +# define Tcl_PkgRequire 0 +# undef Tcl_DiscardResult +# define Tcl_DiscardResult 0 +# undef Tcl_RestoreResult +# define Tcl_RestoreResult 0 +# undef Tcl_SaveResult +# define Tcl_SaveResult 0 #else /* TCL_NO_DEPRECATED */ # define Tcl_SeekOld seekOld # define Tcl_TellOld tellOld -- cgit v0.12 From 754b233873390beef740d1af75437ec3684b198b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Mar 2017 10:24:11 +0000 Subject: If compiled with TCL_NO_DEPRECATED, remove some more stub entries which are not used any more. --- generic/tclBasic.c | 6 ++++++ generic/tclDecls.h | 33 ++++++++++++++++++++++++++++----- generic/tclIndexObj.c | 2 ++ generic/tclInterp.c | 3 --- generic/tclObj.c | 2 +- generic/tclPreserve.c | 2 +- generic/tclStubInit.c | 44 +++++++++++++++++++++++++++++++------------- generic/tclStubLib.c | 2 +- generic/tclTest.c | 8 ++++---- generic/tclVar.c | 16 +++++++++------- 10 files changed, 83 insertions(+), 35 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 685e64c..8e816a5 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -5861,6 +5861,7 @@ TclArgumentGet( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_Eval int Tcl_Eval( @@ -5879,6 +5880,7 @@ Tcl_Eval( (void) Tcl_GetStringResult(interp); return code; } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -6739,6 +6741,7 @@ Tcl_AppendObjToErrorInfo( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_AddErrorInfo void Tcl_AddErrorInfo( @@ -6748,6 +6751,7 @@ Tcl_AddErrorInfo( { Tcl_AddObjErrorInfo(interp, message, -1); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -6920,6 +6924,7 @@ Tcl_VarEval( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_GlobalEval int Tcl_GlobalEval( @@ -6937,6 +6942,7 @@ Tcl_GlobalEval( iPtr->varFramePtr = savedVarFramePtr; return result; } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclDecls.h b/generic/tclDecls.h index fb7f8bc..d990889 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3841,7 +3841,7 @@ extern const TclStubs *tclStubsPtr; Tcl_DbNewLongObj((boolValue)!=0, file, line) #undef Tcl_SetBooleanObj #define Tcl_SetBooleanObj(objPtr, boolValue) \ - Tcl_SetLongObj((objPtr), (boolValue)!=0) + Tcl_SetLongObj(objPtr, (boolValue)!=0) #undef Tcl_SetVar #define Tcl_SetVar(interp, varName, newValue, flags) \ Tcl_SetVar2(interp, varName, NULL, newValue, flags) @@ -3870,6 +3870,29 @@ extern const TclStubs *tclStubsPtr; #define Tcl_AddObjErrorInfo(interp, message, length) \ Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(message, length)) #ifdef TCL_NO_DEPRECATED +#undef Tcl_Eval +#define Tcl_Eval(interp, objPtr) \ + Tcl_EvalEx(interp, objPtr, -1, 0) +#undef Tcl_GlobalEval +#define Tcl_GlobalEval(interp, objPtr) \ + Tcl_EvalEx(interp, objPtr, -1, TCL_EVAL_GLOBAL) +#undef Tcl_SaveResult +#define Tcl_SaveResult(interp, statePtr) \ + do { \ + (statePtr)->objResultPtr = Tcl_GetObjResult(interp); \ + Tcl_IncrRefCount((statePtr)->objResultPtr); \ + Tcl_SetObjResult(interp, Tcl_NewObj()); \ + } while(0) +#undef Tcl_RestoreResult +#define Tcl_RestoreResult(interp, statePtr) \ + do { \ + Tcl_ResetResult(interp); \ + Tcl_SetObjResult(interp, (statePtr)->objResultPtr); \ + Tcl_DecrRefCount((statePtr)->objResultPtr); \ + } while(0) +#undef Tcl_DiscardResult +#define Tcl_DiscardResult(statePtr) \ + Tcl_DecrRefCount((statePtr)->objResultPtr) #undef Tcl_SetResult #define Tcl_SetResult(interp, result, freeProc) \ do { \ @@ -3939,10 +3962,10 @@ extern const TclStubs *tclStubsPtr; */ #undef Tcl_EvalObj -#define Tcl_EvalObj(interp,objPtr) \ - Tcl_EvalObjEx((interp),(objPtr),0) +#define Tcl_EvalObj(interp, objPtr) \ + Tcl_EvalObjEx(interp, objPtr, 0) #undef Tcl_GlobalEvalObj -#define Tcl_GlobalEvalObj(interp,objPtr) \ - Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL) +#define Tcl_GlobalEvalObj(interp, objPtr) \ + Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL) #endif /* _TCLDECLS */ diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 6a3e4e3..9f38638 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -101,6 +101,7 @@ typedef struct { *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_GetIndexFromObj int Tcl_GetIndexFromObj( @@ -137,6 +138,7 @@ Tcl_GetIndexFromObj( return Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, sizeof(char *), msg, flags, indexPtr); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclInterp.c b/generic/tclInterp.c index af9f1bf..d9dfd37 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -3533,9 +3533,6 @@ Tcl_LimitAddHandler( if (deleteProc == (Tcl_LimitHandlerDeleteProc *) TCL_DYNAMIC) { deleteProc = (Tcl_LimitHandlerDeleteProc *) Tcl_Free; } - if (deleteProc == (Tcl_LimitHandlerDeleteProc *) TCL_STATIC) { - deleteProc = NULL; - } /* * Allocate a handler record. diff --git a/generic/tclObj.c b/generic/tclObj.c index bfef5fb..8069a7c 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1828,7 +1828,6 @@ Tcl_DbNewBooleanObj( return Tcl_NewBooleanObj(boolValue); } #endif /* TCL_MEM_DEBUG */ -#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -1860,6 +1859,7 @@ Tcl_SetBooleanObj( TclSetLongObj(objPtr, boolValue!=0); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c index 2d0e15c..5c6097f 100644 --- a/generic/tclPreserve.c +++ b/generic/tclPreserve.c @@ -155,7 +155,7 @@ Tcl_Preserve( refPtr->clientData = clientData; refPtr->refCount = 1; refPtr->mustFree = 0; - refPtr->freeProc = TCL_STATIC; + refPtr->freeProc = 0; inUse += 1; Tcl_MutexUnlock(&preserveMutex); } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 121cf59..50fac4b 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -302,15 +302,6 @@ static int formatInt(char *buffer, int n){ #ifdef TCL_NO_DEPRECATED # define Tcl_SeekOld 0 # define Tcl_TellOld 0 -# undef Tcl_SetResult -# define Tcl_SetResult 0 -# undef Tcl_DbNewBooleanObj -# define Tcl_DbNewBooleanObj 0 -# undef Tcl_EvalObj -# define Tcl_EvalObj 0 -# undef Tcl_GlobalEvalObj -# define Tcl_GlobalEvalObj 0 -# define Tcl_NewBooleanObj 0 # undef Tcl_SetBooleanObj # define Tcl_SetBooleanObj 0 # undef Tcl_PkgPresent @@ -319,12 +310,39 @@ static int formatInt(char *buffer, int n){ # define Tcl_PkgProvide 0 # undef Tcl_PkgRequire # define Tcl_PkgRequire 0 -# undef Tcl_DiscardResult -# define Tcl_DiscardResult 0 -# undef Tcl_RestoreResult -# define Tcl_RestoreResult 0 +# undef Tcl_GetIndexFromObj +# define Tcl_GetIndexFromObj 0 +# define Tcl_NewBooleanObj 0 +# undef Tcl_DbNewBooleanObj +# define Tcl_DbNewBooleanObj 0 +# undef Tcl_SetBooleanObj +# define Tcl_SetBooleanObj 0 +# undef Tcl_SetVar +# define Tcl_SetVar 0 +# undef Tcl_UnsetVar +# define Tcl_UnsetVar 0 +# undef Tcl_GetVar +# define Tcl_GetVar 0 +# undef Tcl_AddErrorInfo +# define Tcl_AddErrorInfo 0 +# undef Tcl_AddObjErrorInfo +# define Tcl_AddObjErrorInfo 0 +# undef Tcl_Eval +# define Tcl_Eval 0 +# undef Tcl_GlobalEval +# define Tcl_GlobalEval 0 # undef Tcl_SaveResult # define Tcl_SaveResult 0 +# undef Tcl_RestoreResult +# define Tcl_RestoreResult 0 +# undef Tcl_DiscardResult +# define Tcl_DiscardResult 0 +# undef Tcl_SetResult +# define Tcl_SetResult 0 +# undef Tcl_EvalObj +# define Tcl_EvalObj 0 +# undef Tcl_GlobalEvalObj +# define Tcl_GlobalEvalObj 0 #else /* TCL_NO_DEPRECATED */ # define Tcl_SeekOld seekOld # define Tcl_TellOld tellOld diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index dd951bf..5261591 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -67,7 +67,7 @@ Tcl_InitStubs( if (!stubsPtr || (stubsPtr->magic != (((exact&0xff00) >= 0x900) ? magic : TCL_STUB_MAGIC))) { iPtr->result = (char *)"interpreter uses an incompatible stubs mechanism"; - iPtr->freeProc = TCL_STATIC; + iPtr->freeProc = 0; return NULL; } diff --git a/generic/tclTest.c b/generic/tclTest.c index a9dc1ca..84d4ea1 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -3405,7 +3405,7 @@ TestMathFunc2( resultPtr->type = TCL_WIDE_INT; resultPtr->wideValue = ((w0 > w1)? w0 : w1); } else { - Tcl_SetResult(interp, (char *)"T3: wrong type for arg 2", TCL_STATIC); + Tcl_AppendResult(interp, "T3: wrong type for arg 2", NULL); result = TCL_ERROR; } } else if (args[0].type == TCL_DOUBLE) { @@ -3427,7 +3427,7 @@ TestMathFunc2( resultPtr->type = TCL_DOUBLE; resultPtr->doubleValue = ((d0 > d1)? d0 : d1); } else { - Tcl_SetResult(interp, (char *)"T3: wrong type for arg 2", TCL_STATIC); + Tcl_AppendResult(interp, "T3: wrong type for arg 2", NULL); result = TCL_ERROR; } } else if (args[0].type == TCL_WIDE_INT) { @@ -3450,11 +3450,11 @@ TestMathFunc2( resultPtr->type = TCL_WIDE_INT; resultPtr->wideValue = ((w0 > w1)? w0 : w1); } else { - Tcl_SetResult(interp, (char *)"T3: wrong type for arg 2", TCL_STATIC); + Tcl_AppendResult(interp, "T3: wrong type for arg 2", NULL); result = TCL_ERROR; } } else { - Tcl_SetResult(interp, (char *)"T3: wrong type for arg 1", TCL_STATIC); + Tcl_AppendResult(interp, "T3: wrong type for arg 1", NULL); result = TCL_ERROR; } return result; diff --git a/generic/tclVar.c b/generic/tclVar.c index 5ab6e8b..6090d61 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -1067,6 +1067,7 @@ TclLookupArrayElement( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_GetVar const char * Tcl_GetVar( @@ -1087,6 +1088,7 @@ Tcl_GetVar( } return TclGetString(resultPtr); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -1410,6 +1412,7 @@ Tcl_SetObjCmd( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_SetVar const char * Tcl_SetVar( @@ -1422,18 +1425,15 @@ Tcl_SetVar( * TCL_APPEND_VALUE, TCL_LIST_ELEMENT, * TCL_LEAVE_ERR_MSG. */ { - Tcl_Obj *varValuePtr, *varNamePtr = Tcl_NewStringObj(varName, -1); - - Tcl_IncrRefCount(varNamePtr); - varValuePtr = Tcl_ObjSetVar2(interp, varNamePtr, NULL, + Tcl_Obj *varValuePtr = Tcl_SetVar2Ex(interp, varName, NULL, Tcl_NewStringObj(newValue, -1), flags); - Tcl_DecrRefCount(varNamePtr); if (varValuePtr == NULL) { return NULL; } return TclGetString(varValuePtr); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -2005,6 +2005,7 @@ TclPtrIncrObjVar( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_UnsetVar int Tcl_UnsetVar( @@ -2033,6 +2034,7 @@ Tcl_UnsetVar( Tcl_DecrRefCount(varNamePtr); return result; } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -4050,7 +4052,7 @@ TclInitArrayCmd( * * Results: * A standard Tcl completion code. If an error occurs then an error - * message is left in iPtr->result. + * message is left in interp. * * Side effects: * The variable given by myName is linked to the variable in framePtr @@ -4144,7 +4146,7 @@ ObjMakeUpvar( * * Results: * A standard Tcl completion code. If an error occurs then an error - * message is left in iPtr->result. + * message is left in interp. * * Side effects: * The variable given by myName is linked to the variable in framePtr -- cgit v0.12 From dc25a1a62b5759e600a6346d6279f71c6d421299 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 21 Mar 2017 09:01:09 +0000 Subject: Addendum to previous commit: If compiled with TCL_NO_DEPRECATED, remove a few more stub entries which are not used any more. --- generic/tclStubInit.c | 8 ++++++++ generic/tclTrace.c | 6 ++++++ generic/tclVar.c | 2 ++ 3 files changed, 16 insertions(+) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 50fac4b..7957389 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -323,6 +323,14 @@ static int formatInt(char *buffer, int n){ # define Tcl_UnsetVar 0 # undef Tcl_GetVar # define Tcl_GetVar 0 +# undef Tcl_TraceVar +# define Tcl_TraceVar 0 +# undef Tcl_UntraceVar +# define Tcl_UntraceVar 0 +# undef Tcl_VarTraceInfo +# define Tcl_VarTraceInfo 0 +# undef Tcl_UpVar +# define Tcl_UpVar 0 # undef Tcl_AddErrorInfo # define Tcl_AddErrorInfo 0 # undef Tcl_AddObjErrorInfo diff --git a/generic/tclTrace.c b/generic/tclTrace.c index bea3162..f86f472 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -2819,6 +2819,7 @@ DisposeTraceResult( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_UntraceVar void Tcl_UntraceVar( @@ -2834,6 +2835,7 @@ Tcl_UntraceVar( { Tcl_UntraceVar2(interp, varName, NULL, flags, proc, clientData); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -2988,6 +2990,7 @@ Tcl_UntraceVar2( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_VarTraceInfo ClientData Tcl_VarTraceInfo( @@ -3005,6 +3008,7 @@ Tcl_VarTraceInfo( return Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc, prevClientData); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -3097,6 +3101,7 @@ Tcl_VarTraceInfo2( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_TraceVar int Tcl_TraceVar( @@ -3114,6 +3119,7 @@ Tcl_TraceVar( { return Tcl_TraceVar2(interp, varName, NULL, flags, proc, clientData); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclVar.c b/generic/tclVar.c index 6090d61..1947c8d 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -4322,6 +4322,7 @@ TclPtrObjMakeUpvar( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_UpVar int Tcl_UpVar( @@ -4355,6 +4356,7 @@ Tcl_UpVar( Tcl_DecrRefCount(localNamePtr); return result; } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- -- cgit v0.12 From 321cd769b746ae6c9ef1b15e193fb645de9a0d0b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 23 Mar 2017 16:35:08 +0000 Subject: Use portable %p modifier in "generic/tclThreadTest.c", in stead of more complicated TCL_LL_MODIFIER. --- generic/tclThreadTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 1a05f80..5bb0165 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -655,7 +655,7 @@ ThreadErrorProc( char *script; char buf[TCL_DOUBLE_SPACE+1]; - sprintf(buf, "%" TCL_LL_MODIFIER "d", (Tcl_WideInt)(size_t)Tcl_GetCurrentThread()); + sprintf(buf, "%p", Tcl_GetCurrentThread()); errorInfo = Tcl_GetVar2(interp, "errorInfo", NULL, TCL_GLOBAL_ONLY); if (errorProcString == NULL) { -- cgit v0.12 From ab08379d1c20b87f25e17de1c9e8bac2b0360e47 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 24 Mar 2017 09:33:00 +0000 Subject: Add TCL_NORETURN attribute to TclpThreadExit() and Tcl_ExitThread() --- generic/tcl.decls | 2 +- generic/tclDecls.h | 4 ++-- generic/tclInt.h | 2 +- macosx/tclMacOSXNotify.c | 5 ++--- unix/tclUnixNotfy.c | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index ba047a0..b2b91a9 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1059,7 +1059,7 @@ declare 293 { int Tcl_EvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags) } declare 294 { - void Tcl_ExitThread(int status) + TCL_NORETURN void Tcl_ExitThread(int status) } declare 295 { int Tcl_ExternalToUtf(Tcl_Interp *interp, Tcl_Encoding encoding, diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d990889..d543238 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -878,7 +878,7 @@ EXTERN int Tcl_EvalObjv(Tcl_Interp *interp, int objc, EXTERN int Tcl_EvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 294 */ -EXTERN void Tcl_ExitThread(int status); +EXTERN TCL_NORETURN void Tcl_ExitThread(int status); /* 295 */ EXTERN int Tcl_ExternalToUtf(Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, @@ -2151,7 +2151,7 @@ typedef struct TclStubs { int (*tcl_EvalEx) (Tcl_Interp *interp, const char *script, int numBytes, int flags); /* 291 */ int (*tcl_EvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 292 */ int (*tcl_EvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 293 */ - void (*tcl_ExitThread) (int status); /* 294 */ + TCL_NORETURN1 void (*tcl_ExitThread) (int status); /* 294 */ int (*tcl_ExternalToUtf) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 295 */ char * (*tcl_ExternalToUtfDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 296 */ void (*tcl_FinalizeThread) (void); /* 297 */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 3845598..1fbc541 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3124,7 +3124,7 @@ MODULE_SCOPE void TclpSetVariables(Tcl_Interp *interp); MODULE_SCOPE void * TclThreadStorageKeyGet(Tcl_ThreadDataKey *keyPtr); MODULE_SCOPE void TclThreadStorageKeySet(Tcl_ThreadDataKey *keyPtr, void *data); -MODULE_SCOPE void TclpThreadExit(int status); +MODULE_SCOPE TCL_NORETURN void TclpThreadExit(int status); MODULE_SCOPE void TclRememberCondition(Tcl_Condition *mutex); MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id); MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex); diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index a7f26b7..1af73de 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -385,8 +385,7 @@ static CFStringRef tclEventsOnlyRunLoopMode = NULL; */ static void StartNotifierThread(void); -static void NotifierThreadProc(ClientData clientData) - __attribute__ ((__noreturn__)); +static TCL_NORETURN void NotifierThreadProc(ClientData clientData); static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); static void TimerWakeUp(CFRunLoopTimerRef timer, void *info); static void QueueFileEvents(void *info); @@ -1753,7 +1752,7 @@ TclUnixWaitForFile( *---------------------------------------------------------------------- */ -static void +static TCL_NORETURN void NotifierThreadProc( ClientData clientData) /* Not used. */ { diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index e37962d..6b7669d 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -193,7 +193,7 @@ static Tcl_ThreadId notifierThread; */ #ifdef TCL_THREADS -static void NotifierThreadProc(ClientData clientData); +static TCL_NORETURN void NotifierThreadProc(ClientData clientData); #if defined(HAVE_PTHREAD_ATFORK) static int atForkInit = 0; static void AtForkChild(void); @@ -1139,7 +1139,7 @@ Tcl_WaitForEvent( *---------------------------------------------------------------------- */ -static void +static TCL_NORETURN void NotifierThreadProc( ClientData clientData) /* Not used. */ { -- cgit v0.12 From 920aa8280f7ad6756c06787903f8ee5b9a5497a3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 24 Mar 2017 15:52:42 +0000 Subject: Supply more C99-compatible (and MSVC) format options: '%p' for pointers, 'z'/'j'/'I' for size_t/intptr_diff, 'j'/'q' for long long. Also add "I32" froom MSVC. Remove TCL_LL_MODIFIER specified as "L" for Borland: This must be wrong as "L" is meant for long double. Just assume that later Borland compilers are MSVC-compatible. --- generic/tcl.h | 6 +----- generic/tclStringObj.c | 39 +++++++++++++++++++++++++++++++++------ generic/tclTest.c | 4 +++- tests/util.test | 32 ++++++++++++++++++++++++++++---- 4 files changed, 65 insertions(+), 16 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 1491745..bdb4035 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -393,11 +393,7 @@ typedef long LONG; #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) # if defined(_WIN32) # define TCL_WIDE_INT_TYPE __int64 -# ifdef __BORLANDC__ -# define TCL_LL_MODIFIER "L" -# else /* __BORLANDC__ */ -# define TCL_LL_MODIFIER "I64" -# endif /* __BORLANDC__ */ +# define TCL_LL_MODIFIER "I64" # elif defined(__GNUC__) # define TCL_WIDE_INT_TYPE long long # define TCL_LL_MODIFIER "ll" diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c45baa1..b8b64d4 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1865,11 +1865,22 @@ Tcl_AppendFormatToObj( useWide = 1; #endif } - } else if ((ch == 'I') && (format[1] == '6') && (format[2] == '4')) { - format += (step + 2); + } else if (ch == 'I') { + if ((format[1] == '6') && (format[2] == '4')) { + format += (step + 2); + step = Tcl_UtfToUniChar(format, &ch); + useBig = 1; + } else if ((format[1] == '3') && (format[2] == '2')) { + format += (step + 2); + step = Tcl_UtfToUniChar(format, &ch); + } else { + format += step; + step = Tcl_UtfToUniChar(format, &ch); + } + } else if ((ch == 't') || (ch == 'z')) { + format += step; step = Tcl_UtfToUniChar(format, &ch); - useBig = 1; - } else if (ch == 'L') { + } else if ((ch == 'q') ||(ch == 'j')) { format += step; step = Tcl_UtfToUniChar(format, &ch); useBig = 1; @@ -1925,6 +1936,7 @@ Tcl_AppendFormatToObj( } case 'd': case 'o': + case 'p': case 'x': case 'X': case 'b': { @@ -1993,13 +2005,14 @@ Tcl_AppendFormatToObj( segmentLimit -= 1; } - if (gotHash) { + if (gotHash || (ch == 'p')) { switch (ch) { case 'o': Tcl_AppendToObj(segment, "0", 1); segmentLimit -= 1; precision--; break; + case 'p': case 'x': case 'X': Tcl_AppendToObj(segment, "0x", 2); @@ -2078,6 +2091,7 @@ Tcl_AppendFormatToObj( case 'u': case 'o': + case 'p': case 'x': case 'X': case 'b': { @@ -2467,6 +2481,7 @@ AppendPrintfToObjVA( case 'u': case 'd': case 'o': + case 'p': case 'x': case 'X': seekingConversion = 0; @@ -2517,7 +2532,15 @@ AppendPrintfToObjVA( ++size; p++; break; - case 'L': + case 't': + case 'z': + if (sizeof(size_t) == sizeof(Tcl_WideInt)) { + size = 2; + } + p++; + break; + case 'j': + case 'q': size = 2; p++; break; @@ -2525,6 +2548,10 @@ AppendPrintfToObjVA( if (p[1]=='6' && p[2]=='4') { p += 2; size = 2; + } else if (p[1]=='3' && p[2]=='2') { + p += 2; + } else if (sizeof(size_t) == sizeof(Tcl_WideInt)) { + size = 2; } p++; break; diff --git a/generic/tclTest.c b/generic/tclTest.c index 84d4ea1..0f019bb 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -3847,6 +3847,7 @@ TestprintObjCmd( Tcl_Obj *const objv[]) /* The argument objects. */ { Tcl_WideInt argv1 = 0; + size_t argv2; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "format wideint"); @@ -3855,7 +3856,8 @@ TestprintObjCmd( if (objc > 1) { Tcl_GetWideIntFromObj(interp, objv[2], &argv1); } - Tcl_SetObjResult(interp, Tcl_ObjPrintf(Tcl_GetString(objv[1]), argv1)); + argv2 = (size_t)argv1; + Tcl_SetObjResult(interp, Tcl_ObjPrintf(Tcl_GetString(objv[1]), argv1, argv2, argv2)); return TCL_OK; } diff --git a/tests/util.test b/tests/util.test index 1a3eecb..22d120b 100644 --- a/tests/util.test +++ b/tests/util.test @@ -4027,21 +4027,45 @@ test util-18.2 {Tcl_ObjPrintf} {testprint} { } {9223372036854775807} test util-18.3 {Tcl_ObjPrintf} {testprint} { - testprint %Ld [expr 2**63-1] + testprint %qd [expr 2**63-1] } {9223372036854775807} test util-18.4 {Tcl_ObjPrintf} {testprint} { + testprint %jd [expr 2**63-1] +} {9223372036854775807} + +test util-18.5 {Tcl_ObjPrintf} {testprint} { testprint %lld [expr -2**63] } {-9223372036854775808} -test util-18.5 {Tcl_ObjPrintf} {testprint} { +test util-18.6 {Tcl_ObjPrintf} {testprint} { testprint %I64d [expr -2**63] } {-9223372036854775808} -test util-18.6 {Tcl_ObjPrintf} {testprint} { - testprint %Ld [expr -2**63] +test util-18.7 {Tcl_ObjPrintf} {testprint} { + testprint %qd [expr -2**63] } {-9223372036854775808} +test util-18.8 {Tcl_ObjPrintf} {testprint} { + testprint %jd [expr -2**63] +} {-9223372036854775808} + +test util-18.9 {Tcl_ObjPrintf} {testprint} { + testprint "%I64d %I32d" [expr -2**63+2] +} {-9223372036854775806 2} + +test util-18.10 {Tcl_ObjPrintf} {testprint} { + testprint "%I64d %p" 65535 +} {65535 0xffff} + +test util-18.11 {Tcl_ObjPrintf} {testprint} { + testprint "%I64d %td" 65536 +} {65536 65536} + +test util-18.12 {Tcl_ObjPrintf} {testprint} { + testprint "%I64d %Id" 65537 +} {65537 65537} + set ::tcl_precision $saved_precision # cleanup -- cgit v0.12 From 0c0b1e14981ac6b1b9d1ba4f5f423b62a7f07cdb Mon Sep 17 00:00:00 2001 From: aspect Date: Mon, 27 Mar 2017 13:02:22 +0000 Subject: Correct this use of isWanted to ensure NO_IMPLEMENTATION methods are not listed (bug [900cb0284bc]) --- generic/tclOOCall.c | 1 + tests/oo.test | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 8003345..c861eb9 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -618,6 +618,7 @@ AddClassMethodNames( if (isNew) { int isWanted = (!(flags & PUBLIC_METHOD) || (mPtr->flags & PUBLIC_METHOD)) ? IN_LIST : 0; + isWanted |= (mPtr->typePtr == NULL ? NO_IMPLEMENTATION : 0); Tcl_SetHashValue(hPtr, INT2PTR(isWanted)); } else if ((PTR2INT(Tcl_GetHashValue(hPtr)) & NO_IMPLEMENTATION) diff --git a/tests/oo.test b/tests/oo.test index ccb05c1..290e41d 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2242,6 +2242,44 @@ test oo-17.10 {OO: class introspection} -setup { info class methods foo -all } -result {} +test oo-17.11 {OO: object method unexport (bug 900cb0284bc)} -setup { + oo::object create o + oo::objdefine o unexport m +} -cleanup { + o destroy +} -body { + expr {"m" in [info object methods o -all -private]} +} -result 0 +test oo-17.12 {OO: instance method unexport (bug 900cb0284bc)} -setup { + oo::class create c + c create o + oo::objdefine o unexport m +} -cleanup { + o destroy + c destroy +} -body { + expr {"m" in [info object methods o -all -private]} +} -result 0 +test oo-17.13 {OO: class method unexport (bug 900cb0284bc)} -setup { + oo::class create c + oo::define c unexport m +} -cleanup { + c destroy +} -body { + expr {"m" in [info class methods c -all -private]} +} -result 0 +test oo-17.14 {OO: instance method unexport (bug 900cb0284bc)} -setup { + oo::class create c + oo::define c unexport m + c create o +} -cleanup { + o destroy + c destroy +} -body { + expr {"m" in [info object methods o -all -private]} +} -result 0 + + test oo-18.1 {OO: define command support} { list [catch {oo::define oo::object {error foo}} msg] $msg $errorInfo } {1 foo {foo -- cgit v0.12 From 0abecbc87da774aa9756a4ce64948de62419cc34 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Mar 2017 14:53:54 +0000 Subject: Fix [4768eb5c166a1b923e3472d18d75fdccc1a47513|4768eb5c16]: format-8.20 failure. Since "%q" now is a valid length specifier, we cannot use it any more to test for "bad field specifier" --- tests/format.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/format.test b/tests/format.test index e199398..7186729 100644 --- a/tests/format.test +++ b/tests/format.test @@ -349,9 +349,9 @@ test format-8.19 {error conditions} { catch {format %q x} } 1 test format-8.20 {error conditions} { - catch {format %q x} msg + catch {format %r x} msg set msg -} {bad field specifier "q"} +} {bad field specifier "r"} test format-8.21 {error conditions} { catch {format %d} } 1 -- cgit v0.12 From 8dfdec39fdad708127121a63c2b9e0ca7cb4a0d2 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 29 Mar 2017 19:05:17 +0000 Subject: Tweak to make tests a little clearer. --- generic/tclOOCall.c | 2 +- tests/oo.test | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index c861eb9..ac0b94d 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -618,8 +618,8 @@ AddClassMethodNames( if (isNew) { int isWanted = (!(flags & PUBLIC_METHOD) || (mPtr->flags & PUBLIC_METHOD)) ? IN_LIST : 0; - isWanted |= (mPtr->typePtr == NULL ? NO_IMPLEMENTATION : 0); + isWanted |= (mPtr->typePtr == NULL ? NO_IMPLEMENTATION : 0); Tcl_SetHashValue(hPtr, INT2PTR(isWanted)); } else if ((PTR2INT(Tcl_GetHashValue(hPtr)) & NO_IMPLEMENTATION) && mPtr->typePtr != NULL) { diff --git a/tests/oo.test b/tests/oo.test index 290e41d..e03911b 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2241,43 +2241,43 @@ test oo-17.10 {OO: class introspection} -setup { oo::define foo unexport {*}[info class methods foo -all] info class methods foo -all } -result {} - +set stdmethods { destroy eval unknown variable varname} test oo-17.11 {OO: object method unexport (bug 900cb0284bc)} -setup { oo::object create o oo::objdefine o unexport m +} -body { + lsort [info object methods o -all -private] } -cleanup { o destroy -} -body { - expr {"m" in [info object methods o -all -private]} -} -result 0 +} -result $stdmethods test oo-17.12 {OO: instance method unexport (bug 900cb0284bc)} -setup { oo::class create c c create o oo::objdefine o unexport m +} -body { + lsort [info object methods o -all -private] } -cleanup { o destroy c destroy -} -body { - expr {"m" in [info object methods o -all -private]} -} -result 0 +} -result $stdmethods test oo-17.13 {OO: class method unexport (bug 900cb0284bc)} -setup { oo::class create c oo::define c unexport m +} -body { + lsort [info class methods c -all -private] } -cleanup { c destroy -} -body { - expr {"m" in [info class methods c -all -private]} -} -result 0 +} -result $stdmethods test oo-17.14 {OO: instance method unexport (bug 900cb0284bc)} -setup { oo::class create c oo::define c unexport m c create o +} -body { + lsort [info object methods o -all -private] } -cleanup { o destroy c destroy -} -body { - expr {"m" in [info object methods o -all -private]} -} -result 0 +} -result $stdmethods test oo-18.1 {OO: define command support} { -- cgit v0.12 From ce7746b49e4fc37fb8b21d41292585113eaa940f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 31 Mar 2017 14:44:08 +0000 Subject: Since Tcl_AppendPrintfToObj() now understands the %p format, we can use it. Eliminating some internal string buffers. --- generic/tclDisassemble.c | 12 ++++-------- generic/tclObj.c | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 0d6da8e..5e977e6 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -254,7 +254,6 @@ DisassembleByteCodeObj( int codeOffset, codeLen, srcOffset, srcLen, numCmds, delta, i, line; Interp *iPtr = (Interp *) *codePtr->interpHandle; Tcl_Obj *bufferObj, *fileObj; - char ptrBuf1[20], ptrBuf2[20]; TclNewObj(bufferObj); if (codePtr->refCount <= 0) { @@ -269,11 +268,9 @@ DisassembleByteCodeObj( * Print header lines describing the ByteCode. */ - sprintf(ptrBuf1, "%p", codePtr); - sprintf(ptrBuf2, "%p", iPtr); Tcl_AppendPrintfToObj(bufferObj, - "ByteCode 0x%s, refCt %u, epoch %u, interp 0x%s (epoch %u)\n", - ptrBuf1, codePtr->refCount, codePtr->compileEpoch, ptrBuf2, + "ByteCode %p, refCt %u, epoch %u, interp %p (epoch %u)\n", + codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, iPtr->compileEpoch); Tcl_AppendToObj(bufferObj, " Source ", -1); PrintSourceToObj(bufferObj, codePtr->source, @@ -316,10 +313,9 @@ DisassembleByteCodeObj( Proc *procPtr = codePtr->procPtr; int numCompiledLocals = procPtr->numCompiledLocals; - sprintf(ptrBuf1, "%p", procPtr); Tcl_AppendPrintfToObj(bufferObj, - " Proc 0x%s, refCt %d, args %d, compiled locals %d\n", - ptrBuf1, procPtr->refCount, procPtr->numArgs, + " Proc %p, refCt %d, args %d, compiled locals %d\n", + procPtr, procPtr->refCount, procPtr->numArgs, numCompiledLocals); if (numCompiledLocals > 0) { CompiledLocal *localPtr = procPtr->firstLocalPtr; diff --git a/generic/tclObj.c b/generic/tclObj.c index 8069a7c..dfcaff0 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -4455,7 +4455,6 @@ Tcl_RepresentationCmd( int objc, Tcl_Obj *const objv[]) { - char ptrBuffer[2*TCL_INTEGER_SPACE+6]; Tcl_Obj *descObj; if (objc != 2) { @@ -4469,18 +4468,20 @@ Tcl_RepresentationCmd( * "1872361827361287" */ - sprintf(ptrBuffer, "%p", (void *) objv[1]); descObj = Tcl_ObjPrintf("value is a %s with a refcount of %d," - " object pointer at %s", - objv[1]->typePtr ? objv[1]->typePtr->name : "pure string", - objv[1]->refCount, ptrBuffer); + " object pointer at %p", + objv[1]->typePtr ? objv[1]->typePtr->name : "pure string", + objv[1]->refCount, objv[1]); if (objv[1]->typePtr) { - sprintf(ptrBuffer, "%p:%p", - (void *) objv[1]->internalRep.twoPtrValue.ptr1, - (void *) objv[1]->internalRep.twoPtrValue.ptr2); - Tcl_AppendPrintfToObj(descObj, ", internal representation %s", - ptrBuffer); + if (objv[1]->typePtr == &tclDoubleType) { + Tcl_AppendPrintfToObj(descObj, ", internal representation %g", + objv[1]->internalRep.doubleValue); + } else { + Tcl_AppendPrintfToObj(descObj, ", internal representation %p:%p", + (void *) objv[1]->internalRep.twoPtrValue.ptr1, + (void *) objv[1]->internalRep.twoPtrValue.ptr2); + } } if (objv[1]->bytes) { -- cgit v0.12 From 55edd253ffe75b5f8d2a8a2501a966f81515659a Mon Sep 17 00:00:00 2001 From: max Date: Wed, 5 Apr 2017 14:47:45 +0000 Subject: Use a random unused port for the dummy http server to avoid conflicts with local services running on port 8010. --- tests/http.test | 8 ++------ tests/httpd | 7 ++++++- tests/httpold.test | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/http.test b/tests/http.test index 12ad475..75c963d 100644 --- a/tests/http.test +++ b/tests/http.test @@ -36,7 +36,6 @@ proc bgerror {args} { puts stderr $errorInfo } -set port 8010 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" catch {unset data} @@ -55,9 +54,8 @@ catch {package require Thread 2.7-} if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { set httpthread [thread::create -preserved] thread::send $httpthread [list source $httpdFile] - thread::send $httpthread [list set port $port] thread::send $httpthread [list set bindata $bindata] - thread::send $httpthread {httpd_init $port} + thread::send $httpthread {httpd_init 0; set port} port puts "Running httpd in thread $httpthread" } else { if {![file exists $httpdFile]} { @@ -69,10 +67,8 @@ if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { # Let the OS pick the port; that's much more flexible if {[catch {httpd_init 0} listen]} { puts "Cannot start http server, http test skipped" - unset port + catch {unset port} return - } else { - set port [lindex [fconfigure $listen -sockname] 2] } } diff --git a/tests/httpd b/tests/httpd index 40e10df..f15d71b 100644 --- a/tests/httpd +++ b/tests/httpd @@ -11,7 +11,12 @@ #set httpLog 1 proc httpd_init {{port 8015}} { - socket -server httpdAccept $port + set s [socket -server httpdAccept $port] + # Save the actual port number in a global variable. + # This is important when we're called with port 0 + # for picking an unused port at random. + set ::port [lindex [chan configure $s -sockname] 2] + return $s } proc httpd_log {args} { global httpLog diff --git a/tests/httpold.test b/tests/httpold.test index 5995bed..ab26613 100644 --- a/tests/httpold.test +++ b/tests/httpold.test @@ -1,3 +1,4 @@ +# -*- tcl -*- # Commands covered: http_config, http_get, http_wait, http_reset # # This file contains a collection of tests for the http script library. @@ -41,10 +42,9 @@ catch {unset data} ## source [file join [file dirname [info script]] httpd] -set port 8010 -if [catch {httpd_init $port} listen] { +if [catch {httpd_init 0} listen] { puts "Cannot start http server, http test skipped" - unset port + catch {unset port} ::tcltest::cleanupTests return } -- cgit v0.12 From 44de3dd8dad74f8031286f0750738099156cef0c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 6 Apr 2017 11:13:22 +0000 Subject: If compiled with TCL_NO_DEPRECATED, the functions TclpGetDate/TclpLocaltime/TclpGmtime can be removed: They are internal and not used for anything any more. --- generic/tclBasic.c | 2 +- generic/tclStubInit.c | 22 ++++++++++++---------- tools/tcltk-man2html.tcl | 2 +- unix/tclUnixTime.c | 7 +++++++ win/tclWinTime.c | 8 ++++++++ 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 8e816a5..b29e19e 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -5880,7 +5880,6 @@ Tcl_Eval( (void) Tcl_GetStringResult(interp); return code; } -#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -5915,6 +5914,7 @@ Tcl_GlobalEvalObj( { return Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 7957389..3f0a8ff 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -287,17 +287,9 @@ static int formatInt(char *buffer, int n){ } #define TclFormatInt (int(*)(char *, long))formatInt -#endif +#endif /* TCL_WIDE_INT_IS_LONG */ -#else /* UNIX and MAC */ -# ifdef TCL_NO_DEPRECATED -# define TclpLocaltime_unix 0 -# define TclpGmtime_unix 0 -# else -# define TclpLocaltime_unix TclpLocaltime -# define TclpGmtime_unix TclpGmtime -# endif -#endif +#endif /* __CYGWIN__ */ #ifdef TCL_NO_DEPRECATED # define Tcl_SeekOld 0 @@ -351,9 +343,19 @@ static int formatInt(char *buffer, int n){ # define Tcl_EvalObj 0 # undef Tcl_GlobalEvalObj # define Tcl_GlobalEvalObj 0 +# undef TclpGetDate +# define TclpGetDate 0 +# undef TclpLocaltime +# define TclpLocaltime 0 +# undef TclpGmtime +# define TclpGmtime 0 +# define TclpLocaltime_unix 0 +# define TclpGmtime_unix 0 #else /* TCL_NO_DEPRECATED */ # define Tcl_SeekOld seekOld # define Tcl_TellOld tellOld +# define TclpLocaltime_unix TclpLocaltime +# define TclpGmtime_unix TclpGmtime static int seekOld( diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index 9a372b7..7ec6365 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -4,7 +4,7 @@ if {[catch {package require Tcl 8.6-} msg]} { puts stderr "ERROR: $msg" puts stderr "If running this script from 'make html', set the\ NATIVE_TCLSH environment\nvariable to point to an installed\ - tclsh8.6 (or the equivalent tclsh86.exe\non Windows)." + tclsh8.7 (or the equivalent tclsh87.exe\non Windows)." exit 1 } diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index d634449..6a73ac2 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -22,6 +22,7 @@ * variable is the key to this buffer. */ +#ifndef TCL_NO_DEPRECATED static Tcl_ThreadDataKey tmKey; typedef struct { struct tm gmtime_buf; @@ -45,6 +46,8 @@ static char *lastTZ = NULL; /* Holds the last setting of the TZ static void SetTZIfNecessary(void); static void CleanupMemory(ClientData clientData); +#endif /* TCL_NO_DEPRECATED */ + static void NativeScaleTime(Tcl_Time *timebuf, ClientData clientData); static void NativeGetTime(Tcl_Time *timebuf, @@ -263,6 +266,7 @@ Tcl_GetTime( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED struct tm * TclpGetDate( const time_t *time, @@ -352,6 +356,7 @@ TclpLocaltime( return &tsdPtr->localtime_buf; } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -486,6 +491,7 @@ NativeGetTime( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED static void SetTZIfNecessary(void) { @@ -531,6 +537,7 @@ CleanupMemory( { ckfree(lastTZ); } +#endif /* TCL_NO_DEPRECATED */ /* * Local Variables: diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 81d9458..18702e7 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -27,6 +27,7 @@ * month, where index 1 is January. */ +#ifndef TCL_NO_DEPRECATED static const int normalDays[] = { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 }; @@ -40,6 +41,7 @@ typedef struct { struct tm tm; /* time information */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; +#endif /* TCL_NO_DEPRECATED */ /* * Data for managing high-resolution timers. @@ -113,7 +115,9 @@ static TimeInfo timeInfo = { * Declarations for functions defined later in this file. */ +#ifndef TCL_NO_DEPRECATED static struct tm * ComputeGMT(const time_t *tp); +#endif /* TCL_NO_DEPRECATED */ static void StopCalibration(ClientData clientData); static DWORD WINAPI CalibrationThread(LPVOID arg); static void UpdateTimeEachSecond(void); @@ -522,6 +526,7 @@ StopCalibration( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED struct tm * TclpGetDate( const time_t *t, @@ -724,6 +729,7 @@ ComputeGMT( return tmPtr; } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -1068,6 +1074,7 @@ AccumulateSample( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED struct tm * TclpGmtime( const time_t *timePtr) /* Pointer to the number of seconds since the @@ -1112,6 +1119,7 @@ TclpLocaltime( return localtime(timePtr); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- -- cgit v0.12 From 904733362eb59a805100de75715e20a5214a98f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 6 Apr 2017 15:25:44 +0000 Subject: Some more (internal) stub entries which can be cleaned up with -DTCL_NO_DEPRECATED, because they are not used any more. --- generic/tclStubInit.c | 20 ++++++++++++++++++-- tools/tcltk-man2html.tcl | 2 +- unix/tclUnixThrd.c | 2 ++ win/tclWinSock.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 3f0a8ff..59325b7 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -41,15 +41,15 @@ #undef Tcl_FindExecutable #undef TclpGetPid #undef TclSockMinimumBuffers -#define TclBackgroundException Tcl_BackgroundException #undef Tcl_SetIntObj #undef TclpInetNtoa #undef TclWinGetServByName #undef TclWinGetSockOpt #undef TclWinSetSockOpt +#undef TclWinNToHS /* See bug 510001: TclSockMinimumBuffers needs plat imp */ -#ifdef _WIN64 +#if defined(_WIN64) || defined(TCL_NO_DEPRECATED) # define TclSockMinimumBuffersOld 0 #else #define TclSockMinimumBuffersOld sockMinimumBuffersOld @@ -59,6 +59,17 @@ static int TclSockMinimumBuffersOld(int sock, int size) } #endif +#if defined(TCL_NO_DEPRECATED) +# define TclSetStartupScriptPath 0 +# define TclGetStartupScriptPath 0 +# define TclSetStartupScriptFileName 0 +# define TclGetStartupScriptFileName 0 +# define TclpInetNtoa 0 +# define TclWinGetServByName 0 +# define TclWinGetSockOpt 0 +# define TclWinSetSockOpt 0 +# define TclWinNToHS 0 +#else #define TclSetStartupScriptPath setStartupScriptPath static void TclSetStartupScriptPath(Tcl_Obj *path) { @@ -92,6 +103,7 @@ static unsigned short TclWinNToHS(unsigned short ns) { return ntohs(ns); } #endif +#endif /* TCL_NO_DEPRECATED */ #ifdef _WIN32 # define TclUnixWaitForFile 0 @@ -343,6 +355,9 @@ static int formatInt(char *buffer, int n){ # define Tcl_EvalObj 0 # undef Tcl_GlobalEvalObj # define Tcl_GlobalEvalObj 0 +# define TclBackgroundException 0 +# undef TclpReaddir +# define TclpReaddir 0 # undef TclpGetDate # define TclpGetDate 0 # undef TclpLocaltime @@ -354,6 +369,7 @@ static int formatInt(char *buffer, int n){ #else /* TCL_NO_DEPRECATED */ # define Tcl_SeekOld seekOld # define Tcl_TellOld tellOld +# define TclBackgroundException Tcl_BackgroundException # define TclpLocaltime_unix TclpLocaltime # define TclpGmtime_unix TclpGmtime diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index 7ec6365..5d21866 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -22,7 +22,7 @@ if {[catch {package require Tcl 8.6-} msg]} { # Copyright (c) 1995-1997 Roger E. Critchlow Jr # Copyright (c) 2004-2010 Donal K. Fellows -set ::Version "50/8.6" +set ::Version "50/8.7" set ::CSSFILE "docs.css" ## diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 805599d..f475aed 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -644,6 +644,7 @@ TclpFinalizeCondition( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED Tcl_DirEntry * TclpReaddir( DIR * dir) @@ -666,6 +667,7 @@ TclpInetNtoa( return inet_ntoa(addr); #endif } +#endif /* TCL_NO_DEPRECATED */ #ifdef TCL_THREADS /* diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 5e0d7c8..81a5449 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -3239,6 +3239,7 @@ FindFDInList( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef TclWinGetSockOpt int TclWinGetSockOpt( @@ -3278,6 +3279,7 @@ TclWinGetServByName( { return getservbyname(name, proto); } +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- -- cgit v0.12 From ff4b11441b14dae3eb536004db30a89fa64e365a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 7 Apr 2017 15:11:47 +0000 Subject: Minor simplification in tcl.h: For the Tcl_WideAsLong/Tcl_LongAsWide/Tcl_WideAsDouble/Tcl_DoubleAsWide #defines, one set suffices: No need to have two versions depending on TCL_WIDE_INT_IS_LONG. --- generic/tcl.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 731724e..6ec47c6 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -419,10 +419,6 @@ typedef TCL_WIDE_INT_TYPE Tcl_WideInt; typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; #ifdef TCL_WIDE_INT_IS_LONG -# define Tcl_WideAsLong(val) ((long)(val)) -# define Tcl_LongAsWide(val) ((long)(val)) -# define Tcl_WideAsDouble(val) ((double)((long)(val))) -# define Tcl_DoubleAsWide(val) ((long)((double)(val))) # ifndef TCL_LL_MODIFIER # define TCL_LL_MODIFIER "l" # endif /* !TCL_LL_MODIFIER */ @@ -434,12 +430,13 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # ifndef TCL_LL_MODIFIER # define TCL_LL_MODIFIER "ll" # endif /* !TCL_LL_MODIFIER */ -# define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) -# define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) -# define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) -# define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) #endif /* TCL_WIDE_INT_IS_LONG */ +#define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) +#define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) +#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) +#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) + #if defined(_WIN32) # ifdef __BORLANDC__ typedef struct stati64 Tcl_StatBuf; -- cgit v0.12 From d00198bd14d66e196b9640683d02023b8a0b2dd7 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 9 Apr 2017 16:51:27 +0000 Subject: Minor style issues through the socket implementation code. --- generic/tclIOCmd.c | 40 ++-- generic/tclIOSock.c | 27 ++- unix/tclUnixSock.c | 276 ++++++++++++++----------- win/tclWinSock.c | 578 +++++++++++++++++++++++++++++++++------------------- 4 files changed, 573 insertions(+), 348 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 1bd3fe7..e52200d 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1618,19 +1618,34 @@ Tcl_SocketObjCmd( return TCL_ERROR; } - // Set the options to their default value if the user didn't override their - // value. - if (reusep == -1) reusep = 0; - if (reusea == -1) reusea = 1; + /* + * Set the options to their default value if the user didn't override + * their value. + */ - // Build the bitset with the flags values. - if (reusea) + if (reusep == -1) { + reusep = 0; + } + if (reusea == -1) { + reusea = 1; + } + + /* + * Build the bitset with the flags values. + */ + + if (reusea) { flags |= TCL_TCPSERVER_REUSEADDR; - if (reusep) + } + if (reusep) { flags |= TCL_TCPSERVER_REUSEPORT; + } + + /* + * All the arguments should have been parsed by now, 'a' points to the + * last one, the port number. + */ - // All the arguments should have been parsed by now, 'a' points to the last - // one, the port number. if (a != objc-1) { goto wrongNumArgs; } @@ -1638,15 +1653,14 @@ Tcl_SocketObjCmd( port = TclGetString(objv[a]); if (server) { - AcceptCallback *acceptCallbackPtr = - ckalloc(sizeof(AcceptCallback)); + AcceptCallback *acceptCallbackPtr = ckalloc(sizeof(AcceptCallback)); Tcl_IncrRefCount(script); acceptCallbackPtr->script = script; acceptCallbackPtr->interp = interp; - chan = Tcl_OpenTcpServerEx(interp, port, host, flags, AcceptCallbackProc, - acceptCallbackPtr); + chan = Tcl_OpenTcpServerEx(interp, port, host, flags, + AcceptCallbackProc, acceptCallbackPtr); if (chan == NULL) { Tcl_DecrRefCount(script); ckfree(acceptCallbackPtr); diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 8ad268a..82d2fc1 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -12,7 +12,9 @@ #include "tclInt.h" #if defined(_WIN32) && defined(UNICODE) -/* On Windows, we need to do proper Unicode->UTF-8 conversion. */ +/* + * On Windows, we need to do proper Unicode->UTF-8 conversion. + */ typedef struct ThreadSpecificData { int initialized; @@ -21,7 +23,10 @@ typedef struct ThreadSpecificData { static Tcl_ThreadDataKey dataKey; #undef gai_strerror -static const char *gai_strerror(int code) { +static const char * +gai_strerror( + int code) +{ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (tsdPtr->initialized) { @@ -126,7 +131,7 @@ TclSockMinimumBuffers( } len = sizeof(int); getsockopt((SOCKET)(size_t) sock, SOL_SOCKET, SO_RCVBUF, - (char *) ¤t, &len); + (char *) ¤t, &len); if (current < size) { len = sizeof(int); setsockopt((SOCKET)(size_t) sock, SOL_SOCKET, SO_RCVBUF, @@ -215,7 +220,7 @@ TclCreateSocketAddress( * We found some problems when using AI_ADDRCONFIG, e.g. on systems that * have no networking besides the loopback interface and want to resolve * localhost. See [Bugs 3385024, 3382419, 3382431]. As the advantage of - * using AI_ADDRCONFIG in situations where it works, is probably low, + * using AI_ADDRCONFIG is probably low even in situations where it works, * we'll leave it out for now. After all, it is just an optimisation. * * Missing on: OpenBSD, NetBSD. @@ -300,16 +305,20 @@ TclCreateSocketAddress( * *---------------------------------------------------------------------- */ -Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, - const char *host, Tcl_TcpAcceptProc *acceptProc, - ClientData callbackData) + +Tcl_Channel +Tcl_OpenTcpServer( + Tcl_Interp *interp, + int port, + const char *host, + Tcl_TcpAcceptProc *acceptProc, + ClientData callbackData) { char portbuf[TCL_INTEGER_SPACE]; TclFormatInt(portbuf, port); - return Tcl_OpenTcpServerEx(interp, portbuf, host, TCL_TCPSERVER_REUSEADDR, - acceptProc, callbackData); + acceptProc, callbackData); } /* diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 9387d05..a64157e 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -117,8 +117,7 @@ struct TcpState { * Static routines for this file: */ -static int TcpConnect(Tcl_Interp *interp, - TcpState *state); +static int TcpConnect(Tcl_Interp *interp, TcpState *state); static void TcpAccept(ClientData data, int mask); static int TcpBlockModeProc(ClientData data, int mode); static int TcpCloseProc(ClientData instanceData, @@ -173,21 +172,24 @@ static ProcessGlobalValue hostName = #if 0 /* printf debugging */ -void printaddrinfo(struct addrinfo *addrlist, char *prefix) +void +printaddrinfo( + struct addrinfo *addrlist, + char *prefix) { char host[NI_MAXHOST], port[NI_MAXSERV]; struct addrinfo *ai; + for (ai = addrlist; ai != NULL; ai = ai->ai_next) { getnameinfo(ai->ai_addr, ai->ai_addrlen, - host, sizeof(host), - port, sizeof(port), - NI_NUMERICHOST|NI_NUMERICSERV); + host, sizeof(host), port, sizeof(port), + NI_NUMERICHOST|NI_NUMERICSERV); fprintf(stderr,"%s: %s:%s\n", prefix, host, port); } } #endif /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * InitializeHostName -- * @@ -197,7 +199,7 @@ void printaddrinfo(struct addrinfo *addrlist, char *prefix) * Results: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ static void @@ -276,7 +278,7 @@ InitializeHostName( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * Tcl_GetHostName -- * @@ -290,7 +292,7 @@ InitializeHostName( * Side effects: * Caches the name to return for future calls. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ const char * @@ -300,7 +302,7 @@ Tcl_GetHostName(void) } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TclpHasSockets -- * @@ -312,7 +314,7 @@ Tcl_GetHostName(void) * Side effects: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ int @@ -323,7 +325,7 @@ TclpHasSockets( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TclpFinalizeSockets -- * @@ -335,7 +337,7 @@ TclpHasSockets( * Side effects: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ void @@ -345,7 +347,7 @@ TclpFinalizeSockets(void) } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpBlockModeProc -- * @@ -358,7 +360,7 @@ TclpFinalizeSockets(void) * Side effects: * Sets the device into blocking or nonblocking mode. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ /* ARGSUSED */ @@ -387,33 +389,32 @@ TcpBlockModeProc( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * WaitForConnect -- * - * Check the state of an async connect process. If a connection - * attempt terminated, process it, which may finalize it or may - * start the next attempt. If a connect error occures, it is saved - * in statePtr->connectError to be reported by 'fconfigure -error'. + * Check the state of an async connect process. If a connection attempt + * terminated, process it, which may finalize it or may start the next + * attempt. If a connect error occures, it is saved in + * statePtr->connectError to be reported by 'fconfigure -error'. * * There are two modes of operation, defined by errorCodePtr: - * * non-NULL: Called by explicite read/write command. block if + * * non-NULL: Called by explicite read/write command. Blocks if the * socket is blocking. * May return two error codes: * * EWOULDBLOCK: if connect is still in progress - * * ENOTCONN: if connect failed. This would be the error - * message of a rect or sendto syscall so this is - * emulated here. - * * NULL: Called by a backround operation. Do not block and - * don't return any error code. + * * ENOTCONN: if connect failed. This would be the error message + * of a rect or sendto syscall so this is emulated here. + * * NULL: Called by a backround operation. Do not block and do not + * return any error code. * * Results: - * 0 if the connection has completed, -1 if still in progress - * or there is an error. + * 0 if the connection has completed, -1 if still in progress or there is + * an error. * * Side effects: - * Processes socket events off the system queue. - * May process asynchroneous connect. + * Processes socket events off the system queue. May process + * asynchroneous connects. * *---------------------------------------------------------------------- */ @@ -426,8 +427,8 @@ WaitForConnect( int timeout; /* - * Check if an async connect failed already and error reporting is demanded, - * return the error ENOTCONN + * Check if an async connect failed already and error reporting is + * demanded, return the error ENOTCONN */ if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) { @@ -450,11 +451,14 @@ WaitForConnect( } do { if (TclUnixWaitForFile(statePtr->fds.fd, - TCL_WRITABLE | TCL_EXCEPTION, timeout) != 0) { + TCL_WRITABLE | TCL_EXCEPTION, timeout) != 0) { TcpConnect(NULL, statePtr); } - /* Do this only once in the nonblocking case and repeat it until the - * socket is final when blocking */ + + /* + * Do this only once in the nonblocking case and repeat it until the + * socket is final when blocking. + */ } while (timeout == -1 && statePtr->flags & TCP_ASYNC_CONNECT); if (errorCodePtr != NULL) { @@ -615,6 +619,7 @@ TcpCloseProc( fds = statePtr->fds.next; while (fds != NULL) { TcpFdList *next = fds->next; + ckfree(fds); fds = next; } @@ -685,10 +690,9 @@ TcpClose2Proc( * * TcpHostPortList -- * - * This function is called by the -gethostname and -getpeername - * switches of TcpGetOptionProc() to add three list elements - * with the textual representation of the given address to the - * given DString. + * This function is called by the -gethostname and -getpeername switches + * of TcpGetOptionProc() to add three list elements with the textual + * representation of the given address to the given DString. * * Results: * None. @@ -709,22 +713,22 @@ TcpHostPortList( char host[NI_MAXHOST], nhost[NI_MAXHOST], nport[NI_MAXSERV]; int flags = 0; - getnameinfo(&addr.sa, salen, - nhost, sizeof(nhost), nport, sizeof(nport), - NI_NUMERICHOST | NI_NUMERICSERV); + getnameinfo(&addr.sa, salen, nhost, sizeof(nhost), nport, sizeof(nport), + NI_NUMERICHOST | NI_NUMERICSERV); Tcl_DStringAppendElement(dsPtr, nhost); + /* - * We don't want to resolve INADDR_ANY and sin6addr_any; they - * can sometimes cause problems (and never have a name). + * We don't want to resolve INADDR_ANY and sin6addr_any; they can + * sometimes cause problems (and never have a name). */ + if (addr.sa.sa_family == AF_INET) { if (addr.sa4.sin_addr.s_addr == INADDR_ANY) { flags |= NI_NUMERICHOST; } #ifndef NEED_FAKE_RFC2553 } else if (addr.sa.sa_family == AF_INET6) { - if ((IN6_ARE_ADDR_EQUAL(&addr.sa6.sin6_addr, - &in6addr_any)) + if ((IN6_ARE_ADDR_EQUAL(&addr.sa6.sin6_addr, &in6addr_any)) || (IN6_IS_ADDR_V4MAPPED(&addr.sa6.sin6_addr) && addr.sa6.sin6_addr.s6_addr[12] == 0 && addr.sa6.sin6_addr.s6_addr[13] == 0 && @@ -734,15 +738,27 @@ TcpHostPortList( } #endif /* NEED_FAKE_RFC2553 */ } - /* Check if reverse DNS has been switched off globally */ - if (interp != NULL && Tcl_GetVar2(interp, SUPPRESS_RDNS_VAR, NULL, 0) != NULL) { + + /* + * Check if reverse DNS has been switched off globally. + */ + + if (interp != NULL && + Tcl_GetVar2(interp, SUPPRESS_RDNS_VAR, NULL, 0) != NULL) { flags |= NI_NUMERICHOST; } - if (getnameinfo(&addr.sa, salen, host, sizeof(host), NULL, 0, flags) == 0) { - /* Reverse mapping worked */ + if (getnameinfo(&addr.sa, salen, host, sizeof(host), NULL, 0, + flags) == 0) { + /* + * Reverse mapping worked. + */ + Tcl_DStringAppendElement(dsPtr, host); } else { - /* Reverse mappong failed - use the numeric rep once more */ + /* + * Reverse mapping failed - use the numeric rep once more. + */ + Tcl_DStringAppendElement(dsPtr, nhost); } Tcl_DStringAppendElement(dsPtr, nport); @@ -793,15 +809,19 @@ TcpGetOptionProc( socklen_t optlen = sizeof(int); if (statePtr->flags & TCP_ASYNC_CONNECT) { - /* Suppress errors as long as we are not done */ + /* + * Suppress errors as long as we are not done. + */ + errno = 0; } else if (statePtr->connectError != 0) { errno = statePtr->connectError; statePtr->connectError = 0; } else { int err; - getsockopt(statePtr->fds.fd, SOL_SOCKET, SO_ERROR, - (char *) &err, &optlen); + + getsockopt(statePtr->fds.fd, SOL_SOCKET, SO_ERROR, (char *) &err, + &optlen); errno = err; } if (errno != 0) { @@ -814,7 +834,7 @@ TcpGetOptionProc( (strncmp(optionName, "-connecting", len) == 0)) { Tcl_DStringAppend(dsPtr, - (statePtr->flags & TCP_ASYNC_CONNECT) ? "1" : "0", -1); + (statePtr->flags & TCP_ASYNC_CONNECT) ? "1" : "0", -1); return TCL_OK; } @@ -823,10 +843,11 @@ TcpGetOptionProc( address peername; socklen_t size = sizeof(peername); - if ( (statePtr->flags & TCP_ASYNC_CONNECT) ) { + if (statePtr->flags & TCP_ASYNC_CONNECT) { /* * In async connect output an empty string */ + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-peername"); Tcl_DStringAppendElement(dsPtr, ""); @@ -837,6 +858,7 @@ TcpGetOptionProc( /* * Peername fetch succeeded - output list */ + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-peername"); Tcl_DStringStartSublist(dsPtr); @@ -876,11 +898,12 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } - if ( (statePtr->flags & TCP_ASYNC_CONNECT) ) { + if (statePtr->flags & TCP_ASYNC_CONNECT) { /* * In async connect output an empty string */ - found = 1; + + found = 1; } else { for (fds = &statePtr->fds; fds != NULL; fds = fds->next) { size = sizeof(sockname); @@ -905,14 +928,15 @@ TcpGetOptionProc( } if (len > 0) { - return Tcl_BadChannelOption(interp, optionName, "connecting peername sockname"); + return Tcl_BadChannelOption(interp, optionName, + "connecting peername sockname"); } return TCL_OK; } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpWatchProc -- * @@ -925,7 +949,7 @@ TcpGetOptionProc( * Sets up the notifier so that a future event on the channel will be * seen by Tcl. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ static void @@ -938,17 +962,17 @@ WrapNotify( if (newmask == 0) { /* - * There was no overlap between the states the channel is - * interested in notifications for, and the states that are - * reported present on the file descriptor by select(). The - * only way that can happen is when the channel is interested - * in a writable condition, and only a readable state is reported - * present (see TcpWatchProc() below). In that case, signal back - * to the caller the writable state, which is really an error - * condition. As an extra check on that assumption, check for - * a non-zero value of errno before reporting an artificial + * There was no overlap between the states the channel is interested + * in notifications for, and the states that are reported present on + * the file descriptor by select(). The only way that can happen is + * when the channel is interested in a writable condition, and only a + * readable state is reported present (see TcpWatchProc() below). In + * that case, signal back to the caller the writable state, which is + * really an error condition. As an extra check on that assumption, + * check for a non-zero value of errno before reporting an artificial * writable state. */ + if (errno == 0) { return; } @@ -972,33 +996,36 @@ TcpWatchProc( * be readable or writable at the Tcl level. This keeps Tcl scripts * from interfering with the -accept behavior (bug #3394732). */ + return; } if (statePtr->flags & TCP_ASYNC_PENDING) { - /* Async sockets use a FileHandler internally while connecting, so we - * need to cache this request until the connection has succeeded. */ + /* + * Async sockets use a FileHandler internally while connecting, so we + * need to cache this request until the connection has succeeded. + */ + statePtr->filehandlers = mask; } else if (mask) { /* - * Whether it is a bug or feature or otherwise, it is a fact - * of life that on at least some Linux kernels select() fails - * to report that a socket file descriptor is writable when - * the other end of the socket is closed. This is in contrast - * to the guarantees Tcl makes that its channels become - * writable and fire writable events on an error conditon. - * This has caused a leak of file descriptors in a state of + * Whether it is a bug or feature or otherwise, it is a fact of life + * that on at least some Linux kernels select() fails to report that a + * socket file descriptor is writable when the other end of the socket + * is closed. This is in contrast to the guarantees Tcl makes that + * its channels become writable and fire writable events on an error + * conditon. This has caused a leak of file descriptors in a state of * background flushing. See Tcl ticket 1758a0b603. * - * As a workaround, when our caller indicates an interest in - * writable notifications, we must tell the notifier built - * around select() that we are interested in the readable state - * of the file descriptor as well, as that is the only reliable - * means to get notified of error conditions. Then it is the - * task of WrapNotify() above to untangle the meaning of these - * channel states and report the chan events as best it can. - * We save a copy of the mask passed in to assist with that. + * As a workaround, when our caller indicates an interest in writable + * notifications, we must tell the notifier built around select() that + * we are interested in the readable state of the file descriptor as + * well, as that is the only reliable means to get notified of error + * conditions. Then it is the task of WrapNotify() above to untangle + * the meaning of these channel states and report the chan events as + * best it can. We save a copy of the mask passed in to assist with + * that. */ statePtr->interest = mask; @@ -1010,7 +1037,7 @@ TcpWatchProc( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpGetHandleProc -- * @@ -1024,7 +1051,7 @@ TcpWatchProc( * Side effects: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ /* ARGSUSED */ @@ -1041,16 +1068,17 @@ TcpGetHandleProc( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpAsyncCallback -- * - * Called by the event handler that TcpConnect sets up - * internally for [socket -async] to get notified when the - * asyncronous connection attempt has succeeded or failed. + * Called by the event handler that TcpConnect sets up internally for + * [socket -async] to get notified when the asyncronous connection + * attempt has succeeded or failed. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ + static void TcpAsyncCallback( ClientData clientData, /* The socket state. */ @@ -1062,7 +1090,7 @@ TcpAsyncCallback( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpConnect -- * @@ -1088,7 +1116,7 @@ TcpAsyncCallback( * return and the loops resume as if they had never been interrupted. * For syncronously connecting sockets, the loops work the usual way. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ static int @@ -1108,7 +1136,8 @@ TcpConnect( for (statePtr->addr = statePtr->addrlist; statePtr->addr != NULL; statePtr->addr = statePtr->addr->ai_next) { - for (statePtr->myaddr = statePtr->myaddrlist; statePtr->myaddr != NULL; + for (statePtr->myaddr = statePtr->myaddrlist; + statePtr->myaddr != NULL; statePtr->myaddr = statePtr->myaddr->ai_next) { int reuseaddr = 1; @@ -1132,7 +1161,8 @@ TcpConnect( errno = 0; } - statePtr->fds.fd = socket(statePtr->addr->ai_family, SOCK_STREAM, 0); + statePtr->fds.fd = socket(statePtr->addr->ai_family, SOCK_STREAM, + 0); if (statePtr->fds.fd < 0) { continue; } @@ -1151,14 +1181,18 @@ TcpConnect( TclSockMinimumBuffers(INT2PTR(statePtr->fds.fd), SOCKET_BUFSIZE); if (async) { - ret = TclUnixSetBlockingMode(statePtr->fds.fd,TCL_MODE_NONBLOCKING); + ret = TclUnixSetBlockingMode(statePtr->fds.fd, + TCL_MODE_NONBLOCKING); if (ret < 0) { continue; } } - /* Gotta reset the error variable here, before we use it for the - * first time in this iteration. */ + /* + * Must reset the error variable here, before we use it for the + * first time in this iteration. + */ + error = 0; (void) setsockopt(statePtr->fds.fd, SOL_SOCKET, SO_REUSEADDR, @@ -1179,10 +1213,13 @@ TcpConnect( ret = connect(statePtr->fds.fd, statePtr->addr->ai_addr, statePtr->addr->ai_addrlen); - if (ret < 0) error = errno; + if (ret < 0) { + error = errno; + } if (ret < 0 && errno == EINPROGRESS) { Tcl_CreateFileHandler(statePtr->fds.fd, - TCL_WRITABLE|TCL_EXCEPTION, TcpAsyncCallback, statePtr); + TCL_WRITABLE | TCL_EXCEPTION, TcpAsyncCallback, + statePtr); errno = EWOULDBLOCK; SET_BITS(statePtr->flags, TCP_ASYNC_PENDING); return TCL_OK; @@ -1210,7 +1247,7 @@ TcpConnect( } } -out: + out: statePtr->connectError = error; CLEAR_BITS(statePtr->flags, TCP_ASYNC_CONNECT); if (async_callback) { @@ -1308,6 +1345,7 @@ Tcl_OpenTcpClient( /* * Allocate a new TcpState for this socket. */ + statePtr = ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->flags = async ? TCP_ASYNC_CONNECT : 0; @@ -1319,6 +1357,7 @@ Tcl_OpenTcpClient( /* * Create a new client socket and wrap it in a channel. */ + if (TcpConnect(interp, statePtr) != TCL_OK) { TcpCloseProc(statePtr, NULL); return NULL; @@ -1326,8 +1365,8 @@ Tcl_OpenTcpClient( sprintf(channelName, SOCK_TEMPLATE, (long) statePtr); - statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, statePtr, - (TCL_READABLE | TCL_WRITABLE)); + statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, + statePtr, TCL_READABLE | TCL_WRITABLE); if (Tcl_SetChannelOption(interp, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close(NULL, statePtr->channel); @@ -1356,7 +1395,8 @@ Tcl_Channel Tcl_MakeTcpClientChannel( ClientData sock) /* The socket to wrap up into a channel. */ { - return (Tcl_Channel) TclpMakeTcpClientChannelMode(sock, (TCL_READABLE | TCL_WRITABLE)); + return (Tcl_Channel) TclpMakeTcpClientChannelMode(sock, + TCL_READABLE | TCL_WRITABLE); } /* @@ -1456,6 +1496,7 @@ Tcl_OpenTcpServerEx( * families. We try this at most MAXRETRY times to avoid an endless loop * if all ports are taken. */ + int retry = 0; #define MAXRETRY 10 @@ -1481,7 +1522,8 @@ Tcl_OpenTcpServerEx( goto error; } - if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) { + if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, + &errorMsg)) { my_errno = errno; goto error; } @@ -1517,21 +1559,22 @@ Tcl_OpenTcpServerEx( if (flags & TCL_TCPSERVER_REUSEADDR) { optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *) &optvalue, sizeof(optvalue)); + (char *) &optvalue, sizeof(optvalue)); } if (flags & TCL_TCPSERVER_REUSEPORT) { #ifndef SO_REUSEPORT /* - * If the platform doesn't support the SO_REUSEPORT flag we can't do - * much beside erroring out. + * If the platform doesn't support the SO_REUSEPORT flag we can't + * do much beside erroring out. */ + errorMsg = "SO_REUSEPORT isn't supported by this platform"; goto error; #else optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, - (char *) &optvalue, sizeof(optvalue)); + (char *) &optvalue, sizeof(optvalue)); #endif } @@ -1549,7 +1592,10 @@ Tcl_OpenTcpServerEx( } #ifdef IPV6_V6ONLY - /* Missing on: Solaris 2.8 */ + /* + * Missing on: Solaris 2.8 + */ + if (addrPtr->ai_family == AF_INET6) { int v6only = 1; @@ -1701,7 +1747,7 @@ TcpAccept( sprintf(channelName, SOCK_TEMPLATE, (long) newSockState); newSockState->channel = Tcl_CreateChannel(&tcpChannelType, channelName, - newSockState, (TCL_READABLE | TCL_WRITABLE)); + newSockState, TCL_READABLE | TCL_WRITABLE); Tcl_SetChannelOption(NULL, newSockState->channel, "-translation", "auto crlf"); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 81a5449..d6aca1b 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -297,17 +297,25 @@ static ProcessGlobalValue hostName = * Address print debug functions */ #if 0 -void printaddrinfo(struct addrinfo *ai, char *prefix) +void +printaddrinfo( + struct addrinfo *ai, + char *prefix) { char host[NI_MAXHOST], port[NI_MAXSERV]; + getnameinfo(ai->ai_addr, ai->ai_addrlen, - host, sizeof(host), - port, sizeof(port), - NI_NUMERICHOST|NI_NUMERICSERV); + host, sizeof(host), port, sizeof(port), + NI_NUMERICHOST|NI_NUMERICSERV); } -void printaddrinfolist(struct addrinfo *addrlist, char *prefix) + +void +printaddrinfolist( + struct addrinfo *addrlist, + char *prefix) { struct addrinfo *ai; + for (ai = addrlist; ai != NULL; ai = ai->ai_next) { printaddrinfo(ai, prefix); } @@ -524,9 +532,9 @@ TcpBlockModeProc( TcpState *statePtr = instanceData; if (mode == TCL_MODE_NONBLOCKING) { - statePtr->flags |= TCP_NONBLOCKING; + SET_BITS(statePtr->flags, TCP_NONBLOCKING); } else { - statePtr->flags &= ~(TCP_NONBLOCKING); + CLEAR_BITS(statePtr->flags, TCP_NONBLOCKING); } return 0; } @@ -536,29 +544,28 @@ TcpBlockModeProc( * * WaitForConnect -- * - * Check the state of an async connect process. If a connection - * attempt terminated, process it, which may finalize it or may - * start the next attempt. If a connect error occures, it is saved - * in statePtr->connectError to be reported by 'fconfigure -error'. + * Check the state of an async connect process. If a connection attempt + * terminated, process it, which may finalize it or may start the next + * attempt. If a connect error occures, it is saved in + * statePtr->connectError to be reported by 'fconfigure -error'. * * There are two modes of operation, defined by errorCodePtr: - * * non-NULL: Called by explicite read/write command. block if - * socket is blocking. + * * non-NULL: Called by explicite read/write command. Block if socket + * is blocking. * May return two error codes: * * EWOULDBLOCK: if connect is still in progress - * * ENOTCONN: if connect failed. This would be the error - * message of a rect or sendto syscall so this is - * emulated here. - * * Null: Called by a backround operation. Do not block and - * don't return any error code. + * * ENOTCONN: if connect failed. This would be the error message + * of a rect or sendto syscall so this is emulated here. + * * Null: Called by a backround operation. Do not block and don't + * return any error code. * * Results: - * 0 if the connection has completed, -1 if still in progress - * or there is an error. + * 0 if the connection has completed, -1 if still in progress or there is + * an error. * * Side effects: - * Processes socket events off the system queue. - * May process asynchroneous connect. + * Processes socket events off the system queue. May process + * asynchroneous connect. * *---------------------------------------------------------------------- */ @@ -566,17 +573,16 @@ TcpBlockModeProc( static int WaitForConnect( TcpState *statePtr, /* State of the socket. */ - int *errorCodePtr) /* Where to store errors? - * A passed null-pointer activates background mode. - */ + int *errorCodePtr) /* Where to store errors? A passed + * null-pointer activates background mode. */ { int result; int oldMode; ThreadSpecificData *tsdPtr; /* - * Check if an async connect failed already and error reporting is demanded, - * return the error ENOTCONN + * Check if an async connect failed already and error reporting is + * demanded, return the error ENOTCONN. */ if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) { @@ -603,36 +609,51 @@ WaitForConnect( */ while (1) { + /* + * Get the statePtr lock. + */ - /* get statePtr lock */ tsdPtr = TclThreadDataKeyGet(&dataKey); WaitForSingleObject(tsdPtr->socketListLock, INFINITE); - /* Check for connect event */ + /* + * Check for connect event. + */ + if (statePtr->readyEvents & FD_CONNECT) { + /* + * Consume the connect event. + */ - /* Consume the connect event */ - statePtr->readyEvents &= ~(FD_CONNECT); + CLEAR_BITS(statePtr->readyEvents, FD_CONNECT); /* - * For blocking sockets and foreground processing - * disable async connect as we continue now synchoneously + * For blocking sockets and foreground processing, disable async + * connect as we continue now synchoneously. */ - if ( errorCodePtr != NULL && - ! (statePtr->flags & TCP_NONBLOCKING) ) { + + if (errorCodePtr != NULL && + !(statePtr->flags & TCP_NONBLOCKING)) { CLEAR_BITS(statePtr->flags, TCP_ASYNC_CONNECT); } - /* Free list lock */ + /* + * Free list lock. + */ + SetEvent(tsdPtr->socketListLock); /* - * Continue connect. - * If switched to synchroneous connect, the connect is terminated. + * Continue connect. If switched to synchroneous connect, the + * connect is terminated. */ + result = TcpConnect(NULL, statePtr); - /* Restore event service mode */ + /* + * Restore event service mode. + */ + (void) Tcl_SetServiceMode(oldMode); /* @@ -641,10 +662,11 @@ WaitForConnect( if (result == TCL_OK) { /* - * Check for async connect restart - * (not possible for foreground blocking operation) + * Check for async connect restart (not possible for + * foreground blocking operation) */ - if ( statePtr->flags & TCP_ASYNC_PENDING ) { + + if (statePtr->flags & TCP_ASYNC_PENDING) { if (errorCodePtr != NULL) { *errorCodePtr = EWOULDBLOCK; } @@ -654,8 +676,8 @@ WaitForConnect( } /* - * Connect finally failed. - * For foreground operation return ENOTCONN. + * Connect finally failed. For foreground operation return + * ENOTCONN. */ if (errorCodePtr != NULL) { @@ -664,7 +686,10 @@ WaitForConnect( return -1; } - /* Free list lock */ + /* + * Free list lock. + */ + SetEvent(tsdPtr->socketListLock); /* @@ -672,13 +697,13 @@ WaitForConnect( * event */ - if ( errorCodePtr == NULL ) { + if (errorCodePtr == NULL) { return -1; } /* - * A non blocking socket waiting for an asyncronous connect - * returns directly the error EWOULDBLOCK + * A non blocking socket waiting for an asyncronous connect returns + * directly the error EWOULDBLOCK. */ if (statePtr->flags & TCP_NONBLOCKING) { @@ -770,16 +795,20 @@ TcpInputProc( while (1) { SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) UNSELECT, (LPARAM) statePtr); - /* single fd operation: this proc is only called for a connected socket. */ + /* + * Single fd operation: this proc is only called for a connected + * socket. + */ + bytesRead = recv(statePtr->sockets->fd, buf, bufSize, 0); - statePtr->readyEvents &= ~(FD_READ); + CLEAR_BITS(statePtr->readyEvents, FD_READ); /* * Check for end-of-file condition or successful read. */ if (bytesRead == 0) { - statePtr->flags |= SOCKET_EOF; + SET_BITS(statePtr->flags, SOCKET_EOF); } if (bytesRead != SOCKET_ERROR) { break; @@ -791,7 +820,7 @@ TcpInputProc( */ if (statePtr->readyEvents & FD_CLOSE) { - statePtr->flags |= SOCKET_EOF; + SET_BITS(statePtr->flags, SOCKET_EOF); bytesRead = 0; break; } @@ -804,7 +833,7 @@ TcpInputProc( */ if (error == WSAECONNRESET) { - statePtr->flags |= SOCKET_EOF; + SET_BITS(statePtr->flags, SOCKET_EOF); bytesRead = 0; break; } @@ -892,7 +921,11 @@ TcpOutputProc( SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) UNSELECT, (LPARAM) statePtr); - /* single fd operation: this proc is only called for a connected socket. */ + /* + * Single fd operation: this proc is only called for a connected + * socket. + */ + written = send(statePtr->sockets->fd, buf, toWrite, 0); if (written != SOCKET_ERROR) { /* @@ -917,7 +950,7 @@ TcpOutputProc( error = WSAGetLastError(); if (error == WSAEWOULDBLOCK) { - statePtr->readyEvents &= ~(FD_WRITE); + CLEAR_BITS(statePtr->readyEvents, FD_WRITE); if (statePtr->flags & TCP_NONBLOCKING) { *errorCodePtr = EWOULDBLOCK; written = -1; @@ -941,7 +974,8 @@ TcpOutputProc( } } - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, (LPARAM)statePtr); + SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, + (LPARAM)statePtr); return written; } @@ -988,10 +1022,10 @@ TcpCloseProc( * background. */ - while ( statePtr->sockets != NULL ) { + while (statePtr->sockets != NULL) { TcpFdList *thisfd = statePtr->sockets; - statePtr->sockets = thisfd->next; + statePtr->sockets = thisfd->next; if (closesocket(thisfd->fd) == SOCKET_ERROR) { TclWinConvertError((DWORD) WSAGetLastError()); errorCode = Tcl_GetErrno(); @@ -1009,18 +1043,25 @@ TcpCloseProc( /* * Clear an eventual tsd info list pointer. + * * This may be called, if an async socket connect fails or is closed * between connect and thread action callback. */ + if (tsdPtr->pendingTcpState != NULL && tsdPtr->pendingTcpState == statePtr) { + /* + * Get infoPtr lock, because this concerns the notifier thread. + */ - /* get infoPtr lock, because this concerns the notifier thread */ WaitForSingleObject(tsdPtr->socketListLock, INFINITE); tsdPtr->pendingTcpState = NULL; - /* Free list lock */ + /* + * Free list lock. + */ + SetEvent(tsdPtr->socketListLock); } @@ -1081,8 +1122,11 @@ TcpClose2Proc( return TCL_ERROR; } - /* single fd operation: Tcl_OpenTcpServer() does not set TCL_READABLE or - * TCL_WRITABLE so this should never be called for a server socket. */ + /* + * Single fd operation: Tcl_OpenTcpServer() does not set TCL_READABLE or + * TCL_WRITABLE so this should never be called for a server socket. + */ + if (shutdown(statePtr->sockets->fd, sd) == SOCKET_ERROR) { TclWinConvertError((DWORD) WSAGetLastError()); errorCode = Tcl_GetErrno(); @@ -1134,7 +1178,7 @@ TcpSetOptionProc( } #ifdef TCL_FEATURE_KEEPALIVE_NAGLE - #error "TCL_FEATURE_KEEPALIVE_NAGLE not reviewed for whether to treat statePtr->sockets as single fd or list" +#error "TCL_FEATURE_KEEPALIVE_NAGLE not reviewed for whether to treat statePtr->sockets as single fd or list" sock = statePtr->sockets->fd; if (!strcasecmp(optionName, "-keepalive")) { @@ -1243,8 +1287,11 @@ TcpGetOptionProc( /* * Go one step in async connect - * If any error is thrown save it as backround error to report eventually below + * + * If any error is thrown save it as backround error to report eventually + * below. */ + WaitForConnect(statePtr, NULL); sock = statePtr->sockets->fd; @@ -1254,31 +1301,26 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'e') && (strncmp(optionName, "-error", len) == 0)) { - /* - * Do not return any errors if async connect is running - */ - if ( ! (statePtr->flags & TCP_ASYNC_PENDING) ) { - - - if ( statePtr->flags & TCP_ASYNC_FAILED ) { + * Do not return any errors if async connect is running. + */ + if (!(statePtr->flags & TCP_ASYNC_PENDING)) { + if (statePtr->flags & TCP_ASYNC_FAILED) { /* * In case of a failed async connect, eventually report the - * connect error only once. - * Do not report the system error, as this comes again and again. + * connect error only once. Do not report the system error, + * as this comes again and again. */ - if ( statePtr->connectError != 0 ) { + if (statePtr->connectError != 0) { Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(statePtr->connectError), -1); statePtr->connectError = 0; } - } else { - /* - * Report an eventual last error of the socket system + * Report an eventual last error of the socket system. */ int optlen; @@ -1286,24 +1328,30 @@ TcpGetOptionProc( DWORD err; /* - * Populater the err Variable with a possix error + * Populate the err variable with a POSIX error */ + optlen = sizeof(int); ret = getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *)&err, &optlen); + /* - * The error was not returned directly but should be - * taken from WSA + * The error was not returned directly but should be taken + * from WSA. */ + if (ret == SOCKET_ERROR) { err = WSAGetLastError(); } + /* - * Return error message + * Return error message. */ + if (err) { TclWinConvertError(err); - Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1); + Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), + -1); } } } @@ -1312,14 +1360,14 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'c') && (strncmp(optionName, "-connecting", len) == 0)) { - Tcl_DStringAppend(dsPtr, (statePtr->flags & TCP_ASYNC_PENDING) ? "1" : "0", -1); return TCL_OK; } - if (interp != NULL && Tcl_GetVar2(interp, SUPPRESS_RDNS_VAR, NULL, 0) != NULL) { + if (interp != NULL + && Tcl_GetVar2(interp, SUPPRESS_RDNS_VAR, NULL, 0) != NULL) { reverseDNS = NI_NUMERICHOST; } @@ -1328,20 +1376,23 @@ TcpGetOptionProc( address peername; socklen_t size = sizeof(peername); - if ( (statePtr->flags & TCP_ASYNC_PENDING) ) { + if (statePtr->flags & TCP_ASYNC_PENDING) { /* * In async connect output an empty string */ + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-peername"); Tcl_DStringAppendElement(dsPtr, ""); } else { return TCL_OK; } - } else if ( getpeername(sock, (LPSOCKADDR) &(peername.sa), &size) == 0) { + } else if (getpeername(sock, (LPSOCKADDR) &(peername.sa), + &size) == 0) { /* * Peername fetch succeeded - output list */ + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-peername"); Tcl_DStringStartSublist(dsPtr); @@ -1390,11 +1441,12 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } - if ( (statePtr->flags & TCP_ASYNC_PENDING ) ) { + if (statePtr->flags & TCP_ASYNC_PENDING) { /* * In async connect output an empty string */ - found = 1; + + found = 1; } else { for (fds = statePtr->sockets; fds != NULL; fds = fds->next) { sock = fds->fd; @@ -1408,9 +1460,11 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, host); /* - * We don't want to resolve INADDR_ANY and sin6addr_any; they - * can sometimes cause problems (and never have a name). + * We don't want to resolve INADDR_ANY and sin6addr_any; + * they can sometimes cause problems (and never have a + * name). */ + flags |= NI_NUMERICSERV; if (sockname.sa.sa_family == AF_INET) { if (sockname.sa4.sin_addr.s_addr == INADDR_ANY) { @@ -1494,7 +1548,8 @@ TcpGetOptionProc( return Tcl_BadChannelOption(interp, optionName, "connecting peername sockname keepalive nagle"); #else - return Tcl_BadChannelOption(interp, optionName, "connecting peername sockname"); + return Tcl_BadChannelOption(interp, optionName, + "connecting peername sockname"); #endif /*TCL_FEATURE_KEEPALIVE_NAGLE*/ } @@ -1536,10 +1591,10 @@ TcpWatchProc( if (!statePtr->acceptProc) { statePtr->watchEvents = 0; if (mask & TCL_READABLE) { - statePtr->watchEvents |= (FD_READ|FD_CLOSE); + SET_BITS(statePtr->watchEvents, FD_READ | FD_CLOSE); } if (mask & TCL_WRITABLE) { - statePtr->watchEvents |= (FD_WRITE|FD_CLOSE); + SET_BITS(statePtr->watchEvents, FD_WRITE | FD_CLOSE); } /* @@ -1630,13 +1685,13 @@ TcpConnect( TcpState *statePtr) { DWORD error; - /* - * We are started with async connect and the connect notification - * was not jet received - */ int async_connect = statePtr->flags & TCP_ASYNC_CONNECT; - /* We were called by the event procedure and continue our loop */ + /* We are started with async connect and the + * connect notification was not yet + * received. */ int async_callback = statePtr->flags & TCP_ASYNC_PENDING; + /* We were called by the event procedure and + * continue our loop. */ ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); if (async_callback) { @@ -1644,11 +1699,10 @@ TcpConnect( } for (statePtr->addr = statePtr->addrlist; statePtr->addr != NULL; - statePtr->addr = statePtr->addr->ai_next) { - - for (statePtr->myaddr = statePtr->myaddrlist; statePtr->myaddr != NULL; - statePtr->myaddr = statePtr->myaddr->ai_next) { - + statePtr->addr = statePtr->addr->ai_next) { + for (statePtr->myaddr = statePtr->myaddrlist; + statePtr->myaddr != NULL; + statePtr->myaddr = statePtr->myaddr->ai_next) { /* * No need to try combinations of local and remote addresses * of different families. @@ -1662,25 +1716,37 @@ TcpConnect( * Close the socket if it is still open from the last unsuccessful * iteration. */ + if (statePtr->sockets->fd != INVALID_SOCKET) { closesocket(statePtr->sockets->fd); } - /* get statePtr lock */ + /* + * Get statePtr lock. + */ + WaitForSingleObject(tsdPtr->socketListLock, INFINITE); /* * Reset last error from last try */ + statePtr->notifierConnectError = 0; Tcl_SetErrno(0); - statePtr->sockets->fd = socket(statePtr->myaddr->ai_family, SOCK_STREAM, 0); + statePtr->sockets->fd = socket(statePtr->myaddr->ai_family, + SOCK_STREAM, 0); + + /* + * Free list lock. + */ - /* Free list lock */ SetEvent(tsdPtr->socketListLock); - /* continue on socket creation error */ + /* + * Continue on socket creation error. + */ + if (statePtr->sockets->fd == INVALID_SOCKET) { TclWinConvertError((DWORD) WSAGetLastError()); continue; @@ -1691,31 +1757,39 @@ TcpConnect( * processes by default. Turn off the inherit bit. */ - SetHandleInformation((HANDLE) statePtr->sockets->fd, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation((HANDLE) statePtr->sockets->fd, + HANDLE_FLAG_INHERIT, 0); /* * Set kernel space buffering */ - TclSockMinimumBuffers((void *) statePtr->sockets->fd, TCP_BUFFER_SIZE); + TclSockMinimumBuffers((void *) statePtr->sockets->fd, + TCP_BUFFER_SIZE); /* * Try to bind to a local port. */ if (bind(statePtr->sockets->fd, statePtr->myaddr->ai_addr, - statePtr->myaddr->ai_addrlen) == SOCKET_ERROR) { + statePtr->myaddr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertError((DWORD) WSAGetLastError()); continue; } + /* * For asyncroneous connect set the socket in nonblocking mode * and activate connect notification */ + if (async_connect) { TcpState *statePtr2; int in_socket_list = 0; - /* get statePtr lock */ + + /* + * Get statePtr lock. + */ + WaitForSingleObject(tsdPtr->socketListLock, INFINITE); /* @@ -1725,8 +1799,8 @@ TcpConnect( * It is set after this call by TcpThreadActionProc and is set * on a second round. * - * If not, we buffer my statePtr in the tsd memory so it is not - * lost by the event procedure + * If not, we buffer my statePtr in the tsd memory so it is + * not lost by the event procedure */ for (statePtr2 = tsdPtr->socketList; statePtr2 != NULL; @@ -1739,19 +1813,26 @@ TcpConnect( if (!in_socket_list) { tsdPtr->pendingTcpState = statePtr; } + /* * Set connect mask to connect events - * This is activated by a SOCKET_SELECT message to the notifier - * thread. + * + * This is activated by a SOCKET_SELECT message to the + * notifier thread. */ - statePtr->selectEvents |= FD_CONNECT; + + SET_BITS(statePtr->selectEvents, FD_CONNECT); /* - * Free list lock + * Free list lock. */ + SetEvent(tsdPtr->socketListLock); - /* activate accept notification */ + /* + * Activate accept notification. + */ + SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) statePtr); } @@ -1769,12 +1850,11 @@ TcpConnect( if (async_connect && error == WSAEWOULDBLOCK) { /* * Asynchroneous connect - */ - - /* + * * Remember that we jump back behind this next round */ - statePtr->flags |= TCP_ASYNC_PENDING; + + SET_BITS(statePtr->flags, TCP_ASYNC_PENDING); return TCL_OK; reenter: @@ -1784,21 +1864,39 @@ TcpConnect( * * Clear the reenter flag */ - statePtr->flags &= ~(TCP_ASYNC_PENDING); - /* get statePtr lock */ + + CLEAR_BITS(statePtr->flags, TCP_ASYNC_PENDING); + + /* + * Get statePtr lock. + */ + WaitForSingleObject(tsdPtr->socketListLock, INFINITE); - /* Get signaled connect error */ + + /* + * Get signaled connect error. + */ + TclWinConvertError((DWORD) statePtr->notifierConnectError); - /* Clear eventual connect flag */ - statePtr->selectEvents &= ~(FD_CONNECT); - /* Free list lock */ + + /* + * Clear eventual connect flag. + */ + + CLEAR_BITS(statePtr->selectEvents, FD_CONNECT); + + /* + * Free list lock. + */ + SetEvent(tsdPtr->socketListLock); } /* - * Clear the tsd socket list pointer if we did not wait for - * the FD_CONNECT asyncroneously + * Clear the tsd socket list pointer if we did not wait for the + * FD_CONNECT asynchronously. */ + tsdPtr->pendingTcpState = NULL; if (Tcl_GetErrno() == 0) { @@ -1807,7 +1905,7 @@ TcpConnect( } } -out: + out: /* * Socket connected or connection failed */ @@ -1818,13 +1916,13 @@ out: CLEAR_BITS(statePtr->flags, TCP_ASYNC_CONNECT); - if ( Tcl_GetErrno() == 0 ) { + if (Tcl_GetErrno() == 0) { /* * Succesfully connected - */ - /* + * * Set up the select mask for read/write events. */ + statePtr->selectEvents = FD_READ | FD_WRITE | FD_CLOSE; /* @@ -1837,30 +1935,52 @@ out: } else { /* * Connect failed - */ - - /* + * * For async connect schedule a writable event to report the fail. */ + if (async_callback) { /* * Set up the select mask for read/write events. */ + statePtr->selectEvents = FD_WRITE|FD_READ; - /* get statePtr lock */ + + /* + * Get statePtr lock. + */ + WaitForSingleObject(tsdPtr->socketListLock, INFINITE); - /* Signal ready readable and writable events */ - statePtr->readyEvents |= FD_WRITE | FD_READ; - /* Flag error to event routine */ - statePtr->flags |= TCP_ASYNC_FAILED; - /* Save connect error to be reported by 'fconfigure -error' */ + + /* + * Signal ready readable and writable events. + */ + + SET_BITS(statePtr->readyEvents, FD_WRITE | FD_READ); + + /* + * Flag error to event routine. + */ + + SET_BITS(statePtr->flags, TCP_ASYNC_FAILED); + + /* + * Save connect error to be reported by 'fconfigure -error'. + */ + statePtr->connectError = Tcl_GetErrno(); - /* Free list lock */ + + /* + * Free list lock. + */ + SetEvent(tsdPtr->socketListLock); } + /* * Error message on syncroneous connect */ + if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't open socket: %s", Tcl_PosixError(interp))); @@ -1938,7 +2058,7 @@ Tcl_OpenTcpClient( statePtr->addrlist = addrlist; statePtr->myaddrlist = myaddrlist; if (async) { - statePtr->flags |= TCP_ASYNC_CONNECT; + SET_BITS(statePtr->flags, TCP_ASYNC_CONNECT); } /* @@ -2008,7 +2128,8 @@ Tcl_MakeTcpClientChannel( */ statePtr->selectEvents = FD_READ | FD_CLOSE | FD_WRITE; - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, (LPARAM)statePtr); + SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, + (LPARAM)statePtr); sprintf(channelName, SOCK_TEMPLATE, statePtr); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, @@ -2078,7 +2199,8 @@ Tcl_OpenTcpServerEx( goto error; } - if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) { + if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, + &errorMsg)) { goto error; } @@ -2117,13 +2239,14 @@ Tcl_OpenTcpServerEx( } /* - * The SO_REUSEADDR option on Windows behaves like SO_REUSEPORT on unix - * systems. + * The SO_REUSEADDR option on Windows behaves like SO_REUSEPORT on + * unix systems. */ + if (flags & TCL_TCPSERVER_REUSEPORT) { optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *) &optvalue, sizeof(optvalue)); + (char *) &optvalue, sizeof(optvalue)); } /* @@ -2134,8 +2257,8 @@ Tcl_OpenTcpServerEx( * place to look for bugs. */ - if (bind(sock, addrPtr->ai_addr, addrPtr->ai_addrlen) - == SOCKET_ERROR) { + if (bind(sock, addrPtr->ai_addr, + addrPtr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertError((DWORD) WSAGetLastError()); closesocket(sock); continue; @@ -2170,13 +2293,14 @@ Tcl_OpenTcpServerEx( /* * Add this socket to the global list of sockets. */ + statePtr = NewSocketInfo(sock); } else { - AddSocketInfoFd( statePtr, sock ); + AddSocketInfoFd(statePtr, sock); } } -error: + error: if (addrlist != NULL) { freeaddrinfo(addrlist); } @@ -2202,7 +2326,7 @@ error: ioctlsocket(sock, (long) FIONBIO, &flag); SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + (LPARAM) statePtr); if (Tcl_SetChannelOption(interp, statePtr->channel, "-eofchar", "") == TCL_ERROR) { Tcl_Close(NULL, statePtr->channel); @@ -2564,9 +2688,8 @@ SocketCheckProc( statePtr = statePtr->nextPtr) { if ((statePtr->readyEvents & (statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)) - && !(statePtr->flags & SOCKET_PENDING) - ) { - statePtr->flags |= SOCKET_PENDING; + && !(statePtr->flags & SOCKET_PENDING)) { + SET_BITS(statePtr->flags, SOCKET_PENDING); evPtr = ckalloc(sizeof(SocketEvent)); evPtr->header.proc = SocketEventProc; evPtr->socket = statePtr->sockets->fd; @@ -2641,29 +2764,26 @@ SocketEventProc( * Clear flag that (this) event is pending */ - statePtr->flags &= ~SOCKET_PENDING; + CLEAR_BITS(statePtr->flags, SOCKET_PENDING); /* * Continue async connect if pending and ready */ - if ( statePtr->readyEvents & FD_CONNECT ) { - if ( statePtr->flags & TCP_ASYNC_PENDING ) { - + if (statePtr->readyEvents & FD_CONNECT) { + if (statePtr->flags & TCP_ASYNC_PENDING) { /* * Do one step and save eventual connect error */ SetEvent(tsdPtr->socketListLock); WaitForConnect(statePtr,NULL); - } else { - /* * No async connect reenter pending. Just clear event. */ - statePtr->readyEvents &= ~(FD_CONNECT); + CLEAR_BITS(statePtr->readyEvents, FD_CONNECT); SetEvent(tsdPtr->socketListLock); } return 1; @@ -2672,20 +2792,23 @@ SocketEventProc( /* * Handle connection requests directly. */ + if (statePtr->readyEvents & FD_ACCEPT) { for (fds = statePtr->sockets; fds != NULL; fds = fds->next) { - /* - * Accept the incoming connection request. - */ - len = sizeof(address); + * Accept the incoming connection request. + */ + len = sizeof(address); newSocket = accept(fds->fd, &(addr.sa), &len); - /* On Tcl server sockets with multiple OS fds we loop over the fds trying - * an accept() on each, so we expect INVALID_SOCKET. There are also other - * network stack conditions that can result in FD_ACCEPT but a subsequent - * failure on accept() by the time we get around to it. + /* + * On Tcl server sockets with multiple OS fds we loop over the fds + * trying an accept() on each, so we expect INVALID_SOCKET. There + * are also other network stack conditions that can result in + * FD_ACCEPT but a subsequent failure on accept() by the time we + * get around to it. + * * Access to sockets (acceptEventCount, readyEvents) in socketList * is still protected by the lock (prevents reintroduction of * SF Tcl Bug 3056775. @@ -2697,35 +2820,40 @@ SocketEventProc( } /* - * It is possible that more than one FD_ACCEPT has been sent, so an extra - * count must be kept. Decrement the count, and reset the readyEvent bit - * if the count is no longer > 0. + * It is possible that more than one FD_ACCEPT has been sent, so + * an extra count must be kept. Decrement the count, and reset the + * readyEvent bit if the count is no longer > 0. */ + statePtr->acceptEventCount--; if (statePtr->acceptEventCount <= 0) { - statePtr->readyEvents &= ~(FD_ACCEPT); + CLEAR_BITS(statePtr->readyEvents, FD_ACCEPT); } SetEvent(tsdPtr->socketListLock); - /* Caution: TcpAccept() has the side-effect of evaluating the server - * accept script (via AcceptCallbackProc() in tclIOCmd.c), which can - * close the server socket and invalidate statePtr and fds. - * If TcpAccept() accepts a socket we must return immediately and let - * SocketCheckProc queue additional FD_ACCEPT events. + /* + * Caution: TcpAccept() has the side-effect of evaluating the + * server accept script (via AcceptCallbackProc() in tclIOCmd.c), + * which can close the server socket and invalidate statePtr and + * fds. If TcpAccept() accepts a socket we must return immediately + * and let SocketCheckProc queue additional FD_ACCEPT events. */ + TcpAccept(fds, newSocket, addr); return 1; } - /* Loop terminated with no sockets accepted; clear the ready mask so + /* + * Loop terminated with no sockets accepted; clear the ready mask so * we can detect the next connection request. Note that connection * requests are level triggered, so if there is a request already * pending, a new event will be generated. */ + statePtr->acceptEventCount = 0; - statePtr->readyEvents &= ~(FD_ACCEPT); + CLEAR_BITS(statePtr->readyEvents, FD_ACCEPT); SetEvent(tsdPtr->socketListLock); return 1; @@ -2754,16 +2882,15 @@ SocketEventProc( Tcl_Time blockTime = { 0, 0 }; Tcl_SetMaxBlockTime(&blockTime); - mask |= TCL_READABLE|TCL_WRITABLE; + SET_BITS(mask, TCL_READABLE | TCL_WRITABLE); } else if (events & FD_READ) { /* * Throw the readable event if an async connect failed. */ - if ( statePtr->flags & TCP_ASYNC_FAILED ) { - - mask |= TCL_READABLE; + if (statePtr->flags & TCP_ASYNC_FAILED) { + SET_BITS(mask, TCL_READABLE); } else { fd_set readFds; @@ -2786,9 +2913,9 @@ SocketEventProc( timeout.tv_sec = 0; if (select(0, &readFds, NULL, NULL, &timeout) != 0) { - mask |= TCL_READABLE; + SET_BITS(mask, TCL_READABLE); } else { - statePtr->readyEvents &= ~(FD_READ); + CLEAR_BITS(statePtr->readyEvents, FD_READ); SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) statePtr); } @@ -2800,7 +2927,7 @@ SocketEventProc( */ if (events & FD_WRITE) { - mask |= TCL_WRITABLE; + SET_BITS(mask, TCL_WRITABLE); } /* @@ -2837,13 +2964,19 @@ AddSocketInfoFd( { TcpFdList *fds = statePtr->sockets; - if ( fds == NULL ) { - /* Add the first FD */ + if (fds == NULL) { + /* + * Add the first FD. + */ + statePtr->sockets = ckalloc(sizeof(TcpFdList)); fds = statePtr->sockets; } else { - /* Find end of list and append FD */ - while ( fds->next != NULL ) { + /* + * Find end of list and append FD. + */ + + while (fds->next != NULL) { fds = fds->next; } @@ -2851,7 +2984,10 @@ AddSocketInfoFd( fds = fds->next; } - /* Populate new FD */ + /* + * Populate new FD. + */ + fds->fd = socket; fds->statePtr = statePtr; fds->next = NULL; @@ -2921,6 +3057,7 @@ WaitForSocketEvent( int result = 1; int oldMode; ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); + /* * Be sure to disable event servicing so we are truly modal. */ @@ -2939,21 +3076,36 @@ WaitForSocketEvent( while (1) { int event_found; - /* get statePtr lock */ + /* + * Get statePtr lock. + */ + WaitForSingleObject(tsdPtr->socketListLock, INFINITE); - /* Check if event occured */ + /* + * Check if event occured. + */ + event_found = (statePtr->readyEvents & events); - /* Free list lock */ + /* + * Free list lock. + */ + SetEvent(tsdPtr->socketListLock); - /* exit loop if event occured */ + /* + * Exit loop if event occured. + */ + if (event_found) { break; } - /* Exit loop if event did not occur but this is a non-blocking channel */ + /* + * Exit loop if event did not occur but this is a non-blocking channel + */ + if (statePtr->flags & TCP_NONBLOCKING) { *errorCodePtr = EWOULDBLOCK; result = 0; @@ -3110,34 +3262,34 @@ SocketProc( for (statePtr = tsdPtr->socketList; statePtr != NULL; statePtr = statePtr->nextPtr) { - if ( FindFDInList(statePtr,socket) ) { + if (FindFDInList(statePtr, socket)) { info_found = 1; break; } } + /* - * Check if there is a pending info structure not jet in the - * list + * Check if there is a pending info structure not jet in the list. */ - if ( !info_found + + if (!info_found && tsdPtr->pendingTcpState != NULL - && FindFDInList(tsdPtr->pendingTcpState,socket) ) { + && FindFDInList(tsdPtr->pendingTcpState, socket)) { statePtr = tsdPtr->pendingTcpState; info_found = 1; } if (info_found) { - /* * Update the socket state. * * A count of FD_ACCEPTS is stored, so if an FD_CLOSE event - * happens, then clear the FD_ACCEPT count. Otherwise, - * increment the count if the current event is an FD_ACCEPT. + * happens, then clear the FD_ACCEPT count. Otherwise, increment + * the count if the current event is an FD_ACCEPT. */ if (event & FD_CLOSE) { statePtr->acceptEventCount = 0; - statePtr->readyEvents &= ~(FD_WRITE|FD_ACCEPT); + CLEAR_BITS(statePtr->readyEvents, FD_WRITE | FD_ACCEPT); } else if (event & FD_ACCEPT) { statePtr->acceptEventCount++; } @@ -3147,18 +3299,22 @@ SocketProc( * Remember any error that occurred so we can report * connection failures. */ + if (error != ERROR_SUCCESS) { statePtr->notifierConnectError = error; } } + /* * Inform main thread about signaled events */ - statePtr->readyEvents |= event; + + SET_BITS(statePtr->readyEvents, event); /* * Wake up the Main Thread. */ + SetEvent(tsdPtr->readyEvent); Tcl_ThreadAlert(tsdPtr->threadId); } -- cgit v0.12 From bbfc7b1ea2d467b198933a82184a6c53de48ac00 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 10 Apr 2017 16:21:31 +0000 Subject: More minor style fixes. --- generic/tclIO.c | 729 ++++++++++++++++++++++++++++----------------------- generic/tclIORChan.c | 57 ++-- generic/tclIOUtil.c | 51 ++-- generic/tclTimer.c | 12 +- unix/tclUnixSock.c | 48 ++-- win/tclWinSock.c | 150 ++++++----- 6 files changed, 572 insertions(+), 475 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index a509ebf..32fbd59 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -321,7 +321,7 @@ static int WillRead(Channel *chanPtr); typedef struct ResolvedChanName { ChannelState *statePtr; /* The saved lookup result */ Tcl_Interp *interp; /* The interp in which the lookup was done. */ - size_t epoch; /* The epoch of the channel when the lookup + size_t epoch; /* The epoch of the channel when the lookup * was done. Use to verify validity. */ size_t refCount; /* Share this struct among many Tcl_Obj. */ } ResolvedChanName; @@ -381,20 +381,20 @@ ChanCloseHalf( * * ChanRead -- * - * Read up to dstSize bytes using the inputProc of chanPtr, store - * them at dst, and return the number of bytes stored. + * Read up to dstSize bytes using the inputProc of chanPtr, store them at + * dst, and return the number of bytes stored. * * Results: * The return value of the driver inputProc, * - number of bytes stored at dst, ot - * - -1 on error, with a Posix error code available to the - * caller by calling Tcl_GetErrno(). + * - -1 on error, with a Posix error code available to the caller by + * calling Tcl_GetErrno(). * * Side effects: - * The CHANNEL_BLOCKED and CHANNEL_EOF flags of the channel state are - * set as appropriate. - * On EOF, the inputEncodingFlags are set to perform ending operations - * on decoding. + * The CHANNEL_BLOCKED and CHANNEL_EOF flags of the channel state are set + * as appropriate. On EOF, the inputEncodingFlags are set to perform + * ending operations on decoding. + * * TODO - Is this really the right place for that? * *--------------------------------------------------------------------------- @@ -408,15 +408,17 @@ ChanRead( int bytesRead, result; /* - * If the caller asked for zero bytes, we'd force the inputProc - * to return zero bytes, and then misinterpret that as EOF. + * If the caller asked for zero bytes, we'd force the inputProc to return + * zero bytes, and then misinterpret that as EOF. */ + assert(dstSize > 0); /* * Each read op must set the blocked and eof states anew, not let * the effect of prior reads leak through. */ + if (GotFlag(chanPtr->state, CHANNEL_EOF)) { chanPtr->state->inputEncodingFlags |= TCL_ENCODING_START; } @@ -429,7 +431,10 @@ ChanRead( bytesRead = chanPtr->typePtr->inputProc(chanPtr->instanceData, dst, dstSize, &result); - /* Stop any flag leakage through stacked channel levels */ + /* + * Stop any flag leakage through stacked channel levels. + */ + if (GotFlag(chanPtr->state, CHANNEL_EOF)) { chanPtr->state->inputEncodingFlags |= TCL_ENCODING_START; } @@ -437,10 +442,10 @@ ChanRead( chanPtr->state->inputEncodingFlags &= ~TCL_ENCODING_END; if (bytesRead > 0) { /* - * If we get a short read, signal up that we may be BLOCKED. - * We should avoid calling the driver because on some - * platforms we will block in the low level reading code even - * though the channel is set into nonblocking mode. + * If we get a short read, signal up that we may be BLOCKED. We should + * avoid calling the driver because on some platforms we will block in + * the low level reading code even though the channel is set into + * nonblocking mode. */ if (bytesRead < dstSize) { @@ -574,7 +579,10 @@ TclFinalizeIOSubsystem(void) int active = 1; /* Flag == 1 while there's still work to do */ int doflushnb; - /* Fetch the pre-TIP#398 compatibility flag */ + /* + * Fetch the pre-TIP#398 compatibility flag. + */ + { const char *s; Tcl_DString ds; @@ -619,18 +627,20 @@ TclFinalizeIOSubsystem(void) */ if (active) { - TclChannelPreserve((Tcl_Channel)chanPtr); + /* - * TIP #398: by default, we no longer set the channel back into - * blocking mode. To restore the old blocking behavior, the - * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set + * TIP #398: by default, we no longer set the channel back into + * blocking mode. To restore the old blocking behavior, the + * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set * and not be "0". */ + if (doflushnb) { - /* Set the channel back into blocking mode to ensure that we wait - * for all data to flush out. - */ + /* + * Set the channel back into blocking mode to ensure that we + * wait for all data to flush out. + */ (void) Tcl_SetChannelOption(NULL, (Tcl_Channel) chanPtr, "-blocking", "on"); @@ -1511,8 +1521,10 @@ TclGetChannelFromObj( if ((resPtr->interp == interp) /* Same interp context */ /* No epoch change in channel since lookup */ && (resPtr->epoch == statePtr->epoch)) { + /* + * Have a valid saved lookup. Jump to end to return it. + */ - /* Have a valid saved lookup. Jump to end to return it. */ goto valid; } } @@ -1527,7 +1539,10 @@ TclGetChannelFromObj( } if (resPtr && resPtr->refCount == 1) { - /* Re-use the ResolvedCmdName struct */ + /* + * Re-use the ResolvedCmdName struct. + */ + Tcl_Release((ClientData) resPtr->statePtr); } else { @@ -1671,7 +1686,7 @@ Tcl_CreateChannel( * Set the channel up initially in AUTO input translation mode to accept * "\n", "\r" and "\r\n". Output translation mode is set to a platform * specific default value. The eofChar is set to 0 for both input and - * output, so that Tcl does not look for an in-file EOF indicator (e.g. + * output, so that Tcl does not look for an in-file EOF indicator (e.g., * ^Z) and does not append an EOF indicator to files. */ @@ -1899,7 +1914,6 @@ Tcl_StackChannel( */ if (((mask & TCL_READABLE) != 0) && (statePtr->inQueueHead != NULL)) { - /* * When statePtr->inQueueHead is not NULL, we know * prevChanPtr->inQueueHead must be NULL. @@ -2031,9 +2045,7 @@ Tcl_UnstackChannel( * of registered channels we wind down the state of the * transformation, and then restore the state of underlying channel * into the old structure. - */ - - /* + * * TODO: Figure out how to handle the situation where the chan * operations called below by this unstacking operation cause * another unstacking recursively. In that case the downChanPtr @@ -2511,6 +2523,7 @@ RecycleBuffer( /* * Do we have to free the buffer to the OS? */ + if (IsShared(bufPtr)) { mustDiscard = 1; } @@ -2521,9 +2534,8 @@ RecycleBuffer( } /* - * Only save buffers which have the requested buffersize for the - * channel. This is to honor dynamic changes of the buffersize - * made by the user. + * Only save buffers which have the requested buffersize for the channel. + * This is to honor dynamic changes of the buffersize made by the user. */ if ((bufPtr->bufLength - BUFFER_PADDING) != statePtr->bufSize) { @@ -2693,14 +2705,18 @@ FlushChannel( /* * Should we shift the current output buffer over to the output queue? * First check that there are bytes in it. If so then... - * If the output queue is empty, then yes, trusting the caller called - * us only when written bytes ought to be flushed. - * If the current output buffer is full, then yes, so we can meet - * the post-condition that on a successful return to caller we've - * left space in the current output buffer for more writing (the flush - * call was to make new room). - * If the channel is blocking, then yes, so we guarantee that - * blocking flushes actually flush all pending data. + * + * If the output queue is empty, then yes, trusting the caller called us + * only when written bytes ought to be flushed. + * + * If the current output buffer is full, then yes, so we can meet the + * post-condition that on a successful return to caller we've left space + * in the current output buffer for more writing (the flush call was to + * make new room). + * + * If the channel is blocking, then yes, so we guarantee that blocking + * flushes actually flush all pending data. + * * Otherwise, no. Keep the current output buffer where it is so more * can be written to it, possibly filling it, to promote more efficient * buffer usage. @@ -2794,8 +2810,8 @@ FlushChannel( /* * TIP #219, Tcl Channel Reflection API. * When defering the error copy a message from the bypass into - * the unreported area. Or discard it if the new error is to be - * ignored in favor of an earlier defered error. + * the unreported area. Or discard it if the new error is to + * be ignored in favor of an earlier defered error. */ Tcl_Obj *msg = statePtr->chanMsg; @@ -2847,8 +2863,11 @@ FlushChannel( ReleaseChannelBuffer(bufPtr); break; } else { - /* TODO: Consider detecting and reacting to short writes - * on blocking channels. Ought not happen. See iocmd-24.2. */ + /* + * TODO: Consider detecting and reacting to short writes on + * blocking channels. Ought not happen. See iocmd-24.2. + */ + wroteSome = 1; } @@ -2882,7 +2901,6 @@ FlushChannel( ResetFlag(statePtr, BG_FLUSH_SCHEDULED); ChanWatch(chanPtr, statePtr->interestMask); } else { - /* * When we are calledFromAsyncFlush, that means a writable * state on the channel triggered the call, so we should be @@ -2927,7 +2945,8 @@ FlushChannel( (statePtr->outQueueHead == NULL) && ((statePtr->curOutPtr == NULL) || IsBufferEmpty(statePtr->curOutPtr))) { - errorCode = CloseChannelPart(interp, chanPtr, errorCode, TCL_CLOSE_WRITE); + errorCode = CloseChannelPart(interp, chanPtr, errorCode, + TCL_CLOSE_WRITE); goto done; } @@ -3398,7 +3417,6 @@ Tcl_Close( if (GotFlag(statePtr, TCL_WRITABLE) && (statePtr->encoding != NULL) && !(statePtr->outputEncodingFlags & TCL_ENCODING_START)) { - int code = CheckChannelErrors(statePtr, TCL_WRITABLE); if (code == 0) { @@ -3488,12 +3506,14 @@ Tcl_Close( } return TCL_ERROR; } + /* * Bug 97069ea11a: set error message if a flush code is set and no error * message set up to now. */ + if (flushcode != 0 && interp != NULL - && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp)) ) { + && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp))) { Tcl_SetErrno(flushcode); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_PosixError(interp), -1)); @@ -3588,8 +3608,8 @@ Tcl_CloseEx( } /* - * A user may try to call half-close from within a channel close - * handler. That won't do. + * A user may try to call half-close from within a channel close handler. + * That won't do. */ if (statePtr->flags & CHANNEL_INCLOSE) { @@ -3660,9 +3680,12 @@ CloseWrite( * closed. May still be used by some * interpreter */ { - /* Notes: clear-channel-handlers - write side only ? or keep around, just - * not called. */ - /* No close cllbacks are run - channel is still open (read side) */ + /* + * Notes: clear-channel-handlers - write side only ? or keep around, just + * not called. + * + * No close callbacks are run - channel is still open (read side) + */ ChannelState *statePtr = chanPtr->state; /* State of real IO channel. */ @@ -3687,9 +3710,9 @@ CloseWrite( * Notes: Due to the assertion of CHANNEL_CLOSEDWRITE in the flags * FlushChannel() has called CloseChannelPart(). While we can still access * "chan" (no structures were freed), the only place which may still - * contain a message is the interpreter itself, and "CloseChannelPart" made - * sure to lift any channel message it generated into it. Hence the NULL - * argument in the call below. + * contain a message is the interpreter itself, and "CloseChannelPart" + * made sure to lift any channel message it generated into it. Hence the + * NULL argument in the call below. */ if (TclChanCaughtErrorBypass(interp, NULL)) { @@ -3913,10 +3936,10 @@ Tcl_ClearChannelHandlers( StopCopy(statePtr->csPtrW); /* - * Must set the interest mask now to 0, otherwise infinite loops - * will occur if Tcl_DoOneEvent is called before the channel is - * finally deleted in FlushChannel. This can happen if the channel - * has a background flush active. + * Must set the interest mask now to 0, otherwise infinite loops will + * occur if Tcl_DoOneEvent is called before the channel is finally deleted + * in FlushChannel. This can happen if the channel has a background flush + * active. */ statePtr->interestMask = 0; @@ -4185,22 +4208,24 @@ WillRead( Channel *chanPtr) { if (chanPtr->typePtr == NULL) { - /* Prevent read attempts on a closed channel */ + /* + * Prevent read attempts on a closed channel. + */ + DiscardInputQueued(chanPtr->state, 0); Tcl_SetErrno(EINVAL); return -1; } if ((chanPtr->typePtr->seekProc != NULL) && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { - /* - * CAVEAT - The assumption here is that FlushChannel() will - * push out the bytes of any writes that are in progress. - * Since this is a seekable channel, we assume it is not one - * that can block and force bg flushing. Channels we know that - * can do that -- sockets, pipes -- are not seekable. If the - * assumption is wrong, more drastic measures may be required here - * like temporarily setting the channel into blocking mode. + * CAVEAT - The assumption here is that FlushChannel() will push out + * the bytes of any writes that are in progress. Since this is a + * seekable channel, we assume it is not one that can block and force + * bg flushing. Channels we know that can do that - sockets, pipes - + * are not seekable. If the assumption is wrong, more drastic measures + * may be required here like temporarily setting the channel into + * blocking mode. */ if (FlushChannel(NULL, chanPtr, 0) != 0) { @@ -4292,11 +4317,17 @@ Write( &statePtr->outputEncodingState, dst, dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); - /* See chan-io-1.[89]. Tcl Bug 506297. */ + /* + * See chan-io-1.[89]. Tcl Bug 506297. + */ + statePtr->outputEncodingFlags &= ~TCL_ENCODING_START; if ((result != TCL_OK) && (srcRead + dstWrote == 0)) { - /* We're reading from invalid/incomplete UTF-8 */ + /* + * We're reading from invalid/incomplete UTF-8. + */ + ReleaseChannelBuffer(bufPtr); if (total == 0) { Tcl_SetErrno(EINVAL); @@ -4336,11 +4367,10 @@ Write( } result |= Tcl_UtfToExternal(NULL, encoding, nl, nlLen, - statePtr->outputEncodingFlags, - &statePtr->outputEncodingState, dst, - dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); - - assert (srcRead == nlLen); + statePtr->outputEncodingFlags, + &statePtr->outputEncodingState, dst, + dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); + assert(srcRead == nlLen); bufPtr->nextAdded += dstWrote; src++; @@ -4354,11 +4384,11 @@ Write( if (IsBufferOverflowing(bufPtr)) { /* - * When translating from UTF-8 to external encoding, we - * allowed the translation to produce a character that crossed - * the end of the output buffer, so that we would get a - * completely full buffer before flushing it. The extra bytes - * will be moved to the beginning of the next buffer. + * When translating from UTF-8 to external encoding, we allowed + * the translation to produce a character that crossed the end of + * the output buffer, so that we would get a completely full + * buffer before flushing it. The extra bytes will be moved to the + * beginning of the next buffer. */ saved = -SpaceLeft(bufPtr); @@ -4378,15 +4408,16 @@ Write( flushed += statePtr->bufSize; /* - * We just flushed. So if we have needNlFlush set to record - * that we need to flush because theres a (translated) newline - * in the buffer, that's likely not true any more. But there - * is a tricky exception. If we have saved bytes that did not - * really get flushed and those bytes came from a translation - * of a newline as the last thing taken from the src array, - * then needNlFlush needs to remain set to flag that the - * next buffer still needs a newline flush. + * We just flushed. So if we have needNlFlush set to record that + * we need to flush because theres a (translated) newline in the + * buffer, that's likely not true any more. But there is a tricky + * exception. If we have saved bytes that did not really get + * flushed and those bytes came from a translation of a newline as + * the last thing taken from the src array, then needNlFlush needs + * to remain set to flag that the next buffer still needs a + * newline flush. */ + if (needNlFlush && (saved == 0 || src[-1] != '\n')) { needNlFlush = 0; } @@ -4492,8 +4523,8 @@ Tcl_GetsObj( if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: Do we need this? */ UpdateInterest(chanPtr); @@ -4833,17 +4864,17 @@ Tcl_GetsObj( */ done: - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); /* * Regenerate the top channel, in case it was changed due to * self-modifying reflected transforms. */ + if (chanPtr != statePtr->topChanPtr) { TclChannelRelease((Tcl_Channel)chanPtr); chanPtr = statePtr->topChanPtr; @@ -4863,10 +4894,9 @@ Tcl_GetsObj( * end-of-line or end-of-file has been seen. Bytes read from the input * channel return as a ByteArray obj. * - * WARNING! The notion of "binary" used here is different from - * notions of "binary" used in other places. In particular, this - * "binary" routine may be called when an -eofchar is set on the - * channel. + * WARNING! The notion of "binary" used here is different from notions + * of "binary" used in other places. In particular, this "binary" routine + * may be called when an -eofchar is set on the channel. * * Results: * Number of characters accumulated in the object or -1 if error, @@ -4932,8 +4962,8 @@ TclGetsObjBinary( ResetFlag(statePtr, CHANNEL_BLOCKED); while (1) { /* - * Subtract the number of bytes that were removed from channel - * buffer during last call. + * Subtract the number of bytes that were removed from channel buffer + * during last call. */ if (bufPtr != NULL) { @@ -4945,10 +4975,11 @@ TclGetsObjBinary( if ((bufPtr == NULL) || (bufPtr->nextAdded == BUFFER_PADDING)) { /* - * All channel buffers were exhausted and the caller still - * hasn't seen EOL. Need to read more bytes from the channel - * device. Side effect is to allocate another channel buffer. + * All channel buffers were exhausted and the caller still hasn't + * seen EOL. Need to read more bytes from the channel device. Side + * effect is to allocate another channel buffer. */ + if (GetInput(chanPtr) != 0) { goto restore; } @@ -4958,15 +4989,15 @@ TclGetsObjBinary( } } else { /* - * Incoming CHANNEL_STICKY_EOF is filtered out on entry. - * A new CHANNEL_STICKY_EOF set in this routine leads to - * return before coming back here. When we are not dealing - * with CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an - * empty buffer. Here the buffer is non-empty so we know - * we're a non-EOF */ + * Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new + * CHANNEL_STICKY_EOF set in this routine leads to return before + * coming back here. When we are not dealing with + * CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an empty buffer. + * Here the buffer is non-empty so we know we're a non-EOF. + */ - assert ( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); - assert ( !GotFlag(statePtr, CHANNEL_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); + assert(!GotFlag(statePtr, CHANNEL_EOF)); } dst = (unsigned char *) RemovePoint(bufPtr); @@ -5033,8 +5064,8 @@ TclGetsObjBinary( } /* - * Copy bytes from the channel buffer to the ByteArray. - * This may realloc space, so keep track of result. + * Copy bytes from the channel buffer to the ByteArray. This may + * realloc space, so keep track of result. */ rawLen = dstEnd - dst; @@ -5118,11 +5149,11 @@ TclGetsObjBinary( */ done: - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return copiedTotal; @@ -5255,15 +5286,15 @@ FilterInputBytes( } } else { /* - * Incoming CHANNEL_STICKY_EOF is filtered out on entry. - * A new CHANNEL_STICKY_EOF set in this routine leads to - * return before coming back here. When we are not dealing - * with CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an - * empty buffer. Here the buffer is non-empty so we know - * we're a non-EOF */ + * Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new + * CHANNEL_STICKY_EOF set in this routine leads to return before + * coming back here. When we are not dealing with CHANNEL_STICKY_EOF, + * a CHANNEL_EOF implies an empty buffer. Here the buffer is + * non-empty so we know we're a non-EOF. + */ - assert ( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); - assert ( !GotFlag(statePtr, CHANNEL_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); + assert(!GotFlag(statePtr, CHANNEL_EOF)); } /* @@ -5593,7 +5624,9 @@ Tcl_ReadRaw( return -1; } - /* First read bytes from the push-back buffers. */ + /* + * First read bytes from the push-back buffers. + */ while (chanPtr->inQueueHead && bytesToRead > 0) { ChannelBuffer *bufPtr = chanPtr->inQueueHead; @@ -5601,7 +5634,9 @@ Tcl_ReadRaw( int toCopy = (bytesInBuffer < bytesToRead) ? bytesInBuffer : bytesToRead; - /* Copy the current chunk into the read buffer. */ + /* + * Copy the current chunk into the read buffer. + */ memcpy(readBuf, RemovePoint(bufPtr), (size_t) toCopy); bufPtr->nextRemoved += toCopy; @@ -5609,7 +5644,9 @@ Tcl_ReadRaw( readBuf += toCopy; bytesToRead -= toCopy; - /* If the current buffer is empty recycle it. */ + /* + * If the current buffer is empty recycle it. + */ if (IsBufferEmpty(bufPtr)) { chanPtr->inQueueHead = bufPtr->nextPtr; @@ -5621,37 +5658,40 @@ Tcl_ReadRaw( } /* - * Go to the driver only if we got nothing from pushback. - * Have to do it this way to avoid EOF mis-timings when we - * consider the ability that EOF may not be a permanent - * condition in the driver, and in that case we have to - * synchronize. + * Go to the driver only if we got nothing from pushback. Have to do it + * this way to avoid EOF mis-timings when we consider the ability that EOF + * may not be a permanent condition in the driver, and in that case we + * have to synchronize. */ if (copied) { return copied; } - /* This test not needed. */ - if (bytesToRead > 0) { + /* + * This test not needed. + */ + if (bytesToRead > 0) { int nread = ChanRead(chanPtr, readBuf, bytesToRead); if (nread > 0) { - /* Successful read (short is OK) - add to bytes copied */ + /* + * Successful read (short is OK) - add to bytes copied. + */ + copied += nread; } else if (nread < 0) { /* - * An error signaled. If CHANNEL_BLOCKED, then the error - * is not real, but an indication of blocked state. In - * that case, retain the flag and let caller receive the - * short read of copied bytes from the pushback. - * HOWEVER, if copied==0 bytes from pushback then repeat - * signalling the blocked state as an error to caller so - * there is no false report of an EOF. - * When !CHANNEL_BLOCKED, the error is real and passes on - * to caller. + * An error signaled. If CHANNEL_BLOCKED, then the error is not + * real, but an indication of blocked state. In that case, retain + * the flag and let caller receive the short read of copied bytes + * from the pushback. HOWEVER, if copied==0 bytes from pushback + * then repeat signalling the blocked state as an error to caller + * so there is no false report of an EOF. When !CHANNEL_BLOCKED, + * the error is real and passes on to caller. */ + if (!GotFlag(statePtr, CHANNEL_BLOCKED) || copied == 0) { copied = -1; } @@ -5788,21 +5828,23 @@ DoReadChars( /* * Early out when next read will see eofchar. * - * NOTE: See DoRead for argument that it's a bug (one we're keeping) - * to have this escape before the one for zero-char read request. + * NOTE: See DoRead for argument that it's a bug (one we're keeping) to + * have this escape before the one for zero-char read request. */ if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: We don't need this call? */ UpdateInterest(chanPtr); return 0; } - /* Special handling for zero-char read request. */ + /* + * Special handling for zero-char read request. + */ if (toRead == 0) { if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; @@ -5821,7 +5863,10 @@ DoReadChars( chanPtr = statePtr->topChanPtr; TclChannelPreserve((Tcl_Channel)chanPtr); - /* Must clear the BLOCKED|EOF flags here since we check before reading */ + /* + * Must clear the BLOCKED|EOF flags here since we check before reading. + */ + if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; } @@ -5879,10 +5924,11 @@ DoReadChars( } /* - * Failure to fill a channel buffer may have left channel reporting - * a "blocked" state, but so long as we fulfilled the request here, - * the caller does not consider us blocked. + * Failure to fill a channel buffer may have left channel reporting a + * "blocked" state, but so long as we fulfilled the request here, the + * caller does not consider us blocked. */ + if (toRead == 0) { ResetFlag(statePtr, CHANNEL_BLOCKED); } @@ -5891,6 +5937,7 @@ DoReadChars( * Regenerate the top channel, in case it was changed due to * self-modifying reflected transforms. */ + if (chanPtr != statePtr->topChanPtr) { TclChannelRelease((Tcl_Channel)chanPtr); chanPtr = statePtr->topChanPtr; @@ -5901,11 +5948,12 @@ DoReadChars( * Update the notifier state so we don't block while there is still data * in the buffers. */ - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return copied; @@ -6022,11 +6070,10 @@ ReadChars( int numBytes, srcLen = BytesLeft(bufPtr); /* - * One src byte can yield at most one character. So when the - * number of src bytes we plan to read is less than the limit on - * character count to be read, clearly we will remain within that - * limit, and we can use the value of "srcLen" as a tighter limit - * for sizing receiving buffers. + * One src byte can yield at most one character. So when the number of + * src bytes we plan to read is less than the limit on character count to + * be read, clearly we will remain within that limit, and we can use the + * value of "srcLen" as a tighter limit for sizing receiving buffers. */ int toRead = ((charsToRead<0)||(charsToRead > srcLen)) ? srcLen : charsToRead; @@ -6044,6 +6091,7 @@ ReadChars( Tcl_AppendToObj(objPtr, NULL, dstLimit); if (toRead == srcLen) { unsigned int size; + dst = TclGetStringStorage(objPtr, &size) + numBytes; dstLimit = size - numBytes; } else { @@ -6051,19 +6099,18 @@ ReadChars( } /* - * This routine is burdened with satisfying several constraints. - * It cannot append more than 'charsToRead` chars onto objPtr. - * This is measured after encoding and translation transformations - * are completed. There is no precise number of src bytes that can - * be associated with the limit. Yet, when we are done, we must know - * precisely the number of src bytes that were consumed to produce - * the appended chars, so that all subsequent bytes are left in - * the buffers for future read operations. + * This routine is burdened with satisfying several constraints. It cannot + * append more than 'charsToRead` chars onto objPtr. This is measured + * after encoding and translation transformations are completed. There is + * no precise number of src bytes that can be associated with the limit. + * Yet, when we are done, we must know precisely the number of src bytes + * that were consumed to produce the appended chars, so that all + * subsequent bytes are left in the buffers for future read operations. * - * The consequence is that we have no choice but to implement a - * "trial and error" approach, where in general we may need to - * perform transformations and copies multiple times to achieve - * a consistent set of results. This takes the shape of a loop. + * The consequence is that we have no choice but to implement a "trial and + * error" approach, where in general we may need to perform + * transformations and copies multiple times to achieve a consistent set + * of results. This takes the shape of a loop. */ while (1) { @@ -6076,18 +6123,17 @@ ReadChars( } /* - * Perform the encoding transformation. Read no more than - * srcLen bytes, write no more than dstLimit bytes. + * Perform the encoding transformation. Read no more than srcLen + * bytes, write no more than dstLimit bytes. * - * Some trickiness with encoding flags here. We do not want - * the end of a buffer to be treated as the end of all input - * when the presence of bytes in a next buffer are already - * known to exist. This is checked with an assert() because - * so far no test case causing the assertion to be false has - * been created. The normal operations of channel reading - * appear to cause EOF and TCL_ENCODING_END setting to appear - * only in situations where there are no further bytes in - * any buffers. + * Some trickiness with encoding flags here. We do not want the end + * of a buffer to be treated as the end of all input when the presence + * of bytes in a next buffer are already known to exist. This is + * checked with an assert() because so far no test case causing the + * assertion to be false has been created. The normal operations of + * channel reading appear to cause EOF and TCL_ENCODING_END setting to + * appear only in situations where there are no further bytes in any + * buffers. */ assert(bufPtr->nextPtr == NULL || BytesLeft(bufPtr->nextPtr) == 0 @@ -6098,10 +6144,10 @@ ReadChars( dst, dstLimit, &srcRead, &dstDecoded, &numChars); /* - * Perform the translation transformation in place. Read no more - * than the dstDecoded bytes the encoding transformation actually - * produced. Capture the number of bytes written in dstWrote. - * Capture the number of bytes actually consumed in dstRead. + * Perform the translation transformation in place. Read no more than + * the dstDecoded bytes the encoding transformation actually produced. + * Capture the number of bytes written in dstWrote. Capture the number + * of bytes actually consumed in dstRead. */ dstWrote = dstLimit; @@ -6109,11 +6155,9 @@ ReadChars( TranslateInputEOL(statePtr, dst, dst, &dstWrote, &dstRead); if (dstRead < dstDecoded) { - /* - * The encoding transformation produced bytes that the - * translation transformation did not consume. Why did - * this happen? + * The encoding transformation produced bytes that the translation + * transformation did not consume. Why did this happen? */ if (statePtr->inEofChar && dst[dstRead] == statePtr->inEofChar) { @@ -6122,40 +6166,38 @@ ReadChars( * we saw it and stopped translating at that point. * * NOTE the bizarre spec of TranslateInputEOL in this case. - * Clearly the eof char had to be read in order to account - * for the stopping, but the value of dstRead does not - * include it. + * Clearly the eof char had to be read in order to account for + * the stopping, but the value of dstRead does not include it. * - * Also rather bizarre, our caller can only notice an - * EOF condition if we return the value -1 as the number - * of chars read. This forces us to perform a 2-call - * dance where the first call can read all the chars - * up to the eof char, and the second call is solely - * for consuming the encoded eof char then pointed at - * by src so that we can return that magic -1 value. - * This seems really wasteful, especially since - * the first decoding pass of each call is likely to - * decode many bytes beyond that eof char that's all we - * care about. + * Also rather bizarre, our caller can only notice an EOF + * condition if we return the value -1 as the number of chars + * read. This forces us to perform a 2-call dance where the + * first call can read all the chars up to the eof char, and + * the second call is solely for consuming the encoded eof + * char then pointed at by src so that we can return that + * magic -1 value. This seems really wasteful, especially + * since the first decoding pass of each call is likely to + * decode many bytes beyond that eof char that's all we care + * about. */ if (dstRead == 0) { /* - * Curious choice in the eof char handling. We leave - * the eof char in the buffer. So, no need to compute - * a proper srcRead value. At this point, there - * are no chars before the eof char in the buffer. + * Curious choice in the eof char handling. We leave the + * eof char in the buffer. So, no need to compute a proper + * srcRead value. At this point, there are no chars before + * the eof char in the buffer. */ + Tcl_SetObjLength(objPtr, numBytes); return -1; } { /* - * There are chars leading the buffer before the eof - * char. Adjust the dstLimit so we go back and read - * only those and do not encounter the eof char this - * time. + * There are chars leading the buffer before the eof char. + * Adjust the dstLimit so we go back and read only those + * and do not encounter the eof char this time. */ dstLimit = dstRead - 1 + TCL_UTF_MAX; @@ -6167,10 +6209,9 @@ ReadChars( } /* - * 2) The other way to read fewer bytes than are decoded - * is when the final byte is \r and we're in a CRLF - * translation mode so we cannot decide whether to - * record \r or \n yet. + * 2) The other way to read fewer bytes than are decoded is when + * the final byte is \r and we're in a CRLF translation mode so + * we cannot decide whether to record \r or \n yet. */ assert(dst[dstRead] == '\r'); @@ -6178,10 +6219,10 @@ ReadChars( if (dstWrote > 0) { /* - * There are chars we can read before we hit the bare cr. - * Go back with a smaller dstLimit so we get them in the - * next pass, compute a matching srcRead, and don't end - * up back here in this call. + * There are chars we can read before we hit the bare CR. Go + * back with a smaller dstLimit so we get them in the next + * pass, compute a matching srcRead, and don't end up back + * here in this call. */ dstLimit = dstRead - 1 + TCL_UTF_MAX; @@ -6195,9 +6236,9 @@ ReadChars( assert(dstRead == 0); /* - * We decoded only the bare cr, and we cannot read a - * translated char from that alone. We have to know what's - * next. So why do we only have the one decoded char? + * We decoded only the bare CR, and we cannot read a translated + * char from that alone. We have to know what's next. So why do + * we only have the one decoded char? */ if (code != TCL_OK) { @@ -6238,10 +6279,9 @@ ReadChars( } } else if (statePtr->flags & CHANNEL_EOF) { - /* - * The bare \r is the only char and we will never read - * a subsequent char to make the determination. + * The bare \r is the only char and we will never read a + * subsequent char to make the determination. */ dst[0] = '\r'; @@ -6251,8 +6291,8 @@ ReadChars( } /* - * Revise the dstRead value so that the numChars calc - * below correctly computes zero characters read. + * Revise the dstRead value so that the numChars calc below + * correctly computes zero characters read. */ dstRead = numChars; @@ -6261,9 +6301,9 @@ ReadChars( } /* - * The translation transformation can only reduce the number - * of chars when it converts \r\n into \n. The reduction in - * the number of chars is the difference in bytes read and written. + * The translation transformation can only reduce the number of chars + * when it converts \r\n into \n. The reduction in the number of chars + * is the difference in bytes read and written. */ numChars -= (dstRead - dstWrote); @@ -6273,10 +6313,9 @@ ReadChars( /* * TODO: This cannot happen anymore. * - * We read more chars than allowed. Reset limits to - * prevent that and try again. Don't forget the extra - * padding of TCL_UTF_MAX bytes demanded by the - * Tcl_ExternalToUtf() call! + * We read more chars than allowed. Reset limits to prevent that + * and try again. Don't forget the extra padding of TCL_UTF_MAX + * bytes demanded by the Tcl_ExternalToUtf() call! */ dstLimit = Tcl_UtfAtIndex(dst, charsToRead) - 1 + TCL_UTF_MAX - dst; @@ -6289,18 +6328,19 @@ ReadChars( if (dstWrote == 0) { ChannelBuffer *nextPtr; - /* We were not able to read any chars. */ + /* + * We were not able to read any chars. + */ - assert (numChars == 0); + assert(numChars == 0); /* - * There is one situation where this is the correct final - * result. If the src buffer contains only a single \n - * byte, and we are in TCL_TRANSLATE_AUTO mode, and - * when the translation pass was made the INPUT_SAW_CR - * flag was set on the channel. In that case, the - * correct behavior is to consume that \n and produce the - * empty string. + * There is one situation where this is the correct final result. + * If the src buffer contains only a single \n byte, and we are in + * TCL_TRANSLATE_AUTO mode, and when the translation pass was made + * the INPUT_SAW_CR flag was set on the channel. In that case, the + * correct behavior is to consume that \n and produce the empty + * string. */ if (dstRead == 1 && dst[0] == '\n') { @@ -6309,12 +6349,13 @@ ReadChars( goto consume; } - /* Otherwise, reading zero characters indicates there's - * something incomplete at the end of the src buffer. - * Maybe there were not enough src bytes to decode into - * a char. Maybe a lone \r could not be translated (crlf - * mode). Need to combine any unused src bytes we have - * in the first buffer with subsequent bytes to try again. + /* + * Otherwise, reading zero characters indicates there's something + * incomplete at the end of the src buffer. Maybe there were not + * enough src bytes to decode into a char. Maybe a lone \r could + * not be translated (crlf mode). Need to combine any unused src + * bytes we have in the first buffer with subsequent bytes to try + * again. */ nextPtr = bufPtr->nextPtr; @@ -6329,15 +6370,15 @@ ReadChars( /* * Space is made at the beginning of the buffer to copy the - * previous unused bytes there. Check first if the buffer we - * are using actually has enough space at its beginning for - * the data we are copying. Because if not we will write over - * the buffer management information, especially the 'nextPtr'. + * previous unused bytes there. Check first if the buffer we are + * using actually has enough space at its beginning for the data + * we are copying. Because if not we will write over the buffer + * management information, especially the 'nextPtr'. * - * Note that the BUFFER_PADDING (See AllocChannelBuffer) is - * used to prevent exactly this situation. I.e. it should never - * happen. Therefore it is ok to panic should it happen despite - * the precautions. + * Note that the BUFFER_PADDING (See AllocChannelBuffer) is used + * to prevent exactly this situation. I.e. it should never happen. + * Therefore it is ok to panic should it happen despite the + * precautions. */ if (nextPtr->nextRemoved - srcLen < 0) { @@ -6356,10 +6397,12 @@ ReadChars( consume: bufPtr->nextRemoved += srcRead; + /* - * If this read contained multibyte characters, revise factorPtr - * so the next read will allocate bigger buffers. + * If this read contained multibyte characters, revise factorPtr so + * the next read will allocate bigger buffers. */ + if (numChars && numChars < srcRead) { *factorPtr = srcRead * UTF_EXPANSION_FACTOR / numChars; } @@ -6407,22 +6450,27 @@ TranslateInputEOL( int inEofChar = statePtr->inEofChar; /* - * Depending on the translation mode in use, there's no need - * to scan more srcLen bytes at srcStart than can possibly transform - * to dstLen bytes. This keeps the scan for eof char below from - * being pointlessly long. + * Depending on the translation mode in use, there's no need to scan more + * srcLen bytes at srcStart than can possibly transform to dstLen bytes. + * This keeps the scan for eof char below from being pointlessly long. */ switch (statePtr->inputTranslation) { case TCL_TRANSLATE_LF: case TCL_TRANSLATE_CR: if (srcLen > dstLen) { - /* In these modes, each src byte become a dst byte. */ + /* + * In these modes, each src byte become a dst byte. + */ + srcLen = dstLen; } break; default: - /* In other modes, at most 2 src bytes become a dst byte. */ + /* + * In other modes, at most 2 src bytes become a dst byte. + */ + if (srcLen/2 > dstLen) { srcLen = 2 * dstLen; } @@ -6755,7 +6803,7 @@ GetInput( * eofchar. */ - assert( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); /* * Prevent reading from a dead channel -- a channel that has been closed @@ -6769,24 +6817,21 @@ GetInput( } /* - * WARNING: There was once a comment here claiming that it was - * a bad idea to make another call to the inputproc of a channel - * driver when EOF has already been detected on the channel. Through - * much of Tcl's history, this warning was then completely negated - * by having all (most?) read paths clear the EOF setting before - * reaching here. So we had a guard that was never triggered. + * WARNING: There was once a comment here claiming that it was a bad idea + * to make another call to the inputproc of a channel driver when EOF has + * already been detected on the channel. Through much of Tcl's history, + * this warning was then completely negated by having all (most?) read + * paths clear the EOF setting before reaching here. So we had a guard + * that was never triggered. + * + * Don't be tempted to restore the guard. Even if EOF is set on the + * channel, continue through and call the inputproc again. This is the + * way to enable the ability to [read] again beyond the EOF, which seems a + * strange thing to do, but for which use cases exist [Tcl Bug 5adc350683] + * and which may even be essential for channels representing things like + * ttys or other devices where the stream might take the logical form of a + * series of 'files' separated by an EOF condition. * - * Don't be tempted to restore the guard. Even if EOF is set on - * the channel, continue through and call the inputproc again. This - * is the way to enable the ability to [read] again beyond the EOF, - * which seems a strange thing to do, but for which use cases exist - * [Tcl Bug 5adc350683] and which may even be essential for channels - * representing things like ttys or other devices where the stream - * might take the logical form of a series of 'files' separated by - * an EOF condition. - */ - - /* * First check for more buffers in the pushback area of the topmost * channel in the stack and use them. They can be the result of a * transformation which went away without reading all the information @@ -6794,7 +6839,6 @@ GetInput( */ if (chanPtr->inQueueHead != NULL) { - /* TODO: Tests to cover this. */ assert(statePtr->inQueueHead == NULL); @@ -6824,8 +6868,9 @@ GetInput( /* * Check the actual buffersize against the requested buffersize. - * Saved buffers of the wrong size are squashed. This is done - * to honor dynamic changes of the buffersize made by the user. + * Saved buffers of the wrong size are squashed. This is done to honor + * dynamic changes of the buffersize made by the user. + * * TODO: Tests to cover this. */ @@ -7132,7 +7177,7 @@ Tcl_Tell( * Truncate a channel to the given length. * * Results: - * TCL_OK on success, TCL_ERROR if the operation failed (e.g. is not + * TCL_OK on success, TCL_ERROR if the operation failed (e.g., is not * supported by the type of channel, or the underlying OS operation * failed in some way). * @@ -9492,7 +9537,10 @@ CopyData( } if (size == 0) { if (!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)) { - /* We allowed a short read. Keep trying. */ + /* + * We allowed a short read. Keep trying. + */ + continue; } if (bufObj != NULL) { @@ -9706,7 +9754,7 @@ DoRead( ChannelState *statePtr = chanPtr->state; char *p = dst; - assert (bytesToRead >= 0); + assert(bytesToRead >= 0); /* * Early out when we know a read will get the eofchar. @@ -9722,15 +9770,18 @@ DoRead( if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: Don't need this call */ UpdateInterest(chanPtr); return 0; } - /* Special handling for zero-char read request. */ + /* + * Special handling for zero-char read request. + */ + if (bytesToRead == 0) { if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; @@ -9745,8 +9796,8 @@ DoRead( TclChannelPreserve((Tcl_Channel)chanPtr); while (bytesToRead) { /* - * Each pass through the loop is intended to process up to - * one channel buffer. + * Each pass through the loop is intended to process up to one channel + * buffer. */ int bytesRead, bytesWritten; @@ -9758,33 +9809,39 @@ DoRead( while (!bufPtr || /* We got no buffer! OR */ (!IsBufferFull(bufPtr) && /* Our buffer has room AND */ - (BytesLeft(bufPtr) < bytesToRead) ) ) { - /* Not enough bytes in it - * yet to fill the dst */ + (BytesLeft(bufPtr) < bytesToRead))) { + /* Not enough bytes in it yet + * to fill the dst */ int code; moreData: code = GetInput(chanPtr); bufPtr = statePtr->inQueueHead; - assert (bufPtr != NULL); + assert(bufPtr != NULL); if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) { - /* Further reads cannot do any more */ + /* + * Further reads cannot do any more. + */ + break; } if (code) { - /* Read error */ + /* + * Read error + */ + UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return -1; } - assert (IsBufferFull(bufPtr)); + assert(IsBufferFull(bufPtr)); } - assert (bufPtr != NULL); + assert(bufPtr != NULL); bytesRead = BytesLeft(bufPtr); bytesWritten = bytesToRead; @@ -9799,8 +9856,8 @@ DoRead( /* * Buffer is not empty. How can that be? * - * 0) We stopped early because we got all the bytes - * we were seeking. That's fine. + * 0) We stopped early because we got all the bytes we were + * seeking. That's fine. */ if (bytesToRead == 0) { @@ -9816,8 +9873,8 @@ DoRead( } /* - * 2) The buffer holds a \r while in CRLF translation, - * followed by the end of the buffer. + * 2) The buffer holds a \r while in CRLF translation, followed by + * the end of the buffer. */ assert(statePtr->inputTranslation == TCL_TRANSLATE_CRLF); @@ -9825,26 +9882,38 @@ DoRead( assert(BytesLeft(bufPtr) == 1); if (bufPtr->nextPtr == NULL) { - /* There's no more buffered data.... */ + /* + * There's no more buffered data... + */ if (statePtr->flags & CHANNEL_EOF) { - /* ...and there never will be. */ + /* + * ...and there never will be. + */ *p++ = '\r'; bytesToRead--; bufPtr->nextRemoved++; } else if (statePtr->flags & CHANNEL_BLOCKED) { - /* ...and we cannot get more now. */ + /* + * ...and we cannot get more now. + */ + SetFlag(statePtr, CHANNEL_NEED_MORE_DATA); break; } else { - /* ... so we need to get some. */ + /* + * ...so we need to get some. + */ + goto moreData; } } if (bufPtr->nextPtr) { - /* There's a next buffer. Shift orphan \r to it. */ + /* + * There's a next buffer. Shift orphan \r to it. + */ ChannelBuffer *nextPtr = bufPtr->nextPtr; @@ -9869,8 +9938,8 @@ DoRead( } /* - * When there's no buffered data to read, and we're at EOF, - * escape to the caller. + * When there's no buffered data to read, and we're at EOF, escape to + * the caller. */ if (GotFlag(statePtr, CHANNEL_EOF) @@ -9882,11 +9951,11 @@ DoRead( ResetFlag(statePtr, CHANNEL_BLOCKED); } - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return (int)(p - dst); diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 2fed3f4..433fb6f 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -851,11 +851,12 @@ TclChanPostEventObjCmd( } /* - * Note that the search above subsumes several of the older checks, namely: + * Note that the search above subsumes several of the older checks, + * namely: * - * (1) Does the channel handle refer to a reflected channel ? + * (1) Does the channel handle refer to a reflected channel? * (2) Is the post event issued from the interpreter holding the handler - * of the reflected channel ? + * of the reflected channel? * * A successful search answers yes to both. Because the map holds only * handles of reflected channels, and only of such whose handler is @@ -939,7 +940,8 @@ TclChanPostEventObjCmd( (void) GetThreadReflectedChannelMap(); - /* XXX Race condition !! + /* + * XXX Race condition !! * XXX The destination thread may not exist anymore already. * XXX (Delayed postevent executed after channel got removed). * XXX Can we detect this ? (check the validity of the owner threadid ?) @@ -1221,8 +1223,8 @@ ReflectClose( #endif tctPtr = ((Channel *)rcPtr->chan)->typePtr; if (tctPtr && tctPtr != &tclRChannelType) { - ckfree(tctPtr); - ((Channel *)rcPtr->chan)->typePtr = NULL; + ckfree(tctPtr); + ((Channel *)rcPtr->chan)->typePtr = NULL; } Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); return (result == TCL_OK) ? EOK : EINVAL; @@ -1272,7 +1274,10 @@ ReflectInput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { - /* No error message, this is an errno signal. */ + /* + * No error message, this is an errno signal. + */ + *errorCodePtr = -p.base.code; } else { PassReceivedError(rcPtr->chan, &p); @@ -1375,7 +1380,10 @@ ReflectOutput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { - /* No error message, this is an errno signal. */ + /* + * No error message, this is an errno signal. + */ + *errorCodePtr = -p.base.code; } else { PassReceivedError(rcPtr->chan, &p); @@ -1426,8 +1434,8 @@ ReflectOutput( if ((written == 0) && (toWrite > 0)) { /* - * The handler claims to have written nothing of what it was - * given. That is bad. + * The handler claims to have written nothing of what it was given. + * That is bad. */ SetChannelErrorStr(rcPtr->chan, msg_write_nothing); @@ -2373,8 +2381,8 @@ InvokeTclMethod( * None. * * Users: - * ReflectInput/Output(), to enable the signaling of EAGAIN - * on 0-sized short reads/writes. + * ReflectInput/Output(), to enable the signaling of EAGAIN on 0-sized + * short reads/writes. * *---------------------------------------------------------------------- */ @@ -2560,7 +2568,10 @@ DeleteReflectedChannelMap( evPtr = resultPtr->evPtr; - /* Basic crash safety until this routine can get revised [3411310] */ + /* + * Basic crash safety until this routine can get revised [3411310] + */ + if (evPtr == NULL) { continue; } @@ -2675,8 +2686,8 @@ DeleteThreadReflectedChannelMap( /* * Go through the list of pending results and cancel all whose events were - * destined for this thread. While this is in progress we block any - * other access to the list of pending results. + * destined for this thread. While this is in progress we block any other + * access to the list of pending results. */ Tcl_MutexLock(&rcForwardMutex); @@ -2707,7 +2718,10 @@ DeleteThreadReflectedChannelMap( evPtr = resultPtr->evPtr; - /* Basic crash safety until this routine can get revised [3411310] */ + /* + * Basic crash safety until this routine can get revised [3411310] + */ + if (evPtr == NULL ) { continue; } @@ -2761,8 +2775,8 @@ ForwardOpToHandlerThread( const void *param) /* Arguments */ { /* - * Core of the communication from OWNER to HANDLER thread. - * The receiver is ForwardProc() below. + * Core of the communication from OWNER to HANDLER thread. The receiver is + * ForwardProc() below. */ Tcl_ThreadId dst = rcPtr->thread; @@ -2812,7 +2826,10 @@ ForwardOpToHandlerThread( */ TclSpliceIn(resultPtr, forwardList); - /* Do not unlock here. That is done by the ConditionWait */ + + /* + * Do not unlock here. That is done by the ConditionWait. + */ /* * Ensure cleanup of the event if the origin thread exits while this event @@ -2888,7 +2905,7 @@ ForwardProc( * Notes regarding access to the referenced data. * * In principle the data belongs to the originating thread (see - * evPtr->src), however this thread is currently blocked at (*), i.e. + * evPtr->src), however this thread is currently blocked at (*), i.e., * quiescent. Because of this we can treat the data as belonging to us, * without fear of race conditions. I.e. we can read and write as we like. * diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index de5d62d..5f79e6e 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -611,6 +611,7 @@ FsRecacheFilesystemList(void) while (toFree) { FilesystemRecord *next = toFree->nextPtr; + toFree->fsPtr = NULL; ckfree(toFree); toFree = next; @@ -672,7 +673,6 @@ TclFSEpoch(void) return tsdPtr->filesystemEpoch; } - /* * If non-NULL, clientData is owned by us and must be freed later. @@ -784,7 +784,9 @@ TclFinalizeFilesystem(void) while (fsRecPtr != NULL) { FilesystemRecord *tmpFsRecPtr = fsRecPtr->nextPtr; - /* The native filesystem is static, so we don't free it. */ + /* + * The native filesystem is static, so we don't free it. + */ if (fsRecPtr != &nativeFilesystemRecord) { ckfree(fsRecPtr); @@ -947,7 +949,7 @@ Tcl_FSRegister( int Tcl_FSUnregister( - const Tcl_Filesystem *fsPtr) /* The filesystem record to remove. */ + const Tcl_Filesystem *fsPtr)/* The filesystem record to remove. */ { int retVal = TCL_ERROR; FilesystemRecord *fsRecPtr; @@ -1233,7 +1235,7 @@ FsAddMountsToGlobResult( len--; } - len++; /* account for '/' in the mElt [Bug 1602539] */ + len++; /* account for '/' in the mElt [Bug 1602539] */ mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len); Tcl_ListObjAppendElement(NULL, resultPtr, mElt); } @@ -1403,7 +1405,7 @@ TclFSNormalizeToUniquePath( * Call each of the "normalise path" functions in succession. This is a * special case, in which if we have a native filesystem handler, we call * it first. This is because the root of Tcl's filesystem is always a - * native filesystem (i.e. '/' on unix is native). + * native filesystem (i.e., '/' on unix is native). */ firstFsRecPtr = FsGetFirstFilesystem(); @@ -1525,7 +1527,7 @@ TclGetOpenModeEx( #define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR) /* - * Check for the simpler fopen-like access modes (e.g. "r"). They are + * Check for the simpler fopen-like access modes (e.g., "r"). They are * distinguished from the POSIX access modes by the presence of a * lower-case first letter. */ @@ -2671,6 +2673,7 @@ Tcl_FSGetCwd( fsRecPtr = fsRecPtr->nextPtr) { ClientData retCd; TclFSGetCwdProc2 *proc2; + if (fsRecPtr->fsPtr->getCwdProc == NULL) { continue; } @@ -3143,8 +3146,8 @@ Tcl_FSLoadFile( * Workaround for issue with modern HPUX which do allow the unlink (no ETXTBSY * error) yet somehow trash some internal data structures which prevents the * second and further shared libraries from getting properly loaded. Only the - * first is ok. We try to get around the issue by not unlinking, - * i.e. emulating the behaviour of the older HPUX which denied removal. + * first is ok. We try to get around the issue by not unlinking, i.e., + * emulating the behaviour of the older HPUX which denied removal. * * Doing the unlink is also an issue within docker containers, whose AUFS * bungles this as well, see @@ -3162,28 +3165,30 @@ Tcl_FSLoadFile( */ int -TclSkipUnlink (Tcl_Obj* shlibFile) +TclSkipUnlink( + Tcl_Obj *shlibFile) { - /* Order of testing: + /* + * Order of testing: * 1. On hpux we generally want to skip unlink in general * * Outside of hpux then: - * 2. For a general user request (TCL_TEMPLOAD_NO_UNLINK present, non-empty, => int) + * 2. For a general user request (TCL_TEMPLOAD_NO_UNLINK present, + * non-empty, => int) * 3. For general AUFS environment (statfs, if available). * * Ad 2: This variable can disable/override the AUFS detection, i.e. for - * testing if a newer AUFS does not have the bug any more. + * testing if a newer AUFS does not have the bug any more. * - * Ad 3: This is conditionally compiled in. Condition currently must be set manually. - * This part needs proper tests in the configure(.in). + * Ad 3: This is conditionally compiled in. Condition currently must be + * set manually. This part needs proper tests in the configure(.in). */ #ifdef hpux return 1; #else - char* skipstr; + char *skipstr = getenv("TCL_TEMPLOAD_NO_UNLINK"); - skipstr = getenv ("TCL_TEMPLOAD_NO_UNLINK"); if (skipstr && (skipstr[0] != '\0')) { return atoi(skipstr); } @@ -3192,7 +3197,8 @@ TclSkipUnlink (Tcl_Obj* shlibFile) #ifndef NO_FSTATFS { struct statfs fs; - /* Have fstatfs. May not have the AUFS super magic ... Indeed our build + /* + * Have fstatfs. May not have the AUFS super magic ... Indeed our build * box is too old to have it directly in the headers. Define taken from * http://mooon.googlecode.com/svn/trunk/linux_include/linux/aufs_type.h * http://aufs.sourceforge.net/ @@ -3209,8 +3215,10 @@ TclSkipUnlink (Tcl_Obj* shlibFile) #endif /* ... NO_FSTATFS */ #endif /* ... TCL_TEMPLOAD_NO_UNLINK */ - /* Fallback: !hpux, no EV override, no AUFS (detection, nor detected): - * Don't skip */ + /* + * Fallback: !hpux, no EV override, no AUFS (detection, nor detected): + * Don't skip + */ return 0; #endif /* hpux */ } @@ -3415,9 +3423,8 @@ Tcl_LoadFile( * avoids any worries about leaving the copy laying around on exit. */ - if ( - !TclSkipUnlink (copyToPtr) && - (Tcl_FSDeleteFile(copyToPtr) == TCL_OK)) { + if (!TclSkipUnlink(copyToPtr) && + (Tcl_FSDeleteFile(copyToPtr) == TCL_OK)) { Tcl_DecrRefCount(copyToPtr); /* diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 6d3938b..3467305 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -1053,11 +1053,17 @@ AfterDelay( if (diff > TCL_TIME_MAXIMUM_SLICE) { diff = TCL_TIME_MAXIMUM_SLICE; } - if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) diff = 1; + if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) { + diff = 1; + } if (diff > 0) { Tcl_Sleep((long) diff); - if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) break; - } else break; + if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) { + break; + } + } else { + break; + } } else { diff = TCL_TIME_DIFF_MS(iPtr->limit.time, now); #ifndef TCL_WIDE_INT_IS_LONG diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 0ae500b..b404080 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -19,6 +19,7 @@ #define SET_BITS(var, bits) ((var) |= (bits)) #define CLEAR_BITS(var, bits) ((var) &= ~(bits)) +#define GOT_BITS(var, bits) (((var) & (bits)) != 0) /* "sock" + a pointer in hex + \0 */ #define SOCK_CHAN_LENGTH (4 + sizeof(void *) * 2 + 1) @@ -99,9 +100,9 @@ struct TcpState { * structure. */ -#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated - * Do not automatically continue connection - * process */ +#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated. Do not + * automatically continue connection + * process. */ /* * The following defines the maximum length of the listen queue. This is the @@ -389,7 +390,7 @@ TcpBlockModeProc( } else { SET_BITS(statePtr->flags, TCP_NONBLOCKING); } - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { statePtr->cachedBlocking = mode; return 0; } @@ -442,7 +443,7 @@ WaitForConnect( * demanded, return the error ENOTCONN */ - if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) { + if (errorCodePtr != NULL && GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { *errorCodePtr = ENOTCONN; return -1; } @@ -451,24 +452,25 @@ WaitForConnect( * Check if an async connect is running. If not return ok */ - if (!(statePtr->flags & TCP_ASYNC_PENDING)) { + if (!GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { return 0; } /* - * In socket test mode do not continue with the connect + * In socket test mode do not continue with the connect. * Exceptions are: * - Call by recv/send and blocking socket - * (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING) + * (errorCodePtr != NULL && !GOT_BITS(flags, TCP_NONBLOCKING)) */ - if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE) - && ! (errorCodePtr != NULL && ! (statePtr->flags & TCP_NONBLOCKING))) { + if (GOT_BITS(statePtr->testFlags, TCP_ASYNC_TEST_MODE) + && !(errorCodePtr != NULL + && !GOT_BITS(statePtr->flags, TCP_NONBLOCKING))) { *errorCodePtr = EWOULDBLOCK; return -1; } - if (errorCodePtr == NULL || (statePtr->flags & TCP_NONBLOCKING)) { + if (errorCodePtr == NULL || GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { timeout = 0; } else { timeout = -1; @@ -483,10 +485,10 @@ WaitForConnect( * Do this only once in the nonblocking case and repeat it until the * socket is final when blocking. */ - } while (timeout == -1 && statePtr->flags & TCP_ASYNC_CONNECT); + } while (timeout == -1 && GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)); if (errorCodePtr != NULL) { - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { *errorCodePtr = EAGAIN; return -1; } else if (statePtr->connectError != 0) { @@ -832,7 +834,7 @@ TcpGetOptionProc( (strncmp(optionName, "-error", len) == 0)) { socklen_t optlen = sizeof(int); - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * Suppress errors as long as we are not done. */ @@ -856,9 +858,8 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'c') && (strncmp(optionName, "-connecting", len) == 0)) { - Tcl_DStringAppend(dsPtr, - (statePtr->flags & TCP_ASYNC_CONNECT) ? "1" : "0", -1); + GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT) ? "1" : "0", -1); return TCL_OK; } @@ -867,7 +868,7 @@ TcpGetOptionProc( address peername; socklen_t size = sizeof(peername); - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * In async connect output an empty string */ @@ -922,7 +923,7 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * In async connect output an empty string */ @@ -1024,7 +1025,7 @@ TcpWatchProc( return; } - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * Async sockets use a FileHandler internally while connecting, so we * need to cache this request until the connection has succeeded. @@ -1149,9 +1150,9 @@ TcpConnect( TcpState *statePtr) { socklen_t optlen; - int async_callback = statePtr->flags & TCP_ASYNC_PENDING; + int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING); int ret = -1, error = EHOSTUNREACH; - int async = statePtr->flags & TCP_ASYNC_CONNECT; + int async = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT); if (async_callback) { goto reenter; @@ -1159,7 +1160,6 @@ TcpConnect( for (statePtr->addr = statePtr->addrlist; statePtr->addr != NULL; statePtr->addr = statePtr->addr->ai_next) { - for (statePtr->myaddr = statePtr->myaddrlist; statePtr->myaddr != NULL; statePtr->myaddr = statePtr->myaddr->ai_next) { @@ -1580,13 +1580,13 @@ Tcl_OpenTcpServerEx( * Set up to reuse server addresses and/or ports if requested. */ - if (flags & TCL_TCPSERVER_REUSEADDR) { + if (GOT_BITS(flags, TCL_TCPSERVER_REUSEADDR)) { optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &optvalue, sizeof(optvalue)); } - if (flags & TCL_TCPSERVER_REUSEPORT) { + if (GOT_BITS(flags, TCL_TCPSERVER_REUSEPORT)) { #ifndef SO_REUSEPORT /* * If the platform doesn't support the SO_REUSEPORT flag we can't diff --git a/win/tclWinSock.c b/win/tclWinSock.c index a5d98ae..8e0f7d0 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -69,6 +69,7 @@ #define SET_BITS(var, bits) ((var) |= (bits)) #define CLEAR_BITS(var, bits) ((var) &= ~(bits)) +#define GOT_BITS(var, bits) (((var) & (bits)) != 0) /* "sock" + a pointer in hex + \0 */ #define SOCK_CHAN_LENGTH (4 + sizeof(void *) * 2 + 1) @@ -190,8 +191,8 @@ struct TcpState { * structure. */ -#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated - * Do not automatically continue connection +#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated. Do not + * automatically continue connection * process */ /* @@ -303,6 +304,15 @@ static const Tcl_ChannelType tcpChannelType = { static TclInitProcessGlobalValueProc InitializeHostName; static ProcessGlobalValue hostName = {0, 0, NULL, NULL, InitializeHostName, NULL, NULL}; + +/* + * Simple wrapper round the SendMessage syscall. + */ + +#define SendSelectMessage(tsdPtr, message, payload) \ + SendMessage((tsdPtr)->hwnd, SOCKET_SELECT, \ + (WPARAM) (message), (LPARAM) (payload)) + /* * Address print debug functions @@ -596,7 +606,7 @@ WaitForConnect( * demanded, return the error ENOTCONN. */ - if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) { + if (errorCodePtr != NULL && GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { *errorCodePtr = ENOTCONN; return -1; } @@ -605,7 +615,7 @@ WaitForConnect( * Check if an async connect is running. If not return ok */ - if (!(statePtr->flags & TCP_ASYNC_CONNECT)) { + if (!GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { return 0; } @@ -613,12 +623,13 @@ WaitForConnect( * In socket test mode do not continue with the connect * Exceptions are: * - Call by recv/send and blocking socket - * (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING) + * (errorCodePtr != NULL && !GOT_BITS(flags, TCP_NONBLOCKING)) * - Call by the event queue (errorCodePtr == NULL) */ - if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE) - && errorCodePtr != NULL && (statePtr->flags & TCP_NONBLOCKING)) { + if (GOT_BITS(statePtr->testFlags, TCP_ASYNC_TEST_MODE) + && errorCodePtr != NULL + && GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { *errorCodePtr = EWOULDBLOCK; return -1; } @@ -645,7 +656,7 @@ WaitForConnect( * Check for connect event. */ - if (statePtr->readyEvents & FD_CONNECT) { + if (GOT_BITS(statePtr->readyEvents, FD_CONNECT)) { /* * Consume the connect event. */ @@ -658,7 +669,7 @@ WaitForConnect( */ if (errorCodePtr != NULL && - !(statePtr->flags & TCP_NONBLOCKING)) { + !GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { CLEAR_BITS(statePtr->flags, TCP_ASYNC_CONNECT); } @@ -691,7 +702,7 @@ WaitForConnect( * foreground blocking operation) */ - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { if (errorCodePtr != NULL) { *errorCodePtr = EWOULDBLOCK; } @@ -731,7 +742,7 @@ WaitForConnect( * directly the error EWOULDBLOCK. */ - if (statePtr->flags & TCP_NONBLOCKING) { + if (GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { *errorCodePtr = EWOULDBLOCK; return -1; } @@ -795,7 +806,7 @@ TcpInputProc( * socket stack after the first time EOF is detected. */ - if (statePtr->flags & SOCKET_EOF) { + if (GOT_BITS(statePtr->flags, SOCKET_EOF)) { return 0; } @@ -818,8 +829,8 @@ TcpInputProc( */ while (1) { - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) UNSELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); + /* * Single fd operation: this proc is only called for a connected * socket. @@ -844,7 +855,7 @@ TcpInputProc( * error and report an EOF. */ - if (statePtr->readyEvents & FD_CLOSE) { + if (GOT_BITS(statePtr->readyEvents, FD_CLOSE)) { SET_BITS(statePtr->flags, SOCKET_EOF); bytesRead = 0; break; @@ -867,7 +878,8 @@ TcpInputProc( * Check for error condition or underflow in non-blocking case. */ - if ((statePtr->flags & TCP_NONBLOCKING) || (error != WSAEWOULDBLOCK)) { + if (GOT_BITS(statePtr->flags, TCP_NONBLOCKING) + || (error != WSAEWOULDBLOCK)) { TclWinConvertError(error); *errorCodePtr = Tcl_GetErrno(); bytesRead = -1; @@ -885,7 +897,7 @@ TcpInputProc( } } - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, (LPARAM)statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); return bytesRead; } @@ -943,8 +955,7 @@ TcpOutputProc( } while (1) { - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) UNSELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); /* * Single fd operation: this proc is only called for a connected @@ -959,8 +970,9 @@ TcpOutputProc( * until the condition changes. */ - if (statePtr->watchEvents & FD_WRITE) { + if (GOT_BITS(statePtr->watchEvents, FD_WRITE)) { Tcl_Time blockTime = { 0, 0 }; + Tcl_SetMaxBlockTime(&blockTime); } break; @@ -976,7 +988,7 @@ TcpOutputProc( error = WSAGetLastError(); if (error == WSAEWOULDBLOCK) { CLEAR_BITS(statePtr->readyEvents, FD_WRITE); - if (statePtr->flags & TCP_NONBLOCKING) { + if (GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { *errorCodePtr = EWOULDBLOCK; written = -1; break; @@ -999,8 +1011,7 @@ TcpOutputProc( } } - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, - (LPARAM)statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); return written; } @@ -1317,7 +1328,7 @@ TcpGetOptionProc( * below. */ - if (! (statePtr->testFlags & TCP_ASYNC_TEST_MODE) ) { + if (!GOT_BITS(statePtr->testFlags, TCP_ASYNC_TEST_MODE)) { WaitForConnect(statePtr, NULL); } @@ -1332,8 +1343,8 @@ TcpGetOptionProc( * Do not return any errors if async connect is running. */ - if (!(statePtr->flags & TCP_ASYNC_PENDING)) { - if (statePtr->flags & TCP_ASYNC_FAILED) { + if (!GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { /* * In case of a failed async connect, eventually report the * connect error only once. Do not report the system error, @@ -1388,7 +1399,7 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'c') && (strncmp(optionName, "-connecting", len) == 0)) { Tcl_DStringAppend(dsPtr, - (statePtr->flags & TCP_ASYNC_PENDING) + GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING) ? "1" : "0", -1); return TCL_OK; } @@ -1403,7 +1414,7 @@ TcpGetOptionProc( address peername; socklen_t size = sizeof(peername); - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * In async connect output an empty string */ @@ -1468,7 +1479,7 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * In async connect output an empty string */ @@ -1617,10 +1628,10 @@ TcpWatchProc( if (!statePtr->acceptProc) { statePtr->watchEvents = 0; - if (mask & TCL_READABLE) { + if (GOT_BITS(mask, TCL_READABLE)) { SET_BITS(statePtr->watchEvents, FD_READ | FD_CLOSE); } - if (mask & TCL_WRITABLE) { + if (GOT_BITS(mask, TCL_WRITABLE)) { SET_BITS(statePtr->watchEvents, FD_WRITE | FD_CLOSE); } @@ -1712,11 +1723,11 @@ TcpConnect( TcpState *statePtr) { DWORD error; - int async_connect = statePtr->flags & TCP_ASYNC_CONNECT; + int async_connect = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT); /* We are started with async connect and the * connect notification was not yet * received. */ - int async_callback = statePtr->flags & TCP_ASYNC_PENDING; + int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING); /* We were called by the event procedure and * continue our loop. */ ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); @@ -1860,8 +1871,7 @@ TcpConnect( * Activate accept notification. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); } /* @@ -1957,8 +1967,7 @@ TcpConnect( * automatically places the socket into non-blocking mode. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); } else { /* * Connect failed @@ -2155,8 +2164,7 @@ Tcl_MakeTcpClientChannel( */ statePtr->selectEvents = FD_READ | FD_CLOSE | FD_WRITE; - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, - (LPARAM)statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); sprintf(channelName, SOCK_TEMPLATE, statePtr); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, @@ -2270,7 +2278,7 @@ Tcl_OpenTcpServerEx( * unix systems. */ - if (flags & TCL_TCPSERVER_REUSEPORT) { + if (GOT_BITS(flags, TCL_TCPSERVER_REUSEPORT)) { optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &optvalue, sizeof(optvalue)); @@ -2352,8 +2360,7 @@ Tcl_OpenTcpServerEx( */ ioctlsocket(sock, (long) FIONBIO, &flag); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); if (Tcl_SetChannelOption(interp, statePtr->channel, "-eofchar", "") == TCL_ERROR) { Tcl_Close(NULL, statePtr->channel); @@ -2422,8 +2429,7 @@ TcpAccept( */ newInfoPtr->selectEvents = (FD_READ | FD_WRITE | FD_CLOSE); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) newInfoPtr); + SendSelectMessage(tsdPtr, SELECT, newInfoPtr); sprintf(channelName, SOCK_TEMPLATE, newInfoPtr); newInfoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, @@ -2654,7 +2660,7 @@ SocketSetupProc( Tcl_Time blockTime = { 0, 0 }; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if (!(flags & TCL_FILE_EVENTS)) { + if (!GET_BITS(flags, TCL_FILE_EVENTS)) { return; } @@ -2664,9 +2670,8 @@ SocketSetupProc( WaitForSingleObject(tsdPtr->socketListLock, INFINITE); for (statePtr = tsdPtr->socketList; statePtr != NULL; statePtr = statePtr->nextPtr) { - if (statePtr->readyEvents & - (statePtr->watchEvents | FD_CONNECT | FD_ACCEPT) - ) { + if (GOT_BITS(statePtr->readyEvents, + statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)) { Tcl_SetMaxBlockTime(&blockTime); break; } @@ -2700,7 +2705,7 @@ SocketCheckProc( SocketEvent *evPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if (!(flags & TCL_FILE_EVENTS)) { + if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return; } @@ -2713,9 +2718,9 @@ SocketCheckProc( WaitForSingleObject(tsdPtr->socketListLock, INFINITE); for (statePtr = tsdPtr->socketList; statePtr != NULL; statePtr = statePtr->nextPtr) { - if ((statePtr->readyEvents & - (statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)) - && !(statePtr->flags & SOCKET_PENDING)) { + if (GOT_BITS(statePtr->readyEvents, + statePtr->watchEvents | FD_CONNECT | FD_ACCEPT) + && !GOT_BITS(statePtr->flags, SOCKET_PENDING)) { SET_BITS(statePtr->flags, SOCKET_PENDING); evPtr = ckalloc(sizeof(SocketEvent)); evPtr->header.proc = SocketEventProc; @@ -2762,7 +2767,7 @@ SocketEventProc( address addr; int len; - if (!(flags & TCL_FILE_EVENTS)) { + if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return 0; } @@ -2797,8 +2802,8 @@ SocketEventProc( * Continue async connect if pending and ready */ - if (statePtr->readyEvents & FD_CONNECT) { - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->readyEvents, FD_CONNECT)) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * Do one step and save eventual connect error */ @@ -2820,7 +2825,7 @@ SocketEventProc( * Handle connection requests directly. */ - if (statePtr->readyEvents & FD_ACCEPT) { + if (GOT_BITS(statePtr->readyEvents, FD_ACCEPT)) { for (fds = statePtr->sockets; fds != NULL; fds = fds->next) { /* * Accept the incoming connection request. @@ -2895,7 +2900,7 @@ SocketEventProc( events = statePtr->readyEvents & statePtr->watchEvents; - if (events & FD_CLOSE) { + if (GOT_BITS(events, FD_CLOSE)) { /* * If the socket was closed and the channel is still interested in * read events, then we need to ensure that we keep polling for this @@ -2910,15 +2915,13 @@ SocketEventProc( Tcl_SetMaxBlockTime(&blockTime); SET_BITS(mask, TCL_READABLE | TCL_WRITABLE); - } else if (events & FD_READ) { - + } else if (GOT_BITS(events, FD_READ)) { /* * Throw the readable event if an async connect failed. */ - if (statePtr->flags & TCP_ASYNC_FAILED) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { SET_BITS(mask, TCL_READABLE); - } else { fd_set readFds; struct timeval timeout; @@ -2931,8 +2934,7 @@ SocketEventProc( * async select handler and keep waiting. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) UNSELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); FD_ZERO(&readFds); FD_SET(statePtr->sockets->fd, &readFds); @@ -2943,8 +2945,7 @@ SocketEventProc( SET_BITS(mask, TCL_READABLE); } else { CLEAR_BITS(statePtr->readyEvents, FD_READ); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) SELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); } } } @@ -2953,7 +2954,7 @@ SocketEventProc( * writable event */ - if (events & FD_WRITE) { + if (GOT_BITS(events, FD_WRITE)) { SET_BITS(mask, TCL_WRITABLE); } @@ -3095,10 +3096,8 @@ WaitForSocketEvent( * Reset WSAAsyncSelect so we have a fresh set of events pending. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) UNSELECT, - (LPARAM) statePtr); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); while (1) { int event_found; @@ -3113,7 +3112,7 @@ WaitForSocketEvent( * Check if event occured. */ - event_found = (statePtr->readyEvents & events); + event_found = GOT_BITS(statePtr->readyEvents, events); /* * Free list lock. @@ -3314,14 +3313,14 @@ SocketProc( * the count if the current event is an FD_ACCEPT. */ - if (event & FD_CLOSE) { + if (GOT_BITS(event, FD_CLOSE)) { statePtr->acceptEventCount = 0; CLEAR_BITS(statePtr->readyEvents, FD_WRITE | FD_ACCEPT); - } else if (event & FD_ACCEPT) { + } else if (GOT_BITS(event, FD_ACCEPT)) { statePtr->acceptEventCount++; } - if (event & FD_CONNECT) { + if (GOT_BITS(event, FD_CONNECT)) { /* * Remember any error that occurred so we can report * connection failures. @@ -3552,8 +3551,7 @@ TcpThreadActionProc( * thread. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) notifyCmd, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, notifyCmd, statePtr); } /* -- cgit v0.12 From 26f98a5e562b865e82adcc6b7de05df4b0fa07de Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 11 Apr 2017 11:30:47 +0000 Subject: unbreak windows build (by previous commit) --- win/tclWinSock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 8e0f7d0..ee6be96 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2660,7 +2660,7 @@ SocketSetupProc( Tcl_Time blockTime = { 0, 0 }; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if (!GET_BITS(flags, TCL_FILE_EVENTS)) { + if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return; } -- cgit v0.12 From cd48f2d3131be957186014e7012d9445e2bd26ff Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 11 Apr 2017 15:20:07 +0000 Subject: Remove some unnecessary "struct" definitions and some type casts no longer necessary. No functional changes. --- generic/tclBasic.c | 2 +- generic/tclClock.c | 2 +- generic/tclEvent.c | 2 +- generic/tclIO.c | 2 +- generic/tclIOCmd.c | 5 ++--- generic/tclIORChan.c | 14 +++++++------- generic/tclIORTrans.c | 2 +- generic/tclIOSock.c | 2 +- generic/tclIOUtil.c | 2 +- generic/tclInt.h | 2 +- generic/tclNamesp.c | 2 +- generic/tclObj.c | 2 +- generic/tclRegexp.c | 4 ++-- generic/tclUtil.c | 4 ++-- 14 files changed, 23 insertions(+), 24 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b29e19e..aae7ab6 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1071,7 +1071,7 @@ Tcl_CallWhenDeleted( Interp *iPtr = (Interp *) interp; static Tcl_ThreadDataKey assocDataCounterKey; int *assocDataCounterPtr = - Tcl_GetThreadData(&assocDataCounterKey, (int)sizeof(int)); + Tcl_GetThreadData(&assocDataCounterKey, sizeof(int)); int isNew; char buffer[32 + TCL_INTEGER_SPACE]; AssocData *dPtr = ckalloc(sizeof(AssocData)); diff --git a/generic/tclClock.c b/generic/tclClock.c index ac4a4d6..d44e9dc 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -1694,7 +1694,7 @@ ThreadSafeLocalTime( * Get a thread-local buffer to hold the returned time. */ - struct tm *tmPtr = Tcl_GetThreadData(&tmKey, (int) sizeof(struct tm)); + struct tm *tmPtr = Tcl_GetThreadData(&tmKey, sizeof(struct tm)); #ifdef HAVE_LOCALTIME_R localtime_r(timePtr, tmPtr); #else diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 436db7a..49fd2ae 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -37,7 +37,7 @@ typedef struct BgError { * pending background errors for the interpreter. */ -typedef struct ErrAssocData { +typedef struct { Tcl_Interp *interp; /* Interpreter in which error occurred. */ Tcl_Obj *cmdPrefix; /* First word(s) of the handler command */ BgError *firstBgPtr; /* First in list of all background errors diff --git a/generic/tclIO.c b/generic/tclIO.c index 32fbd59..1460392 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -116,7 +116,7 @@ typedef struct CopyState { * The structure defined below is used in this file only. */ -typedef struct ThreadSpecificData { +typedef struct { NextChannelHandler *nestedHandlerPtr; /* This variable holds the list of nested * Tcl_NotifyChannel invocations. */ diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index e52200d..6e8bd09 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -25,7 +25,7 @@ typedef struct AcceptCallback { * It must be per-thread because of std channel limitations. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* Set to 1 when the module is initialized. */ Tcl_Obj *stdoutObjPtr; /* Cached stdout channel Tcl_Obj */ } ThreadSpecificData; @@ -113,7 +113,6 @@ Tcl_PutsObjCmd( int newline; /* Add a newline at end? */ int result; /* Result of puts operation. */ int mode; /* Mode in which channel is opened. */ - ThreadSpecificData *tsdPtr; switch (objc) { case 2: /* [puts $x] */ @@ -160,7 +159,7 @@ Tcl_PutsObjCmd( } if (chanObjPtr == NULL) { - tsdPtr = TCL_TSD_INIT(&dataKey); + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 433fb6f..aefa104 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -234,7 +234,7 @@ typedef enum { * sharing problems. */ -typedef struct ForwardParamBase { +typedef struct { int code; /* O: Ok/Fail of the cmd handler */ char *msgStr; /* O: Error message for handler failure */ int mustFree; /* O: True if msgStr is allocated, false if @@ -309,7 +309,7 @@ typedef struct ForwardingResult ForwardingResult; * General event structure, with reference to operation specific data. */ -typedef struct ForwardingEvent { +typedef struct { Tcl_Event event; /* Basic event data, has to be first item */ ForwardingResult *resultPtr; ForwardedOperation op; /* Forwarded driver operation */ @@ -346,7 +346,7 @@ struct ForwardingResult { * results. */ }; -typedef struct ThreadSpecificData { +typedef struct { /* * Table of all reflected channels owned by this thread. This is the * per-thread version of the per-interpreter map. @@ -723,7 +723,7 @@ TclChanCreateObjCmd( Tcl_DecrRefCount(rcPtr->name); Tcl_DecrRefCount(rcPtr->methods); Tcl_DecrRefCount(rcPtr->cmd); - ckfree((char*) rcPtr); + ckfree(rcPtr); return TCL_ERROR; #undef MODE @@ -748,7 +748,7 @@ TclChanCreateObjCmd( *---------------------------------------------------------------------- */ -typedef struct ReflectEvent { +typedef struct { Tcl_Event header; ReflectedChannel *rcPtr; int events; @@ -1223,8 +1223,8 @@ ReflectClose( #endif tctPtr = ((Channel *)rcPtr->chan)->typePtr; if (tctPtr && tctPtr != &tclRChannelType) { - ckfree(tctPtr); - ((Channel *)rcPtr->chan)->typePtr = NULL; + ckfree(tctPtr); + ((Channel *)rcPtr->chan)->typePtr = NULL; } Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); return (result == TCL_OK) ? EOK : EINVAL; diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 8375926..f198c69 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -329,7 +329,7 @@ struct ForwardingResult { * results. */ }; -typedef struct ThreadSpecificData { +typedef struct { /* * Table of all reflected transformations owned by this thread. */ diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 82d2fc1..6abfa60 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -16,7 +16,7 @@ * On Windows, we need to do proper Unicode->UTF-8 conversion. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; Tcl_DString errorMsg; /* UTF-8 encoded error-message */ } ThreadSpecificData; diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 5f79e6e..ea407ab 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -57,7 +57,7 @@ typedef struct FilesystemRecord { * this information each time the corresponding epoch counter changes. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; size_t cwdPathEpoch; size_t filesystemEpoch; diff --git a/generic/tclInt.h b/generic/tclInt.h index 1fbc541..d725688 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1357,7 +1357,7 @@ MODULE_SCOPE void TclThreadDataKeySet(Tcl_ThreadDataKey *keyPtr, */ #define TCL_TSD_INIT(keyPtr) \ - (ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData)) + Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData)) /* *---------------------------------------------------------------- diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 1e360d1..e1bad0e 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -31,7 +31,7 @@ * limited to a single interpreter. */ -typedef struct ThreadSpecificData { +typedef struct { size_t numNsCreated; /* Count of the number of namespaces created * within the thread. This value is used as a * unique id for each namespace. Cannot be diff --git a/generic/tclObj.c b/generic/tclObj.c index dfcaff0..f4b81f2 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -75,7 +75,7 @@ typedef struct ObjData { * The structure defined below is used in this file only. */ -typedef struct ThreadSpecificData { +typedef struct { Tcl_HashTable *lineCLPtr; /* This table remembers for each Tcl_Obj * generated by a call to the function * TclSubstTokens() from a literal text diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index eb23f72..5f8dc20 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -64,7 +64,7 @@ #define NUM_REGEXPS 30 -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* Set to 1 when the module is initialized. */ char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled regular * expression patterns. NULL means that this @@ -679,7 +679,7 @@ TclRegAbout( resultObj = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, resultObj, - Tcl_NewIntObj((int) regexpPtr->re.re_nsub)); + Tcl_NewWideIntObj((Tcl_WideInt) regexpPtr->re.re_nsub)); /* * Now append a list of all the bit-flags set for the RE. diff --git a/generic/tclUtil.c b/generic/tclUtil.c index a4d523a..91cc3b4 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3153,7 +3153,7 @@ Tcl_PrintDouble( int signum; char *digits; char *end; - int *precisionPtr = Tcl_GetThreadData(&precisionKey, (int) sizeof(int)); + int *precisionPtr = Tcl_GetThreadData(&precisionKey, sizeof(int)); /* * Handle NaN. @@ -3326,7 +3326,7 @@ TclPrecTraceProc( { Tcl_Obj *value; int prec; - int *precisionPtr = Tcl_GetThreadData(&precisionKey, (int) sizeof(int)); + int *precisionPtr = Tcl_GetThreadData(&precisionKey, sizeof(int)); /* * If the variable is unset, then recreate the trace. -- cgit v0.12 From 5ba18ec98dfa4afe775a3f7a7caa8d55774d907d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Apr 2017 13:43:15 +0000 Subject: If %llu is considered invalid, it means that "%" TCL_LL_MODIFIER "u" cannot be used Tcl_ObjPrintf(), but only in sprintf(). That's unfortunate, clearly an oversight in TIP #237. Conclusion: new TIP must be written to correct this. I'll read a TIP and see what case you have, but TCL_LL_MODIFIER was never meant to play any role in [format] or in Tcl_ObjPrintf(). TCL_LL_MODIFIER exists to help deal with platform differences in sprintf() calls. Tcl_ObjPrintf() in contrast ought to be consistent in its behavior across platforms and should not need such things. If that's false, then fixes to Tcl_ObjPrintf() are in order. --- generic/tclCkalloc.c | 2 +- generic/tclStringObj.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 3484a97..123d872 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -859,7 +859,7 @@ MemoryCmd( } if (strcmp(argv[1],"info") == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "%-25s %10u\n%-25s %10u\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER"u\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER "u\n", + "%-25s %10u\n%-25s %10u\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER"d\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER "d\n", "total mallocs", total_mallocs, "total frees", total_frees, "current packets allocated", current_malloc_packets, "current bytes allocated", (Tcl_WideInt)current_bytes_malloced, diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 560c169..7c898b7 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2780,7 +2780,7 @@ TclStringRepeat( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "string size overflow: unable to alloc %" - TCL_LL_MODIFIER "u bytes", + TCL_LL_MODIFIER "d bytes", (Tcl_WideUInt)STRING_SIZE(count*length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } @@ -3004,7 +3004,7 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", + TCL_LL_MODIFIER "d bytes", (Tcl_WideUInt)STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } @@ -3020,7 +3020,7 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", + TCL_LL_MODIFIER "d bytes", (Tcl_WideUInt)STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } -- cgit v0.12 From 6be0cf66e023bc64e38f0a037a3e74e5d31b18f7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 13 Apr 2017 12:20:37 +0000 Subject: Translate all \u???? sequences to their UTF-8 counterpart in *.msg files: It is faster during parsing (since no backslash-sequences have to be handled) and makes the msg-files better readable by humans. TODO: adapt tools/loadICU.tcl to generate UTF-8 in stead of those sequences. This tools seems to be out-of-date a long time already, I couldn't make it run with latest ICU. --- library/msgs/ar.msg | 84 ++++++++++++++++++++++----------------------- library/msgs/ar_jo.msg | 62 +++++++++++++++++----------------- library/msgs/ar_lb.msg | 62 +++++++++++++++++----------------- library/msgs/ar_sy.msg | 62 +++++++++++++++++----------------- library/msgs/be.msg | 80 +++++++++++++++++++++---------------------- library/msgs/bg.msg | 56 +++++++++++++++--------------- library/msgs/bn.msg | 80 +++++++++++++++++++++---------------------- library/msgs/ca.msg | 4 +-- library/msgs/cs.msg | 34 +++++++++---------- library/msgs/da.msg | 8 ++--- library/msgs/de.msg | 2 +- library/msgs/de_at.msg | 8 ++--- library/msgs/de_be.msg | 4 +-- library/msgs/el.msg | 80 +++++++++++++++++++++---------------------- library/msgs/eo.msg | 10 +++--- library/msgs/es.msg | 8 ++--- library/msgs/et.msg | 16 ++++----- library/msgs/fa.msg | 76 ++++++++++++++++++++--------------------- library/msgs/fa_in.msg | 80 +++++++++++++++++++++---------------------- library/msgs/fa_ir.msg | 8 ++--- library/msgs/fi.msg | 8 ++--- library/msgs/fo.msg | 18 +++++----- library/msgs/fr.msg | 12 +++---- library/msgs/ga.msg | 50 +++++++++++++-------------- library/msgs/gl.msg | 12 +++---- library/msgs/he.msg | 80 +++++++++++++++++++++---------------------- library/msgs/hi.msg | 64 +++++++++++++++++------------------ library/msgs/hr.msg | 12 +++---- library/msgs/hu.msg | 34 +++++++++---------- library/msgs/is.msg | 44 ++++++++++++------------ library/msgs/it.msg | 10 +++--- library/msgs/ja.msg | 68 ++++++++++++++++++------------------- library/msgs/ko.msg | 86 +++++++++++++++++++++++----------------------- library/msgs/ko_kr.msg | 4 +-- library/msgs/kok.msg | 66 ++++++++++++++++++------------------ library/msgs/lt.msg | 20 +++++------ library/msgs/lv.msg | 22 ++++++------ library/msgs/mk.msg | 80 +++++++++++++++++++++---------------------- library/msgs/mr.msg | 62 +++++++++++++++++----------------- library/msgs/mt.msg | 8 ++--- library/msgs/nb.msg | 8 ++--- library/msgs/nn.msg | 4 +-- library/msgs/pl.msg | 22 ++++++------ library/msgs/pt.msg | 8 ++--- library/msgs/ro.msg | 8 ++--- library/msgs/ru.msg | 80 +++++++++++++++++++++---------------------- library/msgs/sh.msg | 4 +-- library/msgs/sk.msg | 26 +++++++------- library/msgs/sl.msg | 6 ++-- library/msgs/sq.msg | 16 ++++----- library/msgs/sr.msg | 80 +++++++++++++++++++++---------------------- library/msgs/sv.msg | 12 +++---- library/msgs/ta.msg | 66 ++++++++++++++++++------------------ library/msgs/te.msg | 76 ++++++++++++++++++++--------------------- library/msgs/te_in.msg | 4 +-- library/msgs/th.msg | 84 ++++++++++++++++++++++----------------------- library/msgs/tr.msg | 24 ++++++------- library/msgs/uk.msg | 80 +++++++++++++++++++++---------------------- library/msgs/vi.msg | 38 ++++++++++----------- library/msgs/zh.msg | 92 +++++++++++++++++++++++++------------------------- library/msgs/zh_cn.msg | 2 +- library/msgs/zh_hk.msg | 42 +++++++++++------------ library/msgs/zh_sg.msg | 4 +-- library/msgs/zh_tw.msg | 4 +-- tools/loadICU.tcl | 3 ++ 65 files changed, 1190 insertions(+), 1187 deletions(-) diff --git a/library/msgs/ar.msg b/library/msgs/ar.msg index 257157f..2d403ec 100644 --- a/library/msgs/ar.msg +++ b/library/msgs/ar.msg @@ -1,53 +1,53 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar DAYS_OF_WEEK_ABBREV [list \ - "\u062d"\ - "\u0646"\ - "\u062b"\ - "\u0631"\ - "\u062e"\ - "\u062c"\ - "\u0633"] + "Ø­"\ + "Ù†"\ + "Ø«"\ + "ر"\ + "Ø®"\ + "ج"\ + "س"] ::msgcat::mcset ar DAYS_OF_WEEK_FULL [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar MONTHS_ABBREV [list \ - "\u064a\u0646\u0627"\ - "\u0641\u0628\u0631"\ - "\u0645\u0627\u0631"\ - "\u0623\u0628\u0631"\ - "\u0645\u0627\u064a"\ - "\u064a\u0648\u0646"\ - "\u064a\u0648\u0644"\ - "\u0623\u063a\u0633"\ - "\u0633\u0628\u062a"\ - "\u0623\u0643\u062a"\ - "\u0646\u0648\u0641"\ - "\u062f\u064a\u0633"\ + "ينا"\ + "ÙØ¨Ø±"\ + "مار"\ + "أبر"\ + "ماي"\ + "يون"\ + "يول"\ + "أغس"\ + "سبت"\ + "أكت"\ + "نوÙ"\ + "ديس"\ ""] ::msgcat::mcset ar MONTHS_FULL [list \ - "\u064a\u0646\u0627\u064a\u0631"\ - "\u0641\u0628\u0631\u0627\u064a\u0631"\ - "\u0645\u0627\u0631\u0633"\ - "\u0623\u0628\u0631\u064a\u0644"\ - "\u0645\u0627\u064a\u0648"\ - "\u064a\u0648\u0646\u064a\u0648"\ - "\u064a\u0648\u0644\u064a\u0648"\ - "\u0623\u063a\u0633\u0637\u0633"\ - "\u0633\u0628\u062a\u0645\u0628\u0631"\ - "\u0623\u0643\u062a\u0648\u0628\u0631"\ - "\u0646\u0648\u0641\u0645\u0628\u0631"\ - "\u062f\u064a\u0633\u0645\u0628\u0631"\ + "يناير"\ + "ÙØ¨Ø±Ø§ÙŠØ±"\ + "مارس"\ + "أبريل"\ + "مايو"\ + "يونيو"\ + "يوليو"\ + "أغسطس"\ + "سبتمبر"\ + "أكتوبر"\ + "نوÙمبر"\ + "ديسمبر"\ ""] - ::msgcat::mcset ar BCE "\u0642.\u0645" - ::msgcat::mcset ar CE "\u0645" - ::msgcat::mcset ar AM "\u0635" - ::msgcat::mcset ar PM "\u0645" + ::msgcat::mcset ar BCE "Ù‚.Ù…" + ::msgcat::mcset ar CE "Ù…" + ::msgcat::mcset ar AM "ص" + ::msgcat::mcset ar PM "Ù…" ::msgcat::mcset ar DATE_FORMAT "%d/%m/%Y" ::msgcat::mcset ar TIME_FORMAT_12 "%I:%M:%S %P" ::msgcat::mcset ar DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" diff --git a/library/msgs/ar_jo.msg b/library/msgs/ar_jo.msg index 0f5e269..9a9dda0 100644 --- a/library/msgs/ar_jo.msg +++ b/library/msgs/ar_jo.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar_JO DAYS_OF_WEEK_ABBREV [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar_JO MONTHS_ABBREV [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] ::msgcat::mcset ar_JO MONTHS_FULL [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] } diff --git a/library/msgs/ar_lb.msg b/library/msgs/ar_lb.msg index e62acd3..c23aa2c 100644 --- a/library/msgs/ar_lb.msg +++ b/library/msgs/ar_lb.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar_LB DAYS_OF_WEEK_ABBREV [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar_LB MONTHS_ABBREV [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] ::msgcat::mcset ar_LB MONTHS_FULL [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] } diff --git a/library/msgs/ar_sy.msg b/library/msgs/ar_sy.msg index d5e1c87..f0daec0 100644 --- a/library/msgs/ar_sy.msg +++ b/library/msgs/ar_sy.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar_SY DAYS_OF_WEEK_ABBREV [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar_SY MONTHS_ABBREV [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] ::msgcat::mcset ar_SY MONTHS_FULL [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631\u0627\u0646"\ - "\u062d\u0632\u064a\u0631"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نواران"\ + "حزير"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] } diff --git a/library/msgs/be.msg b/library/msgs/be.msg index 379a1d7..a0aceed 100644 --- a/library/msgs/be.msg +++ b/library/msgs/be.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset be DAYS_OF_WEEK_ABBREV [list \ - "\u043d\u0434"\ - "\u043f\u043d"\ - "\u0430\u0442"\ - "\u0441\u0440"\ - "\u0447\u0446"\ - "\u043f\u0442"\ - "\u0441\u0431"] + "нд"\ + "пн"\ + "ат"\ + "ÑÑ€"\ + "чц"\ + "пт"\ + "Ñб"] ::msgcat::mcset be DAYS_OF_WEEK_FULL [list \ - "\u043d\u044f\u0434\u0437\u0435\u043b\u044f"\ - "\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a"\ - "\u0430\u045e\u0442\u043e\u0440\u0430\u043a"\ - "\u0441\u0435\u0440\u0430\u0434\u0430"\ - "\u0447\u0430\u0446\u0432\u0435\u0440"\ - "\u043f\u044f\u0442\u043d\u0456\u0446\u0430"\ - "\u0441\u0443\u0431\u043e\u0442\u0430"] + "нÑдзелÑ"\ + "панÑдзелак"\ + "аўторак"\ + "Ñерада"\ + "чацвер"\ + "пÑтніца"\ + "Ñубота"] ::msgcat::mcset be MONTHS_ABBREV [list \ - "\u0441\u0442\u0434"\ - "\u043b\u044e\u0442"\ - "\u0441\u043a\u0432"\ - "\u043a\u0440\u0441"\ - "\u043c\u0430\u0439"\ - "\u0447\u0440\u0432"\ - "\u043b\u043f\u043d"\ - "\u0436\u043d\u0432"\ - "\u0432\u0440\u0441"\ - "\u043a\u0441\u0442"\ - "\u043b\u0441\u0442"\ - "\u0441\u043d\u0436"\ + "Ñтд"\ + "лют"\ + "Ñкв"\ + "крÑ"\ + "май"\ + "чрв"\ + "лпн"\ + "жнв"\ + "врÑ"\ + "кÑÑ‚"\ + "лÑÑ‚"\ + "Ñнж"\ ""] ::msgcat::mcset be MONTHS_FULL [list \ - "\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044f"\ - "\u043b\u044e\u0442\u0430\u0433\u0430"\ - "\u0441\u0430\u043a\u0430\u0432\u0456\u043a\u0430"\ - "\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a\u0430"\ - "\u043c\u0430\u044f"\ - "\u0447\u0440\u0432\u0435\u043d\u044f"\ - "\u043b\u0456\u043f\u0435\u043d\u044f"\ - "\u0436\u043d\u0456\u045e\u043d\u044f"\ - "\u0432\u0435\u0440\u0430\u0441\u043d\u044f"\ - "\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a\u0430"\ - "\u043b\u0438\u0441\u0442\u0430\u043f\u0430\u0434\u0430"\ - "\u0441\u043d\u0435\u0436\u043d\u044f"\ + "ÑтудзенÑ"\ + "лютага"\ + "Ñакавіка"\ + "краÑавіка"\ + "маÑ"\ + "чрвенÑ"\ + "ліпенÑ"\ + "жніўнÑ"\ + "вераÑнÑ"\ + "каÑтрычніка"\ + "лиÑтапада"\ + "ÑнежнÑ"\ ""] - ::msgcat::mcset be BCE "\u0434\u0430 \u043d.\u0435." - ::msgcat::mcset be CE "\u043d.\u0435." + ::msgcat::mcset be BCE "да н.е." + ::msgcat::mcset be CE "н.е." ::msgcat::mcset be DATE_FORMAT "%e.%m.%Y" ::msgcat::mcset be TIME_FORMAT "%k.%M.%S" ::msgcat::mcset be DATE_TIME_FORMAT "%e.%m.%Y %k.%M.%S %z" diff --git a/library/msgs/bg.msg b/library/msgs/bg.msg index ff17759..2e7730d 100644 --- a/library/msgs/bg.msg +++ b/library/msgs/bg.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset bg DAYS_OF_WEEK_ABBREV [list \ - "\u041d\u0434"\ - "\u041f\u043d"\ - "\u0412\u0442"\ - "\u0421\u0440"\ - "\u0427\u0442"\ - "\u041f\u0442"\ - "\u0421\u0431"] + "Ðд"\ + "Пн"\ + "Ð’Ñ‚"\ + "Ср"\ + "Чт"\ + "Пт"\ + "Сб"] ::msgcat::mcset bg DAYS_OF_WEEK_FULL [list \ - "\u041d\u0435\u0434\u0435\u043b\u044f"\ - "\u041f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a"\ - "\u0412\u0442\u043e\u0440\u043d\u0438\u043a"\ - "\u0421\u0440\u044f\u0434\u0430"\ - "\u0427\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a"\ - "\u041f\u0435\u0442\u044a\u043a"\ - "\u0421\u044a\u0431\u043e\u0442\u0430"] + "ÐеделÑ"\ + "Понеделник"\ + "Вторник"\ + "СрÑда"\ + "Четвъртък"\ + "Петък"\ + "Събота"] ::msgcat::mcset bg MONTHS_ABBREV [list \ "I"\ "II"\ @@ -31,21 +31,21 @@ namespace eval ::tcl::clock { "XII"\ ""] ::msgcat::mcset bg MONTHS_FULL [list \ - "\u042f\u043d\u0443\u0430\u0440\u0438"\ - "\u0424\u0435\u0432\u0440\u0443\u0430\u0440\u0438"\ - "\u041c\u0430\u0440\u0442"\ - "\u0410\u043f\u0440\u0438\u043b"\ - "\u041c\u0430\u0439"\ - "\u042e\u043d\u0438"\ - "\u042e\u043b\u0438"\ - "\u0410\u0432\u0433\u0443\u0441\u0442"\ - "\u0421\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438"\ - "\u041e\u043a\u0442\u043e\u043c\u0432\u0440\u0438"\ - "\u041d\u043e\u0435\u043c\u0432\u0440\u0438"\ - "\u0414\u0435\u043a\u0435\u043c\u0432\u0440\u0438"\ + "Януари"\ + "Февруари"\ + "Март"\ + "Ðприл"\ + "Май"\ + "Юни"\ + "Юли"\ + "ÐвгуÑÑ‚"\ + "Септември"\ + "Октомври"\ + "Ðоември"\ + "Декември"\ ""] - ::msgcat::mcset bg BCE "\u043f\u0440.\u043d.\u0435." - ::msgcat::mcset bg CE "\u043d.\u0435." + ::msgcat::mcset bg BCE "пр.н.е." + ::msgcat::mcset bg CE "н.е." ::msgcat::mcset bg DATE_FORMAT "%Y-%m-%e" ::msgcat::mcset bg TIME_FORMAT "%k:%M:%S" ::msgcat::mcset bg DATE_TIME_FORMAT "%Y-%m-%e %k:%M:%S %z" diff --git a/library/msgs/bn.msg b/library/msgs/bn.msg index 664b9d8..a0aef13 100644 --- a/library/msgs/bn.msg +++ b/library/msgs/bn.msg @@ -1,49 +1,49 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset bn DAYS_OF_WEEK_ABBREV [list \ - "\u09b0\u09ac\u09bf"\ - "\u09b8\u09cb\u09ae"\ - "\u09ae\u0999\u0997\u09b2"\ - "\u09ac\u09c1\u09a7"\ - "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf"\ - "\u09b6\u09c1\u0995\u09cd\u09b0"\ - "\u09b6\u09a8\u09bf"] + "রবি"\ + "সোম"\ + "মঙগল"\ + "বà§à¦§"\ + "বৃহসà§à¦ªà¦¤à¦¿"\ + "শà§à¦•à§à¦°"\ + "শনি"] ::msgcat::mcset bn DAYS_OF_WEEK_FULL [list \ - "\u09b0\u09ac\u09bf\u09ac\u09be\u09b0"\ - "\u09b8\u09cb\u09ae\u09ac\u09be\u09b0"\ - "\u09ae\u0999\u0997\u09b2\u09ac\u09be\u09b0"\ - "\u09ac\u09c1\u09a7\u09ac\u09be\u09b0"\ - "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0"\ - "\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0"\ - "\u09b6\u09a8\u09bf\u09ac\u09be\u09b0"] + "রবিবার"\ + "সোমবার"\ + "মঙগলবার"\ + "বà§à¦§à¦¬à¦¾à¦°"\ + "বৃহসà§à¦ªà¦¤à¦¿à¦¬à¦¾à¦°"\ + "শà§à¦•à§à¦°à¦¬à¦¾à¦°"\ + "শনিবার"] ::msgcat::mcset bn MONTHS_ABBREV [list \ - "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ae\u09be\u09b0\u09cd\u099a"\ - "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\ - "\u09ae\u09c7"\ - "\u099c\u09c1\u09a8"\ - "\u099c\u09c1\u09b2\u09be\u0987"\ - "\u0986\u0997\u09b8\u09cd\u099f"\ - "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\ - "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "জানà§à§Ÿà¦¾à¦°à§€"\ + "ফেবà§à¦°à§à§Ÿà¦¾à¦°à§€"\ + "মারà§à¦š"\ + "à¦à¦ªà§à¦°à¦¿à¦²"\ + "মে"\ + "জà§à¦¨"\ + "জà§à¦²à¦¾à¦‡"\ + "আগসà§à¦Ÿ"\ + "সেপà§à¦Ÿà§‡à¦®à§à¦¬à¦°"\ + "অকà§à¦Ÿà§‹à¦¬à¦°"\ + "নভেমà§à¦¬à¦°"\ + "ডিসেমà§à¦¬à¦°"\ ""] ::msgcat::mcset bn MONTHS_FULL [list \ - "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ae\u09be\u09b0\u09cd\u099a"\ - "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\ - "\u09ae\u09c7"\ - "\u099c\u09c1\u09a8"\ - "\u099c\u09c1\u09b2\u09be\u0987"\ - "\u0986\u0997\u09b8\u09cd\u099f"\ - "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\ - "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "জানà§à§Ÿà¦¾à¦°à§€"\ + "ফেবà§à¦°à§à§Ÿà¦¾à¦°à§€"\ + "মারà§à¦š"\ + "à¦à¦ªà§à¦°à¦¿à¦²"\ + "মে"\ + "জà§à¦¨"\ + "জà§à¦²à¦¾à¦‡"\ + "আগসà§à¦Ÿ"\ + "সেপà§à¦Ÿà§‡à¦®à§à¦¬à¦°"\ + "অকà§à¦Ÿà§‹à¦¬à¦°"\ + "নভেমà§à¦¬à¦°"\ + "ডিসেমà§à¦¬à¦°"\ ""] - ::msgcat::mcset bn AM "\u09aa\u09c2\u09b0\u09cd\u09ac\u09be\u09b9\u09cd\u09a3" - ::msgcat::mcset bn PM "\u0985\u09aa\u09b0\u09be\u09b9\u09cd\u09a3" + ::msgcat::mcset bn AM "পূরà§à¦¬à¦¾à¦¹à§à¦£" + ::msgcat::mcset bn PM "অপরাহà§à¦£" } diff --git a/library/msgs/ca.msg b/library/msgs/ca.msg index 36c9772..272f682 100644 --- a/library/msgs/ca.msg +++ b/library/msgs/ca.msg @@ -19,7 +19,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset ca MONTHS_ABBREV [list \ "gen."\ "feb."\ - "mar\u00e7"\ + "març"\ "abr."\ "maig"\ "juny"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset ca MONTHS_FULL [list \ "gener"\ "febrer"\ - "mar\u00e7"\ + "març"\ "abril"\ "maig"\ "juny"\ diff --git a/library/msgs/cs.msg b/library/msgs/cs.msg index 8db8bdd..4673cd4 100644 --- a/library/msgs/cs.msg +++ b/library/msgs/cs.msg @@ -3,18 +3,18 @@ namespace eval ::tcl::clock { ::msgcat::mcset cs DAYS_OF_WEEK_ABBREV [list \ "Ne"\ "Po"\ - "\u00dat"\ + "Út"\ "St"\ - "\u010ct"\ - "P\u00e1"\ + "ÄŒt"\ + "Pá"\ "So"] ::msgcat::mcset cs DAYS_OF_WEEK_FULL [list \ - "Ned\u011ble"\ - "Pond\u011bl\u00ed"\ - "\u00dater\u00fd"\ - "St\u0159eda"\ - "\u010ctvrtek"\ - "P\u00e1tek"\ + "NedÄ›le"\ + "PondÄ›lí"\ + "Úterý"\ + "StÅ™eda"\ + "ÄŒtvrtek"\ + "Pátek"\ "Sobota"] ::msgcat::mcset cs MONTHS_ABBREV [list \ "I"\ @@ -32,19 +32,19 @@ namespace eval ::tcl::clock { ""] ::msgcat::mcset cs MONTHS_FULL [list \ "leden"\ - "\u00fanor"\ - "b\u0159ezen"\ + "únor"\ + "bÅ™ezen"\ "duben"\ - "kv\u011bten"\ - "\u010derven"\ - "\u010dervenec"\ + "kvÄ›ten"\ + "Äerven"\ + "Äervenec"\ "srpen"\ - "z\u00e1\u0159\u00ed"\ - "\u0159\u00edjen"\ + "září"\ + "říjen"\ "listopad"\ "prosinec"\ ""] - ::msgcat::mcset cs BCE "p\u0159.Kr." + ::msgcat::mcset cs BCE "pÅ™.Kr." ::msgcat::mcset cs CE "po Kr." ::msgcat::mcset cs AM "dop." ::msgcat::mcset cs PM "odp." diff --git a/library/msgs/da.msg b/library/msgs/da.msg index e4fec7f..abed3c5 100644 --- a/library/msgs/da.msg +++ b/library/msgs/da.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset da DAYS_OF_WEEK_ABBREV [list \ - "s\u00f8"\ + "sø"\ "ma"\ "ti"\ "on"\ "to"\ "fr"\ - "l\u00f8"] + "lø"] ::msgcat::mcset da DAYS_OF_WEEK_FULL [list \ - "s\u00f8ndag"\ + "søndag"\ "mandag"\ "tirsdag"\ "onsdag"\ "torsdag"\ "fredag"\ - "l\u00f8rdag"] + "lørdag"] ::msgcat::mcset da MONTHS_ABBREV [list \ "jan"\ "feb"\ diff --git a/library/msgs/de.msg b/library/msgs/de.msg index 9eb3145..0bb7399 100644 --- a/library/msgs/de.msg +++ b/library/msgs/de.msg @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset de MONTHS_FULL [list \ "Januar"\ "Februar"\ - "M\u00e4rz"\ + "März"\ "April"\ "Mai"\ "Juni"\ diff --git a/library/msgs/de_at.msg b/library/msgs/de_at.msg index 61bc266..1a0a0f5 100644 --- a/library/msgs/de_at.msg +++ b/library/msgs/de_at.msg @@ -1,9 +1,9 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset de_AT MONTHS_ABBREV [list \ - "J\u00e4n"\ + "Jän"\ "Feb"\ - "M\u00e4r"\ + "Mär"\ "Apr"\ "Mai"\ "Jun"\ @@ -15,9 +15,9 @@ namespace eval ::tcl::clock { "Dez"\ ""] ::msgcat::mcset de_AT MONTHS_FULL [list \ - "J\u00e4nner"\ + "Jänner"\ "Februar"\ - "M\u00e4rz"\ + "März"\ "April"\ "Mai"\ "Juni"\ diff --git a/library/msgs/de_be.msg b/library/msgs/de_be.msg index 3614763..04cf88c 100644 --- a/library/msgs/de_be.msg +++ b/library/msgs/de_be.msg @@ -19,7 +19,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset de_BE MONTHS_ABBREV [list \ "Jan"\ "Feb"\ - "M\u00e4r"\ + "Mär"\ "Apr"\ "Mai"\ "Jun"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset de_BE MONTHS_FULL [list \ "Januar"\ "Februar"\ - "M\u00e4rz"\ + "März"\ "April"\ "Mai"\ "Juni"\ diff --git a/library/msgs/el.msg b/library/msgs/el.msg index ac19f62..26bdfe9 100644 --- a/library/msgs/el.msg +++ b/library/msgs/el.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset el DAYS_OF_WEEK_ABBREV [list \ - "\u039a\u03c5\u03c1"\ - "\u0394\u03b5\u03c5"\ - "\u03a4\u03c1\u03b9"\ - "\u03a4\u03b5\u03c4"\ - "\u03a0\u03b5\u03bc"\ - "\u03a0\u03b1\u03c1"\ - "\u03a3\u03b1\u03b2"] + "ΚυÏ"\ + "Δευ"\ + "ΤÏι"\ + "Τετ"\ + "Πεμ"\ + "ΠαÏ"\ + "Σαβ"] ::msgcat::mcset el DAYS_OF_WEEK_FULL [list \ - "\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae"\ - "\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1"\ - "\u03a4\u03c1\u03af\u03c4\u03b7"\ - "\u03a4\u03b5\u03c4\u03ac\u03c1\u03c4\u03b7"\ - "\u03a0\u03ad\u03bc\u03c0\u03c4\u03b7"\ - "\u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae"\ - "\u03a3\u03ac\u03b2\u03b2\u03b1\u03c4\u03bf"] + "ΚυÏιακή"\ + "ΔευτέÏα"\ + "ΤÏίτη"\ + "ΤετάÏτη"\ + "Πέμπτη"\ + "ΠαÏασκευή"\ + "Σάββατο"] ::msgcat::mcset el MONTHS_ABBREV [list \ - "\u0399\u03b1\u03bd"\ - "\u03a6\u03b5\u03b2"\ - "\u039c\u03b1\u03c1"\ - "\u0391\u03c0\u03c1"\ - "\u039c\u03b1\u03ca"\ - "\u0399\u03bf\u03c5\u03bd"\ - "\u0399\u03bf\u03c5\u03bb"\ - "\u0391\u03c5\u03b3"\ - "\u03a3\u03b5\u03c0"\ - "\u039f\u03ba\u03c4"\ - "\u039d\u03bf\u03b5"\ - "\u0394\u03b5\u03ba"\ + "Ιαν"\ + "Φεβ"\ + "ΜαÏ"\ + "ΑπÏ"\ + "Μαϊ"\ + "Ιουν"\ + "Ιουλ"\ + "Αυγ"\ + "Σεπ"\ + "Οκτ"\ + "Îοε"\ + "Δεκ"\ ""] ::msgcat::mcset el MONTHS_FULL [list \ - "\u0399\u03b1\u03bd\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\ - "\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\ - "\u039c\u03ac\u03c1\u03c4\u03b9\u03bf\u03c2"\ - "\u0391\u03c0\u03c1\u03af\u03bb\u03b9\u03bf\u03c2"\ - "\u039c\u03ac\u03ca\u03bf\u03c2"\ - "\u0399\u03bf\u03cd\u03bd\u03b9\u03bf\u03c2"\ - "\u0399\u03bf\u03cd\u03bb\u03b9\u03bf\u03c2"\ - "\u0391\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2"\ - "\u03a3\u03b5\u03c0\u03c4\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ - "\u039f\u03ba\u03c4\u03ce\u03b2\u03c1\u03b9\u03bf\u03c2"\ - "\u039d\u03bf\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ - "\u0394\u03b5\u03ba\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ + "ΙανουάÏιος"\ + "ΦεβÏουάÏιος"\ + "ΜάÏτιος"\ + "ΑπÏίλιος"\ + "Μάϊος"\ + "ΙοÏνιος"\ + "ΙοÏλιος"\ + "ΑÏγουστος"\ + "ΣεπτέμβÏιος"\ + "ΟκτώβÏιος"\ + "ÎοέμβÏιος"\ + "ΔεκέμβÏιος"\ ""] - ::msgcat::mcset el AM "\u03c0\u03bc" - ::msgcat::mcset el PM "\u03bc\u03bc" + ::msgcat::mcset el AM "πμ" + ::msgcat::mcset el PM "μμ" ::msgcat::mcset el DATE_FORMAT "%e/%m/%Y" ::msgcat::mcset el TIME_FORMAT_12 "%l:%M:%S %P" ::msgcat::mcset el DATE_TIME_FORMAT "%e/%m/%Y %l:%M:%S %P %z" diff --git a/library/msgs/eo.msg b/library/msgs/eo.msg index 1d2a24f..b9b1500 100644 --- a/library/msgs/eo.msg +++ b/library/msgs/eo.msg @@ -5,15 +5,15 @@ namespace eval ::tcl::clock { "lu"\ "ma"\ "me"\ - "\u0135a"\ + "ĵa"\ "ve"\ "sa"] ::msgcat::mcset eo DAYS_OF_WEEK_FULL [list \ - "diman\u0109o"\ + "dimanĉo"\ "lundo"\ "mardo"\ "merkredo"\ - "\u0135a\u016ddo"\ + "ĵaÅ­do"\ "vendredo"\ "sabato"] ::msgcat::mcset eo MONTHS_ABBREV [list \ @@ -24,7 +24,7 @@ namespace eval ::tcl::clock { "maj"\ "jun"\ "jul"\ - "a\u016dg"\ + "aÅ­g"\ "sep"\ "okt"\ "nov"\ @@ -38,7 +38,7 @@ namespace eval ::tcl::clock { "majo"\ "junio"\ "julio"\ - "a\u016dgusto"\ + "aÅ­gusto"\ "septembro"\ "oktobro"\ "novembro"\ diff --git a/library/msgs/es.msg b/library/msgs/es.msg index a24f0a1..6090eab 100644 --- a/library/msgs/es.msg +++ b/library/msgs/es.msg @@ -4,18 +4,18 @@ namespace eval ::tcl::clock { "dom"\ "lun"\ "mar"\ - "mi\u00e9"\ + "mié"\ "jue"\ "vie"\ - "s\u00e1b"] + "sáb"] ::msgcat::mcset es DAYS_OF_WEEK_FULL [list \ "domingo"\ "lunes"\ "martes"\ - "mi\u00e9rcoles"\ + "miércoles"\ "jueves"\ "viernes"\ - "s\u00e1bado"] + "sábado"] ::msgcat::mcset es MONTHS_ABBREV [list \ "ene"\ "feb"\ diff --git a/library/msgs/et.msg b/library/msgs/et.msg index 8d32e9e..a782f9b 100644 --- a/library/msgs/et.msg +++ b/library/msgs/et.msg @@ -9,17 +9,17 @@ namespace eval ::tcl::clock { "R"\ "L"] ::msgcat::mcset et DAYS_OF_WEEK_FULL [list \ - "p\u00fchap\u00e4ev"\ - "esmasp\u00e4ev"\ - "teisip\u00e4ev"\ - "kolmap\u00e4ev"\ - "neljap\u00e4ev"\ + "pühapäev"\ + "esmaspäev"\ + "teisipäev"\ + "kolmapäev"\ + "neljapäev"\ "reede"\ - "laup\u00e4ev"] + "laupäev"] ::msgcat::mcset et MONTHS_ABBREV [list \ "Jaan"\ "Veebr"\ - "M\u00e4rts"\ + "Märts"\ "Apr"\ "Mai"\ "Juuni"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset et MONTHS_FULL [list \ "Jaanuar"\ "Veebruar"\ - "M\u00e4rts"\ + "Märts"\ "Aprill"\ "Mai"\ "Juuni"\ diff --git a/library/msgs/fa.msg b/library/msgs/fa.msg index 89b2f90..6166e28 100644 --- a/library/msgs/fa.msg +++ b/library/msgs/fa.msg @@ -1,47 +1,47 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset fa DAYS_OF_WEEK_ABBREV [list \ - "\u06cc\u2214"\ - "\u062f\u2214"\ - "\u0633\u2214"\ - "\u0686\u2214"\ - "\u067e\u2214"\ - "\u062c\u2214"\ - "\u0634\u2214"] + "ی∔"\ + "د∔"\ + "س∔"\ + "چ∔"\ + "پ∔"\ + "ج∔"\ + "ش∔"] ::msgcat::mcset fa DAYS_OF_WEEK_FULL [list \ - "\u06cc\u06cc\u200c\u0634\u0646\u0628\u0647"\ - "\u062f\u0648\u0634\u0646\u0628\u0647"\ - "\u0633\u0647\u200c\u0634\u0646\u0628\u0647"\ - "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647"\ - "\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647"\ - "\u062c\u0645\u0639\u0647"\ - "\u0634\u0646\u0628\u0647"] + "یی‌شنبه"\ + "دوشنبه"\ + "سه‌شنبه"\ + "چهارشنبه"\ + "پنج‌شنبه"\ + "جمعه"\ + "شنبه"] ::msgcat::mcset fa MONTHS_ABBREV [list \ - "\u0698\u0627\u0646"\ - "\u0641\u0648\u0631"\ - "\u0645\u0627\u0631"\ - "\u0622\u0648\u0631"\ - "\u0645\u0640\u0647"\ - "\u0698\u0648\u0646"\ - "\u0698\u0648\u06cc"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a"\ - "\u0627\u0643\u062a"\ - "\u0646\u0648\u0627"\ - "\u062f\u0633\u0627"\ + "ژان"\ + "Ùور"\ + "مار"\ + "آور"\ + "مـه"\ + "ژون"\ + "Ú˜ÙˆÛŒ"\ + "اوت"\ + "سپت"\ + "اكت"\ + "نوا"\ + "دسا"\ ""] ::msgcat::mcset fa MONTHS_FULL [list \ - "\u0698\u0627\u0646\u0648\u06cc\u0647"\ - "\u0641\u0648\u0631\u0648\u06cc\u0647"\ - "\u0645\u0627\u0631\u0633"\ - "\u0622\u0648\u0631\u06cc\u0644"\ - "\u0645\u0647"\ - "\u0698\u0648\u0626\u0646"\ - "\u0698\u0648\u0626\u06cc\u0647"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a\u0627\u0645\u0628\u0631"\ - "\u0627\u0643\u062a\u0628\u0631"\ - "\u0646\u0648\u0627\u0645\u0628\u0631"\ - "\u062f\u0633\u0627\u0645\u0628\u0631"\ + "ژانویه"\ + "Ùورویه"\ + "مارس"\ + "آوریل"\ + "مه"\ + "ژوئن"\ + "ژوئیه"\ + "اوت"\ + "سپتامبر"\ + "اكتبر"\ + "نوامبر"\ + "دسامبر"\ ""] } diff --git a/library/msgs/fa_in.msg b/library/msgs/fa_in.msg index adc9e91..ce32f99 100644 --- a/library/msgs/fa_in.msg +++ b/library/msgs/fa_in.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset fa_IN DAYS_OF_WEEK_ABBREV [list \ - "\u06cc\u2214"\ - "\u062f\u2214"\ - "\u0633\u2214"\ - "\u0686\u2214"\ - "\u067e\u2214"\ - "\u062c\u2214"\ - "\u0634\u2214"] + "ی∔"\ + "د∔"\ + "س∔"\ + "چ∔"\ + "پ∔"\ + "ج∔"\ + "ش∔"] ::msgcat::mcset fa_IN DAYS_OF_WEEK_FULL [list \ - "\u06cc\u06cc\u200c\u0634\u0646\u0628\u0647"\ - "\u062f\u0648\u0634\u0646\u0628\u0647"\ - "\u0633\u0647\u200c\u0634\u0646\u0628\u0647"\ - "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647"\ - "\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647"\ - "\u062c\u0645\u0639\u0647"\ - "\u0634\u0646\u0628\u0647"] + "یی‌شنبه"\ + "دوشنبه"\ + "سه‌شنبه"\ + "چهارشنبه"\ + "پنج‌شنبه"\ + "جمعه"\ + "شنبه"] ::msgcat::mcset fa_IN MONTHS_ABBREV [list \ - "\u0698\u0627\u0646"\ - "\u0641\u0648\u0631"\ - "\u0645\u0627\u0631"\ - "\u0622\u0648\u0631"\ - "\u0645\u0640\u0647"\ - "\u0698\u0648\u0646"\ - "\u0698\u0648\u06cc"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a"\ - "\u0627\u0643\u062a"\ - "\u0646\u0648\u0627"\ - "\u062f\u0633\u0627"\ + "ژان"\ + "Ùور"\ + "مار"\ + "آور"\ + "مـه"\ + "ژون"\ + "Ú˜ÙˆÛŒ"\ + "اوت"\ + "سپت"\ + "اكت"\ + "نوا"\ + "دسا"\ ""] ::msgcat::mcset fa_IN MONTHS_FULL [list \ - "\u0698\u0627\u0646\u0648\u06cc\u0647"\ - "\u0641\u0648\u0631\u0648\u06cc\u0647"\ - "\u0645\u0627\u0631\u0633"\ - "\u0622\u0648\u0631\u06cc\u0644"\ - "\u0645\u0647"\ - "\u0698\u0648\u0626\u0646"\ - "\u0698\u0648\u0626\u06cc\u0647"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a\u0627\u0645\u0628\u0631"\ - "\u0627\u0643\u062a\u0628\u0631"\ - "\u0646\u0648\u0627\u0645\u0628\u0631"\ - "\u062f\u0633\u0627\u0645\u0628\u0631"\ + "ژانویه"\ + "Ùورویه"\ + "مارس"\ + "آوریل"\ + "مه"\ + "ژوئن"\ + "ژوئیه"\ + "اوت"\ + "سپتامبر"\ + "اكتبر"\ + "نوامبر"\ + "دسامبر"\ ""] - ::msgcat::mcset fa_IN AM "\u0635\u0628\u062d" - ::msgcat::mcset fa_IN PM "\u0639\u0635\u0631" + ::msgcat::mcset fa_IN AM "صبح" + ::msgcat::mcset fa_IN PM "عصر" ::msgcat::mcset fa_IN DATE_FORMAT "%A %d %B %Y" ::msgcat::mcset fa_IN TIME_FORMAT_12 "%I:%M:%S %z" ::msgcat::mcset fa_IN DATE_TIME_FORMAT "%A %d %B %Y %I:%M:%S %z %z" diff --git a/library/msgs/fa_ir.msg b/library/msgs/fa_ir.msg index 597ce9d..9ce9284 100644 --- a/library/msgs/fa_ir.msg +++ b/library/msgs/fa_ir.msg @@ -1,9 +1,9 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset fa_IR AM "\u0635\u0628\u062d" - ::msgcat::mcset fa_IR PM "\u0639\u0635\u0631" - ::msgcat::mcset fa_IR DATE_FORMAT "%d\u2044%m\u2044%Y" + ::msgcat::mcset fa_IR AM "صبح" + ::msgcat::mcset fa_IR PM "عصر" + ::msgcat::mcset fa_IR DATE_FORMAT "%dâ„%mâ„%Y" ::msgcat::mcset fa_IR TIME_FORMAT "%S:%M:%H" ::msgcat::mcset fa_IR TIME_FORMAT_12 "%S:%M:%l %P" - ::msgcat::mcset fa_IR DATE_TIME_FORMAT "%d\u2044%m\u2044%Y %S:%M:%H %z" + ::msgcat::mcset fa_IR DATE_TIME_FORMAT "%dâ„%mâ„%Y %S:%M:%H %z" } diff --git a/library/msgs/fi.msg b/library/msgs/fi.msg index acabba0..69be367 100644 --- a/library/msgs/fi.msg +++ b/library/msgs/fi.msg @@ -22,8 +22,8 @@ namespace eval ::tcl::clock { "maalis"\ "huhti"\ "touko"\ - "kes\u00e4"\ - "hein\u00e4"\ + "kesä"\ + "heinä"\ "elo"\ "syys"\ "loka"\ @@ -36,8 +36,8 @@ namespace eval ::tcl::clock { "maaliskuu"\ "huhtikuu"\ "toukokuu"\ - "kes\u00e4kuu"\ - "hein\u00e4kuu"\ + "kesäkuu"\ + "heinäkuu"\ "elokuu"\ "syyskuu"\ "lokakuu"\ diff --git a/library/msgs/fo.msg b/library/msgs/fo.msg index 4696e62..1f1794d 100644 --- a/library/msgs/fo.msg +++ b/library/msgs/fo.msg @@ -2,19 +2,19 @@ namespace eval ::tcl::clock { ::msgcat::mcset fo DAYS_OF_WEEK_ABBREV [list \ "sun"\ - "m\u00e1n"\ - "t\u00fds"\ + "mán"\ + "týs"\ "mik"\ - "h\u00f3s"\ - "fr\u00ed"\ + "hós"\ + "frí"\ "ley"] ::msgcat::mcset fo DAYS_OF_WEEK_FULL [list \ "sunnudagur"\ - "m\u00e1nadagur"\ - "t\u00fdsdagur"\ + "mánadagur"\ + "týsdagur"\ "mikudagur"\ - "h\u00f3sdagur"\ - "fr\u00edggjadagur"\ + "hósdagur"\ + "fríggjadagur"\ "leygardagur"] ::msgcat::mcset fo MONTHS_ABBREV [list \ "jan"\ @@ -34,7 +34,7 @@ namespace eval ::tcl::clock { "januar"\ "februar"\ "mars"\ - "apr\u00edl"\ + "apríl"\ "mai"\ "juni"\ "juli"\ diff --git a/library/msgs/fr.msg b/library/msgs/fr.msg index 55b19bf..a274468 100644 --- a/library/msgs/fr.msg +++ b/library/msgs/fr.msg @@ -18,31 +18,31 @@ namespace eval ::tcl::clock { "samedi"] ::msgcat::mcset fr MONTHS_ABBREV [list \ "janv."\ - "f\u00e9vr."\ + "févr."\ "mars"\ "avr."\ "mai"\ "juin"\ "juil."\ - "ao\u00fbt"\ + "août"\ "sept."\ "oct."\ "nov."\ - "d\u00e9c."\ + "déc."\ ""] ::msgcat::mcset fr MONTHS_FULL [list \ "janvier"\ - "f\u00e9vrier"\ + "février"\ "mars"\ "avril"\ "mai"\ "juin"\ "juillet"\ - "ao\u00fbt"\ + "août"\ "septembre"\ "octobre"\ "novembre"\ - "d\u00e9cembre"\ + "décembre"\ ""] ::msgcat::mcset fr BCE "av. J.-C." ::msgcat::mcset fr CE "ap. J.-C." diff --git a/library/msgs/ga.msg b/library/msgs/ga.msg index 6edf13a..056c9a0 100644 --- a/library/msgs/ga.msg +++ b/library/msgs/ga.msg @@ -3,45 +3,45 @@ namespace eval ::tcl::clock { ::msgcat::mcset ga DAYS_OF_WEEK_ABBREV [list \ "Domh"\ "Luan"\ - "M\u00e1irt"\ - "C\u00e9ad"\ - "D\u00e9ar"\ + "Máirt"\ + "Céad"\ + "Déar"\ "Aoine"\ "Sath"] ::msgcat::mcset ga DAYS_OF_WEEK_FULL [list \ - "D\u00e9 Domhnaigh"\ - "D\u00e9 Luain"\ - "D\u00e9 M\u00e1irt"\ - "D\u00e9 C\u00e9adaoin"\ - "D\u00e9ardaoin"\ - "D\u00e9 hAoine"\ - "D\u00e9 Sathairn"] + "Dé Domhnaigh"\ + "Dé Luain"\ + "Dé Máirt"\ + "Dé Céadaoin"\ + "Déardaoin"\ + "Dé hAoine"\ + "Dé Sathairn"] ::msgcat::mcset ga MONTHS_ABBREV [list \ "Ean"\ "Feabh"\ - "M\u00e1rta"\ + "Márta"\ "Aib"\ "Beal"\ "Meith"\ - "I\u00fail"\ - "L\u00fan"\ - "MF\u00f3mh"\ - "DF\u00f3mh"\ + "Iúil"\ + "Lún"\ + "MFómh"\ + "DFómh"\ "Samh"\ "Noll"\ ""] ::msgcat::mcset ga MONTHS_FULL [list \ - "Ean\u00e1ir"\ + "Eanáir"\ "Feabhra"\ - "M\u00e1rta"\ - "Aibre\u00e1n"\ - "M\u00ed na Bealtaine"\ + "Márta"\ + "Aibreán"\ + "Mí na Bealtaine"\ "Meith"\ - "I\u00fail"\ - "L\u00fanasa"\ - "Me\u00e1n F\u00f3mhair"\ - "Deireadh F\u00f3mhair"\ - "M\u00ed na Samhna"\ - "M\u00ed na Nollag"\ + "Iúil"\ + "Lúnasa"\ + "Meán Fómhair"\ + "Deireadh Fómhair"\ + "Mí na Samhna"\ + "Mí na Nollag"\ ""] } diff --git a/library/msgs/gl.msg b/library/msgs/gl.msg index 4b869e8..c2fefc9 100644 --- a/library/msgs/gl.msg +++ b/library/msgs/gl.msg @@ -4,25 +4,25 @@ namespace eval ::tcl::clock { "Dom"\ "Lun"\ "Mar"\ - "M\u00e9r"\ + "Mér"\ "Xov"\ "Ven"\ - "S\u00e1b"] + "Sáb"] ::msgcat::mcset gl DAYS_OF_WEEK_FULL [list \ "Domingo"\ "Luns"\ "Martes"\ - "M\u00e9rcores"\ + "Mércores"\ "Xoves"\ "Venres"\ - "S\u00e1bado"] + "Sábado"] ::msgcat::mcset gl MONTHS_ABBREV [list \ "Xan"\ "Feb"\ "Mar"\ "Abr"\ "Mai"\ - "Xu\u00f1"\ + "Xuñ"\ "Xul"\ "Ago"\ "Set"\ @@ -36,7 +36,7 @@ namespace eval ::tcl::clock { "Marzo"\ "Abril"\ "Maio"\ - "Xu\u00f1o"\ + "Xuño"\ "Xullo"\ "Agosto"\ "Setembro"\ diff --git a/library/msgs/he.msg b/library/msgs/he.msg index 4fd921d..13a81b7 100644 --- a/library/msgs/he.msg +++ b/library/msgs/he.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset he DAYS_OF_WEEK_ABBREV [list \ - "\u05d0"\ - "\u05d1"\ - "\u05d2"\ - "\u05d3"\ - "\u05d4"\ - "\u05d5"\ - "\u05e9"] + "×"\ + "ב"\ + "×’"\ + "ד"\ + "×”"\ + "ו"\ + "ש"] ::msgcat::mcset he DAYS_OF_WEEK_FULL [list \ - "\u05d9\u05d5\u05dd \u05e8\u05d0\u05e9\u05d5\u05df"\ - "\u05d9\u05d5\u05dd \u05e9\u05e0\u05d9"\ - "\u05d9\u05d5\u05dd \u05e9\u05dc\u05d9\u05e9\u05d9"\ - "\u05d9\u05d5\u05dd \u05e8\u05d1\u05d9\u05e2\u05d9"\ - "\u05d9\u05d5\u05dd \u05d7\u05de\u05d9\u05e9\u05d9"\ - "\u05d9\u05d5\u05dd \u05e9\u05d9\u05e9\u05d9"\ - "\u05e9\u05d1\u05ea"] + "×™×•× ×¨×שון"\ + "×™×•× ×©× ×™"\ + "×™×•× ×©×œ×™×©×™"\ + "×™×•× ×¨×‘×™×¢×™"\ + "×™×•× ×—×ž×™×©×™"\ + "×™×•× ×©×™×©×™"\ + "שבת"] ::msgcat::mcset he MONTHS_ABBREV [list \ - "\u05d9\u05e0\u05d5"\ - "\u05e4\u05d1\u05e8"\ - "\u05de\u05e8\u05e5"\ - "\u05d0\u05e4\u05e8"\ - "\u05de\u05d0\u05d9"\ - "\u05d9\u05d5\u05e0"\ - "\u05d9\u05d5\u05dc"\ - "\u05d0\u05d5\u05d2"\ - "\u05e1\u05e4\u05d8"\ - "\u05d0\u05d5\u05e7"\ - "\u05e0\u05d5\u05d1"\ - "\u05d3\u05e6\u05de"\ + "ינו"\ + "פבר"\ + "מרץ"\ + "×פר"\ + "מ××™"\ + "יונ"\ + "יול"\ + "×וג"\ + "ספט"\ + "×וק"\ + "נוב"\ + "דצמ"\ ""] ::msgcat::mcset he MONTHS_FULL [list \ - "\u05d9\u05e0\u05d5\u05d0\u05e8"\ - "\u05e4\u05d1\u05e8\u05d5\u05d0\u05e8"\ - "\u05de\u05e8\u05e5"\ - "\u05d0\u05e4\u05e8\u05d9\u05dc"\ - "\u05de\u05d0\u05d9"\ - "\u05d9\u05d5\u05e0\u05d9"\ - "\u05d9\u05d5\u05dc\u05d9"\ - "\u05d0\u05d5\u05d2\u05d5\u05e1\u05d8"\ - "\u05e1\u05e4\u05d8\u05de\u05d1\u05e8"\ - "\u05d0\u05d5\u05e7\u05d8\u05d5\u05d1\u05e8"\ - "\u05e0\u05d5\u05d1\u05de\u05d1\u05e8"\ - "\u05d3\u05e6\u05de\u05d1\u05e8"\ + "ינו×ר"\ + "פברו×ר"\ + "מרץ"\ + "×פריל"\ + "מ××™"\ + "יוני"\ + "יולי"\ + "×וגוסט"\ + "ספטמבר"\ + "×וקטובר"\ + "נובמבר"\ + "דצמבר"\ ""] - ::msgcat::mcset he BCE "\u05dc\u05e1\u05d4\u0022\u05e0" - ::msgcat::mcset he CE "\u05dc\u05e4\u05e1\u05d4\u0022\u05e0" + ::msgcat::mcset he BCE "לסה"× " + ::msgcat::mcset he CE "לפסה"× " ::msgcat::mcset he DATE_FORMAT "%d/%m/%Y" ::msgcat::mcset he TIME_FORMAT "%H:%M:%S" ::msgcat::mcset he DATE_TIME_FORMAT "%d/%m/%Y %H:%M:%S %z" diff --git a/library/msgs/hi.msg b/library/msgs/hi.msg index 50c9fb8..18c8bf0 100644 --- a/library/msgs/hi.msg +++ b/library/msgs/hi.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset hi DAYS_OF_WEEK_FULL [list \ - "\u0930\u0935\u093f\u0935\u093e\u0930"\ - "\u0938\u094b\u092e\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0932\u0935\u093e\u0930"\ - "\u092c\u0941\u0927\u0935\u093e\u0930"\ - "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ - "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ - "\u0936\u0928\u093f\u0935\u093e\u0930"] + "रविवार"\ + "सोमवार"\ + "मंगलवार"\ + "बà¥à¤§à¤µà¤¾à¤°"\ + "गà¥à¤°à¥à¤µà¤¾à¤°"\ + "शà¥à¤•à¥à¤°à¤µà¤¾à¤°"\ + "शनिवार"] ::msgcat::mcset hi MONTHS_ABBREV [list \ - "\u091c\u0928\u0935\u0930\u0940"\ - "\u092b\u093c\u0930\u0935\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u0905\u092a\u094d\u0930\u0947\u0932"\ - "\u092e\u0908"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u093e\u0908"\ - "\u0905\u0917\u0938\u094d\u0924"\ - "\u0938\u093f\u0924\u092e\u094d\u092c\u0930"\ - "\u0905\u0915\u094d\u091f\u0942\u092c\u0930"\ - "\u0928\u0935\u092e\u094d\u092c\u0930"\ - "\u0926\u093f\u0938\u092e\u094d\u092c\u0930"] + "जनवरी"\ + "फ़रवरी"\ + "मारà¥à¤š"\ + "अपà¥à¤°à¥‡à¤²"\ + "मई"\ + "जून"\ + "जà¥à¤²à¤¾à¤ˆ"\ + "अगसà¥à¤¤"\ + "सितमà¥à¤¬à¤°"\ + "अकà¥à¤Ÿà¥‚बर"\ + "नवमà¥à¤¬à¤°"\ + "दिसमà¥à¤¬à¤°"] ::msgcat::mcset hi MONTHS_FULL [list \ - "\u091c\u0928\u0935\u0930\u0940"\ - "\u092b\u093c\u0930\u0935\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u0905\u092a\u094d\u0930\u0947\u0932"\ - "\u092e\u0908"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u093e\u0908"\ - "\u0905\u0917\u0938\u094d\u0924"\ - "\u0938\u093f\u0924\u092e\u094d\u092c\u0930"\ - "\u0905\u0915\u094d\u091f\u0942\u092c\u0930"\ - "\u0928\u0935\u092e\u094d\u092c\u0930"\ - "\u0926\u093f\u0938\u092e\u094d\u092c\u0930"] - ::msgcat::mcset hi AM "\u0908\u0938\u093e\u092a\u0942\u0930\u094d\u0935" + "जनवरी"\ + "फ़रवरी"\ + "मारà¥à¤š"\ + "अपà¥à¤°à¥‡à¤²"\ + "मई"\ + "जून"\ + "जà¥à¤²à¤¾à¤ˆ"\ + "अगसà¥à¤¤"\ + "सितमà¥à¤¬à¤°"\ + "अकà¥à¤Ÿà¥‚बर"\ + "नवमà¥à¤¬à¤°"\ + "दिसमà¥à¤¬à¤°"] + ::msgcat::mcset hi AM "ईसापूरà¥à¤µ" ::msgcat::mcset hi PM "." } diff --git a/library/msgs/hr.msg b/library/msgs/hr.msg index cec145b..30491e1 100644 --- a/library/msgs/hr.msg +++ b/library/msgs/hr.msg @@ -5,7 +5,7 @@ namespace eval ::tcl::clock { "pon"\ "uto"\ "sri"\ - "\u010det"\ + "Äet"\ "pet"\ "sub"] ::msgcat::mcset hr DAYS_OF_WEEK_FULL [list \ @@ -13,13 +13,13 @@ namespace eval ::tcl::clock { "ponedjeljak"\ "utorak"\ "srijeda"\ - "\u010detvrtak"\ + "Äetvrtak"\ "petak"\ "subota"] ::msgcat::mcset hr MONTHS_ABBREV [list \ "sij"\ "vel"\ - "o\u017eu"\ + "ožu"\ "tra"\ "svi"\ "lip"\ @@ -31,9 +31,9 @@ namespace eval ::tcl::clock { "pro"\ ""] ::msgcat::mcset hr MONTHS_FULL [list \ - "sije\u010danj"\ - "velja\u010da"\ - "o\u017eujak"\ + "sijeÄanj"\ + "veljaÄa"\ + "ožujak"\ "travanj"\ "svibanj"\ "lipanj"\ diff --git a/library/msgs/hu.msg b/library/msgs/hu.msg index e5e68d9..46776dd 100644 --- a/library/msgs/hu.msg +++ b/library/msgs/hu.msg @@ -9,21 +9,21 @@ namespace eval ::tcl::clock { "P"\ "Szo"] ::msgcat::mcset hu DAYS_OF_WEEK_FULL [list \ - "vas\u00e1rnap"\ - "h\u00e9tf\u0151"\ + "vasárnap"\ + "hétfÅ‘"\ "kedd"\ "szerda"\ - "cs\u00fct\u00f6rt\u00f6k"\ - "p\u00e9ntek"\ + "csütörtök"\ + "péntek"\ "szombat"] ::msgcat::mcset hu MONTHS_ABBREV [list \ "jan."\ "febr."\ - "m\u00e1rc."\ - "\u00e1pr."\ - "m\u00e1j."\ - "j\u00fan."\ - "j\u00fal."\ + "márc."\ + "ápr."\ + "máj."\ + "jún."\ + "júl."\ "aug."\ "szept."\ "okt."\ @@ -31,16 +31,16 @@ namespace eval ::tcl::clock { "dec."\ ""] ::msgcat::mcset hu MONTHS_FULL [list \ - "janu\u00e1r"\ - "febru\u00e1r"\ - "m\u00e1rcius"\ - "\u00e1prilis"\ - "m\u00e1jus"\ - "j\u00fanius"\ - "j\u00falius"\ + "január"\ + "február"\ + "március"\ + "április"\ + "május"\ + "június"\ + "július"\ "augusztus"\ "szeptember"\ - "okt\u00f3ber"\ + "október"\ "november"\ "december"\ ""] diff --git a/library/msgs/is.msg b/library/msgs/is.msg index adc2d2a..a369b89 100644 --- a/library/msgs/is.msg +++ b/library/msgs/is.msg @@ -2,46 +2,46 @@ namespace eval ::tcl::clock { ::msgcat::mcset is DAYS_OF_WEEK_ABBREV [list \ "sun."\ - "m\u00e1n."\ - "\u00feri."\ - "mi\u00f0."\ + "mán."\ + "þri."\ + "mið."\ "fim."\ - "f\u00f6s."\ + "fös."\ "lau."] ::msgcat::mcset is DAYS_OF_WEEK_FULL [list \ "sunnudagur"\ - "m\u00e1nudagur"\ - "\u00feri\u00f0judagur"\ - "mi\u00f0vikudagur"\ + "mánudagur"\ + "þriðjudagur"\ + "miðvikudagur"\ "fimmtudagur"\ - "f\u00f6studagur"\ + "föstudagur"\ "laugardagur"] ::msgcat::mcset is MONTHS_ABBREV [list \ "jan."\ "feb."\ "mar."\ "apr."\ - "ma\u00ed"\ - "j\u00fan."\ - "j\u00fal."\ - "\u00e1g\u00fa."\ + "maí"\ + "jún."\ + "júl."\ + "ágú."\ "sep."\ "okt."\ - "n\u00f3v."\ + "nóv."\ "des."\ ""] ::msgcat::mcset is MONTHS_FULL [list \ - "jan\u00faar"\ - "febr\u00faar"\ + "janúar"\ + "febrúar"\ "mars"\ - "apr\u00edl"\ - "ma\u00ed"\ - "j\u00fan\u00ed"\ - "j\u00fal\u00ed"\ - "\u00e1g\u00fast"\ + "apríl"\ + "maí"\ + "júní"\ + "júlí"\ + "ágúst"\ "september"\ - "okt\u00f3ber"\ - "n\u00f3vember"\ + "október"\ + "nóvember"\ "desember"\ ""] ::msgcat::mcset is DATE_FORMAT "%e.%m.%Y" diff --git a/library/msgs/it.msg b/library/msgs/it.msg index b641cde..e51aee2 100644 --- a/library/msgs/it.msg +++ b/library/msgs/it.msg @@ -10,11 +10,11 @@ namespace eval ::tcl::clock { "sab"] ::msgcat::mcset it DAYS_OF_WEEK_FULL [list \ "domenica"\ - "luned\u00ec"\ - "marted\u00ec"\ - "mercoled\u00ec"\ - "gioved\u00ec"\ - "venerd\u00ec"\ + "lunedì"\ + "martedì"\ + "mercoledì"\ + "giovedì"\ + "venerdì"\ "sabato"] ::msgcat::mcset it MONTHS_ABBREV [list \ "gen"\ diff --git a/library/msgs/ja.msg b/library/msgs/ja.msg index 2767665..76b5fa4 100644 --- a/library/msgs/ja.msg +++ b/library/msgs/ja.msg @@ -1,44 +1,44 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ja DAYS_OF_WEEK_ABBREV [list \ - "\u65e5"\ - "\u6708"\ - "\u706b"\ - "\u6c34"\ - "\u6728"\ - "\u91d1"\ - "\u571f"] + "æ—¥"\ + "月"\ + "ç«"\ + "æ°´"\ + "木"\ + "金"\ + "土"] ::msgcat::mcset ja DAYS_OF_WEEK_FULL [list \ - "\u65e5\u66dc\u65e5"\ - "\u6708\u66dc\u65e5"\ - "\u706b\u66dc\u65e5"\ - "\u6c34\u66dc\u65e5"\ - "\u6728\u66dc\u65e5"\ - "\u91d1\u66dc\u65e5"\ - "\u571f\u66dc\u65e5"] + "日曜日"\ + "月曜日"\ + "ç«æ›œæ—¥"\ + "水曜日"\ + "木曜日"\ + "金曜日"\ + "土曜日"] ::msgcat::mcset ja MONTHS_FULL [list \ - "1\u6708"\ - "2\u6708"\ - "3\u6708"\ - "4\u6708"\ - "5\u6708"\ - "6\u6708"\ - "7\u6708"\ - "8\u6708"\ - "9\u6708"\ - "10\u6708"\ - "11\u6708"\ - "12\u6708"] - ::msgcat::mcset ja BCE "\u7d00\u5143\u524d" - ::msgcat::mcset ja CE "\u897f\u66a6" - ::msgcat::mcset ja AM "\u5348\u524d" - ::msgcat::mcset ja PM "\u5348\u5f8c" + "1月"\ + "2月"\ + "3月"\ + "4月"\ + "5月"\ + "6月"\ + "7月"\ + "8月"\ + "9月"\ + "10月"\ + "11月"\ + "12月"] + ::msgcat::mcset ja BCE "紀元å‰" + ::msgcat::mcset ja CE "西暦" + ::msgcat::mcset ja AM "åˆå‰" + ::msgcat::mcset ja PM "åˆå¾Œ" ::msgcat::mcset ja DATE_FORMAT "%Y/%m/%d" ::msgcat::mcset ja TIME_FORMAT "%k:%M:%S" ::msgcat::mcset ja TIME_FORMAT_12 "%P %I:%M:%S" ::msgcat::mcset ja DATE_TIME_FORMAT "%Y/%m/%d %k:%M:%S %z" - ::msgcat::mcset ja LOCALE_DATE_FORMAT "%EY\u5e74%m\u6708%d\u65e5" - ::msgcat::mcset ja LOCALE_TIME_FORMAT "%H\u6642%M\u5206%S\u79d2" - ::msgcat::mcset ja LOCALE_DATE_TIME_FORMAT "%EY\u5e74%m\u6708%d\u65e5 (%a) %H\u6642%M\u5206%S\u79d2 %z" - ::msgcat::mcset ja LOCALE_ERAS "\u007b-9223372036854775808 \u897f\u66a6 0\u007d \u007b-3061011600 \u660e\u6cbb 1867\u007d \u007b-1812186000 \u5927\u6b63 1911\u007d \u007b-1357635600 \u662d\u548c 1925\u007d \u007b600220800 \u5e73\u6210 1988\u007d" + ::msgcat::mcset ja LOCALE_DATE_FORMAT "%EYå¹´%m月%dæ—¥" + ::msgcat::mcset ja LOCALE_TIME_FORMAT "%H時%M分%Sç§’" + ::msgcat::mcset ja LOCALE_DATE_TIME_FORMAT "%EYå¹´%m月%dæ—¥ (%a) %H時%M分%Sç§’ %z" + ::msgcat::mcset ja LOCALE_ERAS "{-9223372036854775808 西暦 0} {-3061011600 明治 1867} {-1812186000 大正 1911} {-1357635600 昭和 1925} {600220800 å¹³æˆ 1988}" } diff --git a/library/msgs/ko.msg b/library/msgs/ko.msg index 0cd17a1..817c2e7 100644 --- a/library/msgs/ko.msg +++ b/library/msgs/ko.msg @@ -1,55 +1,55 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ko DAYS_OF_WEEK_ABBREV [list \ - "\uc77c"\ - "\uc6d4"\ - "\ud654"\ - "\uc218"\ - "\ubaa9"\ - "\uae08"\ - "\ud1a0"] + "ì¼"\ + "ì›”"\ + "í™”"\ + "수"\ + "목"\ + "금"\ + "토"] ::msgcat::mcset ko DAYS_OF_WEEK_FULL [list \ - "\uc77c\uc694\uc77c"\ - "\uc6d4\uc694\uc77c"\ - "\ud654\uc694\uc77c"\ - "\uc218\uc694\uc77c"\ - "\ubaa9\uc694\uc77c"\ - "\uae08\uc694\uc77c"\ - "\ud1a0\uc694\uc77c"] + "ì¼ìš”ì¼"\ + "월요ì¼"\ + "화요ì¼"\ + "수요ì¼"\ + "목요ì¼"\ + "금요ì¼"\ + "토요ì¼"] ::msgcat::mcset ko MONTHS_ABBREV [list \ - "1\uc6d4"\ - "2\uc6d4"\ - "3\uc6d4"\ - "4\uc6d4"\ - "5\uc6d4"\ - "6\uc6d4"\ - "7\uc6d4"\ - "8\uc6d4"\ - "9\uc6d4"\ - "10\uc6d4"\ - "11\uc6d4"\ - "12\uc6d4"\ + "1ì›”"\ + "2ì›”"\ + "3ì›”"\ + "4ì›”"\ + "5ì›”"\ + "6ì›”"\ + "7ì›”"\ + "8ì›”"\ + "9ì›”"\ + "10ì›”"\ + "11ì›”"\ + "12ì›”"\ ""] ::msgcat::mcset ko MONTHS_FULL [list \ - "1\uc6d4"\ - "2\uc6d4"\ - "3\uc6d4"\ - "4\uc6d4"\ - "5\uc6d4"\ - "6\uc6d4"\ - "7\uc6d4"\ - "8\uc6d4"\ - "9\uc6d4"\ - "10\uc6d4"\ - "11\uc6d4"\ - "12\uc6d4"\ + "1ì›”"\ + "2ì›”"\ + "3ì›”"\ + "4ì›”"\ + "5ì›”"\ + "6ì›”"\ + "7ì›”"\ + "8ì›”"\ + "9ì›”"\ + "10ì›”"\ + "11ì›”"\ + "12ì›”"\ ""] - ::msgcat::mcset ko AM "\uc624\uc804" - ::msgcat::mcset ko PM "\uc624\ud6c4" + ::msgcat::mcset ko AM "오전" + ::msgcat::mcset ko PM "오후" ::msgcat::mcset ko DATE_FORMAT "%Y-%m-%d" ::msgcat::mcset ko TIME_FORMAT_12 "%P %l:%M:%S" ::msgcat::mcset ko DATE_TIME_FORMAT "%Y-%m-%d %P %l:%M:%S %z" - ::msgcat::mcset ko LOCALE_DATE_FORMAT "%Y\ub144%B%Od\uc77c" - ::msgcat::mcset ko LOCALE_TIME_FORMAT "%H\uc2dc%M\ubd84%S\ucd08" - ::msgcat::mcset ko LOCALE_DATE_TIME_FORMAT "%A %Y\ub144%B%Od\uc77c%H\uc2dc%M\ubd84%S\ucd08 %z" + ::msgcat::mcset ko LOCALE_DATE_FORMAT "%Yë…„%B%Odì¼" + ::msgcat::mcset ko LOCALE_TIME_FORMAT "%H시%Më¶„%Sì´ˆ" + ::msgcat::mcset ko LOCALE_DATE_TIME_FORMAT "%A %Yë…„%B%Odì¼%H시%Më¶„%Sì´ˆ %z" } diff --git a/library/msgs/ko_kr.msg b/library/msgs/ko_kr.msg index ea5bbd7..f23bd6b 100644 --- a/library/msgs/ko_kr.msg +++ b/library/msgs/ko_kr.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset ko_KR BCE "\uae30\uc6d0\uc804" - ::msgcat::mcset ko_KR CE "\uc11c\uae30" + ::msgcat::mcset ko_KR BCE "기ì›ì „" + ::msgcat::mcset ko_KR CE "서기" ::msgcat::mcset ko_KR DATE_FORMAT "%Y.%m.%d" ::msgcat::mcset ko_KR TIME_FORMAT_12 "%P %l:%M:%S" ::msgcat::mcset ko_KR DATE_TIME_FORMAT "%Y.%m.%d %P %l:%M:%S %z" diff --git a/library/msgs/kok.msg b/library/msgs/kok.msg index 0869f20..231853b 100644 --- a/library/msgs/kok.msg +++ b/library/msgs/kok.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset kok DAYS_OF_WEEK_FULL [list \ - "\u0906\u0926\u093f\u0924\u094d\u092f\u0935\u093e\u0930"\ - "\u0938\u094b\u092e\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0933\u093e\u0930"\ - "\u092c\u0941\u0927\u0935\u093e\u0930"\ - "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ - "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ - "\u0936\u0928\u093f\u0935\u093e\u0930"] + "आदितà¥à¤¯à¤µà¤¾à¤°"\ + "सोमवार"\ + "मंगळार"\ + "बà¥à¤§à¤µà¤¾à¤°"\ + "गà¥à¤°à¥à¤µà¤¾à¤°"\ + "शà¥à¤•à¥à¤°à¤µà¤¾à¤°"\ + "शनिवार"] ::msgcat::mcset kok MONTHS_ABBREV [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + "जानेवारी"\ + "फेबृवारी"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] ::msgcat::mcset kok MONTHS_FULL [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] - ::msgcat::mcset kok AM "\u0915\u094d\u0930\u093f\u0938\u094d\u0924\u092a\u0942\u0930\u094d\u0935" - ::msgcat::mcset kok PM "\u0915\u094d\u0930\u093f\u0938\u094d\u0924\u0936\u0916\u093e" + "जानेवारी"\ + "फेबà¥à¤°à¥à¤µà¤¾à¤°à¥€"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] + ::msgcat::mcset kok AM "कà¥à¤°à¤¿à¤¸à¥à¤¤à¤ªà¥‚रà¥à¤µ" + ::msgcat::mcset kok PM "कà¥à¤°à¤¿à¤¸à¥à¤¤à¤¶à¤–ा" } diff --git a/library/msgs/lt.msg b/library/msgs/lt.msg index 27b0985..15829a9 100644 --- a/library/msgs/lt.msg +++ b/library/msgs/lt.msg @@ -7,15 +7,15 @@ namespace eval ::tcl::clock { "Tr"\ "Kt"\ "Pn"\ - "\u0160t"] + "Å t"] ::msgcat::mcset lt DAYS_OF_WEEK_FULL [list \ "Sekmadienis"\ "Pirmadienis"\ "Antradienis"\ - "Tre\u010diadienis"\ + "TreÄiadienis"\ "Ketvirtadienis"\ "Penktadienis"\ - "\u0160e\u0161tadienis"] + "Å eÅ¡tadienis"] ::msgcat::mcset lt MONTHS_ABBREV [list \ "Sau"\ "Vas"\ @@ -34,15 +34,15 @@ namespace eval ::tcl::clock { "Sausio"\ "Vasario"\ "Kovo"\ - "Baland\u017eio"\ - "Gegu\u017e\u0117s"\ - "Bir\u017eelio"\ + "Balandžio"\ + "Gegužės"\ + "Birželio"\ "Liepos"\ - "Rugpj\u016b\u010dio"\ - "Rugs\u0117jo"\ + "RugpjÅ«Äio"\ + "RugsÄ—jo"\ "Spalio"\ - "Lapkri\u010dio"\ - "Gruod\u017eio"\ + "LapkriÄio"\ + "Gruodžio"\ ""] ::msgcat::mcset lt BCE "pr.Kr." ::msgcat::mcset lt CE "po.Kr." diff --git a/library/msgs/lv.msg b/library/msgs/lv.msg index a037b15..730fd33 100644 --- a/library/msgs/lv.msg +++ b/library/msgs/lv.msg @@ -9,10 +9,10 @@ namespace eval ::tcl::clock { "Pk"\ "S"] ::msgcat::mcset lv DAYS_OF_WEEK_FULL [list \ - "sv\u0113tdiena"\ + "svÄ“tdiena"\ "pirmdiena"\ "otrdiena"\ - "tre\u0161diena"\ + "treÅ¡diena"\ "ceturdien"\ "piektdiena"\ "sestdiena"] @@ -22,8 +22,8 @@ namespace eval ::tcl::clock { "Mar"\ "Apr"\ "Maijs"\ - "J\u016bn"\ - "J\u016bl"\ + "JÅ«n"\ + "JÅ«l"\ "Aug"\ "Sep"\ "Okt"\ @@ -31,21 +31,21 @@ namespace eval ::tcl::clock { "Dec"\ ""] ::msgcat::mcset lv MONTHS_FULL [list \ - "janv\u0101ris"\ - "febru\u0101ris"\ + "janvÄris"\ + "februÄris"\ "marts"\ - "apr\u012blis"\ + "aprÄ«lis"\ "maijs"\ - "j\u016bnijs"\ - "j\u016blijs"\ + "jÅ«nijs"\ + "jÅ«lijs"\ "augusts"\ "septembris"\ "oktobris"\ "novembris"\ "decembris"\ ""] - ::msgcat::mcset lv BCE "pm\u0113" - ::msgcat::mcset lv CE "m\u0113" + ::msgcat::mcset lv BCE "pmÄ“" + ::msgcat::mcset lv CE "mÄ“" ::msgcat::mcset lv DATE_FORMAT "%Y.%e.%m" ::msgcat::mcset lv TIME_FORMAT "%H:%M:%S" ::msgcat::mcset lv DATE_TIME_FORMAT "%Y.%e.%m %H:%M:%S %z" diff --git a/library/msgs/mk.msg b/library/msgs/mk.msg index 41cf60d..9b7bd9d 100644 --- a/library/msgs/mk.msg +++ b/library/msgs/mk.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset mk DAYS_OF_WEEK_ABBREV [list \ - "\u043d\u0435\u0434."\ - "\u043f\u043e\u043d."\ - "\u0432\u0442."\ - "\u0441\u0440\u0435."\ - "\u0447\u0435\u0442."\ - "\u043f\u0435\u0442."\ - "\u0441\u0430\u0431."] + "нед."\ + "пон."\ + "вт."\ + "Ñре."\ + "чет."\ + "пет."\ + "Ñаб."] ::msgcat::mcset mk DAYS_OF_WEEK_FULL [list \ - "\u043d\u0435\u0434\u0435\u043b\u0430"\ - "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a"\ - "\u0432\u0442\u043e\u0440\u043d\u0438\u043a"\ - "\u0441\u0440\u0435\u0434\u0430"\ - "\u0447\u0435\u0442\u0432\u0440\u0442\u043e\u043a"\ - "\u043f\u0435\u0442\u043e\u043a"\ - "\u0441\u0430\u0431\u043e\u0442\u0430"] + "недела"\ + "понеделник"\ + "вторник"\ + "Ñреда"\ + "четврток"\ + "петок"\ + "Ñабота"] ::msgcat::mcset mk MONTHS_ABBREV [list \ - "\u0458\u0430\u043d."\ - "\u0444\u0435\u0432."\ - "\u043c\u0430\u0440."\ - "\u0430\u043f\u0440."\ - "\u043c\u0430\u0458."\ - "\u0458\u0443\u043d."\ - "\u0458\u0443\u043b."\ - "\u0430\u0432\u0433."\ - "\u0441\u0435\u043f\u0442."\ - "\u043e\u043a\u0442."\ - "\u043d\u043e\u0435\u043c."\ - "\u0434\u0435\u043a\u0435\u043c."\ + "јан."\ + "фев."\ + "мар."\ + "апр."\ + "мај."\ + "јун."\ + "јул."\ + "авг."\ + "Ñепт."\ + "окт."\ + "ноем."\ + "декем."\ ""] ::msgcat::mcset mk MONTHS_FULL [list \ - "\u0458\u0430\u043d\u0443\u0430\u0440\u0438"\ - "\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438"\ - "\u043c\u0430\u0440\u0442"\ - "\u0430\u043f\u0440\u0438\u043b"\ - "\u043c\u0430\u0458"\ - "\u0458\u0443\u043d\u0438"\ - "\u0458\u0443\u043b\u0438"\ - "\u0430\u0432\u0433\u0443\u0441\u0442"\ - "\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438"\ - "\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438"\ - "\u043d\u043e\u0435\u043c\u0432\u0440\u0438"\ - "\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438"\ + "јануари"\ + "февруари"\ + "март"\ + "април"\ + "мај"\ + "јуни"\ + "јули"\ + "авгуÑÑ‚"\ + "Ñептември"\ + "октомври"\ + "ноември"\ + "декември"\ ""] - ::msgcat::mcset mk BCE "\u043f\u0440.\u043d.\u0435." - ::msgcat::mcset mk CE "\u0430\u0435." + ::msgcat::mcset mk BCE "пр.н.е." + ::msgcat::mcset mk CE "ае." ::msgcat::mcset mk DATE_FORMAT "%e.%m.%Y" ::msgcat::mcset mk TIME_FORMAT "%H:%M:%S %z" ::msgcat::mcset mk DATE_TIME_FORMAT "%e.%m.%Y %H:%M:%S %z %z" diff --git a/library/msgs/mr.msg b/library/msgs/mr.msg index cea427a..e475615 100644 --- a/library/msgs/mr.msg +++ b/library/msgs/mr.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset mr DAYS_OF_WEEK_FULL [list \ - "\u0930\u0935\u093f\u0935\u093e\u0930"\ - "\u0938\u094b\u092e\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0933\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0933\u0935\u093e\u0930"\ - "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ - "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ - "\u0936\u0928\u093f\u0935\u093e\u0930"] + "रविवार"\ + "सोमवार"\ + "मंगळवार"\ + "मंगळवार"\ + "गà¥à¤°à¥à¤µà¤¾à¤°"\ + "शà¥à¤•à¥à¤°à¤µà¤¾à¤°"\ + "शनिवार"] ::msgcat::mcset mr MONTHS_ABBREV [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + "जानेवारी"\ + "फेबृवारी"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] ::msgcat::mcset mr MONTHS_FULL [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + "जानेवारी"\ + "फेबृवारी"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] ::msgcat::mcset mr AM "BC" ::msgcat::mcset mr PM "AD" } diff --git a/library/msgs/mt.msg b/library/msgs/mt.msg index ddd5446..c479e47 100644 --- a/library/msgs/mt.msg +++ b/library/msgs/mt.msg @@ -1,19 +1,19 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset mt DAYS_OF_WEEK_ABBREV [list \ - "\u0126ad"\ + "Ħad"\ "Tne"\ "Tli"\ "Erb"\ - "\u0126am"\ - "\u0120im"] + "Ħam"\ + "Ä im"] ::msgcat::mcset mt MONTHS_ABBREV [list \ "Jan"\ "Fra"\ "Mar"\ "Apr"\ "Mej"\ - "\u0120un"\ + "Ä un"\ "Lul"\ "Awi"\ "Set"\ diff --git a/library/msgs/nb.msg b/library/msgs/nb.msg index 90d49a3..4dd76c7 100644 --- a/library/msgs/nb.msg +++ b/library/msgs/nb.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset nb DAYS_OF_WEEK_ABBREV [list \ - "s\u00f8"\ + "sø"\ "ma"\ "ti"\ "on"\ "to"\ "fr"\ - "l\u00f8"] + "lø"] ::msgcat::mcset nb DAYS_OF_WEEK_FULL [list \ - "s\u00f8ndag"\ + "søndag"\ "mandag"\ "tirsdag"\ "onsdag"\ "torsdag"\ "fredag"\ - "l\u00f8rdag"] + "lørdag"] ::msgcat::mcset nb MONTHS_ABBREV [list \ "jan"\ "feb"\ diff --git a/library/msgs/nn.msg b/library/msgs/nn.msg index bd61ac9..b61a2dd 100644 --- a/library/msgs/nn.msg +++ b/library/msgs/nn.msg @@ -2,7 +2,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset nn DAYS_OF_WEEK_ABBREV [list \ "su"\ - "m\u00e5"\ + "mÃ¥"\ "ty"\ "on"\ "to"\ @@ -10,7 +10,7 @@ namespace eval ::tcl::clock { "lau"] ::msgcat::mcset nn DAYS_OF_WEEK_FULL [list \ "sundag"\ - "m\u00e5ndag"\ + "mÃ¥ndag"\ "tysdag"\ "onsdag"\ "torsdag"\ diff --git a/library/msgs/pl.msg b/library/msgs/pl.msg index d206f4b..821eea7 100644 --- a/library/msgs/pl.msg +++ b/library/msgs/pl.msg @@ -4,17 +4,17 @@ namespace eval ::tcl::clock { "N"\ "Pn"\ "Wt"\ - "\u015ar"\ + "Åšr"\ "Cz"\ "Pt"\ "So"] ::msgcat::mcset pl DAYS_OF_WEEK_FULL [list \ "niedziela"\ - "poniedzia\u0142ek"\ + "poniedziaÅ‚ek"\ "wtorek"\ - "\u015broda"\ + "Å›roda"\ "czwartek"\ - "pi\u0105tek"\ + "piÄ…tek"\ "sobota"] ::msgcat::mcset pl MONTHS_ABBREV [list \ "sty"\ @@ -26,23 +26,23 @@ namespace eval ::tcl::clock { "lip"\ "sie"\ "wrz"\ - "pa\u017a"\ + "paź"\ "lis"\ "gru"\ ""] ::msgcat::mcset pl MONTHS_FULL [list \ - "stycze\u0144"\ + "styczeÅ„"\ "luty"\ "marzec"\ - "kwiecie\u0144"\ + "kwiecieÅ„"\ "maj"\ "czerwiec"\ "lipiec"\ - "sierpie\u0144"\ - "wrzesie\u0144"\ - "pa\u017adziernik"\ + "sierpieÅ„"\ + "wrzesieÅ„"\ + "październik"\ "listopad"\ - "grudzie\u0144"\ + "grudzieÅ„"\ ""] ::msgcat::mcset pl BCE "p.n.e." ::msgcat::mcset pl CE "n.e." diff --git a/library/msgs/pt.msg b/library/msgs/pt.msg index 96fdb35..425c1f6 100644 --- a/library/msgs/pt.msg +++ b/library/msgs/pt.msg @@ -7,15 +7,15 @@ namespace eval ::tcl::clock { "Qua"\ "Qui"\ "Sex"\ - "S\u00e1b"] + "Sáb"] ::msgcat::mcset pt DAYS_OF_WEEK_FULL [list \ "Domingo"\ "Segunda-feira"\ - "Ter\u00e7a-feira"\ + "Terça-feira"\ "Quarta-feira"\ "Quinta-feira"\ "Sexta-feira"\ - "S\u00e1bado"] + "Sábado"] ::msgcat::mcset pt MONTHS_ABBREV [list \ "Jan"\ "Fev"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset pt MONTHS_FULL [list \ "Janeiro"\ "Fevereiro"\ - "Mar\u00e7o"\ + "Março"\ "Abril"\ "Maio"\ "Junho"\ diff --git a/library/msgs/ro.msg b/library/msgs/ro.msg index bdd7c61..f4452ba 100644 --- a/library/msgs/ro.msg +++ b/library/msgs/ro.msg @@ -9,13 +9,13 @@ namespace eval ::tcl::clock { "V"\ "S"] ::msgcat::mcset ro DAYS_OF_WEEK_FULL [list \ - "duminic\u0103"\ + "duminică"\ "luni"\ - "mar\u0163i"\ + "marÅ£i"\ "miercuri"\ "joi"\ "vineri"\ - "s\u00eemb\u0103t\u0103"] + "sîmbătă"] ::msgcat::mcset ro MONTHS_ABBREV [list \ "Ian"\ "Feb"\ @@ -45,7 +45,7 @@ namespace eval ::tcl::clock { "decembrie"\ ""] ::msgcat::mcset ro BCE "d.C." - ::msgcat::mcset ro CE "\u00ee.d.C." + ::msgcat::mcset ro CE "î.d.C." ::msgcat::mcset ro DATE_FORMAT "%d.%m.%Y" ::msgcat::mcset ro TIME_FORMAT "%H:%M:%S" ::msgcat::mcset ro DATE_TIME_FORMAT "%d.%m.%Y %H:%M:%S %z" diff --git a/library/msgs/ru.msg b/library/msgs/ru.msg index 65b075d..983a253 100644 --- a/library/msgs/ru.msg +++ b/library/msgs/ru.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ru DAYS_OF_WEEK_ABBREV [list \ - "\u0412\u0441"\ - "\u041f\u043d"\ - "\u0412\u0442"\ - "\u0421\u0440"\ - "\u0427\u0442"\ - "\u041f\u0442"\ - "\u0421\u0431"] + "Ð’Ñ"\ + "Пн"\ + "Ð’Ñ‚"\ + "Ср"\ + "Чт"\ + "Пт"\ + "Сб"] ::msgcat::mcset ru DAYS_OF_WEEK_FULL [list \ - "\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"\ - "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a"\ - "\u0432\u0442\u043e\u0440\u043d\u0438\u043a"\ - "\u0441\u0440\u0435\u0434\u0430"\ - "\u0447\u0435\u0442\u0432\u0435\u0440\u0433"\ - "\u043f\u044f\u0442\u043d\u0438\u0446\u0430"\ - "\u0441\u0443\u0431\u0431\u043e\u0442\u0430"] + "воÑкреÑенье"\ + "понедельник"\ + "вторник"\ + "Ñреда"\ + "четверг"\ + "пÑтница"\ + "Ñуббота"] ::msgcat::mcset ru MONTHS_ABBREV [list \ - "\u044f\u043d\u0432"\ - "\u0444\u0435\u0432"\ - "\u043c\u0430\u0440"\ - "\u0430\u043f\u0440"\ - "\u043c\u0430\u0439"\ - "\u0438\u044e\u043d"\ - "\u0438\u044e\u043b"\ - "\u0430\u0432\u0433"\ - "\u0441\u0435\u043d"\ - "\u043e\u043a\u0442"\ - "\u043d\u043e\u044f"\ - "\u0434\u0435\u043a"\ + "Ñнв"\ + "фев"\ + "мар"\ + "апр"\ + "май"\ + "июн"\ + "июл"\ + "авг"\ + "Ñен"\ + "окт"\ + "ноÑ"\ + "дек"\ ""] ::msgcat::mcset ru MONTHS_FULL [list \ - "\u042f\u043d\u0432\u0430\u0440\u044c"\ - "\u0424\u0435\u0432\u0440\u0430\u043b\u044c"\ - "\u041c\u0430\u0440\u0442"\ - "\u0410\u043f\u0440\u0435\u043b\u044c"\ - "\u041c\u0430\u0439"\ - "\u0418\u044e\u043d\u044c"\ - "\u0418\u044e\u043b\u044c"\ - "\u0410\u0432\u0433\u0443\u0441\u0442"\ - "\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c"\ - "\u041e\u043a\u0442\u044f\u0431\u0440\u044c"\ - "\u041d\u043e\u044f\u0431\u0440\u044c"\ - "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"\ + "Январь"\ + "Февраль"\ + "Март"\ + "Ðпрель"\ + "Май"\ + "Июнь"\ + "Июль"\ + "ÐвгуÑÑ‚"\ + "СентÑбрь"\ + "ОктÑбрь"\ + "ÐоÑбрь"\ + "Декабрь"\ ""] - ::msgcat::mcset ru BCE "\u0434\u043e \u043d.\u044d." - ::msgcat::mcset ru CE "\u043d.\u044d." + ::msgcat::mcset ru BCE "до н.Ñ." + ::msgcat::mcset ru CE "н.Ñ." ::msgcat::mcset ru DATE_FORMAT "%d.%m.%Y" ::msgcat::mcset ru TIME_FORMAT "%k:%M:%S" ::msgcat::mcset ru DATE_TIME_FORMAT "%d.%m.%Y %k:%M:%S %z" diff --git a/library/msgs/sh.msg b/library/msgs/sh.msg index 6ee0fc7..2e4143d 100644 --- a/library/msgs/sh.msg +++ b/library/msgs/sh.msg @@ -5,7 +5,7 @@ namespace eval ::tcl::clock { "Pon"\ "Uto"\ "Sre"\ - "\u010cet"\ + "ÄŒet"\ "Pet"\ "Sub"] ::msgcat::mcset sh DAYS_OF_WEEK_FULL [list \ @@ -13,7 +13,7 @@ namespace eval ::tcl::clock { "Ponedeljak"\ "Utorak"\ "Sreda"\ - "\u010cetvrtak"\ + "ÄŒetvrtak"\ "Petak"\ "Subota"] ::msgcat::mcset sh MONTHS_ABBREV [list \ diff --git a/library/msgs/sk.msg b/library/msgs/sk.msg index 9b2f0aa..dc6f6b6 100644 --- a/library/msgs/sk.msg +++ b/library/msgs/sk.msg @@ -5,15 +5,15 @@ namespace eval ::tcl::clock { "Po"\ "Ut"\ "St"\ - "\u0160t"\ + "Å t"\ "Pa"\ "So"] ::msgcat::mcset sk DAYS_OF_WEEK_FULL [list \ - "Nede\u013ee"\ + "Nedeľe"\ "Pondelok"\ "Utorok"\ "Streda"\ - "\u0160tvrtok"\ + "Å tvrtok"\ "Piatok"\ "Sobota"] ::msgcat::mcset sk MONTHS_ABBREV [list \ @@ -21,9 +21,9 @@ namespace eval ::tcl::clock { "feb"\ "mar"\ "apr"\ - "m\u00e1j"\ - "j\u00fan"\ - "j\u00fal"\ + "máj"\ + "jún"\ + "júl"\ "aug"\ "sep"\ "okt"\ @@ -31,16 +31,16 @@ namespace eval ::tcl::clock { "dec"\ ""] ::msgcat::mcset sk MONTHS_FULL [list \ - "janu\u00e1r"\ - "febru\u00e1r"\ + "január"\ + "február"\ "marec"\ - "apr\u00edl"\ - "m\u00e1j"\ - "j\u00fan"\ - "j\u00fal"\ + "apríl"\ + "máj"\ + "jún"\ + "júl"\ "august"\ "september"\ - "okt\u00f3ber"\ + "október"\ "november"\ "december"\ ""] diff --git a/library/msgs/sl.msg b/library/msgs/sl.msg index 42bc509..2ee0a03 100644 --- a/library/msgs/sl.msg +++ b/library/msgs/sl.msg @@ -5,7 +5,7 @@ namespace eval ::tcl::clock { "Pon"\ "Tor"\ "Sre"\ - "\u010cet"\ + "ÄŒet"\ "Pet"\ "Sob"] ::msgcat::mcset sl DAYS_OF_WEEK_FULL [list \ @@ -13,7 +13,7 @@ namespace eval ::tcl::clock { "Ponedeljek"\ "Torek"\ "Sreda"\ - "\u010cetrtek"\ + "ÄŒetrtek"\ "Petek"\ "Sobota"] ::msgcat::mcset sl MONTHS_ABBREV [list \ @@ -44,7 +44,7 @@ namespace eval ::tcl::clock { "november"\ "december"\ ""] - ::msgcat::mcset sl BCE "pr.n.\u0161." + ::msgcat::mcset sl BCE "pr.n.Å¡." ::msgcat::mcset sl CE "po Kr." ::msgcat::mcset sl DATE_FORMAT "%Y.%m.%e" ::msgcat::mcset sl TIME_FORMAT "%k:%M:%S" diff --git a/library/msgs/sq.msg b/library/msgs/sq.msg index 8fb1fce..65da407 100644 --- a/library/msgs/sq.msg +++ b/library/msgs/sq.msg @@ -2,20 +2,20 @@ namespace eval ::tcl::clock { ::msgcat::mcset sq DAYS_OF_WEEK_ABBREV [list \ "Die"\ - "H\u00ebn"\ + "Hën"\ "Mar"\ - "M\u00ebr"\ + "Mër"\ "Enj"\ "Pre"\ "Sht"] ::msgcat::mcset sq DAYS_OF_WEEK_FULL [list \ "e diel"\ - "e h\u00ebn\u00eb"\ - "e mart\u00eb"\ - "e m\u00ebrkur\u00eb"\ + "e hënë"\ + "e martë"\ + "e mërkurë"\ "e enjte"\ "e premte"\ - "e shtun\u00eb"] + "e shtunë"] ::msgcat::mcset sq MONTHS_ABBREV [list \ "Jan"\ "Shk"\ @@ -27,7 +27,7 @@ namespace eval ::tcl::clock { "Gsh"\ "Sht"\ "Tet"\ - "N\u00ebn"\ + "Nën"\ "Dhj"\ ""] ::msgcat::mcset sq MONTHS_FULL [list \ @@ -41,7 +41,7 @@ namespace eval ::tcl::clock { "gusht"\ "shtator"\ "tetor"\ - "n\u00ebntor"\ + "nëntor"\ "dhjetor"\ ""] ::msgcat::mcset sq BCE "p.e.r." diff --git a/library/msgs/sr.msg b/library/msgs/sr.msg index 7576668..3d84d6c 100644 --- a/library/msgs/sr.msg +++ b/library/msgs/sr.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset sr DAYS_OF_WEEK_ABBREV [list \ - "\u041d\u0435\u0434"\ - "\u041f\u043e\u043d"\ - "\u0423\u0442\u043e"\ - "\u0421\u0440\u0435"\ - "\u0427\u0435\u0442"\ - "\u041f\u0435\u0442"\ - "\u0421\u0443\u0431"] + "Ðед"\ + "Пон"\ + "Уто"\ + "Сре"\ + "Чет"\ + "Пет"\ + "Суб"] ::msgcat::mcset sr DAYS_OF_WEEK_FULL [list \ - "\u041d\u0435\u0434\u0435\u0459\u0430"\ - "\u041f\u043e\u043d\u0435\u0434\u0435\u0459\u0430\u043a"\ - "\u0423\u0442\u043e\u0440\u0430\u043a"\ - "\u0421\u0440\u0435\u0434\u0430"\ - "\u0427\u0435\u0442\u0432\u0440\u0442\u0430\u043a"\ - "\u041f\u0435\u0442\u0430\u043a"\ - "\u0421\u0443\u0431\u043e\u0442\u0430"] + "Ðедеља"\ + "Понедељак"\ + "Уторак"\ + "Среда"\ + "Четвртак"\ + "Петак"\ + "Субота"] ::msgcat::mcset sr MONTHS_ABBREV [list \ - "\u0408\u0430\u043d"\ - "\u0424\u0435\u0431"\ - "\u041c\u0430\u0440"\ - "\u0410\u043f\u0440"\ - "\u041c\u0430\u0458"\ - "\u0408\u0443\u043d"\ - "\u0408\u0443\u043b"\ - "\u0410\u0432\u0433"\ - "\u0421\u0435\u043f"\ - "\u041e\u043a\u0442"\ - "\u041d\u043e\u0432"\ - "\u0414\u0435\u0446"\ + "Јан"\ + "Феб"\ + "Мар"\ + "Ðпр"\ + "Мај"\ + "Јун"\ + "Јул"\ + "Ðвг"\ + "Сеп"\ + "Окт"\ + "Ðов"\ + "Дец"\ ""] ::msgcat::mcset sr MONTHS_FULL [list \ - "\u0408\u0430\u043d\u0443\u0430\u0440"\ - "\u0424\u0435\u0431\u0440\u0443\u0430\u0440"\ - "\u041c\u0430\u0440\u0442"\ - "\u0410\u043f\u0440\u0438\u043b"\ - "\u041c\u0430\u0458"\ - "\u0408\u0443\u043d\u0438"\ - "\u0408\u0443\u043b\u0438"\ - "\u0410\u0432\u0433\u0443\u0441\u0442"\ - "\u0421\u0435\u043f\u0442\u0435\u043c\u0431\u0430\u0440"\ - "\u041e\u043a\u0442\u043e\u0431\u0430\u0440"\ - "\u041d\u043e\u0432\u0435\u043c\u0431\u0430\u0440"\ - "\u0414\u0435\u0446\u0435\u043c\u0431\u0430\u0440"\ + "Јануар"\ + "Фебруар"\ + "Март"\ + "Ðприл"\ + "Мај"\ + "Јуни"\ + "Јули"\ + "ÐвгуÑÑ‚"\ + "Септембар"\ + "Октобар"\ + "Ðовембар"\ + "Децембар"\ ""] - ::msgcat::mcset sr BCE "\u043f. \u043d. \u0435." - ::msgcat::mcset sr CE "\u043d. \u0435" + ::msgcat::mcset sr BCE "п. н. е." + ::msgcat::mcset sr CE "н. е" ::msgcat::mcset sr DATE_FORMAT "%Y.%m.%e" ::msgcat::mcset sr TIME_FORMAT "%k.%M.%S" ::msgcat::mcset sr DATE_TIME_FORMAT "%Y.%m.%e %k.%M.%S %z" diff --git a/library/msgs/sv.msg b/library/msgs/sv.msg index f7a67c6..5716092 100644 --- a/library/msgs/sv.msg +++ b/library/msgs/sv.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset sv DAYS_OF_WEEK_ABBREV [list \ - "s\u00f6"\ - "m\u00e5"\ + "sö"\ + "mÃ¥"\ "ti"\ "on"\ "to"\ "fr"\ - "l\u00f6"] + "lö"] ::msgcat::mcset sv DAYS_OF_WEEK_FULL [list \ - "s\u00f6ndag"\ - "m\u00e5ndag"\ + "söndag"\ + "mÃ¥ndag"\ "tisdag"\ "onsdag"\ "torsdag"\ "fredag"\ - "l\u00f6rdag"] + "lördag"] ::msgcat::mcset sv MONTHS_ABBREV [list \ "jan"\ "feb"\ diff --git a/library/msgs/ta.msg b/library/msgs/ta.msg index 4abb90c..ea62552 100644 --- a/library/msgs/ta.msg +++ b/library/msgs/ta.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ta DAYS_OF_WEEK_FULL [list \ - "\u0b9e\u0bbe\u0baf\u0bbf\u0bb1\u0bc1"\ - "\u0ba4\u0bbf\u0b99\u0bcd\u0b95\u0bb3\u0bcd"\ - "\u0b9a\u0bc6\u0bb5\u0bcd\u0bb5\u0bbe\u0baf\u0bcd"\ - "\u0baa\u0bc1\u0ba4\u0ba9\u0bcd"\ - "\u0bb5\u0bbf\u0baf\u0bbe\u0bb4\u0ba9\u0bcd"\ - "\u0bb5\u0bc6\u0bb3\u0bcd\u0bb3\u0bbf"\ - "\u0b9a\u0ba9\u0bbf"] + "ஞாயிறà¯"\ + "திஙà¯à®•ளà¯"\ + "செவà¯à®µà®¾à®¯à¯"\ + "பà¯à®¤à®©à¯"\ + "வியாழனà¯"\ + "வெளà¯à®³à®¿"\ + "சனி"] ::msgcat::mcset ta MONTHS_ABBREV [list \ - "\u0b9c\u0ba9\u0bb5\u0bb0\u0bbf"\ - "\u0baa\u0bc6\u0baa\u0bcd\u0bb0\u0bb5\u0bb0\u0bbf"\ - "\u0bae\u0bbe\u0bb0\u0bcd\u0b9a\u0bcd"\ - "\u0b8f\u0baa\u0bcd\u0bb0\u0bb2\u0bcd"\ - "\u0bae\u0bc7"\ - "\u0b9c\u0bc2\u0ba9\u0bcd"\ - "\u0b9c\u0bc2\u0bb2\u0bc8"\ - "\u0b86\u0b95\u0bb8\u0bcd\u0b9f\u0bcd"\ - "\u0b9a\u0bc6\u0baa\u0bcd\u0b9f\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b85\u0b95\u0bcd\u0b9f\u0bcb\u0baa\u0bb0\u0bcd"\ - "\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcdr"] + "ஜனவரி"\ + "பெபà¯à®°à®µà®°à®¿"\ + "மாரà¯à®šà¯"\ + "à®à®ªà¯à®°à®²à¯"\ + "மே"\ + "ஜூனà¯"\ + "ஜூலை"\ + "ஆகஸà¯à®Ÿà¯"\ + "செபà¯à®Ÿà®®à¯à®ªà®°à¯"\ + "அகà¯à®Ÿà¯‹à®ªà®°à¯"\ + "நவமà¯à®ªà®°à¯"\ + "டிசமà¯à®ªà®°à¯r"] ::msgcat::mcset ta MONTHS_FULL [list \ - "\u0b9c\u0ba9\u0bb5\u0bb0\u0bbf"\ - "\u0baa\u0bc6\u0baa\u0bcd\u0bb0\u0bb5\u0bb0\u0bbf"\ - "\u0bae\u0bbe\u0bb0\u0bcd\u0b9a\u0bcd"\ - "\u0b8f\u0baa\u0bcd\u0bb0\u0bb2\u0bcd"\ - "\u0bae\u0bc7"\ - "\u0b9c\u0bc2\u0ba9\u0bcd"\ - "\u0b9c\u0bc2\u0bb2\u0bc8"\ - "\u0b86\u0b95\u0bb8\u0bcd\u0b9f\u0bcd"\ - "\u0b9a\u0bc6\u0baa\u0bcd\u0b9f\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b85\u0b95\u0bcd\u0b9f\u0bcb\u0baa\u0bb0\u0bcd"\ - "\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcdr"] - ::msgcat::mcset ta AM "\u0b95\u0bbf\u0bae\u0bc1" - ::msgcat::mcset ta PM "\u0b95\u0bbf\u0baa\u0bbf" + "ஜனவரி"\ + "பெபà¯à®°à®µà®°à®¿"\ + "மாரà¯à®šà¯"\ + "à®à®ªà¯à®°à®²à¯"\ + "மே"\ + "ஜூனà¯"\ + "ஜூலை"\ + "ஆகஸà¯à®Ÿà¯"\ + "செபà¯à®Ÿà®®à¯à®ªà®°à¯"\ + "அகà¯à®Ÿà¯‹à®ªà®°à¯"\ + "நவமà¯à®ªà®°à¯"\ + "டிசமà¯à®ªà®°à¯r"] + ::msgcat::mcset ta AM "கிமà¯" + ::msgcat::mcset ta PM "கிபி" } diff --git a/library/msgs/te.msg b/library/msgs/te.msg index 6111473..f35ece4 100644 --- a/library/msgs/te.msg +++ b/library/msgs/te.msg @@ -1,47 +1,47 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset te DAYS_OF_WEEK_ABBREV [list \ - "\u0c06\u0c26\u0c3f"\ - "\u0c38\u0c4b\u0c2e"\ - "\u0c2e\u0c02\u0c17\u0c33"\ - "\u0c2c\u0c41\u0c27"\ - "\u0c17\u0c41\u0c30\u0c41"\ - "\u0c36\u0c41\u0c15\u0c4d\u0c30"\ - "\u0c36\u0c28\u0c3f"] + "ఆది"\ + "సోమ"\ + "మంగళ"\ + "à°¬à±à°§"\ + "à°—à±à°°à±"\ + "à°¶à±à°•à±à°°"\ + "శని"] ::msgcat::mcset te DAYS_OF_WEEK_FULL [list \ - "\u0c06\u0c26\u0c3f\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c38\u0c4b\u0c2e\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c2e\u0c02\u0c17\u0c33\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c2c\u0c41\u0c27\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c17\u0c41\u0c30\u0c41\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c36\u0c41\u0c15\u0c4d\u0c30\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c36\u0c28\u0c3f\u0c35\u0c3e\u0c30\u0c02"] + "ఆదివారం"\ + "సోమవారం"\ + "మంగళవారం"\ + "à°¬à±à°§à°µà°¾à°°à°‚"\ + "à°—à±à°°à±à°µà°¾à°°à°‚"\ + "à°¶à±à°•à±à°°à°µà°¾à°°à°‚"\ + "శనివారం"] ::msgcat::mcset te MONTHS_ABBREV [list \ - "\u0c1c\u0c28\u0c35\u0c30\u0c3f"\ - "\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f"\ - "\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f"\ - "\u0c0f\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d"\ - "\u0c2e\u0c47"\ - "\u0c1c\u0c42\u0c28\u0c4d"\ - "\u0c1c\u0c42\u0c32\u0c48"\ - "\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41"\ - "\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d"\ - "\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ + "జనవరి"\ + "à°«à°¿à°¬à±à°°à°µà°°à°¿"\ + "మారà±à°šà°¿"\ + "à°à°ªà±à°°à°¿à°²à±"\ + "మే"\ + "జూనà±"\ + "జూలై"\ + "ఆగసà±à°Ÿà±"\ + "సెపà±à°Ÿà±†à°‚బరà±"\ + "à°…à°•à±à°Ÿà±‹à°¬à°°à±"\ + "నవంబరà±"\ + "డిసెంబరà±"\ ""] ::msgcat::mcset te MONTHS_FULL [list \ - "\u0c1c\u0c28\u0c35\u0c30\u0c3f"\ - "\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f"\ - "\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f"\ - "\u0c0f\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d"\ - "\u0c2e\u0c47"\ - "\u0c1c\u0c42\u0c28\u0c4d"\ - "\u0c1c\u0c42\u0c32\u0c48"\ - "\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41"\ - "\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d"\ - "\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ + "జనవరి"\ + "à°«à°¿à°¬à±à°°à°µà°°à°¿"\ + "మారà±à°šà°¿"\ + "à°à°ªà±à°°à°¿à°²à±"\ + "మే"\ + "జూనà±"\ + "జూలై"\ + "ఆగసà±à°Ÿà±"\ + "సెపà±à°Ÿà±†à°‚బరà±"\ + "à°…à°•à±à°Ÿà±‹à°¬à°°à±"\ + "నవంబరà±"\ + "డిసెంబరà±"\ ""] } diff --git a/library/msgs/te_in.msg b/library/msgs/te_in.msg index 61638b5..84dd2b3 100644 --- a/library/msgs/te_in.msg +++ b/library/msgs/te_in.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset te_IN AM "\u0c2a\u0c42\u0c30\u0c4d\u0c35\u0c3e\u0c39\u0c4d\u0c28" - ::msgcat::mcset te_IN PM "\u0c05\u0c2a\u0c30\u0c3e\u0c39\u0c4d\u0c28" + ::msgcat::mcset te_IN AM "పూరà±à°µà°¾à°¹à±à°¨" + ::msgcat::mcset te_IN PM "అపరాహà±à°¨" ::msgcat::mcset te_IN DATE_FORMAT "%d/%m/%Y" ::msgcat::mcset te_IN TIME_FORMAT_12 "%I:%M:%S %P" ::msgcat::mcset te_IN DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" diff --git a/library/msgs/th.msg b/library/msgs/th.msg index 7486c35..edaa149 100644 --- a/library/msgs/th.msg +++ b/library/msgs/th.msg @@ -1,53 +1,53 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset th DAYS_OF_WEEK_ABBREV [list \ - "\u0e2d\u0e32."\ - "\u0e08."\ - "\u0e2d."\ - "\u0e1e."\ - "\u0e1e\u0e24."\ - "\u0e28."\ - "\u0e2a."] + "อา."\ + "จ."\ + "อ."\ + "พ."\ + "พฤ."\ + "ศ."\ + "ส."] ::msgcat::mcset th DAYS_OF_WEEK_FULL [list \ - "\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c"\ - "\u0e27\u0e31\u0e19\u0e08\u0e31\u0e19\u0e17\u0e23\u0e4c"\ - "\u0e27\u0e31\u0e19\u0e2d\u0e31\u0e07\u0e04\u0e32\u0e23"\ - "\u0e27\u0e31\u0e19\u0e1e\u0e38\u0e18"\ - "\u0e27\u0e31\u0e19\u0e1e\u0e24\u0e2b\u0e31\u0e2a\u0e1a\u0e14\u0e35"\ - "\u0e27\u0e31\u0e19\u0e28\u0e38\u0e01\u0e23\u0e4c"\ - "\u0e27\u0e31\u0e19\u0e40\u0e2a\u0e32\u0e23\u0e4c"] + "วันอาทิตย์"\ + "วันจันทร์"\ + "วันอังคาร"\ + "วันพุธ"\ + "วันพฤหัสบดี"\ + "วันศุà¸à¸£à¹Œ"\ + "วันเสาร์"] ::msgcat::mcset th MONTHS_ABBREV [list \ - "\u0e21.\u0e04."\ - "\u0e01.\u0e1e."\ - "\u0e21\u0e35.\u0e04."\ - "\u0e40\u0e21.\u0e22."\ - "\u0e1e.\u0e04."\ - "\u0e21\u0e34.\u0e22."\ - "\u0e01.\u0e04."\ - "\u0e2a.\u0e04."\ - "\u0e01.\u0e22."\ - "\u0e15.\u0e04."\ - "\u0e1e.\u0e22."\ - "\u0e18.\u0e04."\ + "ม.ค."\ + "à¸.พ."\ + "มี.ค."\ + "เม.ย."\ + "พ.ค."\ + "มิ.ย."\ + "à¸.ค."\ + "ส.ค."\ + "à¸.ย."\ + "ต.ค."\ + "พ.ย."\ + "ธ.ค."\ ""] ::msgcat::mcset th MONTHS_FULL [list \ - "\u0e21\u0e01\u0e23\u0e32\u0e04\u0e21"\ - "\u0e01\u0e38\u0e21\u0e20\u0e32\u0e1e\u0e31\u0e19\u0e18\u0e4c"\ - "\u0e21\u0e35\u0e19\u0e32\u0e04\u0e21"\ - "\u0e40\u0e21\u0e29\u0e32\u0e22\u0e19"\ - "\u0e1e\u0e24\u0e29\u0e20\u0e32\u0e04\u0e21"\ - "\u0e21\u0e34\u0e16\u0e38\u0e19\u0e32\u0e22\u0e19"\ - "\u0e01\u0e23\u0e01\u0e0e\u0e32\u0e04\u0e21"\ - "\u0e2a\u0e34\u0e07\u0e2b\u0e32\u0e04\u0e21"\ - "\u0e01\u0e31\u0e19\u0e22\u0e32\u0e22\u0e19"\ - "\u0e15\u0e38\u0e25\u0e32\u0e04\u0e21"\ - "\u0e1e\u0e24\u0e28\u0e08\u0e34\u0e01\u0e32\u0e22\u0e19"\ - "\u0e18\u0e31\u0e19\u0e27\u0e32\u0e04\u0e21"\ + "มà¸à¸£à¸²à¸„ม"\ + "à¸à¸¸à¸¡à¸ à¸²à¸žà¸±à¸™à¸˜à¹Œ"\ + "มีนาคม"\ + "เมษายน"\ + "พฤษภาคม"\ + "มิถุนายน"\ + "à¸à¸£à¸à¸Žà¸²à¸„ม"\ + "สิงหาคม"\ + "à¸à¸±à¸™à¸¢à¸²à¸¢à¸™"\ + "ตุลาคม"\ + "พฤศจิà¸à¸²à¸¢à¸™"\ + "ธันวาคม"\ ""] - ::msgcat::mcset th BCE "\u0e25\u0e17\u0e35\u0e48" - ::msgcat::mcset th CE "\u0e04.\u0e28." - ::msgcat::mcset th AM "\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07" - ::msgcat::mcset th PM "\u0e2b\u0e25\u0e31\u0e07\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07" + ::msgcat::mcset th BCE "ลที่" + ::msgcat::mcset th CE "ค.ศ." + ::msgcat::mcset th AM "à¸à¹ˆà¸­à¸™à¹€à¸—ี่ยง" + ::msgcat::mcset th PM "หลังเที่ยง" ::msgcat::mcset th DATE_FORMAT "%e/%m/%Y" ::msgcat::mcset th TIME_FORMAT "%k:%M:%S" ::msgcat::mcset th DATE_TIME_FORMAT "%e/%m/%Y %k:%M:%S %z" diff --git a/library/msgs/tr.msg b/library/msgs/tr.msg index 7b2ecf9..12869ee 100644 --- a/library/msgs/tr.msg +++ b/library/msgs/tr.msg @@ -4,27 +4,27 @@ namespace eval ::tcl::clock { "Paz"\ "Pzt"\ "Sal"\ - "\u00c7ar"\ + "Çar"\ "Per"\ "Cum"\ "Cmt"] ::msgcat::mcset tr DAYS_OF_WEEK_FULL [list \ "Pazar"\ "Pazartesi"\ - "Sal\u0131"\ - "\u00c7ar\u015famba"\ - "Per\u015fembe"\ + "Salı"\ + "ÇarÅŸamba"\ + "PerÅŸembe"\ "Cuma"\ "Cumartesi"] ::msgcat::mcset tr MONTHS_ABBREV [list \ "Oca"\ - "\u015eub"\ + "Åžub"\ "Mar"\ "Nis"\ "May"\ "Haz"\ "Tem"\ - "A\u011fu"\ + "AÄŸu"\ "Eyl"\ "Eki"\ "Kas"\ @@ -32,17 +32,17 @@ namespace eval ::tcl::clock { ""] ::msgcat::mcset tr MONTHS_FULL [list \ "Ocak"\ - "\u015eubat"\ + "Åžubat"\ "Mart"\ "Nisan"\ - "May\u0131s"\ + "Mayıs"\ "Haziran"\ "Temmuz"\ - "A\u011fustos"\ - "Eyl\u00fcl"\ + "AÄŸustos"\ + "Eylül"\ "Ekim"\ - "Kas\u0131m"\ - "Aral\u0131k"\ + "Kasım"\ + "Aralık"\ ""] ::msgcat::mcset tr DATE_FORMAT "%d.%m.%Y" ::msgcat::mcset tr TIME_FORMAT "%H:%M:%S" diff --git a/library/msgs/uk.msg b/library/msgs/uk.msg index 7d4c64a..42eb095 100644 --- a/library/msgs/uk.msg +++ b/library/msgs/uk.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset uk DAYS_OF_WEEK_ABBREV [list \ - "\u043d\u0434"\ - "\u043f\u043d"\ - "\u0432\u0442"\ - "\u0441\u0440"\ - "\u0447\u0442"\ - "\u043f\u0442"\ - "\u0441\u0431"] + "нд"\ + "пн"\ + "вт"\ + "ÑÑ€"\ + "чт"\ + "пт"\ + "Ñб"] ::msgcat::mcset uk DAYS_OF_WEEK_FULL [list \ - "\u043d\u0435\u0434\u0456\u043b\u044f"\ - "\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a"\ - "\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a"\ - "\u0441\u0435\u0440\u0435\u0434\u0430"\ - "\u0447\u0435\u0442\u0432\u0435\u0440"\ - "\u043f'\u044f\u0442\u043d\u0438\u0446\u044f"\ - "\u0441\u0443\u0431\u043e\u0442\u0430"] + "неділÑ"\ + "понеділок"\ + "вівторок"\ + "Ñереда"\ + "четвер"\ + "п'ÑтницÑ"\ + "Ñубота"] ::msgcat::mcset uk MONTHS_ABBREV [list \ - "\u0441\u0456\u0447"\ - "\u043b\u044e\u0442"\ - "\u0431\u0435\u0440"\ - "\u043a\u0432\u0456\u0442"\ - "\u0442\u0440\u0430\u0432"\ - "\u0447\u0435\u0440\u0432"\ - "\u043b\u0438\u043f"\ - "\u0441\u0435\u0440\u043f"\ - "\u0432\u0435\u0440"\ - "\u0436\u043e\u0432\u0442"\ - "\u043b\u0438\u0441\u0442"\ - "\u0433\u0440\u0443\u0434"\ + "Ñіч"\ + "лют"\ + "бер"\ + "квіт"\ + "трав"\ + "черв"\ + "лип"\ + "Ñерп"\ + "вер"\ + "жовт"\ + "лиÑÑ‚"\ + "груд"\ ""] ::msgcat::mcset uk MONTHS_FULL [list \ - "\u0441\u0456\u0447\u043d\u044f"\ - "\u043b\u044e\u0442\u043e\u0433\u043e"\ - "\u0431\u0435\u0440\u0435\u0437\u043d\u044f"\ - "\u043a\u0432\u0456\u0442\u043d\u044f"\ - "\u0442\u0440\u0430\u0432\u043d\u044f"\ - "\u0447\u0435\u0440\u0432\u043d\u044f"\ - "\u043b\u0438\u043f\u043d\u044f"\ - "\u0441\u0435\u0440\u043f\u043d\u044f"\ - "\u0432\u0435\u0440\u0435\u0441\u043d\u044f"\ - "\u0436\u043e\u0432\u0442\u043d\u044f"\ - "\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434\u0430"\ - "\u0433\u0440\u0443\u0434\u043d\u044f"\ + "ÑічнÑ"\ + "лютого"\ + "березнÑ"\ + "квітнÑ"\ + "травнÑ"\ + "червнÑ"\ + "липнÑ"\ + "ÑерпнÑ"\ + "вереÑнÑ"\ + "жовтнÑ"\ + "лиÑтопада"\ + "груднÑ"\ ""] - ::msgcat::mcset uk BCE "\u0434\u043e \u043d.\u0435." - ::msgcat::mcset uk CE "\u043f\u0456\u0441\u043b\u044f \u043d.\u0435." + ::msgcat::mcset uk BCE "до н.е." + ::msgcat::mcset uk CE "піÑÐ»Ñ Ð½.е." ::msgcat::mcset uk DATE_FORMAT "%e/%m/%Y" ::msgcat::mcset uk TIME_FORMAT "%k:%M:%S" ::msgcat::mcset uk DATE_TIME_FORMAT "%e/%m/%Y %k:%M:%S %z" diff --git a/library/msgs/vi.msg b/library/msgs/vi.msg index c98b2a6..3437ebf 100644 --- a/library/msgs/vi.msg +++ b/library/msgs/vi.msg @@ -9,13 +9,13 @@ namespace eval ::tcl::clock { "Th 7"\ "CN"] ::msgcat::mcset vi DAYS_OF_WEEK_FULL [list \ - "Th\u01b0\u0301 hai"\ - "Th\u01b0\u0301 ba"\ - "Th\u01b0\u0301 t\u01b0"\ - "Th\u01b0\u0301 n\u0103m"\ - "Th\u01b0\u0301 s\u00e1u"\ - "Th\u01b0\u0301 ba\u0309y"\ - "Chu\u0309 nh\u00e2\u0323t"] + "ThÆ°Ì hai"\ + "ThÆ°Ì ba"\ + "ThÆ°Ì tư"\ + "ThÆ°Ì năm"\ + "ThÆ°Ì sáu"\ + "ThÆ°Ì bảy"\ + "Chủ nhật"] ::msgcat::mcset vi MONTHS_ABBREV [list \ "Thg 1"\ "Thg 2"\ @@ -31,18 +31,18 @@ namespace eval ::tcl::clock { "Thg 12"\ ""] ::msgcat::mcset vi MONTHS_FULL [list \ - "Th\u00e1ng m\u00f4\u0323t"\ - "Th\u00e1ng hai"\ - "Th\u00e1ng ba"\ - "Th\u00e1ng t\u01b0"\ - "Th\u00e1ng n\u0103m"\ - "Th\u00e1ng s\u00e1u"\ - "Th\u00e1ng ba\u0309y"\ - "Th\u00e1ng t\u00e1m"\ - "Th\u00e1ng ch\u00edn"\ - "Th\u00e1ng m\u01b0\u01a1\u0300i"\ - "Th\u00e1ng m\u01b0\u01a1\u0300i m\u00f4\u0323t"\ - "Th\u00e1ng m\u01b0\u01a1\u0300i hai"\ + "Tháng một"\ + "Tháng hai"\ + "Tháng ba"\ + "Tháng tư"\ + "Tháng năm"\ + "Tháng sáu"\ + "Tháng bảy"\ + "Tháng tám"\ + "Tháng chín"\ + "Tháng mười"\ + "Tháng mười một"\ + "Tháng mười hai"\ ""] ::msgcat::mcset vi DATE_FORMAT "%d %b %Y" ::msgcat::mcset vi TIME_FORMAT "%H:%M:%S" diff --git a/library/msgs/zh.msg b/library/msgs/zh.msg index b799a32..9c1d08b 100644 --- a/library/msgs/zh.msg +++ b/library/msgs/zh.msg @@ -1,55 +1,55 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset zh DAYS_OF_WEEK_ABBREV [list \ - "\u661f\u671f\u65e5"\ - "\u661f\u671f\u4e00"\ - "\u661f\u671f\u4e8c"\ - "\u661f\u671f\u4e09"\ - "\u661f\u671f\u56db"\ - "\u661f\u671f\u4e94"\ - "\u661f\u671f\u516d"] + "星期日"\ + "星期一"\ + "星期二"\ + "星期三"\ + "星期四"\ + "星期五"\ + "星期六"] ::msgcat::mcset zh DAYS_OF_WEEK_FULL [list \ - "\u661f\u671f\u65e5"\ - "\u661f\u671f\u4e00"\ - "\u661f\u671f\u4e8c"\ - "\u661f\u671f\u4e09"\ - "\u661f\u671f\u56db"\ - "\u661f\u671f\u4e94"\ - "\u661f\u671f\u516d"] + "星期日"\ + "星期一"\ + "星期二"\ + "星期三"\ + "星期四"\ + "星期五"\ + "星期六"] ::msgcat::mcset zh MONTHS_ABBREV [list \ - "\u4e00\u6708"\ - "\u4e8c\u6708"\ - "\u4e09\u6708"\ - "\u56db\u6708"\ - "\u4e94\u6708"\ - "\u516d\u6708"\ - "\u4e03\u6708"\ - "\u516b\u6708"\ - "\u4e5d\u6708"\ - "\u5341\u6708"\ - "\u5341\u4e00\u6708"\ - "\u5341\u4e8c\u6708"\ + "一月"\ + "二月"\ + "三月"\ + "四月"\ + "五月"\ + "六月"\ + "七月"\ + "八月"\ + "乿œˆ"\ + "åæœˆ"\ + "å一月"\ + "å二月"\ ""] ::msgcat::mcset zh MONTHS_FULL [list \ - "\u4e00\u6708"\ - "\u4e8c\u6708"\ - "\u4e09\u6708"\ - "\u56db\u6708"\ - "\u4e94\u6708"\ - "\u516d\u6708"\ - "\u4e03\u6708"\ - "\u516b\u6708"\ - "\u4e5d\u6708"\ - "\u5341\u6708"\ - "\u5341\u4e00\u6708"\ - "\u5341\u4e8c\u6708"\ + "一月"\ + "二月"\ + "三月"\ + "四月"\ + "五月"\ + "六月"\ + "七月"\ + "八月"\ + "乿œˆ"\ + "åæœˆ"\ + "å一月"\ + "å二月"\ ""] - ::msgcat::mcset zh BCE "\u516c\u5143\u524d" - ::msgcat::mcset zh CE "\u516c\u5143" - ::msgcat::mcset zh AM "\u4e0a\u5348" - ::msgcat::mcset zh PM "\u4e0b\u5348" - ::msgcat::mcset zh LOCALE_NUMERALS "\u3007 \u4e00 \u4e8c \u4e09 \u56db \u4e94 \u516d \u4e03 \u516b \u4e5d \u5341 \u5341\u4e00 \u5341\u4e8c \u5341\u4e09 \u5341\u56db \u5341\u4e94 \u5341\u516d \u5341\u4e03 \u5341\u516b \u5341\u4e5d \u4e8c\u5341 \u5eff\u4e00 \u5eff\u4e8c \u5eff\u4e09 \u5eff\u56db \u5eff\u4e94 \u5eff\u516d \u5eff\u4e03 \u5eff\u516b \u5eff\u4e5d \u4e09\u5341 \u5345\u4e00 \u5345\u4e8c \u5345\u4e09 \u5345\u56db \u5345\u4e94 \u5345\u516d \u5345\u4e03 \u5345\u516b \u5345\u4e5d \u56db\u5341 \u56db\u5341\u4e00 \u56db\u5341\u4e8c \u56db\u5341\u4e09 \u56db\u5341\u56db \u56db\u5341\u4e94 \u56db\u5341\u516d \u56db\u5341\u4e03 \u56db\u5341\u516b \u56db\u5341\u4e5d \u4e94\u5341 \u4e94\u5341\u4e00 \u4e94\u5341\u4e8c \u4e94\u5341\u4e09 \u4e94\u5341\u56db \u4e94\u5341\u4e94 \u4e94\u5341\u516d \u4e94\u5341\u4e03 \u4e94\u5341\u516b \u4e94\u5341\u4e5d \u516d\u5341 \u516d\u5341\u4e00 \u516d\u5341\u4e8c \u516d\u5341\u4e09 \u516d\u5341\u56db \u516d\u5341\u4e94 \u516d\u5341\u516d \u516d\u5341\u4e03 \u516d\u5341\u516b \u516d\u5341\u4e5d \u4e03\u5341 \u4e03\u5341\u4e00 \u4e03\u5341\u4e8c \u4e03\u5341\u4e09 \u4e03\u5341\u56db \u4e03\u5341\u4e94 \u4e03\u5341\u516d \u4e03\u5341\u4e03 \u4e03\u5341\u516b \u4e03\u5341\u4e5d \u516b\u5341 \u516b\u5341\u4e00 \u516b\u5341\u4e8c \u516b\u5341\u4e09 \u516b\u5341\u56db \u516b\u5341\u4e94 \u516b\u5341\u516d \u516b\u5341\u4e03 \u516b\u5341\u516b \u516b\u5341\u4e5d \u4e5d\u5341 \u4e5d\u5341\u4e00 \u4e5d\u5341\u4e8c \u4e5d\u5341\u4e09 \u4e5d\u5341\u56db \u4e5d\u5341\u4e94 \u4e5d\u5341\u516d \u4e5d\u5341\u4e03 \u4e5d\u5341\u516b \u4e5d\u5341\u4e5d" - ::msgcat::mcset zh LOCALE_DATE_FORMAT "\u516c\u5143%Y\u5e74%B%Od\u65e5" - ::msgcat::mcset zh LOCALE_TIME_FORMAT "%OH\u65f6%OM\u5206%OS\u79d2" - ::msgcat::mcset zh LOCALE_DATE_TIME_FORMAT "%A %Y\u5e74%B%Od\u65e5%OH\u65f6%OM\u5206%OS\u79d2 %z" + ::msgcat::mcset zh BCE "公元å‰" + ::msgcat::mcset zh CE "公元" + ::msgcat::mcset zh AM "上åˆ" + ::msgcat::mcset zh PM "下åˆ" + ::msgcat::mcset zh LOCALE_NUMERALS "〇 一 二 三 å›› 五 å…­ 七 å…« ä¹ å å一 å二 å三 åå›› å五 åå…­ å七 åå…« åä¹ äºŒå 廿一 廿二 廿三 廿四 廿五 廿六 廿七 廿八 å»¿ä¹ ä¸‰å å…一 å…二 å…三 å…å›› å…五 å…å…­ å…七 å…å…« å…ä¹ å››å å››å一 å››å二 å››å三 å››åå›› å››å五 å››åå…­ å››å七 å››åå…« å››åä¹ äº”å 五å一 五å二 五å三 五åå›› 五å五 五åå…­ 五å七 五åå…« 五åä¹ å…­å å…­å一 å…­å二 å…­å三 å…­åå›› å…­å五 å…­åå…­ å…­å七 å…­åå…« å…­åä¹ ä¸ƒå 七å一 七å二 七å三 七åå›› 七å五 七åå…­ 七å七 七åå…« 七åä¹ å…«å å…«å一 å…«å二 å…«å三 å…«åå›› å…«å五 å…«åå…­ å…«å七 å…«åå…« å…«åä¹ ä¹å ä¹å一 ä¹å二 ä¹å三 ä¹åå›› ä¹å五 ä¹åå…­ ä¹å七 ä¹åå…« ä¹åä¹" + ::msgcat::mcset zh LOCALE_DATE_FORMAT "公元%Yå¹´%B%Odæ—¥" + ::msgcat::mcset zh LOCALE_TIME_FORMAT "%OHæ—¶%OM分%OSç§’" + ::msgcat::mcset zh LOCALE_DATE_TIME_FORMAT "%A %Yå¹´%B%Odæ—¥%OHæ—¶%OM分%OSç§’ %z" } diff --git a/library/msgs/zh_cn.msg b/library/msgs/zh_cn.msg index d62ce77..da2869a 100644 --- a/library/msgs/zh_cn.msg +++ b/library/msgs/zh_cn.msg @@ -2,6 +2,6 @@ namespace eval ::tcl::clock { ::msgcat::mcset zh_CN DATE_FORMAT "%Y-%m-%e" ::msgcat::mcset zh_CN TIME_FORMAT "%k:%M:%S" - ::msgcat::mcset zh_CN TIME_FORMAT_12 "%P%I\u65f6%M\u5206%S\u79d2" + ::msgcat::mcset zh_CN TIME_FORMAT_12 "%P%Iæ—¶%M分%Sç§’" ::msgcat::mcset zh_CN DATE_TIME_FORMAT "%Y-%m-%e %k:%M:%S %z" } diff --git a/library/msgs/zh_hk.msg b/library/msgs/zh_hk.msg index badb1dd..7f1b181 100644 --- a/library/msgs/zh_hk.msg +++ b/library/msgs/zh_hk.msg @@ -1,28 +1,28 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset zh_HK DAYS_OF_WEEK_ABBREV [list \ - "\u65e5"\ - "\u4e00"\ - "\u4e8c"\ - "\u4e09"\ - "\u56db"\ - "\u4e94"\ - "\u516d"] + "æ—¥"\ + "一"\ + "二"\ + "三"\ + "å››"\ + "五"\ + "å…­"] ::msgcat::mcset zh_HK MONTHS_ABBREV [list \ - "1\u6708"\ - "2\u6708"\ - "3\u6708"\ - "4\u6708"\ - "5\u6708"\ - "6\u6708"\ - "7\u6708"\ - "8\u6708"\ - "9\u6708"\ - "10\u6708"\ - "11\u6708"\ - "12\u6708"\ + "1月"\ + "2月"\ + "3月"\ + "4月"\ + "5月"\ + "6月"\ + "7月"\ + "8月"\ + "9月"\ + "10月"\ + "11月"\ + "12月"\ ""] - ::msgcat::mcset zh_HK DATE_FORMAT "%Y\u5e74%m\u6708%e\u65e5" + ::msgcat::mcset zh_HK DATE_FORMAT "%Yå¹´%m月%eæ—¥" ::msgcat::mcset zh_HK TIME_FORMAT_12 "%P%I:%M:%S" - ::msgcat::mcset zh_HK DATE_TIME_FORMAT "%Y\u5e74%m\u6708%e\u65e5 %P%I:%M:%S %z" + ::msgcat::mcset zh_HK DATE_TIME_FORMAT "%Yå¹´%m月%eæ—¥ %P%I:%M:%S %z" } diff --git a/library/msgs/zh_sg.msg b/library/msgs/zh_sg.msg index a2f3e39..690edf7 100644 --- a/library/msgs/zh_sg.msg +++ b/library/msgs/zh_sg.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset zh_SG AM "\u4e0a\u5348" - ::msgcat::mcset zh_SG PM "\u4e2d\u5348" + ::msgcat::mcset zh_SG AM "上åˆ" + ::msgcat::mcset zh_SG PM "中åˆ" ::msgcat::mcset zh_SG DATE_FORMAT "%d %B %Y" ::msgcat::mcset zh_SG TIME_FORMAT_12 "%P %I:%M:%S" ::msgcat::mcset zh_SG DATE_TIME_FORMAT "%d %B %Y %P %I:%M:%S %z" diff --git a/library/msgs/zh_tw.msg b/library/msgs/zh_tw.msg index e0796b1..17a6dd7 100644 --- a/library/msgs/zh_tw.msg +++ b/library/msgs/zh_tw.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset zh_TW BCE "\u6c11\u570b\u524d" - ::msgcat::mcset zh_TW CE "\u6c11\u570b" + ::msgcat::mcset zh_TW BCE "民國å‰" + ::msgcat::mcset zh_TW CE "民國" ::msgcat::mcset zh_TW DATE_FORMAT "%Y/%m/%e" ::msgcat::mcset zh_TW TIME_FORMAT_12 "%P %I:%M:%S" ::msgcat::mcset zh_TW DATE_TIME_FORMAT "%Y/%m/%e %P %I:%M:%S %z" diff --git a/tools/loadICU.tcl b/tools/loadICU.tcl index 31f1e54..43d7e6a 100755 --- a/tools/loadICU.tcl +++ b/tools/loadICU.tcl @@ -27,6 +27,9 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. #---------------------------------------------------------------------- +puts stdout "TODO: output in UTF-8 in stead of using \\uhhhh sequences" +exit; # Remove those two lines after modifying this tool. + # Calculate the Chinese numerals from zero to ninety-nine. set zhDigits [list {} \u4e00 \u4e8c \u4e09 \u56db \ -- cgit v0.12 From bcbbf6dacf34d9e895fb57c1fea54adc38baed35 Mon Sep 17 00:00:00 2001 From: gcramer Date: Thu, 20 Apr 2017 10:13:02 +0000 Subject: Entry for text.n into exclude_refs_map inserted. --- tools/tcltk-man2html.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index 5d21866..b0c2d8f 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -586,6 +586,7 @@ array set exclude_refs_map { scrollbar.n {set} selection.n {string} tcltest.n {error} + text.n {bind image lower raise} tkvars.n {tk} tkwait.n {variable} tm.n {exec} -- cgit v0.12 From c1b1e9af62be03f294b7d515133f9e55c0c9688e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 20 Apr 2017 11:44:05 +0000 Subject: Remove unused functions like TclWinSetSockOpt()/Tcl_DStringTrunc() if compiled with -DTCL_NO_DEPRECATED --- generic/tcl.h | 17 +++++++++++------ generic/tclInt.h | 2 +- generic/tclStubInit.c | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 6ec47c6..6fa26f9 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -60,6 +60,7 @@ extern "C" { #define TCL_VERSION "8.7" #define TCL_PATCH_LEVEL "8.7a0" +#if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* *---------------------------------------------------------------------------- * The following definitions set up the proper options for Windows compilers. @@ -88,6 +89,7 @@ extern "C" { # define JOIN(a,b) JOIN1(a,b) # define JOIN1(a,b) a##b #endif +#endif /* !TCL_NO_DEPRECATED */ /* * A special definition used to allow this header file to be included from @@ -139,7 +141,7 @@ extern "C" { # define TCL_VARARGS(type, name) (type name, ...) # define TCL_VARARGS_DEF(type, name) (type name, ...) # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) -#endif +#endif /* !TCL_NO_DEPRECATED */ #if defined(__GNUC__) && (__GNUC__ > 2) # define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) # define TCL_NORETURN __attribute__ ((noreturn)) @@ -255,7 +257,7 @@ extern "C" { #ifndef TCL_NO_DEPRECATED # undef _ANSI_ARGS_ # define _ANSI_ARGS_(x) x -#endif +#endif /* !TCL_NO_DEPRECATED */ /* * Definitions that allow this header file to be used either with or without @@ -521,7 +523,7 @@ typedef struct Tcl_Interp int errorLineDontUse; /* Don't use in extensions! */ #endif } -#endif /* TCL_NO_DEPRECATED */ +#endif /* !TCL_NO_DEPRECATED */ Tcl_Interp; typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; @@ -995,7 +997,9 @@ typedef struct Tcl_DString { #define Tcl_DStringLength(dsPtr) ((dsPtr)->length) #define Tcl_DStringValue(dsPtr) ((dsPtr)->string) -#define Tcl_DStringTrunc Tcl_DStringSetLength +#ifndef TCL_NO_DEPRECATED +# define Tcl_DStringTrunc Tcl_DStringSetLength +#endif /* !TCL_NO_DEPRECATED */ /* * Definitions for the maximum number of digits of precision that may be @@ -1123,7 +1127,7 @@ typedef struct Tcl_DString { #ifndef TCL_NO_DEPRECATED # define TCL_PARSE_PART1 0x400 -#endif +#endif /* !TCL_NO_DEPRECATED */ /* * Types for linked variables: @@ -2624,7 +2628,6 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); # define panic Tcl_Panic #endif # define panicVA Tcl_PanicVA -#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------------- @@ -2635,6 +2638,8 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); extern Tcl_AppInitProc Tcl_AppInit; +#endif /* !TCL_NO_DEPRECATED */ + #endif /* RC_INVOKED */ /* diff --git a/generic/tclInt.h b/generic/tclInt.h index d725688..fdbdb9b 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2630,7 +2630,7 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, size_t *lengthPtr, */ typedef struct ProcessGlobalValue { - size_t epoch; /* Epoch counter to detect changes in the + size_t epoch; /* Epoch counter to detect changes in the * master value. */ size_t numBytes; /* Length of the master string. */ char *value; /* The master string value. */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 59325b7..55ef325 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -143,6 +143,7 @@ void *TclWinGetTclInstance() return hInstance; } +#ifndef TCL_NO_DEPRECATED #define TclWinSetSockOpt winSetSockOpt static int TclWinSetSockOpt(SOCKET s, int level, int optname, @@ -165,6 +166,7 @@ TclWinGetServByName(const char *name, const char *proto) { return getservbyname(name, proto); } +#endif /* TCL_NO_DEPRECATED */ #define TclWinNoBackslash winNoBackslash static char * -- cgit v0.12 From fbbc93906e624113a7eeaa6d2dd6ddc01072804d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Apr 2017 13:48:13 +0000 Subject: Move some variable declarations closer to where they are used. No change in functionality. --- unix/tclEpollNotfy.c | 16 +++++----------- unix/tclUnixNotfy.c | 7 +------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 28fc834..5ed5d5d 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -354,24 +354,21 @@ PlatformEventsInit( if (errno) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create mutex"); } + filePtr = ckalloc(sizeof(*filePtr)); #ifdef HAVE_EVENTFD if ((tsdPtr->triggerEventFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK)) <= 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger eventfd"); } + filePtr->fd = tsdPtr->triggerEventFd; #else if (pipe2(tsdPtr->triggerPipe, O_CLOEXEC | O_NONBLOCK) != 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger pipe"); } + filePtr->fd = tsdPtr->triggerPipe[0]; #endif if ((tsdPtr->eventsFd = epoll_create1(EPOLL_CLOEXEC)) == -1) { Tcl_Panic("epoll_create1: %s", strerror(errno)); } - filePtr = ckalloc(sizeof(*filePtr)); -#ifdef HAVE_EVENTFD - filePtr->fd = tsdPtr->triggerEventFd; -#else - filePtr->fd = tsdPtr->triggerPipe[0]; -#endif filePtr->mask = TCL_READABLE; PlatformEventsControl(filePtr, tsdPtr, EPOLL_CTL_ADD, 1); if (!tsdPtr->readyEvents) { @@ -660,11 +657,6 @@ Tcl_WaitForEvent( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int numQueued; ssize_t i; -#ifdef HAVE_EVENTFD - uint64_t eventFdVal; -#else - char triggerPipeVal; -#endif /* * Set up the timeout structure. Note that if there are no events to @@ -760,10 +752,12 @@ Tcl_WaitForEvent( mask = PlatformEventsTranslate(&tsdPtr->readyEvents[numEvent]); #ifdef HAVE_EVENTFD if (filePtr->fd == tsdPtr->triggerEventFd) { + uint64_t eventFdVal; i = read(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)); if ((i != sizeof(eventFdVal)) && (errno != EAGAIN)) { #else if (filePtr->fd == tsdPtr->triggerPipe[0]) { + char triggerPipeVal; i = read(tsdPtr->triggerPipe[0], &triggerPipeVal, sizeof(triggerPipeVal)); if ((i != sizeof(triggerPipeVal)) && (errno != EAGAIN)) { #endif diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 17307dc..5bc753a 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -102,11 +102,6 @@ void Tcl_AlertNotifier( ClientData clientData) { -#ifdef NOTIFIER_EPOLL -#ifdef HAVE_EVENTFD - uint64_t eventFdVal; -#endif /* HAVE_EVENTFD */ -#endif /* NOTIFIER_EPOLL */ if (tclNotifierHooks.alertNotifierProc) { tclNotifierHooks.alertNotifierProc(clientData); return; @@ -128,7 +123,7 @@ Tcl_AlertNotifier( #else ThreadSpecificData *tsdPtr = clientData; #if defined(NOTIFIER_EPOLL) && defined(HAVE_EVENTFD) - eventFdVal = 1; + uint64_t eventFdVal = 1; if (write(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)) != sizeof(eventFdVal)) { Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerEventFd", -- cgit v0.12 From e3a9350e58588d7d50bc37bc15abd1efb84dcbc1 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 27 Apr 2017 12:38:21 +0000 Subject: Start of implementation of TIP #470. --- generic/tclOO.c | 1 + generic/tclOODefineCmds.c | 43 ++++++++++++++++++++++++++++++++++++++----- generic/tclOOInt.h | 3 +++ 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index ef0c987..73acce8 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -41,6 +41,7 @@ static const struct { {"forward", TclOODefineForwardObjCmd, 1}, {"method", TclOODefineMethodObjCmd, 1}, {"renamemethod", TclOODefineRenameMethodObjCmd, 1}, + {"self", TclOODefineObjSelfObjCmd, 0}, {"unexport", TclOODefineUnexportObjCmd, 1}, {NULL, NULL, 0} }; diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 5b0dfc3..d3ab1eb 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1028,16 +1028,16 @@ TclOODefineSelfObjCmd( int result; Object *oPtr; - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?"); - return TCL_ERROR; - } - oPtr = (Object *) TclOOGetDefineCmdContext(interp); if (oPtr == NULL) { return TCL_ERROR; } + if (objc < 2) { + Tcl_SetObjResult(interp, TclOOObjectName(interp, oPtr)); + return TCL_OK; + } + /* * Make the oo::objdefine namespace the current namespace and evaluate the * command(s). @@ -1113,6 +1113,39 @@ TclOODefineSelfObjCmd( /* * ---------------------------------------------------------------------- * + * TclOODefineObjSelfObjCmd -- + * Implementation of the "self" subcommand of the "oo::objdefine" + * command. + * + * ---------------------------------------------------------------------- + */ + +int +TclOODefineObjSelfObjCmd( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const *objv) +{ + Object *oPtr; + + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, NULL); + return TCL_ERROR; + } + + oPtr = (Object *) TclOOGetDefineCmdContext(interp); + if (oPtr == NULL) { + return TCL_ERROR; + } + + Tcl_SetObjResult(interp, TclOOObjectName(interp, oPtr)); + return TCL_OK; +} + +/* + * ---------------------------------------------------------------------- + * * TclOODefineClassObjCmd -- * Implementation of the "class" subcommand of the "oo::objdefine" * command. diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index ae24dee..476446d 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -431,6 +431,9 @@ MODULE_SCOPE int TclOODefineClassObjCmd(ClientData clientData, MODULE_SCOPE int TclOODefineSelfObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); +MODULE_SCOPE int TclOODefineObjSelfObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const *objv); MODULE_SCOPE int TclOOUnknownDefinition(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); -- cgit v0.12 From 90ffbb41701e9550ed98e8454d100d5a48531b33 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 29 Apr 2017 14:41:20 +0000 Subject: Make trunk compile on MSVC (problem was: warning C4554: '&' : check operator precedence for possible error; use parentheses to clarify precedence) --- win/tclWinChan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 010621c..2898db0 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -128,7 +128,7 @@ static const Tcl_ChannelType fileChannelType = { #define SET_FLAG(var, flag) ((var) |= (flag)) #define CLEAR_FLAG(var, flag) ((var) &= ~(flag)) -#define TEST_FLAG(value, flag) ((value) & (flag) != 0) +#define TEST_FLAG(value, flag) (((value) & (flag)) != 0) /* *---------------------------------------------------------------------- -- cgit v0.12 From be831d7ecb9df8ebfad280ac50be1773124c08bd Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 1 May 2017 20:29:02 +0000 Subject: Revert the colorful debug garbage mistakenly committed. --- generic/tclPathObj.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index ffeb688..5984c16 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1322,14 +1322,8 @@ TclNewFSPathObj( fsPathPtr->translatedPathPtr = NULL; fsPathPtr->normPathPtr = Tcl_NewStringObj(addStrRep, len); Tcl_IncrRefCount(fsPathPtr->normPathPtr); - - if (TCL_PATH_ABSOLUTE == Tcl_FSGetPathType(dirPtr)) { - fsPathPtr->cwdPtr = Tcl_FSGetNormalizedPath(NULL, dirPtr); - } else { -fprintf(stdout, "FUCKING BROKEN!\n"); fflush(stdout); - fsPathPtr->cwdPtr = dirPtr; - } - Tcl_IncrRefCount(fsPathPtr->cwdPtr); + fsPathPtr->cwdPtr = dirPtr; + Tcl_IncrRefCount(dirPtr); fsPathPtr->nativePathPtr = NULL; fsPathPtr->fsPtr = NULL; fsPathPtr->filesystemEpoch = 0; -- cgit v0.12 From 910200b637f2025d21da89213ea124bb28785632 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 2 May 2017 12:36:42 +0000 Subject: Extend "deprecated" functionality of genStubs.tcl: XX_DEPRECATED macro now accepts a message text, which will be used in the compiler's error message. Not used (yet) in Tcl. --- tools/genStubs.tcl | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 742aa46..5956711 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -191,19 +191,21 @@ proc genStubs::declare {args} { regsub -all "\[ \t\n\]+" [string trim $decl] " " decl set decl [parseDecl $decl] - foreach platform $platformList { - if {$decl ne ""} { - set stubs($curName,$platform,$index) $decl - if {![info exists stubs($curName,$platform,lastNum)] \ - || ($index > $stubs($curName,$platform,lastNum))} { - set stubs($curName,$platform,lastNum) $index - } + if {([lindex $platformList 0] eq "deprecated")} { + set stubs($curName,deprecated,$index) [lindex $platformList 1] + set stubs($curName,generic,$index) $decl + if {![info exists stubs($curName,generic,lastNum)] \ + || ($index > $stubs($curName,generic,lastNum))} { + set stubs($curName,generic,lastNum) $index } - if {$platformList eq "deprecated"} { - set stubs($curName,generic,$index) $decl - if {![info exists stubs($curName,generic,lastNum)] \ - || ($index > $stubs($curName,generic,lastNum))} { - set stubs($curName,$platform,lastNum) $index + } else { + foreach platform $platformList { + if {$decl ne ""} { + set stubs($curName,$platform,$index) $decl + if {![info exists stubs($curName,$platform,lastNum)] \ + || ($index > $stubs($curName,$platform,lastNum))} { + set stubs($curName,$platform,lastNum) $index + } } } } @@ -468,7 +470,7 @@ proc genStubs::makeDecl {name decl index} { append text "/* $index */\n" if {[info exists stubs($name,deprecated,$index)]} { - set line "[string toupper $libraryName]_DEPRECATED $rtype" + set line "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n$rtype" } else { set line "$scspec $rtype" } @@ -582,11 +584,15 @@ proc genStubs::makeMacro {name decl index} { proc genStubs::makeSlot {name decl index} { lassign $decl rtype fname args + variable stubs set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text " " + if {[info exists stubs($name,deprecated,$index)]} { + append text "TCL_DEPRECATED_API(\"$stubs($name,deprecated,$index)\") " + } if {$args eq ""} { append text $rtype " *" $lfname "; /* $index */\n" return $text -- cgit v0.12 From 709366bdfe97b432487806c7cdbfe1eed1c365f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 3 May 2017 10:03:00 +0000 Subject: slightly better formatting, both in genStubs.tcl and in the generated XXX_DEPRECATED functions. --- tools/genStubs.tcl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 5956711..830ba2b 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -470,9 +470,10 @@ proc genStubs::makeDecl {name decl index} { append text "/* $index */\n" if {[info exists stubs($name,deprecated,$index)]} { - set line "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n$rtype" + append text "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n" + set line "$rtype" } else { - set line "$scspec $rtype" + set line "$scspec $rtype" } set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] -- cgit v0.12 From 2752a9f58b6ee57703c3bc087133751e0192f150 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 9 May 2017 22:24:44 +0000 Subject: add missing compile functionality (TclPreserveByteCode/TclReleaseByteCode back-ported as inline from trunk) --- generic/tclCompile.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/generic/tclCompile.h b/generic/tclCompile.h index c04fc0e..90edf07 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1159,6 +1159,25 @@ MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, int *isScalarPtr); + +static inline void +TclPreserveByteCode( + register ByteCode *codePtr) +{ + codePtr->refCount++; +} + +static inline void +TclReleaseByteCode( + register ByteCode *codePtr) +{ + if (codePtr->refCount-- > 1) { + return; + } + /* Just dropped to refcount==0. Clean up. */ + TclCleanupByteCode(codePtr); +} + MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); MODULE_SCOPE void TclInvalidateCmdLiteral(Tcl_Interp *interp, const char *name, Namespace *nsPtr); -- cgit v0.12 From a021af135e023aebc82a9062835c46473a1777fd Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:42 +0000 Subject: clock.test normalized (compared with trunk) --- tests/clock.test | 135 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 40 deletions(-) diff --git a/tests/clock.test b/tests/clock.test index 103f254..9e86c97 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -36,9 +36,9 @@ testConstraint y2038 \ # TEST PLAN # clock-1: -# [clock format] - tests of bad and empty arguments +# [clock format] - tests of bad and empty arguments # -# clock-2 +# clock-2 # formatting of year, month and day of month # # clock-3 @@ -196,7 +196,7 @@ namespace eval ::tcl::clock { l li lii liii liv lv lvi lvii lviii lix lx lxi lxii lxiii lxiv lxv lxvi lxvii lxviii lxix lxx lxxi lxxii lxxiii lxxiv lxxv lxxvi lxxvii lxxviii lxxix - lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii + lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii lxxxix xc xci xcii xciii xciv xcv xcvi xcvii xcviii xcix c @@ -273,7 +273,7 @@ test clock-1.4 "clock format - bad flag" {*}{ -body { # range error message for possible extensions: list [catch {clock format 0 -oops badflag} msg] [string range $msg 0 60] $::errorCode - } + } -match glob -result {1 {bad option "-oops": must be -format, -gmt, -locale, -timezone} {CLOCK badOption -oops}} } @@ -35143,6 +35143,10 @@ test clock-29.1800 {time parsing} { } 86399 # END testcases29 + +# BEGIN testcases30 + +# Test [clock add] test clock-30.1 {clock add years} { set t [clock scan 2000-01-01 -format %Y-%m-%d -timezone :UTC] set f [clock add $t 1 year -timezone :UTC] @@ -35369,10 +35373,61 @@ test clock-30.25 {clock add seconds at DST conversion} { set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] } {2004-10-31 01:00:00 -0500} +test clock-30.26 {clock add weekdays} { + set t [clock scan {2013-11-20}] ;# Wednesday + set f1 [clock add $t 3 weekdays] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2013-11-25} +test clock-30.27 {clock add weekdays starting on Saturday} { + set t [clock scan {2013-11-23}] ;# Saturday + set f1 [clock add $t 1 weekday] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2013-11-25} +test clock-30.28 {clock add weekdays starting on Sunday} { + set t [clock scan {2013-11-24}] ;# Sunday + set f1 [clock add $t 1 weekday] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2013-11-25} +test clock-30.29 {clock add 0 weekdays starting on a weekend} { + set t [clock scan {2016-02-27}] ;# Saturday + set f1 [clock add $t 0 weekdays] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2016-02-27} +test clock-30.30 {clock add weekdays and back} -body { + set n [clock seconds] + # we start on each day of the week + for {set i 0} {$i < 7} {incr i} { + set start [clock add $n $i days] + set startu [clock format $start -format %u] + # add 0 - 100 weekdays + for {set j 0} {$j < 100} {incr j} { + set forth [clock add $start $j weekdays] + set back [clock add $forth -$j weekdays] + # If $s was a weekday or $j was 0, $b must be the same day. + # Otherwise, $b must be the immediately preceeding Friday + set fail 0 + if {$j == 0 || $startu < 6} { + if {$start != $back} { set fail 1} + } else { + set friday [clock add $start -[expr {$startu % 5}] days] + if {$friday != $back} { set fail 1 } + } + if {$fail} { + set sdate [clock format $start -format {%Y-%m-%d}] + set bdate [clock format $back -format {%Y-%m-%d}] + return "$sdate + $j - $j := $bdate" + } + } + } + return "OK" +} -result {OK} + +# END testcases30 + test clock-31.1 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35395,7 +35450,7 @@ test clock-31.1 {system locale} \ test clock-31.2 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35418,7 +35473,7 @@ test clock-31.2 {system locale} \ test clock-31.3 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35441,7 +35496,7 @@ test clock-31.3 {system locale} \ test clock-31.4 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35478,7 +35533,7 @@ test clock-31.4 {system locale} \ test clock-31.5 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35515,7 +35570,7 @@ test clock-31.5 {system locale} \ test clock-31.6 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35585,7 +35640,7 @@ test clock-32.1 {scan/format across the Gregorian change} { } set problems } {} - + # Legacy tests # clock clicks @@ -35619,7 +35674,7 @@ test clock-33.5 {clock clicks tests, millisecond timing test} { # 60 msecs seems to be the max time slice under Windows 95/98 expr { ($end > $start) && (($end - $start) <= 60) ? - "ok" : + "ok" : "test should have taken 0-60 ms, actually took [expr $end - $start]"} } {ok} test clock-33.5a {clock tests, millisecond timing test} { @@ -35631,7 +35686,7 @@ test clock-33.5a {clock tests, millisecond timing test} { # 60 msecs seems to be the max time slice under Windows 95/98 expr { ($end > $start) && (($end - $start) <= 60) ? - "ok" : + "ok" : "test should have taken 0-60 ms, actually took [expr $end - $start]"} } {ok} test clock-33.6 {clock clicks, milli with too much abbreviation} { @@ -35984,31 +36039,31 @@ test clock-34.47 {ago with multiple relative units} { } 180000 test clock-34.48 {more than one ToD} {*}{ - -body {clock scan {10:00 11:00}} + -body {clock scan {10:00 11:00}} -returnCodes error -result {unable to convert date-time string "10:00 11:00": more than one time of day in string} } test clock-34.49 {more than one date} {*}{ - -body {clock scan {1/1/2001 2/2/2002}} + -body {clock scan {1/1/2001 2/2/2002}} -returnCodes error -result {unable to convert date-time string "1/1/2001 2/2/2002": more than one date in string} } test clock-34.50 {more than one time zone} {*}{ - -body {clock scan {10:00 EST CST}} + -body {clock scan {10:00 EST CST}} -returnCodes error -result {unable to convert date-time string "10:00 EST CST": more than one time zone in string} } test clock-34.51 {more than one weekday} {*}{ - -body {clock scan {Monday Tuesday}} + -body {clock scan {Monday Tuesday}} -returnCodes error -result {unable to convert date-time string "Monday Tuesday": more than one weekday in string} } test clock-34.52 {more than one ordinal month} {*}{ - -body {clock scan {next January next March}} + -body {clock scan {next January next March}} -returnCodes error -result {unable to convert date-time string "next January next March": more than one ordinal month in string} } @@ -36202,7 +36257,7 @@ test clock-38.2 {make sure TZ is not cached after unset} \ } } \ -result 1 - + test clock-39.1 {regression - synonym timezones} { clock format 0 -format {%H:%M:%S} -timezone :US/Eastern @@ -36274,7 +36329,7 @@ test clock-44.1 {regression test - time zone name containing hyphen } \ } } \ -result {12:34:56-0500} - + test clock-45.1 {regression test - time zone containing only two digits} \ -body { clock scan 1985-04-12T10:15:30+04 -format %Y-%m-%dT%H:%M:%S%Z @@ -36319,7 +36374,7 @@ test clock-48.1 {Bug 1185933: 'i' destroyed by clock init} -setup { test clock-49.1 {regression test - localtime with negative arg (Bug 1237907)} \ -body { - list [catch { + list [catch { clock format -86400 -timezone :localtime -format %Y } result] $result } \ @@ -36558,7 +36613,7 @@ test clock-56.1 {use of zoneinfo, version 1} {*}{ } -result {2004-01-01 00:00:00 MST} } - + test clock-56.2 {use of zoneinfo, version 2} {*}{ -setup { clock format [clock seconds] @@ -36608,7 +36663,7 @@ test clock-56.2 {use of zoneinfo, version 2} {*}{ removeFile PhoenixTwo $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -body { clock format 1072940400 -timezone :Test/PhoenixTwo \ -format {%Y-%m-%d %H:%M:%S %Z} @@ -36818,7 +36873,7 @@ test clock-56.3 {use of zoneinfo, version 2, Y2038 compliance} {*}{ removeFile TijuanaTwo $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -body { clock format 2224738800 -timezone :Test/TijuanaTwo \ -format {%Y-%m-%d %H:%M:%S %Z} @@ -36970,7 +37025,7 @@ test clock-56.4 {Bug 3470928} {*}{ removeFile Windhoek $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -result {Sun Jan 08 22:30:06 WAST 2012} } @@ -36981,7 +37036,7 @@ test clock-57.1 {clock scan - abbreviated options} { test clock-58.1 {clock l10n - Japanese localisation} {*}{ -setup { proc backslashify { string } { - + set retval {} foreach char [split $string {}] { scan $char %c ccode @@ -37087,52 +37142,52 @@ test clock-59.1 {military time zones} { test clock-60.1 {case insensitive weekday names} { clock scan "2000-W01 monday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.2 {case insensitive weekday names} { clock scan "2000-W01 Monday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.3 {case insensitive weekday names} { clock scan "2000-W01 MONDAY" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.4 {case insensitive weekday names} { clock scan "2000-W01 friday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.5 {case insensitive weekday names} { clock scan "2000-W01 Friday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.6 {case insensitive weekday names} { clock scan "2000-W01 FRIDAY" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.7 {case insensitive month names} { clock scan "1 january 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.8 {case insensitive month names} { clock scan "1 January 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.9 {case insensitive month names} { clock scan "1 JANUARY 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.10 {case insensitive month names} { clock scan "1 december 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-60.11 {case insensitive month names} { clock scan "1 December 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-60.12 {case insensitive month names} { clock scan "1 DECEMBER 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-61.1 {overflow of a wide integer on output} {*}{ -body { clock format 0x8000000000000000 -format %s -gmt true - } + } -result {integer value too large to represent} -returnCodes error } test clock-61.2 {overflow of a wide integer on output} {*}{ -body { clock format -0x8000000000000001 -format %s -gmt true - } + } -result {integer value too large to represent} -returnCodes error } -- cgit v0.12 From d9b0bec7d68dc00ac744a5a0e3d0ba5d7d8404f1 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:49 +0000 Subject: resolving differences between 8.6 and trunk --- generic/tclDictObj.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 4088883..593f5a3 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -145,7 +145,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - int refcount; /* Reference counter (see above) */ + size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -395,7 +395,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refcount = 1; + newDict->refCount = 1; /* * Store in the object. @@ -430,8 +430,7 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -716,7 +715,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1120,7 +1119,7 @@ Tcl_DictObjFirst( searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refcount++; + dict->refCount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1234,8 +1233,7 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } } @@ -1387,7 +1385,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1437,7 +1435,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; -- cgit v0.12 From 3fe213e03172327d71bc8a7b2d174b5887434738 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:54 +0000 Subject: Ensemble "clock" fixed after merge with kbk's clock ensemble solution. All commands (including new) compiled now also in ensemble (implemented without TclMakeEnsemble, because it can be extended via new map entries). Ensemble handling partially cherry-picked from new performance branch (TODO: check temporary "-compile" option can be reverted if it becomes ready/merged). --- generic/tclClock.c | 66 +++++++++++++++++++++++++-------------------------- generic/tclEnsemble.c | 20 +++++++++++++--- library/init.tcl | 15 ++++++++---- 3 files changed, 61 insertions(+), 40 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 8e176b6..ad3d6e7 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -17,6 +17,7 @@ #include "tclInt.h" #include "tclStrIdxTree.h" #include "tclDate.h" +#include "tclCompile.h" /* * Windows has mktime. The configurators do not check. @@ -152,21 +153,29 @@ struct ClockCommand { Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This * will always have the ClockClientData sent * to it, but may well ignore this data. */ + CompileProc *compileProc; /* The compiler for the command. */ + ClientData clientData; /* Any clientData to give the command (if NULL + * a reference to ClockClientData will be sent) */ }; static const struct ClockCommand clockCommands[] = { - { "getenv", ClockGetenvObjCmd }, - { "format", ClockFormatObjCmd }, - { "scan", ClockScanObjCmd }, - { "configure", ClockConfigureObjCmd }, - { "Oldscan", TclClockOldscanObjCmd }, - { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, - { "GetDateFields", ClockGetdatefieldsObjCmd }, - { "GetJulianDayFromEraYearMonthDay", - ClockGetjuliandayfromerayearmonthdayObjCmd }, - { "GetJulianDayFromEraYearWeekDay", - ClockGetjuliandayfromerayearweekdayObjCmd }, - { NULL, NULL } + {"add", ClockAddObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"clicks", ClockClicksObjCmd, TclCompileClockClicksCmd, NULL}, + {"format", ClockFormatObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"getenv", ClockGetenvObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"microseconds", ClockMicrosecondsObjCmd,TclCompileClockReadingCmd, INT2PTR(1)}, + {"milliseconds", ClockMillisecondsObjCmd,TclCompileClockReadingCmd, INT2PTR(2)}, + {"scan", ClockScanObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"seconds", ClockSecondsObjCmd, TclCompileClockReadingCmd, INT2PTR(3)}, + {"configure", ClockConfigureObjCmd, NULL, NULL}, + {"Oldscan", TclClockOldscanObjCmd, NULL, NULL}, + {"ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd, NULL, NULL}, + {"GetDateFields", ClockGetdatefieldsObjCmd, NULL, NULL}, + {"GetJulianDayFromEraYearMonthDay", + ClockGetjuliandayfromerayearmonthdayObjCmd, NULL, NULL}, + {"GetJulianDayFromEraYearWeekDay", + ClockGetjuliandayfromerayearweekdayObjCmd, NULL, NULL}, + {NULL, NULL, NULL, NULL} }; /* @@ -195,22 +204,10 @@ TclClockInit( char cmdName[50]; /* Buffer large enough to hold the string *::tcl::clock::GetJulianDayFromEraYearMonthDay * plus a terminating NUL. */ + Command *cmdPtr; ClockClientData *data; int i; - /* Structure of the 'clock' ensemble */ - - static const EnsembleImplMap clockImplMap[] = { - {"add", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL, 0}, - {"clicks", ClockClicksObjCmd, TclCompileClockClicksCmd, NULL, NULL, 0}, - {"format", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL, 0}, - {"microseconds", ClockMicrosecondsObjCmd, TclCompileClockReadingCmd, NULL, INT2PTR(1), 0}, - {"milliseconds", ClockMillisecondsObjCmd, TclCompileClockReadingCmd, NULL, INT2PTR(2), 0}, - {"scan", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL , 0}, - {"seconds", ClockSecondsObjCmd, TclCompileClockReadingCmd, NULL, INT2PTR(3), 0}, - {NULL, NULL, NULL, NULL, NULL, 0} - }; - /* * Safe interps get [::clock] as alias to a master, so do not need their * own copies of the support routines. @@ -258,21 +255,24 @@ TclClockInit( /* * Install the commands. - * TODO - Let Tcl_MakeEnsemble do this? */ #define TCL_CLOCK_PREFIX_LEN 14 /* == strlen("::tcl::clock::") */ memcpy(cmdName, "::tcl::clock::", TCL_CLOCK_PREFIX_LEN); for (clockCmdPtr=clockCommands ; clockCmdPtr->name!=NULL ; clockCmdPtr++) { + ClientData clientData; + strcpy(cmdName + TCL_CLOCK_PREFIX_LEN, clockCmdPtr->name); - data->refCount++; - Tcl_CreateObjCommand(interp, cmdName, clockCmdPtr->objCmdProc, data, - ClockDeleteCmdProc); + if (!(clientData = clockCmdPtr->clientData)) { + clientData = data; + data->refCount++; + } + cmdPtr = (Command *)Tcl_CreateObjCommand(interp, cmdName, + clockCmdPtr->objCmdProc, clientData, + clockCmdPtr->clientData ? NULL : ClockDeleteCmdProc); + cmdPtr->compileProc = clockCmdPtr->compileProc ? + clockCmdPtr->compileProc : TclCompileBasicMin0ArgCmd; } - - /* Make the clock ensemble */ - - TclMakeEnsemble(interp, "clock", clockImplMap); } /* diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index c1b0890..2480685 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -55,11 +55,12 @@ enum EnsSubcmds { }; static const char *const ensembleCreateOptions[] = { - "-command", "-map", "-parameters", "-prefixes", "-subcommands", - "-unknown", NULL + "-command", "-compile", "-map", "-parameters", "-prefixes", + "-subcommands", "-unknown", NULL }; enum EnsCreateOpts { - CRT_CMD, CRT_MAP, CRT_PARAM, CRT_PREFIX, CRT_SUBCMDS, CRT_UNKNOWN + CRT_CMD, CRT_COMPILE, CRT_MAP, CRT_PARAM, CRT_PREFIX, + CRT_SUBCMDS, CRT_UNKNOWN }; static const char *const ensembleConfigOptions[] = { @@ -183,6 +184,7 @@ TclNamespaceEnsembleCmd( int permitPrefix = 1; Tcl_Obj *unknownObj = NULL; Tcl_Obj *paramObj = NULL; + int ensCompFlag = -1; /* * Check that we've got option-value pairs... [Bug 1558654] @@ -325,6 +327,12 @@ TclNamespaceEnsembleCmd( return TCL_ERROR; } continue; + case CRT_COMPILE: + if (Tcl_GetBooleanFromObj(interp, objv[1], + &ensCompFlag) != TCL_OK) { + return TCL_ERROR; + }; + continue; case CRT_UNKNOWN: if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { if (allocatedMapFlag) { @@ -350,6 +358,12 @@ TclNamespaceEnsembleCmd( Tcl_SetEnsembleMappingDict(interp, token, mapObj); Tcl_SetEnsembleUnknownHandler(interp, token, unknownObj); Tcl_SetEnsembleParameterList(interp, token, paramObj); + /* + * Ensemble should be compiled if it has map (performance purposes) + */ + if (ensCompFlag > 0 && mapObj != NULL) { + Tcl_SetEnsembleFlags(interp, token, ENSEMBLE_COMPILE); + } /* * Tricky! Must ensure that the result is not shared (command delete diff --git a/library/init.tcl b/library/init.tcl index 87e84e4..824f66f 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -45,6 +45,7 @@ if {![info exists auto_path]} { set auto_path "" } } + namespace eval tcl { variable Dir foreach Dir [list $::tcl_library [file dirname $::tcl_library]] { @@ -169,9 +170,16 @@ if {[interp issafe]} { namespace eval ::tcl::clock [list variable TclLibDir $::tcl_library] - proc ::tcl::initClock {} { - # Auto-loading stubs for 'clock.tcl' + proc clock args { + set cmdmap [dict create] + foreach cmd {add clicks format microseconds milliseconds scan seconds configure} { + dict set cmdmap $cmd ::tcl::clock::$cmd + } + namespace eval ::tcl::clock [list namespace ensemble create -command \ + [uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \ + -map $cmdmap -compile 1] + # Auto-loading stubs for 'clock.tcl' foreach cmd {mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir @@ -180,9 +188,8 @@ if {[interp issafe]} { } } - rename ::tcl::initClock {} + return [uplevel 1 [info level 0]] } - ::tcl::initClock } # Conditionalize for presence of exec. -- cgit v0.12 From ba8e7c4211e910d243158064e8e7dcd85620fce7 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:59 +0000 Subject: Fixed wrong args message (e.g. "clock format ..." instead of "::tcl::clock::format") if failed through compiled ensemble execution. --- generic/tclClock.c | 14 +++++++------- tests/clock.test | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index ad3d6e7..a066f73 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2865,7 +2865,7 @@ ClockClicksObjCmd( } break; default: - Tcl_WrongNumArgs(interp, 1, objv, "?-switch?"); + Tcl_WrongNumArgs(interp, 0, NULL, "clock clicks ?-switch?"); return TCL_ERROR; } @@ -2918,7 +2918,7 @@ ClockMillisecondsObjCmd( Tcl_Time now; if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock milliseconds"); return TCL_ERROR; } Tcl_GetTime(&now); @@ -2953,7 +2953,7 @@ ClockMicrosecondsObjCmd( Tcl_Obj *const *objv) /* Parameter values */ { if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock microseconds"); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclpGetMicroseconds())); @@ -3223,7 +3223,7 @@ ClockFormatObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now " + Tcl_WrongNumArgs(interp, 0, NULL, "clock format clockval|-now " "?-format string? " "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); @@ -3298,7 +3298,7 @@ ClockScanObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "string " + Tcl_WrongNumArgs(interp, 0, NULL, "clock scan string " "?-base seconds? " "?-format string? " "?-gmt boolean? " @@ -3857,7 +3857,7 @@ ClockAddObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now ?number units?..." + Tcl_WrongNumArgs(interp, 0, NULL, "clock add clockval|-now ?number units?..." "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); @@ -4014,7 +4014,7 @@ ClockSecondsObjCmd( Tcl_Time now; if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock seconds"); return TCL_ERROR; } Tcl_GetTime(&now); diff --git a/tests/clock.test b/tests/clock.test index 9e86c97..214d4cb 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -257,6 +257,10 @@ test clock-1.0 "clock format - wrong # args" { list [catch {clock format} msg] $msg $::errorCode } {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} +test clock-1.0.1 "clock format - wrong # args (compiled ensemble with invalid syntax)" { + list [catch {clock format 0 -too-few-options-4-test} msg] $msg $::errorCode +} {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} + test clock-1.1 "clock format - bad time" { list [catch {clock format foo} msg] $msg } {1 {expected integer but got "foo"}} -- cgit v0.12 From 19b2d40089ec87c4f53419baea8e46524011eb54 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:30:04 +0000 Subject: Fixed possible wrong current date for CET / CEST test cases. --- tests/clock.test | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/clock.test b/tests/clock.test index 214d4cb..0737558 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -36191,7 +36191,7 @@ test clock-36.3 {clock scan next monthname} { } "05.2001" test clock-37.1 {%s gmt testing} { - set s [clock seconds] + set s [clock scan "2017-05-10 09:00:00" -gmt 1] set a [clock format $s -format %s -gmt 0] set b [clock format $s -format %s -gmt 1] set c [clock scan $s -format %s -gmt 0] @@ -36200,8 +36200,8 @@ test clock-37.1 {%s gmt testing} { # depend on the time zone. list [expr {$b-$a}] [expr {$d-$c}] } {0 0} -test clock-37.2 {%Es gmt testing} { - set s [clock seconds] +test clock-37.2 {%Es gmt testing CET} { + set s [clock scan "2017-01-10 09:00:00" -gmt 1] set a [clock format $s -format %Es -timezone CET] set b [clock format $s -format %Es -gmt 1] set c [clock scan $s -format %Es -timezone CET] @@ -36209,6 +36209,15 @@ test clock-37.2 {%Es gmt testing} { # %Es depend on the time zone (local seconds instead of posix seconds). list [expr {$b-$a}] [expr {$d-$c}] } {-3600 3600} +test clock-37.3 {%Es gmt testing CEST} { + set s [clock scan "2017-05-10 09:00:00" -gmt 1] + set a [clock format $s -format %Es -timezone CET] + set b [clock format $s -format %Es -gmt 1] + set c [clock scan $s -format %Es -timezone CET] + set d [clock scan $s -format %Es -gmt 1] + # %Es depend on the time zone (local seconds instead of posix seconds). + list [expr {$b-$a}] [expr {$d-$c}] +} {-7200 7200} test clock-38.1 {regression - convertUTCToLocalViaC - east of Greenwich} \ -setup { -- cgit v0.12 From 2eaa3d3c8d7ede2057e65ea1e7edaaa2214f51c2 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 13:02:17 +0000 Subject: Added files missing after merge/back-port (rebase with merge point) --- generic/tclClockFmt.c | 3135 +++++++++++++++++++++++++++++++++++++++++++++ generic/tclDate.h | 512 ++++++++ generic/tclStrIdxTree.c | 520 ++++++++ generic/tclStrIdxTree.h | 169 +++ tests-perf/clock.perf.tcl | 385 ++++++ 5 files changed, 4721 insertions(+) create mode 100644 generic/tclClockFmt.c create mode 100644 generic/tclDate.h create mode 100644 generic/tclStrIdxTree.c create mode 100644 generic/tclStrIdxTree.h create mode 100644 tests-perf/clock.perf.tcl diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c new file mode 100644 index 0000000..d875bd4 --- /dev/null +++ b/generic/tclClockFmt.c @@ -0,0 +1,3135 @@ +/* + * tclClockFmt.c -- + * + * Contains the date format (and scan) routines. This code is back-ported + * from the time and date facilities of tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2015 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" +#include "tclStrIdxTree.h" +#include "tclDate.h" + +/* + * Miscellaneous forward declarations and functions used within this file + */ + +static void +ClockFmtObj_DupInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +ClockFmtObj_FreeInternalRep(Tcl_Obj *objPtr); +static int +ClockFmtObj_SetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); +static void +ClockFmtObj_UpdateString(Tcl_Obj *objPtr); + + +TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ + +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); + +static void ClockFrmScnFinalize(ClientData clientData); + +/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); + +/* + * Clock scan and format facilities. + */ + +/* + *---------------------------------------------------------------------- + * + * _str2int -- , _str2wideInt -- + * + * Fast inline-convertion of string to signed int or wide int by given + * start/end. + * + * The given string should contain numbers chars only (because already + * pre-validated within parsing routines) + * + * Results: + * Returns a standard Tcl result. + * TCL_OK - by successful conversion, TCL_ERROR by (wide) int overflow + * + *---------------------------------------------------------------------- + */ + +static inline int +_str2int( + int *out, + register + const char *p, + const char *e, + int sign) +{ + register int val = 0, prev = 0; + if (sign >= 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + +static inline int +_str2wideInt( + Tcl_WideInt *out, + register + const char *p, + const char *e, + int sign) +{ + register Tcl_WideInt val = 0, prev = 0; + if (sign >= 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * _itoaw -- , _witoaw -- + * + * Fast inline-convertion of signed int or wide int to string, using + * given padding with specified padchar and width (or without padding). + * + * This is a very fast replacement for sprintf("%02d"). + * + * Results: + * Returns position in buffer after end of conversion result. + * + *---------------------------------------------------------------------- + */ + +static inline char * +_itoaw( + char *buf, + register int val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + while (width <= 9 && val >= wrange[width]) { + width++; + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + while (width <= 9 && val <= -wrange[width]) { + width++; + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + +static inline char * +_witoaw( + char *buf, + register Tcl_WideInt val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + if (val >= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 >= wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val >= wrange[width]) { + width++; + } + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + if (val <= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 <= -wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val <= -wrange[width]) { + width++; + } + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + +/* + * Global GC as LIFO for released scan/format object storages. + * + * Used to holds last released CLOCK_FMT_SCN_STORAGE_GC_SIZE formats + * (after last reference from Tcl-object will be removed). This is helpful + * to avoid continuous (re)creation and compiling by some dynamically resp. + * variable format objects, that could be often reused. + * + * As long as format storage is used resp. belongs to GC, it takes place in + * FmtScnHashTable also. + */ + +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + +static struct { + ClockFmtScnStorage *stackPtr; + ClockFmtScnStorage *stackBound; + unsigned int count; +} ClockFmtScnStorage_GC = {NULL, NULL, 0}; + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageGC_In -- + * + * Adds an format storage object to GC. + * + * If current GC is full (size larger as CLOCK_FMT_SCN_STORAGE_GC_SIZE) + * this removes last unused storage at begin of GC stack (LIFO). + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static inline void +ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) +{ + /* add new entry */ + TclSpliceIn(entry, ClockFmtScnStorage_GC.stackPtr); + if (ClockFmtScnStorage_GC.stackBound == NULL) { + ClockFmtScnStorage_GC.stackBound = entry; + } + ClockFmtScnStorage_GC.count++; + + /* if GC ist full */ + if (ClockFmtScnStorage_GC.count > CLOCK_FMT_SCN_STORAGE_GC_SIZE) { + + /* GC stack is LIFO: delete first inserted entry */ + ClockFmtScnStorage *delEnt = ClockFmtScnStorage_GC.stackBound; + ClockFmtScnStorage_GC.stackBound = delEnt->prevPtr; + TclSpliceOut(delEnt, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + delEnt->prevPtr = delEnt->nextPtr = NULL; + /* remove it now */ + ClockFmtScnStorageDelete(delEnt); + } +} + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorage_GC_Out -- + * + * Restores (for reusing) given format storage object from GC. + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static inline void +ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) +{ + TclSpliceOut(entry, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + if (ClockFmtScnStorage_GC.stackBound == entry) { + ClockFmtScnStorage_GC.stackBound = entry->prevPtr; + } + entry->prevPtr = entry->nextPtr = NULL; +} + +#endif + + +/* + * Global format storage hash table of type ClockFmtScnStorageHashKeyType + * (contains list of scan/format object storages, shared across all threads). + * + * Used for fast searching by format string. + */ +static Tcl_HashTable FmtScnHashTable; +static int initialized = 0; + +/* + * Wrappers between pointers to hash entry and format storage object + */ +static inline Tcl_HashEntry * +HashEntry4FmtScn(ClockFmtScnStorage *fss) { + return (Tcl_HashEntry*)(fss + 1); +}; +static inline ClockFmtScnStorage * +FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { + return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); +}; + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageAllocProc -- + * + * Allocate space for a hash entry containing format storage together + * with the string key. + * + * Results: + * The return value is a pointer to the created entry. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +ClockFmtScnStorageAllocProc( + Tcl_HashTable *tablePtr, /* Hash table. */ + void *keyPtr) /* Key to store in the hash table entry. */ +{ + ClockFmtScnStorage *fss; + + const char *string = (const char *) keyPtr; + Tcl_HashEntry *hPtr; + unsigned int size, + allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry); + + allocsize += (size = strlen(string) + 1); + if (size > sizeof(hPtr->key)) { + allocsize -= sizeof(hPtr->key); + } + + fss = ckalloc(allocsize); + + /* initialize */ + memset(fss, 0, sizeof(*fss)); + + hPtr = HashEntry4FmtScn(fss); + memcpy(&hPtr->key.string, string, size); + hPtr->clientData = 0; /* currently unused */ + + return hPtr; +} + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageFreeProc -- + * + * Free format storage object and space of given hash entry. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ClockFmtScnStorageFreeProc( + Tcl_HashEntry *hPtr) +{ + ClockFmtScnStorage *fss = FmtScn4HashEntry(hPtr); + + if (fss->scnTok != NULL) { + ckfree(fss->scnTok); + fss->scnTok = NULL; + fss->scnTokC = 0; + } + if (fss->fmtTok != NULL) { + ckfree(fss->fmtTok); + fss->fmtTok = NULL; + fss->fmtTokC = 0; + } + + ckfree(fss); +} + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageDelete -- + * + * Delete format storage object. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + /* + * This will delete a hash entry and call "ckfree" for storage self, if + * some additionally handling required, freeEntryProc can be used instead + */ + Tcl_DeleteHashEntry(hPtr); +} + + +/* + * Derivation of tclStringHashKeyType with another allocEntryProc + */ + +static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; + + +/* + * Type definition of clock-format tcl object type. + */ + +Tcl_ObjType ClockFmtObjType = { + "clock-format", /* name */ + ClockFmtObj_FreeInternalRep, /* freeIntRepProc */ + ClockFmtObj_DupInternalRep, /* dupIntRepProc */ + ClockFmtObj_UpdateString, /* updateStringProc */ + ClockFmtObj_SetFromAny /* setFromAnyProc */ +}; + +#define ObjClockFmtScn(objPtr) \ + (*((ClockFmtScnStorage **)&(objPtr)->internalRep.twoPtrValue.ptr1)) + +#define ObjLocFmtKey(objPtr) \ + (*((Tcl_Obj **)&(objPtr)->internalRep.twoPtrValue.ptr2)) + +static void +ClockFmtObj_DupInternalRep(srcPtr, copyPtr) + Tcl_Obj *srcPtr; + Tcl_Obj *copyPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(srcPtr); + + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + fss->objRefCount++; + Tcl_MutexUnlock(&ClockFmtMutex); + } + + ObjClockFmtScn(copyPtr) = fss; + /* regards special case - format not localizable */ + if (ObjLocFmtKey(srcPtr) != srcPtr) { + Tcl_InitObjRef(ObjLocFmtKey(copyPtr), ObjLocFmtKey(srcPtr)); + } else { + ObjLocFmtKey(copyPtr) = copyPtr; + } + copyPtr->typePtr = &ClockFmtObjType; + + + /* if no format representation, dup string representation */ + if (fss == NULL) { + copyPtr->bytes = ckalloc(srcPtr->length + 1); + memcpy(copyPtr->bytes, srcPtr->bytes, srcPtr->length + 1); + copyPtr->length = srcPtr->length; + } +} + +static void +ClockFmtObj_FreeInternalRep(objPtr) + Tcl_Obj *objPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + /* decrement object reference count of format/scan storage */ + if (--fss->objRefCount <= 0) { + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* don't remove it right now (may be reusable), just add to GC */ + ClockFmtScnStorageGC_In(fss); + #else + /* remove storage (format representation) */ + ClockFmtScnStorageDelete(fss); + #endif + } + Tcl_MutexUnlock(&ClockFmtMutex); + } + ObjClockFmtScn(objPtr) = NULL; + if (ObjLocFmtKey(objPtr) != objPtr) { + Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); + } else { + ObjLocFmtKey(objPtr) = NULL; + } + objPtr->typePtr = NULL; +}; + +static int +ClockFmtObj_SetFromAny(interp, objPtr) + Tcl_Interp *interp; + Tcl_Obj *objPtr; +{ + /* validate string representation before free old internal represenation */ + (void)TclGetString(objPtr); + + /* free old internal represenation */ + if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) + objPtr->typePtr->freeIntRepProc(objPtr); + + /* initial state of format object */ + ObjClockFmtScn(objPtr) = NULL; + ObjLocFmtKey(objPtr) = NULL; + objPtr->typePtr = &ClockFmtObjType; + + return TCL_OK; +}; + +static void +ClockFmtObj_UpdateString(objPtr) + Tcl_Obj *objPtr; +{ + char *name = "UNKNOWN"; + int len; + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + + if (fss != NULL) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + name = hPtr->key.string; + } + len = strlen(name); + objPtr->length = len, + objPtr->bytes = ckalloc((size_t)++len); + if (objPtr->bytes) + memcpy(objPtr->bytes, name, len); +} + +/* + *---------------------------------------------------------------------- + * + * ClockFrmObjGetLocFmtKey -- + * + * Retrieves format key object used to search localized format. + * + * This is normally stored in second pointer of internal representation. + * If format object is not localizable, it is equal the given format + * pointer and the first pointer of internal representation may be NULL. + * + * Results: + * Returns tcl object with key or format object if not localizable. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the key inside its internal representation. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE Tcl_Obj* +ClockFrmObjGetLocFmtKey( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + Tcl_Obj *keyObj; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + keyObj = ObjLocFmtKey(objPtr); + if (keyObj) { + return keyObj; + } + + keyObj = Tcl_ObjPrintf("FMT_%s", TclGetString(objPtr)); + Tcl_InitObjRef(ObjLocFmtKey(objPtr), keyObj); + + return keyObj; +} + +/* + *---------------------------------------------------------------------- + * + * FindOrCreateFmtScnStorage -- + * + * Retrieves format storage for given string format. + * + * This will find the given format in the global storage hash table + * or create a format storage object on demaind and save the + * reference in the first pointer of internal representation of given + * object. + * + * Results: + * Returns scan/format storage pointer to ClockFmtScnStorage. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the format storage reference inside its internal representation. + * Increments objRefCount of the ClockFmtScnStorage reference. + * + *---------------------------------------------------------------------- + */ + +static ClockFmtScnStorage * +FindOrCreateFmtScnStorage( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + const char *strFmt = TclGetString(objPtr); + ClockFmtScnStorage *fss = NULL; + int new; + Tcl_HashEntry *hPtr; + + Tcl_MutexLock(&ClockFmtMutex); + + /* if not yet initialized */ + if (!initialized) { + /* initialize type */ + memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); + ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; + ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; + + /* initialize hash table */ + Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, + &ClockFmtScnStorageHashKeyType); + + initialized = 1; + Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); + } + + /* get or create entry (and alocate storage) */ + hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); + if (hPtr != NULL) { + + fss = FmtScn4HashEntry(hPtr); + + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* unlink if it is currently in GC */ + if (new == 0 && fss->objRefCount == 0) { + ClockFmtScnStorage_GC_Out(fss); + } + #endif + + /* new reference, so increment in lock right now */ + fss->objRefCount++; + + ObjClockFmtScn(objPtr) = fss; + } + + Tcl_MutexUnlock(&ClockFmtMutex); + + if (fss == NULL && interp != NULL) { + Tcl_AppendResult(interp, "retrieve clock format failed \"", + strFmt ? strFmt : "", "\"", NULL); + Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetClockFrmScnFromObj -- + * + * Returns a clock format/scan representation of (*objPtr), if possible. + * If something goes wrong, NULL is returned, and if interp is non-NULL, + * an error message is written there. + * + * Results: + * Valid representation of type ClockFmtScnStorage. + * + * Side effects: + * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) + * and in global hash table, shared across all threads. + * + *---------------------------------------------------------------------- + */ + +ClockFmtScnStorage * +Tcl_GetClockFrmScnFromObj( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + ClockFmtScnStorage *fss; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + fss = ObjClockFmtScn(objPtr); + + if (fss == NULL) { + fss = FindOrCreateFmtScnStorage(interp, objPtr); + } + + return fss; +} +/* + *---------------------------------------------------------------------- + * + * ClockLocalizeFormat -- + * + * Wrap the format object in options to the localized format, + * corresponding given locale. + * + * This searches localized format in locale catalog, and if not yet + * exists, it executes ::tcl::clock::LocalizeFormat in given interpreter + * and caches its result in the locale catalog. + * + * Results: + * Localized format object. + * + * Side effects: + * Caches the localized format inside locale catalog. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj = NULL, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + /* special case - format object is not localizable */ + if (keyObj == opts->formatObj) { + return opts->formatObj; + } + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within locale mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + + /* call LocalizeFormat locale format fmtkey */ + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + goto clean; + } + + valObj = Tcl_GetObjResult(opts->interp); + + /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + valObj = NULL; + goto clean; + } + + /* check special case - format object is not localizable */ + if (valObj == opts->formatObj) { + /* mark it as unlocalizable, by setting self as key (without refcount incr) */ + if (opts->formatObj->typePtr == &ClockFmtObjType) { + Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); + ObjLocFmtKey(opts->formatObj) = opts->formatObj; + } + } +clean: + + Tcl_UnsetObjRef(keyObj); + if (valObj) { + Tcl_ResetResult(opts->interp); + } + } + + return (opts->formatObj = valObj); +} + +/* + *---------------------------------------------------------------------- + * + * FindTokenBegin -- + * + * Find begin of given scan token in string, corresponding token type. + * + * Results: + * Position of token inside string if found. Otherwise - end of string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static const char * +FindTokenBegin( + register const char *p, + register const char *end, + ClockScanToken *tok) +{ + char c; + if (p < end) { + /* next token a known token type */ + switch (tok->map->type) { + case CTOKT_DIGIT: + /* should match at least one digit */ + while (!isdigit(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_WORD: + c = *(tok->tokWord.start); + /* should match at least to the first char of this word */ + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_SPACE: + while (!isspace(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_CHAR: + c = *((char *)tok->map->data); + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + } + } + return p; +} + +/* + *---------------------------------------------------------------------- + * + * DetermineGreedySearchLen -- + * + * Determine min/max lengths as exact as possible (speed, greedy match). + * + * Results: + * None. Lengths are stored in *minLenPtr, *maxLenPtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok, + int *minLenPtr, int *maxLenPtr) +{ + register int minLen = tok->map->minSize; + register int maxLen; + register const char *p = yyInput + minLen, + *end = info->dateEnd; + + /* if still tokens available, try to correct minimum length */ + if ((tok+1)->map) { + end -= tok->endDistance + yySpaceCount; + /* find position of next known token */ + p = FindTokenBegin(p, end, tok+1); + if (p < end) { + minLen = p - yyInput; + } + } + + /* max length to the end regarding distance to end (min-width of following tokens) */ + maxLen = end - yyInput; + /* several amendments */ + if (maxLen > tok->map->maxSize) { + maxLen = tok->map->maxSize; + }; + if (minLen < tok->map->minSize) { + minLen = tok->map->minSize; + } + if (minLen > maxLen) { + maxLen = minLen; + } + if (maxLen > info->dateEnd - yyInput) { + maxLen = info->dateEnd - yyInput; + } + + /* check digits rigth now */ + if (tok->map->type == CTOKT_DIGIT) { + p = yyInput; + end = p + maxLen; + if (end > info->dateEnd) { end = info->dateEnd; }; + while (isdigit(UCHAR(*p)) && p < end) { p++; }; + maxLen = p - yyInput; + } + + /* try to get max length more precise for greedy match, + * check the next ahead token available there */ + if (minLen < maxLen && tok->lookAhTok) { + ClockScanToken *laTok = tok + tok->lookAhTok + 1; + p = yyInput + maxLen; + /* regards all possible spaces here (because they are optional) */ + end = p + tok->lookAhMax + yySpaceCount + 1; + if (end > info->dateEnd) { + end = info->dateEnd; + } + p += tok->lookAhMin; + if (laTok->map && p < end) { + const char *f; + /* try to find laTok between [lookAhMin, lookAhMax] */ + while (minLen < maxLen) { + f = FindTokenBegin(p, end, laTok); + /* if found (not below lookAhMax) */ + if (f < end) { + break; + } + /* try again with fewer length */ + maxLen--; + p--; + end--; + } + } else if (p > end) { + maxLen -= (p - end); + if (maxLen < minLen) { + maxLen = minLen; + } + } + } + + *minLenPtr = minLen; + *maxLenPtr = maxLen; +} + +/* + *---------------------------------------------------------------------- + * + * ObjListSearch -- + * + * Find largest part of the input string from start regarding min and + * max lengths in the given list (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found, TCL_RETURN - not matched, TCL_ERROR in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + +static inline int +ObjListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int *val, + Tcl_Obj **lstv, int lstc, + int minLen, int maxLen) +{ + int i, l, lf = -1; + const char *s, *f, *sf; + /* search in list */ + for (i = 0; i < lstc; i++) { + s = TclGetString(lstv[i]); + l = lstv[i]->length; + + if ( l >= minLen + && (f = TclUtfFindEqualNC(yyInput, yyInput + maxLen, s, s + l, &sf)) > yyInput + ) { + l = f - yyInput; + if (l < minLen) { + continue; + } + /* found, try to find longest value (greedy search) */ + if (l < maxLen && minLen != maxLen) { + lf = i; + minLen = l + 1; + continue; + } + /* max possible - end of search */ + *val = i; + yyInput += l; + break; + } + } + + /* if found */ + if (i < lstc) { + return TCL_OK; + } + if (lf >= 0) { + *val = lf; + yyInput += minLen - 1; + return TCL_OK; + } + return TCL_RETURN; +} +#if 0 +/* currently unused */ + +static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int mcKey, int *val, + int minLen, int maxLen) +{ + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + /* get msgcat value */ + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + return TCL_ERROR; + } + + /* is a list */ + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + } + + /* search in list */ + return ObjListSearch(opts, info, val, lstv, lstc, + minLen, maxLen); +} +#endif + +/* + *---------------------------------------------------------------------- + * + * ClockMCGetListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * given literal index mcKey (and builds it on demand). + * + * Searches localized index in locale catalog, and if not yet exists, + * creates string indexed tree and stores it in the locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + +static TclStrIdxTree * +ClockMCGetListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +/* + *---------------------------------------------------------------------- + * + * ClockMCGetMultiListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * multiple lists by literal indices mcKeys (and builds it on demand). + * + * Searches localized index in locale catalog for mcKey, and if not + * yet exists, creates string indexed tree and stores it in the + * locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + +static TclStrIdxTree * +ClockMCGetMultiListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey, + int *mcKeys) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + while (*mcKeys) { + + valObj = ClockMCGet(opts, *mcKeys); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + mcKeys++; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +/* + *---------------------------------------------------------------------- + * + * ClockStrIdxTreeSearch -- + * + * Find largest part of the input string from start regarding lengths + * in the given localized string indexed tree (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found and the index stored in *val, + * TCL_RETURN - not matched or ambigous, + * TCL_ERROR - in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + +static inline int +ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, TclStrIdxTree *idxTree, int *val, + int minLen, int maxLen) +{ + const char *f; + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, + yyInput, yyInput + maxLen); + + if (f <= yyInput || (f - yyInput) < minLen) { + /* not found */ + return TCL_RETURN; + } + if (foundItem->value == -1) { + /* ambigous */ + return TCL_RETURN; + } + + *val = foundItem->value; + + /* shift input pointer */ + yyInput = f; + + return TCL_OK; +} +#if 0 +/* currently unused */ + +static int +StaticListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, const char **lst, int *val) +{ + int len; + const char **s = lst; + while (*s != NULL) { + len = strlen(*s); + if ( len <= info->dateEnd - yyInput + && strncasecmp(yyInput, *s, len) == 0 + ) { + *val = (s - lst); + yyInput += len; + break; + } + s++; + } + if (*s != NULL) { + return TCL_OK; + } + return TCL_RETURN; +} +#endif + +static inline const char * +FindWordEnd( + ClockScanToken *tok, + register const char * p, const char * end) +{ + register const char *x = tok->tokWord.start; + const char *pfnd = p; + if (x == tok->tokWord.end - 1) { /* fast phase-out for single char word */ + if (*p == *x) { + return ++p; + } + } + /* multi-char word */ + x = TclUtfFindEqualNC(x, tok->tokWord.end, p, end, &pfnd); + if (x < tok->tokWord.end) { + /* no match -> error */ + return NULL; + } + return pfnd; +} + +static int +ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ +#if 0 +/* currently unused, test purposes only */ + static const char * months[] = { + /* full */ + "January", "February", "March", + "April", "May", "June", + "July", "August", "September", + "October", "November", "December", + /* abbr */ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + NULL + }; + int val; + if (StaticListSearch(opts, info, months, &val) != TCL_OK) { + return TCL_RETURN; + } + yyMonth = (val % 12) + 1; + return TCL_OK; +#endif + + static int monthsKeys[] = {MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, 0}; + + int ret, val; + int minLen, maxLen; + TclStrIdxTree *idxTree; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_MONTHS_COMB, monthsKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + yyMonth = val + 1; + return TCL_OK; + +} + +static int +ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + static int dowKeys[] = {MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_FULL, 0}; + + int ret, val; + int minLen, maxLen; + char curTok = *tok->tokWord.start; + TclStrIdxTree *idxTree; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* %u %w %Ou %Ow */ + if ( curTok != 'a' && curTok != 'A' + && ((minLen <= 1 && maxLen >= 1) || PTR2INT(tok->map->data)) + ) { + + val = -1; + + if (PTR2INT(tok->map->data) == 0) { + if (*yyInput >= '0' && *yyInput <= '9') { + val = *yyInput - '0'; + } + } else { + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + } + + if (val != -1) { + if (val == 0) { + val = 7; + } + if (val > 7) { + Tcl_SetResult(opts->interp, "day of week is greater than 7", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); + return TCL_ERROR; + } + info->date.dayOfWeek = val; + yyInput++; + return TCL_OK; + } + + + return TCL_RETURN; + } + + /* %a %A */ + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_DAYS_OF_WEEK_COMB, dowKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val == 0) { + val = 7; + } + info->date.dayOfWeek = val; + return TCL_OK; + +} + +static int +ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + Tcl_Obj *amPmObj[2]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + amPmObj[0] = ClockMCGet(opts, MCLIT_AM); + amPmObj[1] = ClockMCGet(opts, MCLIT_PM); + + if (amPmObj[0] == NULL || amPmObj[1] == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, amPmObj, 2, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val == 0) { + yyMeridian = MERam; + } else { + yyMeridian = MERpm; + } + + return TCL_OK; +} + +static int +ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + ClockClientData *dataPtr = opts->clientData; + + int ret, val; + int minLen, maxLen; + Tcl_Obj *eraObj[6]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + eraObj[0] = ClockMCGet(opts, MCLIT_BCE); + eraObj[1] = ClockMCGet(opts, MCLIT_CE); + eraObj[2] = dataPtr->mcLiterals[MCLIT_BCE2]; + eraObj[3] = dataPtr->mcLiterals[MCLIT_CE2]; + eraObj[4] = dataPtr->mcLiterals[MCLIT_BCE3]; + eraObj[5] = dataPtr->mcLiterals[MCLIT_CE3]; + + if (eraObj[0] == NULL || eraObj[1] == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, eraObj, 6, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val & 1) { + yydate.era = CE; + } else { + yydate.era = BCE; + } + + return TCL_OK; +} + +static int +ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + TclStrIdxTree *idxTree; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (tok->map->offs > 0) { + *(int *)(((char *)info) + tok->map->offs) = val; + } + + return TCL_OK; +} + +static int +ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + int len = 0; + register const char *p = yyInput; + Tcl_Obj *tzObjStor = NULL; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* numeric timezone */ + if (*p == '+' || *p == '-') { + /* max chars in numeric zone = "+00:00:00" */ + #define MAX_ZONE_LEN 9 + char buf[MAX_ZONE_LEN + 1]; + char *bp = buf; + *bp++ = *p++; len++; + if (maxLen > MAX_ZONE_LEN) + maxLen = MAX_ZONE_LEN; + /* cumulate zone into buf without ':' */ + while (len + 1 < maxLen) { + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (len + 2 < maxLen) { + if (*p == ':') { + p++; len++; + } + } + } + *bp = '\0'; + + if (len < minLen) { + return TCL_RETURN; + } + #undef MAX_ZONE_LEN + + /* timezone */ + tzObjStor = Tcl_NewStringObj(buf, bp-buf); + } else { + /* legacy (alnum) timezone like CEST, etc. */ + if (maxLen > 4) + maxLen = 4; + while (len < maxLen) { + if ( (*p & 0x80) + || (!isalpha(UCHAR(*p)) && !isdigit(UCHAR(*p))) + ) { /* INTL: ISO only. */ + break; + } + p++; len++; + } + + if (len < minLen) { + return TCL_RETURN; + } + + /* timezone */ + tzObjStor = Tcl_NewStringObj(yyInput, p-yyInput); + + /* convert using dict */ + } + + /* try to apply new time zone */ + Tcl_IncrRefCount(tzObjStor); + + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, + tzObjStor); + + Tcl_DecrRefCount(tzObjStor); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } + + yyInput += len; + + return TCL_OK; +} + +static int +ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + register const char *p = yyInput, *end; const char *s; + int year, fractYear, fractDayDiv, fractDay; + static const char *stardatePref = "stardate "; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + end = yyInput + maxLen; + + /* stardate string */ + p = TclUtfFindEqualNCInLwr(p, end, stardatePref, stardatePref + 9, &s); + if (p >= end || p - yyInput < 9) { + return TCL_RETURN; + } + /* bypass spaces */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + if (p >= end) { + return TCL_RETURN; + } + /* currently positive stardate only */ + if (*p == '+') { p++; }; + s = p; + while (p < end && isdigit(UCHAR(*p))) { + p++; + } + if (p >= end || p - s < 4) { + return TCL_RETURN; + } + if ( _str2int(&year, s, p-3, 1) != TCL_OK + || _str2int(&fractYear, p-3, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + if (*p++ != '.') { + return TCL_RETURN; + } + s = p; + fractDayDiv = 1; + while (p < end && isdigit(UCHAR(*p))) { + fractDayDiv *= 10; + p++; + } + if ( _str2int(&fractDay, s, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + yyInput = p; + + /* Build a date from year and fraction. */ + + yydate.year = year + RODDENBERRY; + yydate.era = CE; + yydate.gregorian = 1; + + if (IsGregorianLeapYear(&yydate)) { + fractYear *= 366; + } else { + fractYear *= 365; + } + yydate.dayOfYear = fractYear / 1000 + 1; + if (fractYear % 1000 >= 500) { + yydate.dayOfYear++; + } + + GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + + yydate.localSeconds = + -210866803200L + + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + + ( SECONDS_PER_DAY * fractDay / fractDayDiv ); + + return TCL_OK; +} + +static const char *ScnSTokenMapIndex = + "dmbyYHMSpJjCgGVazUsntQ"; +static ClockScanTokenMap ScnSTokenMap[] = { + /* %d %e */ + {CTOKT_DIGIT, CLF_DAYOFMONTH, 0, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + NULL}, + /* %m %N */ + {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), + NULL}, + /* %b %B %h */ + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, 0, + ClockScnToken_Month_Proc}, + /* %y */ + {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), + NULL}, + /* %Y */ + {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 4, 4, TclOffset(DateInfo, date.year), + NULL}, + /* %H %k %I %l */ + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), + NULL}, + /* %M */ + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.minutes), + NULL}, + /* %S */ + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), + NULL}, + /* %p %P */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, + ClockScnToken_amPmInd_Proc, NULL}, + /* %J */ + {CTOKT_DIGIT, CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + NULL}, + /* %j */ + {CTOKT_DIGIT, CLF_DAYOFYEAR, 0, 1, 3, TclOffset(DateInfo, date.dayOfYear), + NULL}, + /* %C */ + {CTOKT_DIGIT, CLF_CENTURY|CLF_ISO8601CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), + NULL}, + /* %g */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601, 0, 2, 2, TclOffset(DateInfo, date.iso8601Year), + NULL}, + /* %G */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 4, 4, TclOffset(DateInfo, date.iso8601Year), + NULL}, + /* %V */ + {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), + NULL}, + /* %a %A %u %w */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, + ClockScnToken_DayOfWeek_Proc, NULL}, + /* %z %Z */ + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0xffff, 0, + ClockScnToken_TimeZone_Proc, NULL}, + /* %U %W */ + {CTOKT_DIGIT, CLF_OPTIONAL, 0, 1, 2, 0, /* currently no capture, parse only token */ + NULL}, + /* %s */ + {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), + NULL}, + /* %n */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, + /* %t */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, + /* %Q */ + {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, + ClockScnToken_StarDate_Proc, NULL}, +}; +static const char *ScnSTokenMapAliasIndex[2] = { + "eNBhkIlPAuwZW", + "dmbbHHHpaaazU" +}; + +static const char *ScnETokenMapIndex = + "Eys"; +static ClockScanTokenMap ScnETokenMap[] = { + /* %EE */ + {CTOKT_PARSER, 0, 0, 0, 0xffff, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ey */ + {CTOKT_PARSER, 0, 0, 0, 0xffff, 0, /* currently no capture, parse only token */ + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Es */ + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + NULL}, +}; +static const char *ScnETokenMapAliasIndex[2] = { + "", + "" +}; + +static const char *ScnOTokenMapIndex = + "dmyHMSu"; +static ClockScanTokenMap ScnOTokenMap[] = { + /* %Od %Oe */ + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.dayOfMonth), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.month), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0xffff, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok %OI %Ol */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.hour), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.minutes), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.secondOfDay), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou Ow */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, + ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, +}; +static const char *ScnOTokenMapAliasIndex[2] = { + "ekIlw", + "dHHHu" +}; + +static const char *ScnSpecTokenMapIndex = + " "; +static ClockScanTokenMap ScnSpecTokenMap[] = { + {CTOKT_SPACE, 0, 0, 1, 1, 0, + NULL}, +}; + +static ClockScanTokenMap ScnWordTokenMap = { + CTOKT_WORD, 0, 0, 1, 1, 0, + NULL +}; + + +static inline unsigned int +EstimateTokenCount( + register const char *fmt, + register const char *end) +{ + register const char *p = fmt; + unsigned int tokcnt; + /* estimate token count by % char and format length */ + tokcnt = 0; + while (p <= end) { + if (*p++ == '%') { + tokcnt++; + p++; + } + } + p = fmt + tokcnt * 2; + if (p < end) { + if ((unsigned int)(end - p) < tokcnt) { + tokcnt += (end - p); + } else { + tokcnt += tokcnt; + } + } + return ++tokcnt; +} + +#define AllocTokenInChain(tok, chain, tokCnt) \ + if (++(tok) >= (chain) + (tokCnt)) { \ + *((char **)&chain) = ckrealloc((char *)(chain), \ + (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ + if ((chain) == NULL) { goto done; }; \ + (tok) = (chain) + (tokCnt); \ + (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } \ + memset(tok, 0, sizeof(*(tok))); + +/* + *---------------------------------------------------------------------- + */ +ClockFmtScnStorage * +ClockGetOrParseScanFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockScanToken *tok; + + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); + if (fss == NULL) { + return NULL; + } + + /* if first time scanning - tokenize format */ + if (fss->scnTok == NULL) { + unsigned int tokCnt; + register const char *p, *e, *cp; + + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); + + /* estimate token count by % char and format length */ + fss->scnTokC = EstimateTokenCount(p, e); + + fss->scnSpaceCount = 0; + + Tcl_MutexLock(&ClockFmtMutex); + + fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); + memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; + while (p < e) { + switch (*p) { + case '%': + if (1) { + ClockScanTokenMap * scnMap = ScnSTokenMap; + const char *mapIndex = ScnSTokenMapIndex, + **aliasIndex = ScnSTokenMapAliasIndex; + if (p+1 >= e) { + goto word_tok; + } + p++; + /* try to find modifier: */ + switch (*p) { + case '%': + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &ScnWordTokenMap; + tok->tokWord.start = p; + tok->tokWord.end = p+1; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + p++; + continue; + break; + case 'E': + scnMap = ScnETokenMap, + mapIndex = ScnETokenMapIndex, + aliasIndex = ScnETokenMapAliasIndex; + p++; + break; + case 'O': + scnMap = ScnOTokenMap, + mapIndex = ScnOTokenMapIndex, + aliasIndex = ScnOTokenMapAliasIndex; + p++; + break; + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(aliasIndex[0], *p); + if (!cp || *cp == '\0') { + p--; if (scnMap != ScnSTokenMap) p--; + goto word_tok; + } + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; if (scnMap != ScnSTokenMap) p--; + goto word_tok; + } + } + tok->map = &scnMap[cp - mapIndex]; + tok->tokWord.start = p; + + /* calculate look ahead value by standing together tokens */ + if (tok > fss->scnTok) { + ClockScanToken *prevTok = tok - 1; + + while (prevTok >= fss->scnTok) { + if (prevTok->map->type != tok->map->type) { + break; + } + prevTok->lookAhMin += tok->map->minSize; + prevTok->lookAhMax += tok->map->maxSize; + prevTok->lookAhTok++; + prevTok--; + } + } + + /* increase space count used in format */ + if ( tok->map->type == CTOKT_CHAR + && isspace(UCHAR(*((char *)tok->map->data))) + ) { + fss->scnSpaceCount++; + } + + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + p++; + continue; + } + break; + case ' ': + cp = strchr(ScnSpecTokenMapIndex, *p); + if (!cp || *cp == '\0') { + p--; + goto word_tok; + } + tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; + /* increase space count used in format */ + fss->scnSpaceCount++; + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + p++; + continue; + break; + default: +word_tok: + if (1) { + ClockScanToken *wordTok = tok; + if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { + wordTok = tok-1; + } + /* new word token */ + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &ScnWordTokenMap; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + } + if (isspace(UCHAR(*p))) { + fss->scnSpaceCount++; + } + p = TclUtfNext(p); + wordTok->tokWord.end = p; + } + break; + } + } + + /* calculate end distance value for each tokens */ + if (tok > fss->scnTok) { + unsigned int endDist = 0; + ClockScanToken *prevTok = tok-1; + + while (prevTok >= fss->scnTok) { + prevTok->endDistance = endDist; + if (prevTok->map->type != CTOKT_WORD) { + endDist += prevTok->map->minSize; + } else { + endDist += prevTok->tokWord.end - prevTok->tokWord.start; + } + prevTok--; + } + } + + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->scnTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->scnTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->scnTok = tok; + } + } + fss->scnTokC = tokCnt; + +done: + Tcl_MutexUnlock(&ClockFmtMutex); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- + */ +int +ClockScan( + register DateInfo *info, /* Date fields used for parsing & converting */ + Tcl_Obj *strObj, /* String containing the time to scan */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockClientData *dataPtr = opts->clientData; + ClockFmtScnStorage *fss; + ClockScanToken *tok; + ClockScanTokenMap *map; + register const char *p, *x, *end; + unsigned short int flags = 0; + int ret = TCL_ERROR; + + /* get localized format */ + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + + if ( !(fss = ClockGetOrParseScanFormat(opts->interp, opts->formatObj)) + || !(tok = fss->scnTok) + ) { + return TCL_ERROR; + } + + /* prepare parsing */ + + yyMeridian = MER24; + + p = TclGetString(strObj); + end = p + strObj->length; + /* in strict mode - bypass spaces at begin / end only (not between tokens) */ + if (opts->flags & CLF_STRICT) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + } + yyInput = p; + /* look ahead to count spaces (bypass it by count length and distances) */ + x = end; + while (p < end) { + if (isspace(UCHAR(*p))) { + x = p++; + yySpaceCount++; + continue; + } + x = end; + p++; + } + /* ignore spaces at end */ + yySpaceCount -= (end - x); + end = x; + /* ignore mandatory spaces used in format */ + yySpaceCount -= fss->scnSpaceCount; + if (yySpaceCount < 0) { + yySpaceCount = 0; + } + info->dateStart = p = yyInput; + info->dateEnd = end; + + /* parse string */ + for (; tok->map != NULL; tok++) { + map = tok->map; + /* bypass spaces at begin of input before parsing each token */ + if ( !(opts->flags & CLF_STRICT) + && ( map->type != CTOKT_SPACE + && map->type != CTOKT_WORD + && map->type != CTOKT_CHAR ) + ) { + while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; + p++; + } + } + yyInput = p; + /* end of input string */ + if (p >= end) { + break; + } + switch (map->type) + { + case CTOKT_DIGIT: + if (1) { + int minLen, size; + int sign = 1; + if (map->flags & CLF_SIGNED) { + if (*p == '+') { yyInput = ++p; } + else + if (*p == '-') { yyInput = ++p; sign = -1; }; + } + + DetermineGreedySearchLen(opts, info, tok, &minLen, &size); + + if (size < map->minSize) { + /* missing input -> error */ + if ((map->flags & CLF_OPTIONAL)) { + continue; + } + goto not_match; + } + /* string 2 number, put number into info structure by offset */ + if (map->offs) { + p = yyInput; x = p + size; + if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { + if (_str2int((int *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } + flags = (flags & ~map->clearFlags) | map->flags; + } + } + break; + case CTOKT_PARSER: + switch (map->parser(opts, info, tok)) { + case TCL_OK: + break; + case TCL_RETURN: + if ((map->flags & CLF_OPTIONAL)) { + yyInput = p; + continue; + } + goto not_match; + break; + default: + goto done; + break; + }; + /* decrement count for possible spaces in match */ + while (p < yyInput) { + if (isspace(UCHAR(*p++))) { + yySpaceCount--; + } + } + p = yyInput; + flags = (flags & ~map->clearFlags) | map->flags; + break; + case CTOKT_SPACE: + /* at least one space */ + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto not_match; + } + yySpaceCount--; + p++; + while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; + p++; + } + break; + case CTOKT_WORD: + x = FindWordEnd(tok, p, end); + if (!x) { + /* no match -> error */ + goto not_match; + } + p = x; + break; + case CTOKT_CHAR: + x = (char *)map->data; + if (*x != *p) { + /* no match -> error */ + goto not_match; + } + if (isspace(UCHAR(*x))) { + yySpaceCount--; + } + p++; + break; + } + } + /* check end was reached */ + if (p < end) { + /* something after last token - wrong format */ + goto not_match; + } + /* end of string, check only optional tokens at end, otherwise - not match */ + while (tok->map != NULL) { + if (!(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE)) { + tok++; + if (tok->map == NULL) break; + } + if (!(tok->map->flags & CLF_OPTIONAL)) { + goto not_match; + } + tok++; + } + + /* + * Invalidate result + */ + + /* seconds token (%s) take precedence over all other tokens */ + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_POSIXSEC)) { + if (flags & CLF_DATE) { + + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; + + /* dd precedence below ddd */ + switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { + case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* miss month: ddd over dd (without month) */ + flags &= ~CLF_DAYOFMONTH; + case (CLF_DAYOFYEAR): + /* ddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* both available: mmdd over ddd */ + flags &= ~CLF_DAYOFYEAR; + case (CLF_MONTH|CLF_DAYOFMONTH): + case (CLF_DAYOFMONTH): + /* mmdd / dd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + } + + /* YearWeekDay below YearMonthDay */ + if ( (flags & CLF_ISO8601) + && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) + || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) + ) + ) { + /* yy precedence below yyyy */ + if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { + /* normally precedence of ISO is higher, but no century - so put it down */ + flags &= ~CLF_ISO8601; + } + else + /* yymmdd or yyddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + } + + if (!(flags & CLF_ISO8601)) { + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; + } + } + } else { + if (info->date.iso8601Year < 100) { + if (!(flags & CLF_ISO8601CENTURY)) { + if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { + info->date.iso8601Year -= 100; + } + info->date.iso8601Year += dataPtr->currentYearCentury; + } else { + info->date.iso8601Year += info->dateCentury * 100; + } + } + } + } + } + + /* if no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC|CLF_POSIXSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yydate.localSeconds = 0; + } + + if (flags & CLF_TIME) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else + if (!(flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + } + } + + /* tell caller which flags were set */ + info->flags |= flags; + + ret = TCL_OK; + goto done; + +overflow: + + Tcl_SetResult(opts->interp, "requested date too large to represent", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); + goto done; + +not_match: + + Tcl_SetResult(opts->interp, "input string does not match supplied format", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); + +done: + + return ret; +} + +static inline int +FrmResultAllocate( + register DateFormat *dateFmt, + int len) +{ + int needed = dateFmt->output + len - dateFmt->resEnd; + if (needed >= 0) { /* >= 0 - regards NTS zero */ + int newsize = dateFmt->resEnd - dateFmt->resMem + + needed + MIN_FMT_RESULT_BLOCK_ALLOC; + char *newRes = ckrealloc(dateFmt->resMem, newsize); + if (newRes == NULL) { + return TCL_ERROR; + } + dateFmt->output = newRes + (dateFmt->output - dateFmt->resMem); + dateFmt->resMem = newRes; + dateFmt->resEnd = newRes + newsize; + } + return TCL_OK; +} + +static int +ClockFmtToken_HourAMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + *val = ( ( ( *val % SECONDS_PER_DAY ) + SECONDS_PER_DAY - 3600 ) / 3600 ) % 12 + 1; + return TCL_OK; +} + +static int +ClockFmtToken_AMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if ((*val % SECONDS_PER_DAY) < (SECONDS_PER_DAY / 2)) { + mcObj = ClockMCGet(opts, MCLIT_AM); + } else { + mcObj = ClockMCGet(opts, MCLIT_PM); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + if (*tok->tokWord.start == 'p') { + len = Tcl_UtfToUpper(dateFmt->output); + } + dateFmt->output += len; + + return TCL_OK; +} + +static int +ClockFmtToken_StarDate_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) + { + int fractYear; + /* Get day of year, zero based */ + int doy = dateFmt->date.dayOfYear - 1; + + /* Convert day of year to a fractional year */ + if (IsGregorianLeapYear(&dateFmt->date)) { + fractYear = 1000 * doy / 366; + } else { + fractYear = 1000 * doy / 365; + } + + /* Put together the StarDate as "Stardate %02d%03d.%1d" */ + if (FrmResultAllocate(dateFmt, 30) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, "Stardate ", 9); + dateFmt->output += 9; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.year - RODDENBERRY, '0', 2); + dateFmt->output = _itoaw(dateFmt->output, + fractYear, '0', 3); + *dateFmt->output++ = '.'; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + + return TCL_OK; +} +static int +ClockFmtToken_WeekOfYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int dow = dateFmt->date.dayOfWeek; + if (*tok->tokWord.start == 'U') { + if (dow == 7) { + dow = 0; + } + dow++; + } + *val = ( dateFmt->date.dayOfYear - dow + 7 ) / 7; + return TCL_OK; +} +static int +ClockFmtToken_TimeZone_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + if (*tok->tokWord.start == 'z') { + int z = dateFmt->date.tzOffset; + char sign = '+'; + if ( z < 0 ) { + z = -z; + sign = '-'; + } + if (FrmResultAllocate(dateFmt, 7) != TCL_OK) { return TCL_ERROR; }; + *dateFmt->output++ = sign; + dateFmt->output = _itoaw(dateFmt->output, z / 3600, '0', 2); + z %= 3600; + dateFmt->output = _itoaw(dateFmt->output, z / 60, '0', 2); + z %= 60; + if (z != 0) { + dateFmt->output = _itoaw(dateFmt->output, z, '0', 2); + } + } else { + Tcl_Obj * objPtr; + const char *s; int len; + /* convert seconds to local seconds to obtain tzName object */ + if (ConvertUTCToLocal(opts->clientData, opts->interp, + &dateFmt->date, opts->timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + return TCL_ERROR; + }; + objPtr = dateFmt->date.tzName; + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERA_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if (dateFmt->date.era == BCE) { + mcObj = ClockMCGet(opts, MCLIT_BCE); + } else { + mcObj = ClockMCGet(opts, MCLIT_CE); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERAYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int rowc; + Tcl_Obj **rowv; + + if (dateFmt->localeEra == NULL) { + Tcl_Obj *mcObj = ClockMCGet(opts, MCLIT_LOCALE_ERAS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(opts->interp, mcObj, &rowc, &rowv) != TCL_OK) { + return TCL_ERROR; + } + if (rowc != 0) { + dateFmt->localeEra = LookupLastTransition(opts->interp, + dateFmt->date.localSeconds, rowc, rowv, NULL); + } + if (dateFmt->localeEra == NULL) { + dateFmt->localeEra = (Tcl_Obj*)1; + } + } + + /* if no LOCALE_ERAS in catalog or era not found */ + if (dateFmt->localeEra == (Tcl_Obj*)1) { + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + if (*tok->tokWord.start == 'C') { /* %EC */ + *val = dateFmt->date.year / 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } else { /* %Ey */ + *val = dateFmt->date.year % 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } + } else { + Tcl_Obj *objPtr; + const char *s; + int len; + if (*tok->tokWord.start == 'C') { /* %EC */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 1, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + } else { /* %Ey */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 2, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + if (Tcl_GetIntFromObj(opts->interp, objPtr, val) != TCL_OK) { + return TCL_ERROR; + } + *val = dateFmt->date.year - *val; + /* if year in locale numerals */ + if (*val >= 0 && *val < 100) { + /* year as integer */ + Tcl_Obj * mcObj = ClockMCGet(opts, MCLIT_LOCALE_NUMERALS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (Tcl_ListObjIndex(opts->interp, mcObj, *val, &objPtr) != TCL_OK) { + return TCL_ERROR; + } + } else { + /* year as integer */ + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + return TCL_OK; + } + } + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + + +static const char *FmtSTokenMapIndex = + "demNbByYCHMSIklpaAuwUVzgGjJsntQ"; +static ClockFormatTokenMap FmtSTokenMap[] = { + /* %d */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %e */ + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %m */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %N */ + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %b %h */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_ABBREV}, + /* %B */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_FULL}, + /* %y */ + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, + /* %Y */ + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, + /* %C */ + {CFMTT_INT, "0", 2, 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, + /* %H */ + {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %M */ + {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %S */ + {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %I */ + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %k */ + {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %l */ + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %p %P */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_AMPM_Proc, NULL}, + /* %a */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_ABBREV}, + /* %A */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_FULL}, + /* %u */ + {CFMTT_INT, " ", 1, 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %w */ + {CFMTT_INT, " ", 1, 0, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %U %W */ + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), + ClockFmtToken_WeekOfYear_Proc, NULL}, + /* %V */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, + /* %z %Z */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_TimeZone_Proc, NULL}, + /* %g */ + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %G */ + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %j */ + {CFMTT_INT, "0", 3, 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, + /* %J */ + {CFMTT_INT, "0", 7, 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, + /* %s */ + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + /* %n */ + {CTOKT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, + /* %t */ + {CTOKT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, + /* %Q */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_StarDate_Proc, NULL}, +}; +static const char *FmtSTokenMapAliasIndex[2] = { + "hPWZ", + "bpUz" +}; + +static const char *FmtETokenMapIndex = + "Eys"; +static ClockFormatTokenMap FmtETokenMap[] = { + /* %EE */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), + ClockFmtToken_LocaleERA_Proc, NULL}, + /* %Ey %EC */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleERAYear_Proc, NULL}, + /* %Es */ + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), NULL}, +}; +static const char *FmtETokenMapAliasIndex[2] = { + "C", + "y" +}; + +static const char *FmtOTokenMapIndex = + "dmyHIMSuw"; +static ClockFormatTokenMap FmtOTokenMap[] = { + /* %Od %Oe */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfMonth), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.year), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OI %Ol */ + {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ow */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, +}; +static const char *FmtOTokenMapAliasIndex[2] = { + "ekl", + "dHI" +}; + +static ClockFormatTokenMap FmtWordTokenMap = { + CTOKT_WORD, NULL, 0, 0, 0, 0, 0, NULL +}; + +/* + *---------------------------------------------------------------------- + */ +ClockFmtScnStorage * +ClockGetOrParseFmtFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockFormatToken *tok; + + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); + if (fss == NULL) { + return NULL; + } + + /* if first time scanning - tokenize format */ + if (fss->fmtTok == NULL) { + unsigned int tokCnt; + register const char *p, *e, *cp; + + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); + + /* estimate token count by % char and format length */ + fss->fmtTokC = EstimateTokenCount(p, e); + + Tcl_MutexLock(&ClockFmtMutex); + + fss->fmtTok = tok = ckalloc(sizeof(*tok) * fss->fmtTokC); + memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; + while (p < e) { + switch (*p) { + case '%': + if (1) { + ClockFormatTokenMap * fmtMap = FmtSTokenMap; + const char *mapIndex = FmtSTokenMapIndex, + **aliasIndex = FmtSTokenMapAliasIndex; + if (p+1 >= e) { + goto word_tok; + } + p++; + /* try to find modifier: */ + switch (*p) { + case '%': + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &FmtWordTokenMap; + tok->tokWord.start = p; + tok->tokWord.end = p+1; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; + p++; + continue; + break; + case 'E': + fmtMap = FmtETokenMap, + mapIndex = FmtETokenMapIndex, + aliasIndex = FmtETokenMapAliasIndex; + p++; + break; + case 'O': + fmtMap = FmtOTokenMap, + mapIndex = FmtOTokenMapIndex, + aliasIndex = FmtOTokenMapAliasIndex; + p++; + break; + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(aliasIndex[0], *p); + if (!cp || *cp == '\0') { + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + } + tok->map = &fmtMap[cp - mapIndex]; + tok->tokWord.start = p; + /* next token */ + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; + p++; + continue; + } + break; + default: +word_tok: + if (1) { + ClockFormatToken *wordTok = tok; + if (tok > fss->fmtTok && (tok-1)->map == &FmtWordTokenMap) { + wordTok = tok-1; + } + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &FmtWordTokenMap; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; + } + p = TclUtfNext(p); + wordTok->tokWord.end = p; + } + break; + } + } + + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->fmtTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->fmtTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->fmtTok = tok; + } + } + fss->fmtTokC = tokCnt; + +done: + Tcl_MutexUnlock(&ClockFmtMutex); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- + */ +int +ClockFormat( + register DateFormat *dateFmt, /* Date fields used for parsing & converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockFmtScnStorage *fss; + ClockFormatToken *tok; + ClockFormatTokenMap *map; + + /* get localized format */ + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + + if ( !(fss = ClockGetOrParseFmtFormat(opts->interp, opts->formatObj)) + || !(tok = fss->fmtTok) + ) { + return TCL_ERROR; + } + + /* prepare formatting */ + dateFmt->date.secondOfDay = (int)(dateFmt->date.localSeconds % SECONDS_PER_DAY); + if (dateFmt->date.secondOfDay < 0) { + dateFmt->date.secondOfDay += SECONDS_PER_DAY; + } + + /* result container object */ + dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); + if (dateFmt->resMem == NULL) { + return TCL_ERROR; + } + dateFmt->output = dateFmt->resMem; + dateFmt->resEnd = dateFmt->resMem + MIN_FMT_RESULT_BLOCK_ALLOC; + *dateFmt->output = '\0'; + + /* do format each token */ + for (; tok->map != NULL; tok++) { + map = tok->map; + switch (map->type) + { + case CFMTT_INT: + if (1) { + int val = (int)*(int *)(((char *)dateFmt) + map->offs); + if (map->fmtproc == NULL) { + if (map->flags & CLFMT_DECR) { + val--; + } + if (map->flags & CLFMT_INCR) { + val++; + } + if (map->divider) { + val /= map->divider; + } + if (map->divmod) { + val %= map->divmod; + } + } else { + if (map->fmtproc(opts, dateFmt, tok, &val) != TCL_OK) { + goto done; + } + /* if not calculate only (output inside fmtproc) */ + if (!(map->flags & CLFMT_CALC)) { + continue; + } + } + if (!(map->flags & CLFMT_LOCALE_INDX)) { + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { goto error; }; + if (map->width) { + dateFmt->output = _itoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } + } else { + const char *s; + Tcl_Obj * mcObj = ClockMCGet(opts, PTR2INT(map->data) /* mcKey */); + if (mcObj == NULL) { + goto error; + } + if ( Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK + || mcObj == NULL + ) { + goto error; + } + s = TclGetString(mcObj); + if (FrmResultAllocate(dateFmt, mcObj->length) != TCL_OK) { goto error; }; + memcpy(dateFmt->output, s, mcObj->length + 1); + dateFmt->output += mcObj->length; + } + } + break; + case CFMTT_WIDE: + if (1) { + Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); + if (FrmResultAllocate(dateFmt, 21) != TCL_OK) { goto error; }; + if (map->width) { + dateFmt->output = _witoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } + } + break; + case CTOKT_CHAR: + if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; + *dateFmt->output++ = *map->tostr; + break; + case CFMTT_PROC: + if (map->fmtproc(opts, dateFmt, tok, NULL) != TCL_OK) { + goto error; + }; + break; + case CTOKT_WORD: + if (1) { + int len = tok->tokWord.end - tok->tokWord.start; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { goto error; }; + if (len == 1) { + *dateFmt->output++ = *tok->tokWord.start; + } else { + memcpy(dateFmt->output, tok->tokWord.start, len); + dateFmt->output += len; + } + } + break; + } + } + + goto done; + +error: + + ckfree(dateFmt->resMem); + dateFmt->resMem = NULL; + +done: + + if (dateFmt->resMem) { + Tcl_Obj * result = Tcl_NewObj(); + result->length = dateFmt->output - dateFmt->resMem; + result->bytes = NULL; + result->bytes = ckrealloc(dateFmt->resMem, result->length+1); + if (result->bytes == NULL) { + result->bytes = dateFmt->resMem; + } + result->bytes[result->length] = '\0'; + Tcl_SetObjResult(opts->interp, result); + return TCL_OK; + } + + return TCL_ERROR; +} + + +MODULE_SCOPE void +ClockFrmScnClearCaches(void) +{ + Tcl_MutexLock(&ClockFmtMutex); + /* clear caches ... */ + Tcl_MutexUnlock(&ClockFmtMutex); +} + +static void +ClockFrmScnFinalize( + ClientData clientData) /* Not used. */ +{ + Tcl_MutexLock(&ClockFmtMutex); +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* clear GC */ + ClockFmtScnStorage_GC.stackPtr = NULL; + ClockFmtScnStorage_GC.stackBound = NULL; + ClockFmtScnStorage_GC.count = 0; +#endif + if (initialized) { + Tcl_DeleteHashTable(&FmtScnHashTable); + initialized = 0; + } + Tcl_MutexUnlock(&ClockFmtMutex); + Tcl_MutexFinalize(&ClockFmtMutex); +} +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclDate.h b/generic/tclDate.h new file mode 100644 index 0000000..e614f9d --- /dev/null +++ b/generic/tclDate.h @@ -0,0 +1,512 @@ +/* + * tclDate.h -- + * + * This header file handles common usage of clock primitives + * between tclDate.c (yacc), tclClock.c and tclClockFmt.c. + * + * Copyright (c) 2014 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLCLOCK_H +#define _TCLCLOCK_H + +/* + * Constants + */ + +#define JULIAN_DAY_POSIX_EPOCH 2440588 +#define GREGORIAN_CHANGE_DATE 2361222 +#define SECONDS_PER_DAY 86400 +#define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ + * SECONDS_PER_DAY) +#define FOUR_CENTURIES 146097 /* days */ +#define JDAY_1_JAN_1_CE_JULIAN 1721424 +#define JDAY_1_JAN_1_CE_GREGORIAN 1721426 +#define ONE_CENTURY_GREGORIAN 36524 /* days */ +#define FOUR_YEARS 1461 /* days */ +#define ONE_YEAR 365 /* days */ + +#define RODDENBERRY 1946 /* Another epoch (Hi, Jeff!) */ + + +#define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ +#define CLF_POSIXSEC (1 << 1) +#define CLF_LOCALSEC (1 << 2) +#define CLF_JULIANDAY (1 << 3) +#define CLF_TIME (1 << 4) +#define CLF_CENTURY (1 << 6) +#define CLF_DAYOFMONTH (1 << 7) +#define CLF_DAYOFYEAR (1 << 8) +#define CLF_MONTH (1 << 9) +#define CLF_YEAR (1 << 10) +#define CLF_ISO8601YEAR (1 << 12) +#define CLF_ISO8601 (1 << 13) +#define CLF_ISO8601CENTURY (1 << 14) +#define CLF_SIGNED (1 << 15) +/* On demand (lazy) assemble flags */ +#define CLF_ASSEMBLE_DATE (1 << 28) /* assemble year, month, etc. using julianDay */ +#define CLF_ASSEMBLE_JULIANDAY (1 << 29) /* assemble julianDay using year, month, etc. */ +#define CLF_ASSEMBLE_SECONDS (1 << 30) /* assemble localSeconds (and seconds at end) */ + +#define CLF_DATE (CLF_JULIANDAY | CLF_DAYOFMONTH | CLF_DAYOFYEAR | \ + CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | CLF_ISO8601) + +/* + * Enumeration of the string literals used in [clock] + */ + +typedef enum ClockLiteral { + LIT__NIL, + LIT__DEFAULT_FORMAT, + LIT_SYSTEM, LIT_CURRENT, LIT_C, + LIT_BCE, LIT_CE, + LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, + LIT_ERA, LIT_GMT, LIT_GREGORIAN, + LIT_INTEGER_VALUE_TOO_LARGE, + LIT_ISO8601WEEK, LIT_ISO8601YEAR, + LIT_JULIANDAY, LIT_LOCALSECONDS, + LIT_MONTH, + LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, + LIT_YEAR, + LIT_TZDATA, + LIT_GETSYSTEMTIMEZONE, + LIT_SETUPTIMEZONE, + LIT_MCGET, + LIT_GETSYSTEMLOCALE, LIT_GETCURRENTLOCALE, + LIT_LOCALIZE_FORMAT, + LIT__END +} ClockLiteral; + +#define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ + "", \ + "%a %b %d %H:%M:%S %Z %Y", \ + "system", "current", "C", \ + "BCE", "CE", \ + "dayOfMonth", "dayOfWeek", "dayOfYear", \ + "era", ":GMT", "gregorian", \ + "integer value too large to represent", \ + "iso8601Week", "iso8601Year", \ + "julianDay", "localSeconds", \ + "month", \ + "seconds", "tzName", "tzOffset", \ + "year", \ + "::tcl::clock::TZData", \ + "::tcl::clock::GetSystemTimeZone", \ + "::tcl::clock::SetupTimeZone", \ + "::tcl::clock::mcget", \ + "::tcl::clock::GetSystemLocale", "::tcl::clock::mclocale", \ + "::tcl::clock::LocalizeFormat" \ +} + +/* + * Enumeration of the msgcat literals used in [clock] + */ + +typedef enum ClockMsgCtLiteral { + MCLIT__NIL, /* placeholder */ + MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, + MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, + MCLIT_AM, MCLIT_PM, + MCLIT_LOCALE_ERAS, + MCLIT_BCE, MCLIT_CE, + MCLIT_BCE2, MCLIT_CE2, + MCLIT_BCE3, MCLIT_CE3, + MCLIT_LOCALE_NUMERALS, + MCLIT__END +} ClockMsgCtLiteral; + +#define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ + pref "", \ + pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ + pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", pref "DAYS_OF_WEEK_COMB", \ + pref "AM", pref "PM", \ + pref "LOCALE_ERAS", \ + pref "BCE", pref "CE", \ + pref "b.c.e.", pref "c.e.", \ + pref "b.c.", pref "a.d.", \ + pref "LOCALE_NUMERALS", \ +} + +/* + * Structure containing the fields used in [clock format] and [clock scan] + */ + +typedef struct TclDateFields { + + /* Cacheable fields: */ + + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix + * epoch */ + Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds + * from the Posix epoch */ + int tzOffset; /* Time zone offset in seconds east of + * Greenwich */ + int julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ + int hour; /* Hours of day (in-between time only calculation) */ + int minutes; /* Minutes of day (in-between time only calculation) */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ + + /* Non cacheable fields: */ + + Tcl_Obj *tzName; /* Name (or corresponding DST-abbreviation) of the + * time zone, if set the refCount is incremented */ +} TclDateFields; + +#define ClockCacheableDateFieldsSize \ + TclOffset(TclDateFields, tzName) + +/* + * Structure contains return parsed fields. + */ + +typedef struct DateInfo { + const char *dateStart; + const char *dateInput; + const char *dateEnd; + + TclDateFields date; + + int flags; + + int dateHaveDate; + + int dateMeridian; + int dateHaveTime; + + int dateTimezone; + int dateDSTmode; + int dateHaveZone; + + int dateRelMonth; + int dateRelDay; + int dateRelSeconds; + int dateHaveRel; + + int dateMonthOrdinalIncr; + int dateMonthOrdinal; + int dateHaveOrdinalMonth; + + int dateDayOrdinal; + int dateDayNumber; + int dateHaveDay; + + int *dateRelPointer; + + int dateSpaceCount; + int dateDigitCount; + + int dateCentury; + + Tcl_Obj* messages; /* Error messages */ + const char* separatrix; /* String separating messages */ +} DateInfo; + +#define yydate (info->date) /* Date fields used for converting */ + +#define yyDay (info->date.dayOfMonth) +#define yyMonth (info->date.month) +#define yyYear (info->date.year) + +#define yyHour (info->date.hour) +#define yyMinutes (info->date.minutes) +#define yySeconds (info->date.secondOfDay) + +#define yyDSTmode (info->dateDSTmode) +#define yyDayOrdinal (info->dateDayOrdinal) +#define yyDayNumber (info->dateDayNumber) +#define yyMonthOrdinalIncr (info->dateMonthOrdinalIncr) +#define yyMonthOrdinal (info->dateMonthOrdinal) +#define yyHaveDate (info->dateHaveDate) +#define yyHaveDay (info->dateHaveDay) +#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) +#define yyHaveRel (info->dateHaveRel) +#define yyHaveTime (info->dateHaveTime) +#define yyHaveZone (info->dateHaveZone) +#define yyTimezone (info->dateTimezone) +#define yyMeridian (info->dateMeridian) +#define yyRelMonth (info->dateRelMonth) +#define yyRelDay (info->dateRelDay) +#define yyRelSeconds (info->dateRelSeconds) +#define yyRelPointer (info->dateRelPointer) +#define yyInput (info->dateInput) +#define yyDigitCount (info->dateDigitCount) +#define yySpaceCount (info->dateSpaceCount) + +static inline void +ClockInitDateInfo(DateInfo *info) { + memset(info, 0, sizeof(DateInfo)); +} + +/* + * Structure containing the command arguments supplied to [clock format] and [clock scan] + */ + +#define CLF_EXTENDED (1 << 4) +#define CLF_STRICT (1 << 8) +#define CLF_LOCALE_USED (1 << 15) + +typedef struct ClockFmtScnCmdArgs { + ClientData clientData; /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp; /* Tcl interpreter */ + + Tcl_Obj *formatObj; /* Format */ + Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ + Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ + Tcl_Obj *baseObj; /* Base (scan and add) or clockValue (format) */ + int flags; /* Flags control scanning */ + + Tcl_Obj *mcDictObj; /* Current dictionary of tcl::clock package for given localeObj*/ +} ClockFmtScnCmdArgs; + +/* + * Structure containing the client data for [clock] + */ + +typedef struct ClockClientData { + size_t refCount; /* Number of live references. */ + Tcl_Obj **literals; /* Pool of object literals (common, locale independent). */ + Tcl_Obj **mcLiterals; /* Msgcat object literals with mc-keys for search with locale. */ + Tcl_Obj **mcLitIdxs; /* Msgcat object indices prefixed with _IDX_, + * used for quick dictionary search */ + + /* Cache for current clock parameters, imparted via "configure" */ + unsigned long LastTZEpoch; + int currentYearCentury; + int yearOfCenturySwitch; + Tcl_Obj *SystemTimeZone; + Tcl_Obj *SystemSetupTZData; + Tcl_Obj *GMTSetupTimeZone; + Tcl_Obj *GMTSetupTZData; + Tcl_Obj *AnySetupTimeZone; + Tcl_Obj *AnySetupTZData; + Tcl_Obj *LastUnnormSetupTimeZone; + Tcl_Obj *LastSetupTimeZone; + Tcl_Obj *LastSetupTZData; + + Tcl_Obj *CurrentLocale; + Tcl_Obj *CurrentLocaleDict; + Tcl_Obj *LastUnnormUsedLocale; + Tcl_Obj *LastUsedLocale; + Tcl_Obj *LastUsedLocaleDict; + + /* Cache for last base (last-second fast convert if base/tz not changed) */ + struct { + Tcl_Obj *timezoneObj; + TclDateFields Date; + } lastBase; + /* Las-period cache for fast UTC2Local conversion */ + struct { + /* keys */ + Tcl_Obj *timezoneObj; + int changeover; + Tcl_WideInt seconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ + /* values */ + int tzOffset; + Tcl_Obj *tzName; + } UTC2Local; + /* Las-period cache for fast Local2UTC conversion */ + struct { + /* keys */ + Tcl_Obj *timezoneObj; + int changeover; + Tcl_WideInt localSeconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ + /* values */ + int tzOffset; + } Local2UTC; +} ClockClientData; + +#define ClockDefaultYearCentury 2000 +#define ClockDefaultCenturySwitch 38 + +/* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + +/* + * Clock scan and format facilities. + */ + +#define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 + +#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 2 + +typedef struct ClockScanToken ClockScanToken; + + +typedef int ClockScanTokenProc( + ClockFmtScnCmdArgs *opts, + DateInfo *info, + ClockScanToken *tok); + + +typedef enum _CLCKTOK_TYPE { + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, CTOKT_CHAR, + CFMTT_INT, CFMTT_WIDE, CFMTT_PROC +} CLCKTOK_TYPE; + +typedef struct ClockScanTokenMap { + unsigned short int type; + unsigned short int flags; + unsigned short int clearFlags; + unsigned short int minSize; + unsigned short int maxSize; + unsigned short int offs; + ClockScanTokenProc *parser; + void *data; +} ClockScanTokenMap; + +typedef struct ClockScanToken { + ClockScanTokenMap *map; + struct { + const char *start; + const char *end; + } tokWord; + unsigned short int endDistance; + unsigned short int lookAhMin; + unsigned short int lookAhMax; + unsigned short int lookAhTok; +} ClockScanToken; + + +#define MIN_FMT_RESULT_BLOCK_ALLOC 200 + +typedef struct DateFormat { + char *resMem; + char *resEnd; + char *output; + + TclDateFields date; + + Tcl_Obj *localeEra; +} DateFormat; + +#define CLFMT_INCR (1 << 3) +#define CLFMT_DECR (1 << 4) +#define CLFMT_CALC (1 << 5) +#define CLFMT_LOCALE_INDX (1 << 8) + +typedef struct ClockFormatToken ClockFormatToken; + +typedef int ClockFormatTokenProc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val); + +typedef struct ClockFormatTokenMap { + unsigned short int type; + const char *tostr; + unsigned short int width; + unsigned short int flags; + unsigned short int divider; + unsigned short int divmod; + unsigned short int offs; + ClockFormatTokenProc *fmtproc; + void *data; +} ClockFormatTokenMap; +typedef struct ClockFormatToken { + ClockFormatTokenMap *map; + struct { + const char *start; + const char *end; + } tokWord; +} ClockFormatToken; + + +typedef struct ClockFmtScnStorage ClockFmtScnStorage; + +typedef struct ClockFmtScnStorage { + int objRefCount; /* Reference count shared across threads */ + ClockScanToken *scnTok; + unsigned int scnTokC; + unsigned int scnSpaceCount; /* Count of mandatory spaces used in format */ + ClockFormatToken *fmtTok; + unsigned int fmtTokC; +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + ClockFmtScnStorage *nextPtr; + ClockFmtScnStorage *prevPtr; +#endif +#if 0 + +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, + * stored by offset +sizeof(self) */ +#endif +} ClockFmtScnStorage; + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE int ToSeconds(int Hours, int Minutes, + int Seconds, MERIDIAN Meridian); +MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); +MODULE_SCOPE void + GetJulianDayFromEraYearWeekDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearMonthDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, + TclDateFields *, Tcl_Obj *timezoneObj, int); +MODULE_SCOPE Tcl_Obj * + LookupLastTransition(Tcl_Interp *, Tcl_WideInt, + int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); + +MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); + +/* tclClock.c module declarations */ + +MODULE_SCOPE Tcl_Obj * + ClockSetupTimeZone(ClientData clientData, + Tcl_Interp *interp, Tcl_Obj *timezoneObj); + +MODULE_SCOPE Tcl_Obj * + ClockMCDict(ClockFmtScnCmdArgs *opts); +MODULE_SCOPE Tcl_Obj * + ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE Tcl_Obj * + ClockMCGetIdx(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, + Tcl_Obj *valObj); + +/* tclClockFmt.c module declarations */ + +MODULE_SCOPE Tcl_Obj* + ClockFrmObjGetLocFmtKey(Tcl_Interp *interp, + Tcl_Obj *objPtr); + +MODULE_SCOPE ClockFmtScnStorage * + Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr); +MODULE_SCOPE Tcl_Obj * + ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); + +MODULE_SCOPE int ClockScan(register DateInfo *info, + Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); + +MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, + ClockFmtScnCmdArgs *opts); + +MODULE_SCOPE void ClockFrmScnClearCaches(void); + +#endif /* _TCLCLOCK_H */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c new file mode 100644 index 0000000..d9b5da0 --- /dev/null +++ b/generic/tclStrIdxTree.c @@ -0,0 +1,520 @@ +/* + * tclStrIdxTree.c -- + * + * Contains the routines for managing string index tries in Tcl. + * + * This code is back-ported from the tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2016 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * ----------------------------------------------------------------------- + * + * String index tries are prepaired structures used for fast greedy search of the string + * (index) by unique string prefix as key. + * + * Index tree build for two lists together can be explained in the following datagram + * + * Lists: + * + * {Januar Februar Maerz April Mai Juni Juli August September Oktober November Dezember} + * {Jnr Fbr Mrz Apr Mai Jni Jli Agt Spt Okt Nvb Dzb} + * + * Index-Tree: + * + * j -1 * ... + * anuar 0 * + * u -1 * a -1 + * ni 5 * pril 3 + * li 6 * ugust 7 + * n -1 * gt 7 + * r 0 * s 8 + * i 5 * eptember 8 + * li 6 * pt 8 + * f 1 * oktober 9 + * ebruar 1 * n 10 + * br 1 * ovember 10 + * m -1 * vb 10 + * a -1 * d 11 + * erz 2 * ezember 11 + * i 4 * zb 11 + * rz 2 * + * ... + * + * Thereby value -1 shows pure group items (corresponding ambigous matches). + * + * StrIdxTree's are very fast, so: + * build of above-mentioned tree takes about 10 microseconds. + * search of string index in this tree takes fewer as 0.1 microseconds. + * + */ + +#include "tclInt.h" +#include "tclStrIdxTree.h" + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeSearch -- + * + * Find largest part of string "start" in indexed tree (case sensitive). + * + * Also used for building of string index tree. + * + * Results: + * Return position of UTF character in start after last equal character + * and found item (with parent). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE const char* +TclStrIdxTreeSearch( + TclStrIdxTree **foundParent, /* Return value of found sub tree (used for tree build) */ + TclStrIdx **foundItem, /* Return value of found item */ + TclStrIdxTree *tree, /* Index tree will be browsed */ + const char *start, /* UTF string to find in tree */ + const char *end) /* End of string */ +{ + TclStrIdxTree *parent = tree, *prevParent = tree; + TclStrIdx *item = tree->firstPtr, *prevItem = NULL; + const char *s = start, *f, *cin, *cinf, *prevf; + int offs = 0; + + if (item == NULL) { + goto done; + } + + /* search in tree */ + do { + cinf = cin = TclGetString(item->key) + offs; + f = TclUtfFindEqualNCInLwr(s, end, cin, cin + item->length, &cinf); + /* if something was found */ + if (f > s) { + /* if whole string was found */ + if (f >= end) { + start = f; + goto done; + }; + /* set new offset and shift start string */ + offs += cinf - cin; + s = f; + /* if match item, go deeper as long as possible */ + if (offs >= item->length && item->childTree.firstPtr) { + /* save previuosly found item (if not ambigous) for + * possible fallback (few greedy match) */ + if (item->value != -1) { + prevf = f; + prevItem = item; + prevParent = parent; + } + parent = &item->childTree; + item = item->childTree.firstPtr; + continue; + } + /* no children - return this item and current chars found */ + start = f; + goto done; + } + + item = item->nextPtr; + + } while (item != NULL); + + /* fallback (few greedy match) not ambigous (has a value) */ + if (prevItem != NULL) { + item = prevItem; + parent = prevParent; + start = prevf; + } + +done: + + if (foundParent) + *foundParent = parent; + if (foundItem) + *foundItem = item; + return start; +} + +MODULE_SCOPE void +TclStrIdxTreeFree( + TclStrIdx *tree) +{ + while (tree != NULL) { + TclStrIdx *t; + Tcl_DecrRefCount(tree->key); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreeFree(tree->childTree.firstPtr); + } + t = tree, tree = tree->nextPtr; + ckfree(t); + } +} + +/* + * Several bidirectional list primitives + */ +inline void +TclStrIdxTreeInsertBranch( + TclStrIdxTree *parent, + register TclStrIdx *item, + register TclStrIdx *child) +{ + if (parent->firstPtr == child) + parent->firstPtr = item; + if (parent->lastPtr == child) + parent->lastPtr = item; + if ( (item->nextPtr = child->nextPtr) ) { + item->nextPtr->prevPtr = item; + child->nextPtr = NULL; + } + if ( (item->prevPtr = child->prevPtr) ) { + item->prevPtr->nextPtr = item; + child->prevPtr = NULL; + } + item->childTree.firstPtr = child; + item->childTree.lastPtr = child; +} + +inline void +TclStrIdxTreeAppend( + register TclStrIdxTree *parent, + register TclStrIdx *item) +{ + if (parent->lastPtr != NULL) { + parent->lastPtr->nextPtr = item; + } + item->prevPtr = parent->lastPtr; + item->nextPtr = NULL; + parent->lastPtr = item; + if (parent->firstPtr == NULL) { + parent->firstPtr = item; + } +} + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeBuildFromList -- + * + * Build or extend string indexed tree from tcl list. + * + * Important: by multiple lists, optimal tree can be created only if list with + * larger strings used firstly. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE int +TclStrIdxTreeBuildFromList( + TclStrIdxTree *idxTree, + int lstc, + Tcl_Obj **lstv) +{ + Tcl_Obj **lwrv; + int i, ret = TCL_ERROR; + const char *s, *e, *f; + TclStrIdx *item; + + /* create lowercase reflection of the list keys */ + + lwrv = ckalloc(sizeof(Tcl_Obj*) * lstc); + if (lwrv == NULL) { + return TCL_ERROR; + } + for (i = 0; i < lstc; i++) { + lwrv[i] = Tcl_DuplicateObj(lstv[i]); + if (lwrv[i] == NULL) { + return TCL_ERROR; + } + Tcl_IncrRefCount(lwrv[i]); + lwrv[i]->length = Tcl_UtfToLower(TclGetString(lwrv[i])); + } + + /* build index tree of the list keys */ + for (i = 0; i < lstc; i++) { + TclStrIdxTree *foundParent = idxTree; + e = s = TclGetString(lwrv[i]); + e += lwrv[i]->length; + + /* ignore empty values (impossible to index it) */ + if (lwrv[i]->length == 0) continue; + + item = NULL; + if (idxTree->firstPtr != NULL) { + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(&foundParent, &foundItem, + idxTree, s, e); + /* if common prefix was found */ + if (f > s) { + /* ignore element if fulfilled or ambigous */ + if (f == e) { + continue; + } + /* if shortest key was found with the same value, + * just replace its current key with longest key */ + if ( foundItem->value == i + && foundItem->length < lwrv[i]->length + && foundItem->childTree.firstPtr == NULL + ) { + Tcl_SetObjRef(foundItem->key, lwrv[i]); + foundItem->length = lwrv[i]->length; + continue; + } + /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) + * but don't split by fulfilled child of found item ( ii->iii->iiii ) */ + if (foundItem->length != (f - s)) { + /* first split found item (insert one between parent and found + new one) */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + Tcl_InitObjRef(item->key, foundItem->key); + item->length = f - s; + /* set value or mark as ambigous if not the same value of both */ + item->value = (foundItem->value == i) ? i : -1; + /* insert group item between foundParent and foundItem */ + TclStrIdxTreeInsertBranch(foundParent, item, foundItem); + foundParent = &item->childTree; + } else { + /* the new item should be added as child of found item */ + foundParent = &foundItem->childTree; + } + } + } + /* append item at end of found parent */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + item->childTree.lastPtr = item->childTree.firstPtr = NULL; + Tcl_InitObjRef(item->key, lwrv[i]); + item->length = lwrv[i]->length; + item->value = i; + TclStrIdxTreeAppend(foundParent, item); + }; + + ret = TCL_OK; + +done: + + if (lwrv != NULL) { + for (i = 0; i < lstc; i++) { + Tcl_DecrRefCount(lwrv[i]); + } + ckfree(lwrv); + } + + if (ret != TCL_OK) { + if (idxTree->firstPtr != NULL) { + TclStrIdxTreeFree(idxTree->firstPtr); + } + } + + return ret; +} + + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr); +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr); + +Tcl_ObjType StrIdxTreeObjType = { + "str-idx-tree", /* name */ + StrIdxTreeObj_FreeIntRepProc, /* freeIntRepProc */ + StrIdxTreeObj_DupIntRepProc, /* dupIntRepProc */ + StrIdxTreeObj_UpdateStringProc, /* updateStringProc */ + NULL /* setFromAnyProc */ +}; + +MODULE_SCOPE Tcl_Obj* +TclStrIdxTreeNewObj() +{ + Tcl_Obj *objPtr = Tcl_NewObj(); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + objPtr->typePtr = &StrIdxTreeObjType; + /* return tree root in internal representation */ + return objPtr; +} + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) +{ + /* follow links (smart pointers) */ + if ( srcPtr->internalRep.twoPtrValue.ptr1 != NULL + && srcPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; + } + /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ + Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), + srcPtr); + copyPtr->internalRep.twoPtrValue.ptr2 = NULL; + copyPtr->typePtr = &StrIdxTreeObjType; +} + +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr) +{ + /* follow links (smart pointers) */ + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + /* is a link */ + Tcl_UnsetObjRef(*((Tcl_Obj **)&objPtr->internalRep.twoPtrValue.ptr1)); + } else { + /* is a tree */ + TclStrIdxTree *tree = (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; + if (tree->firstPtr != NULL) { + TclStrIdxTreeFree(tree->firstPtr); + } + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + } + objPtr->typePtr = NULL; +}; + +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr) +{ + /* currently only dummy empty string possible */ + objPtr->length = 0; + objPtr->bytes = &tclEmptyString; +}; + +MODULE_SCOPE TclStrIdxTree * +TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { + /* follow links (smart pointers) */ + if (objPtr->typePtr != &StrIdxTreeObjType) { + return NULL; + } + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + objPtr = (Tcl_Obj*)objPtr->internalRep.twoPtrValue.ptr1; + } + /* return tree root in internal representation */ + return (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; +} + +/* + * Several debug primitives + */ +#if 0 +/* currently unused, debug resp. test purposes only */ + +void +TclStrIdxTreePrint( + Tcl_Interp *interp, + TclStrIdx *tree, + int offs) +{ + Tcl_Obj *obj[2]; + const char *s; + Tcl_InitObjRef(obj[0], Tcl_NewStringObj("::puts", -1)); + while (tree != NULL) { + s = TclGetString(tree->key) + offs; + Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", + offs, "", tree->length - offs, s, tree->value)); + Tcl_PutsObjCmd(NULL, interp, 2, obj); + Tcl_UnsetObjRef(obj[1]); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreePrint(interp, tree->childTree.firstPtr, tree->length); + } + tree = tree->nextPtr; + } + Tcl_UnsetObjRef(obj[0]); +} + + +MODULE_SCOPE int +TclStrIdxTreeTestObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + const char *cs, *cin, *ret; + + static const char *const options[] = { + "index", "puts-index", "findequal", + NULL + }; + enum optionInd { + O_INDEX, O_PUTS_INDEX, O_FINDEQUAL + }; + int optionIndex; + + if (objc < 2) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(interp, objv[1], options, + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[1]), NULL); + return TCL_ERROR; + } + switch (optionIndex) { + case O_FINDEQUAL: + if (objc < 4) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + cs = TclGetString(objv[2]); + cin = TclGetString(objv[3]); + ret = TclUtfFindEqual( + cs, cs + objv[1]->length, cin, cin + objv[2]->length); + Tcl_SetObjResult(interp, Tcl_NewIntObj(ret - cs)); + break; + case O_INDEX: + case O_PUTS_INDEX: + + if (1) { + Tcl_Obj **lstv; + int i, lstc; + TclStrIdxTree idxTree = {NULL, NULL}; + i = 1; + while (++i < objc) { + if (TclListObjGetElements(interp, objv[i], + &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + }; + TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv); + } + if (optionIndex == O_PUTS_INDEX) { + TclStrIdxTreePrint(interp, idxTree.firstPtr, 0); + } + TclStrIdxTreeFree(idxTree.firstPtr); + } + break; + } + + return TCL_OK; +} + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h new file mode 100644 index 0000000..305053c --- /dev/null +++ b/generic/tclStrIdxTree.h @@ -0,0 +1,169 @@ +/* + * tclStrIdxTree.h -- + * + * Declarations of string index tries and other primitives currently + * back-ported from tclSE. + * + * Copyright (c) 2016 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLSTRIDXTREE_H +#define _TCLSTRIDXTREE_H + + +/* + * Main structures declarations of index tree and entry + */ + +typedef struct TclStrIdxTree { + struct TclStrIdx *firstPtr; + struct TclStrIdx *lastPtr; +} TclStrIdxTree; + +typedef struct TclStrIdx { + struct TclStrIdxTree childTree; + struct TclStrIdx *nextPtr; + struct TclStrIdx *prevPtr; + Tcl_Obj *key; + int length; + int value; +} TclStrIdx; + + +/* + *---------------------------------------------------------------------- + * + * TclUtfFindEqual, TclUtfFindEqualNC -- + * + * Find largest part of string cs in string cin (case sensitive and not). + * + * Results: + * Return position of UTF character in cs after last equal character. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static inline const char * +TclUtfFindEqual( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine) /* End of cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) break; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +static inline const char * +TclUtfFindEqualNC( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + ch2 = Tcl_UniCharToLower(ch2); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +static inline const char * +TclUtfFindEqualNCInLwr( + register const char *cs, /* UTF string (in anycase) to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string (in lowercase) will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +static inline const char * +TclUtfNext( + register const char *src) /* The current location in the string. */ +{ + if (((unsigned char) *(src)) < 0xC0) { + return ++src; + } else { + Tcl_UniChar ch; + return src + TclUtfToUniChar(src, &ch); + } +} + + +/* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE const char* + TclStrIdxTreeSearch(TclStrIdxTree **foundParent, + TclStrIdx **foundItem, TclStrIdxTree *tree, + const char *start, const char *end); + +MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, + int lstc, Tcl_Obj **lstv); + +MODULE_SCOPE Tcl_Obj* + TclStrIdxTreeNewObj(); + +MODULE_SCOPE TclStrIdxTree* + TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr); + +#if 1 + +MODULE_SCOPE int TclStrIdxTreeTestObjCmd(ClientData, Tcl_Interp *, + int, Tcl_Obj *const objv[]); +#endif + +#endif /* _TCLSTRIDXTREE_H */ diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl new file mode 100644 index 0000000..733db1a --- /dev/null +++ b/tests-perf/clock.perf.tcl @@ -0,0 +1,385 @@ +#!/usr/bin/tclsh +# ------------------------------------------------------------------------ +# +# test-performance.tcl -- +# +# This file provides common performance tests for comparison of tcl-speed +# degradation by switching between branches. +# (currently for clock ensemble only) +# +# ------------------------------------------------------------------------ +# +# Copyright (c) 2014 Serg G. Brester (aka sebres) +# +# See the file "license.terms" for information on usage and redistribution +# of this file. +# + + +## set testing defaults: +set ::env(TCL_TZ) :CET + +# warm-up interpeter compiler env, clock platform-related features, +# calibrate timerate measurement functionality: +puts -nonewline "Calibration ... "; flush stdout +puts "done: [lrange \ + [timerate -calibrate {}] \ +0 1]" + +## warm-up test-related features (load clock.tcl, system zones, locales, etc.): +clock scan "" -gmt 1 +clock scan "" +clock scan "" -timezone :CET +clock scan "" -format "" -locale en +clock scan "" -format "" -locale de + +## ------------------------------------------ + +proc {**STOP**} {args} { + return -code error -level 4 "**STOP** in [info level [expr {[info level]-2}]] [join $args { }]" +} + +proc _test_get_commands {lst} { + regsub -all {(?:^|\n)[ \t]*(\#[^\n]*|\msetup\M[^\n]*|\mcleanup\M[^\n]*)(?=\n\s*(?:[\{\#]|setup|cleanup))} $lst "\n{\\1}" +} + +proc _test_out_total {} { + upvar _ _ + + set tcnt [llength $_(itm)] + if {!$tcnt} { + puts "" + return + } + + set mintm 0x7fffffff + set maxtm 0 + set nett 0 + set wtm 0 + set wcnt 0 + set i 0 + foreach tm $_(itm) { + if {[llength $tm] > 6} { + set nett [expr {$nett + [lindex $tm 6]}] + } + set wtm [expr {$wtm + [lindex $tm 0]}] + set wcnt [expr {$wcnt + [lindex $tm 2]}] + set tm [lindex $tm 0] + if {$tm > $maxtm} {set maxtm $tm; set maxi $i} + if {$tm < $mintm} {set mintm $tm; set mini $i} + incr i + } + + puts [string repeat ** 40] + set s [format "%d cases in %.2f sec." $tcnt [expr {$tcnt * $_(reptime) / 1000.0}]] + if {$nett > 0} { + append s [format " (%.2f nett-sec.)" [expr {$nett / 1000.0}]] + } + puts "Total $s:" + lset _(m) 0 [format %.6f $wtm] + lset _(m) 2 $wcnt + lset _(m) 4 [format %.3f [expr {$wcnt / (($nett ? $nett : ($tcnt * $_(reptime))) / 1000.0)}]] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f $nett] + } + puts $_(m) + puts "Average:" + lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / $tcnt}]] + lset _(m) 2 [expr {[lindex $_(m) 2] / $tcnt}] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f [expr {[lindex $_(m) 6] / $tcnt}]] + lset _(m) 4 [format %.0f [expr {[lindex $_(m) 2] / [lindex $_(m) 6] * 1000}]] + } + puts $_(m) + puts "Min:" + puts [lindex $_(itm) $mini] + puts "Max:" + puts [lindex $_(itm) $maxi] + puts [string repeat ** 40] + puts "" +} + +proc _test_run {reptime lst {outcmd {puts $_(r)}}} { + upvar _ _ + array set _ [list itm {} reptime $reptime] + + foreach _(c) [_test_get_commands $lst] { + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {^\s*\#} $_(c)]} continue + if {[regexp {^\s*(?:setup|cleanup)\s+} $_(c)]} { + puts [if 1 [lindex $_(c) 1]] + continue + } + set _(r) [if 1 $_(c)] + if {$outcmd ne {}} $outcmd + puts [set _(m) [timerate $_(c) $reptime]] + lappend _(itm) $_(m) + puts "" + } + _test_out_total +} + +proc test-format {{reptime 1000}} { + _test_run $reptime { + # Format : short, week only (in gmt) + {clock format 1482525936 -format "%u" -gmt 1} + # Format : short, week only (system zone) + {clock format 1482525936 -format "%u"} + # Format : short, week only (CEST) + {clock format 1482525936 -format "%u" -timezone :CET} + # Format : date only (in gmt) + {clock format 1482525936 -format "%Y-%m-%d" -gmt 1} + # Format : date only (system zone) + {clock format 1482525936 -format "%Y-%m-%d"} + # Format : date only (CEST) + {clock format 1482525936 -format "%Y-%m-%d" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M:%S" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M:%S"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M:%S" -timezone :CET} + # Format : default (in gmt) + {clock format 1482525936 -gmt 1 -locale en} + # Format : default (system zone) + {clock format 1482525936 -locale en} + # Format : default (CEST) + {clock format 1482525936 -timezone :CET -locale en} + # Format : ISO date-time (in gmt, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1} + # Format : ISO date-time (system zone, CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z"} + # Format : ISO date-time (CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -timezone :CET} + # Format : ISO date-time (system zone, CEST) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %Z"} + # Format : julian day with time (in gmt): + {clock format 1246379415 -format "%J %H:%M:%S" -gmt 1} + # Format : julian day with time (system zone): + {clock format 1246379415 -format "%J %H:%M:%S"} + + # Format : locale date-time (en): + {clock format 1246379415 -format "%x %X" -locale en} + # Format : locale date-time (de): + {clock format 1246379415 -format "%x %X" -locale de} + + # Format : locale lookup table month: + {clock format 1246379400 -format "%b" -locale en -gmt 1} + # Format : locale lookup 2 tables - month and day: + {clock format 1246379400 -format "%b %Od" -locale en -gmt 1} + # Format : locale lookup 3 tables - week, month and day: + {clock format 1246379400 -format "%a %b %Od" -locale en -gmt 1} + # Format : locale lookup 4 tables - week, month, day and year: + {clock format 1246379400 -format "%a %b %Od %Oy" -locale en -gmt 1} + + # Format : dynamic clock value (without converter caches): + setup {set i 0} + {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} + # Format : dynamic clock value (without any converter caches, zone range overflow): + setup {set i 0} + {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} + + # Format : dynamic format (cacheable) + {clock format 1246379415 -format [string trim "%d.%m.%Y %H:%M:%S "] -gmt 1} + + # Format : all (in gmt, locale en) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -gmt 1 -locale en} + # Format : all (in CET, locale de) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -timezone :CET -locale de} + } +} + +proc test-scan {{reptime 1000}} { + _test_run $reptime { + # Scan : date (in gmt) + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + # Scan : date (system time zone, with base) + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0} + # Scan : date (system time zone, without base) + {clock scan "25.11.2015" -format "%d.%m.%Y"} + # Scan : greedy match + {clock scan "111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "11111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111111" -format "%d%m%y" -base 0 -gmt 1} + # Scan : greedy match (space separated) + {clock scan "1 1 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 11" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "11 11 11" -format "%d%m%y" -base 0 -gmt 1} + + # Scan : time (in gmt) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000 -gmt 1} + # Scan : time (system time zone, with base) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000} + # Scan : time (gmt, without base) + {clock scan "10:35:55" -format "%H:%M:%S" -gmt 1} + # Scan : time (system time zone, without base) + {clock scan "10:35:55" -format "%H:%M:%S"} + + # Scan : date-time (in gmt) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0 -gmt 1} + # Scan : date-time (system time zone with base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0} + # Scan : date-time (system time zone without base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S"} + + # Scan : julian day in gmt + {clock scan 2451545 -format %J -gmt 1} + # Scan : julian day in system TZ + {clock scan 2451545 -format %J} + # Scan : julian day in other TZ + {clock scan 2451545 -format %J -timezone +0200} + # Scan : julian day with time: + {clock scan "2451545 10:20:30" -format "%J %H:%M:%S"} + # Scan : julian day with time (greedy match): + {clock scan "2451545 102030" -format "%J%H%M%S"} + + # Scan : century, lookup table month + {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} + # Scan : century, lookup table month and day (both entries are first) + {clock scan {1970 Jan 01} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) + {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} + + # Scan : ISO date-time (CEST) + {clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 CEST" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : ISO date-time (UTC) + {clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 UTC" -format "%Y-%m-%dT%H:%M:%S %z"} + + # Scan : locale date-time (en): + {clock scan "06/30/2009 18:30:15" -format "%x %X" -gmt 1 -locale en} + # Scan : locale date-time (de): + {clock scan "30.06.2009 18:30:15" -format "%x %X" -gmt 1 -locale de} + + # Scan : dynamic format (cacheable) + {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + + break + # # Scan : long format test (allock chain) + # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} + # # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): + # {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # # Scan : again: + # {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + } {puts [clock format $_(r) -locale en]} +} + +proc test-freescan {{reptime 1000}} { + _test_run $reptime { + # FreeScan : relative date + {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} + # FreeScan : relative date with relative weekday + {clock scan "5 years 18 months 385 days Fri" -base 0 -gmt 1} + # FreeScan : relative date with ordinal month + {clock scan "5 years 18 months 385 days next 1 January" -base 0 -gmt 1} + # FreeScan : relative date with ordinal month and relative weekday + {clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1} + # FreeScan : ordinal month + {clock scan "next January" -base 0 -gmt 1} + # FreeScan : relative week + {clock scan "next Fri" -base 0 -gmt 1} + # FreeScan : relative weekday and week offset + {clock scan "next January + 2 week" -base 0 -gmt 1} + # FreeScan : time only with base + {clock scan "19:18:30" -base 148863600 -gmt 1} + # FreeScan : time only without base, gmt + {clock scan "19:18:30" -gmt 1} + # FreeScan : time only without base, system + {clock scan "19:18:30"} + # FreeScan : date, system time zone + {clock scan "05/08/2016 20:18:30"} + # FreeScan : date, supplied time zone + {clock scan "05/08/2016 20:18:30" -timezone :CET} + # FreeScan : date, supplied gmt (equivalent -timezone :GMT) + {clock scan "05/08/2016 20:18:30" -gmt 1} + # FreeScan : date, supplied time zone gmt + {clock scan "05/08/2016 20:18:30" -timezone :GMT} + # FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500) + {clock scan "20:18:30 -0500" -base 148863600 -gmt 1} + # FreeScan : time only, zone in string (exchange zones between system / gmt) + {clock scan "19:18:30 GMT" -base 148863600} + # FreeScan : fast switch of zones in cycle - GMT, MST, CET (system) and EST + {clock scan "19:18:30 MST" -base 148863600 -gmt 1 + clock scan "19:18:30 EST" -base 148863600 + } + } {puts [clock format $_(r) -locale en]} +} + +proc test-add {{reptime 1000}} { + _test_run $reptime { + # Add : years + {clock add 1246379415 5 years -gmt 1} + # Add : months + {clock add 1246379415 18 months -gmt 1} + # Add : weeks + {clock add 1246379415 20 weeks -gmt 1} + # Add : days + {clock add 1246379415 385 days -gmt 1} + # Add : weekdays + {clock add 1246379415 3 weekdays -gmt 1} + + # Add : hours + {clock add 1246379415 5 hours -gmt 1} + # Add : minutes + {clock add 1246379415 55 minutes -gmt 1} + # Add : seconds + {clock add 1246379415 100 seconds -gmt 1} + + # Add : +/- in gmt + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -gmt 1} + # Add : +/- in system timezone + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -timezone :CET} + + # Add : gmt + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -gmt 1} + # Add : system timezone + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -timezone :CET} + + # Add : all in gmt + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -gmt 1} + # Add : all in system timezone + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -timezone :CET} + + } {puts [clock format $_(r) -locale en]} +} + +proc test-other {{reptime 1000}} { + _test_run $reptime { + # Bad zone + {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + + # Scan : julian day (overflow) + {catch {clock scan 5373485 -format %J}} + + # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} + # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 50; time { clock scan "[incr i -1] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} + } +} + +proc test {{reptime 1000}} { + puts "" + test-format $reptime + test-scan $reptime + test-freescan $reptime + test-add $reptime + test-other $reptime + + puts \n**OK** +} + +test 500; # ms -- cgit v0.12 From f9abf9b060c15ad2d4b00f99f7814a388875c642 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 09:46:43 +0000 Subject: man for timerate (doc/timerate.n) --- doc/timerate.n | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 doc/timerate.n diff --git a/doc/timerate.n b/doc/timerate.n new file mode 100644 index 0000000..df9a8f7 --- /dev/null +++ b/doc/timerate.n @@ -0,0 +1,114 @@ +'\" +'\" Copyright (c) 2005 Sergey Brester aka sebres. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.TH timerate n "" Tcl "Tcl Built-In Commands" +.so man.macros +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +timerate \- Time-related execution resp. performance measurement of a script +.SH SYNOPSIS +\fBtimerate \fIscript\fR \fI?time?\fR +.sp +\fBtimerate \fI?-direct?\fR \fI?-overhead double?\fR \fIscript\fR \fI?time?\fR +.sp +\fBtimerate \fI?-calibrate?\fR \fI?-direct?\fR \fIscript\fR \fI?time?\fR +.BE +.SH DESCRIPTION +.PP +The first and second form will evaluate \fIscript\fR until the interval +\fItime\fR given in milliseconds elapses, or for 1000 milliseconds (1 second) +if \fItime\fR is not specified. +.sp +It will then return a canonical tcl-list of the form +.PP +.CS +\f0.095977 µs/# 52095836 # 10419167 #/sec 5000.000 nett-ms\fR +.CE +.PP +which indicates: +.IP \(bu +the average amount of time required per iteration, in microseconds (lindex $result 0) +.IP \(bu +the count how many times it was executed (lindex $result 2) +.IP \(bu +the estimated rate per second (lindex $result 4) +.IP \(bu +the estimated real execution time without measurement overhead (lindex $result 6) +.PP +Time is measured in elapsed time using heighest timer resolution as possible, not CPU time. +This command may be used to provide information as to how well the script or a tcl-command +is performing and can help determine bottlenecks and fine-tune application performance. +.PP +\fI-calibrate\fR +. +To measure very fast scripts as exact as posible the calibration process +may be required. + +This parameter used to calibrate \fBtimerate\fR calculating the estimated overhead +of given \fIscript\fR as default overhead for further execution of \fBtimerate\fR. +It can take up to 10 seconds if parameter \fItime\fR is not specified. +.PP +\fI-overhead double\fR +. +This parameter used to supply the measurement overhead of single iteration +(in microseconds) that should be ignored during whole evaluation process. +.PP +\fI-direct\fR +. +Causes direct execution per iteration (not compiled variant of evaluation used). +.PP +In opposition to \fBtime\fR the execution limited here by fixed time instead of +repetition count. +Additionally the compiled variant of the script will be used during whole evaluation +(as if it were part of a compiled \fBproc\fR), if parameter \fI-direct\fR is not specified. +Therefore it provides more precise results and prevents very long execution time +by slow scripts resp. scripts with unknown speed. + +.SH EXAMPLE +Estimate how fast it takes for a simple Tcl \fBfor\fR loop (including +operations on variable \fIi\fR) to count to a ten: +.PP +.CS +# calibrate: +timerate -calibrate {} +# measure: +timerate { for {set i 0} {$i<10} {incr i} {} } 5000 +.CE +.PP +Estimate how fast it takes for a simple Tcl \fBfor\fR loop only (ignoring the +overhead for operations on variable \fIi\fR) to count to a ten: +.PP +.CS +# calibrate for overhead of variable operations: +set i 0; timerate -calibrate {expr {$i<10}; incr i} 1000 +# measure: +timerate { for {set i 0} {$i<10} {incr i} {} } 5000 +.CE +.PP +Estimate the rate of calculating the hour using \fBclock format\fR only, ignoring +overhead of the rest, without measurement how fast it takes for a whole script: +.PP +.CS +# calibrate: +timerate -calibrate {} +# estimate overhead: +set tm 0 +set ovh [lindex [timerate { incr tm [expr {24*60*60}] }] 0] +# measure using esimated overhead: +set tm 0 +timerate -overhead $ovh { + clock format $tm -format %H + incr tm [expr {24*60*60}]; # overhead for this is ignored +} 5000 +.CE +.SH "SEE ALSO" +time(n) +.SH KEYWORDS +script, timerate, time +.\" Local Variables: +.\" mode: nroff +.\" End: -- cgit v0.12 From 0cdf2fd457ccaaa079eb8da08b23c1367f092d53 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 12:25:59 +0000 Subject: performance test cases extended: several cases to cover absence of the ensemble overhead --- tests-perf/clock.perf.tcl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 733db1a..238e536 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -371,8 +371,34 @@ proc test-other {{reptime 1000}} { } } +proc test-ensemble-perf {{reptime 1000}} { + _test_run $reptime { + # Clock clicks (ensemble) + {clock clicks} + # Clock clicks (direct) + {::tcl::clock::clicks} + # Clock seconds (ensemble) + {clock seconds} + # Clock seconds (direct) + {::tcl::clock::seconds} + # Clock microseconds (ensemble) + {clock microseconds} + # Clock microseconds (direct) + {::tcl::clock::microseconds} + # Clock scan (ensemble) + {clock scan ""} + # Clock scan (direct) + {::tcl::clock::scan ""} + # Clock format (ensemble) + {clock format 0 -f %s} + # Clock format (direct) + {::tcl::clock::format 0 -f %s} + } +} + proc test {{reptime 1000}} { puts "" + test-ensemble-perf [expr {$reptime / 2}]; #fast enough test-format $reptime test-scan $reptime test-freescan $reptime -- cgit v0.12 From 1ea7d20306277fe9aab8d0f70fa57d214eb48ddb Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 12:32:47 +0000 Subject: auto-loading of ensemble and stubs on demand only (+ test covered now, see clock-0.1); introduces new possibility to implement namespace-based auto-loading, e. g.: set ::auto_index_ns(::some::namespace) [list ::source [::file join $dir some namespace.tcl]]] loading of clock-stubs (clock.tcl) implemented via handler "auto_index_ns" now. --- library/init.tcl | 73 ++++++++++++++++++++++++++++++++++---------------------- tests/clock.test | 21 ++++++++++++++++ 2 files changed, 65 insertions(+), 29 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index 824f66f..d2c3b6e 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -156,6 +156,17 @@ if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} { if {[interp issafe]} { package unknown {::tcl::tm::UnknownHandler ::tclPkgUnknown} } else { + # Default known auto_index (avoid loading auto index implicit after interp create): + + array set ::auto_index { + ::tcl::tm::UnknownHandler {source [info library]/tm.tcl} + ::tclPkgUnknown {source [info library]/package.tcl} + ::history {source [info library]/history.tcl} + } + + # The newest possibility to load whole namespace: + array set ::auto_index_ns {} + # Set up search for Tcl Modules (TIP #189). # and setup platform specific unknown package handlers if {$tcl_platform(os) eq "Darwin" @@ -168,28 +179,19 @@ if {[interp issafe]} { # Set up the 'clock' ensemble - namespace eval ::tcl::clock [list variable TclLibDir $::tcl_library] - proc clock args { set cmdmap [dict create] foreach cmd {add clicks format microseconds milliseconds scan seconds configure} { dict set cmdmap $cmd ::tcl::clock::$cmd } - namespace eval ::tcl::clock [list namespace ensemble create -command \ - [uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \ + namespace inscope ::tcl::clock [list namespace ensemble create -command \ + [uplevel 1 [list ::namespace origin [::lindex [info level 0] 0]]] \ -map $cmdmap -compile 1] - # Auto-loading stubs for 'clock.tcl' - foreach cmd {mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { - proc ::tcl::clock::$cmd args { - variable TclLibDir - source -encoding utf-8 [file join $TclLibDir clock.tcl] - return [uplevel 1 [info level 0]] - } - } - - return [uplevel 1 [info level 0]] + uplevel 1 [info level 0] } + # Auto-loading stubs for 'clock.tcl' + set ::auto_index_ns(::tcl::clock) {::namespace inscope ::tcl::clock {::source [::file join [info library] clock.tcl]}} } # Conditionalize for presence of exec. @@ -417,18 +419,22 @@ proc unknown args { # for instance. If not given, namespace current is used. proc auto_load {cmd {namespace {}}} { - global auto_index auto_path + global auto_index auto_index_ns auto_path + # qualify names: if {$namespace eq ""} { set namespace [uplevel 1 [list ::namespace current]] } set nameList [auto_qualify $cmd $namespace] # workaround non canonical auto_index entries that might be around # from older auto_mkindex versions - lappend nameList $cmd - foreach name $nameList { + if {$cmd ni $nameList} {lappend nameList $cmd} + + # try to load (and create sub-cmd handler "_sub_load_cmd" for further usage): + foreach name $nameList [set _sub_load_cmd { + # via auto_index: if {[info exists auto_index($name)]} { - namespace eval :: $auto_index($name) + namespace inscope :: $auto_index($name) # There's a couple of ways to look for a command of a given # name. One is to use # info commands $name @@ -440,22 +446,31 @@ proc auto_load {cmd {namespace {}}} { return 1 } } - } + # via auto_index_ns - resolver for the whole namespace loaders + if {[set ns [::namespace qualifiers $name]] ni {"" "::"} && + [info exists auto_index_ns($ns)] + } { + # remove handler before loading (prevents several self-recursion cases): + set ldr $auto_index_ns($ns); unset auto_index_ns($ns) + namespace inscope :: $ldr + # if got it: + if {[namespace which -command $name] ne ""} { + return 1 + } + } + }] + + # load auto_index if possible: if {![info exists auto_path]} { return 0 } - if {![auto_load_index]} { return 0 } - foreach name $nameList { - if {[info exists auto_index($name)]} { - namespace eval :: $auto_index($name) - if {[namespace which -command $name] ne ""} { - return 1 - } - } - } + + # try again (something new could be loaded): + foreach name $nameList $_sub_load_cmd + return 0 } @@ -605,7 +620,7 @@ proc auto_import {pattern} { foreach name [array names auto_index $pattern] { if {([namespace which -command $name] eq "") && ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} { - namespace eval :: $auto_index($name) + namespace inscope :: $auto_index($name) } } } diff --git a/tests/clock.test b/tests/clock.test index 0737558..af517c8 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35,6 +35,9 @@ testConstraint y2038 \ # TEST PLAN +# clock-0: +# several base test-cases +# # clock-1: # [clock format] - tests of bad and empty arguments # @@ -251,6 +254,24 @@ proc ::testClock::registry { cmd path key } { return [dict get $reg $path $key] } +# Base test cases: + +test clock-0.1 "initial: auto-loading of ensemble and stubs on demand" { + set i [interp create]; # because clock can be used somewhere, test it in new interp: + + set ret [$i eval { + + lappend ret ens:[namespace ensemble exists ::clock] + clock seconds; # init ensemble (but not yet stubs, loading of clock.tcl retarded) + lappend ret ens:[namespace ensemble exists ::clock] + lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] + clock format -now; # clock.tcl stubs expected + lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] + }] + interp delete $i + set ret +} {ens:0 ens:1 stubs:0 stubs:1} + # Test some of the basics of [clock format] test clock-1.0 "clock format - wrong # args" { -- cgit v0.12 From 95d531e781ad6869e929820b306df7206c3f67b8 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 15:07:32 +0000 Subject: prevents loss of key object if the format object (where key stored) becomes changed (loses its internal representation during evals); should avoid possible theoretical segfault there. --- generic/tclClockFmt.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index d875bd4..18b82fa 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -634,7 +634,7 @@ ClockFmtObj_UpdateString(objPtr) * * This is normally stored in second pointer of internal representation. * If format object is not localizable, it is equal the given format - * pointer and the first pointer of internal representation may be NULL. + * pointer (special case to fast fallback by not-localizable formats). * * Results: * Returns tcl object with key or format object if not localizable. @@ -825,16 +825,20 @@ ClockLocalizeFormat( return opts->formatObj; } + /* prevents loss of key object if the format object (where key stored) + * becomes changed (loses its internal representation during evals) */ + Tcl_IncrRefCount(keyObj); + if (opts->mcDictObj == NULL) { ClockMCDict(opts); if (opts->mcDictObj == NULL) - return NULL; + goto done; } /* try to find in cache within locale mc-catalog */ if (Tcl_DictObjGet(NULL, opts->mcDictObj, keyObj, &valObj) != TCL_OK) { - return NULL; + goto done; } /* call LocalizeFormat locale format fmtkey */ @@ -844,10 +848,9 @@ ClockLocalizeFormat( callargs[1] = opts->localeObj; callargs[2] = opts->formatObj; callargs[3] = keyObj; - Tcl_IncrRefCount(keyObj); if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK ) { - goto clean; + goto done; } valObj = Tcl_GetObjResult(opts->interp); @@ -857,9 +860,11 @@ ClockLocalizeFormat( keyObj, valObj) != TCL_OK ) { valObj = NULL; - goto clean; + goto done; } + Tcl_ResetResult(opts->interp); + /* check special case - format object is not localizable */ if (valObj == opts->formatObj) { /* mark it as unlocalizable, by setting self as key (without refcount incr) */ @@ -868,14 +873,11 @@ ClockLocalizeFormat( ObjLocFmtKey(opts->formatObj) = opts->formatObj; } } -clean: - - Tcl_UnsetObjRef(keyObj); - if (valObj) { - Tcl_ResetResult(opts->interp); - } } +done: + + Tcl_UnsetObjRef(keyObj); return (opts->formatObj = valObj); } -- cgit v0.12 From ea1ae51d2d146dc75fd8132f6a7d9b9a24c3cb03 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 15:07:41 +0000 Subject: [clock] tclStrIdxTree extended with possibility to hold client data; also changed in clock - indices starts with 1 instead of 0, and 0(NULL) instead of -1 used as sign of ambiguous keys. --- generic/tclClockFmt.c | 14 +++++++----- generic/tclStrIdxTree.c | 59 +++++++++++++++++++++++++++---------------------- generic/tclStrIdxTree.h | 8 +++---- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 18b82fa..70b3ad7 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1174,7 +1174,7 @@ ClockMCGetListIdxTree( goto done; }; - if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv, NULL) != TCL_OK) { goto done; } @@ -1249,7 +1249,7 @@ ClockMCGetMultiListIdxTree( goto done; }; - if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv, NULL) != TCL_OK) { goto done; } mcKeys++; @@ -1301,12 +1301,12 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, /* not found */ return TCL_RETURN; } - if (foundItem->value == -1) { + if (!foundItem->value) { /* ambigous */ return TCL_RETURN; } - *val = foundItem->value; + *val = PTR2INT(foundItem->value); /* shift input pointer */ yyInput = f; @@ -1406,7 +1406,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, return ret; } - yyMonth = val + 1; + yyMonth = val; return TCL_OK; } @@ -1445,6 +1445,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if (ret != TCL_OK) { return ret; } + --val; } if (val != -1) { @@ -1476,6 +1477,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if (ret != TCL_OK) { return ret; } + --val; if (val == 0) { val = 7; @@ -1578,7 +1580,7 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, } if (tok->map->offs > 0) { - *(int *)(((char *)info) + tok->map->offs) = val; + *(int *)(((char *)info) + tok->map->offs) = --val; } return TCL_OK; diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index d9b5da0..291e481 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -24,26 +24,28 @@ * * Index-Tree: * - * j -1 * ... - * anuar 0 * - * u -1 * a -1 - * ni 5 * pril 3 - * li 6 * ugust 7 - * n -1 * gt 7 - * r 0 * s 8 - * i 5 * eptember 8 - * li 6 * pt 8 - * f 1 * oktober 9 - * ebruar 1 * n 10 - * br 1 * ovember 10 - * m -1 * vb 10 - * a -1 * d 11 - * erz 2 * ezember 11 - * i 4 * zb 11 - * rz 2 * + * j 0 * ... + * anuar 1 * + * u 0 * a 0 + * ni 6 * pril 4 + * li 7 * ugust 8 + * n 0 * gt 8 + * r 1 * s 9 + * i 6 * eptember 9 + * li 7 * pt 9 + * f 2 * oktober 10 + * ebruar 2 * n 11 + * br 2 * ovember 11 + * m 0 * vb 11 + * a 0 * d 12 + * erz 3 * ezember 12 + * i 5 * zb 12 + * rz 3 * * ... * - * Thereby value -1 shows pure group items (corresponding ambigous matches). + * Thereby value 0 shows pure group items (corresponding ambigous matches). + * But the group may have a value if it contains only same values + * (see for example group "f" above). * * StrIdxTree's are very fast, so: * build of above-mentioned tree takes about 10 microseconds. @@ -109,7 +111,7 @@ TclStrIdxTreeSearch( if (offs >= item->length && item->childTree.firstPtr) { /* save previuosly found item (if not ambigous) for * possible fallback (few greedy match) */ - if (item->value != -1) { + if (item->value != NULL) { prevf = f; prevItem = item; prevParent = parent; @@ -206,7 +208,9 @@ TclStrIdxTreeAppend( * TclStrIdxTreeBuildFromList -- * * Build or extend string indexed tree from tcl list. - * + * If the values not given the values of built list are indices starts with 1. + * Value of 0 is thereby reserved to the ambigous values. + * * Important: by multiple lists, optimal tree can be created only if list with * larger strings used firstly. * @@ -223,10 +227,12 @@ MODULE_SCOPE int TclStrIdxTreeBuildFromList( TclStrIdxTree *idxTree, int lstc, - Tcl_Obj **lstv) + Tcl_Obj **lstv, + ClientData *values) { Tcl_Obj **lwrv; int i, ret = TCL_ERROR; + ClientData val; const char *s, *e, *f; TclStrIdx *item; @@ -250,8 +256,9 @@ TclStrIdxTreeBuildFromList( TclStrIdxTree *foundParent = idxTree; e = s = TclGetString(lwrv[i]); e += lwrv[i]->length; + val = values ? values[i] : INT2PTR(i+1); - /* ignore empty values (impossible to index it) */ + /* ignore empty keys (impossible to index it) */ if (lwrv[i]->length == 0) continue; item = NULL; @@ -267,7 +274,7 @@ TclStrIdxTreeBuildFromList( } /* if shortest key was found with the same value, * just replace its current key with longest key */ - if ( foundItem->value == i + if ( foundItem->value == val && foundItem->length < lwrv[i]->length && foundItem->childTree.firstPtr == NULL ) { @@ -286,7 +293,7 @@ TclStrIdxTreeBuildFromList( Tcl_InitObjRef(item->key, foundItem->key); item->length = f - s; /* set value or mark as ambigous if not the same value of both */ - item->value = (foundItem->value == i) ? i : -1; + item->value = (foundItem->value == val) ? val : NULL; /* insert group item between foundParent and foundItem */ TclStrIdxTreeInsertBranch(foundParent, item, foundItem); foundParent = &item->childTree; @@ -304,7 +311,7 @@ TclStrIdxTreeBuildFromList( item->childTree.lastPtr = item->childTree.firstPtr = NULL; Tcl_InitObjRef(item->key, lwrv[i]); item->length = lwrv[i]->length; - item->value = i; + item->value = val; TclStrIdxTreeAppend(foundParent, item); }; @@ -496,7 +503,7 @@ TclStrIdxTreeTestObjCmd( &lstc, &lstv) != TCL_OK) { return TCL_ERROR; }; - TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv); + TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv, NULL); } if (optionIndex == O_PUTS_INDEX) { TclStrIdxTreePrint(interp, idxTree.firstPtr, 0); diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index 305053c..9f26907 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -27,9 +27,9 @@ typedef struct TclStrIdx { struct TclStrIdxTree childTree; struct TclStrIdx *nextPtr; struct TclStrIdx *prevPtr; - Tcl_Obj *key; - int length; - int value; + Tcl_Obj *key; + int length; + ClientData value; } TclStrIdx; @@ -152,7 +152,7 @@ MODULE_SCOPE const char* const char *start, const char *end); MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, - int lstc, Tcl_Obj **lstv); + int lstc, Tcl_Obj **lstv, ClientData *values); MODULE_SCOPE Tcl_Obj* TclStrIdxTreeNewObj(); -- cgit v0.12 From 39a388f0350df40cc42cb9f09c2d1be32327ac93 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 16:56:56 +0000 Subject: update documentation doc/clock.n: small enhancements and relevant changes of new engine. --- doc/clock.n | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/doc/clock.n b/doc/clock.n index 889a5da..38b408d 100644 --- a/doc/clock.n +++ b/doc/clock.n @@ -87,6 +87,15 @@ slowing its clock by a tiny fraction for some minutes until it is back in sync with UTC; its data model does not represent minutes that have 59 or 61 seconds. .TP +\fI\-now\fR +Instead of \fItimeVal\fR a non-integer option \fI\-now\fR can be used as +replacement for today, which is simply interpolated to the runt-time as value +of \fBclock seconds\fR. For example: +.sp +\fBclock format -now -f %a; # current day of the week\fR +.sp +\fBclock add -now 1 month; # next month\fR +.TP \fIunit\fR One of the words, \fBseconds\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR, or @@ -528,6 +537,12 @@ abbreviation appropriate to the current locale, and uses it to fix whether \fB%Y\fR refers to years before or after Year 1 of the Common Era. .TP +\fB%Es\fR +This affects similar to \fB%s\fR, but in opposition to \fB%s\fR it parses +or formats local seconds (not the posix seconds). +Because \fB%s\fR has the same precedence as \fB%s\fR (uniquely determines +a point in time), it overrides all other input formats. +.TP \fB%Ex\fR On output, produces a locale-dependent representation of the date in the locale's alternative calendar. On input, matches @@ -722,13 +737,15 @@ week number \fB%V\fR; programs should use \fB%G\fR for that purpose. On output, produces the current time zone, expressed in hours and minutes east (+hhmm) or west (\-hhmm) of Greenwich. On input, accepts a time zone specifier (see \fBTIME ZONES\fR below) that will be used to -determine the time zone. +determine the time zone (this token is optionally applicable on input, +so the value is not mandatory and can be missing in input). .TP \fB%Z\fR On output, produces the current time zone's name, possibly translated to the given locale. On input, accepts a time zone specifier (see \fBTIME ZONES\fR below) that will be used to determine the -time zone. This option should, in general, be used on input only when +time zone (token is also like \fB%z\fR optionally applicable on input). +This option should, in general, be used on input only when parsing RFC822 dates. Other uses are fraught with ambiguity; for instance, the string \fBBST\fR may represent British Summer Time or Brazilian Standard Time. It is recommended that date/time strings for @@ -927,6 +944,24 @@ used. Finally, a correction is applied so that the correct hour of the day is produced after allowing for daylight savings time differences and the correct date is given when going from the end of a long month to a short month. +.PP +The precedence of the applying of single tokens resp. which sequence will be +used by calculating of the time is complex, e. g. heavily dependent on the +precision of type of the token. +.sp +In example below the second date-string contains "next January", therefore +it results in next year but in January. And third date-string besides "January" +contains also additionally "Fri", so it results in the nearest Friday. +Thus both win before "385 days" resp. make it more precise, because of higher +precision of this token types. +.CS +% clock format [clock scan "5 years 18 months 385 days" -base 0 -gmt 1] -gmt 1 +Thu Jul 21 00:00:00 GMT 1977 +% clock format [clock scan "5 years 18 months 385 days next January" -base 0 -gmt 1] -gmt 1 +Sat Jan 21 00:00:00 GMT 1978 +% clock format [clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1] -gmt 1 +Fri Jan 27 00:00:00 GMT 1978 +.CE .SH "SEE ALSO" msgcat(n) .SH KEYWORDS -- cgit v0.12 From 0ec19f6b1194fb374ddf9865375671b07033d9e1 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 21:53:38 +0000 Subject: fixes lost indentation during back-porting --- generic/tclClock.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a066f73..17c19c3 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -150,7 +150,7 @@ struct ClockCommand { const char *name; /* The tail of the command name. The full name * is "::tcl::clock::". When NULL marks * the end of the table. */ - Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This + Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This * will always have the ClockClientData sent * to it, but may well ignore this data. */ CompileProc *compileProc; /* The compiler for the command. */ @@ -2004,7 +2004,7 @@ ConvertUTCToLocal( if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, dataPtr->UTC2Local.rangesVal) != TCL_OK) { return TCL_ERROR; - } + } } /* Cache the last conversion */ @@ -2576,9 +2576,9 @@ GetJulianDayFromEraYearMonthDay( * See above bug for details. The casts are necessary. */ if (ym1 >= 0) - ym1o4 = ym1 / 4; + ym1o4 = ym1 / 4; else { - ym1o4 = - (int) (((unsigned int) -ym1) / 4); + ym1o4 = - (int) (((unsigned int) -ym1) / 4); } #endif if (ym1 % 4 < 0) { @@ -2992,12 +2992,12 @@ ClockInitFmtScnArgs( static int ClockParseFmtScnArgs( register - ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ - TclDateFields *date, /* Extracted date-time corresponding base - * (by scan or add) resp. clockval (by format) */ + ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ + TclDateFields *date, /* Extracted date-time corresponding base + * (by scan or add) resp. clockval (by format) */ int objc, /* Parameter count */ - Tcl_Obj *const objv[], /* Parameter vector */ - int flags /* Flags, differentiates between format, scan, add */ + Tcl_Obj *const objv[], /* Parameter vector */ + int flags /* Flags, differentiates between format, scan, add */ ) { Tcl_Interp *interp = opts->interp; ClockClientData *dataPtr = opts->clientData; @@ -3031,7 +3031,7 @@ ClockParseFmtScnArgs( Tcl_WideInt num; if (TclGetWideIntFromObj(NULL, objv[i], &num) == TCL_OK) { continue; - } + } } /* get option */ if (Tcl_GetIndexFromObj(interp, objv[i], options, @@ -3067,10 +3067,10 @@ ClockParseFmtScnArgs( case CLC_ARGS_BASE: if ( !(flags & (CLC_SCN_ARGS)) ) { goto badOptionMsg; - } + } opts->baseObj = objv[i+1]; break; - } + } saw |= (1 << optionIndex); } @@ -3130,10 +3130,10 @@ ClockParseFmtScnArgs( i = 1; goto badOption; } - /* + /* * seconds could be an unsigned number that overflowed. Make sure * that it isn't. - */ + */ if (opts->baseObj->typePtr == &tclBignumType) { Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); @@ -4042,14 +4042,14 @@ ClockSecondsObjCmd( static unsigned long TzsetGetEpoch(void) { - static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by - * clockMutex. */ + static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by + * clockMutex. */ static long tzLastRefresh = 0; /* Used for latency before next refresh */ static unsigned long tzWasEpoch = 0; /* Epoch, signals that TZ changed */ static unsigned long tzEnvEpoch = 0; /* Last env epoch, for faster signaling, that TZ changed via TCL */ - const char *tzIsNow; /* Current value of TZ */ + const char *tzIsNow; /* Current value of TZ */ /* * Prevent performance regression on some platforms by resolving of system time zone: @@ -4068,7 +4068,7 @@ TzsetGetEpoch(void) Tcl_MutexLock(&clockMutex); tzIsNow = getenv("TCL_TZ"); if (tzIsNow == NULL) { - tzIsNow = getenv("TZ"); + tzIsNow = getenv("TZ"); } if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1) || strcmp(tzIsNow, tzWas) != 0)) { -- cgit v0.12 From 0adb50f88bf8f3e5220dce66339ccc62c6139d28 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 12 May 2017 07:45:15 +0000 Subject: restored "-encoding utf-8" by source clock.tcl (lost by merging) --- library/init.tcl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/init.tcl b/library/init.tcl index d2c3b6e..de69730 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -191,7 +191,9 @@ if {[interp issafe]} { uplevel 1 [info level 0] } # Auto-loading stubs for 'clock.tcl' - set ::auto_index_ns(::tcl::clock) {::namespace inscope ::tcl::clock {::source [::file join [info library] clock.tcl]}} + set ::auto_index_ns(::tcl::clock) {::namespace inscope ::tcl::clock { + ::source -encoding utf-8 [::file join [info library] clock.tcl] + }} } # Conditionalize for presence of exec. -- cgit v0.12 From 5d20272000e4f0b9ad2d2e16c4835debcac832dd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 12 May 2017 14:31:17 +0000 Subject: Don't test Tcl_GetDefaultEncodingDir() any more (which is obsolete), test Tcl_GetEncodingSearchPath() in stead. --- tests/encoding.test | 14 +++++++------- tests/unixInit.test | 17 +++++++++++------ unix/tclUnixTest.c | 45 ++++++++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/tests/encoding.test b/tests/encoding.test index 4dddbb5..d9ba072 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -35,7 +35,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] testConstraint exec [llength [info commands exec]] -testConstraint testgetdefenc [llength [info commands testgetdefenc]] +testConstraint testgetencpath [llength [info commands testgetencpath]] # TclInitEncodingSubsystem is tested by the rest of this file # TclFinalizeEncodingSubsystem is not currently tested @@ -570,15 +570,15 @@ foreach from {cp932 shiftjis euc-jp iso2022-jp} { } } -test encoding-26.0 {Tcl_GetDefaultEncodingDir} -constraints { - testgetdefenc +test encoding-26.0 {Tcl_GetEncodingSearchPath} -constraints { + testgetencpath } -setup { - set origDir [testgetdefenc] - testsetdefenc slappy + set origPath [testgetencpath] + testsetencpath slappy } -body { - testgetdefenc + testgetencpath } -cleanup { - testsetdefenc $origDir + testsetencpath $origPath } -result slappy file delete {*}[glob -directory [temporaryDirectory] *.chars *.tcltestout] diff --git a/tests/unixInit.test b/tests/unixInit.test index 05338ed..0469ee8 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -15,6 +15,9 @@ namespace import ::tcltest::* unset -nocomplain path catch {set oldlang $env(LANG)} set env(LANG) C + +# Some tests require the testgetencpath command +testConstraint testgetencpath [llength [info commands testgetencpath]] test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unix stdio} { set x {} @@ -87,13 +90,15 @@ test unixInit-1.2 {initialisation: standard channel type deduction} {unix stdio} skip [concat [skip] unixInit-2.*] -test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} { - set origDir [testgetdefenc] - testsetdefenc slappy - set path [testgetdefenc] - testsetdefenc $origDir +test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} -constraints { + testgetencpath +} -body { + set origPath [testgetencpath] + testsetencpath slappy + set path [testgetencpath] + testsetencpath $origPath set path -} {slappy} +} -result {slappy} test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} -setup { unset -nocomplain oldlibrary if {[info exists env(TCL_LIBRARY)]} { diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index 86e0925..ceb64d9 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -68,10 +68,10 @@ static Tcl_CmdProc TestfilehandlerCmd; static Tcl_CmdProc TestfilewaitCmd; static Tcl_CmdProc TestfindexecutableCmd; static Tcl_ObjCmdProc TestforkObjCmd; -static Tcl_CmdProc TestgetdefencdirCmd; +static Tcl_ObjCmdProc TestgetencpathObjCmd; static Tcl_CmdProc TestgetopenfileCmd; static Tcl_CmdProc TestgotsigCmd; -static Tcl_CmdProc TestsetdefencdirCmd; +static Tcl_ObjCmdProc TestsetencpathObjCmd; static Tcl_FileProc TestFileHandlerProc; static void AlarmHandler(int signum); @@ -108,9 +108,9 @@ TclplatformtestInit( NULL, NULL); Tcl_CreateCommand(interp, "testgetopenfile", TestgetopenfileCmd, NULL, NULL); - Tcl_CreateCommand(interp, "testgetdefenc", TestgetdefencdirCmd, + Tcl_CreateObjCommand(interp, "testgetencpath", TestgetencpathObjCmd, NULL, NULL); - Tcl_CreateCommand(interp, "testsetdefenc", TestsetdefencdirCmd, + Tcl_CreateObjCommand(interp, "testsetencpath", TestsetencpathObjCmd, NULL, NULL); Tcl_CreateCommand(interp, "testalarm", TestalarmCmd, NULL, NULL); @@ -499,9 +499,9 @@ TestgetopenfileCmd( /* *---------------------------------------------------------------------- * - * TestsetdefencdirCmd -- + * TestsetencpathCmd -- * - * This function implements the "testsetdefenc" command. It is used to + * This function implements the "testsetencpath" command. It is used to * test Tcl_SetDefaultEncodingDir(). * * Results: @@ -514,19 +514,18 @@ TestgetopenfileCmd( */ static int -TestsetdefencdirCmd( +TestsetencpathObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const *objv) /* Argument strings. */ { - if (argc != 2) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " defaultDir\"", NULL); + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "defaultDir"); return TCL_ERROR; } - Tcl_SetDefaultEncodingDir(argv[1]); + Tcl_SetEncodingSearchPath(objv[1]); return TCL_OK; } @@ -552,7 +551,7 @@ TestforkObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *const *objv) /* Argument strings. */ + Tcl_Obj *const *objv) /* Argument strings. */ { pid_t pid; @@ -578,10 +577,10 @@ TestforkObjCmd( /* *---------------------------------------------------------------------- * - * TestgetdefencdirCmd -- + * TestgetencpathObjCmd -- * - * This function implements the "testgetdefenc" command. It is used to - * test Tcl_GetDefaultEncodingDir(). + * This function implements the "testgetencpath" command. It is used to + * test Tcl_GetEncodingSearchPath(). * * Results: * A standard Tcl result. @@ -593,18 +592,18 @@ TestforkObjCmd( */ static int -TestgetdefencdirCmd( +TestgetencpathObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const *objv) /* Argument strings. */ { - if (argc != 1) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], NULL); + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } - Tcl_AppendResult(interp, Tcl_GetDefaultEncodingDir(), NULL); + Tcl_SetObjResult(interp, Tcl_GetEncodingSearchPath()); return TCL_OK; } -- cgit v0.12 From dcc8bd9aa801c05f114644fe9f6d520b03b3f812 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 12 May 2017 19:58:01 +0000 Subject: Fixed stardate format: be sure positive after decimal point (note: clock-value can be negative - modulo operation in C has the same sign as dividend) --- generic/tclClockFmt.c | 12 +++++++----- tests/clock.test | 51 ++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 70b3ad7..d3cb339 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -2489,13 +2489,13 @@ ClockFmtToken_StarDate_Proc( { int fractYear; /* Get day of year, zero based */ - int doy = dateFmt->date.dayOfYear - 1; + int v = dateFmt->date.dayOfYear - 1; /* Convert day of year to a fractional year */ if (IsGregorianLeapYear(&dateFmt->date)) { - fractYear = 1000 * doy / 366; + fractYear = 1000 * v / 366; } else { - fractYear = 1000 * doy / 365; + fractYear = 1000 * v / 365; } /* Put together the StarDate as "Stardate %02d%03d.%1d" */ @@ -2507,8 +2507,10 @@ ClockFmtToken_StarDate_Proc( dateFmt->output = _itoaw(dateFmt->output, fractYear, '0', 3); *dateFmt->output++ = '.'; - dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + /* be sure positive after decimal point (note: clock-value can be negative) */ + v = dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ); + if (v < 0) v = 10 + v; + dateFmt->output = _itoaw(dateFmt->output, v, '0', 1); return TCL_OK; } diff --git a/tests/clock.test b/tests/clock.test index af517c8..5f9a3ec 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18647,10 +18647,42 @@ test clock-6.20 {special char tokens %n, %t} { } 1246386600 # Hi, Jeff! +proc _testStarDates {s {days {366*2}} {step {86400}}} { + set step [expr {int($step * 86400)}] + # reconvert - arrange in order of stardate: + set s [set i [clock scan [clock format $s -f "%Q" -g 1] -g 1]] + # test: + set wrong {} + while {$i < $s + $days*86400} { + set d [clock format $i -f "%Q" -g 1] + if {![regexp {^Stardate \d+\.\d$} $d]} { + lappend wrong "wrong: $d -- ($i) -- [clock format $i -g 1]" + } + if {[catch { + set i2 [clock scan $d -f "%Q" -g 1] + } msg]} { + lappend wrong "$d -- ($i) -- [clock format $i -g 1]: $msg" + } + if {$i != $i2} { + lappend wrong "$d -- ($i != $i2) -- [clock format $i -g 1]" + } + incr i $step + } + join $wrong \n +} test clock-6.21.0 {Stardate 0 day} { list [set d [clock format -757382400 -format "%Q" -gmt 1]] \ [clock scan $d -format "%Q" -gmt 1] } [list "Stardate 00000.0" -757382400] +test clock-6.21.0.1 {Stardate 0.1 - 1.9 (test negative clock value -> positive Stardate)} { + _testStarDates -757382400 2 0.1 +} {} +test clock-6.21.0.2 {Stardate 10000.1 - 10002.9 (test negative clock value -> positive Stardate)} { + _testStarDates [clock scan "Stardate 10000.1" -f %Q -g 1] 3 0.1 +} {} +test clock-6.21.0.2 {Stardate 80000.1 - 80002.9 (test positive clock value)} { + _testStarDates [clock scan "Stardate 80001.1" -f %Q -g 1] 3 0.1 +} {} test clock-6.21.1 {Stardate} { list [set d [clock format 1482857280 -format "%Q" -gmt 1]] \ [clock scan $d -format "%Q" -gmt 1] @@ -18659,21 +18691,10 @@ test clock-6.21.2 {Stardate next time} { list [set d [clock format 1482865920 -format "%Q" -gmt 1]] \ [clock scan $d -format "%Q" -gmt 1] } [list "Stardate 70986.8" 1482865920] -test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and end of the year)} -body { - set s [clock scan "01.01.2016" -f "%d.%m.%Y" -g 1] - set s [set i [clock scan [clock format $s -f "%Q" -g 1] -g 1]] - set wrong {} - while {[incr i 86400] < $s + 86400*366*2} { - set d [clock format $i -f "%Q" -g 1] - set i2 [clock scan $d -f "%Q" -g 1] - if {$i != $i2} { - lappend wrong "$d -- ($i != $i2) -- [clock format $i -g 1]" - } - } - join $wrong \n -} -result {} -cleanup { - unset -nocomplain wrong i i2 s d -} +test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and end of the year)} { + _testStarDates [clock scan "01.01.2016" -f "%d.%m.%Y" -g 1] [expr {366*2}] 1 +} {} +rename _testStarDates {} test clock-6.22.1 {Greedy match} { clock format [clock scan "111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 -- cgit v0.12 From 02d6d68a6834591e799e305cf937b13b205f8b59 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 16 May 2017 08:51:51 +0000 Subject: resolved warnings compiled with gcc, removed unused "MsgCtLitIdxs" (was moved to tclClock.c) --- generic/tclClockFmt.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index d3cb339..d923ede 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -34,9 +34,6 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); static void ClockFrmScnFinalize(ClientData clientData); -/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ -CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); - /* * Clock scan and format facilities. */ @@ -1906,7 +1903,7 @@ EstimateTokenCount( #define AllocTokenInChain(tok, chain, tokCnt) \ if (++(tok) >= (chain) + (tokCnt)) { \ - *((char **)&chain) = ckrealloc((char *)(chain), \ + chain = ckrealloc((char *)(chain), \ (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ if ((chain) == NULL) { goto done; }; \ (tok) = (chain) + (tokCnt); \ -- cgit v0.12 From c3077bd013037c9dd95e23e2ed2e69e332287ba9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 16 May 2017 09:16:43 +0000 Subject: optimized special case "-now" of base (by scan or add) or clock value (by format): bypass integer recognition if it looks like option "-now" --- generic/tclClock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 17c19c3..80740c8 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3110,14 +3110,19 @@ ClockParseFmtScnArgs( /* Base (by scan or add) or clock value (by format) */ if (opts->baseObj != NULL) { - if (TclGetWideIntFromObj(NULL, opts->baseObj, &baseVal) != TCL_OK) { + register Tcl_Obj *baseObj = opts->baseObj; + /* bypass integer recognition if looks like option "-now" */ + if ( + (baseObj->length == 4 && baseObj->bytes && *(baseObj->bytes+1) == 'n') || + TclGetWideIntFromObj(NULL, baseObj, &baseVal) != TCL_OK + ) { /* we accept "-now" as current date-time */ const char *const nowOpts[] = { "-now", NULL }; int idx; - if (Tcl_GetIndexFromObj(NULL, opts->baseObj, nowOpts, "seconds or -now", + if (Tcl_GetIndexFromObj(NULL, baseObj, nowOpts, "seconds or -now", TCL_EXACT, &idx) == TCL_OK ) { goto baseNow; @@ -3125,7 +3130,7 @@ ClockParseFmtScnArgs( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer but got \"%s\"", - Tcl_GetString(opts->baseObj))); + Tcl_GetString(baseObj))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL); i = 1; goto badOption; @@ -3135,7 +3140,7 @@ ClockParseFmtScnArgs( * that it isn't. */ - if (opts->baseObj->typePtr == &tclBignumType) { + if (baseObj->typePtr == &tclBignumType) { Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); return TCL_ERROR; } -- cgit v0.12 From 993aa1b3384b98684c0c16c3c0c9df672b389054 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 16 May 2017 09:22:17 +0000 Subject: small amend with forgetten static keyword by option --- generic/tclClock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 80740c8..c980a27 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3118,7 +3118,7 @@ ClockParseFmtScnArgs( ) { /* we accept "-now" as current date-time */ - const char *const nowOpts[] = { + static const char *const nowOpts[] = { "-now", NULL }; int idx; -- cgit v0.12 From 62e71e311e8c0f4d38de59686af77451b1754fcb Mon Sep 17 00:00:00 2001 From: stu Date: Sat, 20 May 2017 12:45:31 +0000 Subject: Fix build on OpenBSD. [82701b94c4] missed a couple of bits. Tcl/Tk's tcl.m4 isn't identical to TEA's tcl.m4 - be careful! --- unix/configure | 4 +++- unix/tcl.m4 | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/configure b/unix/configure index 2097111..8b8a464 100755 --- a/unix/configure +++ b/unix/configure @@ -5757,12 +5757,14 @@ fi esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" if test "${TCL_THREADS}" = "1"; then : diff --git a/unix/tcl.m4 b/unix/tcl.m4 index a69715d..559d8f3 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1476,10 +1476,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" AS_IF([test "${TCL_THREADS}" = "1"], [ -- cgit v0.12 From f3ea991996a821a92f44c7f822766e7d59800f6c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 May 2017 14:48:58 +0000 Subject: Update internal tables to Unicode 10.0. Still in Beta, but to be released soon. --- generic/regc_locale.c | 6164 ++++++++++++++++++++++++++++++++++++++++++++++--- generic/tclUniData.c | 1226 +++++----- 2 files changed, 6496 insertions(+), 894 deletions(-) diff --git a/generic/regc_locale.c b/generic/regc_locale.c index ab3b7f1..f0e8439 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -140,106 +140,1106 @@ static const crange alphaRangeTable[] = { {0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x561, 0x587}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x620, 0x64a}, {0x671, 0x6d3}, {0x6fa, 0x6fc}, {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7ca, 0x7ea}, - {0x800, 0x815}, {0x840, 0x858}, {0x8a0, 0x8b4}, {0x8b6, 0x8bd}, - {0x904, 0x939}, {0x958, 0x961}, {0x971, 0x980}, {0x985, 0x98c}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9df, 0x9e1}, - {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa59, 0xa5c}, - {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, - {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xb05, 0xb0c}, {0xb13, 0xb28}, - {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, - {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, - {0xc58, 0xc5a}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, - {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, - {0xd12, 0xd3a}, {0xd54, 0xd56}, {0xd5f, 0xd61}, {0xd7a, 0xd7f}, - {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, - {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, {0xe99, 0xe9f}, - {0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, {0xedc, 0xedf}, - {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a}, - {0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, {0x1075, 0x1081}, - {0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, {0x124a, 0x124d}, - {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, - {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, - {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, - {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1401, 0x166c}, - {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8}, - {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731}, {0x1740, 0x1751}, - {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, {0x1820, 0x1877}, - {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, - {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, - {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33}, {0x1b45, 0x1b4b}, - {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, {0x1c4d, 0x1c4f}, - {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1ce9, 0x1cec}, {0x1cee, 0x1cf1}, - {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, - {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, - {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, - {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, - {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, {0x212a, 0x212d}, - {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, {0x2c00, 0x2c2e}, - {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2d00, 0x2d25}, - {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, - {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, - {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, {0x3041, 0x3096}, - {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312d}, - {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, {0x3400, 0x4db5}, - {0x4e00, 0x9fd5}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, - {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5}, - {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ae}, {0xa7b0, 0xa7b7}, - {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, {0xa80c, 0xa822}, - {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, {0xa90a, 0xa925}, - {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, {0xa9e0, 0xa9e4}, - {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, {0xaa40, 0xaa42}, - {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, {0xaab9, 0xaabd}, - {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, - {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, - {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, {0xac00, 0xd7a3}, - {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, - {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, - {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, {0xde00, 0xde3e}, {0xde40, 0xde7e}, - {0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, - {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, - {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, - {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, - {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, - {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, - {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} + {0x800, 0x815}, {0x840, 0x858}, {0x860, 0x86a}, {0x8a0, 0x8b4}, + {0x8b6, 0x8bd}, {0x904, 0x939}, {0x958, 0x961}, {0x971, 0x980}, + {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, + {0x9df, 0x9e1}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, + {0xa59, 0xa5c}, {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, + {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xb05, 0xb0c}, + {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb5f, 0xb61}, + {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, + {0xbae, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, + {0xc2a, 0xc39}, {0xc58, 0xc5a}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, + {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xd05, 0xd0c}, + {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd54, 0xd56}, {0xd5f, 0xd61}, + {0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, + {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, + {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, + {0xedc, 0xedf}, {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, + {0x1000, 0x102a}, {0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, + {0x1075, 0x1081}, {0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, + {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, + {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, + {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, + {0x1318, 0x135a}, {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, + {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, + {0x16f1, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731}, + {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, + {0x1820, 0x1877}, {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5}, + {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, + {0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33}, + {0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, + {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1ce9, 0x1cec}, + {0x1cee, 0x1cf1}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, + {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, + {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, + {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, + {0x1ff6, 0x1ffc}, {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, + {0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, + {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, + {0x2d00, 0x2d25}, {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, + {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, + {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, + {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, + {0x3105, 0x312e}, {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, + {0x3400, 0x4db5}, {0x4e00, 0x9fea}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, + {0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, + {0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ae}, + {0xa7b0, 0xa7b7}, {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, + {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, + {0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, + {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, + {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, + {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, + {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, + {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, + {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, + {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, + {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, + {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, + {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, + {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} #if TCL_UTF_MAX > 4 - ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, - {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0}, - {0x10300, 0x1031f}, {0x10330, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, - {0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d}, - {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, - {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805}, - {0x1080a, 0x10835}, {0x1083f, 0x10855}, {0x10860, 0x10876}, {0x10880, 0x1089e}, - {0x108e0, 0x108f2}, {0x10900, 0x10915}, {0x10920, 0x10939}, {0x10980, 0x109b7}, - {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a60, 0x10a7c}, - {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4}, {0x10b00, 0x10b35}, - {0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91}, {0x10c00, 0x10c48}, - {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x11003, 0x11037}, {0x11083, 0x110af}, - {0x110d0, 0x110e8}, {0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, - {0x111c1, 0x111c4}, {0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286}, - {0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de}, - {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, - {0x1135d, 0x11361}, {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af}, - {0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa}, - {0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, - {0x11c0a, 0x11c2e}, {0x11c72, 0x11c8f}, {0x12000, 0x12399}, {0x12480, 0x12543}, - {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, - {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, {0x16b63, 0x16b77}, - {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f}, {0x17000, 0x187ec}, - {0x18800, 0x18af2}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, - {0x1bc90, 0x1bc99}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, - {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, - {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, - {0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, - {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, - {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, - {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, - {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, - {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, - {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d} + ,{0x10041, 0x1005a}, {0x10061, 0x1007a}, {0x100c0, 0x100d6}, {0x100d8, 0x100f6}, + {0x100f8, 0x102c1}, {0x102c6, 0x102d1}, {0x102e0, 0x102e4}, {0x10370, 0x10374}, + {0x1037a, 0x1037d}, {0x10388, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x103f5}, + {0x103f7, 0x10481}, {0x1048a, 0x1052f}, {0x10531, 0x10556}, {0x10561, 0x10587}, + {0x105d0, 0x105ea}, {0x105f0, 0x105f2}, {0x10620, 0x1064a}, {0x10671, 0x106d3}, + {0x106fa, 0x106fc}, {0x10712, 0x1072f}, {0x1074d, 0x107a5}, {0x107ca, 0x107ea}, + {0x10800, 0x10815}, {0x10840, 0x10858}, {0x10860, 0x1086a}, {0x108a0, 0x108b4}, + {0x108b6, 0x108bd}, {0x10904, 0x10939}, {0x10958, 0x10961}, {0x10971, 0x10980}, + {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, + {0x109df, 0x109e1}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, + {0x10a59, 0x10a5c}, {0x10a72, 0x10a74}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, + {0x10a93, 0x10aa8}, {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10b05, 0x10b0c}, + {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, {0x10b35, 0x10b39}, {0x10b5f, 0x10b61}, + {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, {0x10ba8, 0x10baa}, + {0x10bae, 0x10bb9}, {0x10c05, 0x10c0c}, {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, + {0x10c2a, 0x10c39}, {0x10c58, 0x10c5a}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, + {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10d05, 0x10d0c}, + {0x10d0e, 0x10d10}, {0x10d12, 0x10d3a}, {0x10d54, 0x10d56}, {0x10d5f, 0x10d61}, + {0x10d7a, 0x10d7f}, {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, + {0x10dc0, 0x10dc6}, {0x10e01, 0x10e30}, {0x10e40, 0x10e46}, {0x10e94, 0x10e97}, + {0x10e99, 0x10e9f}, {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb0}, {0x10ec0, 0x10ec4}, + {0x10edc, 0x10edf}, {0x10f40, 0x10f47}, {0x10f49, 0x10f6c}, {0x10f88, 0x10f8c}, + {0x11000, 0x1102a}, {0x11050, 0x11055}, {0x1105a, 0x1105d}, {0x1106e, 0x11070}, + {0x11075, 0x11081}, {0x110a0, 0x110c5}, {0x110d0, 0x110fa}, {0x110fc, 0x11248}, + {0x1124a, 0x1124d}, {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, + {0x1128a, 0x1128d}, {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, + {0x112c2, 0x112c5}, {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, + {0x11318, 0x1135a}, {0x11380, 0x1138f}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, + {0x11401, 0x1166c}, {0x1166f, 0x1167f}, {0x11681, 0x1169a}, {0x116a0, 0x116ea}, + {0x116f1, 0x116f8}, {0x11700, 0x1170c}, {0x1170e, 0x11711}, {0x11720, 0x11731}, + {0x11740, 0x11751}, {0x11760, 0x1176c}, {0x1176e, 0x11770}, {0x11780, 0x117b3}, + {0x11820, 0x11877}, {0x11880, 0x11884}, {0x11887, 0x118a8}, {0x118b0, 0x118f5}, + {0x11900, 0x1191e}, {0x11950, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, + {0x119b0, 0x119c9}, {0x11a00, 0x11a16}, {0x11a20, 0x11a54}, {0x11b05, 0x11b33}, + {0x11b45, 0x11b4b}, {0x11b83, 0x11ba0}, {0x11bba, 0x11be5}, {0x11c00, 0x11c23}, + {0x11c4d, 0x11c4f}, {0x11c5a, 0x11c7d}, {0x11c80, 0x11c88}, {0x11ce9, 0x11cec}, + {0x11cee, 0x11cf1}, {0x11d00, 0x11dbf}, {0x11e00, 0x11f15}, {0x11f18, 0x11f1d}, + {0x11f20, 0x11f45}, {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, + {0x11f80, 0x11fb4}, {0x11fb6, 0x11fbc}, {0x11fc2, 0x11fc4}, {0x11fc6, 0x11fcc}, + {0x11fd0, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fe0, 0x11fec}, {0x11ff2, 0x11ff4}, + {0x11ff6, 0x11ffc}, {0x12090, 0x1209c}, {0x1210a, 0x12113}, {0x12119, 0x1211d}, + {0x1212a, 0x1212d}, {0x1212f, 0x12139}, {0x1213c, 0x1213f}, {0x12145, 0x12149}, + {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12ce4}, {0x12ceb, 0x12cee}, + {0x12d00, 0x12d25}, {0x12d30, 0x12d67}, {0x12d80, 0x12d96}, {0x12da0, 0x12da6}, + {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, + {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x13031, 0x13035}, + {0x13041, 0x13096}, {0x1309d, 0x1309f}, {0x130a1, 0x130fa}, {0x130fc, 0x130ff}, + {0x13105, 0x1312e}, {0x13131, 0x1318e}, {0x131a0, 0x131ba}, {0x131f0, 0x131ff}, + {0x13400, 0x14db5}, {0x14e00, 0x19fea}, {0x1a000, 0x1a48c}, {0x1a4d0, 0x1a4fd}, + {0x1a500, 0x1a60c}, {0x1a610, 0x1a61f}, {0x1a640, 0x1a66e}, {0x1a67f, 0x1a69d}, + {0x1a6a0, 0x1a6e5}, {0x1a717, 0x1a71f}, {0x1a722, 0x1a788}, {0x1a78b, 0x1a7ae}, + {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a801}, {0x1a803, 0x1a805}, {0x1a807, 0x1a80a}, + {0x1a80c, 0x1a822}, {0x1a840, 0x1a873}, {0x1a882, 0x1a8b3}, {0x1a8f2, 0x1a8f7}, + {0x1a90a, 0x1a925}, {0x1a930, 0x1a946}, {0x1a960, 0x1a97c}, {0x1a984, 0x1a9b2}, + {0x1a9e0, 0x1a9e4}, {0x1a9e6, 0x1a9ef}, {0x1a9fa, 0x1a9fe}, {0x1aa00, 0x1aa28}, + {0x1aa40, 0x1aa42}, {0x1aa44, 0x1aa4b}, {0x1aa60, 0x1aa76}, {0x1aa7e, 0x1aaaf}, + {0x1aab9, 0x1aabd}, {0x1aadb, 0x1aadd}, {0x1aae0, 0x1aaea}, {0x1aaf2, 0x1aaf4}, + {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, {0x1ab20, 0x1ab26}, + {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab5a}, {0x1ab5c, 0x1ab65}, {0x1ab70, 0x1abe2}, + {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, {0x1f900, 0x1fa6d}, + {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, {0x1fb1f, 0x1fb28}, + {0x1fb2a, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbb1}, {0x1fbd3, 0x1fd3d}, + {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfb}, {0x1fe70, 0x1fe74}, + {0x1fe76, 0x1fefc}, {0x1ff21, 0x1ff3a}, {0x1ff41, 0x1ff5a}, {0x1ff66, 0x1ffbe}, + {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, + {0x20041, 0x2005a}, {0x20061, 0x2007a}, {0x200c0, 0x200d6}, {0x200d8, 0x200f6}, + {0x200f8, 0x202c1}, {0x202c6, 0x202d1}, {0x202e0, 0x202e4}, {0x20370, 0x20374}, + {0x2037a, 0x2037d}, {0x20388, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x203f5}, + {0x203f7, 0x20481}, {0x2048a, 0x2052f}, {0x20531, 0x20556}, {0x20561, 0x20587}, + {0x205d0, 0x205ea}, {0x205f0, 0x205f2}, {0x20620, 0x2064a}, {0x20671, 0x206d3}, + {0x206fa, 0x206fc}, {0x20712, 0x2072f}, {0x2074d, 0x207a5}, {0x207ca, 0x207ea}, + {0x20800, 0x20815}, {0x20840, 0x20858}, {0x20860, 0x2086a}, {0x208a0, 0x208b4}, + {0x208b6, 0x208bd}, {0x20904, 0x20939}, {0x20958, 0x20961}, {0x20971, 0x20980}, + {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, + {0x209df, 0x209e1}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, + {0x20a59, 0x20a5c}, {0x20a72, 0x20a74}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, + {0x20a93, 0x20aa8}, {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20b05, 0x20b0c}, + {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, {0x20b35, 0x20b39}, {0x20b5f, 0x20b61}, + {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, {0x20ba8, 0x20baa}, + {0x20bae, 0x20bb9}, {0x20c05, 0x20c0c}, {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, + {0x20c2a, 0x20c39}, {0x20c58, 0x20c5a}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, + {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20d05, 0x20d0c}, + {0x20d0e, 0x20d10}, {0x20d12, 0x20d3a}, {0x20d54, 0x20d56}, {0x20d5f, 0x20d61}, + {0x20d7a, 0x20d7f}, {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, + {0x20dc0, 0x20dc6}, {0x20e01, 0x20e30}, {0x20e40, 0x20e46}, {0x20e94, 0x20e97}, + {0x20e99, 0x20e9f}, {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb0}, {0x20ec0, 0x20ec4}, + {0x20edc, 0x20edf}, {0x20f40, 0x20f47}, {0x20f49, 0x20f6c}, {0x20f88, 0x20f8c}, + {0x21000, 0x2102a}, {0x21050, 0x21055}, {0x2105a, 0x2105d}, {0x2106e, 0x21070}, + {0x21075, 0x21081}, {0x210a0, 0x210c5}, {0x210d0, 0x210fa}, {0x210fc, 0x21248}, + {0x2124a, 0x2124d}, {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, + {0x2128a, 0x2128d}, {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, + {0x212c2, 0x212c5}, {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, + {0x21318, 0x2135a}, {0x21380, 0x2138f}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, + {0x21401, 0x2166c}, {0x2166f, 0x2167f}, {0x21681, 0x2169a}, {0x216a0, 0x216ea}, + {0x216f1, 0x216f8}, {0x21700, 0x2170c}, {0x2170e, 0x21711}, {0x21720, 0x21731}, + {0x21740, 0x21751}, {0x21760, 0x2176c}, {0x2176e, 0x21770}, {0x21780, 0x217b3}, + {0x21820, 0x21877}, {0x21880, 0x21884}, {0x21887, 0x218a8}, {0x218b0, 0x218f5}, + {0x21900, 0x2191e}, {0x21950, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, + {0x219b0, 0x219c9}, {0x21a00, 0x21a16}, {0x21a20, 0x21a54}, {0x21b05, 0x21b33}, + {0x21b45, 0x21b4b}, {0x21b83, 0x21ba0}, {0x21bba, 0x21be5}, {0x21c00, 0x21c23}, + {0x21c4d, 0x21c4f}, {0x21c5a, 0x21c7d}, {0x21c80, 0x21c88}, {0x21ce9, 0x21cec}, + {0x21cee, 0x21cf1}, {0x21d00, 0x21dbf}, {0x21e00, 0x21f15}, {0x21f18, 0x21f1d}, + {0x21f20, 0x21f45}, {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, + {0x21f80, 0x21fb4}, {0x21fb6, 0x21fbc}, {0x21fc2, 0x21fc4}, {0x21fc6, 0x21fcc}, + {0x21fd0, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fe0, 0x21fec}, {0x21ff2, 0x21ff4}, + {0x21ff6, 0x21ffc}, {0x22090, 0x2209c}, {0x2210a, 0x22113}, {0x22119, 0x2211d}, + {0x2212a, 0x2212d}, {0x2212f, 0x22139}, {0x2213c, 0x2213f}, {0x22145, 0x22149}, + {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22ce4}, {0x22ceb, 0x22cee}, + {0x22d00, 0x22d25}, {0x22d30, 0x22d67}, {0x22d80, 0x22d96}, {0x22da0, 0x22da6}, + {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, + {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x23031, 0x23035}, + {0x23041, 0x23096}, {0x2309d, 0x2309f}, {0x230a1, 0x230fa}, {0x230fc, 0x230ff}, + {0x23105, 0x2312e}, {0x23131, 0x2318e}, {0x231a0, 0x231ba}, {0x231f0, 0x231ff}, + {0x23400, 0x24db5}, {0x24e00, 0x29fea}, {0x2a000, 0x2a48c}, {0x2a4d0, 0x2a4fd}, + {0x2a500, 0x2a60c}, {0x2a610, 0x2a61f}, {0x2a640, 0x2a66e}, {0x2a67f, 0x2a69d}, + {0x2a6a0, 0x2a6e5}, {0x2a717, 0x2a71f}, {0x2a722, 0x2a788}, {0x2a78b, 0x2a7ae}, + {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a801}, {0x2a803, 0x2a805}, {0x2a807, 0x2a80a}, + {0x2a80c, 0x2a822}, {0x2a840, 0x2a873}, {0x2a882, 0x2a8b3}, {0x2a8f2, 0x2a8f7}, + {0x2a90a, 0x2a925}, {0x2a930, 0x2a946}, {0x2a960, 0x2a97c}, {0x2a984, 0x2a9b2}, + {0x2a9e0, 0x2a9e4}, {0x2a9e6, 0x2a9ef}, {0x2a9fa, 0x2a9fe}, {0x2aa00, 0x2aa28}, + {0x2aa40, 0x2aa42}, {0x2aa44, 0x2aa4b}, {0x2aa60, 0x2aa76}, {0x2aa7e, 0x2aaaf}, + {0x2aab9, 0x2aabd}, {0x2aadb, 0x2aadd}, {0x2aae0, 0x2aaea}, {0x2aaf2, 0x2aaf4}, + {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, {0x2ab20, 0x2ab26}, + {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab5a}, {0x2ab5c, 0x2ab65}, {0x2ab70, 0x2abe2}, + {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, {0x2f900, 0x2fa6d}, + {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2fb1f, 0x2fb28}, + {0x2fb2a, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbb1}, {0x2fbd3, 0x2fd3d}, + {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfb}, {0x2fe70, 0x2fe74}, + {0x2fe76, 0x2fefc}, {0x2ff21, 0x2ff3a}, {0x2ff41, 0x2ff5a}, {0x2ff66, 0x2ffbe}, + {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, + {0x30041, 0x3005a}, {0x30061, 0x3007a}, {0x300c0, 0x300d6}, {0x300d8, 0x300f6}, + {0x300f8, 0x302c1}, {0x302c6, 0x302d1}, {0x302e0, 0x302e4}, {0x30370, 0x30374}, + {0x3037a, 0x3037d}, {0x30388, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x303f5}, + {0x303f7, 0x30481}, {0x3048a, 0x3052f}, {0x30531, 0x30556}, {0x30561, 0x30587}, + {0x305d0, 0x305ea}, {0x305f0, 0x305f2}, {0x30620, 0x3064a}, {0x30671, 0x306d3}, + {0x306fa, 0x306fc}, {0x30712, 0x3072f}, {0x3074d, 0x307a5}, {0x307ca, 0x307ea}, + {0x30800, 0x30815}, {0x30840, 0x30858}, {0x30860, 0x3086a}, {0x308a0, 0x308b4}, + {0x308b6, 0x308bd}, {0x30904, 0x30939}, {0x30958, 0x30961}, {0x30971, 0x30980}, + {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, + {0x309df, 0x309e1}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, + {0x30a59, 0x30a5c}, {0x30a72, 0x30a74}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, + {0x30a93, 0x30aa8}, {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30b05, 0x30b0c}, + {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, {0x30b35, 0x30b39}, {0x30b5f, 0x30b61}, + {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, {0x30ba8, 0x30baa}, + {0x30bae, 0x30bb9}, {0x30c05, 0x30c0c}, {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, + {0x30c2a, 0x30c39}, {0x30c58, 0x30c5a}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, + {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30d05, 0x30d0c}, + {0x30d0e, 0x30d10}, {0x30d12, 0x30d3a}, {0x30d54, 0x30d56}, {0x30d5f, 0x30d61}, + {0x30d7a, 0x30d7f}, {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, + {0x30dc0, 0x30dc6}, {0x30e01, 0x30e30}, {0x30e40, 0x30e46}, {0x30e94, 0x30e97}, + {0x30e99, 0x30e9f}, {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb0}, {0x30ec0, 0x30ec4}, + {0x30edc, 0x30edf}, {0x30f40, 0x30f47}, {0x30f49, 0x30f6c}, {0x30f88, 0x30f8c}, + {0x31000, 0x3102a}, {0x31050, 0x31055}, {0x3105a, 0x3105d}, {0x3106e, 0x31070}, + {0x31075, 0x31081}, {0x310a0, 0x310c5}, {0x310d0, 0x310fa}, {0x310fc, 0x31248}, + {0x3124a, 0x3124d}, {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, + {0x3128a, 0x3128d}, {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, + {0x312c2, 0x312c5}, {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, + {0x31318, 0x3135a}, {0x31380, 0x3138f}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, + {0x31401, 0x3166c}, {0x3166f, 0x3167f}, {0x31681, 0x3169a}, {0x316a0, 0x316ea}, + {0x316f1, 0x316f8}, {0x31700, 0x3170c}, {0x3170e, 0x31711}, {0x31720, 0x31731}, + {0x31740, 0x31751}, {0x31760, 0x3176c}, {0x3176e, 0x31770}, {0x31780, 0x317b3}, + {0x31820, 0x31877}, {0x31880, 0x31884}, {0x31887, 0x318a8}, {0x318b0, 0x318f5}, + {0x31900, 0x3191e}, {0x31950, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, + {0x319b0, 0x319c9}, {0x31a00, 0x31a16}, {0x31a20, 0x31a54}, {0x31b05, 0x31b33}, + {0x31b45, 0x31b4b}, {0x31b83, 0x31ba0}, {0x31bba, 0x31be5}, {0x31c00, 0x31c23}, + {0x31c4d, 0x31c4f}, {0x31c5a, 0x31c7d}, {0x31c80, 0x31c88}, {0x31ce9, 0x31cec}, + {0x31cee, 0x31cf1}, {0x31d00, 0x31dbf}, {0x31e00, 0x31f15}, {0x31f18, 0x31f1d}, + {0x31f20, 0x31f45}, {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, + {0x31f80, 0x31fb4}, {0x31fb6, 0x31fbc}, {0x31fc2, 0x31fc4}, {0x31fc6, 0x31fcc}, + {0x31fd0, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fe0, 0x31fec}, {0x31ff2, 0x31ff4}, + {0x31ff6, 0x31ffc}, {0x32090, 0x3209c}, {0x3210a, 0x32113}, {0x32119, 0x3211d}, + {0x3212a, 0x3212d}, {0x3212f, 0x32139}, {0x3213c, 0x3213f}, {0x32145, 0x32149}, + {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32ce4}, {0x32ceb, 0x32cee}, + {0x32d00, 0x32d25}, {0x32d30, 0x32d67}, {0x32d80, 0x32d96}, {0x32da0, 0x32da6}, + {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, + {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x33031, 0x33035}, + {0x33041, 0x33096}, {0x3309d, 0x3309f}, {0x330a1, 0x330fa}, {0x330fc, 0x330ff}, + {0x33105, 0x3312e}, {0x33131, 0x3318e}, {0x331a0, 0x331ba}, {0x331f0, 0x331ff}, + {0x33400, 0x34db5}, {0x34e00, 0x39fea}, {0x3a000, 0x3a48c}, {0x3a4d0, 0x3a4fd}, + {0x3a500, 0x3a60c}, {0x3a610, 0x3a61f}, {0x3a640, 0x3a66e}, {0x3a67f, 0x3a69d}, + {0x3a6a0, 0x3a6e5}, {0x3a717, 0x3a71f}, {0x3a722, 0x3a788}, {0x3a78b, 0x3a7ae}, + {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a801}, {0x3a803, 0x3a805}, {0x3a807, 0x3a80a}, + {0x3a80c, 0x3a822}, {0x3a840, 0x3a873}, {0x3a882, 0x3a8b3}, {0x3a8f2, 0x3a8f7}, + {0x3a90a, 0x3a925}, {0x3a930, 0x3a946}, {0x3a960, 0x3a97c}, {0x3a984, 0x3a9b2}, + {0x3a9e0, 0x3a9e4}, {0x3a9e6, 0x3a9ef}, {0x3a9fa, 0x3a9fe}, {0x3aa00, 0x3aa28}, + {0x3aa40, 0x3aa42}, {0x3aa44, 0x3aa4b}, {0x3aa60, 0x3aa76}, {0x3aa7e, 0x3aaaf}, + {0x3aab9, 0x3aabd}, {0x3aadb, 0x3aadd}, {0x3aae0, 0x3aaea}, {0x3aaf2, 0x3aaf4}, + {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, {0x3ab20, 0x3ab26}, + {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab5a}, {0x3ab5c, 0x3ab65}, {0x3ab70, 0x3abe2}, + {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, {0x3f900, 0x3fa6d}, + {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, {0x3fb1f, 0x3fb28}, + {0x3fb2a, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbb1}, {0x3fbd3, 0x3fd3d}, + {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfb}, {0x3fe70, 0x3fe74}, + {0x3fe76, 0x3fefc}, {0x3ff21, 0x3ff3a}, {0x3ff41, 0x3ff5a}, {0x3ff66, 0x3ffbe}, + {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, + {0x40041, 0x4005a}, {0x40061, 0x4007a}, {0x400c0, 0x400d6}, {0x400d8, 0x400f6}, + {0x400f8, 0x402c1}, {0x402c6, 0x402d1}, {0x402e0, 0x402e4}, {0x40370, 0x40374}, + {0x4037a, 0x4037d}, {0x40388, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x403f5}, + {0x403f7, 0x40481}, {0x4048a, 0x4052f}, {0x40531, 0x40556}, {0x40561, 0x40587}, + {0x405d0, 0x405ea}, {0x405f0, 0x405f2}, {0x40620, 0x4064a}, {0x40671, 0x406d3}, + {0x406fa, 0x406fc}, {0x40712, 0x4072f}, {0x4074d, 0x407a5}, {0x407ca, 0x407ea}, + {0x40800, 0x40815}, {0x40840, 0x40858}, {0x40860, 0x4086a}, {0x408a0, 0x408b4}, + {0x408b6, 0x408bd}, {0x40904, 0x40939}, {0x40958, 0x40961}, {0x40971, 0x40980}, + {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, + {0x409df, 0x409e1}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, + {0x40a59, 0x40a5c}, {0x40a72, 0x40a74}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, + {0x40a93, 0x40aa8}, {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40b05, 0x40b0c}, + {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, {0x40b35, 0x40b39}, {0x40b5f, 0x40b61}, + {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, {0x40ba8, 0x40baa}, + {0x40bae, 0x40bb9}, {0x40c05, 0x40c0c}, {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, + {0x40c2a, 0x40c39}, {0x40c58, 0x40c5a}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, + {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40d05, 0x40d0c}, + {0x40d0e, 0x40d10}, {0x40d12, 0x40d3a}, {0x40d54, 0x40d56}, {0x40d5f, 0x40d61}, + {0x40d7a, 0x40d7f}, {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, + {0x40dc0, 0x40dc6}, {0x40e01, 0x40e30}, {0x40e40, 0x40e46}, {0x40e94, 0x40e97}, + {0x40e99, 0x40e9f}, {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb0}, {0x40ec0, 0x40ec4}, + {0x40edc, 0x40edf}, {0x40f40, 0x40f47}, {0x40f49, 0x40f6c}, {0x40f88, 0x40f8c}, + {0x41000, 0x4102a}, {0x41050, 0x41055}, {0x4105a, 0x4105d}, {0x4106e, 0x41070}, + {0x41075, 0x41081}, {0x410a0, 0x410c5}, {0x410d0, 0x410fa}, {0x410fc, 0x41248}, + {0x4124a, 0x4124d}, {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, + {0x4128a, 0x4128d}, {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, + {0x412c2, 0x412c5}, {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, + {0x41318, 0x4135a}, {0x41380, 0x4138f}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, + {0x41401, 0x4166c}, {0x4166f, 0x4167f}, {0x41681, 0x4169a}, {0x416a0, 0x416ea}, + {0x416f1, 0x416f8}, {0x41700, 0x4170c}, {0x4170e, 0x41711}, {0x41720, 0x41731}, + {0x41740, 0x41751}, {0x41760, 0x4176c}, {0x4176e, 0x41770}, {0x41780, 0x417b3}, + {0x41820, 0x41877}, {0x41880, 0x41884}, {0x41887, 0x418a8}, {0x418b0, 0x418f5}, + {0x41900, 0x4191e}, {0x41950, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, + {0x419b0, 0x419c9}, {0x41a00, 0x41a16}, {0x41a20, 0x41a54}, {0x41b05, 0x41b33}, + {0x41b45, 0x41b4b}, {0x41b83, 0x41ba0}, {0x41bba, 0x41be5}, {0x41c00, 0x41c23}, + {0x41c4d, 0x41c4f}, {0x41c5a, 0x41c7d}, {0x41c80, 0x41c88}, {0x41ce9, 0x41cec}, + {0x41cee, 0x41cf1}, {0x41d00, 0x41dbf}, {0x41e00, 0x41f15}, {0x41f18, 0x41f1d}, + {0x41f20, 0x41f45}, {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, + {0x41f80, 0x41fb4}, {0x41fb6, 0x41fbc}, {0x41fc2, 0x41fc4}, {0x41fc6, 0x41fcc}, + {0x41fd0, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fe0, 0x41fec}, {0x41ff2, 0x41ff4}, + {0x41ff6, 0x41ffc}, {0x42090, 0x4209c}, {0x4210a, 0x42113}, {0x42119, 0x4211d}, + {0x4212a, 0x4212d}, {0x4212f, 0x42139}, {0x4213c, 0x4213f}, {0x42145, 0x42149}, + {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42ce4}, {0x42ceb, 0x42cee}, + {0x42d00, 0x42d25}, {0x42d30, 0x42d67}, {0x42d80, 0x42d96}, {0x42da0, 0x42da6}, + {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, + {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x43031, 0x43035}, + {0x43041, 0x43096}, {0x4309d, 0x4309f}, {0x430a1, 0x430fa}, {0x430fc, 0x430ff}, + {0x43105, 0x4312e}, {0x43131, 0x4318e}, {0x431a0, 0x431ba}, {0x431f0, 0x431ff}, + {0x43400, 0x44db5}, {0x44e00, 0x49fea}, {0x4a000, 0x4a48c}, {0x4a4d0, 0x4a4fd}, + {0x4a500, 0x4a60c}, {0x4a610, 0x4a61f}, {0x4a640, 0x4a66e}, {0x4a67f, 0x4a69d}, + {0x4a6a0, 0x4a6e5}, {0x4a717, 0x4a71f}, {0x4a722, 0x4a788}, {0x4a78b, 0x4a7ae}, + {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a801}, {0x4a803, 0x4a805}, {0x4a807, 0x4a80a}, + {0x4a80c, 0x4a822}, {0x4a840, 0x4a873}, {0x4a882, 0x4a8b3}, {0x4a8f2, 0x4a8f7}, + {0x4a90a, 0x4a925}, {0x4a930, 0x4a946}, {0x4a960, 0x4a97c}, {0x4a984, 0x4a9b2}, + {0x4a9e0, 0x4a9e4}, {0x4a9e6, 0x4a9ef}, {0x4a9fa, 0x4a9fe}, {0x4aa00, 0x4aa28}, + {0x4aa40, 0x4aa42}, {0x4aa44, 0x4aa4b}, {0x4aa60, 0x4aa76}, {0x4aa7e, 0x4aaaf}, + {0x4aab9, 0x4aabd}, {0x4aadb, 0x4aadd}, {0x4aae0, 0x4aaea}, {0x4aaf2, 0x4aaf4}, + {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, {0x4ab20, 0x4ab26}, + {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab5a}, {0x4ab5c, 0x4ab65}, {0x4ab70, 0x4abe2}, + {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, {0x4f900, 0x4fa6d}, + {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4fb1f, 0x4fb28}, + {0x4fb2a, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbb1}, {0x4fbd3, 0x4fd3d}, + {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfb}, {0x4fe70, 0x4fe74}, + {0x4fe76, 0x4fefc}, {0x4ff21, 0x4ff3a}, {0x4ff41, 0x4ff5a}, {0x4ff66, 0x4ffbe}, + {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, + {0x50041, 0x5005a}, {0x50061, 0x5007a}, {0x500c0, 0x500d6}, {0x500d8, 0x500f6}, + {0x500f8, 0x502c1}, {0x502c6, 0x502d1}, {0x502e0, 0x502e4}, {0x50370, 0x50374}, + {0x5037a, 0x5037d}, {0x50388, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x503f5}, + {0x503f7, 0x50481}, {0x5048a, 0x5052f}, {0x50531, 0x50556}, {0x50561, 0x50587}, + {0x505d0, 0x505ea}, {0x505f0, 0x505f2}, {0x50620, 0x5064a}, {0x50671, 0x506d3}, + {0x506fa, 0x506fc}, {0x50712, 0x5072f}, {0x5074d, 0x507a5}, {0x507ca, 0x507ea}, + {0x50800, 0x50815}, {0x50840, 0x50858}, {0x50860, 0x5086a}, {0x508a0, 0x508b4}, + {0x508b6, 0x508bd}, {0x50904, 0x50939}, {0x50958, 0x50961}, {0x50971, 0x50980}, + {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, + {0x509df, 0x509e1}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, + {0x50a59, 0x50a5c}, {0x50a72, 0x50a74}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, + {0x50a93, 0x50aa8}, {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50b05, 0x50b0c}, + {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, {0x50b35, 0x50b39}, {0x50b5f, 0x50b61}, + {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, {0x50ba8, 0x50baa}, + {0x50bae, 0x50bb9}, {0x50c05, 0x50c0c}, {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, + {0x50c2a, 0x50c39}, {0x50c58, 0x50c5a}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, + {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50d05, 0x50d0c}, + {0x50d0e, 0x50d10}, {0x50d12, 0x50d3a}, {0x50d54, 0x50d56}, {0x50d5f, 0x50d61}, + {0x50d7a, 0x50d7f}, {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, + {0x50dc0, 0x50dc6}, {0x50e01, 0x50e30}, {0x50e40, 0x50e46}, {0x50e94, 0x50e97}, + {0x50e99, 0x50e9f}, {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb0}, {0x50ec0, 0x50ec4}, + {0x50edc, 0x50edf}, {0x50f40, 0x50f47}, {0x50f49, 0x50f6c}, {0x50f88, 0x50f8c}, + {0x51000, 0x5102a}, {0x51050, 0x51055}, {0x5105a, 0x5105d}, {0x5106e, 0x51070}, + {0x51075, 0x51081}, {0x510a0, 0x510c5}, {0x510d0, 0x510fa}, {0x510fc, 0x51248}, + {0x5124a, 0x5124d}, {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, + {0x5128a, 0x5128d}, {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, + {0x512c2, 0x512c5}, {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, + {0x51318, 0x5135a}, {0x51380, 0x5138f}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, + {0x51401, 0x5166c}, {0x5166f, 0x5167f}, {0x51681, 0x5169a}, {0x516a0, 0x516ea}, + {0x516f1, 0x516f8}, {0x51700, 0x5170c}, {0x5170e, 0x51711}, {0x51720, 0x51731}, + {0x51740, 0x51751}, {0x51760, 0x5176c}, {0x5176e, 0x51770}, {0x51780, 0x517b3}, + {0x51820, 0x51877}, {0x51880, 0x51884}, {0x51887, 0x518a8}, {0x518b0, 0x518f5}, + {0x51900, 0x5191e}, {0x51950, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, + {0x519b0, 0x519c9}, {0x51a00, 0x51a16}, {0x51a20, 0x51a54}, {0x51b05, 0x51b33}, + {0x51b45, 0x51b4b}, {0x51b83, 0x51ba0}, {0x51bba, 0x51be5}, {0x51c00, 0x51c23}, + {0x51c4d, 0x51c4f}, {0x51c5a, 0x51c7d}, {0x51c80, 0x51c88}, {0x51ce9, 0x51cec}, + {0x51cee, 0x51cf1}, {0x51d00, 0x51dbf}, {0x51e00, 0x51f15}, {0x51f18, 0x51f1d}, + {0x51f20, 0x51f45}, {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, + {0x51f80, 0x51fb4}, {0x51fb6, 0x51fbc}, {0x51fc2, 0x51fc4}, {0x51fc6, 0x51fcc}, + {0x51fd0, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fe0, 0x51fec}, {0x51ff2, 0x51ff4}, + {0x51ff6, 0x51ffc}, {0x52090, 0x5209c}, {0x5210a, 0x52113}, {0x52119, 0x5211d}, + {0x5212a, 0x5212d}, {0x5212f, 0x52139}, {0x5213c, 0x5213f}, {0x52145, 0x52149}, + {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52ce4}, {0x52ceb, 0x52cee}, + {0x52d00, 0x52d25}, {0x52d30, 0x52d67}, {0x52d80, 0x52d96}, {0x52da0, 0x52da6}, + {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, + {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x53031, 0x53035}, + {0x53041, 0x53096}, {0x5309d, 0x5309f}, {0x530a1, 0x530fa}, {0x530fc, 0x530ff}, + {0x53105, 0x5312e}, {0x53131, 0x5318e}, {0x531a0, 0x531ba}, {0x531f0, 0x531ff}, + {0x53400, 0x54db5}, {0x54e00, 0x59fea}, {0x5a000, 0x5a48c}, {0x5a4d0, 0x5a4fd}, + {0x5a500, 0x5a60c}, {0x5a610, 0x5a61f}, {0x5a640, 0x5a66e}, {0x5a67f, 0x5a69d}, + {0x5a6a0, 0x5a6e5}, {0x5a717, 0x5a71f}, {0x5a722, 0x5a788}, {0x5a78b, 0x5a7ae}, + {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a801}, {0x5a803, 0x5a805}, {0x5a807, 0x5a80a}, + {0x5a80c, 0x5a822}, {0x5a840, 0x5a873}, {0x5a882, 0x5a8b3}, {0x5a8f2, 0x5a8f7}, + {0x5a90a, 0x5a925}, {0x5a930, 0x5a946}, {0x5a960, 0x5a97c}, {0x5a984, 0x5a9b2}, + {0x5a9e0, 0x5a9e4}, {0x5a9e6, 0x5a9ef}, {0x5a9fa, 0x5a9fe}, {0x5aa00, 0x5aa28}, + {0x5aa40, 0x5aa42}, {0x5aa44, 0x5aa4b}, {0x5aa60, 0x5aa76}, {0x5aa7e, 0x5aaaf}, + {0x5aab9, 0x5aabd}, {0x5aadb, 0x5aadd}, {0x5aae0, 0x5aaea}, {0x5aaf2, 0x5aaf4}, + {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, {0x5ab20, 0x5ab26}, + {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab5a}, {0x5ab5c, 0x5ab65}, {0x5ab70, 0x5abe2}, + {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, {0x5f900, 0x5fa6d}, + {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, {0x5fb1f, 0x5fb28}, + {0x5fb2a, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbb1}, {0x5fbd3, 0x5fd3d}, + {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfb}, {0x5fe70, 0x5fe74}, + {0x5fe76, 0x5fefc}, {0x5ff21, 0x5ff3a}, {0x5ff41, 0x5ff5a}, {0x5ff66, 0x5ffbe}, + {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, + {0x60041, 0x6005a}, {0x60061, 0x6007a}, {0x600c0, 0x600d6}, {0x600d8, 0x600f6}, + {0x600f8, 0x602c1}, {0x602c6, 0x602d1}, {0x602e0, 0x602e4}, {0x60370, 0x60374}, + {0x6037a, 0x6037d}, {0x60388, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x603f5}, + {0x603f7, 0x60481}, {0x6048a, 0x6052f}, {0x60531, 0x60556}, {0x60561, 0x60587}, + {0x605d0, 0x605ea}, {0x605f0, 0x605f2}, {0x60620, 0x6064a}, {0x60671, 0x606d3}, + {0x606fa, 0x606fc}, {0x60712, 0x6072f}, {0x6074d, 0x607a5}, {0x607ca, 0x607ea}, + {0x60800, 0x60815}, {0x60840, 0x60858}, {0x60860, 0x6086a}, {0x608a0, 0x608b4}, + {0x608b6, 0x608bd}, {0x60904, 0x60939}, {0x60958, 0x60961}, {0x60971, 0x60980}, + {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, + {0x609df, 0x609e1}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, + {0x60a59, 0x60a5c}, {0x60a72, 0x60a74}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, + {0x60a93, 0x60aa8}, {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60b05, 0x60b0c}, + {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, {0x60b35, 0x60b39}, {0x60b5f, 0x60b61}, + {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, {0x60ba8, 0x60baa}, + {0x60bae, 0x60bb9}, {0x60c05, 0x60c0c}, {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, + {0x60c2a, 0x60c39}, {0x60c58, 0x60c5a}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, + {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60d05, 0x60d0c}, + {0x60d0e, 0x60d10}, {0x60d12, 0x60d3a}, {0x60d54, 0x60d56}, {0x60d5f, 0x60d61}, + {0x60d7a, 0x60d7f}, {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, + {0x60dc0, 0x60dc6}, {0x60e01, 0x60e30}, {0x60e40, 0x60e46}, {0x60e94, 0x60e97}, + {0x60e99, 0x60e9f}, {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb0}, {0x60ec0, 0x60ec4}, + {0x60edc, 0x60edf}, {0x60f40, 0x60f47}, {0x60f49, 0x60f6c}, {0x60f88, 0x60f8c}, + {0x61000, 0x6102a}, {0x61050, 0x61055}, {0x6105a, 0x6105d}, {0x6106e, 0x61070}, + {0x61075, 0x61081}, {0x610a0, 0x610c5}, {0x610d0, 0x610fa}, {0x610fc, 0x61248}, + {0x6124a, 0x6124d}, {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, + {0x6128a, 0x6128d}, {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, + {0x612c2, 0x612c5}, {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, + {0x61318, 0x6135a}, {0x61380, 0x6138f}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, + {0x61401, 0x6166c}, {0x6166f, 0x6167f}, {0x61681, 0x6169a}, {0x616a0, 0x616ea}, + {0x616f1, 0x616f8}, {0x61700, 0x6170c}, {0x6170e, 0x61711}, {0x61720, 0x61731}, + {0x61740, 0x61751}, {0x61760, 0x6176c}, {0x6176e, 0x61770}, {0x61780, 0x617b3}, + {0x61820, 0x61877}, {0x61880, 0x61884}, {0x61887, 0x618a8}, {0x618b0, 0x618f5}, + {0x61900, 0x6191e}, {0x61950, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, + {0x619b0, 0x619c9}, {0x61a00, 0x61a16}, {0x61a20, 0x61a54}, {0x61b05, 0x61b33}, + {0x61b45, 0x61b4b}, {0x61b83, 0x61ba0}, {0x61bba, 0x61be5}, {0x61c00, 0x61c23}, + {0x61c4d, 0x61c4f}, {0x61c5a, 0x61c7d}, {0x61c80, 0x61c88}, {0x61ce9, 0x61cec}, + {0x61cee, 0x61cf1}, {0x61d00, 0x61dbf}, {0x61e00, 0x61f15}, {0x61f18, 0x61f1d}, + {0x61f20, 0x61f45}, {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, + {0x61f80, 0x61fb4}, {0x61fb6, 0x61fbc}, {0x61fc2, 0x61fc4}, {0x61fc6, 0x61fcc}, + {0x61fd0, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fe0, 0x61fec}, {0x61ff2, 0x61ff4}, + {0x61ff6, 0x61ffc}, {0x62090, 0x6209c}, {0x6210a, 0x62113}, {0x62119, 0x6211d}, + {0x6212a, 0x6212d}, {0x6212f, 0x62139}, {0x6213c, 0x6213f}, {0x62145, 0x62149}, + {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62ce4}, {0x62ceb, 0x62cee}, + {0x62d00, 0x62d25}, {0x62d30, 0x62d67}, {0x62d80, 0x62d96}, {0x62da0, 0x62da6}, + {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, + {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x63031, 0x63035}, + {0x63041, 0x63096}, {0x6309d, 0x6309f}, {0x630a1, 0x630fa}, {0x630fc, 0x630ff}, + {0x63105, 0x6312e}, {0x63131, 0x6318e}, {0x631a0, 0x631ba}, {0x631f0, 0x631ff}, + {0x63400, 0x64db5}, {0x64e00, 0x69fea}, {0x6a000, 0x6a48c}, {0x6a4d0, 0x6a4fd}, + {0x6a500, 0x6a60c}, {0x6a610, 0x6a61f}, {0x6a640, 0x6a66e}, {0x6a67f, 0x6a69d}, + {0x6a6a0, 0x6a6e5}, {0x6a717, 0x6a71f}, {0x6a722, 0x6a788}, {0x6a78b, 0x6a7ae}, + {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a801}, {0x6a803, 0x6a805}, {0x6a807, 0x6a80a}, + {0x6a80c, 0x6a822}, {0x6a840, 0x6a873}, {0x6a882, 0x6a8b3}, {0x6a8f2, 0x6a8f7}, + {0x6a90a, 0x6a925}, {0x6a930, 0x6a946}, {0x6a960, 0x6a97c}, {0x6a984, 0x6a9b2}, + {0x6a9e0, 0x6a9e4}, {0x6a9e6, 0x6a9ef}, {0x6a9fa, 0x6a9fe}, {0x6aa00, 0x6aa28}, + {0x6aa40, 0x6aa42}, {0x6aa44, 0x6aa4b}, {0x6aa60, 0x6aa76}, {0x6aa7e, 0x6aaaf}, + {0x6aab9, 0x6aabd}, {0x6aadb, 0x6aadd}, {0x6aae0, 0x6aaea}, {0x6aaf2, 0x6aaf4}, + {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, {0x6ab20, 0x6ab26}, + {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab5a}, {0x6ab5c, 0x6ab65}, {0x6ab70, 0x6abe2}, + {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, {0x6f900, 0x6fa6d}, + {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6fb1f, 0x6fb28}, + {0x6fb2a, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbb1}, {0x6fbd3, 0x6fd3d}, + {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfb}, {0x6fe70, 0x6fe74}, + {0x6fe76, 0x6fefc}, {0x6ff21, 0x6ff3a}, {0x6ff41, 0x6ff5a}, {0x6ff66, 0x6ffbe}, + {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, + {0x70041, 0x7005a}, {0x70061, 0x7007a}, {0x700c0, 0x700d6}, {0x700d8, 0x700f6}, + {0x700f8, 0x702c1}, {0x702c6, 0x702d1}, {0x702e0, 0x702e4}, {0x70370, 0x70374}, + {0x7037a, 0x7037d}, {0x70388, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x703f5}, + {0x703f7, 0x70481}, {0x7048a, 0x7052f}, {0x70531, 0x70556}, {0x70561, 0x70587}, + {0x705d0, 0x705ea}, {0x705f0, 0x705f2}, {0x70620, 0x7064a}, {0x70671, 0x706d3}, + {0x706fa, 0x706fc}, {0x70712, 0x7072f}, {0x7074d, 0x707a5}, {0x707ca, 0x707ea}, + {0x70800, 0x70815}, {0x70840, 0x70858}, {0x70860, 0x7086a}, {0x708a0, 0x708b4}, + {0x708b6, 0x708bd}, {0x70904, 0x70939}, {0x70958, 0x70961}, {0x70971, 0x70980}, + {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, + {0x709df, 0x709e1}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, + {0x70a59, 0x70a5c}, {0x70a72, 0x70a74}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, + {0x70a93, 0x70aa8}, {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70b05, 0x70b0c}, + {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, {0x70b35, 0x70b39}, {0x70b5f, 0x70b61}, + {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, {0x70ba8, 0x70baa}, + {0x70bae, 0x70bb9}, {0x70c05, 0x70c0c}, {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, + {0x70c2a, 0x70c39}, {0x70c58, 0x70c5a}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, + {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70d05, 0x70d0c}, + {0x70d0e, 0x70d10}, {0x70d12, 0x70d3a}, {0x70d54, 0x70d56}, {0x70d5f, 0x70d61}, + {0x70d7a, 0x70d7f}, {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, + {0x70dc0, 0x70dc6}, {0x70e01, 0x70e30}, {0x70e40, 0x70e46}, {0x70e94, 0x70e97}, + {0x70e99, 0x70e9f}, {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb0}, {0x70ec0, 0x70ec4}, + {0x70edc, 0x70edf}, {0x70f40, 0x70f47}, {0x70f49, 0x70f6c}, {0x70f88, 0x70f8c}, + {0x71000, 0x7102a}, {0x71050, 0x71055}, {0x7105a, 0x7105d}, {0x7106e, 0x71070}, + {0x71075, 0x71081}, {0x710a0, 0x710c5}, {0x710d0, 0x710fa}, {0x710fc, 0x71248}, + {0x7124a, 0x7124d}, {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, + {0x7128a, 0x7128d}, {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, + {0x712c2, 0x712c5}, {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, + {0x71318, 0x7135a}, {0x71380, 0x7138f}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, + {0x71401, 0x7166c}, {0x7166f, 0x7167f}, {0x71681, 0x7169a}, {0x716a0, 0x716ea}, + {0x716f1, 0x716f8}, {0x71700, 0x7170c}, {0x7170e, 0x71711}, {0x71720, 0x71731}, + {0x71740, 0x71751}, {0x71760, 0x7176c}, {0x7176e, 0x71770}, {0x71780, 0x717b3}, + {0x71820, 0x71877}, {0x71880, 0x71884}, {0x71887, 0x718a8}, {0x718b0, 0x718f5}, + {0x71900, 0x7191e}, {0x71950, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, + {0x719b0, 0x719c9}, {0x71a00, 0x71a16}, {0x71a20, 0x71a54}, {0x71b05, 0x71b33}, + {0x71b45, 0x71b4b}, {0x71b83, 0x71ba0}, {0x71bba, 0x71be5}, {0x71c00, 0x71c23}, + {0x71c4d, 0x71c4f}, {0x71c5a, 0x71c7d}, {0x71c80, 0x71c88}, {0x71ce9, 0x71cec}, + {0x71cee, 0x71cf1}, {0x71d00, 0x71dbf}, {0x71e00, 0x71f15}, {0x71f18, 0x71f1d}, + {0x71f20, 0x71f45}, {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, + {0x71f80, 0x71fb4}, {0x71fb6, 0x71fbc}, {0x71fc2, 0x71fc4}, {0x71fc6, 0x71fcc}, + {0x71fd0, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fe0, 0x71fec}, {0x71ff2, 0x71ff4}, + {0x71ff6, 0x71ffc}, {0x72090, 0x7209c}, {0x7210a, 0x72113}, {0x72119, 0x7211d}, + {0x7212a, 0x7212d}, {0x7212f, 0x72139}, {0x7213c, 0x7213f}, {0x72145, 0x72149}, + {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72ce4}, {0x72ceb, 0x72cee}, + {0x72d00, 0x72d25}, {0x72d30, 0x72d67}, {0x72d80, 0x72d96}, {0x72da0, 0x72da6}, + {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, + {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x73031, 0x73035}, + {0x73041, 0x73096}, {0x7309d, 0x7309f}, {0x730a1, 0x730fa}, {0x730fc, 0x730ff}, + {0x73105, 0x7312e}, {0x73131, 0x7318e}, {0x731a0, 0x731ba}, {0x731f0, 0x731ff}, + {0x73400, 0x74db5}, {0x74e00, 0x79fea}, {0x7a000, 0x7a48c}, {0x7a4d0, 0x7a4fd}, + {0x7a500, 0x7a60c}, {0x7a610, 0x7a61f}, {0x7a640, 0x7a66e}, {0x7a67f, 0x7a69d}, + {0x7a6a0, 0x7a6e5}, {0x7a717, 0x7a71f}, {0x7a722, 0x7a788}, {0x7a78b, 0x7a7ae}, + {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a801}, {0x7a803, 0x7a805}, {0x7a807, 0x7a80a}, + {0x7a80c, 0x7a822}, {0x7a840, 0x7a873}, {0x7a882, 0x7a8b3}, {0x7a8f2, 0x7a8f7}, + {0x7a90a, 0x7a925}, {0x7a930, 0x7a946}, {0x7a960, 0x7a97c}, {0x7a984, 0x7a9b2}, + {0x7a9e0, 0x7a9e4}, {0x7a9e6, 0x7a9ef}, {0x7a9fa, 0x7a9fe}, {0x7aa00, 0x7aa28}, + {0x7aa40, 0x7aa42}, {0x7aa44, 0x7aa4b}, {0x7aa60, 0x7aa76}, {0x7aa7e, 0x7aaaf}, + {0x7aab9, 0x7aabd}, {0x7aadb, 0x7aadd}, {0x7aae0, 0x7aaea}, {0x7aaf2, 0x7aaf4}, + {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, {0x7ab20, 0x7ab26}, + {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab5a}, {0x7ab5c, 0x7ab65}, {0x7ab70, 0x7abe2}, + {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, {0x7f900, 0x7fa6d}, + {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, {0x7fb1f, 0x7fb28}, + {0x7fb2a, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbb1}, {0x7fbd3, 0x7fd3d}, + {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfb}, {0x7fe70, 0x7fe74}, + {0x7fe76, 0x7fefc}, {0x7ff21, 0x7ff3a}, {0x7ff41, 0x7ff5a}, {0x7ff66, 0x7ffbe}, + {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, + {0x80041, 0x8005a}, {0x80061, 0x8007a}, {0x800c0, 0x800d6}, {0x800d8, 0x800f6}, + {0x800f8, 0x802c1}, {0x802c6, 0x802d1}, {0x802e0, 0x802e4}, {0x80370, 0x80374}, + {0x8037a, 0x8037d}, {0x80388, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x803f5}, + {0x803f7, 0x80481}, {0x8048a, 0x8052f}, {0x80531, 0x80556}, {0x80561, 0x80587}, + {0x805d0, 0x805ea}, {0x805f0, 0x805f2}, {0x80620, 0x8064a}, {0x80671, 0x806d3}, + {0x806fa, 0x806fc}, {0x80712, 0x8072f}, {0x8074d, 0x807a5}, {0x807ca, 0x807ea}, + {0x80800, 0x80815}, {0x80840, 0x80858}, {0x80860, 0x8086a}, {0x808a0, 0x808b4}, + {0x808b6, 0x808bd}, {0x80904, 0x80939}, {0x80958, 0x80961}, {0x80971, 0x80980}, + {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, + {0x809df, 0x809e1}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, + {0x80a59, 0x80a5c}, {0x80a72, 0x80a74}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, + {0x80a93, 0x80aa8}, {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80b05, 0x80b0c}, + {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, {0x80b35, 0x80b39}, {0x80b5f, 0x80b61}, + {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, {0x80ba8, 0x80baa}, + {0x80bae, 0x80bb9}, {0x80c05, 0x80c0c}, {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, + {0x80c2a, 0x80c39}, {0x80c58, 0x80c5a}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, + {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80d05, 0x80d0c}, + {0x80d0e, 0x80d10}, {0x80d12, 0x80d3a}, {0x80d54, 0x80d56}, {0x80d5f, 0x80d61}, + {0x80d7a, 0x80d7f}, {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, + {0x80dc0, 0x80dc6}, {0x80e01, 0x80e30}, {0x80e40, 0x80e46}, {0x80e94, 0x80e97}, + {0x80e99, 0x80e9f}, {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb0}, {0x80ec0, 0x80ec4}, + {0x80edc, 0x80edf}, {0x80f40, 0x80f47}, {0x80f49, 0x80f6c}, {0x80f88, 0x80f8c}, + {0x81000, 0x8102a}, {0x81050, 0x81055}, {0x8105a, 0x8105d}, {0x8106e, 0x81070}, + {0x81075, 0x81081}, {0x810a0, 0x810c5}, {0x810d0, 0x810fa}, {0x810fc, 0x81248}, + {0x8124a, 0x8124d}, {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, + {0x8128a, 0x8128d}, {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, + {0x812c2, 0x812c5}, {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, + {0x81318, 0x8135a}, {0x81380, 0x8138f}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, + {0x81401, 0x8166c}, {0x8166f, 0x8167f}, {0x81681, 0x8169a}, {0x816a0, 0x816ea}, + {0x816f1, 0x816f8}, {0x81700, 0x8170c}, {0x8170e, 0x81711}, {0x81720, 0x81731}, + {0x81740, 0x81751}, {0x81760, 0x8176c}, {0x8176e, 0x81770}, {0x81780, 0x817b3}, + {0x81820, 0x81877}, {0x81880, 0x81884}, {0x81887, 0x818a8}, {0x818b0, 0x818f5}, + {0x81900, 0x8191e}, {0x81950, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, + {0x819b0, 0x819c9}, {0x81a00, 0x81a16}, {0x81a20, 0x81a54}, {0x81b05, 0x81b33}, + {0x81b45, 0x81b4b}, {0x81b83, 0x81ba0}, {0x81bba, 0x81be5}, {0x81c00, 0x81c23}, + {0x81c4d, 0x81c4f}, {0x81c5a, 0x81c7d}, {0x81c80, 0x81c88}, {0x81ce9, 0x81cec}, + {0x81cee, 0x81cf1}, {0x81d00, 0x81dbf}, {0x81e00, 0x81f15}, {0x81f18, 0x81f1d}, + {0x81f20, 0x81f45}, {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, + {0x81f80, 0x81fb4}, {0x81fb6, 0x81fbc}, {0x81fc2, 0x81fc4}, {0x81fc6, 0x81fcc}, + {0x81fd0, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fe0, 0x81fec}, {0x81ff2, 0x81ff4}, + {0x81ff6, 0x81ffc}, {0x82090, 0x8209c}, {0x8210a, 0x82113}, {0x82119, 0x8211d}, + {0x8212a, 0x8212d}, {0x8212f, 0x82139}, {0x8213c, 0x8213f}, {0x82145, 0x82149}, + {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82ce4}, {0x82ceb, 0x82cee}, + {0x82d00, 0x82d25}, {0x82d30, 0x82d67}, {0x82d80, 0x82d96}, {0x82da0, 0x82da6}, + {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, + {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x83031, 0x83035}, + {0x83041, 0x83096}, {0x8309d, 0x8309f}, {0x830a1, 0x830fa}, {0x830fc, 0x830ff}, + {0x83105, 0x8312e}, {0x83131, 0x8318e}, {0x831a0, 0x831ba}, {0x831f0, 0x831ff}, + {0x83400, 0x84db5}, {0x84e00, 0x89fea}, {0x8a000, 0x8a48c}, {0x8a4d0, 0x8a4fd}, + {0x8a500, 0x8a60c}, {0x8a610, 0x8a61f}, {0x8a640, 0x8a66e}, {0x8a67f, 0x8a69d}, + {0x8a6a0, 0x8a6e5}, {0x8a717, 0x8a71f}, {0x8a722, 0x8a788}, {0x8a78b, 0x8a7ae}, + {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a801}, {0x8a803, 0x8a805}, {0x8a807, 0x8a80a}, + {0x8a80c, 0x8a822}, {0x8a840, 0x8a873}, {0x8a882, 0x8a8b3}, {0x8a8f2, 0x8a8f7}, + {0x8a90a, 0x8a925}, {0x8a930, 0x8a946}, {0x8a960, 0x8a97c}, {0x8a984, 0x8a9b2}, + {0x8a9e0, 0x8a9e4}, {0x8a9e6, 0x8a9ef}, {0x8a9fa, 0x8a9fe}, {0x8aa00, 0x8aa28}, + {0x8aa40, 0x8aa42}, {0x8aa44, 0x8aa4b}, {0x8aa60, 0x8aa76}, {0x8aa7e, 0x8aaaf}, + {0x8aab9, 0x8aabd}, {0x8aadb, 0x8aadd}, {0x8aae0, 0x8aaea}, {0x8aaf2, 0x8aaf4}, + {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, {0x8ab20, 0x8ab26}, + {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab5a}, {0x8ab5c, 0x8ab65}, {0x8ab70, 0x8abe2}, + {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, {0x8f900, 0x8fa6d}, + {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8fb1f, 0x8fb28}, + {0x8fb2a, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbb1}, {0x8fbd3, 0x8fd3d}, + {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfb}, {0x8fe70, 0x8fe74}, + {0x8fe76, 0x8fefc}, {0x8ff21, 0x8ff3a}, {0x8ff41, 0x8ff5a}, {0x8ff66, 0x8ffbe}, + {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, + {0x90041, 0x9005a}, {0x90061, 0x9007a}, {0x900c0, 0x900d6}, {0x900d8, 0x900f6}, + {0x900f8, 0x902c1}, {0x902c6, 0x902d1}, {0x902e0, 0x902e4}, {0x90370, 0x90374}, + {0x9037a, 0x9037d}, {0x90388, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x903f5}, + {0x903f7, 0x90481}, {0x9048a, 0x9052f}, {0x90531, 0x90556}, {0x90561, 0x90587}, + {0x905d0, 0x905ea}, {0x905f0, 0x905f2}, {0x90620, 0x9064a}, {0x90671, 0x906d3}, + {0x906fa, 0x906fc}, {0x90712, 0x9072f}, {0x9074d, 0x907a5}, {0x907ca, 0x907ea}, + {0x90800, 0x90815}, {0x90840, 0x90858}, {0x90860, 0x9086a}, {0x908a0, 0x908b4}, + {0x908b6, 0x908bd}, {0x90904, 0x90939}, {0x90958, 0x90961}, {0x90971, 0x90980}, + {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, + {0x909df, 0x909e1}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, + {0x90a59, 0x90a5c}, {0x90a72, 0x90a74}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, + {0x90a93, 0x90aa8}, {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90b05, 0x90b0c}, + {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, {0x90b35, 0x90b39}, {0x90b5f, 0x90b61}, + {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, {0x90ba8, 0x90baa}, + {0x90bae, 0x90bb9}, {0x90c05, 0x90c0c}, {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, + {0x90c2a, 0x90c39}, {0x90c58, 0x90c5a}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, + {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90d05, 0x90d0c}, + {0x90d0e, 0x90d10}, {0x90d12, 0x90d3a}, {0x90d54, 0x90d56}, {0x90d5f, 0x90d61}, + {0x90d7a, 0x90d7f}, {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, + {0x90dc0, 0x90dc6}, {0x90e01, 0x90e30}, {0x90e40, 0x90e46}, {0x90e94, 0x90e97}, + {0x90e99, 0x90e9f}, {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb0}, {0x90ec0, 0x90ec4}, + {0x90edc, 0x90edf}, {0x90f40, 0x90f47}, {0x90f49, 0x90f6c}, {0x90f88, 0x90f8c}, + {0x91000, 0x9102a}, {0x91050, 0x91055}, {0x9105a, 0x9105d}, {0x9106e, 0x91070}, + {0x91075, 0x91081}, {0x910a0, 0x910c5}, {0x910d0, 0x910fa}, {0x910fc, 0x91248}, + {0x9124a, 0x9124d}, {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, + {0x9128a, 0x9128d}, {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, + {0x912c2, 0x912c5}, {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, + {0x91318, 0x9135a}, {0x91380, 0x9138f}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, + {0x91401, 0x9166c}, {0x9166f, 0x9167f}, {0x91681, 0x9169a}, {0x916a0, 0x916ea}, + {0x916f1, 0x916f8}, {0x91700, 0x9170c}, {0x9170e, 0x91711}, {0x91720, 0x91731}, + {0x91740, 0x91751}, {0x91760, 0x9176c}, {0x9176e, 0x91770}, {0x91780, 0x917b3}, + {0x91820, 0x91877}, {0x91880, 0x91884}, {0x91887, 0x918a8}, {0x918b0, 0x918f5}, + {0x91900, 0x9191e}, {0x91950, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, + {0x919b0, 0x919c9}, {0x91a00, 0x91a16}, {0x91a20, 0x91a54}, {0x91b05, 0x91b33}, + {0x91b45, 0x91b4b}, {0x91b83, 0x91ba0}, {0x91bba, 0x91be5}, {0x91c00, 0x91c23}, + {0x91c4d, 0x91c4f}, {0x91c5a, 0x91c7d}, {0x91c80, 0x91c88}, {0x91ce9, 0x91cec}, + {0x91cee, 0x91cf1}, {0x91d00, 0x91dbf}, {0x91e00, 0x91f15}, {0x91f18, 0x91f1d}, + {0x91f20, 0x91f45}, {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, + {0x91f80, 0x91fb4}, {0x91fb6, 0x91fbc}, {0x91fc2, 0x91fc4}, {0x91fc6, 0x91fcc}, + {0x91fd0, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fe0, 0x91fec}, {0x91ff2, 0x91ff4}, + {0x91ff6, 0x91ffc}, {0x92090, 0x9209c}, {0x9210a, 0x92113}, {0x92119, 0x9211d}, + {0x9212a, 0x9212d}, {0x9212f, 0x92139}, {0x9213c, 0x9213f}, {0x92145, 0x92149}, + {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92ce4}, {0x92ceb, 0x92cee}, + {0x92d00, 0x92d25}, {0x92d30, 0x92d67}, {0x92d80, 0x92d96}, {0x92da0, 0x92da6}, + {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, + {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x93031, 0x93035}, + {0x93041, 0x93096}, {0x9309d, 0x9309f}, {0x930a1, 0x930fa}, {0x930fc, 0x930ff}, + {0x93105, 0x9312e}, {0x93131, 0x9318e}, {0x931a0, 0x931ba}, {0x931f0, 0x931ff}, + {0x93400, 0x94db5}, {0x94e00, 0x99fea}, {0x9a000, 0x9a48c}, {0x9a4d0, 0x9a4fd}, + {0x9a500, 0x9a60c}, {0x9a610, 0x9a61f}, {0x9a640, 0x9a66e}, {0x9a67f, 0x9a69d}, + {0x9a6a0, 0x9a6e5}, {0x9a717, 0x9a71f}, {0x9a722, 0x9a788}, {0x9a78b, 0x9a7ae}, + {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a801}, {0x9a803, 0x9a805}, {0x9a807, 0x9a80a}, + {0x9a80c, 0x9a822}, {0x9a840, 0x9a873}, {0x9a882, 0x9a8b3}, {0x9a8f2, 0x9a8f7}, + {0x9a90a, 0x9a925}, {0x9a930, 0x9a946}, {0x9a960, 0x9a97c}, {0x9a984, 0x9a9b2}, + {0x9a9e0, 0x9a9e4}, {0x9a9e6, 0x9a9ef}, {0x9a9fa, 0x9a9fe}, {0x9aa00, 0x9aa28}, + {0x9aa40, 0x9aa42}, {0x9aa44, 0x9aa4b}, {0x9aa60, 0x9aa76}, {0x9aa7e, 0x9aaaf}, + {0x9aab9, 0x9aabd}, {0x9aadb, 0x9aadd}, {0x9aae0, 0x9aaea}, {0x9aaf2, 0x9aaf4}, + {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, {0x9ab20, 0x9ab26}, + {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab5a}, {0x9ab5c, 0x9ab65}, {0x9ab70, 0x9abe2}, + {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, {0x9f900, 0x9fa6d}, + {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, {0x9fb1f, 0x9fb28}, + {0x9fb2a, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbb1}, {0x9fbd3, 0x9fd3d}, + {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfb}, {0x9fe70, 0x9fe74}, + {0x9fe76, 0x9fefc}, {0x9ff21, 0x9ff3a}, {0x9ff41, 0x9ff5a}, {0x9ff66, 0x9ffbe}, + {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, + {0xa0041, 0xa005a}, {0xa0061, 0xa007a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00f6}, + {0xa00f8, 0xa02c1}, {0xa02c6, 0xa02d1}, {0xa02e0, 0xa02e4}, {0xa0370, 0xa0374}, + {0xa037a, 0xa037d}, {0xa0388, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa03f5}, + {0xa03f7, 0xa0481}, {0xa048a, 0xa052f}, {0xa0531, 0xa0556}, {0xa0561, 0xa0587}, + {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f2}, {0xa0620, 0xa064a}, {0xa0671, 0xa06d3}, + {0xa06fa, 0xa06fc}, {0xa0712, 0xa072f}, {0xa074d, 0xa07a5}, {0xa07ca, 0xa07ea}, + {0xa0800, 0xa0815}, {0xa0840, 0xa0858}, {0xa0860, 0xa086a}, {0xa08a0, 0xa08b4}, + {0xa08b6, 0xa08bd}, {0xa0904, 0xa0939}, {0xa0958, 0xa0961}, {0xa0971, 0xa0980}, + {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, + {0xa09df, 0xa09e1}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, + {0xa0a59, 0xa0a5c}, {0xa0a72, 0xa0a74}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, + {0xa0a93, 0xa0aa8}, {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0b05, 0xa0b0c}, + {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, {0xa0b35, 0xa0b39}, {0xa0b5f, 0xa0b61}, + {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, {0xa0ba8, 0xa0baa}, + {0xa0bae, 0xa0bb9}, {0xa0c05, 0xa0c0c}, {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, + {0xa0c2a, 0xa0c39}, {0xa0c58, 0xa0c5a}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, + {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0d05, 0xa0d0c}, + {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d3a}, {0xa0d54, 0xa0d56}, {0xa0d5f, 0xa0d61}, + {0xa0d7a, 0xa0d7f}, {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, + {0xa0dc0, 0xa0dc6}, {0xa0e01, 0xa0e30}, {0xa0e40, 0xa0e46}, {0xa0e94, 0xa0e97}, + {0xa0e99, 0xa0e9f}, {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb0}, {0xa0ec0, 0xa0ec4}, + {0xa0edc, 0xa0edf}, {0xa0f40, 0xa0f47}, {0xa0f49, 0xa0f6c}, {0xa0f88, 0xa0f8c}, + {0xa1000, 0xa102a}, {0xa1050, 0xa1055}, {0xa105a, 0xa105d}, {0xa106e, 0xa1070}, + {0xa1075, 0xa1081}, {0xa10a0, 0xa10c5}, {0xa10d0, 0xa10fa}, {0xa10fc, 0xa1248}, + {0xa124a, 0xa124d}, {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, + {0xa128a, 0xa128d}, {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, + {0xa12c2, 0xa12c5}, {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, + {0xa1318, 0xa135a}, {0xa1380, 0xa138f}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, + {0xa1401, 0xa166c}, {0xa166f, 0xa167f}, {0xa1681, 0xa169a}, {0xa16a0, 0xa16ea}, + {0xa16f1, 0xa16f8}, {0xa1700, 0xa170c}, {0xa170e, 0xa1711}, {0xa1720, 0xa1731}, + {0xa1740, 0xa1751}, {0xa1760, 0xa176c}, {0xa176e, 0xa1770}, {0xa1780, 0xa17b3}, + {0xa1820, 0xa1877}, {0xa1880, 0xa1884}, {0xa1887, 0xa18a8}, {0xa18b0, 0xa18f5}, + {0xa1900, 0xa191e}, {0xa1950, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, + {0xa19b0, 0xa19c9}, {0xa1a00, 0xa1a16}, {0xa1a20, 0xa1a54}, {0xa1b05, 0xa1b33}, + {0xa1b45, 0xa1b4b}, {0xa1b83, 0xa1ba0}, {0xa1bba, 0xa1be5}, {0xa1c00, 0xa1c23}, + {0xa1c4d, 0xa1c4f}, {0xa1c5a, 0xa1c7d}, {0xa1c80, 0xa1c88}, {0xa1ce9, 0xa1cec}, + {0xa1cee, 0xa1cf1}, {0xa1d00, 0xa1dbf}, {0xa1e00, 0xa1f15}, {0xa1f18, 0xa1f1d}, + {0xa1f20, 0xa1f45}, {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, + {0xa1f80, 0xa1fb4}, {0xa1fb6, 0xa1fbc}, {0xa1fc2, 0xa1fc4}, {0xa1fc6, 0xa1fcc}, + {0xa1fd0, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fe0, 0xa1fec}, {0xa1ff2, 0xa1ff4}, + {0xa1ff6, 0xa1ffc}, {0xa2090, 0xa209c}, {0xa210a, 0xa2113}, {0xa2119, 0xa211d}, + {0xa212a, 0xa212d}, {0xa212f, 0xa2139}, {0xa213c, 0xa213f}, {0xa2145, 0xa2149}, + {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2ce4}, {0xa2ceb, 0xa2cee}, + {0xa2d00, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d80, 0xa2d96}, {0xa2da0, 0xa2da6}, + {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, + {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa3031, 0xa3035}, + {0xa3041, 0xa3096}, {0xa309d, 0xa309f}, {0xa30a1, 0xa30fa}, {0xa30fc, 0xa30ff}, + {0xa3105, 0xa312e}, {0xa3131, 0xa318e}, {0xa31a0, 0xa31ba}, {0xa31f0, 0xa31ff}, + {0xa3400, 0xa4db5}, {0xa4e00, 0xa9fea}, {0xaa000, 0xaa48c}, {0xaa4d0, 0xaa4fd}, + {0xaa500, 0xaa60c}, {0xaa610, 0xaa61f}, {0xaa640, 0xaa66e}, {0xaa67f, 0xaa69d}, + {0xaa6a0, 0xaa6e5}, {0xaa717, 0xaa71f}, {0xaa722, 0xaa788}, {0xaa78b, 0xaa7ae}, + {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa801}, {0xaa803, 0xaa805}, {0xaa807, 0xaa80a}, + {0xaa80c, 0xaa822}, {0xaa840, 0xaa873}, {0xaa882, 0xaa8b3}, {0xaa8f2, 0xaa8f7}, + {0xaa90a, 0xaa925}, {0xaa930, 0xaa946}, {0xaa960, 0xaa97c}, {0xaa984, 0xaa9b2}, + {0xaa9e0, 0xaa9e4}, {0xaa9e6, 0xaa9ef}, {0xaa9fa, 0xaa9fe}, {0xaaa00, 0xaaa28}, + {0xaaa40, 0xaaa42}, {0xaaa44, 0xaaa4b}, {0xaaa60, 0xaaa76}, {0xaaa7e, 0xaaaaf}, + {0xaaab9, 0xaaabd}, {0xaaadb, 0xaaadd}, {0xaaae0, 0xaaaea}, {0xaaaf2, 0xaaaf4}, + {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, {0xaab20, 0xaab26}, + {0xaab28, 0xaab2e}, {0xaab30, 0xaab5a}, {0xaab5c, 0xaab65}, {0xaab70, 0xaabe2}, + {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, {0xaf900, 0xafa6d}, + {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xafb1f, 0xafb28}, + {0xafb2a, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbb1}, {0xafbd3, 0xafd3d}, + {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfb}, {0xafe70, 0xafe74}, + {0xafe76, 0xafefc}, {0xaff21, 0xaff3a}, {0xaff41, 0xaff5a}, {0xaff66, 0xaffbe}, + {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, + {0xb0041, 0xb005a}, {0xb0061, 0xb007a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00f6}, + {0xb00f8, 0xb02c1}, {0xb02c6, 0xb02d1}, {0xb02e0, 0xb02e4}, {0xb0370, 0xb0374}, + {0xb037a, 0xb037d}, {0xb0388, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb03f5}, + {0xb03f7, 0xb0481}, {0xb048a, 0xb052f}, {0xb0531, 0xb0556}, {0xb0561, 0xb0587}, + {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f2}, {0xb0620, 0xb064a}, {0xb0671, 0xb06d3}, + {0xb06fa, 0xb06fc}, {0xb0712, 0xb072f}, {0xb074d, 0xb07a5}, {0xb07ca, 0xb07ea}, + {0xb0800, 0xb0815}, {0xb0840, 0xb0858}, {0xb0860, 0xb086a}, {0xb08a0, 0xb08b4}, + {0xb08b6, 0xb08bd}, {0xb0904, 0xb0939}, {0xb0958, 0xb0961}, {0xb0971, 0xb0980}, + {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, + {0xb09df, 0xb09e1}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, + {0xb0a59, 0xb0a5c}, {0xb0a72, 0xb0a74}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, + {0xb0a93, 0xb0aa8}, {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0b05, 0xb0b0c}, + {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, {0xb0b35, 0xb0b39}, {0xb0b5f, 0xb0b61}, + {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, {0xb0ba8, 0xb0baa}, + {0xb0bae, 0xb0bb9}, {0xb0c05, 0xb0c0c}, {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, + {0xb0c2a, 0xb0c39}, {0xb0c58, 0xb0c5a}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, + {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0d05, 0xb0d0c}, + {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d3a}, {0xb0d54, 0xb0d56}, {0xb0d5f, 0xb0d61}, + {0xb0d7a, 0xb0d7f}, {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, + {0xb0dc0, 0xb0dc6}, {0xb0e01, 0xb0e30}, {0xb0e40, 0xb0e46}, {0xb0e94, 0xb0e97}, + {0xb0e99, 0xb0e9f}, {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb0}, {0xb0ec0, 0xb0ec4}, + {0xb0edc, 0xb0edf}, {0xb0f40, 0xb0f47}, {0xb0f49, 0xb0f6c}, {0xb0f88, 0xb0f8c}, + {0xb1000, 0xb102a}, {0xb1050, 0xb1055}, {0xb105a, 0xb105d}, {0xb106e, 0xb1070}, + {0xb1075, 0xb1081}, {0xb10a0, 0xb10c5}, {0xb10d0, 0xb10fa}, {0xb10fc, 0xb1248}, + {0xb124a, 0xb124d}, {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, + {0xb128a, 0xb128d}, {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, + {0xb12c2, 0xb12c5}, {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, + {0xb1318, 0xb135a}, {0xb1380, 0xb138f}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, + {0xb1401, 0xb166c}, {0xb166f, 0xb167f}, {0xb1681, 0xb169a}, {0xb16a0, 0xb16ea}, + {0xb16f1, 0xb16f8}, {0xb1700, 0xb170c}, {0xb170e, 0xb1711}, {0xb1720, 0xb1731}, + {0xb1740, 0xb1751}, {0xb1760, 0xb176c}, {0xb176e, 0xb1770}, {0xb1780, 0xb17b3}, + {0xb1820, 0xb1877}, {0xb1880, 0xb1884}, {0xb1887, 0xb18a8}, {0xb18b0, 0xb18f5}, + {0xb1900, 0xb191e}, {0xb1950, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, + {0xb19b0, 0xb19c9}, {0xb1a00, 0xb1a16}, {0xb1a20, 0xb1a54}, {0xb1b05, 0xb1b33}, + {0xb1b45, 0xb1b4b}, {0xb1b83, 0xb1ba0}, {0xb1bba, 0xb1be5}, {0xb1c00, 0xb1c23}, + {0xb1c4d, 0xb1c4f}, {0xb1c5a, 0xb1c7d}, {0xb1c80, 0xb1c88}, {0xb1ce9, 0xb1cec}, + {0xb1cee, 0xb1cf1}, {0xb1d00, 0xb1dbf}, {0xb1e00, 0xb1f15}, {0xb1f18, 0xb1f1d}, + {0xb1f20, 0xb1f45}, {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, + {0xb1f80, 0xb1fb4}, {0xb1fb6, 0xb1fbc}, {0xb1fc2, 0xb1fc4}, {0xb1fc6, 0xb1fcc}, + {0xb1fd0, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fe0, 0xb1fec}, {0xb1ff2, 0xb1ff4}, + {0xb1ff6, 0xb1ffc}, {0xb2090, 0xb209c}, {0xb210a, 0xb2113}, {0xb2119, 0xb211d}, + {0xb212a, 0xb212d}, {0xb212f, 0xb2139}, {0xb213c, 0xb213f}, {0xb2145, 0xb2149}, + {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2ce4}, {0xb2ceb, 0xb2cee}, + {0xb2d00, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d80, 0xb2d96}, {0xb2da0, 0xb2da6}, + {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, + {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb3031, 0xb3035}, + {0xb3041, 0xb3096}, {0xb309d, 0xb309f}, {0xb30a1, 0xb30fa}, {0xb30fc, 0xb30ff}, + {0xb3105, 0xb312e}, {0xb3131, 0xb318e}, {0xb31a0, 0xb31ba}, {0xb31f0, 0xb31ff}, + {0xb3400, 0xb4db5}, {0xb4e00, 0xb9fea}, {0xba000, 0xba48c}, {0xba4d0, 0xba4fd}, + {0xba500, 0xba60c}, {0xba610, 0xba61f}, {0xba640, 0xba66e}, {0xba67f, 0xba69d}, + {0xba6a0, 0xba6e5}, {0xba717, 0xba71f}, {0xba722, 0xba788}, {0xba78b, 0xba7ae}, + {0xba7b0, 0xba7b7}, {0xba7f7, 0xba801}, {0xba803, 0xba805}, {0xba807, 0xba80a}, + {0xba80c, 0xba822}, {0xba840, 0xba873}, {0xba882, 0xba8b3}, {0xba8f2, 0xba8f7}, + {0xba90a, 0xba925}, {0xba930, 0xba946}, {0xba960, 0xba97c}, {0xba984, 0xba9b2}, + {0xba9e0, 0xba9e4}, {0xba9e6, 0xba9ef}, {0xba9fa, 0xba9fe}, {0xbaa00, 0xbaa28}, + {0xbaa40, 0xbaa42}, {0xbaa44, 0xbaa4b}, {0xbaa60, 0xbaa76}, {0xbaa7e, 0xbaaaf}, + {0xbaab9, 0xbaabd}, {0xbaadb, 0xbaadd}, {0xbaae0, 0xbaaea}, {0xbaaf2, 0xbaaf4}, + {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, {0xbab20, 0xbab26}, + {0xbab28, 0xbab2e}, {0xbab30, 0xbab5a}, {0xbab5c, 0xbab65}, {0xbab70, 0xbabe2}, + {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, {0xbf900, 0xbfa6d}, + {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, {0xbfb1f, 0xbfb28}, + {0xbfb2a, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbb1}, {0xbfbd3, 0xbfd3d}, + {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfb}, {0xbfe70, 0xbfe74}, + {0xbfe76, 0xbfefc}, {0xbff21, 0xbff3a}, {0xbff41, 0xbff5a}, {0xbff66, 0xbffbe}, + {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, + {0xc0041, 0xc005a}, {0xc0061, 0xc007a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00f6}, + {0xc00f8, 0xc02c1}, {0xc02c6, 0xc02d1}, {0xc02e0, 0xc02e4}, {0xc0370, 0xc0374}, + {0xc037a, 0xc037d}, {0xc0388, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc03f5}, + {0xc03f7, 0xc0481}, {0xc048a, 0xc052f}, {0xc0531, 0xc0556}, {0xc0561, 0xc0587}, + {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f2}, {0xc0620, 0xc064a}, {0xc0671, 0xc06d3}, + {0xc06fa, 0xc06fc}, {0xc0712, 0xc072f}, {0xc074d, 0xc07a5}, {0xc07ca, 0xc07ea}, + {0xc0800, 0xc0815}, {0xc0840, 0xc0858}, {0xc0860, 0xc086a}, {0xc08a0, 0xc08b4}, + {0xc08b6, 0xc08bd}, {0xc0904, 0xc0939}, {0xc0958, 0xc0961}, {0xc0971, 0xc0980}, + {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, + {0xc09df, 0xc09e1}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, + {0xc0a59, 0xc0a5c}, {0xc0a72, 0xc0a74}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, + {0xc0a93, 0xc0aa8}, {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0b05, 0xc0b0c}, + {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, {0xc0b35, 0xc0b39}, {0xc0b5f, 0xc0b61}, + {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, {0xc0ba8, 0xc0baa}, + {0xc0bae, 0xc0bb9}, {0xc0c05, 0xc0c0c}, {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, + {0xc0c2a, 0xc0c39}, {0xc0c58, 0xc0c5a}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, + {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0d05, 0xc0d0c}, + {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d3a}, {0xc0d54, 0xc0d56}, {0xc0d5f, 0xc0d61}, + {0xc0d7a, 0xc0d7f}, {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, + {0xc0dc0, 0xc0dc6}, {0xc0e01, 0xc0e30}, {0xc0e40, 0xc0e46}, {0xc0e94, 0xc0e97}, + {0xc0e99, 0xc0e9f}, {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb0}, {0xc0ec0, 0xc0ec4}, + {0xc0edc, 0xc0edf}, {0xc0f40, 0xc0f47}, {0xc0f49, 0xc0f6c}, {0xc0f88, 0xc0f8c}, + {0xc1000, 0xc102a}, {0xc1050, 0xc1055}, {0xc105a, 0xc105d}, {0xc106e, 0xc1070}, + {0xc1075, 0xc1081}, {0xc10a0, 0xc10c5}, {0xc10d0, 0xc10fa}, {0xc10fc, 0xc1248}, + {0xc124a, 0xc124d}, {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, + {0xc128a, 0xc128d}, {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, + {0xc12c2, 0xc12c5}, {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, + {0xc1318, 0xc135a}, {0xc1380, 0xc138f}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, + {0xc1401, 0xc166c}, {0xc166f, 0xc167f}, {0xc1681, 0xc169a}, {0xc16a0, 0xc16ea}, + {0xc16f1, 0xc16f8}, {0xc1700, 0xc170c}, {0xc170e, 0xc1711}, {0xc1720, 0xc1731}, + {0xc1740, 0xc1751}, {0xc1760, 0xc176c}, {0xc176e, 0xc1770}, {0xc1780, 0xc17b3}, + {0xc1820, 0xc1877}, {0xc1880, 0xc1884}, {0xc1887, 0xc18a8}, {0xc18b0, 0xc18f5}, + {0xc1900, 0xc191e}, {0xc1950, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, + {0xc19b0, 0xc19c9}, {0xc1a00, 0xc1a16}, {0xc1a20, 0xc1a54}, {0xc1b05, 0xc1b33}, + {0xc1b45, 0xc1b4b}, {0xc1b83, 0xc1ba0}, {0xc1bba, 0xc1be5}, {0xc1c00, 0xc1c23}, + {0xc1c4d, 0xc1c4f}, {0xc1c5a, 0xc1c7d}, {0xc1c80, 0xc1c88}, {0xc1ce9, 0xc1cec}, + {0xc1cee, 0xc1cf1}, {0xc1d00, 0xc1dbf}, {0xc1e00, 0xc1f15}, {0xc1f18, 0xc1f1d}, + {0xc1f20, 0xc1f45}, {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, + {0xc1f80, 0xc1fb4}, {0xc1fb6, 0xc1fbc}, {0xc1fc2, 0xc1fc4}, {0xc1fc6, 0xc1fcc}, + {0xc1fd0, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fe0, 0xc1fec}, {0xc1ff2, 0xc1ff4}, + {0xc1ff6, 0xc1ffc}, {0xc2090, 0xc209c}, {0xc210a, 0xc2113}, {0xc2119, 0xc211d}, + {0xc212a, 0xc212d}, {0xc212f, 0xc2139}, {0xc213c, 0xc213f}, {0xc2145, 0xc2149}, + {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2ce4}, {0xc2ceb, 0xc2cee}, + {0xc2d00, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d80, 0xc2d96}, {0xc2da0, 0xc2da6}, + {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, + {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc3031, 0xc3035}, + {0xc3041, 0xc3096}, {0xc309d, 0xc309f}, {0xc30a1, 0xc30fa}, {0xc30fc, 0xc30ff}, + {0xc3105, 0xc312e}, {0xc3131, 0xc318e}, {0xc31a0, 0xc31ba}, {0xc31f0, 0xc31ff}, + {0xc3400, 0xc4db5}, {0xc4e00, 0xc9fea}, {0xca000, 0xca48c}, {0xca4d0, 0xca4fd}, + {0xca500, 0xca60c}, {0xca610, 0xca61f}, {0xca640, 0xca66e}, {0xca67f, 0xca69d}, + {0xca6a0, 0xca6e5}, {0xca717, 0xca71f}, {0xca722, 0xca788}, {0xca78b, 0xca7ae}, + {0xca7b0, 0xca7b7}, {0xca7f7, 0xca801}, {0xca803, 0xca805}, {0xca807, 0xca80a}, + {0xca80c, 0xca822}, {0xca840, 0xca873}, {0xca882, 0xca8b3}, {0xca8f2, 0xca8f7}, + {0xca90a, 0xca925}, {0xca930, 0xca946}, {0xca960, 0xca97c}, {0xca984, 0xca9b2}, + {0xca9e0, 0xca9e4}, {0xca9e6, 0xca9ef}, {0xca9fa, 0xca9fe}, {0xcaa00, 0xcaa28}, + {0xcaa40, 0xcaa42}, {0xcaa44, 0xcaa4b}, {0xcaa60, 0xcaa76}, {0xcaa7e, 0xcaaaf}, + {0xcaab9, 0xcaabd}, {0xcaadb, 0xcaadd}, {0xcaae0, 0xcaaea}, {0xcaaf2, 0xcaaf4}, + {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, {0xcab20, 0xcab26}, + {0xcab28, 0xcab2e}, {0xcab30, 0xcab5a}, {0xcab5c, 0xcab65}, {0xcab70, 0xcabe2}, + {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, {0xcf900, 0xcfa6d}, + {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcfb1f, 0xcfb28}, + {0xcfb2a, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbb1}, {0xcfbd3, 0xcfd3d}, + {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfb}, {0xcfe70, 0xcfe74}, + {0xcfe76, 0xcfefc}, {0xcff21, 0xcff3a}, {0xcff41, 0xcff5a}, {0xcff66, 0xcffbe}, + {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, + {0xd0041, 0xd005a}, {0xd0061, 0xd007a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00f6}, + {0xd00f8, 0xd02c1}, {0xd02c6, 0xd02d1}, {0xd02e0, 0xd02e4}, {0xd0370, 0xd0374}, + {0xd037a, 0xd037d}, {0xd0388, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd03f5}, + {0xd03f7, 0xd0481}, {0xd048a, 0xd052f}, {0xd0531, 0xd0556}, {0xd0561, 0xd0587}, + {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f2}, {0xd0620, 0xd064a}, {0xd0671, 0xd06d3}, + {0xd06fa, 0xd06fc}, {0xd0712, 0xd072f}, {0xd074d, 0xd07a5}, {0xd07ca, 0xd07ea}, + {0xd0800, 0xd0815}, {0xd0840, 0xd0858}, {0xd0860, 0xd086a}, {0xd08a0, 0xd08b4}, + {0xd08b6, 0xd08bd}, {0xd0904, 0xd0939}, {0xd0958, 0xd0961}, {0xd0971, 0xd0980}, + {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, + {0xd09df, 0xd09e1}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, + {0xd0a59, 0xd0a5c}, {0xd0a72, 0xd0a74}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, + {0xd0a93, 0xd0aa8}, {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0b05, 0xd0b0c}, + {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, {0xd0b35, 0xd0b39}, {0xd0b5f, 0xd0b61}, + {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, {0xd0ba8, 0xd0baa}, + {0xd0bae, 0xd0bb9}, {0xd0c05, 0xd0c0c}, {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, + {0xd0c2a, 0xd0c39}, {0xd0c58, 0xd0c5a}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, + {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0d05, 0xd0d0c}, + {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d3a}, {0xd0d54, 0xd0d56}, {0xd0d5f, 0xd0d61}, + {0xd0d7a, 0xd0d7f}, {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, + {0xd0dc0, 0xd0dc6}, {0xd0e01, 0xd0e30}, {0xd0e40, 0xd0e46}, {0xd0e94, 0xd0e97}, + {0xd0e99, 0xd0e9f}, {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb0}, {0xd0ec0, 0xd0ec4}, + {0xd0edc, 0xd0edf}, {0xd0f40, 0xd0f47}, {0xd0f49, 0xd0f6c}, {0xd0f88, 0xd0f8c}, + {0xd1000, 0xd102a}, {0xd1050, 0xd1055}, {0xd105a, 0xd105d}, {0xd106e, 0xd1070}, + {0xd1075, 0xd1081}, {0xd10a0, 0xd10c5}, {0xd10d0, 0xd10fa}, {0xd10fc, 0xd1248}, + {0xd124a, 0xd124d}, {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, + {0xd128a, 0xd128d}, {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, + {0xd12c2, 0xd12c5}, {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, + {0xd1318, 0xd135a}, {0xd1380, 0xd138f}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, + {0xd1401, 0xd166c}, {0xd166f, 0xd167f}, {0xd1681, 0xd169a}, {0xd16a0, 0xd16ea}, + {0xd16f1, 0xd16f8}, {0xd1700, 0xd170c}, {0xd170e, 0xd1711}, {0xd1720, 0xd1731}, + {0xd1740, 0xd1751}, {0xd1760, 0xd176c}, {0xd176e, 0xd1770}, {0xd1780, 0xd17b3}, + {0xd1820, 0xd1877}, {0xd1880, 0xd1884}, {0xd1887, 0xd18a8}, {0xd18b0, 0xd18f5}, + {0xd1900, 0xd191e}, {0xd1950, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, + {0xd19b0, 0xd19c9}, {0xd1a00, 0xd1a16}, {0xd1a20, 0xd1a54}, {0xd1b05, 0xd1b33}, + {0xd1b45, 0xd1b4b}, {0xd1b83, 0xd1ba0}, {0xd1bba, 0xd1be5}, {0xd1c00, 0xd1c23}, + {0xd1c4d, 0xd1c4f}, {0xd1c5a, 0xd1c7d}, {0xd1c80, 0xd1c88}, {0xd1ce9, 0xd1cec}, + {0xd1cee, 0xd1cf1}, {0xd1d00, 0xd1dbf}, {0xd1e00, 0xd1f15}, {0xd1f18, 0xd1f1d}, + {0xd1f20, 0xd1f45}, {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, + {0xd1f80, 0xd1fb4}, {0xd1fb6, 0xd1fbc}, {0xd1fc2, 0xd1fc4}, {0xd1fc6, 0xd1fcc}, + {0xd1fd0, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fe0, 0xd1fec}, {0xd1ff2, 0xd1ff4}, + {0xd1ff6, 0xd1ffc}, {0xd2090, 0xd209c}, {0xd210a, 0xd2113}, {0xd2119, 0xd211d}, + {0xd212a, 0xd212d}, {0xd212f, 0xd2139}, {0xd213c, 0xd213f}, {0xd2145, 0xd2149}, + {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2ce4}, {0xd2ceb, 0xd2cee}, + {0xd2d00, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d80, 0xd2d96}, {0xd2da0, 0xd2da6}, + {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, + {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd3031, 0xd3035}, + {0xd3041, 0xd3096}, {0xd309d, 0xd309f}, {0xd30a1, 0xd30fa}, {0xd30fc, 0xd30ff}, + {0xd3105, 0xd312e}, {0xd3131, 0xd318e}, {0xd31a0, 0xd31ba}, {0xd31f0, 0xd31ff}, + {0xd3400, 0xd4db5}, {0xd4e00, 0xd9fea}, {0xda000, 0xda48c}, {0xda4d0, 0xda4fd}, + {0xda500, 0xda60c}, {0xda610, 0xda61f}, {0xda640, 0xda66e}, {0xda67f, 0xda69d}, + {0xda6a0, 0xda6e5}, {0xda717, 0xda71f}, {0xda722, 0xda788}, {0xda78b, 0xda7ae}, + {0xda7b0, 0xda7b7}, {0xda7f7, 0xda801}, {0xda803, 0xda805}, {0xda807, 0xda80a}, + {0xda80c, 0xda822}, {0xda840, 0xda873}, {0xda882, 0xda8b3}, {0xda8f2, 0xda8f7}, + {0xda90a, 0xda925}, {0xda930, 0xda946}, {0xda960, 0xda97c}, {0xda984, 0xda9b2}, + {0xda9e0, 0xda9e4}, {0xda9e6, 0xda9ef}, {0xda9fa, 0xda9fe}, {0xdaa00, 0xdaa28}, + {0xdaa40, 0xdaa42}, {0xdaa44, 0xdaa4b}, {0xdaa60, 0xdaa76}, {0xdaa7e, 0xdaaaf}, + {0xdaab9, 0xdaabd}, {0xdaadb, 0xdaadd}, {0xdaae0, 0xdaaea}, {0xdaaf2, 0xdaaf4}, + {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, {0xdab20, 0xdab26}, + {0xdab28, 0xdab2e}, {0xdab30, 0xdab5a}, {0xdab5c, 0xdab65}, {0xdab70, 0xdabe2}, + {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, {0xdf900, 0xdfa6d}, + {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, {0xdfb1f, 0xdfb28}, + {0xdfb2a, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbb1}, {0xdfbd3, 0xdfd3d}, + {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfb}, {0xdfe70, 0xdfe74}, + {0xdfe76, 0xdfefc}, {0xdff21, 0xdff3a}, {0xdff41, 0xdff5a}, {0xdff66, 0xdffbe}, + {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, + {0xe0041, 0xe005a}, {0xe0061, 0xe007a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00f6}, + {0xe00f8, 0xe02c1}, {0xe02c6, 0xe02d1}, {0xe02e0, 0xe02e4}, {0xe0370, 0xe0374}, + {0xe037a, 0xe037d}, {0xe0388, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe03f5}, + {0xe03f7, 0xe0481}, {0xe048a, 0xe052f}, {0xe0531, 0xe0556}, {0xe0561, 0xe0587}, + {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f2}, {0xe0620, 0xe064a}, {0xe0671, 0xe06d3}, + {0xe06fa, 0xe06fc}, {0xe0712, 0xe072f}, {0xe074d, 0xe07a5}, {0xe07ca, 0xe07ea}, + {0xe0800, 0xe0815}, {0xe0840, 0xe0858}, {0xe0860, 0xe086a}, {0xe08a0, 0xe08b4}, + {0xe08b6, 0xe08bd}, {0xe0904, 0xe0939}, {0xe0958, 0xe0961}, {0xe0971, 0xe0980}, + {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, + {0xe09df, 0xe09e1}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, + {0xe0a59, 0xe0a5c}, {0xe0a72, 0xe0a74}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, + {0xe0a93, 0xe0aa8}, {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0b05, 0xe0b0c}, + {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, {0xe0b35, 0xe0b39}, {0xe0b5f, 0xe0b61}, + {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, {0xe0ba8, 0xe0baa}, + {0xe0bae, 0xe0bb9}, {0xe0c05, 0xe0c0c}, {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, + {0xe0c2a, 0xe0c39}, {0xe0c58, 0xe0c5a}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, + {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0d05, 0xe0d0c}, + {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d3a}, {0xe0d54, 0xe0d56}, {0xe0d5f, 0xe0d61}, + {0xe0d7a, 0xe0d7f}, {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, + {0xe0dc0, 0xe0dc6}, {0xe0e01, 0xe0e30}, {0xe0e40, 0xe0e46}, {0xe0e94, 0xe0e97}, + {0xe0e99, 0xe0e9f}, {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb0}, {0xe0ec0, 0xe0ec4}, + {0xe0edc, 0xe0edf}, {0xe0f40, 0xe0f47}, {0xe0f49, 0xe0f6c}, {0xe0f88, 0xe0f8c}, + {0xe1000, 0xe102a}, {0xe1050, 0xe1055}, {0xe105a, 0xe105d}, {0xe106e, 0xe1070}, + {0xe1075, 0xe1081}, {0xe10a0, 0xe10c5}, {0xe10d0, 0xe10fa}, {0xe10fc, 0xe1248}, + {0xe124a, 0xe124d}, {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, + {0xe128a, 0xe128d}, {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, + {0xe12c2, 0xe12c5}, {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, + {0xe1318, 0xe135a}, {0xe1380, 0xe138f}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, + {0xe1401, 0xe166c}, {0xe166f, 0xe167f}, {0xe1681, 0xe169a}, {0xe16a0, 0xe16ea}, + {0xe16f1, 0xe16f8}, {0xe1700, 0xe170c}, {0xe170e, 0xe1711}, {0xe1720, 0xe1731}, + {0xe1740, 0xe1751}, {0xe1760, 0xe176c}, {0xe176e, 0xe1770}, {0xe1780, 0xe17b3}, + {0xe1820, 0xe1877}, {0xe1880, 0xe1884}, {0xe1887, 0xe18a8}, {0xe18b0, 0xe18f5}, + {0xe1900, 0xe191e}, {0xe1950, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, + {0xe19b0, 0xe19c9}, {0xe1a00, 0xe1a16}, {0xe1a20, 0xe1a54}, {0xe1b05, 0xe1b33}, + {0xe1b45, 0xe1b4b}, {0xe1b83, 0xe1ba0}, {0xe1bba, 0xe1be5}, {0xe1c00, 0xe1c23}, + {0xe1c4d, 0xe1c4f}, {0xe1c5a, 0xe1c7d}, {0xe1c80, 0xe1c88}, {0xe1ce9, 0xe1cec}, + {0xe1cee, 0xe1cf1}, {0xe1d00, 0xe1dbf}, {0xe1e00, 0xe1f15}, {0xe1f18, 0xe1f1d}, + {0xe1f20, 0xe1f45}, {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, + {0xe1f80, 0xe1fb4}, {0xe1fb6, 0xe1fbc}, {0xe1fc2, 0xe1fc4}, {0xe1fc6, 0xe1fcc}, + {0xe1fd0, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fe0, 0xe1fec}, {0xe1ff2, 0xe1ff4}, + {0xe1ff6, 0xe1ffc}, {0xe2090, 0xe209c}, {0xe210a, 0xe2113}, {0xe2119, 0xe211d}, + {0xe212a, 0xe212d}, {0xe212f, 0xe2139}, {0xe213c, 0xe213f}, {0xe2145, 0xe2149}, + {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2ce4}, {0xe2ceb, 0xe2cee}, + {0xe2d00, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d80, 0xe2d96}, {0xe2da0, 0xe2da6}, + {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, + {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe3031, 0xe3035}, + {0xe3041, 0xe3096}, {0xe309d, 0xe309f}, {0xe30a1, 0xe30fa}, {0xe30fc, 0xe30ff}, + {0xe3105, 0xe312e}, {0xe3131, 0xe318e}, {0xe31a0, 0xe31ba}, {0xe31f0, 0xe31ff}, + {0xe3400, 0xe4db5}, {0xe4e00, 0xe9fea}, {0xea000, 0xea48c}, {0xea4d0, 0xea4fd}, + {0xea500, 0xea60c}, {0xea610, 0xea61f}, {0xea640, 0xea66e}, {0xea67f, 0xea69d}, + {0xea6a0, 0xea6e5}, {0xea717, 0xea71f}, {0xea722, 0xea788}, {0xea78b, 0xea7ae}, + {0xea7b0, 0xea7b7}, {0xea7f7, 0xea801}, {0xea803, 0xea805}, {0xea807, 0xea80a}, + {0xea80c, 0xea822}, {0xea840, 0xea873}, {0xea882, 0xea8b3}, {0xea8f2, 0xea8f7}, + {0xea90a, 0xea925}, {0xea930, 0xea946}, {0xea960, 0xea97c}, {0xea984, 0xea9b2}, + {0xea9e0, 0xea9e4}, {0xea9e6, 0xea9ef}, {0xea9fa, 0xea9fe}, {0xeaa00, 0xeaa28}, + {0xeaa40, 0xeaa42}, {0xeaa44, 0xeaa4b}, {0xeaa60, 0xeaa76}, {0xeaa7e, 0xeaaaf}, + {0xeaab9, 0xeaabd}, {0xeaadb, 0xeaadd}, {0xeaae0, 0xeaaea}, {0xeaaf2, 0xeaaf4}, + {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, {0xeab20, 0xeab26}, + {0xeab28, 0xeab2e}, {0xeab30, 0xeab5a}, {0xeab5c, 0xeab65}, {0xeab70, 0xeabe2}, + {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, {0xef900, 0xefa6d}, + {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xefb1f, 0xefb28}, + {0xefb2a, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbb1}, {0xefbd3, 0xefd3d}, + {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfb}, {0xefe70, 0xefe74}, + {0xefe76, 0xefefc}, {0xeff21, 0xeff3a}, {0xeff41, 0xeff5a}, {0xeff66, 0xeffbe}, + {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, + {0xf0041, 0xf005a}, {0xf0061, 0xf007a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00f6}, + {0xf00f8, 0xf02c1}, {0xf02c6, 0xf02d1}, {0xf02e0, 0xf02e4}, {0xf0370, 0xf0374}, + {0xf037a, 0xf037d}, {0xf0388, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf03f5}, + {0xf03f7, 0xf0481}, {0xf048a, 0xf052f}, {0xf0531, 0xf0556}, {0xf0561, 0xf0587}, + {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f2}, {0xf0620, 0xf064a}, {0xf0671, 0xf06d3}, + {0xf06fa, 0xf06fc}, {0xf0712, 0xf072f}, {0xf074d, 0xf07a5}, {0xf07ca, 0xf07ea}, + {0xf0800, 0xf0815}, {0xf0840, 0xf0858}, {0xf0860, 0xf086a}, {0xf08a0, 0xf08b4}, + {0xf08b6, 0xf08bd}, {0xf0904, 0xf0939}, {0xf0958, 0xf0961}, {0xf0971, 0xf0980}, + {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, + {0xf09df, 0xf09e1}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, + {0xf0a59, 0xf0a5c}, {0xf0a72, 0xf0a74}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, + {0xf0a93, 0xf0aa8}, {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0b05, 0xf0b0c}, + {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, {0xf0b35, 0xf0b39}, {0xf0b5f, 0xf0b61}, + {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, {0xf0ba8, 0xf0baa}, + {0xf0bae, 0xf0bb9}, {0xf0c05, 0xf0c0c}, {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, + {0xf0c2a, 0xf0c39}, {0xf0c58, 0xf0c5a}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, + {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0d05, 0xf0d0c}, + {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d3a}, {0xf0d54, 0xf0d56}, {0xf0d5f, 0xf0d61}, + {0xf0d7a, 0xf0d7f}, {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, + {0xf0dc0, 0xf0dc6}, {0xf0e01, 0xf0e30}, {0xf0e40, 0xf0e46}, {0xf0e94, 0xf0e97}, + {0xf0e99, 0xf0e9f}, {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb0}, {0xf0ec0, 0xf0ec4}, + {0xf0edc, 0xf0edf}, {0xf0f40, 0xf0f47}, {0xf0f49, 0xf0f6c}, {0xf0f88, 0xf0f8c}, + {0xf1000, 0xf102a}, {0xf1050, 0xf1055}, {0xf105a, 0xf105d}, {0xf106e, 0xf1070}, + {0xf1075, 0xf1081}, {0xf10a0, 0xf10c5}, {0xf10d0, 0xf10fa}, {0xf10fc, 0xf1248}, + {0xf124a, 0xf124d}, {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, + {0xf128a, 0xf128d}, {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, + {0xf12c2, 0xf12c5}, {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, + {0xf1318, 0xf135a}, {0xf1380, 0xf138f}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, + {0xf1401, 0xf166c}, {0xf166f, 0xf167f}, {0xf1681, 0xf169a}, {0xf16a0, 0xf16ea}, + {0xf16f1, 0xf16f8}, {0xf1700, 0xf170c}, {0xf170e, 0xf1711}, {0xf1720, 0xf1731}, + {0xf1740, 0xf1751}, {0xf1760, 0xf176c}, {0xf176e, 0xf1770}, {0xf1780, 0xf17b3}, + {0xf1820, 0xf1877}, {0xf1880, 0xf1884}, {0xf1887, 0xf18a8}, {0xf18b0, 0xf18f5}, + {0xf1900, 0xf191e}, {0xf1950, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, + {0xf19b0, 0xf19c9}, {0xf1a00, 0xf1a16}, {0xf1a20, 0xf1a54}, {0xf1b05, 0xf1b33}, + {0xf1b45, 0xf1b4b}, {0xf1b83, 0xf1ba0}, {0xf1bba, 0xf1be5}, {0xf1c00, 0xf1c23}, + {0xf1c4d, 0xf1c4f}, {0xf1c5a, 0xf1c7d}, {0xf1c80, 0xf1c88}, {0xf1ce9, 0xf1cec}, + {0xf1cee, 0xf1cf1}, {0xf1d00, 0xf1dbf}, {0xf1e00, 0xf1f15}, {0xf1f18, 0xf1f1d}, + {0xf1f20, 0xf1f45}, {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, + {0xf1f80, 0xf1fb4}, {0xf1fb6, 0xf1fbc}, {0xf1fc2, 0xf1fc4}, {0xf1fc6, 0xf1fcc}, + {0xf1fd0, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fe0, 0xf1fec}, {0xf1ff2, 0xf1ff4}, + {0xf1ff6, 0xf1ffc}, {0xf2090, 0xf209c}, {0xf210a, 0xf2113}, {0xf2119, 0xf211d}, + {0xf212a, 0xf212d}, {0xf212f, 0xf2139}, {0xf213c, 0xf213f}, {0xf2145, 0xf2149}, + {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2ce4}, {0xf2ceb, 0xf2cee}, + {0xf2d00, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d80, 0xf2d96}, {0xf2da0, 0xf2da6}, + {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, + {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf3031, 0xf3035}, + {0xf3041, 0xf3096}, {0xf309d, 0xf309f}, {0xf30a1, 0xf30fa}, {0xf30fc, 0xf30ff}, + {0xf3105, 0xf312e}, {0xf3131, 0xf318e}, {0xf31a0, 0xf31ba}, {0xf31f0, 0xf31ff}, + {0xf3400, 0xf4db5}, {0xf4e00, 0xf9fea}, {0xfa000, 0xfa48c}, {0xfa4d0, 0xfa4fd}, + {0xfa500, 0xfa60c}, {0xfa610, 0xfa61f}, {0xfa640, 0xfa66e}, {0xfa67f, 0xfa69d}, + {0xfa6a0, 0xfa6e5}, {0xfa717, 0xfa71f}, {0xfa722, 0xfa788}, {0xfa78b, 0xfa7ae}, + {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa801}, {0xfa803, 0xfa805}, {0xfa807, 0xfa80a}, + {0xfa80c, 0xfa822}, {0xfa840, 0xfa873}, {0xfa882, 0xfa8b3}, {0xfa8f2, 0xfa8f7}, + {0xfa90a, 0xfa925}, {0xfa930, 0xfa946}, {0xfa960, 0xfa97c}, {0xfa984, 0xfa9b2}, + {0xfa9e0, 0xfa9e4}, {0xfa9e6, 0xfa9ef}, {0xfa9fa, 0xfa9fe}, {0xfaa00, 0xfaa28}, + {0xfaa40, 0xfaa42}, {0xfaa44, 0xfaa4b}, {0xfaa60, 0xfaa76}, {0xfaa7e, 0xfaaaf}, + {0xfaab9, 0xfaabd}, {0xfaadb, 0xfaadd}, {0xfaae0, 0xfaaea}, {0xfaaf2, 0xfaaf4}, + {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, {0xfab20, 0xfab26}, + {0xfab28, 0xfab2e}, {0xfab30, 0xfab5a}, {0xfab5c, 0xfab65}, {0xfab70, 0xfabe2}, + {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, {0xff900, 0xffa6d}, + {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, {0xffb1f, 0xffb28}, + {0xffb2a, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbb1}, {0xffbd3, 0xffd3d}, + {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfb}, {0xffe70, 0xffe74}, + {0xffe76, 0xffefc}, {0xfff21, 0xfff3a}, {0xfff41, 0xfff5a}, {0xfff66, 0xfffbe}, + {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, + {0x100041, 0x10005a}, {0x100061, 0x10007a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000f6}, + {0x1000f8, 0x1002c1}, {0x1002c6, 0x1002d1}, {0x1002e0, 0x1002e4}, {0x100370, 0x100374}, + {0x10037a, 0x10037d}, {0x100388, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x1003f5}, + {0x1003f7, 0x100481}, {0x10048a, 0x10052f}, {0x100531, 0x100556}, {0x100561, 0x100587}, + {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f2}, {0x100620, 0x10064a}, {0x100671, 0x1006d3}, + {0x1006fa, 0x1006fc}, {0x100712, 0x10072f}, {0x10074d, 0x1007a5}, {0x1007ca, 0x1007ea}, + {0x100800, 0x100815}, {0x100840, 0x100858}, {0x100860, 0x10086a}, {0x1008a0, 0x1008b4}, + {0x1008b6, 0x1008bd}, {0x100904, 0x100939}, {0x100958, 0x100961}, {0x100971, 0x100980}, + {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, + {0x1009df, 0x1009e1}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, + {0x100a59, 0x100a5c}, {0x100a72, 0x100a74}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, + {0x100a93, 0x100aa8}, {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100b05, 0x100b0c}, + {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, {0x100b35, 0x100b39}, {0x100b5f, 0x100b61}, + {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, {0x100ba8, 0x100baa}, + {0x100bae, 0x100bb9}, {0x100c05, 0x100c0c}, {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, + {0x100c2a, 0x100c39}, {0x100c58, 0x100c5a}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, + {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100d05, 0x100d0c}, + {0x100d0e, 0x100d10}, {0x100d12, 0x100d3a}, {0x100d54, 0x100d56}, {0x100d5f, 0x100d61}, + {0x100d7a, 0x100d7f}, {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, + {0x100dc0, 0x100dc6}, {0x100e01, 0x100e30}, {0x100e40, 0x100e46}, {0x100e94, 0x100e97}, + {0x100e99, 0x100e9f}, {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb0}, {0x100ec0, 0x100ec4}, + {0x100edc, 0x100edf}, {0x100f40, 0x100f47}, {0x100f49, 0x100f6c}, {0x100f88, 0x100f8c}, + {0x101000, 0x10102a}, {0x101050, 0x101055}, {0x10105a, 0x10105d}, {0x10106e, 0x101070}, + {0x101075, 0x101081}, {0x1010a0, 0x1010c5}, {0x1010d0, 0x1010fa}, {0x1010fc, 0x101248}, + {0x10124a, 0x10124d}, {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, + {0x10128a, 0x10128d}, {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, + {0x1012c2, 0x1012c5}, {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, + {0x101318, 0x10135a}, {0x101380, 0x10138f}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, + {0x101401, 0x10166c}, {0x10166f, 0x10167f}, {0x101681, 0x10169a}, {0x1016a0, 0x1016ea}, + {0x1016f1, 0x1016f8}, {0x101700, 0x10170c}, {0x10170e, 0x101711}, {0x101720, 0x101731}, + {0x101740, 0x101751}, {0x101760, 0x10176c}, {0x10176e, 0x101770}, {0x101780, 0x1017b3}, + {0x101820, 0x101877}, {0x101880, 0x101884}, {0x101887, 0x1018a8}, {0x1018b0, 0x1018f5}, + {0x101900, 0x10191e}, {0x101950, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, + {0x1019b0, 0x1019c9}, {0x101a00, 0x101a16}, {0x101a20, 0x101a54}, {0x101b05, 0x101b33}, + {0x101b45, 0x101b4b}, {0x101b83, 0x101ba0}, {0x101bba, 0x101be5}, {0x101c00, 0x101c23}, + {0x101c4d, 0x101c4f}, {0x101c5a, 0x101c7d}, {0x101c80, 0x101c88}, {0x101ce9, 0x101cec}, + {0x101cee, 0x101cf1}, {0x101d00, 0x101dbf}, {0x101e00, 0x101f15}, {0x101f18, 0x101f1d}, + {0x101f20, 0x101f45}, {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, + {0x101f80, 0x101fb4}, {0x101fb6, 0x101fbc}, {0x101fc2, 0x101fc4}, {0x101fc6, 0x101fcc}, + {0x101fd0, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fe0, 0x101fec}, {0x101ff2, 0x101ff4}, + {0x101ff6, 0x101ffc}, {0x102090, 0x10209c}, {0x10210a, 0x102113}, {0x102119, 0x10211d}, + {0x10212a, 0x10212d}, {0x10212f, 0x102139}, {0x10213c, 0x10213f}, {0x102145, 0x102149}, + {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102ce4}, {0x102ceb, 0x102cee}, + {0x102d00, 0x102d25}, {0x102d30, 0x102d67}, {0x102d80, 0x102d96}, {0x102da0, 0x102da6}, + {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, + {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x103031, 0x103035}, + {0x103041, 0x103096}, {0x10309d, 0x10309f}, {0x1030a1, 0x1030fa}, {0x1030fc, 0x1030ff}, + {0x103105, 0x10312e}, {0x103131, 0x10318e}, {0x1031a0, 0x1031ba}, {0x1031f0, 0x1031ff}, + {0x103400, 0x104db5}, {0x104e00, 0x109fea}, {0x10a000, 0x10a48c}, {0x10a4d0, 0x10a4fd}, + {0x10a500, 0x10a60c}, {0x10a610, 0x10a61f}, {0x10a640, 0x10a66e}, {0x10a67f, 0x10a69d}, + {0x10a6a0, 0x10a6e5}, {0x10a717, 0x10a71f}, {0x10a722, 0x10a788}, {0x10a78b, 0x10a7ae}, + {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a801}, {0x10a803, 0x10a805}, {0x10a807, 0x10a80a}, + {0x10a80c, 0x10a822}, {0x10a840, 0x10a873}, {0x10a882, 0x10a8b3}, {0x10a8f2, 0x10a8f7}, + {0x10a90a, 0x10a925}, {0x10a930, 0x10a946}, {0x10a960, 0x10a97c}, {0x10a984, 0x10a9b2}, + {0x10a9e0, 0x10a9e4}, {0x10a9e6, 0x10a9ef}, {0x10a9fa, 0x10a9fe}, {0x10aa00, 0x10aa28}, + {0x10aa40, 0x10aa42}, {0x10aa44, 0x10aa4b}, {0x10aa60, 0x10aa76}, {0x10aa7e, 0x10aaaf}, + {0x10aab9, 0x10aabd}, {0x10aadb, 0x10aadd}, {0x10aae0, 0x10aaea}, {0x10aaf2, 0x10aaf4}, + {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, {0x10ab20, 0x10ab26}, + {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab5a}, {0x10ab5c, 0x10ab65}, {0x10ab70, 0x10abe2}, + {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, {0x10f900, 0x10fa6d}, + {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10fb1f, 0x10fb28}, + {0x10fb2a, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbb1}, {0x10fbd3, 0x10fd3d}, + {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfb}, {0x10fe70, 0x10fe74}, + {0x10fe76, 0x10fefc}, {0x10ff21, 0x10ff3a}, {0x10ff41, 0x10ff5a}, {0x10ff66, 0x10ffbe}, + {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc} #endif }; @@ -250,28 +1250,309 @@ static const chr alphaCharTable[] = { 0x38c, 0x559, 0x66e, 0x66f, 0x6d5, 0x6e5, 0x6e6, 0x6ee, 0x6ef, 0x6ff, 0x710, 0x7b1, 0x7f4, 0x7f5, 0x7fa, 0x81a, 0x824, 0x828, 0x93d, 0x950, 0x98f, 0x990, 0x9b2, 0x9bd, 0x9ce, 0x9dc, 0x9dd, - 0x9f0, 0x9f1, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, - 0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, 0xaf9, - 0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, 0xb83, - 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, 0xc3d, - 0xc60, 0xc61, 0xc80, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, 0xcf2, - 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, 0xe87, - 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, 0xeb3, - 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, 0x10c7, - 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, 0x1baf, - 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, 0x2102, - 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, 0x2cf2, - 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, 0x303c, - 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, - 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 + 0x9f0, 0x9f1, 0x9fc, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, + 0xa38, 0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, + 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, + 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, + 0xc3d, 0xc60, 0xc61, 0xc80, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, + 0xcf2, 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, + 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, + 0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, + 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, + 0x1baf, 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, + 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, + 0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, + 0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, + 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 #if TCL_UTF_MAX > 4 - ,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be, - 0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332, - 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x11c40, - 0x16f50, 0x16fe0, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, - 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, - 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, - 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e + ,0x100aa, 0x100b5, 0x100ba, 0x102ec, 0x102ee, 0x10376, 0x10377, 0x1037f, 0x10386, + 0x1038c, 0x10559, 0x1066e, 0x1066f, 0x106d5, 0x106e5, 0x106e6, 0x106ee, 0x106ef, + 0x106ff, 0x10710, 0x107b1, 0x107f4, 0x107f5, 0x107fa, 0x1081a, 0x10824, 0x10828, + 0x1093d, 0x10950, 0x1098f, 0x10990, 0x109b2, 0x109bd, 0x109ce, 0x109dc, 0x109dd, + 0x109f0, 0x109f1, 0x109fc, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, + 0x10a38, 0x10a39, 0x10a5e, 0x10ab2, 0x10ab3, 0x10abd, 0x10ad0, 0x10ae0, 0x10ae1, + 0x10af9, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b3d, 0x10b5c, 0x10b5d, 0x10b71, + 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, 0x10ba3, 0x10ba4, 0x10bd0, + 0x10c3d, 0x10c60, 0x10c61, 0x10c80, 0x10cbd, 0x10cde, 0x10ce0, 0x10ce1, 0x10cf1, + 0x10cf2, 0x10d3d, 0x10d4e, 0x10dbd, 0x10e32, 0x10e33, 0x10e81, 0x10e82, 0x10e84, + 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, 0x10eb2, + 0x10eb3, 0x10ebd, 0x10ec6, 0x10f00, 0x1103f, 0x11061, 0x11065, 0x11066, 0x1108e, + 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x117d7, 0x117dc, 0x118aa, 0x11aa7, 0x11bae, + 0x11baf, 0x11cf5, 0x11cf6, 0x11f59, 0x11f5b, 0x11f5d, 0x11fbe, 0x12071, 0x1207f, + 0x12102, 0x12107, 0x12115, 0x12124, 0x12126, 0x12128, 0x1214e, 0x12183, 0x12184, + 0x12cf2, 0x12cf3, 0x12d27, 0x12d2d, 0x12d6f, 0x12e2f, 0x13005, 0x13006, 0x1303b, + 0x1303c, 0x1a62a, 0x1a62b, 0x1a8fb, 0x1a8fd, 0x1a9cf, 0x1aa7a, 0x1aab1, 0x1aab5, + 0x1aab6, 0x1aac0, 0x1aac2, 0x1fb1d, 0x1fb3e, 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, + 0x200aa, 0x200b5, 0x200ba, 0x202ec, 0x202ee, 0x20376, 0x20377, 0x2037f, 0x20386, + 0x2038c, 0x20559, 0x2066e, 0x2066f, 0x206d5, 0x206e5, 0x206e6, 0x206ee, 0x206ef, + 0x206ff, 0x20710, 0x207b1, 0x207f4, 0x207f5, 0x207fa, 0x2081a, 0x20824, 0x20828, + 0x2093d, 0x20950, 0x2098f, 0x20990, 0x209b2, 0x209bd, 0x209ce, 0x209dc, 0x209dd, + 0x209f0, 0x209f1, 0x209fc, 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, + 0x20a38, 0x20a39, 0x20a5e, 0x20ab2, 0x20ab3, 0x20abd, 0x20ad0, 0x20ae0, 0x20ae1, + 0x20af9, 0x20b0f, 0x20b10, 0x20b32, 0x20b33, 0x20b3d, 0x20b5c, 0x20b5d, 0x20b71, + 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, + 0x20c3d, 0x20c60, 0x20c61, 0x20c80, 0x20cbd, 0x20cde, 0x20ce0, 0x20ce1, 0x20cf1, + 0x20cf2, 0x20d3d, 0x20d4e, 0x20dbd, 0x20e32, 0x20e33, 0x20e81, 0x20e82, 0x20e84, + 0x20e87, 0x20e88, 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20eb2, + 0x20eb3, 0x20ebd, 0x20ec6, 0x20f00, 0x2103f, 0x21061, 0x21065, 0x21066, 0x2108e, + 0x210c7, 0x210cd, 0x21258, 0x212c0, 0x217d7, 0x217dc, 0x218aa, 0x21aa7, 0x21bae, + 0x21baf, 0x21cf5, 0x21cf6, 0x21f59, 0x21f5b, 0x21f5d, 0x21fbe, 0x22071, 0x2207f, + 0x22102, 0x22107, 0x22115, 0x22124, 0x22126, 0x22128, 0x2214e, 0x22183, 0x22184, + 0x22cf2, 0x22cf3, 0x22d27, 0x22d2d, 0x22d6f, 0x22e2f, 0x23005, 0x23006, 0x2303b, + 0x2303c, 0x2a62a, 0x2a62b, 0x2a8fb, 0x2a8fd, 0x2a9cf, 0x2aa7a, 0x2aab1, 0x2aab5, + 0x2aab6, 0x2aac0, 0x2aac2, 0x2fb1d, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, 0x2fb44, + 0x300aa, 0x300b5, 0x300ba, 0x302ec, 0x302ee, 0x30376, 0x30377, 0x3037f, 0x30386, + 0x3038c, 0x30559, 0x3066e, 0x3066f, 0x306d5, 0x306e5, 0x306e6, 0x306ee, 0x306ef, + 0x306ff, 0x30710, 0x307b1, 0x307f4, 0x307f5, 0x307fa, 0x3081a, 0x30824, 0x30828, + 0x3093d, 0x30950, 0x3098f, 0x30990, 0x309b2, 0x309bd, 0x309ce, 0x309dc, 0x309dd, + 0x309f0, 0x309f1, 0x309fc, 0x30a0f, 0x30a10, 0x30a32, 0x30a33, 0x30a35, 0x30a36, + 0x30a38, 0x30a39, 0x30a5e, 0x30ab2, 0x30ab3, 0x30abd, 0x30ad0, 0x30ae0, 0x30ae1, + 0x30af9, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b3d, 0x30b5c, 0x30b5d, 0x30b71, + 0x30b83, 0x30b99, 0x30b9a, 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, + 0x30c3d, 0x30c60, 0x30c61, 0x30c80, 0x30cbd, 0x30cde, 0x30ce0, 0x30ce1, 0x30cf1, + 0x30cf2, 0x30d3d, 0x30d4e, 0x30dbd, 0x30e32, 0x30e33, 0x30e81, 0x30e82, 0x30e84, + 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, 0x30ea7, 0x30eaa, 0x30eab, 0x30eb2, + 0x30eb3, 0x30ebd, 0x30ec6, 0x30f00, 0x3103f, 0x31061, 0x31065, 0x31066, 0x3108e, + 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x317d7, 0x317dc, 0x318aa, 0x31aa7, 0x31bae, + 0x31baf, 0x31cf5, 0x31cf6, 0x31f59, 0x31f5b, 0x31f5d, 0x31fbe, 0x32071, 0x3207f, + 0x32102, 0x32107, 0x32115, 0x32124, 0x32126, 0x32128, 0x3214e, 0x32183, 0x32184, + 0x32cf2, 0x32cf3, 0x32d27, 0x32d2d, 0x32d6f, 0x32e2f, 0x33005, 0x33006, 0x3303b, + 0x3303c, 0x3a62a, 0x3a62b, 0x3a8fb, 0x3a8fd, 0x3a9cf, 0x3aa7a, 0x3aab1, 0x3aab5, + 0x3aab6, 0x3aac0, 0x3aac2, 0x3fb1d, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, + 0x400aa, 0x400b5, 0x400ba, 0x402ec, 0x402ee, 0x40376, 0x40377, 0x4037f, 0x40386, + 0x4038c, 0x40559, 0x4066e, 0x4066f, 0x406d5, 0x406e5, 0x406e6, 0x406ee, 0x406ef, + 0x406ff, 0x40710, 0x407b1, 0x407f4, 0x407f5, 0x407fa, 0x4081a, 0x40824, 0x40828, + 0x4093d, 0x40950, 0x4098f, 0x40990, 0x409b2, 0x409bd, 0x409ce, 0x409dc, 0x409dd, + 0x409f0, 0x409f1, 0x409fc, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, + 0x40a38, 0x40a39, 0x40a5e, 0x40ab2, 0x40ab3, 0x40abd, 0x40ad0, 0x40ae0, 0x40ae1, + 0x40af9, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b3d, 0x40b5c, 0x40b5d, 0x40b71, + 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, 0x40ba3, 0x40ba4, 0x40bd0, + 0x40c3d, 0x40c60, 0x40c61, 0x40c80, 0x40cbd, 0x40cde, 0x40ce0, 0x40ce1, 0x40cf1, + 0x40cf2, 0x40d3d, 0x40d4e, 0x40dbd, 0x40e32, 0x40e33, 0x40e81, 0x40e82, 0x40e84, + 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, 0x40eb2, + 0x40eb3, 0x40ebd, 0x40ec6, 0x40f00, 0x4103f, 0x41061, 0x41065, 0x41066, 0x4108e, + 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x417d7, 0x417dc, 0x418aa, 0x41aa7, 0x41bae, + 0x41baf, 0x41cf5, 0x41cf6, 0x41f59, 0x41f5b, 0x41f5d, 0x41fbe, 0x42071, 0x4207f, + 0x42102, 0x42107, 0x42115, 0x42124, 0x42126, 0x42128, 0x4214e, 0x42183, 0x42184, + 0x42cf2, 0x42cf3, 0x42d27, 0x42d2d, 0x42d6f, 0x42e2f, 0x43005, 0x43006, 0x4303b, + 0x4303c, 0x4a62a, 0x4a62b, 0x4a8fb, 0x4a8fd, 0x4a9cf, 0x4aa7a, 0x4aab1, 0x4aab5, + 0x4aab6, 0x4aac0, 0x4aac2, 0x4fb1d, 0x4fb3e, 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, + 0x500aa, 0x500b5, 0x500ba, 0x502ec, 0x502ee, 0x50376, 0x50377, 0x5037f, 0x50386, + 0x5038c, 0x50559, 0x5066e, 0x5066f, 0x506d5, 0x506e5, 0x506e6, 0x506ee, 0x506ef, + 0x506ff, 0x50710, 0x507b1, 0x507f4, 0x507f5, 0x507fa, 0x5081a, 0x50824, 0x50828, + 0x5093d, 0x50950, 0x5098f, 0x50990, 0x509b2, 0x509bd, 0x509ce, 0x509dc, 0x509dd, + 0x509f0, 0x509f1, 0x509fc, 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, + 0x50a38, 0x50a39, 0x50a5e, 0x50ab2, 0x50ab3, 0x50abd, 0x50ad0, 0x50ae0, 0x50ae1, + 0x50af9, 0x50b0f, 0x50b10, 0x50b32, 0x50b33, 0x50b3d, 0x50b5c, 0x50b5d, 0x50b71, + 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, + 0x50c3d, 0x50c60, 0x50c61, 0x50c80, 0x50cbd, 0x50cde, 0x50ce0, 0x50ce1, 0x50cf1, + 0x50cf2, 0x50d3d, 0x50d4e, 0x50dbd, 0x50e32, 0x50e33, 0x50e81, 0x50e82, 0x50e84, + 0x50e87, 0x50e88, 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50eb2, + 0x50eb3, 0x50ebd, 0x50ec6, 0x50f00, 0x5103f, 0x51061, 0x51065, 0x51066, 0x5108e, + 0x510c7, 0x510cd, 0x51258, 0x512c0, 0x517d7, 0x517dc, 0x518aa, 0x51aa7, 0x51bae, + 0x51baf, 0x51cf5, 0x51cf6, 0x51f59, 0x51f5b, 0x51f5d, 0x51fbe, 0x52071, 0x5207f, + 0x52102, 0x52107, 0x52115, 0x52124, 0x52126, 0x52128, 0x5214e, 0x52183, 0x52184, + 0x52cf2, 0x52cf3, 0x52d27, 0x52d2d, 0x52d6f, 0x52e2f, 0x53005, 0x53006, 0x5303b, + 0x5303c, 0x5a62a, 0x5a62b, 0x5a8fb, 0x5a8fd, 0x5a9cf, 0x5aa7a, 0x5aab1, 0x5aab5, + 0x5aab6, 0x5aac0, 0x5aac2, 0x5fb1d, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, 0x5fb44, + 0x600aa, 0x600b5, 0x600ba, 0x602ec, 0x602ee, 0x60376, 0x60377, 0x6037f, 0x60386, + 0x6038c, 0x60559, 0x6066e, 0x6066f, 0x606d5, 0x606e5, 0x606e6, 0x606ee, 0x606ef, + 0x606ff, 0x60710, 0x607b1, 0x607f4, 0x607f5, 0x607fa, 0x6081a, 0x60824, 0x60828, + 0x6093d, 0x60950, 0x6098f, 0x60990, 0x609b2, 0x609bd, 0x609ce, 0x609dc, 0x609dd, + 0x609f0, 0x609f1, 0x609fc, 0x60a0f, 0x60a10, 0x60a32, 0x60a33, 0x60a35, 0x60a36, + 0x60a38, 0x60a39, 0x60a5e, 0x60ab2, 0x60ab3, 0x60abd, 0x60ad0, 0x60ae0, 0x60ae1, + 0x60af9, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b3d, 0x60b5c, 0x60b5d, 0x60b71, + 0x60b83, 0x60b99, 0x60b9a, 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, + 0x60c3d, 0x60c60, 0x60c61, 0x60c80, 0x60cbd, 0x60cde, 0x60ce0, 0x60ce1, 0x60cf1, + 0x60cf2, 0x60d3d, 0x60d4e, 0x60dbd, 0x60e32, 0x60e33, 0x60e81, 0x60e82, 0x60e84, + 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, 0x60ea7, 0x60eaa, 0x60eab, 0x60eb2, + 0x60eb3, 0x60ebd, 0x60ec6, 0x60f00, 0x6103f, 0x61061, 0x61065, 0x61066, 0x6108e, + 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x617d7, 0x617dc, 0x618aa, 0x61aa7, 0x61bae, + 0x61baf, 0x61cf5, 0x61cf6, 0x61f59, 0x61f5b, 0x61f5d, 0x61fbe, 0x62071, 0x6207f, + 0x62102, 0x62107, 0x62115, 0x62124, 0x62126, 0x62128, 0x6214e, 0x62183, 0x62184, + 0x62cf2, 0x62cf3, 0x62d27, 0x62d2d, 0x62d6f, 0x62e2f, 0x63005, 0x63006, 0x6303b, + 0x6303c, 0x6a62a, 0x6a62b, 0x6a8fb, 0x6a8fd, 0x6a9cf, 0x6aa7a, 0x6aab1, 0x6aab5, + 0x6aab6, 0x6aac0, 0x6aac2, 0x6fb1d, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, + 0x700aa, 0x700b5, 0x700ba, 0x702ec, 0x702ee, 0x70376, 0x70377, 0x7037f, 0x70386, + 0x7038c, 0x70559, 0x7066e, 0x7066f, 0x706d5, 0x706e5, 0x706e6, 0x706ee, 0x706ef, + 0x706ff, 0x70710, 0x707b1, 0x707f4, 0x707f5, 0x707fa, 0x7081a, 0x70824, 0x70828, + 0x7093d, 0x70950, 0x7098f, 0x70990, 0x709b2, 0x709bd, 0x709ce, 0x709dc, 0x709dd, + 0x709f0, 0x709f1, 0x709fc, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, + 0x70a38, 0x70a39, 0x70a5e, 0x70ab2, 0x70ab3, 0x70abd, 0x70ad0, 0x70ae0, 0x70ae1, + 0x70af9, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b3d, 0x70b5c, 0x70b5d, 0x70b71, + 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, 0x70ba3, 0x70ba4, 0x70bd0, + 0x70c3d, 0x70c60, 0x70c61, 0x70c80, 0x70cbd, 0x70cde, 0x70ce0, 0x70ce1, 0x70cf1, + 0x70cf2, 0x70d3d, 0x70d4e, 0x70dbd, 0x70e32, 0x70e33, 0x70e81, 0x70e82, 0x70e84, + 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, 0x70eb2, + 0x70eb3, 0x70ebd, 0x70ec6, 0x70f00, 0x7103f, 0x71061, 0x71065, 0x71066, 0x7108e, + 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x717d7, 0x717dc, 0x718aa, 0x71aa7, 0x71bae, + 0x71baf, 0x71cf5, 0x71cf6, 0x71f59, 0x71f5b, 0x71f5d, 0x71fbe, 0x72071, 0x7207f, + 0x72102, 0x72107, 0x72115, 0x72124, 0x72126, 0x72128, 0x7214e, 0x72183, 0x72184, + 0x72cf2, 0x72cf3, 0x72d27, 0x72d2d, 0x72d6f, 0x72e2f, 0x73005, 0x73006, 0x7303b, + 0x7303c, 0x7a62a, 0x7a62b, 0x7a8fb, 0x7a8fd, 0x7a9cf, 0x7aa7a, 0x7aab1, 0x7aab5, + 0x7aab6, 0x7aac0, 0x7aac2, 0x7fb1d, 0x7fb3e, 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, + 0x800aa, 0x800b5, 0x800ba, 0x802ec, 0x802ee, 0x80376, 0x80377, 0x8037f, 0x80386, + 0x8038c, 0x80559, 0x8066e, 0x8066f, 0x806d5, 0x806e5, 0x806e6, 0x806ee, 0x806ef, + 0x806ff, 0x80710, 0x807b1, 0x807f4, 0x807f5, 0x807fa, 0x8081a, 0x80824, 0x80828, + 0x8093d, 0x80950, 0x8098f, 0x80990, 0x809b2, 0x809bd, 0x809ce, 0x809dc, 0x809dd, + 0x809f0, 0x809f1, 0x809fc, 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, + 0x80a38, 0x80a39, 0x80a5e, 0x80ab2, 0x80ab3, 0x80abd, 0x80ad0, 0x80ae0, 0x80ae1, + 0x80af9, 0x80b0f, 0x80b10, 0x80b32, 0x80b33, 0x80b3d, 0x80b5c, 0x80b5d, 0x80b71, + 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, + 0x80c3d, 0x80c60, 0x80c61, 0x80c80, 0x80cbd, 0x80cde, 0x80ce0, 0x80ce1, 0x80cf1, + 0x80cf2, 0x80d3d, 0x80d4e, 0x80dbd, 0x80e32, 0x80e33, 0x80e81, 0x80e82, 0x80e84, + 0x80e87, 0x80e88, 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80eb2, + 0x80eb3, 0x80ebd, 0x80ec6, 0x80f00, 0x8103f, 0x81061, 0x81065, 0x81066, 0x8108e, + 0x810c7, 0x810cd, 0x81258, 0x812c0, 0x817d7, 0x817dc, 0x818aa, 0x81aa7, 0x81bae, + 0x81baf, 0x81cf5, 0x81cf6, 0x81f59, 0x81f5b, 0x81f5d, 0x81fbe, 0x82071, 0x8207f, + 0x82102, 0x82107, 0x82115, 0x82124, 0x82126, 0x82128, 0x8214e, 0x82183, 0x82184, + 0x82cf2, 0x82cf3, 0x82d27, 0x82d2d, 0x82d6f, 0x82e2f, 0x83005, 0x83006, 0x8303b, + 0x8303c, 0x8a62a, 0x8a62b, 0x8a8fb, 0x8a8fd, 0x8a9cf, 0x8aa7a, 0x8aab1, 0x8aab5, + 0x8aab6, 0x8aac0, 0x8aac2, 0x8fb1d, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, 0x8fb44, + 0x900aa, 0x900b5, 0x900ba, 0x902ec, 0x902ee, 0x90376, 0x90377, 0x9037f, 0x90386, + 0x9038c, 0x90559, 0x9066e, 0x9066f, 0x906d5, 0x906e5, 0x906e6, 0x906ee, 0x906ef, + 0x906ff, 0x90710, 0x907b1, 0x907f4, 0x907f5, 0x907fa, 0x9081a, 0x90824, 0x90828, + 0x9093d, 0x90950, 0x9098f, 0x90990, 0x909b2, 0x909bd, 0x909ce, 0x909dc, 0x909dd, + 0x909f0, 0x909f1, 0x909fc, 0x90a0f, 0x90a10, 0x90a32, 0x90a33, 0x90a35, 0x90a36, + 0x90a38, 0x90a39, 0x90a5e, 0x90ab2, 0x90ab3, 0x90abd, 0x90ad0, 0x90ae0, 0x90ae1, + 0x90af9, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b3d, 0x90b5c, 0x90b5d, 0x90b71, + 0x90b83, 0x90b99, 0x90b9a, 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, + 0x90c3d, 0x90c60, 0x90c61, 0x90c80, 0x90cbd, 0x90cde, 0x90ce0, 0x90ce1, 0x90cf1, + 0x90cf2, 0x90d3d, 0x90d4e, 0x90dbd, 0x90e32, 0x90e33, 0x90e81, 0x90e82, 0x90e84, + 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, 0x90ea7, 0x90eaa, 0x90eab, 0x90eb2, + 0x90eb3, 0x90ebd, 0x90ec6, 0x90f00, 0x9103f, 0x91061, 0x91065, 0x91066, 0x9108e, + 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x917d7, 0x917dc, 0x918aa, 0x91aa7, 0x91bae, + 0x91baf, 0x91cf5, 0x91cf6, 0x91f59, 0x91f5b, 0x91f5d, 0x91fbe, 0x92071, 0x9207f, + 0x92102, 0x92107, 0x92115, 0x92124, 0x92126, 0x92128, 0x9214e, 0x92183, 0x92184, + 0x92cf2, 0x92cf3, 0x92d27, 0x92d2d, 0x92d6f, 0x92e2f, 0x93005, 0x93006, 0x9303b, + 0x9303c, 0x9a62a, 0x9a62b, 0x9a8fb, 0x9a8fd, 0x9a9cf, 0x9aa7a, 0x9aab1, 0x9aab5, + 0x9aab6, 0x9aac0, 0x9aac2, 0x9fb1d, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, + 0xa00aa, 0xa00b5, 0xa00ba, 0xa02ec, 0xa02ee, 0xa0376, 0xa0377, 0xa037f, 0xa0386, + 0xa038c, 0xa0559, 0xa066e, 0xa066f, 0xa06d5, 0xa06e5, 0xa06e6, 0xa06ee, 0xa06ef, + 0xa06ff, 0xa0710, 0xa07b1, 0xa07f4, 0xa07f5, 0xa07fa, 0xa081a, 0xa0824, 0xa0828, + 0xa093d, 0xa0950, 0xa098f, 0xa0990, 0xa09b2, 0xa09bd, 0xa09ce, 0xa09dc, 0xa09dd, + 0xa09f0, 0xa09f1, 0xa09fc, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, + 0xa0a38, 0xa0a39, 0xa0a5e, 0xa0ab2, 0xa0ab3, 0xa0abd, 0xa0ad0, 0xa0ae0, 0xa0ae1, + 0xa0af9, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b3d, 0xa0b5c, 0xa0b5d, 0xa0b71, + 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, 0xa0ba3, 0xa0ba4, 0xa0bd0, + 0xa0c3d, 0xa0c60, 0xa0c61, 0xa0c80, 0xa0cbd, 0xa0cde, 0xa0ce0, 0xa0ce1, 0xa0cf1, + 0xa0cf2, 0xa0d3d, 0xa0d4e, 0xa0dbd, 0xa0e32, 0xa0e33, 0xa0e81, 0xa0e82, 0xa0e84, + 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, 0xa0eb2, + 0xa0eb3, 0xa0ebd, 0xa0ec6, 0xa0f00, 0xa103f, 0xa1061, 0xa1065, 0xa1066, 0xa108e, + 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa17d7, 0xa17dc, 0xa18aa, 0xa1aa7, 0xa1bae, + 0xa1baf, 0xa1cf5, 0xa1cf6, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1fbe, 0xa2071, 0xa207f, + 0xa2102, 0xa2107, 0xa2115, 0xa2124, 0xa2126, 0xa2128, 0xa214e, 0xa2183, 0xa2184, + 0xa2cf2, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2e2f, 0xa3005, 0xa3006, 0xa303b, + 0xa303c, 0xaa62a, 0xaa62b, 0xaa8fb, 0xaa8fd, 0xaa9cf, 0xaaa7a, 0xaaab1, 0xaaab5, + 0xaaab6, 0xaaac0, 0xaaac2, 0xafb1d, 0xafb3e, 0xafb40, 0xafb41, 0xafb43, 0xafb44, + 0xb00aa, 0xb00b5, 0xb00ba, 0xb02ec, 0xb02ee, 0xb0376, 0xb0377, 0xb037f, 0xb0386, + 0xb038c, 0xb0559, 0xb066e, 0xb066f, 0xb06d5, 0xb06e5, 0xb06e6, 0xb06ee, 0xb06ef, + 0xb06ff, 0xb0710, 0xb07b1, 0xb07f4, 0xb07f5, 0xb07fa, 0xb081a, 0xb0824, 0xb0828, + 0xb093d, 0xb0950, 0xb098f, 0xb0990, 0xb09b2, 0xb09bd, 0xb09ce, 0xb09dc, 0xb09dd, + 0xb09f0, 0xb09f1, 0xb09fc, 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, + 0xb0a38, 0xb0a39, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0abd, 0xb0ad0, 0xb0ae0, 0xb0ae1, + 0xb0af9, 0xb0b0f, 0xb0b10, 0xb0b32, 0xb0b33, 0xb0b3d, 0xb0b5c, 0xb0b5d, 0xb0b71, + 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, + 0xb0c3d, 0xb0c60, 0xb0c61, 0xb0c80, 0xb0cbd, 0xb0cde, 0xb0ce0, 0xb0ce1, 0xb0cf1, + 0xb0cf2, 0xb0d3d, 0xb0d4e, 0xb0dbd, 0xb0e32, 0xb0e33, 0xb0e81, 0xb0e82, 0xb0e84, + 0xb0e87, 0xb0e88, 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0eb2, + 0xb0eb3, 0xb0ebd, 0xb0ec6, 0xb0f00, 0xb103f, 0xb1061, 0xb1065, 0xb1066, 0xb108e, + 0xb10c7, 0xb10cd, 0xb1258, 0xb12c0, 0xb17d7, 0xb17dc, 0xb18aa, 0xb1aa7, 0xb1bae, + 0xb1baf, 0xb1cf5, 0xb1cf6, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1fbe, 0xb2071, 0xb207f, + 0xb2102, 0xb2107, 0xb2115, 0xb2124, 0xb2126, 0xb2128, 0xb214e, 0xb2183, 0xb2184, + 0xb2cf2, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2e2f, 0xb3005, 0xb3006, 0xb303b, + 0xb303c, 0xba62a, 0xba62b, 0xba8fb, 0xba8fd, 0xba9cf, 0xbaa7a, 0xbaab1, 0xbaab5, + 0xbaab6, 0xbaac0, 0xbaac2, 0xbfb1d, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, 0xbfb44, + 0xc00aa, 0xc00b5, 0xc00ba, 0xc02ec, 0xc02ee, 0xc0376, 0xc0377, 0xc037f, 0xc0386, + 0xc038c, 0xc0559, 0xc066e, 0xc066f, 0xc06d5, 0xc06e5, 0xc06e6, 0xc06ee, 0xc06ef, + 0xc06ff, 0xc0710, 0xc07b1, 0xc07f4, 0xc07f5, 0xc07fa, 0xc081a, 0xc0824, 0xc0828, + 0xc093d, 0xc0950, 0xc098f, 0xc0990, 0xc09b2, 0xc09bd, 0xc09ce, 0xc09dc, 0xc09dd, + 0xc09f0, 0xc09f1, 0xc09fc, 0xc0a0f, 0xc0a10, 0xc0a32, 0xc0a33, 0xc0a35, 0xc0a36, + 0xc0a38, 0xc0a39, 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0abd, 0xc0ad0, 0xc0ae0, 0xc0ae1, + 0xc0af9, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b3d, 0xc0b5c, 0xc0b5d, 0xc0b71, + 0xc0b83, 0xc0b99, 0xc0b9a, 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, + 0xc0c3d, 0xc0c60, 0xc0c61, 0xc0c80, 0xc0cbd, 0xc0cde, 0xc0ce0, 0xc0ce1, 0xc0cf1, + 0xc0cf2, 0xc0d3d, 0xc0d4e, 0xc0dbd, 0xc0e32, 0xc0e33, 0xc0e81, 0xc0e82, 0xc0e84, + 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0eb2, + 0xc0eb3, 0xc0ebd, 0xc0ec6, 0xc0f00, 0xc103f, 0xc1061, 0xc1065, 0xc1066, 0xc108e, + 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc17d7, 0xc17dc, 0xc18aa, 0xc1aa7, 0xc1bae, + 0xc1baf, 0xc1cf5, 0xc1cf6, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1fbe, 0xc2071, 0xc207f, + 0xc2102, 0xc2107, 0xc2115, 0xc2124, 0xc2126, 0xc2128, 0xc214e, 0xc2183, 0xc2184, + 0xc2cf2, 0xc2cf3, 0xc2d27, 0xc2d2d, 0xc2d6f, 0xc2e2f, 0xc3005, 0xc3006, 0xc303b, + 0xc303c, 0xca62a, 0xca62b, 0xca8fb, 0xca8fd, 0xca9cf, 0xcaa7a, 0xcaab1, 0xcaab5, + 0xcaab6, 0xcaac0, 0xcaac2, 0xcfb1d, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, + 0xd00aa, 0xd00b5, 0xd00ba, 0xd02ec, 0xd02ee, 0xd0376, 0xd0377, 0xd037f, 0xd0386, + 0xd038c, 0xd0559, 0xd066e, 0xd066f, 0xd06d5, 0xd06e5, 0xd06e6, 0xd06ee, 0xd06ef, + 0xd06ff, 0xd0710, 0xd07b1, 0xd07f4, 0xd07f5, 0xd07fa, 0xd081a, 0xd0824, 0xd0828, + 0xd093d, 0xd0950, 0xd098f, 0xd0990, 0xd09b2, 0xd09bd, 0xd09ce, 0xd09dc, 0xd09dd, + 0xd09f0, 0xd09f1, 0xd09fc, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, + 0xd0a38, 0xd0a39, 0xd0a5e, 0xd0ab2, 0xd0ab3, 0xd0abd, 0xd0ad0, 0xd0ae0, 0xd0ae1, + 0xd0af9, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b3d, 0xd0b5c, 0xd0b5d, 0xd0b71, + 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, 0xd0ba3, 0xd0ba4, 0xd0bd0, + 0xd0c3d, 0xd0c60, 0xd0c61, 0xd0c80, 0xd0cbd, 0xd0cde, 0xd0ce0, 0xd0ce1, 0xd0cf1, + 0xd0cf2, 0xd0d3d, 0xd0d4e, 0xd0dbd, 0xd0e32, 0xd0e33, 0xd0e81, 0xd0e82, 0xd0e84, + 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, 0xd0eb2, + 0xd0eb3, 0xd0ebd, 0xd0ec6, 0xd0f00, 0xd103f, 0xd1061, 0xd1065, 0xd1066, 0xd108e, + 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd17d7, 0xd17dc, 0xd18aa, 0xd1aa7, 0xd1bae, + 0xd1baf, 0xd1cf5, 0xd1cf6, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1fbe, 0xd2071, 0xd207f, + 0xd2102, 0xd2107, 0xd2115, 0xd2124, 0xd2126, 0xd2128, 0xd214e, 0xd2183, 0xd2184, + 0xd2cf2, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2e2f, 0xd3005, 0xd3006, 0xd303b, + 0xd303c, 0xda62a, 0xda62b, 0xda8fb, 0xda8fd, 0xda9cf, 0xdaa7a, 0xdaab1, 0xdaab5, + 0xdaab6, 0xdaac0, 0xdaac2, 0xdfb1d, 0xdfb3e, 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, + 0xe00aa, 0xe00b5, 0xe00ba, 0xe02ec, 0xe02ee, 0xe0376, 0xe0377, 0xe037f, 0xe0386, + 0xe038c, 0xe0559, 0xe066e, 0xe066f, 0xe06d5, 0xe06e5, 0xe06e6, 0xe06ee, 0xe06ef, + 0xe06ff, 0xe0710, 0xe07b1, 0xe07f4, 0xe07f5, 0xe07fa, 0xe081a, 0xe0824, 0xe0828, + 0xe093d, 0xe0950, 0xe098f, 0xe0990, 0xe09b2, 0xe09bd, 0xe09ce, 0xe09dc, 0xe09dd, + 0xe09f0, 0xe09f1, 0xe09fc, 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, + 0xe0a38, 0xe0a39, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0abd, 0xe0ad0, 0xe0ae0, 0xe0ae1, + 0xe0af9, 0xe0b0f, 0xe0b10, 0xe0b32, 0xe0b33, 0xe0b3d, 0xe0b5c, 0xe0b5d, 0xe0b71, + 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, + 0xe0c3d, 0xe0c60, 0xe0c61, 0xe0c80, 0xe0cbd, 0xe0cde, 0xe0ce0, 0xe0ce1, 0xe0cf1, + 0xe0cf2, 0xe0d3d, 0xe0d4e, 0xe0dbd, 0xe0e32, 0xe0e33, 0xe0e81, 0xe0e82, 0xe0e84, + 0xe0e87, 0xe0e88, 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0eb2, + 0xe0eb3, 0xe0ebd, 0xe0ec6, 0xe0f00, 0xe103f, 0xe1061, 0xe1065, 0xe1066, 0xe108e, + 0xe10c7, 0xe10cd, 0xe1258, 0xe12c0, 0xe17d7, 0xe17dc, 0xe18aa, 0xe1aa7, 0xe1bae, + 0xe1baf, 0xe1cf5, 0xe1cf6, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1fbe, 0xe2071, 0xe207f, + 0xe2102, 0xe2107, 0xe2115, 0xe2124, 0xe2126, 0xe2128, 0xe214e, 0xe2183, 0xe2184, + 0xe2cf2, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2e2f, 0xe3005, 0xe3006, 0xe303b, + 0xe303c, 0xea62a, 0xea62b, 0xea8fb, 0xea8fd, 0xea9cf, 0xeaa7a, 0xeaab1, 0xeaab5, + 0xeaab6, 0xeaac0, 0xeaac2, 0xefb1d, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, 0xefb44, + 0xf00aa, 0xf00b5, 0xf00ba, 0xf02ec, 0xf02ee, 0xf0376, 0xf0377, 0xf037f, 0xf0386, + 0xf038c, 0xf0559, 0xf066e, 0xf066f, 0xf06d5, 0xf06e5, 0xf06e6, 0xf06ee, 0xf06ef, + 0xf06ff, 0xf0710, 0xf07b1, 0xf07f4, 0xf07f5, 0xf07fa, 0xf081a, 0xf0824, 0xf0828, + 0xf093d, 0xf0950, 0xf098f, 0xf0990, 0xf09b2, 0xf09bd, 0xf09ce, 0xf09dc, 0xf09dd, + 0xf09f0, 0xf09f1, 0xf09fc, 0xf0a0f, 0xf0a10, 0xf0a32, 0xf0a33, 0xf0a35, 0xf0a36, + 0xf0a38, 0xf0a39, 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0abd, 0xf0ad0, 0xf0ae0, 0xf0ae1, + 0xf0af9, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b3d, 0xf0b5c, 0xf0b5d, 0xf0b71, + 0xf0b83, 0xf0b99, 0xf0b9a, 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, + 0xf0c3d, 0xf0c60, 0xf0c61, 0xf0c80, 0xf0cbd, 0xf0cde, 0xf0ce0, 0xf0ce1, 0xf0cf1, + 0xf0cf2, 0xf0d3d, 0xf0d4e, 0xf0dbd, 0xf0e32, 0xf0e33, 0xf0e81, 0xf0e82, 0xf0e84, + 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0eb2, + 0xf0eb3, 0xf0ebd, 0xf0ec6, 0xf0f00, 0xf103f, 0xf1061, 0xf1065, 0xf1066, 0xf108e, + 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf17d7, 0xf17dc, 0xf18aa, 0xf1aa7, 0xf1bae, + 0xf1baf, 0xf1cf5, 0xf1cf6, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1fbe, 0xf2071, 0xf207f, + 0xf2102, 0xf2107, 0xf2115, 0xf2124, 0xf2126, 0xf2128, 0xf214e, 0xf2183, 0xf2184, + 0xf2cf2, 0xf2cf3, 0xf2d27, 0xf2d2d, 0xf2d6f, 0xf2e2f, 0xf3005, 0xf3006, 0xf303b, + 0xf303c, 0xfa62a, 0xfa62b, 0xfa8fb, 0xfa8fd, 0xfa9cf, 0xfaa7a, 0xfaab1, 0xfaab5, + 0xfaab6, 0xfaac0, 0xfaac2, 0xffb1d, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, + 0x1000aa, 0x1000b5, 0x1000ba, 0x1002ec, 0x1002ee, 0x100376, 0x100377, 0x10037f, 0x100386, + 0x10038c, 0x100559, 0x10066e, 0x10066f, 0x1006d5, 0x1006e5, 0x1006e6, 0x1006ee, 0x1006ef, + 0x1006ff, 0x100710, 0x1007b1, 0x1007f4, 0x1007f5, 0x1007fa, 0x10081a, 0x100824, 0x100828, + 0x10093d, 0x100950, 0x10098f, 0x100990, 0x1009b2, 0x1009bd, 0x1009ce, 0x1009dc, 0x1009dd, + 0x1009f0, 0x1009f1, 0x1009fc, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, + 0x100a38, 0x100a39, 0x100a5e, 0x100ab2, 0x100ab3, 0x100abd, 0x100ad0, 0x100ae0, 0x100ae1, + 0x100af9, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b3d, 0x100b5c, 0x100b5d, 0x100b71, + 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, 0x100ba3, 0x100ba4, 0x100bd0, + 0x100c3d, 0x100c60, 0x100c61, 0x100c80, 0x100cbd, 0x100cde, 0x100ce0, 0x100ce1, 0x100cf1, + 0x100cf2, 0x100d3d, 0x100d4e, 0x100dbd, 0x100e32, 0x100e33, 0x100e81, 0x100e82, 0x100e84, + 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, 0x100eb2, + 0x100eb3, 0x100ebd, 0x100ec6, 0x100f00, 0x10103f, 0x101061, 0x101065, 0x101066, 0x10108e, + 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x1017d7, 0x1017dc, 0x1018aa, 0x101aa7, 0x101bae, + 0x101baf, 0x101cf5, 0x101cf6, 0x101f59, 0x101f5b, 0x101f5d, 0x101fbe, 0x102071, 0x10207f, + 0x102102, 0x102107, 0x102115, 0x102124, 0x102126, 0x102128, 0x10214e, 0x102183, 0x102184, + 0x102cf2, 0x102cf3, 0x102d27, 0x102d2d, 0x102d6f, 0x102e2f, 0x103005, 0x103006, 0x10303b, + 0x10303c, 0x10a62a, 0x10a62b, 0x10a8fb, 0x10a8fd, 0x10a9cf, 0x10aa7a, 0x10aab1, 0x10aab5, + 0x10aab6, 0x10aac0, 0x10aac2, 0x10fb1d, 0x10fb3e, 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44 #endif }; @@ -286,8 +1567,42 @@ static const crange controlRangeTable[] = { {0x202a, 0x202e}, {0x2060, 0x2064}, {0x2066, 0x206f}, {0xe000, 0xf8ff}, {0xfff9, 0xfffb} #if TCL_UTF_MAX > 4 - ,{0x1bca0, 0x1bca3}, {0x1d173, 0x1d17a}, {0xe0020, 0xe007f}, {0xf0000, 0xffffd}, - {0x100000, 0x10fffd} + ,{0x10000, 0x1001f}, {0x1007f, 0x1009f}, {0x10600, 0x10605}, {0x1200b, 0x1200f}, + {0x1202a, 0x1202e}, {0x12060, 0x12064}, {0x12066, 0x1206f}, {0x1e000, 0x1f8ff}, + {0x1fff9, 0x1fffb}, {0x20000, 0x2001f}, {0x2007f, 0x2009f}, {0x20600, 0x20605}, + {0x2200b, 0x2200f}, {0x2202a, 0x2202e}, {0x22060, 0x22064}, {0x22066, 0x2206f}, + {0x2e000, 0x2f8ff}, {0x2fff9, 0x2fffb}, {0x30000, 0x3001f}, {0x3007f, 0x3009f}, + {0x30600, 0x30605}, {0x3200b, 0x3200f}, {0x3202a, 0x3202e}, {0x32060, 0x32064}, + {0x32066, 0x3206f}, {0x3e000, 0x3f8ff}, {0x3fff9, 0x3fffb}, {0x40000, 0x4001f}, + {0x4007f, 0x4009f}, {0x40600, 0x40605}, {0x4200b, 0x4200f}, {0x4202a, 0x4202e}, + {0x42060, 0x42064}, {0x42066, 0x4206f}, {0x4e000, 0x4f8ff}, {0x4fff9, 0x4fffb}, + {0x50000, 0x5001f}, {0x5007f, 0x5009f}, {0x50600, 0x50605}, {0x5200b, 0x5200f}, + {0x5202a, 0x5202e}, {0x52060, 0x52064}, {0x52066, 0x5206f}, {0x5e000, 0x5f8ff}, + {0x5fff9, 0x5fffb}, {0x60000, 0x6001f}, {0x6007f, 0x6009f}, {0x60600, 0x60605}, + {0x6200b, 0x6200f}, {0x6202a, 0x6202e}, {0x62060, 0x62064}, {0x62066, 0x6206f}, + {0x6e000, 0x6f8ff}, {0x6fff9, 0x6fffb}, {0x70000, 0x7001f}, {0x7007f, 0x7009f}, + {0x70600, 0x70605}, {0x7200b, 0x7200f}, {0x7202a, 0x7202e}, {0x72060, 0x72064}, + {0x72066, 0x7206f}, {0x7e000, 0x7f8ff}, {0x7fff9, 0x7fffb}, {0x80000, 0x8001f}, + {0x8007f, 0x8009f}, {0x80600, 0x80605}, {0x8200b, 0x8200f}, {0x8202a, 0x8202e}, + {0x82060, 0x82064}, {0x82066, 0x8206f}, {0x8e000, 0x8f8ff}, {0x8fff9, 0x8fffb}, + {0x90000, 0x9001f}, {0x9007f, 0x9009f}, {0x90600, 0x90605}, {0x9200b, 0x9200f}, + {0x9202a, 0x9202e}, {0x92060, 0x92064}, {0x92066, 0x9206f}, {0x9e000, 0x9f8ff}, + {0x9fff9, 0x9fffb}, {0xa0000, 0xa001f}, {0xa007f, 0xa009f}, {0xa0600, 0xa0605}, + {0xa200b, 0xa200f}, {0xa202a, 0xa202e}, {0xa2060, 0xa2064}, {0xa2066, 0xa206f}, + {0xae000, 0xaf8ff}, {0xafff9, 0xafffb}, {0xb0000, 0xb001f}, {0xb007f, 0xb009f}, + {0xb0600, 0xb0605}, {0xb200b, 0xb200f}, {0xb202a, 0xb202e}, {0xb2060, 0xb2064}, + {0xb2066, 0xb206f}, {0xbe000, 0xbf8ff}, {0xbfff9, 0xbfffb}, {0xc0000, 0xc001f}, + {0xc007f, 0xc009f}, {0xc0600, 0xc0605}, {0xc200b, 0xc200f}, {0xc202a, 0xc202e}, + {0xc2060, 0xc2064}, {0xc2066, 0xc206f}, {0xce000, 0xcf8ff}, {0xcfff9, 0xcfffb}, + {0xd0000, 0xd001f}, {0xd007f, 0xd009f}, {0xd0600, 0xd0605}, {0xd200b, 0xd200f}, + {0xd202a, 0xd202e}, {0xd2060, 0xd2064}, {0xd2066, 0xd206f}, {0xde000, 0xdf8ff}, + {0xdfff9, 0xdfffb}, {0xe0000, 0xe001f}, {0xe007f, 0xe009f}, {0xe0600, 0xe0605}, + {0xe200b, 0xe200f}, {0xe202a, 0xe202e}, {0xe2060, 0xe2064}, {0xe2066, 0xe206f}, + {0xee000, 0xef8ff}, {0xefff9, 0xefffb}, {0xf0000, 0xf001f}, {0xf007f, 0xf009f}, + {0xf0600, 0xf0605}, {0xf200b, 0xf200f}, {0xf202a, 0xf202e}, {0xf2060, 0xf2064}, + {0xf2066, 0xf206f}, {0xfe000, 0xff8ff}, {0xffff9, 0xffffb}, {0x100000, 0x10001f}, + {0x10007f, 0x10009f}, {0x100600, 0x100605}, {0x10200b, 0x10200f}, {0x10202a, 0x10202e}, + {0x102060, 0x102064}, {0x102066, 0x10206f}, {0x10e000, 0x10f8ff}, {0x10fff9, 0x10fffb} #endif }; @@ -296,7 +1611,19 @@ static const crange controlRangeTable[] = { static const chr controlCharTable[] = { 0xad, 0x61c, 0x6dd, 0x70f, 0x8e2, 0x180e, 0xfeff #if TCL_UTF_MAX > 4 - ,0x110bd, 0xe0001 + ,0x100ad, 0x1061c, 0x106dd, 0x1070f, 0x108e2, 0x1180e, 0x1feff, 0x200ad, 0x2061c, + 0x206dd, 0x2070f, 0x208e2, 0x2180e, 0x2feff, 0x300ad, 0x3061c, 0x306dd, 0x3070f, + 0x308e2, 0x3180e, 0x3feff, 0x400ad, 0x4061c, 0x406dd, 0x4070f, 0x408e2, 0x4180e, + 0x4feff, 0x500ad, 0x5061c, 0x506dd, 0x5070f, 0x508e2, 0x5180e, 0x5feff, 0x600ad, + 0x6061c, 0x606dd, 0x6070f, 0x608e2, 0x6180e, 0x6feff, 0x700ad, 0x7061c, 0x706dd, + 0x7070f, 0x708e2, 0x7180e, 0x7feff, 0x800ad, 0x8061c, 0x806dd, 0x8070f, 0x808e2, + 0x8180e, 0x8feff, 0x900ad, 0x9061c, 0x906dd, 0x9070f, 0x908e2, 0x9180e, 0x9feff, + 0xa00ad, 0xa061c, 0xa06dd, 0xa070f, 0xa08e2, 0xa180e, 0xafeff, 0xb00ad, 0xb061c, + 0xb06dd, 0xb070f, 0xb08e2, 0xb180e, 0xbfeff, 0xc00ad, 0xc061c, 0xc06dd, 0xc070f, + 0xc08e2, 0xc180e, 0xcfeff, 0xd00ad, 0xd061c, 0xd06dd, 0xd070f, 0xd08e2, 0xd180e, + 0xdfeff, 0xe00ad, 0xe061c, 0xe06dd, 0xe070f, 0xe08e2, 0xe180e, 0xefeff, 0xf00ad, + 0xf061c, 0xf06dd, 0xf070f, 0xf08e2, 0xf180e, 0xffeff, 0x1000ad, 0x10061c, 0x1006dd, + 0x10070f, 0x1008e2, 0x10180e, 0x10feff #endif }; @@ -318,11 +1645,154 @@ static const crange digitRangeTable[] = { {0xa9d0, 0xa9d9}, {0xa9f0, 0xa9f9}, {0xaa50, 0xaa59}, {0xabf0, 0xabf9}, {0xff10, 0xff19} #if TCL_UTF_MAX > 4 - ,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f}, - {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459}, {0x114d0, 0x114d9}, - {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9}, - {0x11c50, 0x11c59}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}, - {0x1e950, 0x1e959} + ,{0x10030, 0x10039}, {0x10660, 0x10669}, {0x106f0, 0x106f9}, {0x107c0, 0x107c9}, + {0x10966, 0x1096f}, {0x109e6, 0x109ef}, {0x10a66, 0x10a6f}, {0x10ae6, 0x10aef}, + {0x10b66, 0x10b6f}, {0x10be6, 0x10bef}, {0x10c66, 0x10c6f}, {0x10ce6, 0x10cef}, + {0x10d66, 0x10d6f}, {0x10de6, 0x10def}, {0x10e50, 0x10e59}, {0x10ed0, 0x10ed9}, + {0x10f20, 0x10f29}, {0x11040, 0x11049}, {0x11090, 0x11099}, {0x117e0, 0x117e9}, + {0x11810, 0x11819}, {0x11946, 0x1194f}, {0x119d0, 0x119d9}, {0x11a80, 0x11a89}, + {0x11a90, 0x11a99}, {0x11b50, 0x11b59}, {0x11bb0, 0x11bb9}, {0x11c40, 0x11c49}, + {0x11c50, 0x11c59}, {0x1a620, 0x1a629}, {0x1a8d0, 0x1a8d9}, {0x1a900, 0x1a909}, + {0x1a9d0, 0x1a9d9}, {0x1a9f0, 0x1a9f9}, {0x1aa50, 0x1aa59}, {0x1abf0, 0x1abf9}, + {0x1ff10, 0x1ff19}, {0x20030, 0x20039}, {0x20660, 0x20669}, {0x206f0, 0x206f9}, + {0x207c0, 0x207c9}, {0x20966, 0x2096f}, {0x209e6, 0x209ef}, {0x20a66, 0x20a6f}, + {0x20ae6, 0x20aef}, {0x20b66, 0x20b6f}, {0x20be6, 0x20bef}, {0x20c66, 0x20c6f}, + {0x20ce6, 0x20cef}, {0x20d66, 0x20d6f}, {0x20de6, 0x20def}, {0x20e50, 0x20e59}, + {0x20ed0, 0x20ed9}, {0x20f20, 0x20f29}, {0x21040, 0x21049}, {0x21090, 0x21099}, + {0x217e0, 0x217e9}, {0x21810, 0x21819}, {0x21946, 0x2194f}, {0x219d0, 0x219d9}, + {0x21a80, 0x21a89}, {0x21a90, 0x21a99}, {0x21b50, 0x21b59}, {0x21bb0, 0x21bb9}, + {0x21c40, 0x21c49}, {0x21c50, 0x21c59}, {0x2a620, 0x2a629}, {0x2a8d0, 0x2a8d9}, + {0x2a900, 0x2a909}, {0x2a9d0, 0x2a9d9}, {0x2a9f0, 0x2a9f9}, {0x2aa50, 0x2aa59}, + {0x2abf0, 0x2abf9}, {0x2ff10, 0x2ff19}, {0x30030, 0x30039}, {0x30660, 0x30669}, + {0x306f0, 0x306f9}, {0x307c0, 0x307c9}, {0x30966, 0x3096f}, {0x309e6, 0x309ef}, + {0x30a66, 0x30a6f}, {0x30ae6, 0x30aef}, {0x30b66, 0x30b6f}, {0x30be6, 0x30bef}, + {0x30c66, 0x30c6f}, {0x30ce6, 0x30cef}, {0x30d66, 0x30d6f}, {0x30de6, 0x30def}, + {0x30e50, 0x30e59}, {0x30ed0, 0x30ed9}, {0x30f20, 0x30f29}, {0x31040, 0x31049}, + {0x31090, 0x31099}, {0x317e0, 0x317e9}, {0x31810, 0x31819}, {0x31946, 0x3194f}, + {0x319d0, 0x319d9}, {0x31a80, 0x31a89}, {0x31a90, 0x31a99}, {0x31b50, 0x31b59}, + {0x31bb0, 0x31bb9}, {0x31c40, 0x31c49}, {0x31c50, 0x31c59}, {0x3a620, 0x3a629}, + {0x3a8d0, 0x3a8d9}, {0x3a900, 0x3a909}, {0x3a9d0, 0x3a9d9}, {0x3a9f0, 0x3a9f9}, + {0x3aa50, 0x3aa59}, {0x3abf0, 0x3abf9}, {0x3ff10, 0x3ff19}, {0x40030, 0x40039}, + {0x40660, 0x40669}, {0x406f0, 0x406f9}, {0x407c0, 0x407c9}, {0x40966, 0x4096f}, + {0x409e6, 0x409ef}, {0x40a66, 0x40a6f}, {0x40ae6, 0x40aef}, {0x40b66, 0x40b6f}, + {0x40be6, 0x40bef}, {0x40c66, 0x40c6f}, {0x40ce6, 0x40cef}, {0x40d66, 0x40d6f}, + {0x40de6, 0x40def}, {0x40e50, 0x40e59}, {0x40ed0, 0x40ed9}, {0x40f20, 0x40f29}, + {0x41040, 0x41049}, {0x41090, 0x41099}, {0x417e0, 0x417e9}, {0x41810, 0x41819}, + {0x41946, 0x4194f}, {0x419d0, 0x419d9}, {0x41a80, 0x41a89}, {0x41a90, 0x41a99}, + {0x41b50, 0x41b59}, {0x41bb0, 0x41bb9}, {0x41c40, 0x41c49}, {0x41c50, 0x41c59}, + {0x4a620, 0x4a629}, {0x4a8d0, 0x4a8d9}, {0x4a900, 0x4a909}, {0x4a9d0, 0x4a9d9}, + {0x4a9f0, 0x4a9f9}, {0x4aa50, 0x4aa59}, {0x4abf0, 0x4abf9}, {0x4ff10, 0x4ff19}, + {0x50030, 0x50039}, {0x50660, 0x50669}, {0x506f0, 0x506f9}, {0x507c0, 0x507c9}, + {0x50966, 0x5096f}, {0x509e6, 0x509ef}, {0x50a66, 0x50a6f}, {0x50ae6, 0x50aef}, + {0x50b66, 0x50b6f}, {0x50be6, 0x50bef}, {0x50c66, 0x50c6f}, {0x50ce6, 0x50cef}, + {0x50d66, 0x50d6f}, {0x50de6, 0x50def}, {0x50e50, 0x50e59}, {0x50ed0, 0x50ed9}, + {0x50f20, 0x50f29}, {0x51040, 0x51049}, {0x51090, 0x51099}, {0x517e0, 0x517e9}, + {0x51810, 0x51819}, {0x51946, 0x5194f}, {0x519d0, 0x519d9}, {0x51a80, 0x51a89}, + {0x51a90, 0x51a99}, {0x51b50, 0x51b59}, {0x51bb0, 0x51bb9}, {0x51c40, 0x51c49}, + {0x51c50, 0x51c59}, {0x5a620, 0x5a629}, {0x5a8d0, 0x5a8d9}, {0x5a900, 0x5a909}, + {0x5a9d0, 0x5a9d9}, {0x5a9f0, 0x5a9f9}, {0x5aa50, 0x5aa59}, {0x5abf0, 0x5abf9}, + {0x5ff10, 0x5ff19}, {0x60030, 0x60039}, {0x60660, 0x60669}, {0x606f0, 0x606f9}, + {0x607c0, 0x607c9}, {0x60966, 0x6096f}, {0x609e6, 0x609ef}, {0x60a66, 0x60a6f}, + {0x60ae6, 0x60aef}, {0x60b66, 0x60b6f}, {0x60be6, 0x60bef}, {0x60c66, 0x60c6f}, + {0x60ce6, 0x60cef}, {0x60d66, 0x60d6f}, {0x60de6, 0x60def}, {0x60e50, 0x60e59}, + {0x60ed0, 0x60ed9}, {0x60f20, 0x60f29}, {0x61040, 0x61049}, {0x61090, 0x61099}, + {0x617e0, 0x617e9}, {0x61810, 0x61819}, {0x61946, 0x6194f}, {0x619d0, 0x619d9}, + {0x61a80, 0x61a89}, {0x61a90, 0x61a99}, {0x61b50, 0x61b59}, {0x61bb0, 0x61bb9}, + {0x61c40, 0x61c49}, {0x61c50, 0x61c59}, {0x6a620, 0x6a629}, {0x6a8d0, 0x6a8d9}, + {0x6a900, 0x6a909}, {0x6a9d0, 0x6a9d9}, {0x6a9f0, 0x6a9f9}, {0x6aa50, 0x6aa59}, + {0x6abf0, 0x6abf9}, {0x6ff10, 0x6ff19}, {0x70030, 0x70039}, {0x70660, 0x70669}, + {0x706f0, 0x706f9}, {0x707c0, 0x707c9}, {0x70966, 0x7096f}, {0x709e6, 0x709ef}, + {0x70a66, 0x70a6f}, {0x70ae6, 0x70aef}, {0x70b66, 0x70b6f}, {0x70be6, 0x70bef}, + {0x70c66, 0x70c6f}, {0x70ce6, 0x70cef}, {0x70d66, 0x70d6f}, {0x70de6, 0x70def}, + {0x70e50, 0x70e59}, {0x70ed0, 0x70ed9}, {0x70f20, 0x70f29}, {0x71040, 0x71049}, + {0x71090, 0x71099}, {0x717e0, 0x717e9}, {0x71810, 0x71819}, {0x71946, 0x7194f}, + {0x719d0, 0x719d9}, {0x71a80, 0x71a89}, {0x71a90, 0x71a99}, {0x71b50, 0x71b59}, + {0x71bb0, 0x71bb9}, {0x71c40, 0x71c49}, {0x71c50, 0x71c59}, {0x7a620, 0x7a629}, + {0x7a8d0, 0x7a8d9}, {0x7a900, 0x7a909}, {0x7a9d0, 0x7a9d9}, {0x7a9f0, 0x7a9f9}, + {0x7aa50, 0x7aa59}, {0x7abf0, 0x7abf9}, {0x7ff10, 0x7ff19}, {0x80030, 0x80039}, + {0x80660, 0x80669}, {0x806f0, 0x806f9}, {0x807c0, 0x807c9}, {0x80966, 0x8096f}, + {0x809e6, 0x809ef}, {0x80a66, 0x80a6f}, {0x80ae6, 0x80aef}, {0x80b66, 0x80b6f}, + {0x80be6, 0x80bef}, {0x80c66, 0x80c6f}, {0x80ce6, 0x80cef}, {0x80d66, 0x80d6f}, + {0x80de6, 0x80def}, {0x80e50, 0x80e59}, {0x80ed0, 0x80ed9}, {0x80f20, 0x80f29}, + {0x81040, 0x81049}, {0x81090, 0x81099}, {0x817e0, 0x817e9}, {0x81810, 0x81819}, + {0x81946, 0x8194f}, {0x819d0, 0x819d9}, {0x81a80, 0x81a89}, {0x81a90, 0x81a99}, + {0x81b50, 0x81b59}, {0x81bb0, 0x81bb9}, {0x81c40, 0x81c49}, {0x81c50, 0x81c59}, + {0x8a620, 0x8a629}, {0x8a8d0, 0x8a8d9}, {0x8a900, 0x8a909}, {0x8a9d0, 0x8a9d9}, + {0x8a9f0, 0x8a9f9}, {0x8aa50, 0x8aa59}, {0x8abf0, 0x8abf9}, {0x8ff10, 0x8ff19}, + {0x90030, 0x90039}, {0x90660, 0x90669}, {0x906f0, 0x906f9}, {0x907c0, 0x907c9}, + {0x90966, 0x9096f}, {0x909e6, 0x909ef}, {0x90a66, 0x90a6f}, {0x90ae6, 0x90aef}, + {0x90b66, 0x90b6f}, {0x90be6, 0x90bef}, {0x90c66, 0x90c6f}, {0x90ce6, 0x90cef}, + {0x90d66, 0x90d6f}, {0x90de6, 0x90def}, {0x90e50, 0x90e59}, {0x90ed0, 0x90ed9}, + {0x90f20, 0x90f29}, {0x91040, 0x91049}, {0x91090, 0x91099}, {0x917e0, 0x917e9}, + {0x91810, 0x91819}, {0x91946, 0x9194f}, {0x919d0, 0x919d9}, {0x91a80, 0x91a89}, + {0x91a90, 0x91a99}, {0x91b50, 0x91b59}, {0x91bb0, 0x91bb9}, {0x91c40, 0x91c49}, + {0x91c50, 0x91c59}, {0x9a620, 0x9a629}, {0x9a8d0, 0x9a8d9}, {0x9a900, 0x9a909}, + {0x9a9d0, 0x9a9d9}, {0x9a9f0, 0x9a9f9}, {0x9aa50, 0x9aa59}, {0x9abf0, 0x9abf9}, + {0x9ff10, 0x9ff19}, {0xa0030, 0xa0039}, {0xa0660, 0xa0669}, {0xa06f0, 0xa06f9}, + {0xa07c0, 0xa07c9}, {0xa0966, 0xa096f}, {0xa09e6, 0xa09ef}, {0xa0a66, 0xa0a6f}, + {0xa0ae6, 0xa0aef}, {0xa0b66, 0xa0b6f}, {0xa0be6, 0xa0bef}, {0xa0c66, 0xa0c6f}, + {0xa0ce6, 0xa0cef}, {0xa0d66, 0xa0d6f}, {0xa0de6, 0xa0def}, {0xa0e50, 0xa0e59}, + {0xa0ed0, 0xa0ed9}, {0xa0f20, 0xa0f29}, {0xa1040, 0xa1049}, {0xa1090, 0xa1099}, + {0xa17e0, 0xa17e9}, {0xa1810, 0xa1819}, {0xa1946, 0xa194f}, {0xa19d0, 0xa19d9}, + {0xa1a80, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1b50, 0xa1b59}, {0xa1bb0, 0xa1bb9}, + {0xa1c40, 0xa1c49}, {0xa1c50, 0xa1c59}, {0xaa620, 0xaa629}, {0xaa8d0, 0xaa8d9}, + {0xaa900, 0xaa909}, {0xaa9d0, 0xaa9d9}, {0xaa9f0, 0xaa9f9}, {0xaaa50, 0xaaa59}, + {0xaabf0, 0xaabf9}, {0xaff10, 0xaff19}, {0xb0030, 0xb0039}, {0xb0660, 0xb0669}, + {0xb06f0, 0xb06f9}, {0xb07c0, 0xb07c9}, {0xb0966, 0xb096f}, {0xb09e6, 0xb09ef}, + {0xb0a66, 0xb0a6f}, {0xb0ae6, 0xb0aef}, {0xb0b66, 0xb0b6f}, {0xb0be6, 0xb0bef}, + {0xb0c66, 0xb0c6f}, {0xb0ce6, 0xb0cef}, {0xb0d66, 0xb0d6f}, {0xb0de6, 0xb0def}, + {0xb0e50, 0xb0e59}, {0xb0ed0, 0xb0ed9}, {0xb0f20, 0xb0f29}, {0xb1040, 0xb1049}, + {0xb1090, 0xb1099}, {0xb17e0, 0xb17e9}, {0xb1810, 0xb1819}, {0xb1946, 0xb194f}, + {0xb19d0, 0xb19d9}, {0xb1a80, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1b50, 0xb1b59}, + {0xb1bb0, 0xb1bb9}, {0xb1c40, 0xb1c49}, {0xb1c50, 0xb1c59}, {0xba620, 0xba629}, + {0xba8d0, 0xba8d9}, {0xba900, 0xba909}, {0xba9d0, 0xba9d9}, {0xba9f0, 0xba9f9}, + {0xbaa50, 0xbaa59}, {0xbabf0, 0xbabf9}, {0xbff10, 0xbff19}, {0xc0030, 0xc0039}, + {0xc0660, 0xc0669}, {0xc06f0, 0xc06f9}, {0xc07c0, 0xc07c9}, {0xc0966, 0xc096f}, + {0xc09e6, 0xc09ef}, {0xc0a66, 0xc0a6f}, {0xc0ae6, 0xc0aef}, {0xc0b66, 0xc0b6f}, + {0xc0be6, 0xc0bef}, {0xc0c66, 0xc0c6f}, {0xc0ce6, 0xc0cef}, {0xc0d66, 0xc0d6f}, + {0xc0de6, 0xc0def}, {0xc0e50, 0xc0e59}, {0xc0ed0, 0xc0ed9}, {0xc0f20, 0xc0f29}, + {0xc1040, 0xc1049}, {0xc1090, 0xc1099}, {0xc17e0, 0xc17e9}, {0xc1810, 0xc1819}, + {0xc1946, 0xc194f}, {0xc19d0, 0xc19d9}, {0xc1a80, 0xc1a89}, {0xc1a90, 0xc1a99}, + {0xc1b50, 0xc1b59}, {0xc1bb0, 0xc1bb9}, {0xc1c40, 0xc1c49}, {0xc1c50, 0xc1c59}, + {0xca620, 0xca629}, {0xca8d0, 0xca8d9}, {0xca900, 0xca909}, {0xca9d0, 0xca9d9}, + {0xca9f0, 0xca9f9}, {0xcaa50, 0xcaa59}, {0xcabf0, 0xcabf9}, {0xcff10, 0xcff19}, + {0xd0030, 0xd0039}, {0xd0660, 0xd0669}, {0xd06f0, 0xd06f9}, {0xd07c0, 0xd07c9}, + {0xd0966, 0xd096f}, {0xd09e6, 0xd09ef}, {0xd0a66, 0xd0a6f}, {0xd0ae6, 0xd0aef}, + {0xd0b66, 0xd0b6f}, {0xd0be6, 0xd0bef}, {0xd0c66, 0xd0c6f}, {0xd0ce6, 0xd0cef}, + {0xd0d66, 0xd0d6f}, {0xd0de6, 0xd0def}, {0xd0e50, 0xd0e59}, {0xd0ed0, 0xd0ed9}, + {0xd0f20, 0xd0f29}, {0xd1040, 0xd1049}, {0xd1090, 0xd1099}, {0xd17e0, 0xd17e9}, + {0xd1810, 0xd1819}, {0xd1946, 0xd194f}, {0xd19d0, 0xd19d9}, {0xd1a80, 0xd1a89}, + {0xd1a90, 0xd1a99}, {0xd1b50, 0xd1b59}, {0xd1bb0, 0xd1bb9}, {0xd1c40, 0xd1c49}, + {0xd1c50, 0xd1c59}, {0xda620, 0xda629}, {0xda8d0, 0xda8d9}, {0xda900, 0xda909}, + {0xda9d0, 0xda9d9}, {0xda9f0, 0xda9f9}, {0xdaa50, 0xdaa59}, {0xdabf0, 0xdabf9}, + {0xdff10, 0xdff19}, {0xe0030, 0xe0039}, {0xe0660, 0xe0669}, {0xe06f0, 0xe06f9}, + {0xe07c0, 0xe07c9}, {0xe0966, 0xe096f}, {0xe09e6, 0xe09ef}, {0xe0a66, 0xe0a6f}, + {0xe0ae6, 0xe0aef}, {0xe0b66, 0xe0b6f}, {0xe0be6, 0xe0bef}, {0xe0c66, 0xe0c6f}, + {0xe0ce6, 0xe0cef}, {0xe0d66, 0xe0d6f}, {0xe0de6, 0xe0def}, {0xe0e50, 0xe0e59}, + {0xe0ed0, 0xe0ed9}, {0xe0f20, 0xe0f29}, {0xe1040, 0xe1049}, {0xe1090, 0xe1099}, + {0xe17e0, 0xe17e9}, {0xe1810, 0xe1819}, {0xe1946, 0xe194f}, {0xe19d0, 0xe19d9}, + {0xe1a80, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1b50, 0xe1b59}, {0xe1bb0, 0xe1bb9}, + {0xe1c40, 0xe1c49}, {0xe1c50, 0xe1c59}, {0xea620, 0xea629}, {0xea8d0, 0xea8d9}, + {0xea900, 0xea909}, {0xea9d0, 0xea9d9}, {0xea9f0, 0xea9f9}, {0xeaa50, 0xeaa59}, + {0xeabf0, 0xeabf9}, {0xeff10, 0xeff19}, {0xf0030, 0xf0039}, {0xf0660, 0xf0669}, + {0xf06f0, 0xf06f9}, {0xf07c0, 0xf07c9}, {0xf0966, 0xf096f}, {0xf09e6, 0xf09ef}, + {0xf0a66, 0xf0a6f}, {0xf0ae6, 0xf0aef}, {0xf0b66, 0xf0b6f}, {0xf0be6, 0xf0bef}, + {0xf0c66, 0xf0c6f}, {0xf0ce6, 0xf0cef}, {0xf0d66, 0xf0d6f}, {0xf0de6, 0xf0def}, + {0xf0e50, 0xf0e59}, {0xf0ed0, 0xf0ed9}, {0xf0f20, 0xf0f29}, {0xf1040, 0xf1049}, + {0xf1090, 0xf1099}, {0xf17e0, 0xf17e9}, {0xf1810, 0xf1819}, {0xf1946, 0xf194f}, + {0xf19d0, 0xf19d9}, {0xf1a80, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1b50, 0xf1b59}, + {0xf1bb0, 0xf1bb9}, {0xf1c40, 0xf1c49}, {0xf1c50, 0xf1c59}, {0xfa620, 0xfa629}, + {0xfa8d0, 0xfa8d9}, {0xfa900, 0xfa909}, {0xfa9d0, 0xfa9d9}, {0xfa9f0, 0xfa9f9}, + {0xfaa50, 0xfaa59}, {0xfabf0, 0xfabf9}, {0xfff10, 0xfff19}, {0x100030, 0x100039}, + {0x100660, 0x100669}, {0x1006f0, 0x1006f9}, {0x1007c0, 0x1007c9}, {0x100966, 0x10096f}, + {0x1009e6, 0x1009ef}, {0x100a66, 0x100a6f}, {0x100ae6, 0x100aef}, {0x100b66, 0x100b6f}, + {0x100be6, 0x100bef}, {0x100c66, 0x100c6f}, {0x100ce6, 0x100cef}, {0x100d66, 0x100d6f}, + {0x100de6, 0x100def}, {0x100e50, 0x100e59}, {0x100ed0, 0x100ed9}, {0x100f20, 0x100f29}, + {0x101040, 0x101049}, {0x101090, 0x101099}, {0x1017e0, 0x1017e9}, {0x101810, 0x101819}, + {0x101946, 0x10194f}, {0x1019d0, 0x1019d9}, {0x101a80, 0x101a89}, {0x101a90, 0x101a99}, + {0x101b50, 0x101b59}, {0x101bb0, 0x101bb9}, {0x101c40, 0x101c49}, {0x101c50, 0x101c59}, + {0x10a620, 0x10a629}, {0x10a8d0, 0x10a8d9}, {0x10a900, 0x10a909}, {0x10a9d0, 0x10a9d9}, + {0x10a9f0, 0x10a9f9}, {0x10aa50, 0x10aa59}, {0x10abf0, 0x10abf9}, {0x10ff10, 0x10ff19} #endif }; @@ -345,18 +1815,225 @@ static const crange punctRangeTable[] = { {0x1b5a, 0x1b60}, {0x1bfc, 0x1bff}, {0x1c3b, 0x1c3f}, {0x1cc0, 0x1cc7}, {0x2010, 0x2027}, {0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x205e}, {0x2308, 0x230b}, {0x2768, 0x2775}, {0x27e6, 0x27ef}, {0x2983, 0x2998}, - {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e44}, + {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e49}, {0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f}, {0xa60d, 0xa60f}, {0xa6f2, 0xa6f7}, {0xa874, 0xa877}, {0xa8f8, 0xa8fa}, {0xa9c1, 0xa9cd}, {0xaa5c, 0xaa5f}, {0xfe10, 0xfe19}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61}, {0xff01, 0xff03}, {0xff05, 0xff0a}, {0xff0c, 0xff0f}, {0xff3b, 0xff3d}, {0xff5f, 0xff65} #if TCL_UTF_MAX > 4 - ,{0x10100, 0x10102}, {0x10a50, 0x10a58}, {0x10af0, 0x10af6}, {0x10b39, 0x10b3f}, - {0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143}, - {0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x1144b, 0x1144f}, - {0x115c1, 0x115d7}, {0x11641, 0x11643}, {0x11660, 0x1166c}, {0x1173c, 0x1173e}, - {0x11c41, 0x11c45}, {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x1da87, 0x1da8b} + ,{0x10021, 0x10023}, {0x10025, 0x1002a}, {0x1002c, 0x1002f}, {0x1005b, 0x1005d}, + {0x1055a, 0x1055f}, {0x1066a, 0x1066d}, {0x10700, 0x1070d}, {0x107f7, 0x107f9}, + {0x10830, 0x1083e}, {0x10f04, 0x10f12}, {0x10f3a, 0x10f3d}, {0x10fd0, 0x10fd4}, + {0x1104a, 0x1104f}, {0x11360, 0x11368}, {0x116eb, 0x116ed}, {0x117d4, 0x117d6}, + {0x117d8, 0x117da}, {0x11800, 0x1180a}, {0x11aa0, 0x11aa6}, {0x11aa8, 0x11aad}, + {0x11b5a, 0x11b60}, {0x11bfc, 0x11bff}, {0x11c3b, 0x11c3f}, {0x11cc0, 0x11cc7}, + {0x12010, 0x12027}, {0x12030, 0x12043}, {0x12045, 0x12051}, {0x12053, 0x1205e}, + {0x12308, 0x1230b}, {0x12768, 0x12775}, {0x127e6, 0x127ef}, {0x12983, 0x12998}, + {0x129d8, 0x129db}, {0x12cf9, 0x12cfc}, {0x12e00, 0x12e2e}, {0x12e30, 0x12e49}, + {0x13001, 0x13003}, {0x13008, 0x13011}, {0x13014, 0x1301f}, {0x1a60d, 0x1a60f}, + {0x1a6f2, 0x1a6f7}, {0x1a874, 0x1a877}, {0x1a8f8, 0x1a8fa}, {0x1a9c1, 0x1a9cd}, + {0x1aa5c, 0x1aa5f}, {0x1fe10, 0x1fe19}, {0x1fe30, 0x1fe52}, {0x1fe54, 0x1fe61}, + {0x1ff01, 0x1ff03}, {0x1ff05, 0x1ff0a}, {0x1ff0c, 0x1ff0f}, {0x1ff3b, 0x1ff3d}, + {0x1ff5f, 0x1ff65}, {0x20021, 0x20023}, {0x20025, 0x2002a}, {0x2002c, 0x2002f}, + {0x2005b, 0x2005d}, {0x2055a, 0x2055f}, {0x2066a, 0x2066d}, {0x20700, 0x2070d}, + {0x207f7, 0x207f9}, {0x20830, 0x2083e}, {0x20f04, 0x20f12}, {0x20f3a, 0x20f3d}, + {0x20fd0, 0x20fd4}, {0x2104a, 0x2104f}, {0x21360, 0x21368}, {0x216eb, 0x216ed}, + {0x217d4, 0x217d6}, {0x217d8, 0x217da}, {0x21800, 0x2180a}, {0x21aa0, 0x21aa6}, + {0x21aa8, 0x21aad}, {0x21b5a, 0x21b60}, {0x21bfc, 0x21bff}, {0x21c3b, 0x21c3f}, + {0x21cc0, 0x21cc7}, {0x22010, 0x22027}, {0x22030, 0x22043}, {0x22045, 0x22051}, + {0x22053, 0x2205e}, {0x22308, 0x2230b}, {0x22768, 0x22775}, {0x227e6, 0x227ef}, + {0x22983, 0x22998}, {0x229d8, 0x229db}, {0x22cf9, 0x22cfc}, {0x22e00, 0x22e2e}, + {0x22e30, 0x22e49}, {0x23001, 0x23003}, {0x23008, 0x23011}, {0x23014, 0x2301f}, + {0x2a60d, 0x2a60f}, {0x2a6f2, 0x2a6f7}, {0x2a874, 0x2a877}, {0x2a8f8, 0x2a8fa}, + {0x2a9c1, 0x2a9cd}, {0x2aa5c, 0x2aa5f}, {0x2fe10, 0x2fe19}, {0x2fe30, 0x2fe52}, + {0x2fe54, 0x2fe61}, {0x2ff01, 0x2ff03}, {0x2ff05, 0x2ff0a}, {0x2ff0c, 0x2ff0f}, + {0x2ff3b, 0x2ff3d}, {0x2ff5f, 0x2ff65}, {0x30021, 0x30023}, {0x30025, 0x3002a}, + {0x3002c, 0x3002f}, {0x3005b, 0x3005d}, {0x3055a, 0x3055f}, {0x3066a, 0x3066d}, + {0x30700, 0x3070d}, {0x307f7, 0x307f9}, {0x30830, 0x3083e}, {0x30f04, 0x30f12}, + {0x30f3a, 0x30f3d}, {0x30fd0, 0x30fd4}, {0x3104a, 0x3104f}, {0x31360, 0x31368}, + {0x316eb, 0x316ed}, {0x317d4, 0x317d6}, {0x317d8, 0x317da}, {0x31800, 0x3180a}, + {0x31aa0, 0x31aa6}, {0x31aa8, 0x31aad}, {0x31b5a, 0x31b60}, {0x31bfc, 0x31bff}, + {0x31c3b, 0x31c3f}, {0x31cc0, 0x31cc7}, {0x32010, 0x32027}, {0x32030, 0x32043}, + {0x32045, 0x32051}, {0x32053, 0x3205e}, {0x32308, 0x3230b}, {0x32768, 0x32775}, + {0x327e6, 0x327ef}, {0x32983, 0x32998}, {0x329d8, 0x329db}, {0x32cf9, 0x32cfc}, + {0x32e00, 0x32e2e}, {0x32e30, 0x32e49}, {0x33001, 0x33003}, {0x33008, 0x33011}, + {0x33014, 0x3301f}, {0x3a60d, 0x3a60f}, {0x3a6f2, 0x3a6f7}, {0x3a874, 0x3a877}, + {0x3a8f8, 0x3a8fa}, {0x3a9c1, 0x3a9cd}, {0x3aa5c, 0x3aa5f}, {0x3fe10, 0x3fe19}, + {0x3fe30, 0x3fe52}, {0x3fe54, 0x3fe61}, {0x3ff01, 0x3ff03}, {0x3ff05, 0x3ff0a}, + {0x3ff0c, 0x3ff0f}, {0x3ff3b, 0x3ff3d}, {0x3ff5f, 0x3ff65}, {0x40021, 0x40023}, + {0x40025, 0x4002a}, {0x4002c, 0x4002f}, {0x4005b, 0x4005d}, {0x4055a, 0x4055f}, + {0x4066a, 0x4066d}, {0x40700, 0x4070d}, {0x407f7, 0x407f9}, {0x40830, 0x4083e}, + {0x40f04, 0x40f12}, {0x40f3a, 0x40f3d}, {0x40fd0, 0x40fd4}, {0x4104a, 0x4104f}, + {0x41360, 0x41368}, {0x416eb, 0x416ed}, {0x417d4, 0x417d6}, {0x417d8, 0x417da}, + {0x41800, 0x4180a}, {0x41aa0, 0x41aa6}, {0x41aa8, 0x41aad}, {0x41b5a, 0x41b60}, + {0x41bfc, 0x41bff}, {0x41c3b, 0x41c3f}, {0x41cc0, 0x41cc7}, {0x42010, 0x42027}, + {0x42030, 0x42043}, {0x42045, 0x42051}, {0x42053, 0x4205e}, {0x42308, 0x4230b}, + {0x42768, 0x42775}, {0x427e6, 0x427ef}, {0x42983, 0x42998}, {0x429d8, 0x429db}, + {0x42cf9, 0x42cfc}, {0x42e00, 0x42e2e}, {0x42e30, 0x42e49}, {0x43001, 0x43003}, + {0x43008, 0x43011}, {0x43014, 0x4301f}, {0x4a60d, 0x4a60f}, {0x4a6f2, 0x4a6f7}, + {0x4a874, 0x4a877}, {0x4a8f8, 0x4a8fa}, {0x4a9c1, 0x4a9cd}, {0x4aa5c, 0x4aa5f}, + {0x4fe10, 0x4fe19}, {0x4fe30, 0x4fe52}, {0x4fe54, 0x4fe61}, {0x4ff01, 0x4ff03}, + {0x4ff05, 0x4ff0a}, {0x4ff0c, 0x4ff0f}, {0x4ff3b, 0x4ff3d}, {0x4ff5f, 0x4ff65}, + {0x50021, 0x50023}, {0x50025, 0x5002a}, {0x5002c, 0x5002f}, {0x5005b, 0x5005d}, + {0x5055a, 0x5055f}, {0x5066a, 0x5066d}, {0x50700, 0x5070d}, {0x507f7, 0x507f9}, + {0x50830, 0x5083e}, {0x50f04, 0x50f12}, {0x50f3a, 0x50f3d}, {0x50fd0, 0x50fd4}, + {0x5104a, 0x5104f}, {0x51360, 0x51368}, {0x516eb, 0x516ed}, {0x517d4, 0x517d6}, + {0x517d8, 0x517da}, {0x51800, 0x5180a}, {0x51aa0, 0x51aa6}, {0x51aa8, 0x51aad}, + {0x51b5a, 0x51b60}, {0x51bfc, 0x51bff}, {0x51c3b, 0x51c3f}, {0x51cc0, 0x51cc7}, + {0x52010, 0x52027}, {0x52030, 0x52043}, {0x52045, 0x52051}, {0x52053, 0x5205e}, + {0x52308, 0x5230b}, {0x52768, 0x52775}, {0x527e6, 0x527ef}, {0x52983, 0x52998}, + {0x529d8, 0x529db}, {0x52cf9, 0x52cfc}, {0x52e00, 0x52e2e}, {0x52e30, 0x52e49}, + {0x53001, 0x53003}, {0x53008, 0x53011}, {0x53014, 0x5301f}, {0x5a60d, 0x5a60f}, + {0x5a6f2, 0x5a6f7}, {0x5a874, 0x5a877}, {0x5a8f8, 0x5a8fa}, {0x5a9c1, 0x5a9cd}, + {0x5aa5c, 0x5aa5f}, {0x5fe10, 0x5fe19}, {0x5fe30, 0x5fe52}, {0x5fe54, 0x5fe61}, + {0x5ff01, 0x5ff03}, {0x5ff05, 0x5ff0a}, {0x5ff0c, 0x5ff0f}, {0x5ff3b, 0x5ff3d}, + {0x5ff5f, 0x5ff65}, {0x60021, 0x60023}, {0x60025, 0x6002a}, {0x6002c, 0x6002f}, + {0x6005b, 0x6005d}, {0x6055a, 0x6055f}, {0x6066a, 0x6066d}, {0x60700, 0x6070d}, + {0x607f7, 0x607f9}, {0x60830, 0x6083e}, {0x60f04, 0x60f12}, {0x60f3a, 0x60f3d}, + {0x60fd0, 0x60fd4}, {0x6104a, 0x6104f}, {0x61360, 0x61368}, {0x616eb, 0x616ed}, + {0x617d4, 0x617d6}, {0x617d8, 0x617da}, {0x61800, 0x6180a}, {0x61aa0, 0x61aa6}, + {0x61aa8, 0x61aad}, {0x61b5a, 0x61b60}, {0x61bfc, 0x61bff}, {0x61c3b, 0x61c3f}, + {0x61cc0, 0x61cc7}, {0x62010, 0x62027}, {0x62030, 0x62043}, {0x62045, 0x62051}, + {0x62053, 0x6205e}, {0x62308, 0x6230b}, {0x62768, 0x62775}, {0x627e6, 0x627ef}, + {0x62983, 0x62998}, {0x629d8, 0x629db}, {0x62cf9, 0x62cfc}, {0x62e00, 0x62e2e}, + {0x62e30, 0x62e49}, {0x63001, 0x63003}, {0x63008, 0x63011}, {0x63014, 0x6301f}, + {0x6a60d, 0x6a60f}, {0x6a6f2, 0x6a6f7}, {0x6a874, 0x6a877}, {0x6a8f8, 0x6a8fa}, + {0x6a9c1, 0x6a9cd}, {0x6aa5c, 0x6aa5f}, {0x6fe10, 0x6fe19}, {0x6fe30, 0x6fe52}, + {0x6fe54, 0x6fe61}, {0x6ff01, 0x6ff03}, {0x6ff05, 0x6ff0a}, {0x6ff0c, 0x6ff0f}, + {0x6ff3b, 0x6ff3d}, {0x6ff5f, 0x6ff65}, {0x70021, 0x70023}, {0x70025, 0x7002a}, + {0x7002c, 0x7002f}, {0x7005b, 0x7005d}, {0x7055a, 0x7055f}, {0x7066a, 0x7066d}, + {0x70700, 0x7070d}, {0x707f7, 0x707f9}, {0x70830, 0x7083e}, {0x70f04, 0x70f12}, + {0x70f3a, 0x70f3d}, {0x70fd0, 0x70fd4}, {0x7104a, 0x7104f}, {0x71360, 0x71368}, + {0x716eb, 0x716ed}, {0x717d4, 0x717d6}, {0x717d8, 0x717da}, {0x71800, 0x7180a}, + {0x71aa0, 0x71aa6}, {0x71aa8, 0x71aad}, {0x71b5a, 0x71b60}, {0x71bfc, 0x71bff}, + {0x71c3b, 0x71c3f}, {0x71cc0, 0x71cc7}, {0x72010, 0x72027}, {0x72030, 0x72043}, + {0x72045, 0x72051}, {0x72053, 0x7205e}, {0x72308, 0x7230b}, {0x72768, 0x72775}, + {0x727e6, 0x727ef}, {0x72983, 0x72998}, {0x729d8, 0x729db}, {0x72cf9, 0x72cfc}, + {0x72e00, 0x72e2e}, {0x72e30, 0x72e49}, {0x73001, 0x73003}, {0x73008, 0x73011}, + {0x73014, 0x7301f}, {0x7a60d, 0x7a60f}, {0x7a6f2, 0x7a6f7}, {0x7a874, 0x7a877}, + {0x7a8f8, 0x7a8fa}, {0x7a9c1, 0x7a9cd}, {0x7aa5c, 0x7aa5f}, {0x7fe10, 0x7fe19}, + {0x7fe30, 0x7fe52}, {0x7fe54, 0x7fe61}, {0x7ff01, 0x7ff03}, {0x7ff05, 0x7ff0a}, + {0x7ff0c, 0x7ff0f}, {0x7ff3b, 0x7ff3d}, {0x7ff5f, 0x7ff65}, {0x80021, 0x80023}, + {0x80025, 0x8002a}, {0x8002c, 0x8002f}, {0x8005b, 0x8005d}, {0x8055a, 0x8055f}, + {0x8066a, 0x8066d}, {0x80700, 0x8070d}, {0x807f7, 0x807f9}, {0x80830, 0x8083e}, + {0x80f04, 0x80f12}, {0x80f3a, 0x80f3d}, {0x80fd0, 0x80fd4}, {0x8104a, 0x8104f}, + {0x81360, 0x81368}, {0x816eb, 0x816ed}, {0x817d4, 0x817d6}, {0x817d8, 0x817da}, + {0x81800, 0x8180a}, {0x81aa0, 0x81aa6}, {0x81aa8, 0x81aad}, {0x81b5a, 0x81b60}, + {0x81bfc, 0x81bff}, {0x81c3b, 0x81c3f}, {0x81cc0, 0x81cc7}, {0x82010, 0x82027}, + {0x82030, 0x82043}, {0x82045, 0x82051}, {0x82053, 0x8205e}, {0x82308, 0x8230b}, + {0x82768, 0x82775}, {0x827e6, 0x827ef}, {0x82983, 0x82998}, {0x829d8, 0x829db}, + {0x82cf9, 0x82cfc}, {0x82e00, 0x82e2e}, {0x82e30, 0x82e49}, {0x83001, 0x83003}, + {0x83008, 0x83011}, {0x83014, 0x8301f}, {0x8a60d, 0x8a60f}, {0x8a6f2, 0x8a6f7}, + {0x8a874, 0x8a877}, {0x8a8f8, 0x8a8fa}, {0x8a9c1, 0x8a9cd}, {0x8aa5c, 0x8aa5f}, + {0x8fe10, 0x8fe19}, {0x8fe30, 0x8fe52}, {0x8fe54, 0x8fe61}, {0x8ff01, 0x8ff03}, + {0x8ff05, 0x8ff0a}, {0x8ff0c, 0x8ff0f}, {0x8ff3b, 0x8ff3d}, {0x8ff5f, 0x8ff65}, + {0x90021, 0x90023}, {0x90025, 0x9002a}, {0x9002c, 0x9002f}, {0x9005b, 0x9005d}, + {0x9055a, 0x9055f}, {0x9066a, 0x9066d}, {0x90700, 0x9070d}, {0x907f7, 0x907f9}, + {0x90830, 0x9083e}, {0x90f04, 0x90f12}, {0x90f3a, 0x90f3d}, {0x90fd0, 0x90fd4}, + {0x9104a, 0x9104f}, {0x91360, 0x91368}, {0x916eb, 0x916ed}, {0x917d4, 0x917d6}, + {0x917d8, 0x917da}, {0x91800, 0x9180a}, {0x91aa0, 0x91aa6}, {0x91aa8, 0x91aad}, + {0x91b5a, 0x91b60}, {0x91bfc, 0x91bff}, {0x91c3b, 0x91c3f}, {0x91cc0, 0x91cc7}, + {0x92010, 0x92027}, {0x92030, 0x92043}, {0x92045, 0x92051}, {0x92053, 0x9205e}, + {0x92308, 0x9230b}, {0x92768, 0x92775}, {0x927e6, 0x927ef}, {0x92983, 0x92998}, + {0x929d8, 0x929db}, {0x92cf9, 0x92cfc}, {0x92e00, 0x92e2e}, {0x92e30, 0x92e49}, + {0x93001, 0x93003}, {0x93008, 0x93011}, {0x93014, 0x9301f}, {0x9a60d, 0x9a60f}, + {0x9a6f2, 0x9a6f7}, {0x9a874, 0x9a877}, {0x9a8f8, 0x9a8fa}, {0x9a9c1, 0x9a9cd}, + {0x9aa5c, 0x9aa5f}, {0x9fe10, 0x9fe19}, {0x9fe30, 0x9fe52}, {0x9fe54, 0x9fe61}, + {0x9ff01, 0x9ff03}, {0x9ff05, 0x9ff0a}, {0x9ff0c, 0x9ff0f}, {0x9ff3b, 0x9ff3d}, + {0x9ff5f, 0x9ff65}, {0xa0021, 0xa0023}, {0xa0025, 0xa002a}, {0xa002c, 0xa002f}, + {0xa005b, 0xa005d}, {0xa055a, 0xa055f}, {0xa066a, 0xa066d}, {0xa0700, 0xa070d}, + {0xa07f7, 0xa07f9}, {0xa0830, 0xa083e}, {0xa0f04, 0xa0f12}, {0xa0f3a, 0xa0f3d}, + {0xa0fd0, 0xa0fd4}, {0xa104a, 0xa104f}, {0xa1360, 0xa1368}, {0xa16eb, 0xa16ed}, + {0xa17d4, 0xa17d6}, {0xa17d8, 0xa17da}, {0xa1800, 0xa180a}, {0xa1aa0, 0xa1aa6}, + {0xa1aa8, 0xa1aad}, {0xa1b5a, 0xa1b60}, {0xa1bfc, 0xa1bff}, {0xa1c3b, 0xa1c3f}, + {0xa1cc0, 0xa1cc7}, {0xa2010, 0xa2027}, {0xa2030, 0xa2043}, {0xa2045, 0xa2051}, + {0xa2053, 0xa205e}, {0xa2308, 0xa230b}, {0xa2768, 0xa2775}, {0xa27e6, 0xa27ef}, + {0xa2983, 0xa2998}, {0xa29d8, 0xa29db}, {0xa2cf9, 0xa2cfc}, {0xa2e00, 0xa2e2e}, + {0xa2e30, 0xa2e49}, {0xa3001, 0xa3003}, {0xa3008, 0xa3011}, {0xa3014, 0xa301f}, + {0xaa60d, 0xaa60f}, {0xaa6f2, 0xaa6f7}, {0xaa874, 0xaa877}, {0xaa8f8, 0xaa8fa}, + {0xaa9c1, 0xaa9cd}, {0xaaa5c, 0xaaa5f}, {0xafe10, 0xafe19}, {0xafe30, 0xafe52}, + {0xafe54, 0xafe61}, {0xaff01, 0xaff03}, {0xaff05, 0xaff0a}, {0xaff0c, 0xaff0f}, + {0xaff3b, 0xaff3d}, {0xaff5f, 0xaff65}, {0xb0021, 0xb0023}, {0xb0025, 0xb002a}, + {0xb002c, 0xb002f}, {0xb005b, 0xb005d}, {0xb055a, 0xb055f}, {0xb066a, 0xb066d}, + {0xb0700, 0xb070d}, {0xb07f7, 0xb07f9}, {0xb0830, 0xb083e}, {0xb0f04, 0xb0f12}, + {0xb0f3a, 0xb0f3d}, {0xb0fd0, 0xb0fd4}, {0xb104a, 0xb104f}, {0xb1360, 0xb1368}, + {0xb16eb, 0xb16ed}, {0xb17d4, 0xb17d6}, {0xb17d8, 0xb17da}, {0xb1800, 0xb180a}, + {0xb1aa0, 0xb1aa6}, {0xb1aa8, 0xb1aad}, {0xb1b5a, 0xb1b60}, {0xb1bfc, 0xb1bff}, + {0xb1c3b, 0xb1c3f}, {0xb1cc0, 0xb1cc7}, {0xb2010, 0xb2027}, {0xb2030, 0xb2043}, + {0xb2045, 0xb2051}, {0xb2053, 0xb205e}, {0xb2308, 0xb230b}, {0xb2768, 0xb2775}, + {0xb27e6, 0xb27ef}, {0xb2983, 0xb2998}, {0xb29d8, 0xb29db}, {0xb2cf9, 0xb2cfc}, + {0xb2e00, 0xb2e2e}, {0xb2e30, 0xb2e49}, {0xb3001, 0xb3003}, {0xb3008, 0xb3011}, + {0xb3014, 0xb301f}, {0xba60d, 0xba60f}, {0xba6f2, 0xba6f7}, {0xba874, 0xba877}, + {0xba8f8, 0xba8fa}, {0xba9c1, 0xba9cd}, {0xbaa5c, 0xbaa5f}, {0xbfe10, 0xbfe19}, + {0xbfe30, 0xbfe52}, {0xbfe54, 0xbfe61}, {0xbff01, 0xbff03}, {0xbff05, 0xbff0a}, + {0xbff0c, 0xbff0f}, {0xbff3b, 0xbff3d}, {0xbff5f, 0xbff65}, {0xc0021, 0xc0023}, + {0xc0025, 0xc002a}, {0xc002c, 0xc002f}, {0xc005b, 0xc005d}, {0xc055a, 0xc055f}, + {0xc066a, 0xc066d}, {0xc0700, 0xc070d}, {0xc07f7, 0xc07f9}, {0xc0830, 0xc083e}, + {0xc0f04, 0xc0f12}, {0xc0f3a, 0xc0f3d}, {0xc0fd0, 0xc0fd4}, {0xc104a, 0xc104f}, + {0xc1360, 0xc1368}, {0xc16eb, 0xc16ed}, {0xc17d4, 0xc17d6}, {0xc17d8, 0xc17da}, + {0xc1800, 0xc180a}, {0xc1aa0, 0xc1aa6}, {0xc1aa8, 0xc1aad}, {0xc1b5a, 0xc1b60}, + {0xc1bfc, 0xc1bff}, {0xc1c3b, 0xc1c3f}, {0xc1cc0, 0xc1cc7}, {0xc2010, 0xc2027}, + {0xc2030, 0xc2043}, {0xc2045, 0xc2051}, {0xc2053, 0xc205e}, {0xc2308, 0xc230b}, + {0xc2768, 0xc2775}, {0xc27e6, 0xc27ef}, {0xc2983, 0xc2998}, {0xc29d8, 0xc29db}, + {0xc2cf9, 0xc2cfc}, {0xc2e00, 0xc2e2e}, {0xc2e30, 0xc2e49}, {0xc3001, 0xc3003}, + {0xc3008, 0xc3011}, {0xc3014, 0xc301f}, {0xca60d, 0xca60f}, {0xca6f2, 0xca6f7}, + {0xca874, 0xca877}, {0xca8f8, 0xca8fa}, {0xca9c1, 0xca9cd}, {0xcaa5c, 0xcaa5f}, + {0xcfe10, 0xcfe19}, {0xcfe30, 0xcfe52}, {0xcfe54, 0xcfe61}, {0xcff01, 0xcff03}, + {0xcff05, 0xcff0a}, {0xcff0c, 0xcff0f}, {0xcff3b, 0xcff3d}, {0xcff5f, 0xcff65}, + {0xd0021, 0xd0023}, {0xd0025, 0xd002a}, {0xd002c, 0xd002f}, {0xd005b, 0xd005d}, + {0xd055a, 0xd055f}, {0xd066a, 0xd066d}, {0xd0700, 0xd070d}, {0xd07f7, 0xd07f9}, + {0xd0830, 0xd083e}, {0xd0f04, 0xd0f12}, {0xd0f3a, 0xd0f3d}, {0xd0fd0, 0xd0fd4}, + {0xd104a, 0xd104f}, {0xd1360, 0xd1368}, {0xd16eb, 0xd16ed}, {0xd17d4, 0xd17d6}, + {0xd17d8, 0xd17da}, {0xd1800, 0xd180a}, {0xd1aa0, 0xd1aa6}, {0xd1aa8, 0xd1aad}, + {0xd1b5a, 0xd1b60}, {0xd1bfc, 0xd1bff}, {0xd1c3b, 0xd1c3f}, {0xd1cc0, 0xd1cc7}, + {0xd2010, 0xd2027}, {0xd2030, 0xd2043}, {0xd2045, 0xd2051}, {0xd2053, 0xd205e}, + {0xd2308, 0xd230b}, {0xd2768, 0xd2775}, {0xd27e6, 0xd27ef}, {0xd2983, 0xd2998}, + {0xd29d8, 0xd29db}, {0xd2cf9, 0xd2cfc}, {0xd2e00, 0xd2e2e}, {0xd2e30, 0xd2e49}, + {0xd3001, 0xd3003}, {0xd3008, 0xd3011}, {0xd3014, 0xd301f}, {0xda60d, 0xda60f}, + {0xda6f2, 0xda6f7}, {0xda874, 0xda877}, {0xda8f8, 0xda8fa}, {0xda9c1, 0xda9cd}, + {0xdaa5c, 0xdaa5f}, {0xdfe10, 0xdfe19}, {0xdfe30, 0xdfe52}, {0xdfe54, 0xdfe61}, + {0xdff01, 0xdff03}, {0xdff05, 0xdff0a}, {0xdff0c, 0xdff0f}, {0xdff3b, 0xdff3d}, + {0xdff5f, 0xdff65}, {0xe0021, 0xe0023}, {0xe0025, 0xe002a}, {0xe002c, 0xe002f}, + {0xe005b, 0xe005d}, {0xe055a, 0xe055f}, {0xe066a, 0xe066d}, {0xe0700, 0xe070d}, + {0xe07f7, 0xe07f9}, {0xe0830, 0xe083e}, {0xe0f04, 0xe0f12}, {0xe0f3a, 0xe0f3d}, + {0xe0fd0, 0xe0fd4}, {0xe104a, 0xe104f}, {0xe1360, 0xe1368}, {0xe16eb, 0xe16ed}, + {0xe17d4, 0xe17d6}, {0xe17d8, 0xe17da}, {0xe1800, 0xe180a}, {0xe1aa0, 0xe1aa6}, + {0xe1aa8, 0xe1aad}, {0xe1b5a, 0xe1b60}, {0xe1bfc, 0xe1bff}, {0xe1c3b, 0xe1c3f}, + {0xe1cc0, 0xe1cc7}, {0xe2010, 0xe2027}, {0xe2030, 0xe2043}, {0xe2045, 0xe2051}, + {0xe2053, 0xe205e}, {0xe2308, 0xe230b}, {0xe2768, 0xe2775}, {0xe27e6, 0xe27ef}, + {0xe2983, 0xe2998}, {0xe29d8, 0xe29db}, {0xe2cf9, 0xe2cfc}, {0xe2e00, 0xe2e2e}, + {0xe2e30, 0xe2e49}, {0xe3001, 0xe3003}, {0xe3008, 0xe3011}, {0xe3014, 0xe301f}, + {0xea60d, 0xea60f}, {0xea6f2, 0xea6f7}, {0xea874, 0xea877}, {0xea8f8, 0xea8fa}, + {0xea9c1, 0xea9cd}, {0xeaa5c, 0xeaa5f}, {0xefe10, 0xefe19}, {0xefe30, 0xefe52}, + {0xefe54, 0xefe61}, {0xeff01, 0xeff03}, {0xeff05, 0xeff0a}, {0xeff0c, 0xeff0f}, + {0xeff3b, 0xeff3d}, {0xeff5f, 0xeff65}, {0xf0021, 0xf0023}, {0xf0025, 0xf002a}, + {0xf002c, 0xf002f}, {0xf005b, 0xf005d}, {0xf055a, 0xf055f}, {0xf066a, 0xf066d}, + {0xf0700, 0xf070d}, {0xf07f7, 0xf07f9}, {0xf0830, 0xf083e}, {0xf0f04, 0xf0f12}, + {0xf0f3a, 0xf0f3d}, {0xf0fd0, 0xf0fd4}, {0xf104a, 0xf104f}, {0xf1360, 0xf1368}, + {0xf16eb, 0xf16ed}, {0xf17d4, 0xf17d6}, {0xf17d8, 0xf17da}, {0xf1800, 0xf180a}, + {0xf1aa0, 0xf1aa6}, {0xf1aa8, 0xf1aad}, {0xf1b5a, 0xf1b60}, {0xf1bfc, 0xf1bff}, + {0xf1c3b, 0xf1c3f}, {0xf1cc0, 0xf1cc7}, {0xf2010, 0xf2027}, {0xf2030, 0xf2043}, + {0xf2045, 0xf2051}, {0xf2053, 0xf205e}, {0xf2308, 0xf230b}, {0xf2768, 0xf2775}, + {0xf27e6, 0xf27ef}, {0xf2983, 0xf2998}, {0xf29d8, 0xf29db}, {0xf2cf9, 0xf2cfc}, + {0xf2e00, 0xf2e2e}, {0xf2e30, 0xf2e49}, {0xf3001, 0xf3003}, {0xf3008, 0xf3011}, + {0xf3014, 0xf301f}, {0xfa60d, 0xfa60f}, {0xfa6f2, 0xfa6f7}, {0xfa874, 0xfa877}, + {0xfa8f8, 0xfa8fa}, {0xfa9c1, 0xfa9cd}, {0xfaa5c, 0xfaa5f}, {0xffe10, 0xffe19}, + {0xffe30, 0xffe52}, {0xffe54, 0xffe61}, {0xfff01, 0xfff03}, {0xfff05, 0xfff0a}, + {0xfff0c, 0xfff0f}, {0xfff3b, 0xfff3d}, {0xfff5f, 0xfff65}, {0x100021, 0x100023}, + {0x100025, 0x10002a}, {0x10002c, 0x10002f}, {0x10005b, 0x10005d}, {0x10055a, 0x10055f}, + {0x10066a, 0x10066d}, {0x100700, 0x10070d}, {0x1007f7, 0x1007f9}, {0x100830, 0x10083e}, + {0x100f04, 0x100f12}, {0x100f3a, 0x100f3d}, {0x100fd0, 0x100fd4}, {0x10104a, 0x10104f}, + {0x101360, 0x101368}, {0x1016eb, 0x1016ed}, {0x1017d4, 0x1017d6}, {0x1017d8, 0x1017da}, + {0x101800, 0x10180a}, {0x101aa0, 0x101aa6}, {0x101aa8, 0x101aad}, {0x101b5a, 0x101b60}, + {0x101bfc, 0x101bff}, {0x101c3b, 0x101c3f}, {0x101cc0, 0x101cc7}, {0x102010, 0x102027}, + {0x102030, 0x102043}, {0x102045, 0x102051}, {0x102053, 0x10205e}, {0x102308, 0x10230b}, + {0x102768, 0x102775}, {0x1027e6, 0x1027ef}, {0x102983, 0x102998}, {0x1029d8, 0x1029db}, + {0x102cf9, 0x102cfc}, {0x102e00, 0x102e2e}, {0x102e30, 0x102e49}, {0x103001, 0x103003}, + {0x103008, 0x103011}, {0x103014, 0x10301f}, {0x10a60d, 0x10a60f}, {0x10a6f2, 0x10a6f7}, + {0x10a874, 0x10a877}, {0x10a8f8, 0x10a8fa}, {0x10a9c1, 0x10a9cd}, {0x10aa5c, 0x10aa5f}, + {0x10fe10, 0x10fe19}, {0x10fe30, 0x10fe52}, {0x10fe54, 0x10fe61}, {0x10ff01, 0x10ff03}, + {0x10ff05, 0x10ff0a}, {0x10ff0c, 0x10ff0f}, {0x10ff3b, 0x10ff3d}, {0x10ff5f, 0x10ff65} #endif }; @@ -367,18 +2044,207 @@ static const chr punctCharTable[] = { 0xab, 0xb6, 0xb7, 0xbb, 0xbf, 0x37e, 0x387, 0x589, 0x58a, 0x5be, 0x5c0, 0x5c3, 0x5c6, 0x5f3, 0x5f4, 0x609, 0x60a, 0x60c, 0x60d, 0x61b, 0x61e, 0x61f, 0x6d4, 0x85e, 0x964, 0x965, 0x970, - 0xaf0, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14, 0xf85, 0xfd9, 0xfda, - 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x1735, 0x1736, 0x1944, - 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, 0x208d, - 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, 0x2cff, - 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, 0xa67e, - 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, 0xaade, - 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a, - 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d + 0x9fd, 0xaf0, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14, 0xf85, 0xfd9, + 0xfda, 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x1735, 0x1736, + 0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, + 0x208d, 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, + 0x2cff, 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, + 0xa67e, 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, + 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, + 0xfe6a, 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d #if TCL_UTF_MAX > 4 - ,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc, - 0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x11c70, - 0x11c71, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f, 0x1e95e, 0x1e95f + ,0x1003a, 0x1003b, 0x1003f, 0x10040, 0x1005f, 0x1007b, 0x1007d, 0x100a1, 0x100a7, + 0x100ab, 0x100b6, 0x100b7, 0x100bb, 0x100bf, 0x1037e, 0x10387, 0x10589, 0x1058a, + 0x105be, 0x105c0, 0x105c3, 0x105c6, 0x105f3, 0x105f4, 0x10609, 0x1060a, 0x1060c, + 0x1060d, 0x1061b, 0x1061e, 0x1061f, 0x106d4, 0x1085e, 0x10964, 0x10965, 0x10970, + 0x109fd, 0x10af0, 0x10df4, 0x10e4f, 0x10e5a, 0x10e5b, 0x10f14, 0x10f85, 0x10fd9, + 0x10fda, 0x110fb, 0x11400, 0x1166d, 0x1166e, 0x1169b, 0x1169c, 0x11735, 0x11736, + 0x11944, 0x11945, 0x11a1e, 0x11a1f, 0x11c7e, 0x11c7f, 0x11cd3, 0x1207d, 0x1207e, + 0x1208d, 0x1208e, 0x12329, 0x1232a, 0x127c5, 0x127c6, 0x129fc, 0x129fd, 0x12cfe, + 0x12cff, 0x12d70, 0x13030, 0x1303d, 0x130a0, 0x130fb, 0x1a4fe, 0x1a4ff, 0x1a673, + 0x1a67e, 0x1a8ce, 0x1a8cf, 0x1a8fc, 0x1a92e, 0x1a92f, 0x1a95f, 0x1a9de, 0x1a9df, + 0x1aade, 0x1aadf, 0x1aaf0, 0x1aaf1, 0x1abeb, 0x1fd3e, 0x1fd3f, 0x1fe63, 0x1fe68, + 0x1fe6a, 0x1fe6b, 0x1ff1a, 0x1ff1b, 0x1ff1f, 0x1ff20, 0x1ff3f, 0x1ff5b, 0x1ff5d, + 0x2003a, 0x2003b, 0x2003f, 0x20040, 0x2005f, 0x2007b, 0x2007d, 0x200a1, 0x200a7, + 0x200ab, 0x200b6, 0x200b7, 0x200bb, 0x200bf, 0x2037e, 0x20387, 0x20589, 0x2058a, + 0x205be, 0x205c0, 0x205c3, 0x205c6, 0x205f3, 0x205f4, 0x20609, 0x2060a, 0x2060c, + 0x2060d, 0x2061b, 0x2061e, 0x2061f, 0x206d4, 0x2085e, 0x20964, 0x20965, 0x20970, + 0x209fd, 0x20af0, 0x20df4, 0x20e4f, 0x20e5a, 0x20e5b, 0x20f14, 0x20f85, 0x20fd9, + 0x20fda, 0x210fb, 0x21400, 0x2166d, 0x2166e, 0x2169b, 0x2169c, 0x21735, 0x21736, + 0x21944, 0x21945, 0x21a1e, 0x21a1f, 0x21c7e, 0x21c7f, 0x21cd3, 0x2207d, 0x2207e, + 0x2208d, 0x2208e, 0x22329, 0x2232a, 0x227c5, 0x227c6, 0x229fc, 0x229fd, 0x22cfe, + 0x22cff, 0x22d70, 0x23030, 0x2303d, 0x230a0, 0x230fb, 0x2a4fe, 0x2a4ff, 0x2a673, + 0x2a67e, 0x2a8ce, 0x2a8cf, 0x2a8fc, 0x2a92e, 0x2a92f, 0x2a95f, 0x2a9de, 0x2a9df, + 0x2aade, 0x2aadf, 0x2aaf0, 0x2aaf1, 0x2abeb, 0x2fd3e, 0x2fd3f, 0x2fe63, 0x2fe68, + 0x2fe6a, 0x2fe6b, 0x2ff1a, 0x2ff1b, 0x2ff1f, 0x2ff20, 0x2ff3f, 0x2ff5b, 0x2ff5d, + 0x3003a, 0x3003b, 0x3003f, 0x30040, 0x3005f, 0x3007b, 0x3007d, 0x300a1, 0x300a7, + 0x300ab, 0x300b6, 0x300b7, 0x300bb, 0x300bf, 0x3037e, 0x30387, 0x30589, 0x3058a, + 0x305be, 0x305c0, 0x305c3, 0x305c6, 0x305f3, 0x305f4, 0x30609, 0x3060a, 0x3060c, + 0x3060d, 0x3061b, 0x3061e, 0x3061f, 0x306d4, 0x3085e, 0x30964, 0x30965, 0x30970, + 0x309fd, 0x30af0, 0x30df4, 0x30e4f, 0x30e5a, 0x30e5b, 0x30f14, 0x30f85, 0x30fd9, + 0x30fda, 0x310fb, 0x31400, 0x3166d, 0x3166e, 0x3169b, 0x3169c, 0x31735, 0x31736, + 0x31944, 0x31945, 0x31a1e, 0x31a1f, 0x31c7e, 0x31c7f, 0x31cd3, 0x3207d, 0x3207e, + 0x3208d, 0x3208e, 0x32329, 0x3232a, 0x327c5, 0x327c6, 0x329fc, 0x329fd, 0x32cfe, + 0x32cff, 0x32d70, 0x33030, 0x3303d, 0x330a0, 0x330fb, 0x3a4fe, 0x3a4ff, 0x3a673, + 0x3a67e, 0x3a8ce, 0x3a8cf, 0x3a8fc, 0x3a92e, 0x3a92f, 0x3a95f, 0x3a9de, 0x3a9df, + 0x3aade, 0x3aadf, 0x3aaf0, 0x3aaf1, 0x3abeb, 0x3fd3e, 0x3fd3f, 0x3fe63, 0x3fe68, + 0x3fe6a, 0x3fe6b, 0x3ff1a, 0x3ff1b, 0x3ff1f, 0x3ff20, 0x3ff3f, 0x3ff5b, 0x3ff5d, + 0x4003a, 0x4003b, 0x4003f, 0x40040, 0x4005f, 0x4007b, 0x4007d, 0x400a1, 0x400a7, + 0x400ab, 0x400b6, 0x400b7, 0x400bb, 0x400bf, 0x4037e, 0x40387, 0x40589, 0x4058a, + 0x405be, 0x405c0, 0x405c3, 0x405c6, 0x405f3, 0x405f4, 0x40609, 0x4060a, 0x4060c, + 0x4060d, 0x4061b, 0x4061e, 0x4061f, 0x406d4, 0x4085e, 0x40964, 0x40965, 0x40970, + 0x409fd, 0x40af0, 0x40df4, 0x40e4f, 0x40e5a, 0x40e5b, 0x40f14, 0x40f85, 0x40fd9, + 0x40fda, 0x410fb, 0x41400, 0x4166d, 0x4166e, 0x4169b, 0x4169c, 0x41735, 0x41736, + 0x41944, 0x41945, 0x41a1e, 0x41a1f, 0x41c7e, 0x41c7f, 0x41cd3, 0x4207d, 0x4207e, + 0x4208d, 0x4208e, 0x42329, 0x4232a, 0x427c5, 0x427c6, 0x429fc, 0x429fd, 0x42cfe, + 0x42cff, 0x42d70, 0x43030, 0x4303d, 0x430a0, 0x430fb, 0x4a4fe, 0x4a4ff, 0x4a673, + 0x4a67e, 0x4a8ce, 0x4a8cf, 0x4a8fc, 0x4a92e, 0x4a92f, 0x4a95f, 0x4a9de, 0x4a9df, + 0x4aade, 0x4aadf, 0x4aaf0, 0x4aaf1, 0x4abeb, 0x4fd3e, 0x4fd3f, 0x4fe63, 0x4fe68, + 0x4fe6a, 0x4fe6b, 0x4ff1a, 0x4ff1b, 0x4ff1f, 0x4ff20, 0x4ff3f, 0x4ff5b, 0x4ff5d, + 0x5003a, 0x5003b, 0x5003f, 0x50040, 0x5005f, 0x5007b, 0x5007d, 0x500a1, 0x500a7, + 0x500ab, 0x500b6, 0x500b7, 0x500bb, 0x500bf, 0x5037e, 0x50387, 0x50589, 0x5058a, + 0x505be, 0x505c0, 0x505c3, 0x505c6, 0x505f3, 0x505f4, 0x50609, 0x5060a, 0x5060c, + 0x5060d, 0x5061b, 0x5061e, 0x5061f, 0x506d4, 0x5085e, 0x50964, 0x50965, 0x50970, + 0x509fd, 0x50af0, 0x50df4, 0x50e4f, 0x50e5a, 0x50e5b, 0x50f14, 0x50f85, 0x50fd9, + 0x50fda, 0x510fb, 0x51400, 0x5166d, 0x5166e, 0x5169b, 0x5169c, 0x51735, 0x51736, + 0x51944, 0x51945, 0x51a1e, 0x51a1f, 0x51c7e, 0x51c7f, 0x51cd3, 0x5207d, 0x5207e, + 0x5208d, 0x5208e, 0x52329, 0x5232a, 0x527c5, 0x527c6, 0x529fc, 0x529fd, 0x52cfe, + 0x52cff, 0x52d70, 0x53030, 0x5303d, 0x530a0, 0x530fb, 0x5a4fe, 0x5a4ff, 0x5a673, + 0x5a67e, 0x5a8ce, 0x5a8cf, 0x5a8fc, 0x5a92e, 0x5a92f, 0x5a95f, 0x5a9de, 0x5a9df, + 0x5aade, 0x5aadf, 0x5aaf0, 0x5aaf1, 0x5abeb, 0x5fd3e, 0x5fd3f, 0x5fe63, 0x5fe68, + 0x5fe6a, 0x5fe6b, 0x5ff1a, 0x5ff1b, 0x5ff1f, 0x5ff20, 0x5ff3f, 0x5ff5b, 0x5ff5d, + 0x6003a, 0x6003b, 0x6003f, 0x60040, 0x6005f, 0x6007b, 0x6007d, 0x600a1, 0x600a7, + 0x600ab, 0x600b6, 0x600b7, 0x600bb, 0x600bf, 0x6037e, 0x60387, 0x60589, 0x6058a, + 0x605be, 0x605c0, 0x605c3, 0x605c6, 0x605f3, 0x605f4, 0x60609, 0x6060a, 0x6060c, + 0x6060d, 0x6061b, 0x6061e, 0x6061f, 0x606d4, 0x6085e, 0x60964, 0x60965, 0x60970, + 0x609fd, 0x60af0, 0x60df4, 0x60e4f, 0x60e5a, 0x60e5b, 0x60f14, 0x60f85, 0x60fd9, + 0x60fda, 0x610fb, 0x61400, 0x6166d, 0x6166e, 0x6169b, 0x6169c, 0x61735, 0x61736, + 0x61944, 0x61945, 0x61a1e, 0x61a1f, 0x61c7e, 0x61c7f, 0x61cd3, 0x6207d, 0x6207e, + 0x6208d, 0x6208e, 0x62329, 0x6232a, 0x627c5, 0x627c6, 0x629fc, 0x629fd, 0x62cfe, + 0x62cff, 0x62d70, 0x63030, 0x6303d, 0x630a0, 0x630fb, 0x6a4fe, 0x6a4ff, 0x6a673, + 0x6a67e, 0x6a8ce, 0x6a8cf, 0x6a8fc, 0x6a92e, 0x6a92f, 0x6a95f, 0x6a9de, 0x6a9df, + 0x6aade, 0x6aadf, 0x6aaf0, 0x6aaf1, 0x6abeb, 0x6fd3e, 0x6fd3f, 0x6fe63, 0x6fe68, + 0x6fe6a, 0x6fe6b, 0x6ff1a, 0x6ff1b, 0x6ff1f, 0x6ff20, 0x6ff3f, 0x6ff5b, 0x6ff5d, + 0x7003a, 0x7003b, 0x7003f, 0x70040, 0x7005f, 0x7007b, 0x7007d, 0x700a1, 0x700a7, + 0x700ab, 0x700b6, 0x700b7, 0x700bb, 0x700bf, 0x7037e, 0x70387, 0x70589, 0x7058a, + 0x705be, 0x705c0, 0x705c3, 0x705c6, 0x705f3, 0x705f4, 0x70609, 0x7060a, 0x7060c, + 0x7060d, 0x7061b, 0x7061e, 0x7061f, 0x706d4, 0x7085e, 0x70964, 0x70965, 0x70970, + 0x709fd, 0x70af0, 0x70df4, 0x70e4f, 0x70e5a, 0x70e5b, 0x70f14, 0x70f85, 0x70fd9, + 0x70fda, 0x710fb, 0x71400, 0x7166d, 0x7166e, 0x7169b, 0x7169c, 0x71735, 0x71736, + 0x71944, 0x71945, 0x71a1e, 0x71a1f, 0x71c7e, 0x71c7f, 0x71cd3, 0x7207d, 0x7207e, + 0x7208d, 0x7208e, 0x72329, 0x7232a, 0x727c5, 0x727c6, 0x729fc, 0x729fd, 0x72cfe, + 0x72cff, 0x72d70, 0x73030, 0x7303d, 0x730a0, 0x730fb, 0x7a4fe, 0x7a4ff, 0x7a673, + 0x7a67e, 0x7a8ce, 0x7a8cf, 0x7a8fc, 0x7a92e, 0x7a92f, 0x7a95f, 0x7a9de, 0x7a9df, + 0x7aade, 0x7aadf, 0x7aaf0, 0x7aaf1, 0x7abeb, 0x7fd3e, 0x7fd3f, 0x7fe63, 0x7fe68, + 0x7fe6a, 0x7fe6b, 0x7ff1a, 0x7ff1b, 0x7ff1f, 0x7ff20, 0x7ff3f, 0x7ff5b, 0x7ff5d, + 0x8003a, 0x8003b, 0x8003f, 0x80040, 0x8005f, 0x8007b, 0x8007d, 0x800a1, 0x800a7, + 0x800ab, 0x800b6, 0x800b7, 0x800bb, 0x800bf, 0x8037e, 0x80387, 0x80589, 0x8058a, + 0x805be, 0x805c0, 0x805c3, 0x805c6, 0x805f3, 0x805f4, 0x80609, 0x8060a, 0x8060c, + 0x8060d, 0x8061b, 0x8061e, 0x8061f, 0x806d4, 0x8085e, 0x80964, 0x80965, 0x80970, + 0x809fd, 0x80af0, 0x80df4, 0x80e4f, 0x80e5a, 0x80e5b, 0x80f14, 0x80f85, 0x80fd9, + 0x80fda, 0x810fb, 0x81400, 0x8166d, 0x8166e, 0x8169b, 0x8169c, 0x81735, 0x81736, + 0x81944, 0x81945, 0x81a1e, 0x81a1f, 0x81c7e, 0x81c7f, 0x81cd3, 0x8207d, 0x8207e, + 0x8208d, 0x8208e, 0x82329, 0x8232a, 0x827c5, 0x827c6, 0x829fc, 0x829fd, 0x82cfe, + 0x82cff, 0x82d70, 0x83030, 0x8303d, 0x830a0, 0x830fb, 0x8a4fe, 0x8a4ff, 0x8a673, + 0x8a67e, 0x8a8ce, 0x8a8cf, 0x8a8fc, 0x8a92e, 0x8a92f, 0x8a95f, 0x8a9de, 0x8a9df, + 0x8aade, 0x8aadf, 0x8aaf0, 0x8aaf1, 0x8abeb, 0x8fd3e, 0x8fd3f, 0x8fe63, 0x8fe68, + 0x8fe6a, 0x8fe6b, 0x8ff1a, 0x8ff1b, 0x8ff1f, 0x8ff20, 0x8ff3f, 0x8ff5b, 0x8ff5d, + 0x9003a, 0x9003b, 0x9003f, 0x90040, 0x9005f, 0x9007b, 0x9007d, 0x900a1, 0x900a7, + 0x900ab, 0x900b6, 0x900b7, 0x900bb, 0x900bf, 0x9037e, 0x90387, 0x90589, 0x9058a, + 0x905be, 0x905c0, 0x905c3, 0x905c6, 0x905f3, 0x905f4, 0x90609, 0x9060a, 0x9060c, + 0x9060d, 0x9061b, 0x9061e, 0x9061f, 0x906d4, 0x9085e, 0x90964, 0x90965, 0x90970, + 0x909fd, 0x90af0, 0x90df4, 0x90e4f, 0x90e5a, 0x90e5b, 0x90f14, 0x90f85, 0x90fd9, + 0x90fda, 0x910fb, 0x91400, 0x9166d, 0x9166e, 0x9169b, 0x9169c, 0x91735, 0x91736, + 0x91944, 0x91945, 0x91a1e, 0x91a1f, 0x91c7e, 0x91c7f, 0x91cd3, 0x9207d, 0x9207e, + 0x9208d, 0x9208e, 0x92329, 0x9232a, 0x927c5, 0x927c6, 0x929fc, 0x929fd, 0x92cfe, + 0x92cff, 0x92d70, 0x93030, 0x9303d, 0x930a0, 0x930fb, 0x9a4fe, 0x9a4ff, 0x9a673, + 0x9a67e, 0x9a8ce, 0x9a8cf, 0x9a8fc, 0x9a92e, 0x9a92f, 0x9a95f, 0x9a9de, 0x9a9df, + 0x9aade, 0x9aadf, 0x9aaf0, 0x9aaf1, 0x9abeb, 0x9fd3e, 0x9fd3f, 0x9fe63, 0x9fe68, + 0x9fe6a, 0x9fe6b, 0x9ff1a, 0x9ff1b, 0x9ff1f, 0x9ff20, 0x9ff3f, 0x9ff5b, 0x9ff5d, + 0xa003a, 0xa003b, 0xa003f, 0xa0040, 0xa005f, 0xa007b, 0xa007d, 0xa00a1, 0xa00a7, + 0xa00ab, 0xa00b6, 0xa00b7, 0xa00bb, 0xa00bf, 0xa037e, 0xa0387, 0xa0589, 0xa058a, + 0xa05be, 0xa05c0, 0xa05c3, 0xa05c6, 0xa05f3, 0xa05f4, 0xa0609, 0xa060a, 0xa060c, + 0xa060d, 0xa061b, 0xa061e, 0xa061f, 0xa06d4, 0xa085e, 0xa0964, 0xa0965, 0xa0970, + 0xa09fd, 0xa0af0, 0xa0df4, 0xa0e4f, 0xa0e5a, 0xa0e5b, 0xa0f14, 0xa0f85, 0xa0fd9, + 0xa0fda, 0xa10fb, 0xa1400, 0xa166d, 0xa166e, 0xa169b, 0xa169c, 0xa1735, 0xa1736, + 0xa1944, 0xa1945, 0xa1a1e, 0xa1a1f, 0xa1c7e, 0xa1c7f, 0xa1cd3, 0xa207d, 0xa207e, + 0xa208d, 0xa208e, 0xa2329, 0xa232a, 0xa27c5, 0xa27c6, 0xa29fc, 0xa29fd, 0xa2cfe, + 0xa2cff, 0xa2d70, 0xa3030, 0xa303d, 0xa30a0, 0xa30fb, 0xaa4fe, 0xaa4ff, 0xaa673, + 0xaa67e, 0xaa8ce, 0xaa8cf, 0xaa8fc, 0xaa92e, 0xaa92f, 0xaa95f, 0xaa9de, 0xaa9df, + 0xaaade, 0xaaadf, 0xaaaf0, 0xaaaf1, 0xaabeb, 0xafd3e, 0xafd3f, 0xafe63, 0xafe68, + 0xafe6a, 0xafe6b, 0xaff1a, 0xaff1b, 0xaff1f, 0xaff20, 0xaff3f, 0xaff5b, 0xaff5d, + 0xb003a, 0xb003b, 0xb003f, 0xb0040, 0xb005f, 0xb007b, 0xb007d, 0xb00a1, 0xb00a7, + 0xb00ab, 0xb00b6, 0xb00b7, 0xb00bb, 0xb00bf, 0xb037e, 0xb0387, 0xb0589, 0xb058a, + 0xb05be, 0xb05c0, 0xb05c3, 0xb05c6, 0xb05f3, 0xb05f4, 0xb0609, 0xb060a, 0xb060c, + 0xb060d, 0xb061b, 0xb061e, 0xb061f, 0xb06d4, 0xb085e, 0xb0964, 0xb0965, 0xb0970, + 0xb09fd, 0xb0af0, 0xb0df4, 0xb0e4f, 0xb0e5a, 0xb0e5b, 0xb0f14, 0xb0f85, 0xb0fd9, + 0xb0fda, 0xb10fb, 0xb1400, 0xb166d, 0xb166e, 0xb169b, 0xb169c, 0xb1735, 0xb1736, + 0xb1944, 0xb1945, 0xb1a1e, 0xb1a1f, 0xb1c7e, 0xb1c7f, 0xb1cd3, 0xb207d, 0xb207e, + 0xb208d, 0xb208e, 0xb2329, 0xb232a, 0xb27c5, 0xb27c6, 0xb29fc, 0xb29fd, 0xb2cfe, + 0xb2cff, 0xb2d70, 0xb3030, 0xb303d, 0xb30a0, 0xb30fb, 0xba4fe, 0xba4ff, 0xba673, + 0xba67e, 0xba8ce, 0xba8cf, 0xba8fc, 0xba92e, 0xba92f, 0xba95f, 0xba9de, 0xba9df, + 0xbaade, 0xbaadf, 0xbaaf0, 0xbaaf1, 0xbabeb, 0xbfd3e, 0xbfd3f, 0xbfe63, 0xbfe68, + 0xbfe6a, 0xbfe6b, 0xbff1a, 0xbff1b, 0xbff1f, 0xbff20, 0xbff3f, 0xbff5b, 0xbff5d, + 0xc003a, 0xc003b, 0xc003f, 0xc0040, 0xc005f, 0xc007b, 0xc007d, 0xc00a1, 0xc00a7, + 0xc00ab, 0xc00b6, 0xc00b7, 0xc00bb, 0xc00bf, 0xc037e, 0xc0387, 0xc0589, 0xc058a, + 0xc05be, 0xc05c0, 0xc05c3, 0xc05c6, 0xc05f3, 0xc05f4, 0xc0609, 0xc060a, 0xc060c, + 0xc060d, 0xc061b, 0xc061e, 0xc061f, 0xc06d4, 0xc085e, 0xc0964, 0xc0965, 0xc0970, + 0xc09fd, 0xc0af0, 0xc0df4, 0xc0e4f, 0xc0e5a, 0xc0e5b, 0xc0f14, 0xc0f85, 0xc0fd9, + 0xc0fda, 0xc10fb, 0xc1400, 0xc166d, 0xc166e, 0xc169b, 0xc169c, 0xc1735, 0xc1736, + 0xc1944, 0xc1945, 0xc1a1e, 0xc1a1f, 0xc1c7e, 0xc1c7f, 0xc1cd3, 0xc207d, 0xc207e, + 0xc208d, 0xc208e, 0xc2329, 0xc232a, 0xc27c5, 0xc27c6, 0xc29fc, 0xc29fd, 0xc2cfe, + 0xc2cff, 0xc2d70, 0xc3030, 0xc303d, 0xc30a0, 0xc30fb, 0xca4fe, 0xca4ff, 0xca673, + 0xca67e, 0xca8ce, 0xca8cf, 0xca8fc, 0xca92e, 0xca92f, 0xca95f, 0xca9de, 0xca9df, + 0xcaade, 0xcaadf, 0xcaaf0, 0xcaaf1, 0xcabeb, 0xcfd3e, 0xcfd3f, 0xcfe63, 0xcfe68, + 0xcfe6a, 0xcfe6b, 0xcff1a, 0xcff1b, 0xcff1f, 0xcff20, 0xcff3f, 0xcff5b, 0xcff5d, + 0xd003a, 0xd003b, 0xd003f, 0xd0040, 0xd005f, 0xd007b, 0xd007d, 0xd00a1, 0xd00a7, + 0xd00ab, 0xd00b6, 0xd00b7, 0xd00bb, 0xd00bf, 0xd037e, 0xd0387, 0xd0589, 0xd058a, + 0xd05be, 0xd05c0, 0xd05c3, 0xd05c6, 0xd05f3, 0xd05f4, 0xd0609, 0xd060a, 0xd060c, + 0xd060d, 0xd061b, 0xd061e, 0xd061f, 0xd06d4, 0xd085e, 0xd0964, 0xd0965, 0xd0970, + 0xd09fd, 0xd0af0, 0xd0df4, 0xd0e4f, 0xd0e5a, 0xd0e5b, 0xd0f14, 0xd0f85, 0xd0fd9, + 0xd0fda, 0xd10fb, 0xd1400, 0xd166d, 0xd166e, 0xd169b, 0xd169c, 0xd1735, 0xd1736, + 0xd1944, 0xd1945, 0xd1a1e, 0xd1a1f, 0xd1c7e, 0xd1c7f, 0xd1cd3, 0xd207d, 0xd207e, + 0xd208d, 0xd208e, 0xd2329, 0xd232a, 0xd27c5, 0xd27c6, 0xd29fc, 0xd29fd, 0xd2cfe, + 0xd2cff, 0xd2d70, 0xd3030, 0xd303d, 0xd30a0, 0xd30fb, 0xda4fe, 0xda4ff, 0xda673, + 0xda67e, 0xda8ce, 0xda8cf, 0xda8fc, 0xda92e, 0xda92f, 0xda95f, 0xda9de, 0xda9df, + 0xdaade, 0xdaadf, 0xdaaf0, 0xdaaf1, 0xdabeb, 0xdfd3e, 0xdfd3f, 0xdfe63, 0xdfe68, + 0xdfe6a, 0xdfe6b, 0xdff1a, 0xdff1b, 0xdff1f, 0xdff20, 0xdff3f, 0xdff5b, 0xdff5d, + 0xe003a, 0xe003b, 0xe003f, 0xe0040, 0xe005f, 0xe007b, 0xe007d, 0xe00a1, 0xe00a7, + 0xe00ab, 0xe00b6, 0xe00b7, 0xe00bb, 0xe00bf, 0xe037e, 0xe0387, 0xe0589, 0xe058a, + 0xe05be, 0xe05c0, 0xe05c3, 0xe05c6, 0xe05f3, 0xe05f4, 0xe0609, 0xe060a, 0xe060c, + 0xe060d, 0xe061b, 0xe061e, 0xe061f, 0xe06d4, 0xe085e, 0xe0964, 0xe0965, 0xe0970, + 0xe09fd, 0xe0af0, 0xe0df4, 0xe0e4f, 0xe0e5a, 0xe0e5b, 0xe0f14, 0xe0f85, 0xe0fd9, + 0xe0fda, 0xe10fb, 0xe1400, 0xe166d, 0xe166e, 0xe169b, 0xe169c, 0xe1735, 0xe1736, + 0xe1944, 0xe1945, 0xe1a1e, 0xe1a1f, 0xe1c7e, 0xe1c7f, 0xe1cd3, 0xe207d, 0xe207e, + 0xe208d, 0xe208e, 0xe2329, 0xe232a, 0xe27c5, 0xe27c6, 0xe29fc, 0xe29fd, 0xe2cfe, + 0xe2cff, 0xe2d70, 0xe3030, 0xe303d, 0xe30a0, 0xe30fb, 0xea4fe, 0xea4ff, 0xea673, + 0xea67e, 0xea8ce, 0xea8cf, 0xea8fc, 0xea92e, 0xea92f, 0xea95f, 0xea9de, 0xea9df, + 0xeaade, 0xeaadf, 0xeaaf0, 0xeaaf1, 0xeabeb, 0xefd3e, 0xefd3f, 0xefe63, 0xefe68, + 0xefe6a, 0xefe6b, 0xeff1a, 0xeff1b, 0xeff1f, 0xeff20, 0xeff3f, 0xeff5b, 0xeff5d, + 0xf003a, 0xf003b, 0xf003f, 0xf0040, 0xf005f, 0xf007b, 0xf007d, 0xf00a1, 0xf00a7, + 0xf00ab, 0xf00b6, 0xf00b7, 0xf00bb, 0xf00bf, 0xf037e, 0xf0387, 0xf0589, 0xf058a, + 0xf05be, 0xf05c0, 0xf05c3, 0xf05c6, 0xf05f3, 0xf05f4, 0xf0609, 0xf060a, 0xf060c, + 0xf060d, 0xf061b, 0xf061e, 0xf061f, 0xf06d4, 0xf085e, 0xf0964, 0xf0965, 0xf0970, + 0xf09fd, 0xf0af0, 0xf0df4, 0xf0e4f, 0xf0e5a, 0xf0e5b, 0xf0f14, 0xf0f85, 0xf0fd9, + 0xf0fda, 0xf10fb, 0xf1400, 0xf166d, 0xf166e, 0xf169b, 0xf169c, 0xf1735, 0xf1736, + 0xf1944, 0xf1945, 0xf1a1e, 0xf1a1f, 0xf1c7e, 0xf1c7f, 0xf1cd3, 0xf207d, 0xf207e, + 0xf208d, 0xf208e, 0xf2329, 0xf232a, 0xf27c5, 0xf27c6, 0xf29fc, 0xf29fd, 0xf2cfe, + 0xf2cff, 0xf2d70, 0xf3030, 0xf303d, 0xf30a0, 0xf30fb, 0xfa4fe, 0xfa4ff, 0xfa673, + 0xfa67e, 0xfa8ce, 0xfa8cf, 0xfa8fc, 0xfa92e, 0xfa92f, 0xfa95f, 0xfa9de, 0xfa9df, + 0xfaade, 0xfaadf, 0xfaaf0, 0xfaaf1, 0xfabeb, 0xffd3e, 0xffd3f, 0xffe63, 0xffe68, + 0xffe6a, 0xffe6b, 0xfff1a, 0xfff1b, 0xfff1f, 0xfff20, 0xfff3f, 0xfff5b, 0xfff5d, + 0x10003a, 0x10003b, 0x10003f, 0x100040, 0x10005f, 0x10007b, 0x10007d, 0x1000a1, 0x1000a7, + 0x1000ab, 0x1000b6, 0x1000b7, 0x1000bb, 0x1000bf, 0x10037e, 0x100387, 0x100589, 0x10058a, + 0x1005be, 0x1005c0, 0x1005c3, 0x1005c6, 0x1005f3, 0x1005f4, 0x100609, 0x10060a, 0x10060c, + 0x10060d, 0x10061b, 0x10061e, 0x10061f, 0x1006d4, 0x10085e, 0x100964, 0x100965, 0x100970, + 0x1009fd, 0x100af0, 0x100df4, 0x100e4f, 0x100e5a, 0x100e5b, 0x100f14, 0x100f85, 0x100fd9, + 0x100fda, 0x1010fb, 0x101400, 0x10166d, 0x10166e, 0x10169b, 0x10169c, 0x101735, 0x101736, + 0x101944, 0x101945, 0x101a1e, 0x101a1f, 0x101c7e, 0x101c7f, 0x101cd3, 0x10207d, 0x10207e, + 0x10208d, 0x10208e, 0x102329, 0x10232a, 0x1027c5, 0x1027c6, 0x1029fc, 0x1029fd, 0x102cfe, + 0x102cff, 0x102d70, 0x103030, 0x10303d, 0x1030a0, 0x1030fb, 0x10a4fe, 0x10a4ff, 0x10a673, + 0x10a67e, 0x10a8ce, 0x10a8cf, 0x10a8fc, 0x10a92e, 0x10a92f, 0x10a95f, 0x10a9de, 0x10a9df, + 0x10aade, 0x10aadf, 0x10aaf0, 0x10aaf1, 0x10abeb, 0x10fd3e, 0x10fd3f, 0x10fe63, 0x10fe68, + 0x10fe6a, 0x10fe6b, 0x10ff1a, 0x10ff1b, 0x10ff1f, 0x10ff20, 0x10ff3f, 0x10ff5b, 0x10ff5d #endif }; @@ -390,6 +2256,16 @@ static const chr punctCharTable[] = { static const crange spaceRangeTable[] = { {0x9, 0xd}, {0x2000, 0x200b} +#if TCL_UTF_MAX > 4 + ,{0x10009, 0x1000d}, {0x12000, 0x1200b}, {0x20009, 0x2000d}, {0x22000, 0x2200b}, + {0x30009, 0x3000d}, {0x32000, 0x3200b}, {0x40009, 0x4000d}, {0x42000, 0x4200b}, + {0x50009, 0x5000d}, {0x52000, 0x5200b}, {0x60009, 0x6000d}, {0x62000, 0x6200b}, + {0x70009, 0x7000d}, {0x72000, 0x7200b}, {0x80009, 0x8000d}, {0x82000, 0x8200b}, + {0x90009, 0x9000d}, {0x92000, 0x9200b}, {0xa0009, 0xa000d}, {0xa2000, 0xa200b}, + {0xb0009, 0xb000d}, {0xb2000, 0xb200b}, {0xc0009, 0xc000d}, {0xc2000, 0xc200b}, + {0xd0009, 0xd000d}, {0xd2000, 0xd200b}, {0xe0009, 0xe000d}, {0xe2000, 0xe200b}, + {0xf0009, 0xf000d}, {0xf2000, 0xf200b}, {0x100009, 0x10000d}, {0x102000, 0x10200b} +#endif }; #define NUM_SPACE_RANGE (sizeof(spaceRangeTable)/sizeof(crange)) @@ -397,6 +2273,30 @@ static const crange spaceRangeTable[] = { static const chr spaceCharTable[] = { 0x20, 0x85, 0xa0, 0x1680, 0x180e, 0x2028, 0x2029, 0x202f, 0x205f, 0x2060, 0x3000, 0xfeff +#if TCL_UTF_MAX > 4 + ,0x10020, 0x10085, 0x100a0, 0x11680, 0x1180e, 0x12028, 0x12029, 0x1202f, 0x1205f, + 0x12060, 0x13000, 0x1feff, 0x20020, 0x20085, 0x200a0, 0x21680, 0x2180e, 0x22028, + 0x22029, 0x2202f, 0x2205f, 0x22060, 0x23000, 0x2feff, 0x30020, 0x30085, 0x300a0, + 0x31680, 0x3180e, 0x32028, 0x32029, 0x3202f, 0x3205f, 0x32060, 0x33000, 0x3feff, + 0x40020, 0x40085, 0x400a0, 0x41680, 0x4180e, 0x42028, 0x42029, 0x4202f, 0x4205f, + 0x42060, 0x43000, 0x4feff, 0x50020, 0x50085, 0x500a0, 0x51680, 0x5180e, 0x52028, + 0x52029, 0x5202f, 0x5205f, 0x52060, 0x53000, 0x5feff, 0x60020, 0x60085, 0x600a0, + 0x61680, 0x6180e, 0x62028, 0x62029, 0x6202f, 0x6205f, 0x62060, 0x63000, 0x6feff, + 0x70020, 0x70085, 0x700a0, 0x71680, 0x7180e, 0x72028, 0x72029, 0x7202f, 0x7205f, + 0x72060, 0x73000, 0x7feff, 0x80020, 0x80085, 0x800a0, 0x81680, 0x8180e, 0x82028, + 0x82029, 0x8202f, 0x8205f, 0x82060, 0x83000, 0x8feff, 0x90020, 0x90085, 0x900a0, + 0x91680, 0x9180e, 0x92028, 0x92029, 0x9202f, 0x9205f, 0x92060, 0x93000, 0x9feff, + 0xa0020, 0xa0085, 0xa00a0, 0xa1680, 0xa180e, 0xa2028, 0xa2029, 0xa202f, 0xa205f, + 0xa2060, 0xa3000, 0xafeff, 0xb0020, 0xb0085, 0xb00a0, 0xb1680, 0xb180e, 0xb2028, + 0xb2029, 0xb202f, 0xb205f, 0xb2060, 0xb3000, 0xbfeff, 0xc0020, 0xc0085, 0xc00a0, + 0xc1680, 0xc180e, 0xc2028, 0xc2029, 0xc202f, 0xc205f, 0xc2060, 0xc3000, 0xcfeff, + 0xd0020, 0xd0085, 0xd00a0, 0xd1680, 0xd180e, 0xd2028, 0xd2029, 0xd202f, 0xd205f, + 0xd2060, 0xd3000, 0xdfeff, 0xe0020, 0xe0085, 0xe00a0, 0xe1680, 0xe180e, 0xe2028, + 0xe2029, 0xe202f, 0xe205f, 0xe2060, 0xe3000, 0xefeff, 0xf0020, 0xf0085, 0xf00a0, + 0xf1680, 0xf180e, 0xf2028, 0xf2029, 0xf202f, 0xf205f, 0xf2060, 0xf3000, 0xffeff, + 0x100020, 0x100085, 0x1000a0, 0x101680, 0x10180e, 0x102028, 0x102029, 0x10202f, 0x10205f, + 0x102060, 0x103000, 0x10feff +#endif }; #define NUM_SPACE_CHAR (sizeof(spaceCharTable)/sizeof(chr)) @@ -420,14 +2320,206 @@ static const crange lowerRangeTable[] = { {0xab30, 0xab5a}, {0xab60, 0xab65}, {0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xff41, 0xff5a} #if TCL_UTF_MAX > 4 - ,{0x10428, 0x1044f}, {0x104d8, 0x104fb}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df}, - {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, - {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, - {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, - {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, - {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, - {0x1d736, 0x1d74e}, {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, - {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x1e922, 0x1e943} + ,{0x10061, 0x1007a}, {0x100df, 0x100f6}, {0x100f8, 0x100ff}, {0x1017e, 0x10180}, + {0x10199, 0x1019b}, {0x101bd, 0x101bf}, {0x10233, 0x10239}, {0x1024f, 0x10293}, + {0x10295, 0x102af}, {0x1037b, 0x1037d}, {0x103ac, 0x103ce}, {0x103d5, 0x103d7}, + {0x103ef, 0x103f3}, {0x10430, 0x1045f}, {0x10561, 0x10587}, {0x113f8, 0x113fd}, + {0x11c80, 0x11c88}, {0x11d00, 0x11d2b}, {0x11d6b, 0x11d77}, {0x11d79, 0x11d9a}, + {0x11e95, 0x11e9d}, {0x11eff, 0x11f07}, {0x11f10, 0x11f15}, {0x11f20, 0x11f27}, + {0x11f30, 0x11f37}, {0x11f40, 0x11f45}, {0x11f50, 0x11f57}, {0x11f60, 0x11f67}, + {0x11f70, 0x11f7d}, {0x11f80, 0x11f87}, {0x11f90, 0x11f97}, {0x11fa0, 0x11fa7}, + {0x11fb0, 0x11fb4}, {0x11fc2, 0x11fc4}, {0x11fd0, 0x11fd3}, {0x11fe0, 0x11fe7}, + {0x11ff2, 0x11ff4}, {0x12146, 0x12149}, {0x12c30, 0x12c5e}, {0x12c76, 0x12c7b}, + {0x12d00, 0x12d25}, {0x1a72f, 0x1a731}, {0x1a771, 0x1a778}, {0x1a793, 0x1a795}, + {0x1ab30, 0x1ab5a}, {0x1ab60, 0x1ab65}, {0x1ab70, 0x1abbf}, {0x1fb00, 0x1fb06}, + {0x1fb13, 0x1fb17}, {0x1ff41, 0x1ff5a}, {0x20061, 0x2007a}, {0x200df, 0x200f6}, + {0x200f8, 0x200ff}, {0x2017e, 0x20180}, {0x20199, 0x2019b}, {0x201bd, 0x201bf}, + {0x20233, 0x20239}, {0x2024f, 0x20293}, {0x20295, 0x202af}, {0x2037b, 0x2037d}, + {0x203ac, 0x203ce}, {0x203d5, 0x203d7}, {0x203ef, 0x203f3}, {0x20430, 0x2045f}, + {0x20561, 0x20587}, {0x213f8, 0x213fd}, {0x21c80, 0x21c88}, {0x21d00, 0x21d2b}, + {0x21d6b, 0x21d77}, {0x21d79, 0x21d9a}, {0x21e95, 0x21e9d}, {0x21eff, 0x21f07}, + {0x21f10, 0x21f15}, {0x21f20, 0x21f27}, {0x21f30, 0x21f37}, {0x21f40, 0x21f45}, + {0x21f50, 0x21f57}, {0x21f60, 0x21f67}, {0x21f70, 0x21f7d}, {0x21f80, 0x21f87}, + {0x21f90, 0x21f97}, {0x21fa0, 0x21fa7}, {0x21fb0, 0x21fb4}, {0x21fc2, 0x21fc4}, + {0x21fd0, 0x21fd3}, {0x21fe0, 0x21fe7}, {0x21ff2, 0x21ff4}, {0x22146, 0x22149}, + {0x22c30, 0x22c5e}, {0x22c76, 0x22c7b}, {0x22d00, 0x22d25}, {0x2a72f, 0x2a731}, + {0x2a771, 0x2a778}, {0x2a793, 0x2a795}, {0x2ab30, 0x2ab5a}, {0x2ab60, 0x2ab65}, + {0x2ab70, 0x2abbf}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2ff41, 0x2ff5a}, + {0x30061, 0x3007a}, {0x300df, 0x300f6}, {0x300f8, 0x300ff}, {0x3017e, 0x30180}, + {0x30199, 0x3019b}, {0x301bd, 0x301bf}, {0x30233, 0x30239}, {0x3024f, 0x30293}, + {0x30295, 0x302af}, {0x3037b, 0x3037d}, {0x303ac, 0x303ce}, {0x303d5, 0x303d7}, + {0x303ef, 0x303f3}, {0x30430, 0x3045f}, {0x30561, 0x30587}, {0x313f8, 0x313fd}, + {0x31c80, 0x31c88}, {0x31d00, 0x31d2b}, {0x31d6b, 0x31d77}, {0x31d79, 0x31d9a}, + {0x31e95, 0x31e9d}, {0x31eff, 0x31f07}, {0x31f10, 0x31f15}, {0x31f20, 0x31f27}, + {0x31f30, 0x31f37}, {0x31f40, 0x31f45}, {0x31f50, 0x31f57}, {0x31f60, 0x31f67}, + {0x31f70, 0x31f7d}, {0x31f80, 0x31f87}, {0x31f90, 0x31f97}, {0x31fa0, 0x31fa7}, + {0x31fb0, 0x31fb4}, {0x31fc2, 0x31fc4}, {0x31fd0, 0x31fd3}, {0x31fe0, 0x31fe7}, + {0x31ff2, 0x31ff4}, {0x32146, 0x32149}, {0x32c30, 0x32c5e}, {0x32c76, 0x32c7b}, + {0x32d00, 0x32d25}, {0x3a72f, 0x3a731}, {0x3a771, 0x3a778}, {0x3a793, 0x3a795}, + {0x3ab30, 0x3ab5a}, {0x3ab60, 0x3ab65}, {0x3ab70, 0x3abbf}, {0x3fb00, 0x3fb06}, + {0x3fb13, 0x3fb17}, {0x3ff41, 0x3ff5a}, {0x40061, 0x4007a}, {0x400df, 0x400f6}, + {0x400f8, 0x400ff}, {0x4017e, 0x40180}, {0x40199, 0x4019b}, {0x401bd, 0x401bf}, + {0x40233, 0x40239}, {0x4024f, 0x40293}, {0x40295, 0x402af}, {0x4037b, 0x4037d}, + {0x403ac, 0x403ce}, {0x403d5, 0x403d7}, {0x403ef, 0x403f3}, {0x40430, 0x4045f}, + {0x40561, 0x40587}, {0x413f8, 0x413fd}, {0x41c80, 0x41c88}, {0x41d00, 0x41d2b}, + {0x41d6b, 0x41d77}, {0x41d79, 0x41d9a}, {0x41e95, 0x41e9d}, {0x41eff, 0x41f07}, + {0x41f10, 0x41f15}, {0x41f20, 0x41f27}, {0x41f30, 0x41f37}, {0x41f40, 0x41f45}, + {0x41f50, 0x41f57}, {0x41f60, 0x41f67}, {0x41f70, 0x41f7d}, {0x41f80, 0x41f87}, + {0x41f90, 0x41f97}, {0x41fa0, 0x41fa7}, {0x41fb0, 0x41fb4}, {0x41fc2, 0x41fc4}, + {0x41fd0, 0x41fd3}, {0x41fe0, 0x41fe7}, {0x41ff2, 0x41ff4}, {0x42146, 0x42149}, + {0x42c30, 0x42c5e}, {0x42c76, 0x42c7b}, {0x42d00, 0x42d25}, {0x4a72f, 0x4a731}, + {0x4a771, 0x4a778}, {0x4a793, 0x4a795}, {0x4ab30, 0x4ab5a}, {0x4ab60, 0x4ab65}, + {0x4ab70, 0x4abbf}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4ff41, 0x4ff5a}, + {0x50061, 0x5007a}, {0x500df, 0x500f6}, {0x500f8, 0x500ff}, {0x5017e, 0x50180}, + {0x50199, 0x5019b}, {0x501bd, 0x501bf}, {0x50233, 0x50239}, {0x5024f, 0x50293}, + {0x50295, 0x502af}, {0x5037b, 0x5037d}, {0x503ac, 0x503ce}, {0x503d5, 0x503d7}, + {0x503ef, 0x503f3}, {0x50430, 0x5045f}, {0x50561, 0x50587}, {0x513f8, 0x513fd}, + {0x51c80, 0x51c88}, {0x51d00, 0x51d2b}, {0x51d6b, 0x51d77}, {0x51d79, 0x51d9a}, + {0x51e95, 0x51e9d}, {0x51eff, 0x51f07}, {0x51f10, 0x51f15}, {0x51f20, 0x51f27}, + {0x51f30, 0x51f37}, {0x51f40, 0x51f45}, {0x51f50, 0x51f57}, {0x51f60, 0x51f67}, + {0x51f70, 0x51f7d}, {0x51f80, 0x51f87}, {0x51f90, 0x51f97}, {0x51fa0, 0x51fa7}, + {0x51fb0, 0x51fb4}, {0x51fc2, 0x51fc4}, {0x51fd0, 0x51fd3}, {0x51fe0, 0x51fe7}, + {0x51ff2, 0x51ff4}, {0x52146, 0x52149}, {0x52c30, 0x52c5e}, {0x52c76, 0x52c7b}, + {0x52d00, 0x52d25}, {0x5a72f, 0x5a731}, {0x5a771, 0x5a778}, {0x5a793, 0x5a795}, + {0x5ab30, 0x5ab5a}, {0x5ab60, 0x5ab65}, {0x5ab70, 0x5abbf}, {0x5fb00, 0x5fb06}, + {0x5fb13, 0x5fb17}, {0x5ff41, 0x5ff5a}, {0x60061, 0x6007a}, {0x600df, 0x600f6}, + {0x600f8, 0x600ff}, {0x6017e, 0x60180}, {0x60199, 0x6019b}, {0x601bd, 0x601bf}, + {0x60233, 0x60239}, {0x6024f, 0x60293}, {0x60295, 0x602af}, {0x6037b, 0x6037d}, + {0x603ac, 0x603ce}, {0x603d5, 0x603d7}, {0x603ef, 0x603f3}, {0x60430, 0x6045f}, + {0x60561, 0x60587}, {0x613f8, 0x613fd}, {0x61c80, 0x61c88}, {0x61d00, 0x61d2b}, + {0x61d6b, 0x61d77}, {0x61d79, 0x61d9a}, {0x61e95, 0x61e9d}, {0x61eff, 0x61f07}, + {0x61f10, 0x61f15}, {0x61f20, 0x61f27}, {0x61f30, 0x61f37}, {0x61f40, 0x61f45}, + {0x61f50, 0x61f57}, {0x61f60, 0x61f67}, {0x61f70, 0x61f7d}, {0x61f80, 0x61f87}, + {0x61f90, 0x61f97}, {0x61fa0, 0x61fa7}, {0x61fb0, 0x61fb4}, {0x61fc2, 0x61fc4}, + {0x61fd0, 0x61fd3}, {0x61fe0, 0x61fe7}, {0x61ff2, 0x61ff4}, {0x62146, 0x62149}, + {0x62c30, 0x62c5e}, {0x62c76, 0x62c7b}, {0x62d00, 0x62d25}, {0x6a72f, 0x6a731}, + {0x6a771, 0x6a778}, {0x6a793, 0x6a795}, {0x6ab30, 0x6ab5a}, {0x6ab60, 0x6ab65}, + {0x6ab70, 0x6abbf}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6ff41, 0x6ff5a}, + {0x70061, 0x7007a}, {0x700df, 0x700f6}, {0x700f8, 0x700ff}, {0x7017e, 0x70180}, + {0x70199, 0x7019b}, {0x701bd, 0x701bf}, {0x70233, 0x70239}, {0x7024f, 0x70293}, + {0x70295, 0x702af}, {0x7037b, 0x7037d}, {0x703ac, 0x703ce}, {0x703d5, 0x703d7}, + {0x703ef, 0x703f3}, {0x70430, 0x7045f}, {0x70561, 0x70587}, {0x713f8, 0x713fd}, + {0x71c80, 0x71c88}, {0x71d00, 0x71d2b}, {0x71d6b, 0x71d77}, {0x71d79, 0x71d9a}, + {0x71e95, 0x71e9d}, {0x71eff, 0x71f07}, {0x71f10, 0x71f15}, {0x71f20, 0x71f27}, + {0x71f30, 0x71f37}, {0x71f40, 0x71f45}, {0x71f50, 0x71f57}, {0x71f60, 0x71f67}, + {0x71f70, 0x71f7d}, {0x71f80, 0x71f87}, {0x71f90, 0x71f97}, {0x71fa0, 0x71fa7}, + {0x71fb0, 0x71fb4}, {0x71fc2, 0x71fc4}, {0x71fd0, 0x71fd3}, {0x71fe0, 0x71fe7}, + {0x71ff2, 0x71ff4}, {0x72146, 0x72149}, {0x72c30, 0x72c5e}, {0x72c76, 0x72c7b}, + {0x72d00, 0x72d25}, {0x7a72f, 0x7a731}, {0x7a771, 0x7a778}, {0x7a793, 0x7a795}, + {0x7ab30, 0x7ab5a}, {0x7ab60, 0x7ab65}, {0x7ab70, 0x7abbf}, {0x7fb00, 0x7fb06}, + {0x7fb13, 0x7fb17}, {0x7ff41, 0x7ff5a}, {0x80061, 0x8007a}, {0x800df, 0x800f6}, + {0x800f8, 0x800ff}, {0x8017e, 0x80180}, {0x80199, 0x8019b}, {0x801bd, 0x801bf}, + {0x80233, 0x80239}, {0x8024f, 0x80293}, {0x80295, 0x802af}, {0x8037b, 0x8037d}, + {0x803ac, 0x803ce}, {0x803d5, 0x803d7}, {0x803ef, 0x803f3}, {0x80430, 0x8045f}, + {0x80561, 0x80587}, {0x813f8, 0x813fd}, {0x81c80, 0x81c88}, {0x81d00, 0x81d2b}, + {0x81d6b, 0x81d77}, {0x81d79, 0x81d9a}, {0x81e95, 0x81e9d}, {0x81eff, 0x81f07}, + {0x81f10, 0x81f15}, {0x81f20, 0x81f27}, {0x81f30, 0x81f37}, {0x81f40, 0x81f45}, + {0x81f50, 0x81f57}, {0x81f60, 0x81f67}, {0x81f70, 0x81f7d}, {0x81f80, 0x81f87}, + {0x81f90, 0x81f97}, {0x81fa0, 0x81fa7}, {0x81fb0, 0x81fb4}, {0x81fc2, 0x81fc4}, + {0x81fd0, 0x81fd3}, {0x81fe0, 0x81fe7}, {0x81ff2, 0x81ff4}, {0x82146, 0x82149}, + {0x82c30, 0x82c5e}, {0x82c76, 0x82c7b}, {0x82d00, 0x82d25}, {0x8a72f, 0x8a731}, + {0x8a771, 0x8a778}, {0x8a793, 0x8a795}, {0x8ab30, 0x8ab5a}, {0x8ab60, 0x8ab65}, + {0x8ab70, 0x8abbf}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8ff41, 0x8ff5a}, + {0x90061, 0x9007a}, {0x900df, 0x900f6}, {0x900f8, 0x900ff}, {0x9017e, 0x90180}, + {0x90199, 0x9019b}, {0x901bd, 0x901bf}, {0x90233, 0x90239}, {0x9024f, 0x90293}, + {0x90295, 0x902af}, {0x9037b, 0x9037d}, {0x903ac, 0x903ce}, {0x903d5, 0x903d7}, + {0x903ef, 0x903f3}, {0x90430, 0x9045f}, {0x90561, 0x90587}, {0x913f8, 0x913fd}, + {0x91c80, 0x91c88}, {0x91d00, 0x91d2b}, {0x91d6b, 0x91d77}, {0x91d79, 0x91d9a}, + {0x91e95, 0x91e9d}, {0x91eff, 0x91f07}, {0x91f10, 0x91f15}, {0x91f20, 0x91f27}, + {0x91f30, 0x91f37}, {0x91f40, 0x91f45}, {0x91f50, 0x91f57}, {0x91f60, 0x91f67}, + {0x91f70, 0x91f7d}, {0x91f80, 0x91f87}, {0x91f90, 0x91f97}, {0x91fa0, 0x91fa7}, + {0x91fb0, 0x91fb4}, {0x91fc2, 0x91fc4}, {0x91fd0, 0x91fd3}, {0x91fe0, 0x91fe7}, + {0x91ff2, 0x91ff4}, {0x92146, 0x92149}, {0x92c30, 0x92c5e}, {0x92c76, 0x92c7b}, + {0x92d00, 0x92d25}, {0x9a72f, 0x9a731}, {0x9a771, 0x9a778}, {0x9a793, 0x9a795}, + {0x9ab30, 0x9ab5a}, {0x9ab60, 0x9ab65}, {0x9ab70, 0x9abbf}, {0x9fb00, 0x9fb06}, + {0x9fb13, 0x9fb17}, {0x9ff41, 0x9ff5a}, {0xa0061, 0xa007a}, {0xa00df, 0xa00f6}, + {0xa00f8, 0xa00ff}, {0xa017e, 0xa0180}, {0xa0199, 0xa019b}, {0xa01bd, 0xa01bf}, + {0xa0233, 0xa0239}, {0xa024f, 0xa0293}, {0xa0295, 0xa02af}, {0xa037b, 0xa037d}, + {0xa03ac, 0xa03ce}, {0xa03d5, 0xa03d7}, {0xa03ef, 0xa03f3}, {0xa0430, 0xa045f}, + {0xa0561, 0xa0587}, {0xa13f8, 0xa13fd}, {0xa1c80, 0xa1c88}, {0xa1d00, 0xa1d2b}, + {0xa1d6b, 0xa1d77}, {0xa1d79, 0xa1d9a}, {0xa1e95, 0xa1e9d}, {0xa1eff, 0xa1f07}, + {0xa1f10, 0xa1f15}, {0xa1f20, 0xa1f27}, {0xa1f30, 0xa1f37}, {0xa1f40, 0xa1f45}, + {0xa1f50, 0xa1f57}, {0xa1f60, 0xa1f67}, {0xa1f70, 0xa1f7d}, {0xa1f80, 0xa1f87}, + {0xa1f90, 0xa1f97}, {0xa1fa0, 0xa1fa7}, {0xa1fb0, 0xa1fb4}, {0xa1fc2, 0xa1fc4}, + {0xa1fd0, 0xa1fd3}, {0xa1fe0, 0xa1fe7}, {0xa1ff2, 0xa1ff4}, {0xa2146, 0xa2149}, + {0xa2c30, 0xa2c5e}, {0xa2c76, 0xa2c7b}, {0xa2d00, 0xa2d25}, {0xaa72f, 0xaa731}, + {0xaa771, 0xaa778}, {0xaa793, 0xaa795}, {0xaab30, 0xaab5a}, {0xaab60, 0xaab65}, + {0xaab70, 0xaabbf}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xaff41, 0xaff5a}, + {0xb0061, 0xb007a}, {0xb00df, 0xb00f6}, {0xb00f8, 0xb00ff}, {0xb017e, 0xb0180}, + {0xb0199, 0xb019b}, {0xb01bd, 0xb01bf}, {0xb0233, 0xb0239}, {0xb024f, 0xb0293}, + {0xb0295, 0xb02af}, {0xb037b, 0xb037d}, {0xb03ac, 0xb03ce}, {0xb03d5, 0xb03d7}, + {0xb03ef, 0xb03f3}, {0xb0430, 0xb045f}, {0xb0561, 0xb0587}, {0xb13f8, 0xb13fd}, + {0xb1c80, 0xb1c88}, {0xb1d00, 0xb1d2b}, {0xb1d6b, 0xb1d77}, {0xb1d79, 0xb1d9a}, + {0xb1e95, 0xb1e9d}, {0xb1eff, 0xb1f07}, {0xb1f10, 0xb1f15}, {0xb1f20, 0xb1f27}, + {0xb1f30, 0xb1f37}, {0xb1f40, 0xb1f45}, {0xb1f50, 0xb1f57}, {0xb1f60, 0xb1f67}, + {0xb1f70, 0xb1f7d}, {0xb1f80, 0xb1f87}, {0xb1f90, 0xb1f97}, {0xb1fa0, 0xb1fa7}, + {0xb1fb0, 0xb1fb4}, {0xb1fc2, 0xb1fc4}, {0xb1fd0, 0xb1fd3}, {0xb1fe0, 0xb1fe7}, + {0xb1ff2, 0xb1ff4}, {0xb2146, 0xb2149}, {0xb2c30, 0xb2c5e}, {0xb2c76, 0xb2c7b}, + {0xb2d00, 0xb2d25}, {0xba72f, 0xba731}, {0xba771, 0xba778}, {0xba793, 0xba795}, + {0xbab30, 0xbab5a}, {0xbab60, 0xbab65}, {0xbab70, 0xbabbf}, {0xbfb00, 0xbfb06}, + {0xbfb13, 0xbfb17}, {0xbff41, 0xbff5a}, {0xc0061, 0xc007a}, {0xc00df, 0xc00f6}, + {0xc00f8, 0xc00ff}, {0xc017e, 0xc0180}, {0xc0199, 0xc019b}, {0xc01bd, 0xc01bf}, + {0xc0233, 0xc0239}, {0xc024f, 0xc0293}, {0xc0295, 0xc02af}, {0xc037b, 0xc037d}, + {0xc03ac, 0xc03ce}, {0xc03d5, 0xc03d7}, {0xc03ef, 0xc03f3}, {0xc0430, 0xc045f}, + {0xc0561, 0xc0587}, {0xc13f8, 0xc13fd}, {0xc1c80, 0xc1c88}, {0xc1d00, 0xc1d2b}, + {0xc1d6b, 0xc1d77}, {0xc1d79, 0xc1d9a}, {0xc1e95, 0xc1e9d}, {0xc1eff, 0xc1f07}, + {0xc1f10, 0xc1f15}, {0xc1f20, 0xc1f27}, {0xc1f30, 0xc1f37}, {0xc1f40, 0xc1f45}, + {0xc1f50, 0xc1f57}, {0xc1f60, 0xc1f67}, {0xc1f70, 0xc1f7d}, {0xc1f80, 0xc1f87}, + {0xc1f90, 0xc1f97}, {0xc1fa0, 0xc1fa7}, {0xc1fb0, 0xc1fb4}, {0xc1fc2, 0xc1fc4}, + {0xc1fd0, 0xc1fd3}, {0xc1fe0, 0xc1fe7}, {0xc1ff2, 0xc1ff4}, {0xc2146, 0xc2149}, + {0xc2c30, 0xc2c5e}, {0xc2c76, 0xc2c7b}, {0xc2d00, 0xc2d25}, {0xca72f, 0xca731}, + {0xca771, 0xca778}, {0xca793, 0xca795}, {0xcab30, 0xcab5a}, {0xcab60, 0xcab65}, + {0xcab70, 0xcabbf}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcff41, 0xcff5a}, + {0xd0061, 0xd007a}, {0xd00df, 0xd00f6}, {0xd00f8, 0xd00ff}, {0xd017e, 0xd0180}, + {0xd0199, 0xd019b}, {0xd01bd, 0xd01bf}, {0xd0233, 0xd0239}, {0xd024f, 0xd0293}, + {0xd0295, 0xd02af}, {0xd037b, 0xd037d}, {0xd03ac, 0xd03ce}, {0xd03d5, 0xd03d7}, + {0xd03ef, 0xd03f3}, {0xd0430, 0xd045f}, {0xd0561, 0xd0587}, {0xd13f8, 0xd13fd}, + {0xd1c80, 0xd1c88}, {0xd1d00, 0xd1d2b}, {0xd1d6b, 0xd1d77}, {0xd1d79, 0xd1d9a}, + {0xd1e95, 0xd1e9d}, {0xd1eff, 0xd1f07}, {0xd1f10, 0xd1f15}, {0xd1f20, 0xd1f27}, + {0xd1f30, 0xd1f37}, {0xd1f40, 0xd1f45}, {0xd1f50, 0xd1f57}, {0xd1f60, 0xd1f67}, + {0xd1f70, 0xd1f7d}, {0xd1f80, 0xd1f87}, {0xd1f90, 0xd1f97}, {0xd1fa0, 0xd1fa7}, + {0xd1fb0, 0xd1fb4}, {0xd1fc2, 0xd1fc4}, {0xd1fd0, 0xd1fd3}, {0xd1fe0, 0xd1fe7}, + {0xd1ff2, 0xd1ff4}, {0xd2146, 0xd2149}, {0xd2c30, 0xd2c5e}, {0xd2c76, 0xd2c7b}, + {0xd2d00, 0xd2d25}, {0xda72f, 0xda731}, {0xda771, 0xda778}, {0xda793, 0xda795}, + {0xdab30, 0xdab5a}, {0xdab60, 0xdab65}, {0xdab70, 0xdabbf}, {0xdfb00, 0xdfb06}, + {0xdfb13, 0xdfb17}, {0xdff41, 0xdff5a}, {0xe0061, 0xe007a}, {0xe00df, 0xe00f6}, + {0xe00f8, 0xe00ff}, {0xe017e, 0xe0180}, {0xe0199, 0xe019b}, {0xe01bd, 0xe01bf}, + {0xe0233, 0xe0239}, {0xe024f, 0xe0293}, {0xe0295, 0xe02af}, {0xe037b, 0xe037d}, + {0xe03ac, 0xe03ce}, {0xe03d5, 0xe03d7}, {0xe03ef, 0xe03f3}, {0xe0430, 0xe045f}, + {0xe0561, 0xe0587}, {0xe13f8, 0xe13fd}, {0xe1c80, 0xe1c88}, {0xe1d00, 0xe1d2b}, + {0xe1d6b, 0xe1d77}, {0xe1d79, 0xe1d9a}, {0xe1e95, 0xe1e9d}, {0xe1eff, 0xe1f07}, + {0xe1f10, 0xe1f15}, {0xe1f20, 0xe1f27}, {0xe1f30, 0xe1f37}, {0xe1f40, 0xe1f45}, + {0xe1f50, 0xe1f57}, {0xe1f60, 0xe1f67}, {0xe1f70, 0xe1f7d}, {0xe1f80, 0xe1f87}, + {0xe1f90, 0xe1f97}, {0xe1fa0, 0xe1fa7}, {0xe1fb0, 0xe1fb4}, {0xe1fc2, 0xe1fc4}, + {0xe1fd0, 0xe1fd3}, {0xe1fe0, 0xe1fe7}, {0xe1ff2, 0xe1ff4}, {0xe2146, 0xe2149}, + {0xe2c30, 0xe2c5e}, {0xe2c76, 0xe2c7b}, {0xe2d00, 0xe2d25}, {0xea72f, 0xea731}, + {0xea771, 0xea778}, {0xea793, 0xea795}, {0xeab30, 0xeab5a}, {0xeab60, 0xeab65}, + {0xeab70, 0xeabbf}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xeff41, 0xeff5a}, + {0xf0061, 0xf007a}, {0xf00df, 0xf00f6}, {0xf00f8, 0xf00ff}, {0xf017e, 0xf0180}, + {0xf0199, 0xf019b}, {0xf01bd, 0xf01bf}, {0xf0233, 0xf0239}, {0xf024f, 0xf0293}, + {0xf0295, 0xf02af}, {0xf037b, 0xf037d}, {0xf03ac, 0xf03ce}, {0xf03d5, 0xf03d7}, + {0xf03ef, 0xf03f3}, {0xf0430, 0xf045f}, {0xf0561, 0xf0587}, {0xf13f8, 0xf13fd}, + {0xf1c80, 0xf1c88}, {0xf1d00, 0xf1d2b}, {0xf1d6b, 0xf1d77}, {0xf1d79, 0xf1d9a}, + {0xf1e95, 0xf1e9d}, {0xf1eff, 0xf1f07}, {0xf1f10, 0xf1f15}, {0xf1f20, 0xf1f27}, + {0xf1f30, 0xf1f37}, {0xf1f40, 0xf1f45}, {0xf1f50, 0xf1f57}, {0xf1f60, 0xf1f67}, + {0xf1f70, 0xf1f7d}, {0xf1f80, 0xf1f87}, {0xf1f90, 0xf1f97}, {0xf1fa0, 0xf1fa7}, + {0xf1fb0, 0xf1fb4}, {0xf1fc2, 0xf1fc4}, {0xf1fd0, 0xf1fd3}, {0xf1fe0, 0xf1fe7}, + {0xf1ff2, 0xf1ff4}, {0xf2146, 0xf2149}, {0xf2c30, 0xf2c5e}, {0xf2c76, 0xf2c7b}, + {0xf2d00, 0xf2d25}, {0xfa72f, 0xfa731}, {0xfa771, 0xfa778}, {0xfa793, 0xfa795}, + {0xfab30, 0xfab5a}, {0xfab60, 0xfab65}, {0xfab70, 0xfabbf}, {0xffb00, 0xffb06}, + {0xffb13, 0xffb17}, {0xfff41, 0xfff5a}, {0x100061, 0x10007a}, {0x1000df, 0x1000f6}, + {0x1000f8, 0x1000ff}, {0x10017e, 0x100180}, {0x100199, 0x10019b}, {0x1001bd, 0x1001bf}, + {0x100233, 0x100239}, {0x10024f, 0x100293}, {0x100295, 0x1002af}, {0x10037b, 0x10037d}, + {0x1003ac, 0x1003ce}, {0x1003d5, 0x1003d7}, {0x1003ef, 0x1003f3}, {0x100430, 0x10045f}, + {0x100561, 0x100587}, {0x1013f8, 0x1013fd}, {0x101c80, 0x101c88}, {0x101d00, 0x101d2b}, + {0x101d6b, 0x101d77}, {0x101d79, 0x101d9a}, {0x101e95, 0x101e9d}, {0x101eff, 0x101f07}, + {0x101f10, 0x101f15}, {0x101f20, 0x101f27}, {0x101f30, 0x101f37}, {0x101f40, 0x101f45}, + {0x101f50, 0x101f57}, {0x101f60, 0x101f67}, {0x101f70, 0x101f7d}, {0x101f80, 0x101f87}, + {0x101f90, 0x101f97}, {0x101fa0, 0x101fa7}, {0x101fb0, 0x101fb4}, {0x101fc2, 0x101fc4}, + {0x101fd0, 0x101fd3}, {0x101fe0, 0x101fe7}, {0x101ff2, 0x101ff4}, {0x102146, 0x102149}, + {0x102c30, 0x102c5e}, {0x102c76, 0x102c7b}, {0x102d00, 0x102d25}, {0x10a72f, 0x10a731}, + {0x10a771, 0x10a778}, {0x10a793, 0x10a795}, {0x10ab30, 0x10ab5a}, {0x10ab60, 0x10ab65}, + {0x10ab70, 0x10abbf}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10ff41, 0x10ff5a} #endif }; @@ -499,7 +2591,1020 @@ static const chr lowerCharTable[] = { 0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9, 0xa7b5, 0xa7b7, 0xa7fa #if TCL_UTF_MAX > 4 - ,0x1d4bb, 0x1d7cb + ,0x100b5, 0x10101, 0x10103, 0x10105, 0x10107, 0x10109, 0x1010b, 0x1010d, 0x1010f, + 0x10111, 0x10113, 0x10115, 0x10117, 0x10119, 0x1011b, 0x1011d, 0x1011f, 0x10121, + 0x10123, 0x10125, 0x10127, 0x10129, 0x1012b, 0x1012d, 0x1012f, 0x10131, 0x10133, + 0x10135, 0x10137, 0x10138, 0x1013a, 0x1013c, 0x1013e, 0x10140, 0x10142, 0x10144, + 0x10146, 0x10148, 0x10149, 0x1014b, 0x1014d, 0x1014f, 0x10151, 0x10153, 0x10155, + 0x10157, 0x10159, 0x1015b, 0x1015d, 0x1015f, 0x10161, 0x10163, 0x10165, 0x10167, + 0x10169, 0x1016b, 0x1016d, 0x1016f, 0x10171, 0x10173, 0x10175, 0x10177, 0x1017a, + 0x1017c, 0x10183, 0x10185, 0x10188, 0x1018c, 0x1018d, 0x10192, 0x10195, 0x1019e, + 0x101a1, 0x101a3, 0x101a5, 0x101a8, 0x101aa, 0x101ab, 0x101ad, 0x101b0, 0x101b4, + 0x101b6, 0x101b9, 0x101ba, 0x101c6, 0x101c9, 0x101cc, 0x101ce, 0x101d0, 0x101d2, + 0x101d4, 0x101d6, 0x101d8, 0x101da, 0x101dc, 0x101dd, 0x101df, 0x101e1, 0x101e3, + 0x101e5, 0x101e7, 0x101e9, 0x101eb, 0x101ed, 0x101ef, 0x101f0, 0x101f3, 0x101f5, + 0x101f9, 0x101fb, 0x101fd, 0x101ff, 0x10201, 0x10203, 0x10205, 0x10207, 0x10209, + 0x1020b, 0x1020d, 0x1020f, 0x10211, 0x10213, 0x10215, 0x10217, 0x10219, 0x1021b, + 0x1021d, 0x1021f, 0x10221, 0x10223, 0x10225, 0x10227, 0x10229, 0x1022b, 0x1022d, + 0x1022f, 0x10231, 0x1023c, 0x1023f, 0x10240, 0x10242, 0x10247, 0x10249, 0x1024b, + 0x1024d, 0x10371, 0x10373, 0x10377, 0x10390, 0x103d0, 0x103d1, 0x103d9, 0x103db, + 0x103dd, 0x103df, 0x103e1, 0x103e3, 0x103e5, 0x103e7, 0x103e9, 0x103eb, 0x103ed, + 0x103f5, 0x103f8, 0x103fb, 0x103fc, 0x10461, 0x10463, 0x10465, 0x10467, 0x10469, + 0x1046b, 0x1046d, 0x1046f, 0x10471, 0x10473, 0x10475, 0x10477, 0x10479, 0x1047b, + 0x1047d, 0x1047f, 0x10481, 0x1048b, 0x1048d, 0x1048f, 0x10491, 0x10493, 0x10495, + 0x10497, 0x10499, 0x1049b, 0x1049d, 0x1049f, 0x104a1, 0x104a3, 0x104a5, 0x104a7, + 0x104a9, 0x104ab, 0x104ad, 0x104af, 0x104b1, 0x104b3, 0x104b5, 0x104b7, 0x104b9, + 0x104bb, 0x104bd, 0x104bf, 0x104c2, 0x104c4, 0x104c6, 0x104c8, 0x104ca, 0x104cc, + 0x104ce, 0x104cf, 0x104d1, 0x104d3, 0x104d5, 0x104d7, 0x104d9, 0x104db, 0x104dd, + 0x104df, 0x104e1, 0x104e3, 0x104e5, 0x104e7, 0x104e9, 0x104eb, 0x104ed, 0x104ef, + 0x104f1, 0x104f3, 0x104f5, 0x104f7, 0x104f9, 0x104fb, 0x104fd, 0x104ff, 0x10501, + 0x10503, 0x10505, 0x10507, 0x10509, 0x1050b, 0x1050d, 0x1050f, 0x10511, 0x10513, + 0x10515, 0x10517, 0x10519, 0x1051b, 0x1051d, 0x1051f, 0x10521, 0x10523, 0x10525, + 0x10527, 0x10529, 0x1052b, 0x1052d, 0x1052f, 0x11e01, 0x11e03, 0x11e05, 0x11e07, + 0x11e09, 0x11e0b, 0x11e0d, 0x11e0f, 0x11e11, 0x11e13, 0x11e15, 0x11e17, 0x11e19, + 0x11e1b, 0x11e1d, 0x11e1f, 0x11e21, 0x11e23, 0x11e25, 0x11e27, 0x11e29, 0x11e2b, + 0x11e2d, 0x11e2f, 0x11e31, 0x11e33, 0x11e35, 0x11e37, 0x11e39, 0x11e3b, 0x11e3d, + 0x11e3f, 0x11e41, 0x11e43, 0x11e45, 0x11e47, 0x11e49, 0x11e4b, 0x11e4d, 0x11e4f, + 0x11e51, 0x11e53, 0x11e55, 0x11e57, 0x11e59, 0x11e5b, 0x11e5d, 0x11e5f, 0x11e61, + 0x11e63, 0x11e65, 0x11e67, 0x11e69, 0x11e6b, 0x11e6d, 0x11e6f, 0x11e71, 0x11e73, + 0x11e75, 0x11e77, 0x11e79, 0x11e7b, 0x11e7d, 0x11e7f, 0x11e81, 0x11e83, 0x11e85, + 0x11e87, 0x11e89, 0x11e8b, 0x11e8d, 0x11e8f, 0x11e91, 0x11e93, 0x11e9f, 0x11ea1, + 0x11ea3, 0x11ea5, 0x11ea7, 0x11ea9, 0x11eab, 0x11ead, 0x11eaf, 0x11eb1, 0x11eb3, + 0x11eb5, 0x11eb7, 0x11eb9, 0x11ebb, 0x11ebd, 0x11ebf, 0x11ec1, 0x11ec3, 0x11ec5, + 0x11ec7, 0x11ec9, 0x11ecb, 0x11ecd, 0x11ecf, 0x11ed1, 0x11ed3, 0x11ed5, 0x11ed7, + 0x11ed9, 0x11edb, 0x11edd, 0x11edf, 0x11ee1, 0x11ee3, 0x11ee5, 0x11ee7, 0x11ee9, + 0x11eeb, 0x11eed, 0x11eef, 0x11ef1, 0x11ef3, 0x11ef5, 0x11ef7, 0x11ef9, 0x11efb, + 0x11efd, 0x11fb6, 0x11fb7, 0x11fbe, 0x11fc6, 0x11fc7, 0x11fd6, 0x11fd7, 0x11ff6, + 0x11ff7, 0x1210a, 0x1210e, 0x1210f, 0x12113, 0x1212f, 0x12134, 0x12139, 0x1213c, + 0x1213d, 0x1214e, 0x12184, 0x12c61, 0x12c65, 0x12c66, 0x12c68, 0x12c6a, 0x12c6c, + 0x12c71, 0x12c73, 0x12c74, 0x12c81, 0x12c83, 0x12c85, 0x12c87, 0x12c89, 0x12c8b, + 0x12c8d, 0x12c8f, 0x12c91, 0x12c93, 0x12c95, 0x12c97, 0x12c99, 0x12c9b, 0x12c9d, + 0x12c9f, 0x12ca1, 0x12ca3, 0x12ca5, 0x12ca7, 0x12ca9, 0x12cab, 0x12cad, 0x12caf, + 0x12cb1, 0x12cb3, 0x12cb5, 0x12cb7, 0x12cb9, 0x12cbb, 0x12cbd, 0x12cbf, 0x12cc1, + 0x12cc3, 0x12cc5, 0x12cc7, 0x12cc9, 0x12ccb, 0x12ccd, 0x12ccf, 0x12cd1, 0x12cd3, + 0x12cd5, 0x12cd7, 0x12cd9, 0x12cdb, 0x12cdd, 0x12cdf, 0x12ce1, 0x12ce3, 0x12ce4, + 0x12cec, 0x12cee, 0x12cf3, 0x12d27, 0x12d2d, 0x1a641, 0x1a643, 0x1a645, 0x1a647, + 0x1a649, 0x1a64b, 0x1a64d, 0x1a64f, 0x1a651, 0x1a653, 0x1a655, 0x1a657, 0x1a659, + 0x1a65b, 0x1a65d, 0x1a65f, 0x1a661, 0x1a663, 0x1a665, 0x1a667, 0x1a669, 0x1a66b, + 0x1a66d, 0x1a681, 0x1a683, 0x1a685, 0x1a687, 0x1a689, 0x1a68b, 0x1a68d, 0x1a68f, + 0x1a691, 0x1a693, 0x1a695, 0x1a697, 0x1a699, 0x1a69b, 0x1a723, 0x1a725, 0x1a727, + 0x1a729, 0x1a72b, 0x1a72d, 0x1a733, 0x1a735, 0x1a737, 0x1a739, 0x1a73b, 0x1a73d, + 0x1a73f, 0x1a741, 0x1a743, 0x1a745, 0x1a747, 0x1a749, 0x1a74b, 0x1a74d, 0x1a74f, + 0x1a751, 0x1a753, 0x1a755, 0x1a757, 0x1a759, 0x1a75b, 0x1a75d, 0x1a75f, 0x1a761, + 0x1a763, 0x1a765, 0x1a767, 0x1a769, 0x1a76b, 0x1a76d, 0x1a76f, 0x1a77a, 0x1a77c, + 0x1a77f, 0x1a781, 0x1a783, 0x1a785, 0x1a787, 0x1a78c, 0x1a78e, 0x1a791, 0x1a797, + 0x1a799, 0x1a79b, 0x1a79d, 0x1a79f, 0x1a7a1, 0x1a7a3, 0x1a7a5, 0x1a7a7, 0x1a7a9, + 0x1a7b5, 0x1a7b7, 0x1a7fa, 0x200b5, 0x20101, 0x20103, 0x20105, 0x20107, 0x20109, + 0x2010b, 0x2010d, 0x2010f, 0x20111, 0x20113, 0x20115, 0x20117, 0x20119, 0x2011b, + 0x2011d, 0x2011f, 0x20121, 0x20123, 0x20125, 0x20127, 0x20129, 0x2012b, 0x2012d, + 0x2012f, 0x20131, 0x20133, 0x20135, 0x20137, 0x20138, 0x2013a, 0x2013c, 0x2013e, + 0x20140, 0x20142, 0x20144, 0x20146, 0x20148, 0x20149, 0x2014b, 0x2014d, 0x2014f, + 0x20151, 0x20153, 0x20155, 0x20157, 0x20159, 0x2015b, 0x2015d, 0x2015f, 0x20161, + 0x20163, 0x20165, 0x20167, 0x20169, 0x2016b, 0x2016d, 0x2016f, 0x20171, 0x20173, + 0x20175, 0x20177, 0x2017a, 0x2017c, 0x20183, 0x20185, 0x20188, 0x2018c, 0x2018d, + 0x20192, 0x20195, 0x2019e, 0x201a1, 0x201a3, 0x201a5, 0x201a8, 0x201aa, 0x201ab, + 0x201ad, 0x201b0, 0x201b4, 0x201b6, 0x201b9, 0x201ba, 0x201c6, 0x201c9, 0x201cc, + 0x201ce, 0x201d0, 0x201d2, 0x201d4, 0x201d6, 0x201d8, 0x201da, 0x201dc, 0x201dd, + 0x201df, 0x201e1, 0x201e3, 0x201e5, 0x201e7, 0x201e9, 0x201eb, 0x201ed, 0x201ef, + 0x201f0, 0x201f3, 0x201f5, 0x201f9, 0x201fb, 0x201fd, 0x201ff, 0x20201, 0x20203, + 0x20205, 0x20207, 0x20209, 0x2020b, 0x2020d, 0x2020f, 0x20211, 0x20213, 0x20215, + 0x20217, 0x20219, 0x2021b, 0x2021d, 0x2021f, 0x20221, 0x20223, 0x20225, 0x20227, + 0x20229, 0x2022b, 0x2022d, 0x2022f, 0x20231, 0x2023c, 0x2023f, 0x20240, 0x20242, + 0x20247, 0x20249, 0x2024b, 0x2024d, 0x20371, 0x20373, 0x20377, 0x20390, 0x203d0, + 0x203d1, 0x203d9, 0x203db, 0x203dd, 0x203df, 0x203e1, 0x203e3, 0x203e5, 0x203e7, + 0x203e9, 0x203eb, 0x203ed, 0x203f5, 0x203f8, 0x203fb, 0x203fc, 0x20461, 0x20463, + 0x20465, 0x20467, 0x20469, 0x2046b, 0x2046d, 0x2046f, 0x20471, 0x20473, 0x20475, + 0x20477, 0x20479, 0x2047b, 0x2047d, 0x2047f, 0x20481, 0x2048b, 0x2048d, 0x2048f, + 0x20491, 0x20493, 0x20495, 0x20497, 0x20499, 0x2049b, 0x2049d, 0x2049f, 0x204a1, + 0x204a3, 0x204a5, 0x204a7, 0x204a9, 0x204ab, 0x204ad, 0x204af, 0x204b1, 0x204b3, + 0x204b5, 0x204b7, 0x204b9, 0x204bb, 0x204bd, 0x204bf, 0x204c2, 0x204c4, 0x204c6, + 0x204c8, 0x204ca, 0x204cc, 0x204ce, 0x204cf, 0x204d1, 0x204d3, 0x204d5, 0x204d7, + 0x204d9, 0x204db, 0x204dd, 0x204df, 0x204e1, 0x204e3, 0x204e5, 0x204e7, 0x204e9, + 0x204eb, 0x204ed, 0x204ef, 0x204f1, 0x204f3, 0x204f5, 0x204f7, 0x204f9, 0x204fb, + 0x204fd, 0x204ff, 0x20501, 0x20503, 0x20505, 0x20507, 0x20509, 0x2050b, 0x2050d, + 0x2050f, 0x20511, 0x20513, 0x20515, 0x20517, 0x20519, 0x2051b, 0x2051d, 0x2051f, + 0x20521, 0x20523, 0x20525, 0x20527, 0x20529, 0x2052b, 0x2052d, 0x2052f, 0x21e01, + 0x21e03, 0x21e05, 0x21e07, 0x21e09, 0x21e0b, 0x21e0d, 0x21e0f, 0x21e11, 0x21e13, + 0x21e15, 0x21e17, 0x21e19, 0x21e1b, 0x21e1d, 0x21e1f, 0x21e21, 0x21e23, 0x21e25, + 0x21e27, 0x21e29, 0x21e2b, 0x21e2d, 0x21e2f, 0x21e31, 0x21e33, 0x21e35, 0x21e37, + 0x21e39, 0x21e3b, 0x21e3d, 0x21e3f, 0x21e41, 0x21e43, 0x21e45, 0x21e47, 0x21e49, + 0x21e4b, 0x21e4d, 0x21e4f, 0x21e51, 0x21e53, 0x21e55, 0x21e57, 0x21e59, 0x21e5b, + 0x21e5d, 0x21e5f, 0x21e61, 0x21e63, 0x21e65, 0x21e67, 0x21e69, 0x21e6b, 0x21e6d, + 0x21e6f, 0x21e71, 0x21e73, 0x21e75, 0x21e77, 0x21e79, 0x21e7b, 0x21e7d, 0x21e7f, + 0x21e81, 0x21e83, 0x21e85, 0x21e87, 0x21e89, 0x21e8b, 0x21e8d, 0x21e8f, 0x21e91, + 0x21e93, 0x21e9f, 0x21ea1, 0x21ea3, 0x21ea5, 0x21ea7, 0x21ea9, 0x21eab, 0x21ead, + 0x21eaf, 0x21eb1, 0x21eb3, 0x21eb5, 0x21eb7, 0x21eb9, 0x21ebb, 0x21ebd, 0x21ebf, + 0x21ec1, 0x21ec3, 0x21ec5, 0x21ec7, 0x21ec9, 0x21ecb, 0x21ecd, 0x21ecf, 0x21ed1, + 0x21ed3, 0x21ed5, 0x21ed7, 0x21ed9, 0x21edb, 0x21edd, 0x21edf, 0x21ee1, 0x21ee3, + 0x21ee5, 0x21ee7, 0x21ee9, 0x21eeb, 0x21eed, 0x21eef, 0x21ef1, 0x21ef3, 0x21ef5, + 0x21ef7, 0x21ef9, 0x21efb, 0x21efd, 0x21fb6, 0x21fb7, 0x21fbe, 0x21fc6, 0x21fc7, + 0x21fd6, 0x21fd7, 0x21ff6, 0x21ff7, 0x2210a, 0x2210e, 0x2210f, 0x22113, 0x2212f, + 0x22134, 0x22139, 0x2213c, 0x2213d, 0x2214e, 0x22184, 0x22c61, 0x22c65, 0x22c66, + 0x22c68, 0x22c6a, 0x22c6c, 0x22c71, 0x22c73, 0x22c74, 0x22c81, 0x22c83, 0x22c85, + 0x22c87, 0x22c89, 0x22c8b, 0x22c8d, 0x22c8f, 0x22c91, 0x22c93, 0x22c95, 0x22c97, + 0x22c99, 0x22c9b, 0x22c9d, 0x22c9f, 0x22ca1, 0x22ca3, 0x22ca5, 0x22ca7, 0x22ca9, + 0x22cab, 0x22cad, 0x22caf, 0x22cb1, 0x22cb3, 0x22cb5, 0x22cb7, 0x22cb9, 0x22cbb, + 0x22cbd, 0x22cbf, 0x22cc1, 0x22cc3, 0x22cc5, 0x22cc7, 0x22cc9, 0x22ccb, 0x22ccd, + 0x22ccf, 0x22cd1, 0x22cd3, 0x22cd5, 0x22cd7, 0x22cd9, 0x22cdb, 0x22cdd, 0x22cdf, + 0x22ce1, 0x22ce3, 0x22ce4, 0x22cec, 0x22cee, 0x22cf3, 0x22d27, 0x22d2d, 0x2a641, + 0x2a643, 0x2a645, 0x2a647, 0x2a649, 0x2a64b, 0x2a64d, 0x2a64f, 0x2a651, 0x2a653, + 0x2a655, 0x2a657, 0x2a659, 0x2a65b, 0x2a65d, 0x2a65f, 0x2a661, 0x2a663, 0x2a665, + 0x2a667, 0x2a669, 0x2a66b, 0x2a66d, 0x2a681, 0x2a683, 0x2a685, 0x2a687, 0x2a689, + 0x2a68b, 0x2a68d, 0x2a68f, 0x2a691, 0x2a693, 0x2a695, 0x2a697, 0x2a699, 0x2a69b, + 0x2a723, 0x2a725, 0x2a727, 0x2a729, 0x2a72b, 0x2a72d, 0x2a733, 0x2a735, 0x2a737, + 0x2a739, 0x2a73b, 0x2a73d, 0x2a73f, 0x2a741, 0x2a743, 0x2a745, 0x2a747, 0x2a749, + 0x2a74b, 0x2a74d, 0x2a74f, 0x2a751, 0x2a753, 0x2a755, 0x2a757, 0x2a759, 0x2a75b, + 0x2a75d, 0x2a75f, 0x2a761, 0x2a763, 0x2a765, 0x2a767, 0x2a769, 0x2a76b, 0x2a76d, + 0x2a76f, 0x2a77a, 0x2a77c, 0x2a77f, 0x2a781, 0x2a783, 0x2a785, 0x2a787, 0x2a78c, + 0x2a78e, 0x2a791, 0x2a797, 0x2a799, 0x2a79b, 0x2a79d, 0x2a79f, 0x2a7a1, 0x2a7a3, + 0x2a7a5, 0x2a7a7, 0x2a7a9, 0x2a7b5, 0x2a7b7, 0x2a7fa, 0x300b5, 0x30101, 0x30103, + 0x30105, 0x30107, 0x30109, 0x3010b, 0x3010d, 0x3010f, 0x30111, 0x30113, 0x30115, + 0x30117, 0x30119, 0x3011b, 0x3011d, 0x3011f, 0x30121, 0x30123, 0x30125, 0x30127, + 0x30129, 0x3012b, 0x3012d, 0x3012f, 0x30131, 0x30133, 0x30135, 0x30137, 0x30138, + 0x3013a, 0x3013c, 0x3013e, 0x30140, 0x30142, 0x30144, 0x30146, 0x30148, 0x30149, + 0x3014b, 0x3014d, 0x3014f, 0x30151, 0x30153, 0x30155, 0x30157, 0x30159, 0x3015b, + 0x3015d, 0x3015f, 0x30161, 0x30163, 0x30165, 0x30167, 0x30169, 0x3016b, 0x3016d, + 0x3016f, 0x30171, 0x30173, 0x30175, 0x30177, 0x3017a, 0x3017c, 0x30183, 0x30185, + 0x30188, 0x3018c, 0x3018d, 0x30192, 0x30195, 0x3019e, 0x301a1, 0x301a3, 0x301a5, + 0x301a8, 0x301aa, 0x301ab, 0x301ad, 0x301b0, 0x301b4, 0x301b6, 0x301b9, 0x301ba, + 0x301c6, 0x301c9, 0x301cc, 0x301ce, 0x301d0, 0x301d2, 0x301d4, 0x301d6, 0x301d8, + 0x301da, 0x301dc, 0x301dd, 0x301df, 0x301e1, 0x301e3, 0x301e5, 0x301e7, 0x301e9, + 0x301eb, 0x301ed, 0x301ef, 0x301f0, 0x301f3, 0x301f5, 0x301f9, 0x301fb, 0x301fd, + 0x301ff, 0x30201, 0x30203, 0x30205, 0x30207, 0x30209, 0x3020b, 0x3020d, 0x3020f, + 0x30211, 0x30213, 0x30215, 0x30217, 0x30219, 0x3021b, 0x3021d, 0x3021f, 0x30221, + 0x30223, 0x30225, 0x30227, 0x30229, 0x3022b, 0x3022d, 0x3022f, 0x30231, 0x3023c, + 0x3023f, 0x30240, 0x30242, 0x30247, 0x30249, 0x3024b, 0x3024d, 0x30371, 0x30373, + 0x30377, 0x30390, 0x303d0, 0x303d1, 0x303d9, 0x303db, 0x303dd, 0x303df, 0x303e1, + 0x303e3, 0x303e5, 0x303e7, 0x303e9, 0x303eb, 0x303ed, 0x303f5, 0x303f8, 0x303fb, + 0x303fc, 0x30461, 0x30463, 0x30465, 0x30467, 0x30469, 0x3046b, 0x3046d, 0x3046f, + 0x30471, 0x30473, 0x30475, 0x30477, 0x30479, 0x3047b, 0x3047d, 0x3047f, 0x30481, + 0x3048b, 0x3048d, 0x3048f, 0x30491, 0x30493, 0x30495, 0x30497, 0x30499, 0x3049b, + 0x3049d, 0x3049f, 0x304a1, 0x304a3, 0x304a5, 0x304a7, 0x304a9, 0x304ab, 0x304ad, + 0x304af, 0x304b1, 0x304b3, 0x304b5, 0x304b7, 0x304b9, 0x304bb, 0x304bd, 0x304bf, + 0x304c2, 0x304c4, 0x304c6, 0x304c8, 0x304ca, 0x304cc, 0x304ce, 0x304cf, 0x304d1, + 0x304d3, 0x304d5, 0x304d7, 0x304d9, 0x304db, 0x304dd, 0x304df, 0x304e1, 0x304e3, + 0x304e5, 0x304e7, 0x304e9, 0x304eb, 0x304ed, 0x304ef, 0x304f1, 0x304f3, 0x304f5, + 0x304f7, 0x304f9, 0x304fb, 0x304fd, 0x304ff, 0x30501, 0x30503, 0x30505, 0x30507, + 0x30509, 0x3050b, 0x3050d, 0x3050f, 0x30511, 0x30513, 0x30515, 0x30517, 0x30519, + 0x3051b, 0x3051d, 0x3051f, 0x30521, 0x30523, 0x30525, 0x30527, 0x30529, 0x3052b, + 0x3052d, 0x3052f, 0x31e01, 0x31e03, 0x31e05, 0x31e07, 0x31e09, 0x31e0b, 0x31e0d, + 0x31e0f, 0x31e11, 0x31e13, 0x31e15, 0x31e17, 0x31e19, 0x31e1b, 0x31e1d, 0x31e1f, + 0x31e21, 0x31e23, 0x31e25, 0x31e27, 0x31e29, 0x31e2b, 0x31e2d, 0x31e2f, 0x31e31, + 0x31e33, 0x31e35, 0x31e37, 0x31e39, 0x31e3b, 0x31e3d, 0x31e3f, 0x31e41, 0x31e43, + 0x31e45, 0x31e47, 0x31e49, 0x31e4b, 0x31e4d, 0x31e4f, 0x31e51, 0x31e53, 0x31e55, + 0x31e57, 0x31e59, 0x31e5b, 0x31e5d, 0x31e5f, 0x31e61, 0x31e63, 0x31e65, 0x31e67, + 0x31e69, 0x31e6b, 0x31e6d, 0x31e6f, 0x31e71, 0x31e73, 0x31e75, 0x31e77, 0x31e79, + 0x31e7b, 0x31e7d, 0x31e7f, 0x31e81, 0x31e83, 0x31e85, 0x31e87, 0x31e89, 0x31e8b, + 0x31e8d, 0x31e8f, 0x31e91, 0x31e93, 0x31e9f, 0x31ea1, 0x31ea3, 0x31ea5, 0x31ea7, + 0x31ea9, 0x31eab, 0x31ead, 0x31eaf, 0x31eb1, 0x31eb3, 0x31eb5, 0x31eb7, 0x31eb9, + 0x31ebb, 0x31ebd, 0x31ebf, 0x31ec1, 0x31ec3, 0x31ec5, 0x31ec7, 0x31ec9, 0x31ecb, + 0x31ecd, 0x31ecf, 0x31ed1, 0x31ed3, 0x31ed5, 0x31ed7, 0x31ed9, 0x31edb, 0x31edd, + 0x31edf, 0x31ee1, 0x31ee3, 0x31ee5, 0x31ee7, 0x31ee9, 0x31eeb, 0x31eed, 0x31eef, + 0x31ef1, 0x31ef3, 0x31ef5, 0x31ef7, 0x31ef9, 0x31efb, 0x31efd, 0x31fb6, 0x31fb7, + 0x31fbe, 0x31fc6, 0x31fc7, 0x31fd6, 0x31fd7, 0x31ff6, 0x31ff7, 0x3210a, 0x3210e, + 0x3210f, 0x32113, 0x3212f, 0x32134, 0x32139, 0x3213c, 0x3213d, 0x3214e, 0x32184, + 0x32c61, 0x32c65, 0x32c66, 0x32c68, 0x32c6a, 0x32c6c, 0x32c71, 0x32c73, 0x32c74, + 0x32c81, 0x32c83, 0x32c85, 0x32c87, 0x32c89, 0x32c8b, 0x32c8d, 0x32c8f, 0x32c91, + 0x32c93, 0x32c95, 0x32c97, 0x32c99, 0x32c9b, 0x32c9d, 0x32c9f, 0x32ca1, 0x32ca3, + 0x32ca5, 0x32ca7, 0x32ca9, 0x32cab, 0x32cad, 0x32caf, 0x32cb1, 0x32cb3, 0x32cb5, + 0x32cb7, 0x32cb9, 0x32cbb, 0x32cbd, 0x32cbf, 0x32cc1, 0x32cc3, 0x32cc5, 0x32cc7, + 0x32cc9, 0x32ccb, 0x32ccd, 0x32ccf, 0x32cd1, 0x32cd3, 0x32cd5, 0x32cd7, 0x32cd9, + 0x32cdb, 0x32cdd, 0x32cdf, 0x32ce1, 0x32ce3, 0x32ce4, 0x32cec, 0x32cee, 0x32cf3, + 0x32d27, 0x32d2d, 0x3a641, 0x3a643, 0x3a645, 0x3a647, 0x3a649, 0x3a64b, 0x3a64d, + 0x3a64f, 0x3a651, 0x3a653, 0x3a655, 0x3a657, 0x3a659, 0x3a65b, 0x3a65d, 0x3a65f, + 0x3a661, 0x3a663, 0x3a665, 0x3a667, 0x3a669, 0x3a66b, 0x3a66d, 0x3a681, 0x3a683, + 0x3a685, 0x3a687, 0x3a689, 0x3a68b, 0x3a68d, 0x3a68f, 0x3a691, 0x3a693, 0x3a695, + 0x3a697, 0x3a699, 0x3a69b, 0x3a723, 0x3a725, 0x3a727, 0x3a729, 0x3a72b, 0x3a72d, + 0x3a733, 0x3a735, 0x3a737, 0x3a739, 0x3a73b, 0x3a73d, 0x3a73f, 0x3a741, 0x3a743, + 0x3a745, 0x3a747, 0x3a749, 0x3a74b, 0x3a74d, 0x3a74f, 0x3a751, 0x3a753, 0x3a755, + 0x3a757, 0x3a759, 0x3a75b, 0x3a75d, 0x3a75f, 0x3a761, 0x3a763, 0x3a765, 0x3a767, + 0x3a769, 0x3a76b, 0x3a76d, 0x3a76f, 0x3a77a, 0x3a77c, 0x3a77f, 0x3a781, 0x3a783, + 0x3a785, 0x3a787, 0x3a78c, 0x3a78e, 0x3a791, 0x3a797, 0x3a799, 0x3a79b, 0x3a79d, + 0x3a79f, 0x3a7a1, 0x3a7a3, 0x3a7a5, 0x3a7a7, 0x3a7a9, 0x3a7b5, 0x3a7b7, 0x3a7fa, + 0x400b5, 0x40101, 0x40103, 0x40105, 0x40107, 0x40109, 0x4010b, 0x4010d, 0x4010f, + 0x40111, 0x40113, 0x40115, 0x40117, 0x40119, 0x4011b, 0x4011d, 0x4011f, 0x40121, + 0x40123, 0x40125, 0x40127, 0x40129, 0x4012b, 0x4012d, 0x4012f, 0x40131, 0x40133, + 0x40135, 0x40137, 0x40138, 0x4013a, 0x4013c, 0x4013e, 0x40140, 0x40142, 0x40144, + 0x40146, 0x40148, 0x40149, 0x4014b, 0x4014d, 0x4014f, 0x40151, 0x40153, 0x40155, + 0x40157, 0x40159, 0x4015b, 0x4015d, 0x4015f, 0x40161, 0x40163, 0x40165, 0x40167, + 0x40169, 0x4016b, 0x4016d, 0x4016f, 0x40171, 0x40173, 0x40175, 0x40177, 0x4017a, + 0x4017c, 0x40183, 0x40185, 0x40188, 0x4018c, 0x4018d, 0x40192, 0x40195, 0x4019e, + 0x401a1, 0x401a3, 0x401a5, 0x401a8, 0x401aa, 0x401ab, 0x401ad, 0x401b0, 0x401b4, + 0x401b6, 0x401b9, 0x401ba, 0x401c6, 0x401c9, 0x401cc, 0x401ce, 0x401d0, 0x401d2, + 0x401d4, 0x401d6, 0x401d8, 0x401da, 0x401dc, 0x401dd, 0x401df, 0x401e1, 0x401e3, + 0x401e5, 0x401e7, 0x401e9, 0x401eb, 0x401ed, 0x401ef, 0x401f0, 0x401f3, 0x401f5, + 0x401f9, 0x401fb, 0x401fd, 0x401ff, 0x40201, 0x40203, 0x40205, 0x40207, 0x40209, + 0x4020b, 0x4020d, 0x4020f, 0x40211, 0x40213, 0x40215, 0x40217, 0x40219, 0x4021b, + 0x4021d, 0x4021f, 0x40221, 0x40223, 0x40225, 0x40227, 0x40229, 0x4022b, 0x4022d, + 0x4022f, 0x40231, 0x4023c, 0x4023f, 0x40240, 0x40242, 0x40247, 0x40249, 0x4024b, + 0x4024d, 0x40371, 0x40373, 0x40377, 0x40390, 0x403d0, 0x403d1, 0x403d9, 0x403db, + 0x403dd, 0x403df, 0x403e1, 0x403e3, 0x403e5, 0x403e7, 0x403e9, 0x403eb, 0x403ed, + 0x403f5, 0x403f8, 0x403fb, 0x403fc, 0x40461, 0x40463, 0x40465, 0x40467, 0x40469, + 0x4046b, 0x4046d, 0x4046f, 0x40471, 0x40473, 0x40475, 0x40477, 0x40479, 0x4047b, + 0x4047d, 0x4047f, 0x40481, 0x4048b, 0x4048d, 0x4048f, 0x40491, 0x40493, 0x40495, + 0x40497, 0x40499, 0x4049b, 0x4049d, 0x4049f, 0x404a1, 0x404a3, 0x404a5, 0x404a7, + 0x404a9, 0x404ab, 0x404ad, 0x404af, 0x404b1, 0x404b3, 0x404b5, 0x404b7, 0x404b9, + 0x404bb, 0x404bd, 0x404bf, 0x404c2, 0x404c4, 0x404c6, 0x404c8, 0x404ca, 0x404cc, + 0x404ce, 0x404cf, 0x404d1, 0x404d3, 0x404d5, 0x404d7, 0x404d9, 0x404db, 0x404dd, + 0x404df, 0x404e1, 0x404e3, 0x404e5, 0x404e7, 0x404e9, 0x404eb, 0x404ed, 0x404ef, + 0x404f1, 0x404f3, 0x404f5, 0x404f7, 0x404f9, 0x404fb, 0x404fd, 0x404ff, 0x40501, + 0x40503, 0x40505, 0x40507, 0x40509, 0x4050b, 0x4050d, 0x4050f, 0x40511, 0x40513, + 0x40515, 0x40517, 0x40519, 0x4051b, 0x4051d, 0x4051f, 0x40521, 0x40523, 0x40525, + 0x40527, 0x40529, 0x4052b, 0x4052d, 0x4052f, 0x41e01, 0x41e03, 0x41e05, 0x41e07, + 0x41e09, 0x41e0b, 0x41e0d, 0x41e0f, 0x41e11, 0x41e13, 0x41e15, 0x41e17, 0x41e19, + 0x41e1b, 0x41e1d, 0x41e1f, 0x41e21, 0x41e23, 0x41e25, 0x41e27, 0x41e29, 0x41e2b, + 0x41e2d, 0x41e2f, 0x41e31, 0x41e33, 0x41e35, 0x41e37, 0x41e39, 0x41e3b, 0x41e3d, + 0x41e3f, 0x41e41, 0x41e43, 0x41e45, 0x41e47, 0x41e49, 0x41e4b, 0x41e4d, 0x41e4f, + 0x41e51, 0x41e53, 0x41e55, 0x41e57, 0x41e59, 0x41e5b, 0x41e5d, 0x41e5f, 0x41e61, + 0x41e63, 0x41e65, 0x41e67, 0x41e69, 0x41e6b, 0x41e6d, 0x41e6f, 0x41e71, 0x41e73, + 0x41e75, 0x41e77, 0x41e79, 0x41e7b, 0x41e7d, 0x41e7f, 0x41e81, 0x41e83, 0x41e85, + 0x41e87, 0x41e89, 0x41e8b, 0x41e8d, 0x41e8f, 0x41e91, 0x41e93, 0x41e9f, 0x41ea1, + 0x41ea3, 0x41ea5, 0x41ea7, 0x41ea9, 0x41eab, 0x41ead, 0x41eaf, 0x41eb1, 0x41eb3, + 0x41eb5, 0x41eb7, 0x41eb9, 0x41ebb, 0x41ebd, 0x41ebf, 0x41ec1, 0x41ec3, 0x41ec5, + 0x41ec7, 0x41ec9, 0x41ecb, 0x41ecd, 0x41ecf, 0x41ed1, 0x41ed3, 0x41ed5, 0x41ed7, + 0x41ed9, 0x41edb, 0x41edd, 0x41edf, 0x41ee1, 0x41ee3, 0x41ee5, 0x41ee7, 0x41ee9, + 0x41eeb, 0x41eed, 0x41eef, 0x41ef1, 0x41ef3, 0x41ef5, 0x41ef7, 0x41ef9, 0x41efb, + 0x41efd, 0x41fb6, 0x41fb7, 0x41fbe, 0x41fc6, 0x41fc7, 0x41fd6, 0x41fd7, 0x41ff6, + 0x41ff7, 0x4210a, 0x4210e, 0x4210f, 0x42113, 0x4212f, 0x42134, 0x42139, 0x4213c, + 0x4213d, 0x4214e, 0x42184, 0x42c61, 0x42c65, 0x42c66, 0x42c68, 0x42c6a, 0x42c6c, + 0x42c71, 0x42c73, 0x42c74, 0x42c81, 0x42c83, 0x42c85, 0x42c87, 0x42c89, 0x42c8b, + 0x42c8d, 0x42c8f, 0x42c91, 0x42c93, 0x42c95, 0x42c97, 0x42c99, 0x42c9b, 0x42c9d, + 0x42c9f, 0x42ca1, 0x42ca3, 0x42ca5, 0x42ca7, 0x42ca9, 0x42cab, 0x42cad, 0x42caf, + 0x42cb1, 0x42cb3, 0x42cb5, 0x42cb7, 0x42cb9, 0x42cbb, 0x42cbd, 0x42cbf, 0x42cc1, + 0x42cc3, 0x42cc5, 0x42cc7, 0x42cc9, 0x42ccb, 0x42ccd, 0x42ccf, 0x42cd1, 0x42cd3, + 0x42cd5, 0x42cd7, 0x42cd9, 0x42cdb, 0x42cdd, 0x42cdf, 0x42ce1, 0x42ce3, 0x42ce4, + 0x42cec, 0x42cee, 0x42cf3, 0x42d27, 0x42d2d, 0x4a641, 0x4a643, 0x4a645, 0x4a647, + 0x4a649, 0x4a64b, 0x4a64d, 0x4a64f, 0x4a651, 0x4a653, 0x4a655, 0x4a657, 0x4a659, + 0x4a65b, 0x4a65d, 0x4a65f, 0x4a661, 0x4a663, 0x4a665, 0x4a667, 0x4a669, 0x4a66b, + 0x4a66d, 0x4a681, 0x4a683, 0x4a685, 0x4a687, 0x4a689, 0x4a68b, 0x4a68d, 0x4a68f, + 0x4a691, 0x4a693, 0x4a695, 0x4a697, 0x4a699, 0x4a69b, 0x4a723, 0x4a725, 0x4a727, + 0x4a729, 0x4a72b, 0x4a72d, 0x4a733, 0x4a735, 0x4a737, 0x4a739, 0x4a73b, 0x4a73d, + 0x4a73f, 0x4a741, 0x4a743, 0x4a745, 0x4a747, 0x4a749, 0x4a74b, 0x4a74d, 0x4a74f, + 0x4a751, 0x4a753, 0x4a755, 0x4a757, 0x4a759, 0x4a75b, 0x4a75d, 0x4a75f, 0x4a761, + 0x4a763, 0x4a765, 0x4a767, 0x4a769, 0x4a76b, 0x4a76d, 0x4a76f, 0x4a77a, 0x4a77c, + 0x4a77f, 0x4a781, 0x4a783, 0x4a785, 0x4a787, 0x4a78c, 0x4a78e, 0x4a791, 0x4a797, + 0x4a799, 0x4a79b, 0x4a79d, 0x4a79f, 0x4a7a1, 0x4a7a3, 0x4a7a5, 0x4a7a7, 0x4a7a9, + 0x4a7b5, 0x4a7b7, 0x4a7fa, 0x500b5, 0x50101, 0x50103, 0x50105, 0x50107, 0x50109, + 0x5010b, 0x5010d, 0x5010f, 0x50111, 0x50113, 0x50115, 0x50117, 0x50119, 0x5011b, + 0x5011d, 0x5011f, 0x50121, 0x50123, 0x50125, 0x50127, 0x50129, 0x5012b, 0x5012d, + 0x5012f, 0x50131, 0x50133, 0x50135, 0x50137, 0x50138, 0x5013a, 0x5013c, 0x5013e, + 0x50140, 0x50142, 0x50144, 0x50146, 0x50148, 0x50149, 0x5014b, 0x5014d, 0x5014f, + 0x50151, 0x50153, 0x50155, 0x50157, 0x50159, 0x5015b, 0x5015d, 0x5015f, 0x50161, + 0x50163, 0x50165, 0x50167, 0x50169, 0x5016b, 0x5016d, 0x5016f, 0x50171, 0x50173, + 0x50175, 0x50177, 0x5017a, 0x5017c, 0x50183, 0x50185, 0x50188, 0x5018c, 0x5018d, + 0x50192, 0x50195, 0x5019e, 0x501a1, 0x501a3, 0x501a5, 0x501a8, 0x501aa, 0x501ab, + 0x501ad, 0x501b0, 0x501b4, 0x501b6, 0x501b9, 0x501ba, 0x501c6, 0x501c9, 0x501cc, + 0x501ce, 0x501d0, 0x501d2, 0x501d4, 0x501d6, 0x501d8, 0x501da, 0x501dc, 0x501dd, + 0x501df, 0x501e1, 0x501e3, 0x501e5, 0x501e7, 0x501e9, 0x501eb, 0x501ed, 0x501ef, + 0x501f0, 0x501f3, 0x501f5, 0x501f9, 0x501fb, 0x501fd, 0x501ff, 0x50201, 0x50203, + 0x50205, 0x50207, 0x50209, 0x5020b, 0x5020d, 0x5020f, 0x50211, 0x50213, 0x50215, + 0x50217, 0x50219, 0x5021b, 0x5021d, 0x5021f, 0x50221, 0x50223, 0x50225, 0x50227, + 0x50229, 0x5022b, 0x5022d, 0x5022f, 0x50231, 0x5023c, 0x5023f, 0x50240, 0x50242, + 0x50247, 0x50249, 0x5024b, 0x5024d, 0x50371, 0x50373, 0x50377, 0x50390, 0x503d0, + 0x503d1, 0x503d9, 0x503db, 0x503dd, 0x503df, 0x503e1, 0x503e3, 0x503e5, 0x503e7, + 0x503e9, 0x503eb, 0x503ed, 0x503f5, 0x503f8, 0x503fb, 0x503fc, 0x50461, 0x50463, + 0x50465, 0x50467, 0x50469, 0x5046b, 0x5046d, 0x5046f, 0x50471, 0x50473, 0x50475, + 0x50477, 0x50479, 0x5047b, 0x5047d, 0x5047f, 0x50481, 0x5048b, 0x5048d, 0x5048f, + 0x50491, 0x50493, 0x50495, 0x50497, 0x50499, 0x5049b, 0x5049d, 0x5049f, 0x504a1, + 0x504a3, 0x504a5, 0x504a7, 0x504a9, 0x504ab, 0x504ad, 0x504af, 0x504b1, 0x504b3, + 0x504b5, 0x504b7, 0x504b9, 0x504bb, 0x504bd, 0x504bf, 0x504c2, 0x504c4, 0x504c6, + 0x504c8, 0x504ca, 0x504cc, 0x504ce, 0x504cf, 0x504d1, 0x504d3, 0x504d5, 0x504d7, + 0x504d9, 0x504db, 0x504dd, 0x504df, 0x504e1, 0x504e3, 0x504e5, 0x504e7, 0x504e9, + 0x504eb, 0x504ed, 0x504ef, 0x504f1, 0x504f3, 0x504f5, 0x504f7, 0x504f9, 0x504fb, + 0x504fd, 0x504ff, 0x50501, 0x50503, 0x50505, 0x50507, 0x50509, 0x5050b, 0x5050d, + 0x5050f, 0x50511, 0x50513, 0x50515, 0x50517, 0x50519, 0x5051b, 0x5051d, 0x5051f, + 0x50521, 0x50523, 0x50525, 0x50527, 0x50529, 0x5052b, 0x5052d, 0x5052f, 0x51e01, + 0x51e03, 0x51e05, 0x51e07, 0x51e09, 0x51e0b, 0x51e0d, 0x51e0f, 0x51e11, 0x51e13, + 0x51e15, 0x51e17, 0x51e19, 0x51e1b, 0x51e1d, 0x51e1f, 0x51e21, 0x51e23, 0x51e25, + 0x51e27, 0x51e29, 0x51e2b, 0x51e2d, 0x51e2f, 0x51e31, 0x51e33, 0x51e35, 0x51e37, + 0x51e39, 0x51e3b, 0x51e3d, 0x51e3f, 0x51e41, 0x51e43, 0x51e45, 0x51e47, 0x51e49, + 0x51e4b, 0x51e4d, 0x51e4f, 0x51e51, 0x51e53, 0x51e55, 0x51e57, 0x51e59, 0x51e5b, + 0x51e5d, 0x51e5f, 0x51e61, 0x51e63, 0x51e65, 0x51e67, 0x51e69, 0x51e6b, 0x51e6d, + 0x51e6f, 0x51e71, 0x51e73, 0x51e75, 0x51e77, 0x51e79, 0x51e7b, 0x51e7d, 0x51e7f, + 0x51e81, 0x51e83, 0x51e85, 0x51e87, 0x51e89, 0x51e8b, 0x51e8d, 0x51e8f, 0x51e91, + 0x51e93, 0x51e9f, 0x51ea1, 0x51ea3, 0x51ea5, 0x51ea7, 0x51ea9, 0x51eab, 0x51ead, + 0x51eaf, 0x51eb1, 0x51eb3, 0x51eb5, 0x51eb7, 0x51eb9, 0x51ebb, 0x51ebd, 0x51ebf, + 0x51ec1, 0x51ec3, 0x51ec5, 0x51ec7, 0x51ec9, 0x51ecb, 0x51ecd, 0x51ecf, 0x51ed1, + 0x51ed3, 0x51ed5, 0x51ed7, 0x51ed9, 0x51edb, 0x51edd, 0x51edf, 0x51ee1, 0x51ee3, + 0x51ee5, 0x51ee7, 0x51ee9, 0x51eeb, 0x51eed, 0x51eef, 0x51ef1, 0x51ef3, 0x51ef5, + 0x51ef7, 0x51ef9, 0x51efb, 0x51efd, 0x51fb6, 0x51fb7, 0x51fbe, 0x51fc6, 0x51fc7, + 0x51fd6, 0x51fd7, 0x51ff6, 0x51ff7, 0x5210a, 0x5210e, 0x5210f, 0x52113, 0x5212f, + 0x52134, 0x52139, 0x5213c, 0x5213d, 0x5214e, 0x52184, 0x52c61, 0x52c65, 0x52c66, + 0x52c68, 0x52c6a, 0x52c6c, 0x52c71, 0x52c73, 0x52c74, 0x52c81, 0x52c83, 0x52c85, + 0x52c87, 0x52c89, 0x52c8b, 0x52c8d, 0x52c8f, 0x52c91, 0x52c93, 0x52c95, 0x52c97, + 0x52c99, 0x52c9b, 0x52c9d, 0x52c9f, 0x52ca1, 0x52ca3, 0x52ca5, 0x52ca7, 0x52ca9, + 0x52cab, 0x52cad, 0x52caf, 0x52cb1, 0x52cb3, 0x52cb5, 0x52cb7, 0x52cb9, 0x52cbb, + 0x52cbd, 0x52cbf, 0x52cc1, 0x52cc3, 0x52cc5, 0x52cc7, 0x52cc9, 0x52ccb, 0x52ccd, + 0x52ccf, 0x52cd1, 0x52cd3, 0x52cd5, 0x52cd7, 0x52cd9, 0x52cdb, 0x52cdd, 0x52cdf, + 0x52ce1, 0x52ce3, 0x52ce4, 0x52cec, 0x52cee, 0x52cf3, 0x52d27, 0x52d2d, 0x5a641, + 0x5a643, 0x5a645, 0x5a647, 0x5a649, 0x5a64b, 0x5a64d, 0x5a64f, 0x5a651, 0x5a653, + 0x5a655, 0x5a657, 0x5a659, 0x5a65b, 0x5a65d, 0x5a65f, 0x5a661, 0x5a663, 0x5a665, + 0x5a667, 0x5a669, 0x5a66b, 0x5a66d, 0x5a681, 0x5a683, 0x5a685, 0x5a687, 0x5a689, + 0x5a68b, 0x5a68d, 0x5a68f, 0x5a691, 0x5a693, 0x5a695, 0x5a697, 0x5a699, 0x5a69b, + 0x5a723, 0x5a725, 0x5a727, 0x5a729, 0x5a72b, 0x5a72d, 0x5a733, 0x5a735, 0x5a737, + 0x5a739, 0x5a73b, 0x5a73d, 0x5a73f, 0x5a741, 0x5a743, 0x5a745, 0x5a747, 0x5a749, + 0x5a74b, 0x5a74d, 0x5a74f, 0x5a751, 0x5a753, 0x5a755, 0x5a757, 0x5a759, 0x5a75b, + 0x5a75d, 0x5a75f, 0x5a761, 0x5a763, 0x5a765, 0x5a767, 0x5a769, 0x5a76b, 0x5a76d, + 0x5a76f, 0x5a77a, 0x5a77c, 0x5a77f, 0x5a781, 0x5a783, 0x5a785, 0x5a787, 0x5a78c, + 0x5a78e, 0x5a791, 0x5a797, 0x5a799, 0x5a79b, 0x5a79d, 0x5a79f, 0x5a7a1, 0x5a7a3, + 0x5a7a5, 0x5a7a7, 0x5a7a9, 0x5a7b5, 0x5a7b7, 0x5a7fa, 0x600b5, 0x60101, 0x60103, + 0x60105, 0x60107, 0x60109, 0x6010b, 0x6010d, 0x6010f, 0x60111, 0x60113, 0x60115, + 0x60117, 0x60119, 0x6011b, 0x6011d, 0x6011f, 0x60121, 0x60123, 0x60125, 0x60127, + 0x60129, 0x6012b, 0x6012d, 0x6012f, 0x60131, 0x60133, 0x60135, 0x60137, 0x60138, + 0x6013a, 0x6013c, 0x6013e, 0x60140, 0x60142, 0x60144, 0x60146, 0x60148, 0x60149, + 0x6014b, 0x6014d, 0x6014f, 0x60151, 0x60153, 0x60155, 0x60157, 0x60159, 0x6015b, + 0x6015d, 0x6015f, 0x60161, 0x60163, 0x60165, 0x60167, 0x60169, 0x6016b, 0x6016d, + 0x6016f, 0x60171, 0x60173, 0x60175, 0x60177, 0x6017a, 0x6017c, 0x60183, 0x60185, + 0x60188, 0x6018c, 0x6018d, 0x60192, 0x60195, 0x6019e, 0x601a1, 0x601a3, 0x601a5, + 0x601a8, 0x601aa, 0x601ab, 0x601ad, 0x601b0, 0x601b4, 0x601b6, 0x601b9, 0x601ba, + 0x601c6, 0x601c9, 0x601cc, 0x601ce, 0x601d0, 0x601d2, 0x601d4, 0x601d6, 0x601d8, + 0x601da, 0x601dc, 0x601dd, 0x601df, 0x601e1, 0x601e3, 0x601e5, 0x601e7, 0x601e9, + 0x601eb, 0x601ed, 0x601ef, 0x601f0, 0x601f3, 0x601f5, 0x601f9, 0x601fb, 0x601fd, + 0x601ff, 0x60201, 0x60203, 0x60205, 0x60207, 0x60209, 0x6020b, 0x6020d, 0x6020f, + 0x60211, 0x60213, 0x60215, 0x60217, 0x60219, 0x6021b, 0x6021d, 0x6021f, 0x60221, + 0x60223, 0x60225, 0x60227, 0x60229, 0x6022b, 0x6022d, 0x6022f, 0x60231, 0x6023c, + 0x6023f, 0x60240, 0x60242, 0x60247, 0x60249, 0x6024b, 0x6024d, 0x60371, 0x60373, + 0x60377, 0x60390, 0x603d0, 0x603d1, 0x603d9, 0x603db, 0x603dd, 0x603df, 0x603e1, + 0x603e3, 0x603e5, 0x603e7, 0x603e9, 0x603eb, 0x603ed, 0x603f5, 0x603f8, 0x603fb, + 0x603fc, 0x60461, 0x60463, 0x60465, 0x60467, 0x60469, 0x6046b, 0x6046d, 0x6046f, + 0x60471, 0x60473, 0x60475, 0x60477, 0x60479, 0x6047b, 0x6047d, 0x6047f, 0x60481, + 0x6048b, 0x6048d, 0x6048f, 0x60491, 0x60493, 0x60495, 0x60497, 0x60499, 0x6049b, + 0x6049d, 0x6049f, 0x604a1, 0x604a3, 0x604a5, 0x604a7, 0x604a9, 0x604ab, 0x604ad, + 0x604af, 0x604b1, 0x604b3, 0x604b5, 0x604b7, 0x604b9, 0x604bb, 0x604bd, 0x604bf, + 0x604c2, 0x604c4, 0x604c6, 0x604c8, 0x604ca, 0x604cc, 0x604ce, 0x604cf, 0x604d1, + 0x604d3, 0x604d5, 0x604d7, 0x604d9, 0x604db, 0x604dd, 0x604df, 0x604e1, 0x604e3, + 0x604e5, 0x604e7, 0x604e9, 0x604eb, 0x604ed, 0x604ef, 0x604f1, 0x604f3, 0x604f5, + 0x604f7, 0x604f9, 0x604fb, 0x604fd, 0x604ff, 0x60501, 0x60503, 0x60505, 0x60507, + 0x60509, 0x6050b, 0x6050d, 0x6050f, 0x60511, 0x60513, 0x60515, 0x60517, 0x60519, + 0x6051b, 0x6051d, 0x6051f, 0x60521, 0x60523, 0x60525, 0x60527, 0x60529, 0x6052b, + 0x6052d, 0x6052f, 0x61e01, 0x61e03, 0x61e05, 0x61e07, 0x61e09, 0x61e0b, 0x61e0d, + 0x61e0f, 0x61e11, 0x61e13, 0x61e15, 0x61e17, 0x61e19, 0x61e1b, 0x61e1d, 0x61e1f, + 0x61e21, 0x61e23, 0x61e25, 0x61e27, 0x61e29, 0x61e2b, 0x61e2d, 0x61e2f, 0x61e31, + 0x61e33, 0x61e35, 0x61e37, 0x61e39, 0x61e3b, 0x61e3d, 0x61e3f, 0x61e41, 0x61e43, + 0x61e45, 0x61e47, 0x61e49, 0x61e4b, 0x61e4d, 0x61e4f, 0x61e51, 0x61e53, 0x61e55, + 0x61e57, 0x61e59, 0x61e5b, 0x61e5d, 0x61e5f, 0x61e61, 0x61e63, 0x61e65, 0x61e67, + 0x61e69, 0x61e6b, 0x61e6d, 0x61e6f, 0x61e71, 0x61e73, 0x61e75, 0x61e77, 0x61e79, + 0x61e7b, 0x61e7d, 0x61e7f, 0x61e81, 0x61e83, 0x61e85, 0x61e87, 0x61e89, 0x61e8b, + 0x61e8d, 0x61e8f, 0x61e91, 0x61e93, 0x61e9f, 0x61ea1, 0x61ea3, 0x61ea5, 0x61ea7, + 0x61ea9, 0x61eab, 0x61ead, 0x61eaf, 0x61eb1, 0x61eb3, 0x61eb5, 0x61eb7, 0x61eb9, + 0x61ebb, 0x61ebd, 0x61ebf, 0x61ec1, 0x61ec3, 0x61ec5, 0x61ec7, 0x61ec9, 0x61ecb, + 0x61ecd, 0x61ecf, 0x61ed1, 0x61ed3, 0x61ed5, 0x61ed7, 0x61ed9, 0x61edb, 0x61edd, + 0x61edf, 0x61ee1, 0x61ee3, 0x61ee5, 0x61ee7, 0x61ee9, 0x61eeb, 0x61eed, 0x61eef, + 0x61ef1, 0x61ef3, 0x61ef5, 0x61ef7, 0x61ef9, 0x61efb, 0x61efd, 0x61fb6, 0x61fb7, + 0x61fbe, 0x61fc6, 0x61fc7, 0x61fd6, 0x61fd7, 0x61ff6, 0x61ff7, 0x6210a, 0x6210e, + 0x6210f, 0x62113, 0x6212f, 0x62134, 0x62139, 0x6213c, 0x6213d, 0x6214e, 0x62184, + 0x62c61, 0x62c65, 0x62c66, 0x62c68, 0x62c6a, 0x62c6c, 0x62c71, 0x62c73, 0x62c74, + 0x62c81, 0x62c83, 0x62c85, 0x62c87, 0x62c89, 0x62c8b, 0x62c8d, 0x62c8f, 0x62c91, + 0x62c93, 0x62c95, 0x62c97, 0x62c99, 0x62c9b, 0x62c9d, 0x62c9f, 0x62ca1, 0x62ca3, + 0x62ca5, 0x62ca7, 0x62ca9, 0x62cab, 0x62cad, 0x62caf, 0x62cb1, 0x62cb3, 0x62cb5, + 0x62cb7, 0x62cb9, 0x62cbb, 0x62cbd, 0x62cbf, 0x62cc1, 0x62cc3, 0x62cc5, 0x62cc7, + 0x62cc9, 0x62ccb, 0x62ccd, 0x62ccf, 0x62cd1, 0x62cd3, 0x62cd5, 0x62cd7, 0x62cd9, + 0x62cdb, 0x62cdd, 0x62cdf, 0x62ce1, 0x62ce3, 0x62ce4, 0x62cec, 0x62cee, 0x62cf3, + 0x62d27, 0x62d2d, 0x6a641, 0x6a643, 0x6a645, 0x6a647, 0x6a649, 0x6a64b, 0x6a64d, + 0x6a64f, 0x6a651, 0x6a653, 0x6a655, 0x6a657, 0x6a659, 0x6a65b, 0x6a65d, 0x6a65f, + 0x6a661, 0x6a663, 0x6a665, 0x6a667, 0x6a669, 0x6a66b, 0x6a66d, 0x6a681, 0x6a683, + 0x6a685, 0x6a687, 0x6a689, 0x6a68b, 0x6a68d, 0x6a68f, 0x6a691, 0x6a693, 0x6a695, + 0x6a697, 0x6a699, 0x6a69b, 0x6a723, 0x6a725, 0x6a727, 0x6a729, 0x6a72b, 0x6a72d, + 0x6a733, 0x6a735, 0x6a737, 0x6a739, 0x6a73b, 0x6a73d, 0x6a73f, 0x6a741, 0x6a743, + 0x6a745, 0x6a747, 0x6a749, 0x6a74b, 0x6a74d, 0x6a74f, 0x6a751, 0x6a753, 0x6a755, + 0x6a757, 0x6a759, 0x6a75b, 0x6a75d, 0x6a75f, 0x6a761, 0x6a763, 0x6a765, 0x6a767, + 0x6a769, 0x6a76b, 0x6a76d, 0x6a76f, 0x6a77a, 0x6a77c, 0x6a77f, 0x6a781, 0x6a783, + 0x6a785, 0x6a787, 0x6a78c, 0x6a78e, 0x6a791, 0x6a797, 0x6a799, 0x6a79b, 0x6a79d, + 0x6a79f, 0x6a7a1, 0x6a7a3, 0x6a7a5, 0x6a7a7, 0x6a7a9, 0x6a7b5, 0x6a7b7, 0x6a7fa, + 0x700b5, 0x70101, 0x70103, 0x70105, 0x70107, 0x70109, 0x7010b, 0x7010d, 0x7010f, + 0x70111, 0x70113, 0x70115, 0x70117, 0x70119, 0x7011b, 0x7011d, 0x7011f, 0x70121, + 0x70123, 0x70125, 0x70127, 0x70129, 0x7012b, 0x7012d, 0x7012f, 0x70131, 0x70133, + 0x70135, 0x70137, 0x70138, 0x7013a, 0x7013c, 0x7013e, 0x70140, 0x70142, 0x70144, + 0x70146, 0x70148, 0x70149, 0x7014b, 0x7014d, 0x7014f, 0x70151, 0x70153, 0x70155, + 0x70157, 0x70159, 0x7015b, 0x7015d, 0x7015f, 0x70161, 0x70163, 0x70165, 0x70167, + 0x70169, 0x7016b, 0x7016d, 0x7016f, 0x70171, 0x70173, 0x70175, 0x70177, 0x7017a, + 0x7017c, 0x70183, 0x70185, 0x70188, 0x7018c, 0x7018d, 0x70192, 0x70195, 0x7019e, + 0x701a1, 0x701a3, 0x701a5, 0x701a8, 0x701aa, 0x701ab, 0x701ad, 0x701b0, 0x701b4, + 0x701b6, 0x701b9, 0x701ba, 0x701c6, 0x701c9, 0x701cc, 0x701ce, 0x701d0, 0x701d2, + 0x701d4, 0x701d6, 0x701d8, 0x701da, 0x701dc, 0x701dd, 0x701df, 0x701e1, 0x701e3, + 0x701e5, 0x701e7, 0x701e9, 0x701eb, 0x701ed, 0x701ef, 0x701f0, 0x701f3, 0x701f5, + 0x701f9, 0x701fb, 0x701fd, 0x701ff, 0x70201, 0x70203, 0x70205, 0x70207, 0x70209, + 0x7020b, 0x7020d, 0x7020f, 0x70211, 0x70213, 0x70215, 0x70217, 0x70219, 0x7021b, + 0x7021d, 0x7021f, 0x70221, 0x70223, 0x70225, 0x70227, 0x70229, 0x7022b, 0x7022d, + 0x7022f, 0x70231, 0x7023c, 0x7023f, 0x70240, 0x70242, 0x70247, 0x70249, 0x7024b, + 0x7024d, 0x70371, 0x70373, 0x70377, 0x70390, 0x703d0, 0x703d1, 0x703d9, 0x703db, + 0x703dd, 0x703df, 0x703e1, 0x703e3, 0x703e5, 0x703e7, 0x703e9, 0x703eb, 0x703ed, + 0x703f5, 0x703f8, 0x703fb, 0x703fc, 0x70461, 0x70463, 0x70465, 0x70467, 0x70469, + 0x7046b, 0x7046d, 0x7046f, 0x70471, 0x70473, 0x70475, 0x70477, 0x70479, 0x7047b, + 0x7047d, 0x7047f, 0x70481, 0x7048b, 0x7048d, 0x7048f, 0x70491, 0x70493, 0x70495, + 0x70497, 0x70499, 0x7049b, 0x7049d, 0x7049f, 0x704a1, 0x704a3, 0x704a5, 0x704a7, + 0x704a9, 0x704ab, 0x704ad, 0x704af, 0x704b1, 0x704b3, 0x704b5, 0x704b7, 0x704b9, + 0x704bb, 0x704bd, 0x704bf, 0x704c2, 0x704c4, 0x704c6, 0x704c8, 0x704ca, 0x704cc, + 0x704ce, 0x704cf, 0x704d1, 0x704d3, 0x704d5, 0x704d7, 0x704d9, 0x704db, 0x704dd, + 0x704df, 0x704e1, 0x704e3, 0x704e5, 0x704e7, 0x704e9, 0x704eb, 0x704ed, 0x704ef, + 0x704f1, 0x704f3, 0x704f5, 0x704f7, 0x704f9, 0x704fb, 0x704fd, 0x704ff, 0x70501, + 0x70503, 0x70505, 0x70507, 0x70509, 0x7050b, 0x7050d, 0x7050f, 0x70511, 0x70513, + 0x70515, 0x70517, 0x70519, 0x7051b, 0x7051d, 0x7051f, 0x70521, 0x70523, 0x70525, + 0x70527, 0x70529, 0x7052b, 0x7052d, 0x7052f, 0x71e01, 0x71e03, 0x71e05, 0x71e07, + 0x71e09, 0x71e0b, 0x71e0d, 0x71e0f, 0x71e11, 0x71e13, 0x71e15, 0x71e17, 0x71e19, + 0x71e1b, 0x71e1d, 0x71e1f, 0x71e21, 0x71e23, 0x71e25, 0x71e27, 0x71e29, 0x71e2b, + 0x71e2d, 0x71e2f, 0x71e31, 0x71e33, 0x71e35, 0x71e37, 0x71e39, 0x71e3b, 0x71e3d, + 0x71e3f, 0x71e41, 0x71e43, 0x71e45, 0x71e47, 0x71e49, 0x71e4b, 0x71e4d, 0x71e4f, + 0x71e51, 0x71e53, 0x71e55, 0x71e57, 0x71e59, 0x71e5b, 0x71e5d, 0x71e5f, 0x71e61, + 0x71e63, 0x71e65, 0x71e67, 0x71e69, 0x71e6b, 0x71e6d, 0x71e6f, 0x71e71, 0x71e73, + 0x71e75, 0x71e77, 0x71e79, 0x71e7b, 0x71e7d, 0x71e7f, 0x71e81, 0x71e83, 0x71e85, + 0x71e87, 0x71e89, 0x71e8b, 0x71e8d, 0x71e8f, 0x71e91, 0x71e93, 0x71e9f, 0x71ea1, + 0x71ea3, 0x71ea5, 0x71ea7, 0x71ea9, 0x71eab, 0x71ead, 0x71eaf, 0x71eb1, 0x71eb3, + 0x71eb5, 0x71eb7, 0x71eb9, 0x71ebb, 0x71ebd, 0x71ebf, 0x71ec1, 0x71ec3, 0x71ec5, + 0x71ec7, 0x71ec9, 0x71ecb, 0x71ecd, 0x71ecf, 0x71ed1, 0x71ed3, 0x71ed5, 0x71ed7, + 0x71ed9, 0x71edb, 0x71edd, 0x71edf, 0x71ee1, 0x71ee3, 0x71ee5, 0x71ee7, 0x71ee9, + 0x71eeb, 0x71eed, 0x71eef, 0x71ef1, 0x71ef3, 0x71ef5, 0x71ef7, 0x71ef9, 0x71efb, + 0x71efd, 0x71fb6, 0x71fb7, 0x71fbe, 0x71fc6, 0x71fc7, 0x71fd6, 0x71fd7, 0x71ff6, + 0x71ff7, 0x7210a, 0x7210e, 0x7210f, 0x72113, 0x7212f, 0x72134, 0x72139, 0x7213c, + 0x7213d, 0x7214e, 0x72184, 0x72c61, 0x72c65, 0x72c66, 0x72c68, 0x72c6a, 0x72c6c, + 0x72c71, 0x72c73, 0x72c74, 0x72c81, 0x72c83, 0x72c85, 0x72c87, 0x72c89, 0x72c8b, + 0x72c8d, 0x72c8f, 0x72c91, 0x72c93, 0x72c95, 0x72c97, 0x72c99, 0x72c9b, 0x72c9d, + 0x72c9f, 0x72ca1, 0x72ca3, 0x72ca5, 0x72ca7, 0x72ca9, 0x72cab, 0x72cad, 0x72caf, + 0x72cb1, 0x72cb3, 0x72cb5, 0x72cb7, 0x72cb9, 0x72cbb, 0x72cbd, 0x72cbf, 0x72cc1, + 0x72cc3, 0x72cc5, 0x72cc7, 0x72cc9, 0x72ccb, 0x72ccd, 0x72ccf, 0x72cd1, 0x72cd3, + 0x72cd5, 0x72cd7, 0x72cd9, 0x72cdb, 0x72cdd, 0x72cdf, 0x72ce1, 0x72ce3, 0x72ce4, + 0x72cec, 0x72cee, 0x72cf3, 0x72d27, 0x72d2d, 0x7a641, 0x7a643, 0x7a645, 0x7a647, + 0x7a649, 0x7a64b, 0x7a64d, 0x7a64f, 0x7a651, 0x7a653, 0x7a655, 0x7a657, 0x7a659, + 0x7a65b, 0x7a65d, 0x7a65f, 0x7a661, 0x7a663, 0x7a665, 0x7a667, 0x7a669, 0x7a66b, + 0x7a66d, 0x7a681, 0x7a683, 0x7a685, 0x7a687, 0x7a689, 0x7a68b, 0x7a68d, 0x7a68f, + 0x7a691, 0x7a693, 0x7a695, 0x7a697, 0x7a699, 0x7a69b, 0x7a723, 0x7a725, 0x7a727, + 0x7a729, 0x7a72b, 0x7a72d, 0x7a733, 0x7a735, 0x7a737, 0x7a739, 0x7a73b, 0x7a73d, + 0x7a73f, 0x7a741, 0x7a743, 0x7a745, 0x7a747, 0x7a749, 0x7a74b, 0x7a74d, 0x7a74f, + 0x7a751, 0x7a753, 0x7a755, 0x7a757, 0x7a759, 0x7a75b, 0x7a75d, 0x7a75f, 0x7a761, + 0x7a763, 0x7a765, 0x7a767, 0x7a769, 0x7a76b, 0x7a76d, 0x7a76f, 0x7a77a, 0x7a77c, + 0x7a77f, 0x7a781, 0x7a783, 0x7a785, 0x7a787, 0x7a78c, 0x7a78e, 0x7a791, 0x7a797, + 0x7a799, 0x7a79b, 0x7a79d, 0x7a79f, 0x7a7a1, 0x7a7a3, 0x7a7a5, 0x7a7a7, 0x7a7a9, + 0x7a7b5, 0x7a7b7, 0x7a7fa, 0x800b5, 0x80101, 0x80103, 0x80105, 0x80107, 0x80109, + 0x8010b, 0x8010d, 0x8010f, 0x80111, 0x80113, 0x80115, 0x80117, 0x80119, 0x8011b, + 0x8011d, 0x8011f, 0x80121, 0x80123, 0x80125, 0x80127, 0x80129, 0x8012b, 0x8012d, + 0x8012f, 0x80131, 0x80133, 0x80135, 0x80137, 0x80138, 0x8013a, 0x8013c, 0x8013e, + 0x80140, 0x80142, 0x80144, 0x80146, 0x80148, 0x80149, 0x8014b, 0x8014d, 0x8014f, + 0x80151, 0x80153, 0x80155, 0x80157, 0x80159, 0x8015b, 0x8015d, 0x8015f, 0x80161, + 0x80163, 0x80165, 0x80167, 0x80169, 0x8016b, 0x8016d, 0x8016f, 0x80171, 0x80173, + 0x80175, 0x80177, 0x8017a, 0x8017c, 0x80183, 0x80185, 0x80188, 0x8018c, 0x8018d, + 0x80192, 0x80195, 0x8019e, 0x801a1, 0x801a3, 0x801a5, 0x801a8, 0x801aa, 0x801ab, + 0x801ad, 0x801b0, 0x801b4, 0x801b6, 0x801b9, 0x801ba, 0x801c6, 0x801c9, 0x801cc, + 0x801ce, 0x801d0, 0x801d2, 0x801d4, 0x801d6, 0x801d8, 0x801da, 0x801dc, 0x801dd, + 0x801df, 0x801e1, 0x801e3, 0x801e5, 0x801e7, 0x801e9, 0x801eb, 0x801ed, 0x801ef, + 0x801f0, 0x801f3, 0x801f5, 0x801f9, 0x801fb, 0x801fd, 0x801ff, 0x80201, 0x80203, + 0x80205, 0x80207, 0x80209, 0x8020b, 0x8020d, 0x8020f, 0x80211, 0x80213, 0x80215, + 0x80217, 0x80219, 0x8021b, 0x8021d, 0x8021f, 0x80221, 0x80223, 0x80225, 0x80227, + 0x80229, 0x8022b, 0x8022d, 0x8022f, 0x80231, 0x8023c, 0x8023f, 0x80240, 0x80242, + 0x80247, 0x80249, 0x8024b, 0x8024d, 0x80371, 0x80373, 0x80377, 0x80390, 0x803d0, + 0x803d1, 0x803d9, 0x803db, 0x803dd, 0x803df, 0x803e1, 0x803e3, 0x803e5, 0x803e7, + 0x803e9, 0x803eb, 0x803ed, 0x803f5, 0x803f8, 0x803fb, 0x803fc, 0x80461, 0x80463, + 0x80465, 0x80467, 0x80469, 0x8046b, 0x8046d, 0x8046f, 0x80471, 0x80473, 0x80475, + 0x80477, 0x80479, 0x8047b, 0x8047d, 0x8047f, 0x80481, 0x8048b, 0x8048d, 0x8048f, + 0x80491, 0x80493, 0x80495, 0x80497, 0x80499, 0x8049b, 0x8049d, 0x8049f, 0x804a1, + 0x804a3, 0x804a5, 0x804a7, 0x804a9, 0x804ab, 0x804ad, 0x804af, 0x804b1, 0x804b3, + 0x804b5, 0x804b7, 0x804b9, 0x804bb, 0x804bd, 0x804bf, 0x804c2, 0x804c4, 0x804c6, + 0x804c8, 0x804ca, 0x804cc, 0x804ce, 0x804cf, 0x804d1, 0x804d3, 0x804d5, 0x804d7, + 0x804d9, 0x804db, 0x804dd, 0x804df, 0x804e1, 0x804e3, 0x804e5, 0x804e7, 0x804e9, + 0x804eb, 0x804ed, 0x804ef, 0x804f1, 0x804f3, 0x804f5, 0x804f7, 0x804f9, 0x804fb, + 0x804fd, 0x804ff, 0x80501, 0x80503, 0x80505, 0x80507, 0x80509, 0x8050b, 0x8050d, + 0x8050f, 0x80511, 0x80513, 0x80515, 0x80517, 0x80519, 0x8051b, 0x8051d, 0x8051f, + 0x80521, 0x80523, 0x80525, 0x80527, 0x80529, 0x8052b, 0x8052d, 0x8052f, 0x81e01, + 0x81e03, 0x81e05, 0x81e07, 0x81e09, 0x81e0b, 0x81e0d, 0x81e0f, 0x81e11, 0x81e13, + 0x81e15, 0x81e17, 0x81e19, 0x81e1b, 0x81e1d, 0x81e1f, 0x81e21, 0x81e23, 0x81e25, + 0x81e27, 0x81e29, 0x81e2b, 0x81e2d, 0x81e2f, 0x81e31, 0x81e33, 0x81e35, 0x81e37, + 0x81e39, 0x81e3b, 0x81e3d, 0x81e3f, 0x81e41, 0x81e43, 0x81e45, 0x81e47, 0x81e49, + 0x81e4b, 0x81e4d, 0x81e4f, 0x81e51, 0x81e53, 0x81e55, 0x81e57, 0x81e59, 0x81e5b, + 0x81e5d, 0x81e5f, 0x81e61, 0x81e63, 0x81e65, 0x81e67, 0x81e69, 0x81e6b, 0x81e6d, + 0x81e6f, 0x81e71, 0x81e73, 0x81e75, 0x81e77, 0x81e79, 0x81e7b, 0x81e7d, 0x81e7f, + 0x81e81, 0x81e83, 0x81e85, 0x81e87, 0x81e89, 0x81e8b, 0x81e8d, 0x81e8f, 0x81e91, + 0x81e93, 0x81e9f, 0x81ea1, 0x81ea3, 0x81ea5, 0x81ea7, 0x81ea9, 0x81eab, 0x81ead, + 0x81eaf, 0x81eb1, 0x81eb3, 0x81eb5, 0x81eb7, 0x81eb9, 0x81ebb, 0x81ebd, 0x81ebf, + 0x81ec1, 0x81ec3, 0x81ec5, 0x81ec7, 0x81ec9, 0x81ecb, 0x81ecd, 0x81ecf, 0x81ed1, + 0x81ed3, 0x81ed5, 0x81ed7, 0x81ed9, 0x81edb, 0x81edd, 0x81edf, 0x81ee1, 0x81ee3, + 0x81ee5, 0x81ee7, 0x81ee9, 0x81eeb, 0x81eed, 0x81eef, 0x81ef1, 0x81ef3, 0x81ef5, + 0x81ef7, 0x81ef9, 0x81efb, 0x81efd, 0x81fb6, 0x81fb7, 0x81fbe, 0x81fc6, 0x81fc7, + 0x81fd6, 0x81fd7, 0x81ff6, 0x81ff7, 0x8210a, 0x8210e, 0x8210f, 0x82113, 0x8212f, + 0x82134, 0x82139, 0x8213c, 0x8213d, 0x8214e, 0x82184, 0x82c61, 0x82c65, 0x82c66, + 0x82c68, 0x82c6a, 0x82c6c, 0x82c71, 0x82c73, 0x82c74, 0x82c81, 0x82c83, 0x82c85, + 0x82c87, 0x82c89, 0x82c8b, 0x82c8d, 0x82c8f, 0x82c91, 0x82c93, 0x82c95, 0x82c97, + 0x82c99, 0x82c9b, 0x82c9d, 0x82c9f, 0x82ca1, 0x82ca3, 0x82ca5, 0x82ca7, 0x82ca9, + 0x82cab, 0x82cad, 0x82caf, 0x82cb1, 0x82cb3, 0x82cb5, 0x82cb7, 0x82cb9, 0x82cbb, + 0x82cbd, 0x82cbf, 0x82cc1, 0x82cc3, 0x82cc5, 0x82cc7, 0x82cc9, 0x82ccb, 0x82ccd, + 0x82ccf, 0x82cd1, 0x82cd3, 0x82cd5, 0x82cd7, 0x82cd9, 0x82cdb, 0x82cdd, 0x82cdf, + 0x82ce1, 0x82ce3, 0x82ce4, 0x82cec, 0x82cee, 0x82cf3, 0x82d27, 0x82d2d, 0x8a641, + 0x8a643, 0x8a645, 0x8a647, 0x8a649, 0x8a64b, 0x8a64d, 0x8a64f, 0x8a651, 0x8a653, + 0x8a655, 0x8a657, 0x8a659, 0x8a65b, 0x8a65d, 0x8a65f, 0x8a661, 0x8a663, 0x8a665, + 0x8a667, 0x8a669, 0x8a66b, 0x8a66d, 0x8a681, 0x8a683, 0x8a685, 0x8a687, 0x8a689, + 0x8a68b, 0x8a68d, 0x8a68f, 0x8a691, 0x8a693, 0x8a695, 0x8a697, 0x8a699, 0x8a69b, + 0x8a723, 0x8a725, 0x8a727, 0x8a729, 0x8a72b, 0x8a72d, 0x8a733, 0x8a735, 0x8a737, + 0x8a739, 0x8a73b, 0x8a73d, 0x8a73f, 0x8a741, 0x8a743, 0x8a745, 0x8a747, 0x8a749, + 0x8a74b, 0x8a74d, 0x8a74f, 0x8a751, 0x8a753, 0x8a755, 0x8a757, 0x8a759, 0x8a75b, + 0x8a75d, 0x8a75f, 0x8a761, 0x8a763, 0x8a765, 0x8a767, 0x8a769, 0x8a76b, 0x8a76d, + 0x8a76f, 0x8a77a, 0x8a77c, 0x8a77f, 0x8a781, 0x8a783, 0x8a785, 0x8a787, 0x8a78c, + 0x8a78e, 0x8a791, 0x8a797, 0x8a799, 0x8a79b, 0x8a79d, 0x8a79f, 0x8a7a1, 0x8a7a3, + 0x8a7a5, 0x8a7a7, 0x8a7a9, 0x8a7b5, 0x8a7b7, 0x8a7fa, 0x900b5, 0x90101, 0x90103, + 0x90105, 0x90107, 0x90109, 0x9010b, 0x9010d, 0x9010f, 0x90111, 0x90113, 0x90115, + 0x90117, 0x90119, 0x9011b, 0x9011d, 0x9011f, 0x90121, 0x90123, 0x90125, 0x90127, + 0x90129, 0x9012b, 0x9012d, 0x9012f, 0x90131, 0x90133, 0x90135, 0x90137, 0x90138, + 0x9013a, 0x9013c, 0x9013e, 0x90140, 0x90142, 0x90144, 0x90146, 0x90148, 0x90149, + 0x9014b, 0x9014d, 0x9014f, 0x90151, 0x90153, 0x90155, 0x90157, 0x90159, 0x9015b, + 0x9015d, 0x9015f, 0x90161, 0x90163, 0x90165, 0x90167, 0x90169, 0x9016b, 0x9016d, + 0x9016f, 0x90171, 0x90173, 0x90175, 0x90177, 0x9017a, 0x9017c, 0x90183, 0x90185, + 0x90188, 0x9018c, 0x9018d, 0x90192, 0x90195, 0x9019e, 0x901a1, 0x901a3, 0x901a5, + 0x901a8, 0x901aa, 0x901ab, 0x901ad, 0x901b0, 0x901b4, 0x901b6, 0x901b9, 0x901ba, + 0x901c6, 0x901c9, 0x901cc, 0x901ce, 0x901d0, 0x901d2, 0x901d4, 0x901d6, 0x901d8, + 0x901da, 0x901dc, 0x901dd, 0x901df, 0x901e1, 0x901e3, 0x901e5, 0x901e7, 0x901e9, + 0x901eb, 0x901ed, 0x901ef, 0x901f0, 0x901f3, 0x901f5, 0x901f9, 0x901fb, 0x901fd, + 0x901ff, 0x90201, 0x90203, 0x90205, 0x90207, 0x90209, 0x9020b, 0x9020d, 0x9020f, + 0x90211, 0x90213, 0x90215, 0x90217, 0x90219, 0x9021b, 0x9021d, 0x9021f, 0x90221, + 0x90223, 0x90225, 0x90227, 0x90229, 0x9022b, 0x9022d, 0x9022f, 0x90231, 0x9023c, + 0x9023f, 0x90240, 0x90242, 0x90247, 0x90249, 0x9024b, 0x9024d, 0x90371, 0x90373, + 0x90377, 0x90390, 0x903d0, 0x903d1, 0x903d9, 0x903db, 0x903dd, 0x903df, 0x903e1, + 0x903e3, 0x903e5, 0x903e7, 0x903e9, 0x903eb, 0x903ed, 0x903f5, 0x903f8, 0x903fb, + 0x903fc, 0x90461, 0x90463, 0x90465, 0x90467, 0x90469, 0x9046b, 0x9046d, 0x9046f, + 0x90471, 0x90473, 0x90475, 0x90477, 0x90479, 0x9047b, 0x9047d, 0x9047f, 0x90481, + 0x9048b, 0x9048d, 0x9048f, 0x90491, 0x90493, 0x90495, 0x90497, 0x90499, 0x9049b, + 0x9049d, 0x9049f, 0x904a1, 0x904a3, 0x904a5, 0x904a7, 0x904a9, 0x904ab, 0x904ad, + 0x904af, 0x904b1, 0x904b3, 0x904b5, 0x904b7, 0x904b9, 0x904bb, 0x904bd, 0x904bf, + 0x904c2, 0x904c4, 0x904c6, 0x904c8, 0x904ca, 0x904cc, 0x904ce, 0x904cf, 0x904d1, + 0x904d3, 0x904d5, 0x904d7, 0x904d9, 0x904db, 0x904dd, 0x904df, 0x904e1, 0x904e3, + 0x904e5, 0x904e7, 0x904e9, 0x904eb, 0x904ed, 0x904ef, 0x904f1, 0x904f3, 0x904f5, + 0x904f7, 0x904f9, 0x904fb, 0x904fd, 0x904ff, 0x90501, 0x90503, 0x90505, 0x90507, + 0x90509, 0x9050b, 0x9050d, 0x9050f, 0x90511, 0x90513, 0x90515, 0x90517, 0x90519, + 0x9051b, 0x9051d, 0x9051f, 0x90521, 0x90523, 0x90525, 0x90527, 0x90529, 0x9052b, + 0x9052d, 0x9052f, 0x91e01, 0x91e03, 0x91e05, 0x91e07, 0x91e09, 0x91e0b, 0x91e0d, + 0x91e0f, 0x91e11, 0x91e13, 0x91e15, 0x91e17, 0x91e19, 0x91e1b, 0x91e1d, 0x91e1f, + 0x91e21, 0x91e23, 0x91e25, 0x91e27, 0x91e29, 0x91e2b, 0x91e2d, 0x91e2f, 0x91e31, + 0x91e33, 0x91e35, 0x91e37, 0x91e39, 0x91e3b, 0x91e3d, 0x91e3f, 0x91e41, 0x91e43, + 0x91e45, 0x91e47, 0x91e49, 0x91e4b, 0x91e4d, 0x91e4f, 0x91e51, 0x91e53, 0x91e55, + 0x91e57, 0x91e59, 0x91e5b, 0x91e5d, 0x91e5f, 0x91e61, 0x91e63, 0x91e65, 0x91e67, + 0x91e69, 0x91e6b, 0x91e6d, 0x91e6f, 0x91e71, 0x91e73, 0x91e75, 0x91e77, 0x91e79, + 0x91e7b, 0x91e7d, 0x91e7f, 0x91e81, 0x91e83, 0x91e85, 0x91e87, 0x91e89, 0x91e8b, + 0x91e8d, 0x91e8f, 0x91e91, 0x91e93, 0x91e9f, 0x91ea1, 0x91ea3, 0x91ea5, 0x91ea7, + 0x91ea9, 0x91eab, 0x91ead, 0x91eaf, 0x91eb1, 0x91eb3, 0x91eb5, 0x91eb7, 0x91eb9, + 0x91ebb, 0x91ebd, 0x91ebf, 0x91ec1, 0x91ec3, 0x91ec5, 0x91ec7, 0x91ec9, 0x91ecb, + 0x91ecd, 0x91ecf, 0x91ed1, 0x91ed3, 0x91ed5, 0x91ed7, 0x91ed9, 0x91edb, 0x91edd, + 0x91edf, 0x91ee1, 0x91ee3, 0x91ee5, 0x91ee7, 0x91ee9, 0x91eeb, 0x91eed, 0x91eef, + 0x91ef1, 0x91ef3, 0x91ef5, 0x91ef7, 0x91ef9, 0x91efb, 0x91efd, 0x91fb6, 0x91fb7, + 0x91fbe, 0x91fc6, 0x91fc7, 0x91fd6, 0x91fd7, 0x91ff6, 0x91ff7, 0x9210a, 0x9210e, + 0x9210f, 0x92113, 0x9212f, 0x92134, 0x92139, 0x9213c, 0x9213d, 0x9214e, 0x92184, + 0x92c61, 0x92c65, 0x92c66, 0x92c68, 0x92c6a, 0x92c6c, 0x92c71, 0x92c73, 0x92c74, + 0x92c81, 0x92c83, 0x92c85, 0x92c87, 0x92c89, 0x92c8b, 0x92c8d, 0x92c8f, 0x92c91, + 0x92c93, 0x92c95, 0x92c97, 0x92c99, 0x92c9b, 0x92c9d, 0x92c9f, 0x92ca1, 0x92ca3, + 0x92ca5, 0x92ca7, 0x92ca9, 0x92cab, 0x92cad, 0x92caf, 0x92cb1, 0x92cb3, 0x92cb5, + 0x92cb7, 0x92cb9, 0x92cbb, 0x92cbd, 0x92cbf, 0x92cc1, 0x92cc3, 0x92cc5, 0x92cc7, + 0x92cc9, 0x92ccb, 0x92ccd, 0x92ccf, 0x92cd1, 0x92cd3, 0x92cd5, 0x92cd7, 0x92cd9, + 0x92cdb, 0x92cdd, 0x92cdf, 0x92ce1, 0x92ce3, 0x92ce4, 0x92cec, 0x92cee, 0x92cf3, + 0x92d27, 0x92d2d, 0x9a641, 0x9a643, 0x9a645, 0x9a647, 0x9a649, 0x9a64b, 0x9a64d, + 0x9a64f, 0x9a651, 0x9a653, 0x9a655, 0x9a657, 0x9a659, 0x9a65b, 0x9a65d, 0x9a65f, + 0x9a661, 0x9a663, 0x9a665, 0x9a667, 0x9a669, 0x9a66b, 0x9a66d, 0x9a681, 0x9a683, + 0x9a685, 0x9a687, 0x9a689, 0x9a68b, 0x9a68d, 0x9a68f, 0x9a691, 0x9a693, 0x9a695, + 0x9a697, 0x9a699, 0x9a69b, 0x9a723, 0x9a725, 0x9a727, 0x9a729, 0x9a72b, 0x9a72d, + 0x9a733, 0x9a735, 0x9a737, 0x9a739, 0x9a73b, 0x9a73d, 0x9a73f, 0x9a741, 0x9a743, + 0x9a745, 0x9a747, 0x9a749, 0x9a74b, 0x9a74d, 0x9a74f, 0x9a751, 0x9a753, 0x9a755, + 0x9a757, 0x9a759, 0x9a75b, 0x9a75d, 0x9a75f, 0x9a761, 0x9a763, 0x9a765, 0x9a767, + 0x9a769, 0x9a76b, 0x9a76d, 0x9a76f, 0x9a77a, 0x9a77c, 0x9a77f, 0x9a781, 0x9a783, + 0x9a785, 0x9a787, 0x9a78c, 0x9a78e, 0x9a791, 0x9a797, 0x9a799, 0x9a79b, 0x9a79d, + 0x9a79f, 0x9a7a1, 0x9a7a3, 0x9a7a5, 0x9a7a7, 0x9a7a9, 0x9a7b5, 0x9a7b7, 0x9a7fa, + 0xa00b5, 0xa0101, 0xa0103, 0xa0105, 0xa0107, 0xa0109, 0xa010b, 0xa010d, 0xa010f, + 0xa0111, 0xa0113, 0xa0115, 0xa0117, 0xa0119, 0xa011b, 0xa011d, 0xa011f, 0xa0121, + 0xa0123, 0xa0125, 0xa0127, 0xa0129, 0xa012b, 0xa012d, 0xa012f, 0xa0131, 0xa0133, + 0xa0135, 0xa0137, 0xa0138, 0xa013a, 0xa013c, 0xa013e, 0xa0140, 0xa0142, 0xa0144, + 0xa0146, 0xa0148, 0xa0149, 0xa014b, 0xa014d, 0xa014f, 0xa0151, 0xa0153, 0xa0155, + 0xa0157, 0xa0159, 0xa015b, 0xa015d, 0xa015f, 0xa0161, 0xa0163, 0xa0165, 0xa0167, + 0xa0169, 0xa016b, 0xa016d, 0xa016f, 0xa0171, 0xa0173, 0xa0175, 0xa0177, 0xa017a, + 0xa017c, 0xa0183, 0xa0185, 0xa0188, 0xa018c, 0xa018d, 0xa0192, 0xa0195, 0xa019e, + 0xa01a1, 0xa01a3, 0xa01a5, 0xa01a8, 0xa01aa, 0xa01ab, 0xa01ad, 0xa01b0, 0xa01b4, + 0xa01b6, 0xa01b9, 0xa01ba, 0xa01c6, 0xa01c9, 0xa01cc, 0xa01ce, 0xa01d0, 0xa01d2, + 0xa01d4, 0xa01d6, 0xa01d8, 0xa01da, 0xa01dc, 0xa01dd, 0xa01df, 0xa01e1, 0xa01e3, + 0xa01e5, 0xa01e7, 0xa01e9, 0xa01eb, 0xa01ed, 0xa01ef, 0xa01f0, 0xa01f3, 0xa01f5, + 0xa01f9, 0xa01fb, 0xa01fd, 0xa01ff, 0xa0201, 0xa0203, 0xa0205, 0xa0207, 0xa0209, + 0xa020b, 0xa020d, 0xa020f, 0xa0211, 0xa0213, 0xa0215, 0xa0217, 0xa0219, 0xa021b, + 0xa021d, 0xa021f, 0xa0221, 0xa0223, 0xa0225, 0xa0227, 0xa0229, 0xa022b, 0xa022d, + 0xa022f, 0xa0231, 0xa023c, 0xa023f, 0xa0240, 0xa0242, 0xa0247, 0xa0249, 0xa024b, + 0xa024d, 0xa0371, 0xa0373, 0xa0377, 0xa0390, 0xa03d0, 0xa03d1, 0xa03d9, 0xa03db, + 0xa03dd, 0xa03df, 0xa03e1, 0xa03e3, 0xa03e5, 0xa03e7, 0xa03e9, 0xa03eb, 0xa03ed, + 0xa03f5, 0xa03f8, 0xa03fb, 0xa03fc, 0xa0461, 0xa0463, 0xa0465, 0xa0467, 0xa0469, + 0xa046b, 0xa046d, 0xa046f, 0xa0471, 0xa0473, 0xa0475, 0xa0477, 0xa0479, 0xa047b, + 0xa047d, 0xa047f, 0xa0481, 0xa048b, 0xa048d, 0xa048f, 0xa0491, 0xa0493, 0xa0495, + 0xa0497, 0xa0499, 0xa049b, 0xa049d, 0xa049f, 0xa04a1, 0xa04a3, 0xa04a5, 0xa04a7, + 0xa04a9, 0xa04ab, 0xa04ad, 0xa04af, 0xa04b1, 0xa04b3, 0xa04b5, 0xa04b7, 0xa04b9, + 0xa04bb, 0xa04bd, 0xa04bf, 0xa04c2, 0xa04c4, 0xa04c6, 0xa04c8, 0xa04ca, 0xa04cc, + 0xa04ce, 0xa04cf, 0xa04d1, 0xa04d3, 0xa04d5, 0xa04d7, 0xa04d9, 0xa04db, 0xa04dd, + 0xa04df, 0xa04e1, 0xa04e3, 0xa04e5, 0xa04e7, 0xa04e9, 0xa04eb, 0xa04ed, 0xa04ef, + 0xa04f1, 0xa04f3, 0xa04f5, 0xa04f7, 0xa04f9, 0xa04fb, 0xa04fd, 0xa04ff, 0xa0501, + 0xa0503, 0xa0505, 0xa0507, 0xa0509, 0xa050b, 0xa050d, 0xa050f, 0xa0511, 0xa0513, + 0xa0515, 0xa0517, 0xa0519, 0xa051b, 0xa051d, 0xa051f, 0xa0521, 0xa0523, 0xa0525, + 0xa0527, 0xa0529, 0xa052b, 0xa052d, 0xa052f, 0xa1e01, 0xa1e03, 0xa1e05, 0xa1e07, + 0xa1e09, 0xa1e0b, 0xa1e0d, 0xa1e0f, 0xa1e11, 0xa1e13, 0xa1e15, 0xa1e17, 0xa1e19, + 0xa1e1b, 0xa1e1d, 0xa1e1f, 0xa1e21, 0xa1e23, 0xa1e25, 0xa1e27, 0xa1e29, 0xa1e2b, + 0xa1e2d, 0xa1e2f, 0xa1e31, 0xa1e33, 0xa1e35, 0xa1e37, 0xa1e39, 0xa1e3b, 0xa1e3d, + 0xa1e3f, 0xa1e41, 0xa1e43, 0xa1e45, 0xa1e47, 0xa1e49, 0xa1e4b, 0xa1e4d, 0xa1e4f, + 0xa1e51, 0xa1e53, 0xa1e55, 0xa1e57, 0xa1e59, 0xa1e5b, 0xa1e5d, 0xa1e5f, 0xa1e61, + 0xa1e63, 0xa1e65, 0xa1e67, 0xa1e69, 0xa1e6b, 0xa1e6d, 0xa1e6f, 0xa1e71, 0xa1e73, + 0xa1e75, 0xa1e77, 0xa1e79, 0xa1e7b, 0xa1e7d, 0xa1e7f, 0xa1e81, 0xa1e83, 0xa1e85, + 0xa1e87, 0xa1e89, 0xa1e8b, 0xa1e8d, 0xa1e8f, 0xa1e91, 0xa1e93, 0xa1e9f, 0xa1ea1, + 0xa1ea3, 0xa1ea5, 0xa1ea7, 0xa1ea9, 0xa1eab, 0xa1ead, 0xa1eaf, 0xa1eb1, 0xa1eb3, + 0xa1eb5, 0xa1eb7, 0xa1eb9, 0xa1ebb, 0xa1ebd, 0xa1ebf, 0xa1ec1, 0xa1ec3, 0xa1ec5, + 0xa1ec7, 0xa1ec9, 0xa1ecb, 0xa1ecd, 0xa1ecf, 0xa1ed1, 0xa1ed3, 0xa1ed5, 0xa1ed7, + 0xa1ed9, 0xa1edb, 0xa1edd, 0xa1edf, 0xa1ee1, 0xa1ee3, 0xa1ee5, 0xa1ee7, 0xa1ee9, + 0xa1eeb, 0xa1eed, 0xa1eef, 0xa1ef1, 0xa1ef3, 0xa1ef5, 0xa1ef7, 0xa1ef9, 0xa1efb, + 0xa1efd, 0xa1fb6, 0xa1fb7, 0xa1fbe, 0xa1fc6, 0xa1fc7, 0xa1fd6, 0xa1fd7, 0xa1ff6, + 0xa1ff7, 0xa210a, 0xa210e, 0xa210f, 0xa2113, 0xa212f, 0xa2134, 0xa2139, 0xa213c, + 0xa213d, 0xa214e, 0xa2184, 0xa2c61, 0xa2c65, 0xa2c66, 0xa2c68, 0xa2c6a, 0xa2c6c, + 0xa2c71, 0xa2c73, 0xa2c74, 0xa2c81, 0xa2c83, 0xa2c85, 0xa2c87, 0xa2c89, 0xa2c8b, + 0xa2c8d, 0xa2c8f, 0xa2c91, 0xa2c93, 0xa2c95, 0xa2c97, 0xa2c99, 0xa2c9b, 0xa2c9d, + 0xa2c9f, 0xa2ca1, 0xa2ca3, 0xa2ca5, 0xa2ca7, 0xa2ca9, 0xa2cab, 0xa2cad, 0xa2caf, + 0xa2cb1, 0xa2cb3, 0xa2cb5, 0xa2cb7, 0xa2cb9, 0xa2cbb, 0xa2cbd, 0xa2cbf, 0xa2cc1, + 0xa2cc3, 0xa2cc5, 0xa2cc7, 0xa2cc9, 0xa2ccb, 0xa2ccd, 0xa2ccf, 0xa2cd1, 0xa2cd3, + 0xa2cd5, 0xa2cd7, 0xa2cd9, 0xa2cdb, 0xa2cdd, 0xa2cdf, 0xa2ce1, 0xa2ce3, 0xa2ce4, + 0xa2cec, 0xa2cee, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xaa641, 0xaa643, 0xaa645, 0xaa647, + 0xaa649, 0xaa64b, 0xaa64d, 0xaa64f, 0xaa651, 0xaa653, 0xaa655, 0xaa657, 0xaa659, + 0xaa65b, 0xaa65d, 0xaa65f, 0xaa661, 0xaa663, 0xaa665, 0xaa667, 0xaa669, 0xaa66b, + 0xaa66d, 0xaa681, 0xaa683, 0xaa685, 0xaa687, 0xaa689, 0xaa68b, 0xaa68d, 0xaa68f, + 0xaa691, 0xaa693, 0xaa695, 0xaa697, 0xaa699, 0xaa69b, 0xaa723, 0xaa725, 0xaa727, + 0xaa729, 0xaa72b, 0xaa72d, 0xaa733, 0xaa735, 0xaa737, 0xaa739, 0xaa73b, 0xaa73d, + 0xaa73f, 0xaa741, 0xaa743, 0xaa745, 0xaa747, 0xaa749, 0xaa74b, 0xaa74d, 0xaa74f, + 0xaa751, 0xaa753, 0xaa755, 0xaa757, 0xaa759, 0xaa75b, 0xaa75d, 0xaa75f, 0xaa761, + 0xaa763, 0xaa765, 0xaa767, 0xaa769, 0xaa76b, 0xaa76d, 0xaa76f, 0xaa77a, 0xaa77c, + 0xaa77f, 0xaa781, 0xaa783, 0xaa785, 0xaa787, 0xaa78c, 0xaa78e, 0xaa791, 0xaa797, + 0xaa799, 0xaa79b, 0xaa79d, 0xaa79f, 0xaa7a1, 0xaa7a3, 0xaa7a5, 0xaa7a7, 0xaa7a9, + 0xaa7b5, 0xaa7b7, 0xaa7fa, 0xb00b5, 0xb0101, 0xb0103, 0xb0105, 0xb0107, 0xb0109, + 0xb010b, 0xb010d, 0xb010f, 0xb0111, 0xb0113, 0xb0115, 0xb0117, 0xb0119, 0xb011b, + 0xb011d, 0xb011f, 0xb0121, 0xb0123, 0xb0125, 0xb0127, 0xb0129, 0xb012b, 0xb012d, + 0xb012f, 0xb0131, 0xb0133, 0xb0135, 0xb0137, 0xb0138, 0xb013a, 0xb013c, 0xb013e, + 0xb0140, 0xb0142, 0xb0144, 0xb0146, 0xb0148, 0xb0149, 0xb014b, 0xb014d, 0xb014f, + 0xb0151, 0xb0153, 0xb0155, 0xb0157, 0xb0159, 0xb015b, 0xb015d, 0xb015f, 0xb0161, + 0xb0163, 0xb0165, 0xb0167, 0xb0169, 0xb016b, 0xb016d, 0xb016f, 0xb0171, 0xb0173, + 0xb0175, 0xb0177, 0xb017a, 0xb017c, 0xb0183, 0xb0185, 0xb0188, 0xb018c, 0xb018d, + 0xb0192, 0xb0195, 0xb019e, 0xb01a1, 0xb01a3, 0xb01a5, 0xb01a8, 0xb01aa, 0xb01ab, + 0xb01ad, 0xb01b0, 0xb01b4, 0xb01b6, 0xb01b9, 0xb01ba, 0xb01c6, 0xb01c9, 0xb01cc, + 0xb01ce, 0xb01d0, 0xb01d2, 0xb01d4, 0xb01d6, 0xb01d8, 0xb01da, 0xb01dc, 0xb01dd, + 0xb01df, 0xb01e1, 0xb01e3, 0xb01e5, 0xb01e7, 0xb01e9, 0xb01eb, 0xb01ed, 0xb01ef, + 0xb01f0, 0xb01f3, 0xb01f5, 0xb01f9, 0xb01fb, 0xb01fd, 0xb01ff, 0xb0201, 0xb0203, + 0xb0205, 0xb0207, 0xb0209, 0xb020b, 0xb020d, 0xb020f, 0xb0211, 0xb0213, 0xb0215, + 0xb0217, 0xb0219, 0xb021b, 0xb021d, 0xb021f, 0xb0221, 0xb0223, 0xb0225, 0xb0227, + 0xb0229, 0xb022b, 0xb022d, 0xb022f, 0xb0231, 0xb023c, 0xb023f, 0xb0240, 0xb0242, + 0xb0247, 0xb0249, 0xb024b, 0xb024d, 0xb0371, 0xb0373, 0xb0377, 0xb0390, 0xb03d0, + 0xb03d1, 0xb03d9, 0xb03db, 0xb03dd, 0xb03df, 0xb03e1, 0xb03e3, 0xb03e5, 0xb03e7, + 0xb03e9, 0xb03eb, 0xb03ed, 0xb03f5, 0xb03f8, 0xb03fb, 0xb03fc, 0xb0461, 0xb0463, + 0xb0465, 0xb0467, 0xb0469, 0xb046b, 0xb046d, 0xb046f, 0xb0471, 0xb0473, 0xb0475, + 0xb0477, 0xb0479, 0xb047b, 0xb047d, 0xb047f, 0xb0481, 0xb048b, 0xb048d, 0xb048f, + 0xb0491, 0xb0493, 0xb0495, 0xb0497, 0xb0499, 0xb049b, 0xb049d, 0xb049f, 0xb04a1, + 0xb04a3, 0xb04a5, 0xb04a7, 0xb04a9, 0xb04ab, 0xb04ad, 0xb04af, 0xb04b1, 0xb04b3, + 0xb04b5, 0xb04b7, 0xb04b9, 0xb04bb, 0xb04bd, 0xb04bf, 0xb04c2, 0xb04c4, 0xb04c6, + 0xb04c8, 0xb04ca, 0xb04cc, 0xb04ce, 0xb04cf, 0xb04d1, 0xb04d3, 0xb04d5, 0xb04d7, + 0xb04d9, 0xb04db, 0xb04dd, 0xb04df, 0xb04e1, 0xb04e3, 0xb04e5, 0xb04e7, 0xb04e9, + 0xb04eb, 0xb04ed, 0xb04ef, 0xb04f1, 0xb04f3, 0xb04f5, 0xb04f7, 0xb04f9, 0xb04fb, + 0xb04fd, 0xb04ff, 0xb0501, 0xb0503, 0xb0505, 0xb0507, 0xb0509, 0xb050b, 0xb050d, + 0xb050f, 0xb0511, 0xb0513, 0xb0515, 0xb0517, 0xb0519, 0xb051b, 0xb051d, 0xb051f, + 0xb0521, 0xb0523, 0xb0525, 0xb0527, 0xb0529, 0xb052b, 0xb052d, 0xb052f, 0xb1e01, + 0xb1e03, 0xb1e05, 0xb1e07, 0xb1e09, 0xb1e0b, 0xb1e0d, 0xb1e0f, 0xb1e11, 0xb1e13, + 0xb1e15, 0xb1e17, 0xb1e19, 0xb1e1b, 0xb1e1d, 0xb1e1f, 0xb1e21, 0xb1e23, 0xb1e25, + 0xb1e27, 0xb1e29, 0xb1e2b, 0xb1e2d, 0xb1e2f, 0xb1e31, 0xb1e33, 0xb1e35, 0xb1e37, + 0xb1e39, 0xb1e3b, 0xb1e3d, 0xb1e3f, 0xb1e41, 0xb1e43, 0xb1e45, 0xb1e47, 0xb1e49, + 0xb1e4b, 0xb1e4d, 0xb1e4f, 0xb1e51, 0xb1e53, 0xb1e55, 0xb1e57, 0xb1e59, 0xb1e5b, + 0xb1e5d, 0xb1e5f, 0xb1e61, 0xb1e63, 0xb1e65, 0xb1e67, 0xb1e69, 0xb1e6b, 0xb1e6d, + 0xb1e6f, 0xb1e71, 0xb1e73, 0xb1e75, 0xb1e77, 0xb1e79, 0xb1e7b, 0xb1e7d, 0xb1e7f, + 0xb1e81, 0xb1e83, 0xb1e85, 0xb1e87, 0xb1e89, 0xb1e8b, 0xb1e8d, 0xb1e8f, 0xb1e91, + 0xb1e93, 0xb1e9f, 0xb1ea1, 0xb1ea3, 0xb1ea5, 0xb1ea7, 0xb1ea9, 0xb1eab, 0xb1ead, + 0xb1eaf, 0xb1eb1, 0xb1eb3, 0xb1eb5, 0xb1eb7, 0xb1eb9, 0xb1ebb, 0xb1ebd, 0xb1ebf, + 0xb1ec1, 0xb1ec3, 0xb1ec5, 0xb1ec7, 0xb1ec9, 0xb1ecb, 0xb1ecd, 0xb1ecf, 0xb1ed1, + 0xb1ed3, 0xb1ed5, 0xb1ed7, 0xb1ed9, 0xb1edb, 0xb1edd, 0xb1edf, 0xb1ee1, 0xb1ee3, + 0xb1ee5, 0xb1ee7, 0xb1ee9, 0xb1eeb, 0xb1eed, 0xb1eef, 0xb1ef1, 0xb1ef3, 0xb1ef5, + 0xb1ef7, 0xb1ef9, 0xb1efb, 0xb1efd, 0xb1fb6, 0xb1fb7, 0xb1fbe, 0xb1fc6, 0xb1fc7, + 0xb1fd6, 0xb1fd7, 0xb1ff6, 0xb1ff7, 0xb210a, 0xb210e, 0xb210f, 0xb2113, 0xb212f, + 0xb2134, 0xb2139, 0xb213c, 0xb213d, 0xb214e, 0xb2184, 0xb2c61, 0xb2c65, 0xb2c66, + 0xb2c68, 0xb2c6a, 0xb2c6c, 0xb2c71, 0xb2c73, 0xb2c74, 0xb2c81, 0xb2c83, 0xb2c85, + 0xb2c87, 0xb2c89, 0xb2c8b, 0xb2c8d, 0xb2c8f, 0xb2c91, 0xb2c93, 0xb2c95, 0xb2c97, + 0xb2c99, 0xb2c9b, 0xb2c9d, 0xb2c9f, 0xb2ca1, 0xb2ca3, 0xb2ca5, 0xb2ca7, 0xb2ca9, + 0xb2cab, 0xb2cad, 0xb2caf, 0xb2cb1, 0xb2cb3, 0xb2cb5, 0xb2cb7, 0xb2cb9, 0xb2cbb, + 0xb2cbd, 0xb2cbf, 0xb2cc1, 0xb2cc3, 0xb2cc5, 0xb2cc7, 0xb2cc9, 0xb2ccb, 0xb2ccd, + 0xb2ccf, 0xb2cd1, 0xb2cd3, 0xb2cd5, 0xb2cd7, 0xb2cd9, 0xb2cdb, 0xb2cdd, 0xb2cdf, + 0xb2ce1, 0xb2ce3, 0xb2ce4, 0xb2cec, 0xb2cee, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xba641, + 0xba643, 0xba645, 0xba647, 0xba649, 0xba64b, 0xba64d, 0xba64f, 0xba651, 0xba653, + 0xba655, 0xba657, 0xba659, 0xba65b, 0xba65d, 0xba65f, 0xba661, 0xba663, 0xba665, + 0xba667, 0xba669, 0xba66b, 0xba66d, 0xba681, 0xba683, 0xba685, 0xba687, 0xba689, + 0xba68b, 0xba68d, 0xba68f, 0xba691, 0xba693, 0xba695, 0xba697, 0xba699, 0xba69b, + 0xba723, 0xba725, 0xba727, 0xba729, 0xba72b, 0xba72d, 0xba733, 0xba735, 0xba737, + 0xba739, 0xba73b, 0xba73d, 0xba73f, 0xba741, 0xba743, 0xba745, 0xba747, 0xba749, + 0xba74b, 0xba74d, 0xba74f, 0xba751, 0xba753, 0xba755, 0xba757, 0xba759, 0xba75b, + 0xba75d, 0xba75f, 0xba761, 0xba763, 0xba765, 0xba767, 0xba769, 0xba76b, 0xba76d, + 0xba76f, 0xba77a, 0xba77c, 0xba77f, 0xba781, 0xba783, 0xba785, 0xba787, 0xba78c, + 0xba78e, 0xba791, 0xba797, 0xba799, 0xba79b, 0xba79d, 0xba79f, 0xba7a1, 0xba7a3, + 0xba7a5, 0xba7a7, 0xba7a9, 0xba7b5, 0xba7b7, 0xba7fa, 0xc00b5, 0xc0101, 0xc0103, + 0xc0105, 0xc0107, 0xc0109, 0xc010b, 0xc010d, 0xc010f, 0xc0111, 0xc0113, 0xc0115, + 0xc0117, 0xc0119, 0xc011b, 0xc011d, 0xc011f, 0xc0121, 0xc0123, 0xc0125, 0xc0127, + 0xc0129, 0xc012b, 0xc012d, 0xc012f, 0xc0131, 0xc0133, 0xc0135, 0xc0137, 0xc0138, + 0xc013a, 0xc013c, 0xc013e, 0xc0140, 0xc0142, 0xc0144, 0xc0146, 0xc0148, 0xc0149, + 0xc014b, 0xc014d, 0xc014f, 0xc0151, 0xc0153, 0xc0155, 0xc0157, 0xc0159, 0xc015b, + 0xc015d, 0xc015f, 0xc0161, 0xc0163, 0xc0165, 0xc0167, 0xc0169, 0xc016b, 0xc016d, + 0xc016f, 0xc0171, 0xc0173, 0xc0175, 0xc0177, 0xc017a, 0xc017c, 0xc0183, 0xc0185, + 0xc0188, 0xc018c, 0xc018d, 0xc0192, 0xc0195, 0xc019e, 0xc01a1, 0xc01a3, 0xc01a5, + 0xc01a8, 0xc01aa, 0xc01ab, 0xc01ad, 0xc01b0, 0xc01b4, 0xc01b6, 0xc01b9, 0xc01ba, + 0xc01c6, 0xc01c9, 0xc01cc, 0xc01ce, 0xc01d0, 0xc01d2, 0xc01d4, 0xc01d6, 0xc01d8, + 0xc01da, 0xc01dc, 0xc01dd, 0xc01df, 0xc01e1, 0xc01e3, 0xc01e5, 0xc01e7, 0xc01e9, + 0xc01eb, 0xc01ed, 0xc01ef, 0xc01f0, 0xc01f3, 0xc01f5, 0xc01f9, 0xc01fb, 0xc01fd, + 0xc01ff, 0xc0201, 0xc0203, 0xc0205, 0xc0207, 0xc0209, 0xc020b, 0xc020d, 0xc020f, + 0xc0211, 0xc0213, 0xc0215, 0xc0217, 0xc0219, 0xc021b, 0xc021d, 0xc021f, 0xc0221, + 0xc0223, 0xc0225, 0xc0227, 0xc0229, 0xc022b, 0xc022d, 0xc022f, 0xc0231, 0xc023c, + 0xc023f, 0xc0240, 0xc0242, 0xc0247, 0xc0249, 0xc024b, 0xc024d, 0xc0371, 0xc0373, + 0xc0377, 0xc0390, 0xc03d0, 0xc03d1, 0xc03d9, 0xc03db, 0xc03dd, 0xc03df, 0xc03e1, + 0xc03e3, 0xc03e5, 0xc03e7, 0xc03e9, 0xc03eb, 0xc03ed, 0xc03f5, 0xc03f8, 0xc03fb, + 0xc03fc, 0xc0461, 0xc0463, 0xc0465, 0xc0467, 0xc0469, 0xc046b, 0xc046d, 0xc046f, + 0xc0471, 0xc0473, 0xc0475, 0xc0477, 0xc0479, 0xc047b, 0xc047d, 0xc047f, 0xc0481, + 0xc048b, 0xc048d, 0xc048f, 0xc0491, 0xc0493, 0xc0495, 0xc0497, 0xc0499, 0xc049b, + 0xc049d, 0xc049f, 0xc04a1, 0xc04a3, 0xc04a5, 0xc04a7, 0xc04a9, 0xc04ab, 0xc04ad, + 0xc04af, 0xc04b1, 0xc04b3, 0xc04b5, 0xc04b7, 0xc04b9, 0xc04bb, 0xc04bd, 0xc04bf, + 0xc04c2, 0xc04c4, 0xc04c6, 0xc04c8, 0xc04ca, 0xc04cc, 0xc04ce, 0xc04cf, 0xc04d1, + 0xc04d3, 0xc04d5, 0xc04d7, 0xc04d9, 0xc04db, 0xc04dd, 0xc04df, 0xc04e1, 0xc04e3, + 0xc04e5, 0xc04e7, 0xc04e9, 0xc04eb, 0xc04ed, 0xc04ef, 0xc04f1, 0xc04f3, 0xc04f5, + 0xc04f7, 0xc04f9, 0xc04fb, 0xc04fd, 0xc04ff, 0xc0501, 0xc0503, 0xc0505, 0xc0507, + 0xc0509, 0xc050b, 0xc050d, 0xc050f, 0xc0511, 0xc0513, 0xc0515, 0xc0517, 0xc0519, + 0xc051b, 0xc051d, 0xc051f, 0xc0521, 0xc0523, 0xc0525, 0xc0527, 0xc0529, 0xc052b, + 0xc052d, 0xc052f, 0xc1e01, 0xc1e03, 0xc1e05, 0xc1e07, 0xc1e09, 0xc1e0b, 0xc1e0d, + 0xc1e0f, 0xc1e11, 0xc1e13, 0xc1e15, 0xc1e17, 0xc1e19, 0xc1e1b, 0xc1e1d, 0xc1e1f, + 0xc1e21, 0xc1e23, 0xc1e25, 0xc1e27, 0xc1e29, 0xc1e2b, 0xc1e2d, 0xc1e2f, 0xc1e31, + 0xc1e33, 0xc1e35, 0xc1e37, 0xc1e39, 0xc1e3b, 0xc1e3d, 0xc1e3f, 0xc1e41, 0xc1e43, + 0xc1e45, 0xc1e47, 0xc1e49, 0xc1e4b, 0xc1e4d, 0xc1e4f, 0xc1e51, 0xc1e53, 0xc1e55, + 0xc1e57, 0xc1e59, 0xc1e5b, 0xc1e5d, 0xc1e5f, 0xc1e61, 0xc1e63, 0xc1e65, 0xc1e67, + 0xc1e69, 0xc1e6b, 0xc1e6d, 0xc1e6f, 0xc1e71, 0xc1e73, 0xc1e75, 0xc1e77, 0xc1e79, + 0xc1e7b, 0xc1e7d, 0xc1e7f, 0xc1e81, 0xc1e83, 0xc1e85, 0xc1e87, 0xc1e89, 0xc1e8b, + 0xc1e8d, 0xc1e8f, 0xc1e91, 0xc1e93, 0xc1e9f, 0xc1ea1, 0xc1ea3, 0xc1ea5, 0xc1ea7, + 0xc1ea9, 0xc1eab, 0xc1ead, 0xc1eaf, 0xc1eb1, 0xc1eb3, 0xc1eb5, 0xc1eb7, 0xc1eb9, + 0xc1ebb, 0xc1ebd, 0xc1ebf, 0xc1ec1, 0xc1ec3, 0xc1ec5, 0xc1ec7, 0xc1ec9, 0xc1ecb, + 0xc1ecd, 0xc1ecf, 0xc1ed1, 0xc1ed3, 0xc1ed5, 0xc1ed7, 0xc1ed9, 0xc1edb, 0xc1edd, + 0xc1edf, 0xc1ee1, 0xc1ee3, 0xc1ee5, 0xc1ee7, 0xc1ee9, 0xc1eeb, 0xc1eed, 0xc1eef, + 0xc1ef1, 0xc1ef3, 0xc1ef5, 0xc1ef7, 0xc1ef9, 0xc1efb, 0xc1efd, 0xc1fb6, 0xc1fb7, + 0xc1fbe, 0xc1fc6, 0xc1fc7, 0xc1fd6, 0xc1fd7, 0xc1ff6, 0xc1ff7, 0xc210a, 0xc210e, + 0xc210f, 0xc2113, 0xc212f, 0xc2134, 0xc2139, 0xc213c, 0xc213d, 0xc214e, 0xc2184, + 0xc2c61, 0xc2c65, 0xc2c66, 0xc2c68, 0xc2c6a, 0xc2c6c, 0xc2c71, 0xc2c73, 0xc2c74, + 0xc2c81, 0xc2c83, 0xc2c85, 0xc2c87, 0xc2c89, 0xc2c8b, 0xc2c8d, 0xc2c8f, 0xc2c91, + 0xc2c93, 0xc2c95, 0xc2c97, 0xc2c99, 0xc2c9b, 0xc2c9d, 0xc2c9f, 0xc2ca1, 0xc2ca3, + 0xc2ca5, 0xc2ca7, 0xc2ca9, 0xc2cab, 0xc2cad, 0xc2caf, 0xc2cb1, 0xc2cb3, 0xc2cb5, + 0xc2cb7, 0xc2cb9, 0xc2cbb, 0xc2cbd, 0xc2cbf, 0xc2cc1, 0xc2cc3, 0xc2cc5, 0xc2cc7, + 0xc2cc9, 0xc2ccb, 0xc2ccd, 0xc2ccf, 0xc2cd1, 0xc2cd3, 0xc2cd5, 0xc2cd7, 0xc2cd9, + 0xc2cdb, 0xc2cdd, 0xc2cdf, 0xc2ce1, 0xc2ce3, 0xc2ce4, 0xc2cec, 0xc2cee, 0xc2cf3, + 0xc2d27, 0xc2d2d, 0xca641, 0xca643, 0xca645, 0xca647, 0xca649, 0xca64b, 0xca64d, + 0xca64f, 0xca651, 0xca653, 0xca655, 0xca657, 0xca659, 0xca65b, 0xca65d, 0xca65f, + 0xca661, 0xca663, 0xca665, 0xca667, 0xca669, 0xca66b, 0xca66d, 0xca681, 0xca683, + 0xca685, 0xca687, 0xca689, 0xca68b, 0xca68d, 0xca68f, 0xca691, 0xca693, 0xca695, + 0xca697, 0xca699, 0xca69b, 0xca723, 0xca725, 0xca727, 0xca729, 0xca72b, 0xca72d, + 0xca733, 0xca735, 0xca737, 0xca739, 0xca73b, 0xca73d, 0xca73f, 0xca741, 0xca743, + 0xca745, 0xca747, 0xca749, 0xca74b, 0xca74d, 0xca74f, 0xca751, 0xca753, 0xca755, + 0xca757, 0xca759, 0xca75b, 0xca75d, 0xca75f, 0xca761, 0xca763, 0xca765, 0xca767, + 0xca769, 0xca76b, 0xca76d, 0xca76f, 0xca77a, 0xca77c, 0xca77f, 0xca781, 0xca783, + 0xca785, 0xca787, 0xca78c, 0xca78e, 0xca791, 0xca797, 0xca799, 0xca79b, 0xca79d, + 0xca79f, 0xca7a1, 0xca7a3, 0xca7a5, 0xca7a7, 0xca7a9, 0xca7b5, 0xca7b7, 0xca7fa, + 0xd00b5, 0xd0101, 0xd0103, 0xd0105, 0xd0107, 0xd0109, 0xd010b, 0xd010d, 0xd010f, + 0xd0111, 0xd0113, 0xd0115, 0xd0117, 0xd0119, 0xd011b, 0xd011d, 0xd011f, 0xd0121, + 0xd0123, 0xd0125, 0xd0127, 0xd0129, 0xd012b, 0xd012d, 0xd012f, 0xd0131, 0xd0133, + 0xd0135, 0xd0137, 0xd0138, 0xd013a, 0xd013c, 0xd013e, 0xd0140, 0xd0142, 0xd0144, + 0xd0146, 0xd0148, 0xd0149, 0xd014b, 0xd014d, 0xd014f, 0xd0151, 0xd0153, 0xd0155, + 0xd0157, 0xd0159, 0xd015b, 0xd015d, 0xd015f, 0xd0161, 0xd0163, 0xd0165, 0xd0167, + 0xd0169, 0xd016b, 0xd016d, 0xd016f, 0xd0171, 0xd0173, 0xd0175, 0xd0177, 0xd017a, + 0xd017c, 0xd0183, 0xd0185, 0xd0188, 0xd018c, 0xd018d, 0xd0192, 0xd0195, 0xd019e, + 0xd01a1, 0xd01a3, 0xd01a5, 0xd01a8, 0xd01aa, 0xd01ab, 0xd01ad, 0xd01b0, 0xd01b4, + 0xd01b6, 0xd01b9, 0xd01ba, 0xd01c6, 0xd01c9, 0xd01cc, 0xd01ce, 0xd01d0, 0xd01d2, + 0xd01d4, 0xd01d6, 0xd01d8, 0xd01da, 0xd01dc, 0xd01dd, 0xd01df, 0xd01e1, 0xd01e3, + 0xd01e5, 0xd01e7, 0xd01e9, 0xd01eb, 0xd01ed, 0xd01ef, 0xd01f0, 0xd01f3, 0xd01f5, + 0xd01f9, 0xd01fb, 0xd01fd, 0xd01ff, 0xd0201, 0xd0203, 0xd0205, 0xd0207, 0xd0209, + 0xd020b, 0xd020d, 0xd020f, 0xd0211, 0xd0213, 0xd0215, 0xd0217, 0xd0219, 0xd021b, + 0xd021d, 0xd021f, 0xd0221, 0xd0223, 0xd0225, 0xd0227, 0xd0229, 0xd022b, 0xd022d, + 0xd022f, 0xd0231, 0xd023c, 0xd023f, 0xd0240, 0xd0242, 0xd0247, 0xd0249, 0xd024b, + 0xd024d, 0xd0371, 0xd0373, 0xd0377, 0xd0390, 0xd03d0, 0xd03d1, 0xd03d9, 0xd03db, + 0xd03dd, 0xd03df, 0xd03e1, 0xd03e3, 0xd03e5, 0xd03e7, 0xd03e9, 0xd03eb, 0xd03ed, + 0xd03f5, 0xd03f8, 0xd03fb, 0xd03fc, 0xd0461, 0xd0463, 0xd0465, 0xd0467, 0xd0469, + 0xd046b, 0xd046d, 0xd046f, 0xd0471, 0xd0473, 0xd0475, 0xd0477, 0xd0479, 0xd047b, + 0xd047d, 0xd047f, 0xd0481, 0xd048b, 0xd048d, 0xd048f, 0xd0491, 0xd0493, 0xd0495, + 0xd0497, 0xd0499, 0xd049b, 0xd049d, 0xd049f, 0xd04a1, 0xd04a3, 0xd04a5, 0xd04a7, + 0xd04a9, 0xd04ab, 0xd04ad, 0xd04af, 0xd04b1, 0xd04b3, 0xd04b5, 0xd04b7, 0xd04b9, + 0xd04bb, 0xd04bd, 0xd04bf, 0xd04c2, 0xd04c4, 0xd04c6, 0xd04c8, 0xd04ca, 0xd04cc, + 0xd04ce, 0xd04cf, 0xd04d1, 0xd04d3, 0xd04d5, 0xd04d7, 0xd04d9, 0xd04db, 0xd04dd, + 0xd04df, 0xd04e1, 0xd04e3, 0xd04e5, 0xd04e7, 0xd04e9, 0xd04eb, 0xd04ed, 0xd04ef, + 0xd04f1, 0xd04f3, 0xd04f5, 0xd04f7, 0xd04f9, 0xd04fb, 0xd04fd, 0xd04ff, 0xd0501, + 0xd0503, 0xd0505, 0xd0507, 0xd0509, 0xd050b, 0xd050d, 0xd050f, 0xd0511, 0xd0513, + 0xd0515, 0xd0517, 0xd0519, 0xd051b, 0xd051d, 0xd051f, 0xd0521, 0xd0523, 0xd0525, + 0xd0527, 0xd0529, 0xd052b, 0xd052d, 0xd052f, 0xd1e01, 0xd1e03, 0xd1e05, 0xd1e07, + 0xd1e09, 0xd1e0b, 0xd1e0d, 0xd1e0f, 0xd1e11, 0xd1e13, 0xd1e15, 0xd1e17, 0xd1e19, + 0xd1e1b, 0xd1e1d, 0xd1e1f, 0xd1e21, 0xd1e23, 0xd1e25, 0xd1e27, 0xd1e29, 0xd1e2b, + 0xd1e2d, 0xd1e2f, 0xd1e31, 0xd1e33, 0xd1e35, 0xd1e37, 0xd1e39, 0xd1e3b, 0xd1e3d, + 0xd1e3f, 0xd1e41, 0xd1e43, 0xd1e45, 0xd1e47, 0xd1e49, 0xd1e4b, 0xd1e4d, 0xd1e4f, + 0xd1e51, 0xd1e53, 0xd1e55, 0xd1e57, 0xd1e59, 0xd1e5b, 0xd1e5d, 0xd1e5f, 0xd1e61, + 0xd1e63, 0xd1e65, 0xd1e67, 0xd1e69, 0xd1e6b, 0xd1e6d, 0xd1e6f, 0xd1e71, 0xd1e73, + 0xd1e75, 0xd1e77, 0xd1e79, 0xd1e7b, 0xd1e7d, 0xd1e7f, 0xd1e81, 0xd1e83, 0xd1e85, + 0xd1e87, 0xd1e89, 0xd1e8b, 0xd1e8d, 0xd1e8f, 0xd1e91, 0xd1e93, 0xd1e9f, 0xd1ea1, + 0xd1ea3, 0xd1ea5, 0xd1ea7, 0xd1ea9, 0xd1eab, 0xd1ead, 0xd1eaf, 0xd1eb1, 0xd1eb3, + 0xd1eb5, 0xd1eb7, 0xd1eb9, 0xd1ebb, 0xd1ebd, 0xd1ebf, 0xd1ec1, 0xd1ec3, 0xd1ec5, + 0xd1ec7, 0xd1ec9, 0xd1ecb, 0xd1ecd, 0xd1ecf, 0xd1ed1, 0xd1ed3, 0xd1ed5, 0xd1ed7, + 0xd1ed9, 0xd1edb, 0xd1edd, 0xd1edf, 0xd1ee1, 0xd1ee3, 0xd1ee5, 0xd1ee7, 0xd1ee9, + 0xd1eeb, 0xd1eed, 0xd1eef, 0xd1ef1, 0xd1ef3, 0xd1ef5, 0xd1ef7, 0xd1ef9, 0xd1efb, + 0xd1efd, 0xd1fb6, 0xd1fb7, 0xd1fbe, 0xd1fc6, 0xd1fc7, 0xd1fd6, 0xd1fd7, 0xd1ff6, + 0xd1ff7, 0xd210a, 0xd210e, 0xd210f, 0xd2113, 0xd212f, 0xd2134, 0xd2139, 0xd213c, + 0xd213d, 0xd214e, 0xd2184, 0xd2c61, 0xd2c65, 0xd2c66, 0xd2c68, 0xd2c6a, 0xd2c6c, + 0xd2c71, 0xd2c73, 0xd2c74, 0xd2c81, 0xd2c83, 0xd2c85, 0xd2c87, 0xd2c89, 0xd2c8b, + 0xd2c8d, 0xd2c8f, 0xd2c91, 0xd2c93, 0xd2c95, 0xd2c97, 0xd2c99, 0xd2c9b, 0xd2c9d, + 0xd2c9f, 0xd2ca1, 0xd2ca3, 0xd2ca5, 0xd2ca7, 0xd2ca9, 0xd2cab, 0xd2cad, 0xd2caf, + 0xd2cb1, 0xd2cb3, 0xd2cb5, 0xd2cb7, 0xd2cb9, 0xd2cbb, 0xd2cbd, 0xd2cbf, 0xd2cc1, + 0xd2cc3, 0xd2cc5, 0xd2cc7, 0xd2cc9, 0xd2ccb, 0xd2ccd, 0xd2ccf, 0xd2cd1, 0xd2cd3, + 0xd2cd5, 0xd2cd7, 0xd2cd9, 0xd2cdb, 0xd2cdd, 0xd2cdf, 0xd2ce1, 0xd2ce3, 0xd2ce4, + 0xd2cec, 0xd2cee, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xda641, 0xda643, 0xda645, 0xda647, + 0xda649, 0xda64b, 0xda64d, 0xda64f, 0xda651, 0xda653, 0xda655, 0xda657, 0xda659, + 0xda65b, 0xda65d, 0xda65f, 0xda661, 0xda663, 0xda665, 0xda667, 0xda669, 0xda66b, + 0xda66d, 0xda681, 0xda683, 0xda685, 0xda687, 0xda689, 0xda68b, 0xda68d, 0xda68f, + 0xda691, 0xda693, 0xda695, 0xda697, 0xda699, 0xda69b, 0xda723, 0xda725, 0xda727, + 0xda729, 0xda72b, 0xda72d, 0xda733, 0xda735, 0xda737, 0xda739, 0xda73b, 0xda73d, + 0xda73f, 0xda741, 0xda743, 0xda745, 0xda747, 0xda749, 0xda74b, 0xda74d, 0xda74f, + 0xda751, 0xda753, 0xda755, 0xda757, 0xda759, 0xda75b, 0xda75d, 0xda75f, 0xda761, + 0xda763, 0xda765, 0xda767, 0xda769, 0xda76b, 0xda76d, 0xda76f, 0xda77a, 0xda77c, + 0xda77f, 0xda781, 0xda783, 0xda785, 0xda787, 0xda78c, 0xda78e, 0xda791, 0xda797, + 0xda799, 0xda79b, 0xda79d, 0xda79f, 0xda7a1, 0xda7a3, 0xda7a5, 0xda7a7, 0xda7a9, + 0xda7b5, 0xda7b7, 0xda7fa, 0xe00b5, 0xe0101, 0xe0103, 0xe0105, 0xe0107, 0xe0109, + 0xe010b, 0xe010d, 0xe010f, 0xe0111, 0xe0113, 0xe0115, 0xe0117, 0xe0119, 0xe011b, + 0xe011d, 0xe011f, 0xe0121, 0xe0123, 0xe0125, 0xe0127, 0xe0129, 0xe012b, 0xe012d, + 0xe012f, 0xe0131, 0xe0133, 0xe0135, 0xe0137, 0xe0138, 0xe013a, 0xe013c, 0xe013e, + 0xe0140, 0xe0142, 0xe0144, 0xe0146, 0xe0148, 0xe0149, 0xe014b, 0xe014d, 0xe014f, + 0xe0151, 0xe0153, 0xe0155, 0xe0157, 0xe0159, 0xe015b, 0xe015d, 0xe015f, 0xe0161, + 0xe0163, 0xe0165, 0xe0167, 0xe0169, 0xe016b, 0xe016d, 0xe016f, 0xe0171, 0xe0173, + 0xe0175, 0xe0177, 0xe017a, 0xe017c, 0xe0183, 0xe0185, 0xe0188, 0xe018c, 0xe018d, + 0xe0192, 0xe0195, 0xe019e, 0xe01a1, 0xe01a3, 0xe01a5, 0xe01a8, 0xe01aa, 0xe01ab, + 0xe01ad, 0xe01b0, 0xe01b4, 0xe01b6, 0xe01b9, 0xe01ba, 0xe01c6, 0xe01c9, 0xe01cc, + 0xe01ce, 0xe01d0, 0xe01d2, 0xe01d4, 0xe01d6, 0xe01d8, 0xe01da, 0xe01dc, 0xe01dd, + 0xe01df, 0xe01e1, 0xe01e3, 0xe01e5, 0xe01e7, 0xe01e9, 0xe01eb, 0xe01ed, 0xe01ef, + 0xe01f0, 0xe01f3, 0xe01f5, 0xe01f9, 0xe01fb, 0xe01fd, 0xe01ff, 0xe0201, 0xe0203, + 0xe0205, 0xe0207, 0xe0209, 0xe020b, 0xe020d, 0xe020f, 0xe0211, 0xe0213, 0xe0215, + 0xe0217, 0xe0219, 0xe021b, 0xe021d, 0xe021f, 0xe0221, 0xe0223, 0xe0225, 0xe0227, + 0xe0229, 0xe022b, 0xe022d, 0xe022f, 0xe0231, 0xe023c, 0xe023f, 0xe0240, 0xe0242, + 0xe0247, 0xe0249, 0xe024b, 0xe024d, 0xe0371, 0xe0373, 0xe0377, 0xe0390, 0xe03d0, + 0xe03d1, 0xe03d9, 0xe03db, 0xe03dd, 0xe03df, 0xe03e1, 0xe03e3, 0xe03e5, 0xe03e7, + 0xe03e9, 0xe03eb, 0xe03ed, 0xe03f5, 0xe03f8, 0xe03fb, 0xe03fc, 0xe0461, 0xe0463, + 0xe0465, 0xe0467, 0xe0469, 0xe046b, 0xe046d, 0xe046f, 0xe0471, 0xe0473, 0xe0475, + 0xe0477, 0xe0479, 0xe047b, 0xe047d, 0xe047f, 0xe0481, 0xe048b, 0xe048d, 0xe048f, + 0xe0491, 0xe0493, 0xe0495, 0xe0497, 0xe0499, 0xe049b, 0xe049d, 0xe049f, 0xe04a1, + 0xe04a3, 0xe04a5, 0xe04a7, 0xe04a9, 0xe04ab, 0xe04ad, 0xe04af, 0xe04b1, 0xe04b3, + 0xe04b5, 0xe04b7, 0xe04b9, 0xe04bb, 0xe04bd, 0xe04bf, 0xe04c2, 0xe04c4, 0xe04c6, + 0xe04c8, 0xe04ca, 0xe04cc, 0xe04ce, 0xe04cf, 0xe04d1, 0xe04d3, 0xe04d5, 0xe04d7, + 0xe04d9, 0xe04db, 0xe04dd, 0xe04df, 0xe04e1, 0xe04e3, 0xe04e5, 0xe04e7, 0xe04e9, + 0xe04eb, 0xe04ed, 0xe04ef, 0xe04f1, 0xe04f3, 0xe04f5, 0xe04f7, 0xe04f9, 0xe04fb, + 0xe04fd, 0xe04ff, 0xe0501, 0xe0503, 0xe0505, 0xe0507, 0xe0509, 0xe050b, 0xe050d, + 0xe050f, 0xe0511, 0xe0513, 0xe0515, 0xe0517, 0xe0519, 0xe051b, 0xe051d, 0xe051f, + 0xe0521, 0xe0523, 0xe0525, 0xe0527, 0xe0529, 0xe052b, 0xe052d, 0xe052f, 0xe1e01, + 0xe1e03, 0xe1e05, 0xe1e07, 0xe1e09, 0xe1e0b, 0xe1e0d, 0xe1e0f, 0xe1e11, 0xe1e13, + 0xe1e15, 0xe1e17, 0xe1e19, 0xe1e1b, 0xe1e1d, 0xe1e1f, 0xe1e21, 0xe1e23, 0xe1e25, + 0xe1e27, 0xe1e29, 0xe1e2b, 0xe1e2d, 0xe1e2f, 0xe1e31, 0xe1e33, 0xe1e35, 0xe1e37, + 0xe1e39, 0xe1e3b, 0xe1e3d, 0xe1e3f, 0xe1e41, 0xe1e43, 0xe1e45, 0xe1e47, 0xe1e49, + 0xe1e4b, 0xe1e4d, 0xe1e4f, 0xe1e51, 0xe1e53, 0xe1e55, 0xe1e57, 0xe1e59, 0xe1e5b, + 0xe1e5d, 0xe1e5f, 0xe1e61, 0xe1e63, 0xe1e65, 0xe1e67, 0xe1e69, 0xe1e6b, 0xe1e6d, + 0xe1e6f, 0xe1e71, 0xe1e73, 0xe1e75, 0xe1e77, 0xe1e79, 0xe1e7b, 0xe1e7d, 0xe1e7f, + 0xe1e81, 0xe1e83, 0xe1e85, 0xe1e87, 0xe1e89, 0xe1e8b, 0xe1e8d, 0xe1e8f, 0xe1e91, + 0xe1e93, 0xe1e9f, 0xe1ea1, 0xe1ea3, 0xe1ea5, 0xe1ea7, 0xe1ea9, 0xe1eab, 0xe1ead, + 0xe1eaf, 0xe1eb1, 0xe1eb3, 0xe1eb5, 0xe1eb7, 0xe1eb9, 0xe1ebb, 0xe1ebd, 0xe1ebf, + 0xe1ec1, 0xe1ec3, 0xe1ec5, 0xe1ec7, 0xe1ec9, 0xe1ecb, 0xe1ecd, 0xe1ecf, 0xe1ed1, + 0xe1ed3, 0xe1ed5, 0xe1ed7, 0xe1ed9, 0xe1edb, 0xe1edd, 0xe1edf, 0xe1ee1, 0xe1ee3, + 0xe1ee5, 0xe1ee7, 0xe1ee9, 0xe1eeb, 0xe1eed, 0xe1eef, 0xe1ef1, 0xe1ef3, 0xe1ef5, + 0xe1ef7, 0xe1ef9, 0xe1efb, 0xe1efd, 0xe1fb6, 0xe1fb7, 0xe1fbe, 0xe1fc6, 0xe1fc7, + 0xe1fd6, 0xe1fd7, 0xe1ff6, 0xe1ff7, 0xe210a, 0xe210e, 0xe210f, 0xe2113, 0xe212f, + 0xe2134, 0xe2139, 0xe213c, 0xe213d, 0xe214e, 0xe2184, 0xe2c61, 0xe2c65, 0xe2c66, + 0xe2c68, 0xe2c6a, 0xe2c6c, 0xe2c71, 0xe2c73, 0xe2c74, 0xe2c81, 0xe2c83, 0xe2c85, + 0xe2c87, 0xe2c89, 0xe2c8b, 0xe2c8d, 0xe2c8f, 0xe2c91, 0xe2c93, 0xe2c95, 0xe2c97, + 0xe2c99, 0xe2c9b, 0xe2c9d, 0xe2c9f, 0xe2ca1, 0xe2ca3, 0xe2ca5, 0xe2ca7, 0xe2ca9, + 0xe2cab, 0xe2cad, 0xe2caf, 0xe2cb1, 0xe2cb3, 0xe2cb5, 0xe2cb7, 0xe2cb9, 0xe2cbb, + 0xe2cbd, 0xe2cbf, 0xe2cc1, 0xe2cc3, 0xe2cc5, 0xe2cc7, 0xe2cc9, 0xe2ccb, 0xe2ccd, + 0xe2ccf, 0xe2cd1, 0xe2cd3, 0xe2cd5, 0xe2cd7, 0xe2cd9, 0xe2cdb, 0xe2cdd, 0xe2cdf, + 0xe2ce1, 0xe2ce3, 0xe2ce4, 0xe2cec, 0xe2cee, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xea641, + 0xea643, 0xea645, 0xea647, 0xea649, 0xea64b, 0xea64d, 0xea64f, 0xea651, 0xea653, + 0xea655, 0xea657, 0xea659, 0xea65b, 0xea65d, 0xea65f, 0xea661, 0xea663, 0xea665, + 0xea667, 0xea669, 0xea66b, 0xea66d, 0xea681, 0xea683, 0xea685, 0xea687, 0xea689, + 0xea68b, 0xea68d, 0xea68f, 0xea691, 0xea693, 0xea695, 0xea697, 0xea699, 0xea69b, + 0xea723, 0xea725, 0xea727, 0xea729, 0xea72b, 0xea72d, 0xea733, 0xea735, 0xea737, + 0xea739, 0xea73b, 0xea73d, 0xea73f, 0xea741, 0xea743, 0xea745, 0xea747, 0xea749, + 0xea74b, 0xea74d, 0xea74f, 0xea751, 0xea753, 0xea755, 0xea757, 0xea759, 0xea75b, + 0xea75d, 0xea75f, 0xea761, 0xea763, 0xea765, 0xea767, 0xea769, 0xea76b, 0xea76d, + 0xea76f, 0xea77a, 0xea77c, 0xea77f, 0xea781, 0xea783, 0xea785, 0xea787, 0xea78c, + 0xea78e, 0xea791, 0xea797, 0xea799, 0xea79b, 0xea79d, 0xea79f, 0xea7a1, 0xea7a3, + 0xea7a5, 0xea7a7, 0xea7a9, 0xea7b5, 0xea7b7, 0xea7fa, 0xf00b5, 0xf0101, 0xf0103, + 0xf0105, 0xf0107, 0xf0109, 0xf010b, 0xf010d, 0xf010f, 0xf0111, 0xf0113, 0xf0115, + 0xf0117, 0xf0119, 0xf011b, 0xf011d, 0xf011f, 0xf0121, 0xf0123, 0xf0125, 0xf0127, + 0xf0129, 0xf012b, 0xf012d, 0xf012f, 0xf0131, 0xf0133, 0xf0135, 0xf0137, 0xf0138, + 0xf013a, 0xf013c, 0xf013e, 0xf0140, 0xf0142, 0xf0144, 0xf0146, 0xf0148, 0xf0149, + 0xf014b, 0xf014d, 0xf014f, 0xf0151, 0xf0153, 0xf0155, 0xf0157, 0xf0159, 0xf015b, + 0xf015d, 0xf015f, 0xf0161, 0xf0163, 0xf0165, 0xf0167, 0xf0169, 0xf016b, 0xf016d, + 0xf016f, 0xf0171, 0xf0173, 0xf0175, 0xf0177, 0xf017a, 0xf017c, 0xf0183, 0xf0185, + 0xf0188, 0xf018c, 0xf018d, 0xf0192, 0xf0195, 0xf019e, 0xf01a1, 0xf01a3, 0xf01a5, + 0xf01a8, 0xf01aa, 0xf01ab, 0xf01ad, 0xf01b0, 0xf01b4, 0xf01b6, 0xf01b9, 0xf01ba, + 0xf01c6, 0xf01c9, 0xf01cc, 0xf01ce, 0xf01d0, 0xf01d2, 0xf01d4, 0xf01d6, 0xf01d8, + 0xf01da, 0xf01dc, 0xf01dd, 0xf01df, 0xf01e1, 0xf01e3, 0xf01e5, 0xf01e7, 0xf01e9, + 0xf01eb, 0xf01ed, 0xf01ef, 0xf01f0, 0xf01f3, 0xf01f5, 0xf01f9, 0xf01fb, 0xf01fd, + 0xf01ff, 0xf0201, 0xf0203, 0xf0205, 0xf0207, 0xf0209, 0xf020b, 0xf020d, 0xf020f, + 0xf0211, 0xf0213, 0xf0215, 0xf0217, 0xf0219, 0xf021b, 0xf021d, 0xf021f, 0xf0221, + 0xf0223, 0xf0225, 0xf0227, 0xf0229, 0xf022b, 0xf022d, 0xf022f, 0xf0231, 0xf023c, + 0xf023f, 0xf0240, 0xf0242, 0xf0247, 0xf0249, 0xf024b, 0xf024d, 0xf0371, 0xf0373, + 0xf0377, 0xf0390, 0xf03d0, 0xf03d1, 0xf03d9, 0xf03db, 0xf03dd, 0xf03df, 0xf03e1, + 0xf03e3, 0xf03e5, 0xf03e7, 0xf03e9, 0xf03eb, 0xf03ed, 0xf03f5, 0xf03f8, 0xf03fb, + 0xf03fc, 0xf0461, 0xf0463, 0xf0465, 0xf0467, 0xf0469, 0xf046b, 0xf046d, 0xf046f, + 0xf0471, 0xf0473, 0xf0475, 0xf0477, 0xf0479, 0xf047b, 0xf047d, 0xf047f, 0xf0481, + 0xf048b, 0xf048d, 0xf048f, 0xf0491, 0xf0493, 0xf0495, 0xf0497, 0xf0499, 0xf049b, + 0xf049d, 0xf049f, 0xf04a1, 0xf04a3, 0xf04a5, 0xf04a7, 0xf04a9, 0xf04ab, 0xf04ad, + 0xf04af, 0xf04b1, 0xf04b3, 0xf04b5, 0xf04b7, 0xf04b9, 0xf04bb, 0xf04bd, 0xf04bf, + 0xf04c2, 0xf04c4, 0xf04c6, 0xf04c8, 0xf04ca, 0xf04cc, 0xf04ce, 0xf04cf, 0xf04d1, + 0xf04d3, 0xf04d5, 0xf04d7, 0xf04d9, 0xf04db, 0xf04dd, 0xf04df, 0xf04e1, 0xf04e3, + 0xf04e5, 0xf04e7, 0xf04e9, 0xf04eb, 0xf04ed, 0xf04ef, 0xf04f1, 0xf04f3, 0xf04f5, + 0xf04f7, 0xf04f9, 0xf04fb, 0xf04fd, 0xf04ff, 0xf0501, 0xf0503, 0xf0505, 0xf0507, + 0xf0509, 0xf050b, 0xf050d, 0xf050f, 0xf0511, 0xf0513, 0xf0515, 0xf0517, 0xf0519, + 0xf051b, 0xf051d, 0xf051f, 0xf0521, 0xf0523, 0xf0525, 0xf0527, 0xf0529, 0xf052b, + 0xf052d, 0xf052f, 0xf1e01, 0xf1e03, 0xf1e05, 0xf1e07, 0xf1e09, 0xf1e0b, 0xf1e0d, + 0xf1e0f, 0xf1e11, 0xf1e13, 0xf1e15, 0xf1e17, 0xf1e19, 0xf1e1b, 0xf1e1d, 0xf1e1f, + 0xf1e21, 0xf1e23, 0xf1e25, 0xf1e27, 0xf1e29, 0xf1e2b, 0xf1e2d, 0xf1e2f, 0xf1e31, + 0xf1e33, 0xf1e35, 0xf1e37, 0xf1e39, 0xf1e3b, 0xf1e3d, 0xf1e3f, 0xf1e41, 0xf1e43, + 0xf1e45, 0xf1e47, 0xf1e49, 0xf1e4b, 0xf1e4d, 0xf1e4f, 0xf1e51, 0xf1e53, 0xf1e55, + 0xf1e57, 0xf1e59, 0xf1e5b, 0xf1e5d, 0xf1e5f, 0xf1e61, 0xf1e63, 0xf1e65, 0xf1e67, + 0xf1e69, 0xf1e6b, 0xf1e6d, 0xf1e6f, 0xf1e71, 0xf1e73, 0xf1e75, 0xf1e77, 0xf1e79, + 0xf1e7b, 0xf1e7d, 0xf1e7f, 0xf1e81, 0xf1e83, 0xf1e85, 0xf1e87, 0xf1e89, 0xf1e8b, + 0xf1e8d, 0xf1e8f, 0xf1e91, 0xf1e93, 0xf1e9f, 0xf1ea1, 0xf1ea3, 0xf1ea5, 0xf1ea7, + 0xf1ea9, 0xf1eab, 0xf1ead, 0xf1eaf, 0xf1eb1, 0xf1eb3, 0xf1eb5, 0xf1eb7, 0xf1eb9, + 0xf1ebb, 0xf1ebd, 0xf1ebf, 0xf1ec1, 0xf1ec3, 0xf1ec5, 0xf1ec7, 0xf1ec9, 0xf1ecb, + 0xf1ecd, 0xf1ecf, 0xf1ed1, 0xf1ed3, 0xf1ed5, 0xf1ed7, 0xf1ed9, 0xf1edb, 0xf1edd, + 0xf1edf, 0xf1ee1, 0xf1ee3, 0xf1ee5, 0xf1ee7, 0xf1ee9, 0xf1eeb, 0xf1eed, 0xf1eef, + 0xf1ef1, 0xf1ef3, 0xf1ef5, 0xf1ef7, 0xf1ef9, 0xf1efb, 0xf1efd, 0xf1fb6, 0xf1fb7, + 0xf1fbe, 0xf1fc6, 0xf1fc7, 0xf1fd6, 0xf1fd7, 0xf1ff6, 0xf1ff7, 0xf210a, 0xf210e, + 0xf210f, 0xf2113, 0xf212f, 0xf2134, 0xf2139, 0xf213c, 0xf213d, 0xf214e, 0xf2184, + 0xf2c61, 0xf2c65, 0xf2c66, 0xf2c68, 0xf2c6a, 0xf2c6c, 0xf2c71, 0xf2c73, 0xf2c74, + 0xf2c81, 0xf2c83, 0xf2c85, 0xf2c87, 0xf2c89, 0xf2c8b, 0xf2c8d, 0xf2c8f, 0xf2c91, + 0xf2c93, 0xf2c95, 0xf2c97, 0xf2c99, 0xf2c9b, 0xf2c9d, 0xf2c9f, 0xf2ca1, 0xf2ca3, + 0xf2ca5, 0xf2ca7, 0xf2ca9, 0xf2cab, 0xf2cad, 0xf2caf, 0xf2cb1, 0xf2cb3, 0xf2cb5, + 0xf2cb7, 0xf2cb9, 0xf2cbb, 0xf2cbd, 0xf2cbf, 0xf2cc1, 0xf2cc3, 0xf2cc5, 0xf2cc7, + 0xf2cc9, 0xf2ccb, 0xf2ccd, 0xf2ccf, 0xf2cd1, 0xf2cd3, 0xf2cd5, 0xf2cd7, 0xf2cd9, + 0xf2cdb, 0xf2cdd, 0xf2cdf, 0xf2ce1, 0xf2ce3, 0xf2ce4, 0xf2cec, 0xf2cee, 0xf2cf3, + 0xf2d27, 0xf2d2d, 0xfa641, 0xfa643, 0xfa645, 0xfa647, 0xfa649, 0xfa64b, 0xfa64d, + 0xfa64f, 0xfa651, 0xfa653, 0xfa655, 0xfa657, 0xfa659, 0xfa65b, 0xfa65d, 0xfa65f, + 0xfa661, 0xfa663, 0xfa665, 0xfa667, 0xfa669, 0xfa66b, 0xfa66d, 0xfa681, 0xfa683, + 0xfa685, 0xfa687, 0xfa689, 0xfa68b, 0xfa68d, 0xfa68f, 0xfa691, 0xfa693, 0xfa695, + 0xfa697, 0xfa699, 0xfa69b, 0xfa723, 0xfa725, 0xfa727, 0xfa729, 0xfa72b, 0xfa72d, + 0xfa733, 0xfa735, 0xfa737, 0xfa739, 0xfa73b, 0xfa73d, 0xfa73f, 0xfa741, 0xfa743, + 0xfa745, 0xfa747, 0xfa749, 0xfa74b, 0xfa74d, 0xfa74f, 0xfa751, 0xfa753, 0xfa755, + 0xfa757, 0xfa759, 0xfa75b, 0xfa75d, 0xfa75f, 0xfa761, 0xfa763, 0xfa765, 0xfa767, + 0xfa769, 0xfa76b, 0xfa76d, 0xfa76f, 0xfa77a, 0xfa77c, 0xfa77f, 0xfa781, 0xfa783, + 0xfa785, 0xfa787, 0xfa78c, 0xfa78e, 0xfa791, 0xfa797, 0xfa799, 0xfa79b, 0xfa79d, + 0xfa79f, 0xfa7a1, 0xfa7a3, 0xfa7a5, 0xfa7a7, 0xfa7a9, 0xfa7b5, 0xfa7b7, 0xfa7fa, + 0x1000b5, 0x100101, 0x100103, 0x100105, 0x100107, 0x100109, 0x10010b, 0x10010d, 0x10010f, + 0x100111, 0x100113, 0x100115, 0x100117, 0x100119, 0x10011b, 0x10011d, 0x10011f, 0x100121, + 0x100123, 0x100125, 0x100127, 0x100129, 0x10012b, 0x10012d, 0x10012f, 0x100131, 0x100133, + 0x100135, 0x100137, 0x100138, 0x10013a, 0x10013c, 0x10013e, 0x100140, 0x100142, 0x100144, + 0x100146, 0x100148, 0x100149, 0x10014b, 0x10014d, 0x10014f, 0x100151, 0x100153, 0x100155, + 0x100157, 0x100159, 0x10015b, 0x10015d, 0x10015f, 0x100161, 0x100163, 0x100165, 0x100167, + 0x100169, 0x10016b, 0x10016d, 0x10016f, 0x100171, 0x100173, 0x100175, 0x100177, 0x10017a, + 0x10017c, 0x100183, 0x100185, 0x100188, 0x10018c, 0x10018d, 0x100192, 0x100195, 0x10019e, + 0x1001a1, 0x1001a3, 0x1001a5, 0x1001a8, 0x1001aa, 0x1001ab, 0x1001ad, 0x1001b0, 0x1001b4, + 0x1001b6, 0x1001b9, 0x1001ba, 0x1001c6, 0x1001c9, 0x1001cc, 0x1001ce, 0x1001d0, 0x1001d2, + 0x1001d4, 0x1001d6, 0x1001d8, 0x1001da, 0x1001dc, 0x1001dd, 0x1001df, 0x1001e1, 0x1001e3, + 0x1001e5, 0x1001e7, 0x1001e9, 0x1001eb, 0x1001ed, 0x1001ef, 0x1001f0, 0x1001f3, 0x1001f5, + 0x1001f9, 0x1001fb, 0x1001fd, 0x1001ff, 0x100201, 0x100203, 0x100205, 0x100207, 0x100209, + 0x10020b, 0x10020d, 0x10020f, 0x100211, 0x100213, 0x100215, 0x100217, 0x100219, 0x10021b, + 0x10021d, 0x10021f, 0x100221, 0x100223, 0x100225, 0x100227, 0x100229, 0x10022b, 0x10022d, + 0x10022f, 0x100231, 0x10023c, 0x10023f, 0x100240, 0x100242, 0x100247, 0x100249, 0x10024b, + 0x10024d, 0x100371, 0x100373, 0x100377, 0x100390, 0x1003d0, 0x1003d1, 0x1003d9, 0x1003db, + 0x1003dd, 0x1003df, 0x1003e1, 0x1003e3, 0x1003e5, 0x1003e7, 0x1003e9, 0x1003eb, 0x1003ed, + 0x1003f5, 0x1003f8, 0x1003fb, 0x1003fc, 0x100461, 0x100463, 0x100465, 0x100467, 0x100469, + 0x10046b, 0x10046d, 0x10046f, 0x100471, 0x100473, 0x100475, 0x100477, 0x100479, 0x10047b, + 0x10047d, 0x10047f, 0x100481, 0x10048b, 0x10048d, 0x10048f, 0x100491, 0x100493, 0x100495, + 0x100497, 0x100499, 0x10049b, 0x10049d, 0x10049f, 0x1004a1, 0x1004a3, 0x1004a5, 0x1004a7, + 0x1004a9, 0x1004ab, 0x1004ad, 0x1004af, 0x1004b1, 0x1004b3, 0x1004b5, 0x1004b7, 0x1004b9, + 0x1004bb, 0x1004bd, 0x1004bf, 0x1004c2, 0x1004c4, 0x1004c6, 0x1004c8, 0x1004ca, 0x1004cc, + 0x1004ce, 0x1004cf, 0x1004d1, 0x1004d3, 0x1004d5, 0x1004d7, 0x1004d9, 0x1004db, 0x1004dd, + 0x1004df, 0x1004e1, 0x1004e3, 0x1004e5, 0x1004e7, 0x1004e9, 0x1004eb, 0x1004ed, 0x1004ef, + 0x1004f1, 0x1004f3, 0x1004f5, 0x1004f7, 0x1004f9, 0x1004fb, 0x1004fd, 0x1004ff, 0x100501, + 0x100503, 0x100505, 0x100507, 0x100509, 0x10050b, 0x10050d, 0x10050f, 0x100511, 0x100513, + 0x100515, 0x100517, 0x100519, 0x10051b, 0x10051d, 0x10051f, 0x100521, 0x100523, 0x100525, + 0x100527, 0x100529, 0x10052b, 0x10052d, 0x10052f, 0x101e01, 0x101e03, 0x101e05, 0x101e07, + 0x101e09, 0x101e0b, 0x101e0d, 0x101e0f, 0x101e11, 0x101e13, 0x101e15, 0x101e17, 0x101e19, + 0x101e1b, 0x101e1d, 0x101e1f, 0x101e21, 0x101e23, 0x101e25, 0x101e27, 0x101e29, 0x101e2b, + 0x101e2d, 0x101e2f, 0x101e31, 0x101e33, 0x101e35, 0x101e37, 0x101e39, 0x101e3b, 0x101e3d, + 0x101e3f, 0x101e41, 0x101e43, 0x101e45, 0x101e47, 0x101e49, 0x101e4b, 0x101e4d, 0x101e4f, + 0x101e51, 0x101e53, 0x101e55, 0x101e57, 0x101e59, 0x101e5b, 0x101e5d, 0x101e5f, 0x101e61, + 0x101e63, 0x101e65, 0x101e67, 0x101e69, 0x101e6b, 0x101e6d, 0x101e6f, 0x101e71, 0x101e73, + 0x101e75, 0x101e77, 0x101e79, 0x101e7b, 0x101e7d, 0x101e7f, 0x101e81, 0x101e83, 0x101e85, + 0x101e87, 0x101e89, 0x101e8b, 0x101e8d, 0x101e8f, 0x101e91, 0x101e93, 0x101e9f, 0x101ea1, + 0x101ea3, 0x101ea5, 0x101ea7, 0x101ea9, 0x101eab, 0x101ead, 0x101eaf, 0x101eb1, 0x101eb3, + 0x101eb5, 0x101eb7, 0x101eb9, 0x101ebb, 0x101ebd, 0x101ebf, 0x101ec1, 0x101ec3, 0x101ec5, + 0x101ec7, 0x101ec9, 0x101ecb, 0x101ecd, 0x101ecf, 0x101ed1, 0x101ed3, 0x101ed5, 0x101ed7, + 0x101ed9, 0x101edb, 0x101edd, 0x101edf, 0x101ee1, 0x101ee3, 0x101ee5, 0x101ee7, 0x101ee9, + 0x101eeb, 0x101eed, 0x101eef, 0x101ef1, 0x101ef3, 0x101ef5, 0x101ef7, 0x101ef9, 0x101efb, + 0x101efd, 0x101fb6, 0x101fb7, 0x101fbe, 0x101fc6, 0x101fc7, 0x101fd6, 0x101fd7, 0x101ff6, + 0x101ff7, 0x10210a, 0x10210e, 0x10210f, 0x102113, 0x10212f, 0x102134, 0x102139, 0x10213c, + 0x10213d, 0x10214e, 0x102184, 0x102c61, 0x102c65, 0x102c66, 0x102c68, 0x102c6a, 0x102c6c, + 0x102c71, 0x102c73, 0x102c74, 0x102c81, 0x102c83, 0x102c85, 0x102c87, 0x102c89, 0x102c8b, + 0x102c8d, 0x102c8f, 0x102c91, 0x102c93, 0x102c95, 0x102c97, 0x102c99, 0x102c9b, 0x102c9d, + 0x102c9f, 0x102ca1, 0x102ca3, 0x102ca5, 0x102ca7, 0x102ca9, 0x102cab, 0x102cad, 0x102caf, + 0x102cb1, 0x102cb3, 0x102cb5, 0x102cb7, 0x102cb9, 0x102cbb, 0x102cbd, 0x102cbf, 0x102cc1, + 0x102cc3, 0x102cc5, 0x102cc7, 0x102cc9, 0x102ccb, 0x102ccd, 0x102ccf, 0x102cd1, 0x102cd3, + 0x102cd5, 0x102cd7, 0x102cd9, 0x102cdb, 0x102cdd, 0x102cdf, 0x102ce1, 0x102ce3, 0x102ce4, + 0x102cec, 0x102cee, 0x102cf3, 0x102d27, 0x102d2d, 0x10a641, 0x10a643, 0x10a645, 0x10a647, + 0x10a649, 0x10a64b, 0x10a64d, 0x10a64f, 0x10a651, 0x10a653, 0x10a655, 0x10a657, 0x10a659, + 0x10a65b, 0x10a65d, 0x10a65f, 0x10a661, 0x10a663, 0x10a665, 0x10a667, 0x10a669, 0x10a66b, + 0x10a66d, 0x10a681, 0x10a683, 0x10a685, 0x10a687, 0x10a689, 0x10a68b, 0x10a68d, 0x10a68f, + 0x10a691, 0x10a693, 0x10a695, 0x10a697, 0x10a699, 0x10a69b, 0x10a723, 0x10a725, 0x10a727, + 0x10a729, 0x10a72b, 0x10a72d, 0x10a733, 0x10a735, 0x10a737, 0x10a739, 0x10a73b, 0x10a73d, + 0x10a73f, 0x10a741, 0x10a743, 0x10a745, 0x10a747, 0x10a749, 0x10a74b, 0x10a74d, 0x10a74f, + 0x10a751, 0x10a753, 0x10a755, 0x10a757, 0x10a759, 0x10a75b, 0x10a75d, 0x10a75f, 0x10a761, + 0x10a763, 0x10a765, 0x10a767, 0x10a769, 0x10a76b, 0x10a76d, 0x10a76f, 0x10a77a, 0x10a77c, + 0x10a77f, 0x10a781, 0x10a783, 0x10a785, 0x10a787, 0x10a78c, 0x10a78e, 0x10a791, 0x10a797, + 0x10a799, 0x10a79b, 0x10a79d, 0x10a79f, 0x10a7a1, 0x10a7a3, 0x10a7a5, 0x10a7a7, 0x10a7a9, + 0x10a7b5, 0x10a7b7, 0x10a7fa #endif }; @@ -521,13 +3626,166 @@ static const crange upperRangeTable[] = { {0x2130, 0x2133}, {0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80}, {0xa7aa, 0xa7ae}, {0xa7b0, 0xa7b4}, {0xff21, 0xff3a} #if TCL_UTF_MAX > 4 - ,{0x10400, 0x10427}, {0x104b0, 0x104d3}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf}, - {0x1d400, 0x1d419}, {0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, - {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, - {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, - {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, - {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}, {0x1e900, 0x1e921} + ,{0x10041, 0x1005a}, {0x100c0, 0x100d6}, {0x100d8, 0x100de}, {0x10189, 0x1018b}, + {0x1018e, 0x10191}, {0x10196, 0x10198}, {0x101b1, 0x101b3}, {0x101f6, 0x101f8}, + {0x10243, 0x10246}, {0x10388, 0x1038a}, {0x10391, 0x103a1}, {0x103a3, 0x103ab}, + {0x103d2, 0x103d4}, {0x103fd, 0x1042f}, {0x10531, 0x10556}, {0x110a0, 0x110c5}, + {0x113a0, 0x113f5}, {0x11f08, 0x11f0f}, {0x11f18, 0x11f1d}, {0x11f28, 0x11f2f}, + {0x11f38, 0x11f3f}, {0x11f48, 0x11f4d}, {0x11f68, 0x11f6f}, {0x11fb8, 0x11fbb}, + {0x11fc8, 0x11fcb}, {0x11fd8, 0x11fdb}, {0x11fe8, 0x11fec}, {0x11ff8, 0x11ffb}, + {0x1210b, 0x1210d}, {0x12110, 0x12112}, {0x12119, 0x1211d}, {0x1212a, 0x1212d}, + {0x12130, 0x12133}, {0x12c00, 0x12c2e}, {0x12c62, 0x12c64}, {0x12c6d, 0x12c70}, + {0x12c7e, 0x12c80}, {0x1a7aa, 0x1a7ae}, {0x1a7b0, 0x1a7b4}, {0x1ff21, 0x1ff3a}, + {0x20041, 0x2005a}, {0x200c0, 0x200d6}, {0x200d8, 0x200de}, {0x20189, 0x2018b}, + {0x2018e, 0x20191}, {0x20196, 0x20198}, {0x201b1, 0x201b3}, {0x201f6, 0x201f8}, + {0x20243, 0x20246}, {0x20388, 0x2038a}, {0x20391, 0x203a1}, {0x203a3, 0x203ab}, + {0x203d2, 0x203d4}, {0x203fd, 0x2042f}, {0x20531, 0x20556}, {0x210a0, 0x210c5}, + {0x213a0, 0x213f5}, {0x21f08, 0x21f0f}, {0x21f18, 0x21f1d}, {0x21f28, 0x21f2f}, + {0x21f38, 0x21f3f}, {0x21f48, 0x21f4d}, {0x21f68, 0x21f6f}, {0x21fb8, 0x21fbb}, + {0x21fc8, 0x21fcb}, {0x21fd8, 0x21fdb}, {0x21fe8, 0x21fec}, {0x21ff8, 0x21ffb}, + {0x2210b, 0x2210d}, {0x22110, 0x22112}, {0x22119, 0x2211d}, {0x2212a, 0x2212d}, + {0x22130, 0x22133}, {0x22c00, 0x22c2e}, {0x22c62, 0x22c64}, {0x22c6d, 0x22c70}, + {0x22c7e, 0x22c80}, {0x2a7aa, 0x2a7ae}, {0x2a7b0, 0x2a7b4}, {0x2ff21, 0x2ff3a}, + {0x30041, 0x3005a}, {0x300c0, 0x300d6}, {0x300d8, 0x300de}, {0x30189, 0x3018b}, + {0x3018e, 0x30191}, {0x30196, 0x30198}, {0x301b1, 0x301b3}, {0x301f6, 0x301f8}, + {0x30243, 0x30246}, {0x30388, 0x3038a}, {0x30391, 0x303a1}, {0x303a3, 0x303ab}, + {0x303d2, 0x303d4}, {0x303fd, 0x3042f}, {0x30531, 0x30556}, {0x310a0, 0x310c5}, + {0x313a0, 0x313f5}, {0x31f08, 0x31f0f}, {0x31f18, 0x31f1d}, {0x31f28, 0x31f2f}, + {0x31f38, 0x31f3f}, {0x31f48, 0x31f4d}, {0x31f68, 0x31f6f}, {0x31fb8, 0x31fbb}, + {0x31fc8, 0x31fcb}, {0x31fd8, 0x31fdb}, {0x31fe8, 0x31fec}, {0x31ff8, 0x31ffb}, + {0x3210b, 0x3210d}, {0x32110, 0x32112}, {0x32119, 0x3211d}, {0x3212a, 0x3212d}, + {0x32130, 0x32133}, {0x32c00, 0x32c2e}, {0x32c62, 0x32c64}, {0x32c6d, 0x32c70}, + {0x32c7e, 0x32c80}, {0x3a7aa, 0x3a7ae}, {0x3a7b0, 0x3a7b4}, {0x3ff21, 0x3ff3a}, + {0x40041, 0x4005a}, {0x400c0, 0x400d6}, {0x400d8, 0x400de}, {0x40189, 0x4018b}, + {0x4018e, 0x40191}, {0x40196, 0x40198}, {0x401b1, 0x401b3}, {0x401f6, 0x401f8}, + {0x40243, 0x40246}, {0x40388, 0x4038a}, {0x40391, 0x403a1}, {0x403a3, 0x403ab}, + {0x403d2, 0x403d4}, {0x403fd, 0x4042f}, {0x40531, 0x40556}, {0x410a0, 0x410c5}, + {0x413a0, 0x413f5}, {0x41f08, 0x41f0f}, {0x41f18, 0x41f1d}, {0x41f28, 0x41f2f}, + {0x41f38, 0x41f3f}, {0x41f48, 0x41f4d}, {0x41f68, 0x41f6f}, {0x41fb8, 0x41fbb}, + {0x41fc8, 0x41fcb}, {0x41fd8, 0x41fdb}, {0x41fe8, 0x41fec}, {0x41ff8, 0x41ffb}, + {0x4210b, 0x4210d}, {0x42110, 0x42112}, {0x42119, 0x4211d}, {0x4212a, 0x4212d}, + {0x42130, 0x42133}, {0x42c00, 0x42c2e}, {0x42c62, 0x42c64}, {0x42c6d, 0x42c70}, + {0x42c7e, 0x42c80}, {0x4a7aa, 0x4a7ae}, {0x4a7b0, 0x4a7b4}, {0x4ff21, 0x4ff3a}, + {0x50041, 0x5005a}, {0x500c0, 0x500d6}, {0x500d8, 0x500de}, {0x50189, 0x5018b}, + {0x5018e, 0x50191}, {0x50196, 0x50198}, {0x501b1, 0x501b3}, {0x501f6, 0x501f8}, + {0x50243, 0x50246}, {0x50388, 0x5038a}, {0x50391, 0x503a1}, {0x503a3, 0x503ab}, + {0x503d2, 0x503d4}, {0x503fd, 0x5042f}, {0x50531, 0x50556}, {0x510a0, 0x510c5}, + {0x513a0, 0x513f5}, {0x51f08, 0x51f0f}, {0x51f18, 0x51f1d}, {0x51f28, 0x51f2f}, + {0x51f38, 0x51f3f}, {0x51f48, 0x51f4d}, {0x51f68, 0x51f6f}, {0x51fb8, 0x51fbb}, + {0x51fc8, 0x51fcb}, {0x51fd8, 0x51fdb}, {0x51fe8, 0x51fec}, {0x51ff8, 0x51ffb}, + {0x5210b, 0x5210d}, {0x52110, 0x52112}, {0x52119, 0x5211d}, {0x5212a, 0x5212d}, + {0x52130, 0x52133}, {0x52c00, 0x52c2e}, {0x52c62, 0x52c64}, {0x52c6d, 0x52c70}, + {0x52c7e, 0x52c80}, {0x5a7aa, 0x5a7ae}, {0x5a7b0, 0x5a7b4}, {0x5ff21, 0x5ff3a}, + {0x60041, 0x6005a}, {0x600c0, 0x600d6}, {0x600d8, 0x600de}, {0x60189, 0x6018b}, + {0x6018e, 0x60191}, {0x60196, 0x60198}, {0x601b1, 0x601b3}, {0x601f6, 0x601f8}, + {0x60243, 0x60246}, {0x60388, 0x6038a}, {0x60391, 0x603a1}, {0x603a3, 0x603ab}, + {0x603d2, 0x603d4}, {0x603fd, 0x6042f}, {0x60531, 0x60556}, {0x610a0, 0x610c5}, + {0x613a0, 0x613f5}, {0x61f08, 0x61f0f}, {0x61f18, 0x61f1d}, {0x61f28, 0x61f2f}, + {0x61f38, 0x61f3f}, {0x61f48, 0x61f4d}, {0x61f68, 0x61f6f}, {0x61fb8, 0x61fbb}, + {0x61fc8, 0x61fcb}, {0x61fd8, 0x61fdb}, {0x61fe8, 0x61fec}, {0x61ff8, 0x61ffb}, + {0x6210b, 0x6210d}, {0x62110, 0x62112}, {0x62119, 0x6211d}, {0x6212a, 0x6212d}, + {0x62130, 0x62133}, {0x62c00, 0x62c2e}, {0x62c62, 0x62c64}, {0x62c6d, 0x62c70}, + {0x62c7e, 0x62c80}, {0x6a7aa, 0x6a7ae}, {0x6a7b0, 0x6a7b4}, {0x6ff21, 0x6ff3a}, + {0x70041, 0x7005a}, {0x700c0, 0x700d6}, {0x700d8, 0x700de}, {0x70189, 0x7018b}, + {0x7018e, 0x70191}, {0x70196, 0x70198}, {0x701b1, 0x701b3}, {0x701f6, 0x701f8}, + {0x70243, 0x70246}, {0x70388, 0x7038a}, {0x70391, 0x703a1}, {0x703a3, 0x703ab}, + {0x703d2, 0x703d4}, {0x703fd, 0x7042f}, {0x70531, 0x70556}, {0x710a0, 0x710c5}, + {0x713a0, 0x713f5}, {0x71f08, 0x71f0f}, {0x71f18, 0x71f1d}, {0x71f28, 0x71f2f}, + {0x71f38, 0x71f3f}, {0x71f48, 0x71f4d}, {0x71f68, 0x71f6f}, {0x71fb8, 0x71fbb}, + {0x71fc8, 0x71fcb}, {0x71fd8, 0x71fdb}, {0x71fe8, 0x71fec}, {0x71ff8, 0x71ffb}, + {0x7210b, 0x7210d}, {0x72110, 0x72112}, {0x72119, 0x7211d}, {0x7212a, 0x7212d}, + {0x72130, 0x72133}, {0x72c00, 0x72c2e}, {0x72c62, 0x72c64}, {0x72c6d, 0x72c70}, + {0x72c7e, 0x72c80}, {0x7a7aa, 0x7a7ae}, {0x7a7b0, 0x7a7b4}, {0x7ff21, 0x7ff3a}, + {0x80041, 0x8005a}, {0x800c0, 0x800d6}, {0x800d8, 0x800de}, {0x80189, 0x8018b}, + {0x8018e, 0x80191}, {0x80196, 0x80198}, {0x801b1, 0x801b3}, {0x801f6, 0x801f8}, + {0x80243, 0x80246}, {0x80388, 0x8038a}, {0x80391, 0x803a1}, {0x803a3, 0x803ab}, + {0x803d2, 0x803d4}, {0x803fd, 0x8042f}, {0x80531, 0x80556}, {0x810a0, 0x810c5}, + {0x813a0, 0x813f5}, {0x81f08, 0x81f0f}, {0x81f18, 0x81f1d}, {0x81f28, 0x81f2f}, + {0x81f38, 0x81f3f}, {0x81f48, 0x81f4d}, {0x81f68, 0x81f6f}, {0x81fb8, 0x81fbb}, + {0x81fc8, 0x81fcb}, {0x81fd8, 0x81fdb}, {0x81fe8, 0x81fec}, {0x81ff8, 0x81ffb}, + {0x8210b, 0x8210d}, {0x82110, 0x82112}, {0x82119, 0x8211d}, {0x8212a, 0x8212d}, + {0x82130, 0x82133}, {0x82c00, 0x82c2e}, {0x82c62, 0x82c64}, {0x82c6d, 0x82c70}, + {0x82c7e, 0x82c80}, {0x8a7aa, 0x8a7ae}, {0x8a7b0, 0x8a7b4}, {0x8ff21, 0x8ff3a}, + {0x90041, 0x9005a}, {0x900c0, 0x900d6}, {0x900d8, 0x900de}, {0x90189, 0x9018b}, + {0x9018e, 0x90191}, {0x90196, 0x90198}, {0x901b1, 0x901b3}, {0x901f6, 0x901f8}, + {0x90243, 0x90246}, {0x90388, 0x9038a}, {0x90391, 0x903a1}, {0x903a3, 0x903ab}, + {0x903d2, 0x903d4}, {0x903fd, 0x9042f}, {0x90531, 0x90556}, {0x910a0, 0x910c5}, + {0x913a0, 0x913f5}, {0x91f08, 0x91f0f}, {0x91f18, 0x91f1d}, {0x91f28, 0x91f2f}, + {0x91f38, 0x91f3f}, {0x91f48, 0x91f4d}, {0x91f68, 0x91f6f}, {0x91fb8, 0x91fbb}, + {0x91fc8, 0x91fcb}, {0x91fd8, 0x91fdb}, {0x91fe8, 0x91fec}, {0x91ff8, 0x91ffb}, + {0x9210b, 0x9210d}, {0x92110, 0x92112}, {0x92119, 0x9211d}, {0x9212a, 0x9212d}, + {0x92130, 0x92133}, {0x92c00, 0x92c2e}, {0x92c62, 0x92c64}, {0x92c6d, 0x92c70}, + {0x92c7e, 0x92c80}, {0x9a7aa, 0x9a7ae}, {0x9a7b0, 0x9a7b4}, {0x9ff21, 0x9ff3a}, + {0xa0041, 0xa005a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00de}, {0xa0189, 0xa018b}, + {0xa018e, 0xa0191}, {0xa0196, 0xa0198}, {0xa01b1, 0xa01b3}, {0xa01f6, 0xa01f8}, + {0xa0243, 0xa0246}, {0xa0388, 0xa038a}, {0xa0391, 0xa03a1}, {0xa03a3, 0xa03ab}, + {0xa03d2, 0xa03d4}, {0xa03fd, 0xa042f}, {0xa0531, 0xa0556}, {0xa10a0, 0xa10c5}, + {0xa13a0, 0xa13f5}, {0xa1f08, 0xa1f0f}, {0xa1f18, 0xa1f1d}, {0xa1f28, 0xa1f2f}, + {0xa1f38, 0xa1f3f}, {0xa1f48, 0xa1f4d}, {0xa1f68, 0xa1f6f}, {0xa1fb8, 0xa1fbb}, + {0xa1fc8, 0xa1fcb}, {0xa1fd8, 0xa1fdb}, {0xa1fe8, 0xa1fec}, {0xa1ff8, 0xa1ffb}, + {0xa210b, 0xa210d}, {0xa2110, 0xa2112}, {0xa2119, 0xa211d}, {0xa212a, 0xa212d}, + {0xa2130, 0xa2133}, {0xa2c00, 0xa2c2e}, {0xa2c62, 0xa2c64}, {0xa2c6d, 0xa2c70}, + {0xa2c7e, 0xa2c80}, {0xaa7aa, 0xaa7ae}, {0xaa7b0, 0xaa7b4}, {0xaff21, 0xaff3a}, + {0xb0041, 0xb005a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00de}, {0xb0189, 0xb018b}, + {0xb018e, 0xb0191}, {0xb0196, 0xb0198}, {0xb01b1, 0xb01b3}, {0xb01f6, 0xb01f8}, + {0xb0243, 0xb0246}, {0xb0388, 0xb038a}, {0xb0391, 0xb03a1}, {0xb03a3, 0xb03ab}, + {0xb03d2, 0xb03d4}, {0xb03fd, 0xb042f}, {0xb0531, 0xb0556}, {0xb10a0, 0xb10c5}, + {0xb13a0, 0xb13f5}, {0xb1f08, 0xb1f0f}, {0xb1f18, 0xb1f1d}, {0xb1f28, 0xb1f2f}, + {0xb1f38, 0xb1f3f}, {0xb1f48, 0xb1f4d}, {0xb1f68, 0xb1f6f}, {0xb1fb8, 0xb1fbb}, + {0xb1fc8, 0xb1fcb}, {0xb1fd8, 0xb1fdb}, {0xb1fe8, 0xb1fec}, {0xb1ff8, 0xb1ffb}, + {0xb210b, 0xb210d}, {0xb2110, 0xb2112}, {0xb2119, 0xb211d}, {0xb212a, 0xb212d}, + {0xb2130, 0xb2133}, {0xb2c00, 0xb2c2e}, {0xb2c62, 0xb2c64}, {0xb2c6d, 0xb2c70}, + {0xb2c7e, 0xb2c80}, {0xba7aa, 0xba7ae}, {0xba7b0, 0xba7b4}, {0xbff21, 0xbff3a}, + {0xc0041, 0xc005a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00de}, {0xc0189, 0xc018b}, + {0xc018e, 0xc0191}, {0xc0196, 0xc0198}, {0xc01b1, 0xc01b3}, {0xc01f6, 0xc01f8}, + {0xc0243, 0xc0246}, {0xc0388, 0xc038a}, {0xc0391, 0xc03a1}, {0xc03a3, 0xc03ab}, + {0xc03d2, 0xc03d4}, {0xc03fd, 0xc042f}, {0xc0531, 0xc0556}, {0xc10a0, 0xc10c5}, + {0xc13a0, 0xc13f5}, {0xc1f08, 0xc1f0f}, {0xc1f18, 0xc1f1d}, {0xc1f28, 0xc1f2f}, + {0xc1f38, 0xc1f3f}, {0xc1f48, 0xc1f4d}, {0xc1f68, 0xc1f6f}, {0xc1fb8, 0xc1fbb}, + {0xc1fc8, 0xc1fcb}, {0xc1fd8, 0xc1fdb}, {0xc1fe8, 0xc1fec}, {0xc1ff8, 0xc1ffb}, + {0xc210b, 0xc210d}, {0xc2110, 0xc2112}, {0xc2119, 0xc211d}, {0xc212a, 0xc212d}, + {0xc2130, 0xc2133}, {0xc2c00, 0xc2c2e}, {0xc2c62, 0xc2c64}, {0xc2c6d, 0xc2c70}, + {0xc2c7e, 0xc2c80}, {0xca7aa, 0xca7ae}, {0xca7b0, 0xca7b4}, {0xcff21, 0xcff3a}, + {0xd0041, 0xd005a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00de}, {0xd0189, 0xd018b}, + {0xd018e, 0xd0191}, {0xd0196, 0xd0198}, {0xd01b1, 0xd01b3}, {0xd01f6, 0xd01f8}, + {0xd0243, 0xd0246}, {0xd0388, 0xd038a}, {0xd0391, 0xd03a1}, {0xd03a3, 0xd03ab}, + {0xd03d2, 0xd03d4}, {0xd03fd, 0xd042f}, {0xd0531, 0xd0556}, {0xd10a0, 0xd10c5}, + {0xd13a0, 0xd13f5}, {0xd1f08, 0xd1f0f}, {0xd1f18, 0xd1f1d}, {0xd1f28, 0xd1f2f}, + {0xd1f38, 0xd1f3f}, {0xd1f48, 0xd1f4d}, {0xd1f68, 0xd1f6f}, {0xd1fb8, 0xd1fbb}, + {0xd1fc8, 0xd1fcb}, {0xd1fd8, 0xd1fdb}, {0xd1fe8, 0xd1fec}, {0xd1ff8, 0xd1ffb}, + {0xd210b, 0xd210d}, {0xd2110, 0xd2112}, {0xd2119, 0xd211d}, {0xd212a, 0xd212d}, + {0xd2130, 0xd2133}, {0xd2c00, 0xd2c2e}, {0xd2c62, 0xd2c64}, {0xd2c6d, 0xd2c70}, + {0xd2c7e, 0xd2c80}, {0xda7aa, 0xda7ae}, {0xda7b0, 0xda7b4}, {0xdff21, 0xdff3a}, + {0xe0041, 0xe005a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00de}, {0xe0189, 0xe018b}, + {0xe018e, 0xe0191}, {0xe0196, 0xe0198}, {0xe01b1, 0xe01b3}, {0xe01f6, 0xe01f8}, + {0xe0243, 0xe0246}, {0xe0388, 0xe038a}, {0xe0391, 0xe03a1}, {0xe03a3, 0xe03ab}, + {0xe03d2, 0xe03d4}, {0xe03fd, 0xe042f}, {0xe0531, 0xe0556}, {0xe10a0, 0xe10c5}, + {0xe13a0, 0xe13f5}, {0xe1f08, 0xe1f0f}, {0xe1f18, 0xe1f1d}, {0xe1f28, 0xe1f2f}, + {0xe1f38, 0xe1f3f}, {0xe1f48, 0xe1f4d}, {0xe1f68, 0xe1f6f}, {0xe1fb8, 0xe1fbb}, + {0xe1fc8, 0xe1fcb}, {0xe1fd8, 0xe1fdb}, {0xe1fe8, 0xe1fec}, {0xe1ff8, 0xe1ffb}, + {0xe210b, 0xe210d}, {0xe2110, 0xe2112}, {0xe2119, 0xe211d}, {0xe212a, 0xe212d}, + {0xe2130, 0xe2133}, {0xe2c00, 0xe2c2e}, {0xe2c62, 0xe2c64}, {0xe2c6d, 0xe2c70}, + {0xe2c7e, 0xe2c80}, {0xea7aa, 0xea7ae}, {0xea7b0, 0xea7b4}, {0xeff21, 0xeff3a}, + {0xf0041, 0xf005a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00de}, {0xf0189, 0xf018b}, + {0xf018e, 0xf0191}, {0xf0196, 0xf0198}, {0xf01b1, 0xf01b3}, {0xf01f6, 0xf01f8}, + {0xf0243, 0xf0246}, {0xf0388, 0xf038a}, {0xf0391, 0xf03a1}, {0xf03a3, 0xf03ab}, + {0xf03d2, 0xf03d4}, {0xf03fd, 0xf042f}, {0xf0531, 0xf0556}, {0xf10a0, 0xf10c5}, + {0xf13a0, 0xf13f5}, {0xf1f08, 0xf1f0f}, {0xf1f18, 0xf1f1d}, {0xf1f28, 0xf1f2f}, + {0xf1f38, 0xf1f3f}, {0xf1f48, 0xf1f4d}, {0xf1f68, 0xf1f6f}, {0xf1fb8, 0xf1fbb}, + {0xf1fc8, 0xf1fcb}, {0xf1fd8, 0xf1fdb}, {0xf1fe8, 0xf1fec}, {0xf1ff8, 0xf1ffb}, + {0xf210b, 0xf210d}, {0xf2110, 0xf2112}, {0xf2119, 0xf211d}, {0xf212a, 0xf212d}, + {0xf2130, 0xf2133}, {0xf2c00, 0xf2c2e}, {0xf2c62, 0xf2c64}, {0xf2c6d, 0xf2c70}, + {0xf2c7e, 0xf2c80}, {0xfa7aa, 0xfa7ae}, {0xfa7b0, 0xfa7b4}, {0xfff21, 0xfff3a}, + {0x100041, 0x10005a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000de}, {0x100189, 0x10018b}, + {0x10018e, 0x100191}, {0x100196, 0x100198}, {0x1001b1, 0x1001b3}, {0x1001f6, 0x1001f8}, + {0x100243, 0x100246}, {0x100388, 0x10038a}, {0x100391, 0x1003a1}, {0x1003a3, 0x1003ab}, + {0x1003d2, 0x1003d4}, {0x1003fd, 0x10042f}, {0x100531, 0x100556}, {0x1010a0, 0x1010c5}, + {0x1013a0, 0x1013f5}, {0x101f08, 0x101f0f}, {0x101f18, 0x101f1d}, {0x101f28, 0x101f2f}, + {0x101f38, 0x101f3f}, {0x101f48, 0x101f4d}, {0x101f68, 0x101f6f}, {0x101fb8, 0x101fbb}, + {0x101fc8, 0x101fcb}, {0x101fd8, 0x101fdb}, {0x101fe8, 0x101fec}, {0x101ff8, 0x101ffb}, + {0x10210b, 0x10210d}, {0x102110, 0x102112}, {0x102119, 0x10211d}, {0x10212a, 0x10212d}, + {0x102130, 0x102133}, {0x102c00, 0x102c2e}, {0x102c62, 0x102c64}, {0x102c6d, 0x102c70}, + {0x102c7e, 0x102c80}, {0x10a7aa, 0x10a7ae}, {0x10a7b0, 0x10a7b4}, {0x10ff21, 0x10ff3a} #endif }; @@ -598,8 +3856,1014 @@ static const chr upperCharTable[] = { 0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798, 0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6 #if TCL_UTF_MAX > 4 - ,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538, - 0x1d539, 0x1d546, 0x1d7ca + ,0x10100, 0x10102, 0x10104, 0x10106, 0x10108, 0x1010a, 0x1010c, 0x1010e, 0x10110, + 0x10112, 0x10114, 0x10116, 0x10118, 0x1011a, 0x1011c, 0x1011e, 0x10120, 0x10122, + 0x10124, 0x10126, 0x10128, 0x1012a, 0x1012c, 0x1012e, 0x10130, 0x10132, 0x10134, + 0x10136, 0x10139, 0x1013b, 0x1013d, 0x1013f, 0x10141, 0x10143, 0x10145, 0x10147, + 0x1014a, 0x1014c, 0x1014e, 0x10150, 0x10152, 0x10154, 0x10156, 0x10158, 0x1015a, + 0x1015c, 0x1015e, 0x10160, 0x10162, 0x10164, 0x10166, 0x10168, 0x1016a, 0x1016c, + 0x1016e, 0x10170, 0x10172, 0x10174, 0x10176, 0x10178, 0x10179, 0x1017b, 0x1017d, + 0x10181, 0x10182, 0x10184, 0x10186, 0x10187, 0x10193, 0x10194, 0x1019c, 0x1019d, + 0x1019f, 0x101a0, 0x101a2, 0x101a4, 0x101a6, 0x101a7, 0x101a9, 0x101ac, 0x101ae, + 0x101af, 0x101b5, 0x101b7, 0x101b8, 0x101bc, 0x101c4, 0x101c7, 0x101ca, 0x101cd, + 0x101cf, 0x101d1, 0x101d3, 0x101d5, 0x101d7, 0x101d9, 0x101db, 0x101de, 0x101e0, + 0x101e2, 0x101e4, 0x101e6, 0x101e8, 0x101ea, 0x101ec, 0x101ee, 0x101f1, 0x101f4, + 0x101fa, 0x101fc, 0x101fe, 0x10200, 0x10202, 0x10204, 0x10206, 0x10208, 0x1020a, + 0x1020c, 0x1020e, 0x10210, 0x10212, 0x10214, 0x10216, 0x10218, 0x1021a, 0x1021c, + 0x1021e, 0x10220, 0x10222, 0x10224, 0x10226, 0x10228, 0x1022a, 0x1022c, 0x1022e, + 0x10230, 0x10232, 0x1023a, 0x1023b, 0x1023d, 0x1023e, 0x10241, 0x10248, 0x1024a, + 0x1024c, 0x1024e, 0x10370, 0x10372, 0x10376, 0x1037f, 0x10386, 0x1038c, 0x1038e, + 0x1038f, 0x103cf, 0x103d8, 0x103da, 0x103dc, 0x103de, 0x103e0, 0x103e2, 0x103e4, + 0x103e6, 0x103e8, 0x103ea, 0x103ec, 0x103ee, 0x103f4, 0x103f7, 0x103f9, 0x103fa, + 0x10460, 0x10462, 0x10464, 0x10466, 0x10468, 0x1046a, 0x1046c, 0x1046e, 0x10470, + 0x10472, 0x10474, 0x10476, 0x10478, 0x1047a, 0x1047c, 0x1047e, 0x10480, 0x1048a, + 0x1048c, 0x1048e, 0x10490, 0x10492, 0x10494, 0x10496, 0x10498, 0x1049a, 0x1049c, + 0x1049e, 0x104a0, 0x104a2, 0x104a4, 0x104a6, 0x104a8, 0x104aa, 0x104ac, 0x104ae, + 0x104b0, 0x104b2, 0x104b4, 0x104b6, 0x104b8, 0x104ba, 0x104bc, 0x104be, 0x104c0, + 0x104c1, 0x104c3, 0x104c5, 0x104c7, 0x104c9, 0x104cb, 0x104cd, 0x104d0, 0x104d2, + 0x104d4, 0x104d6, 0x104d8, 0x104da, 0x104dc, 0x104de, 0x104e0, 0x104e2, 0x104e4, + 0x104e6, 0x104e8, 0x104ea, 0x104ec, 0x104ee, 0x104f0, 0x104f2, 0x104f4, 0x104f6, + 0x104f8, 0x104fa, 0x104fc, 0x104fe, 0x10500, 0x10502, 0x10504, 0x10506, 0x10508, + 0x1050a, 0x1050c, 0x1050e, 0x10510, 0x10512, 0x10514, 0x10516, 0x10518, 0x1051a, + 0x1051c, 0x1051e, 0x10520, 0x10522, 0x10524, 0x10526, 0x10528, 0x1052a, 0x1052c, + 0x1052e, 0x110c7, 0x110cd, 0x11e00, 0x11e02, 0x11e04, 0x11e06, 0x11e08, 0x11e0a, + 0x11e0c, 0x11e0e, 0x11e10, 0x11e12, 0x11e14, 0x11e16, 0x11e18, 0x11e1a, 0x11e1c, + 0x11e1e, 0x11e20, 0x11e22, 0x11e24, 0x11e26, 0x11e28, 0x11e2a, 0x11e2c, 0x11e2e, + 0x11e30, 0x11e32, 0x11e34, 0x11e36, 0x11e38, 0x11e3a, 0x11e3c, 0x11e3e, 0x11e40, + 0x11e42, 0x11e44, 0x11e46, 0x11e48, 0x11e4a, 0x11e4c, 0x11e4e, 0x11e50, 0x11e52, + 0x11e54, 0x11e56, 0x11e58, 0x11e5a, 0x11e5c, 0x11e5e, 0x11e60, 0x11e62, 0x11e64, + 0x11e66, 0x11e68, 0x11e6a, 0x11e6c, 0x11e6e, 0x11e70, 0x11e72, 0x11e74, 0x11e76, + 0x11e78, 0x11e7a, 0x11e7c, 0x11e7e, 0x11e80, 0x11e82, 0x11e84, 0x11e86, 0x11e88, + 0x11e8a, 0x11e8c, 0x11e8e, 0x11e90, 0x11e92, 0x11e94, 0x11e9e, 0x11ea0, 0x11ea2, + 0x11ea4, 0x11ea6, 0x11ea8, 0x11eaa, 0x11eac, 0x11eae, 0x11eb0, 0x11eb2, 0x11eb4, + 0x11eb6, 0x11eb8, 0x11eba, 0x11ebc, 0x11ebe, 0x11ec0, 0x11ec2, 0x11ec4, 0x11ec6, + 0x11ec8, 0x11eca, 0x11ecc, 0x11ece, 0x11ed0, 0x11ed2, 0x11ed4, 0x11ed6, 0x11ed8, + 0x11eda, 0x11edc, 0x11ede, 0x11ee0, 0x11ee2, 0x11ee4, 0x11ee6, 0x11ee8, 0x11eea, + 0x11eec, 0x11eee, 0x11ef0, 0x11ef2, 0x11ef4, 0x11ef6, 0x11ef8, 0x11efa, 0x11efc, + 0x11efe, 0x11f59, 0x11f5b, 0x11f5d, 0x11f5f, 0x12102, 0x12107, 0x12115, 0x12124, + 0x12126, 0x12128, 0x1213e, 0x1213f, 0x12145, 0x12183, 0x12c60, 0x12c67, 0x12c69, + 0x12c6b, 0x12c72, 0x12c75, 0x12c82, 0x12c84, 0x12c86, 0x12c88, 0x12c8a, 0x12c8c, + 0x12c8e, 0x12c90, 0x12c92, 0x12c94, 0x12c96, 0x12c98, 0x12c9a, 0x12c9c, 0x12c9e, + 0x12ca0, 0x12ca2, 0x12ca4, 0x12ca6, 0x12ca8, 0x12caa, 0x12cac, 0x12cae, 0x12cb0, + 0x12cb2, 0x12cb4, 0x12cb6, 0x12cb8, 0x12cba, 0x12cbc, 0x12cbe, 0x12cc0, 0x12cc2, + 0x12cc4, 0x12cc6, 0x12cc8, 0x12cca, 0x12ccc, 0x12cce, 0x12cd0, 0x12cd2, 0x12cd4, + 0x12cd6, 0x12cd8, 0x12cda, 0x12cdc, 0x12cde, 0x12ce0, 0x12ce2, 0x12ceb, 0x12ced, + 0x12cf2, 0x1a640, 0x1a642, 0x1a644, 0x1a646, 0x1a648, 0x1a64a, 0x1a64c, 0x1a64e, + 0x1a650, 0x1a652, 0x1a654, 0x1a656, 0x1a658, 0x1a65a, 0x1a65c, 0x1a65e, 0x1a660, + 0x1a662, 0x1a664, 0x1a666, 0x1a668, 0x1a66a, 0x1a66c, 0x1a680, 0x1a682, 0x1a684, + 0x1a686, 0x1a688, 0x1a68a, 0x1a68c, 0x1a68e, 0x1a690, 0x1a692, 0x1a694, 0x1a696, + 0x1a698, 0x1a69a, 0x1a722, 0x1a724, 0x1a726, 0x1a728, 0x1a72a, 0x1a72c, 0x1a72e, + 0x1a732, 0x1a734, 0x1a736, 0x1a738, 0x1a73a, 0x1a73c, 0x1a73e, 0x1a740, 0x1a742, + 0x1a744, 0x1a746, 0x1a748, 0x1a74a, 0x1a74c, 0x1a74e, 0x1a750, 0x1a752, 0x1a754, + 0x1a756, 0x1a758, 0x1a75a, 0x1a75c, 0x1a75e, 0x1a760, 0x1a762, 0x1a764, 0x1a766, + 0x1a768, 0x1a76a, 0x1a76c, 0x1a76e, 0x1a779, 0x1a77b, 0x1a77d, 0x1a77e, 0x1a780, + 0x1a782, 0x1a784, 0x1a786, 0x1a78b, 0x1a78d, 0x1a790, 0x1a792, 0x1a796, 0x1a798, + 0x1a79a, 0x1a79c, 0x1a79e, 0x1a7a0, 0x1a7a2, 0x1a7a4, 0x1a7a6, 0x1a7a8, 0x1a7b6, + 0x20100, 0x20102, 0x20104, 0x20106, 0x20108, 0x2010a, 0x2010c, 0x2010e, 0x20110, + 0x20112, 0x20114, 0x20116, 0x20118, 0x2011a, 0x2011c, 0x2011e, 0x20120, 0x20122, + 0x20124, 0x20126, 0x20128, 0x2012a, 0x2012c, 0x2012e, 0x20130, 0x20132, 0x20134, + 0x20136, 0x20139, 0x2013b, 0x2013d, 0x2013f, 0x20141, 0x20143, 0x20145, 0x20147, + 0x2014a, 0x2014c, 0x2014e, 0x20150, 0x20152, 0x20154, 0x20156, 0x20158, 0x2015a, + 0x2015c, 0x2015e, 0x20160, 0x20162, 0x20164, 0x20166, 0x20168, 0x2016a, 0x2016c, + 0x2016e, 0x20170, 0x20172, 0x20174, 0x20176, 0x20178, 0x20179, 0x2017b, 0x2017d, + 0x20181, 0x20182, 0x20184, 0x20186, 0x20187, 0x20193, 0x20194, 0x2019c, 0x2019d, + 0x2019f, 0x201a0, 0x201a2, 0x201a4, 0x201a6, 0x201a7, 0x201a9, 0x201ac, 0x201ae, + 0x201af, 0x201b5, 0x201b7, 0x201b8, 0x201bc, 0x201c4, 0x201c7, 0x201ca, 0x201cd, + 0x201cf, 0x201d1, 0x201d3, 0x201d5, 0x201d7, 0x201d9, 0x201db, 0x201de, 0x201e0, + 0x201e2, 0x201e4, 0x201e6, 0x201e8, 0x201ea, 0x201ec, 0x201ee, 0x201f1, 0x201f4, + 0x201fa, 0x201fc, 0x201fe, 0x20200, 0x20202, 0x20204, 0x20206, 0x20208, 0x2020a, + 0x2020c, 0x2020e, 0x20210, 0x20212, 0x20214, 0x20216, 0x20218, 0x2021a, 0x2021c, + 0x2021e, 0x20220, 0x20222, 0x20224, 0x20226, 0x20228, 0x2022a, 0x2022c, 0x2022e, + 0x20230, 0x20232, 0x2023a, 0x2023b, 0x2023d, 0x2023e, 0x20241, 0x20248, 0x2024a, + 0x2024c, 0x2024e, 0x20370, 0x20372, 0x20376, 0x2037f, 0x20386, 0x2038c, 0x2038e, + 0x2038f, 0x203cf, 0x203d8, 0x203da, 0x203dc, 0x203de, 0x203e0, 0x203e2, 0x203e4, + 0x203e6, 0x203e8, 0x203ea, 0x203ec, 0x203ee, 0x203f4, 0x203f7, 0x203f9, 0x203fa, + 0x20460, 0x20462, 0x20464, 0x20466, 0x20468, 0x2046a, 0x2046c, 0x2046e, 0x20470, + 0x20472, 0x20474, 0x20476, 0x20478, 0x2047a, 0x2047c, 0x2047e, 0x20480, 0x2048a, + 0x2048c, 0x2048e, 0x20490, 0x20492, 0x20494, 0x20496, 0x20498, 0x2049a, 0x2049c, + 0x2049e, 0x204a0, 0x204a2, 0x204a4, 0x204a6, 0x204a8, 0x204aa, 0x204ac, 0x204ae, + 0x204b0, 0x204b2, 0x204b4, 0x204b6, 0x204b8, 0x204ba, 0x204bc, 0x204be, 0x204c0, + 0x204c1, 0x204c3, 0x204c5, 0x204c7, 0x204c9, 0x204cb, 0x204cd, 0x204d0, 0x204d2, + 0x204d4, 0x204d6, 0x204d8, 0x204da, 0x204dc, 0x204de, 0x204e0, 0x204e2, 0x204e4, + 0x204e6, 0x204e8, 0x204ea, 0x204ec, 0x204ee, 0x204f0, 0x204f2, 0x204f4, 0x204f6, + 0x204f8, 0x204fa, 0x204fc, 0x204fe, 0x20500, 0x20502, 0x20504, 0x20506, 0x20508, + 0x2050a, 0x2050c, 0x2050e, 0x20510, 0x20512, 0x20514, 0x20516, 0x20518, 0x2051a, + 0x2051c, 0x2051e, 0x20520, 0x20522, 0x20524, 0x20526, 0x20528, 0x2052a, 0x2052c, + 0x2052e, 0x210c7, 0x210cd, 0x21e00, 0x21e02, 0x21e04, 0x21e06, 0x21e08, 0x21e0a, + 0x21e0c, 0x21e0e, 0x21e10, 0x21e12, 0x21e14, 0x21e16, 0x21e18, 0x21e1a, 0x21e1c, + 0x21e1e, 0x21e20, 0x21e22, 0x21e24, 0x21e26, 0x21e28, 0x21e2a, 0x21e2c, 0x21e2e, + 0x21e30, 0x21e32, 0x21e34, 0x21e36, 0x21e38, 0x21e3a, 0x21e3c, 0x21e3e, 0x21e40, + 0x21e42, 0x21e44, 0x21e46, 0x21e48, 0x21e4a, 0x21e4c, 0x21e4e, 0x21e50, 0x21e52, + 0x21e54, 0x21e56, 0x21e58, 0x21e5a, 0x21e5c, 0x21e5e, 0x21e60, 0x21e62, 0x21e64, + 0x21e66, 0x21e68, 0x21e6a, 0x21e6c, 0x21e6e, 0x21e70, 0x21e72, 0x21e74, 0x21e76, + 0x21e78, 0x21e7a, 0x21e7c, 0x21e7e, 0x21e80, 0x21e82, 0x21e84, 0x21e86, 0x21e88, + 0x21e8a, 0x21e8c, 0x21e8e, 0x21e90, 0x21e92, 0x21e94, 0x21e9e, 0x21ea0, 0x21ea2, + 0x21ea4, 0x21ea6, 0x21ea8, 0x21eaa, 0x21eac, 0x21eae, 0x21eb0, 0x21eb2, 0x21eb4, + 0x21eb6, 0x21eb8, 0x21eba, 0x21ebc, 0x21ebe, 0x21ec0, 0x21ec2, 0x21ec4, 0x21ec6, + 0x21ec8, 0x21eca, 0x21ecc, 0x21ece, 0x21ed0, 0x21ed2, 0x21ed4, 0x21ed6, 0x21ed8, + 0x21eda, 0x21edc, 0x21ede, 0x21ee0, 0x21ee2, 0x21ee4, 0x21ee6, 0x21ee8, 0x21eea, + 0x21eec, 0x21eee, 0x21ef0, 0x21ef2, 0x21ef4, 0x21ef6, 0x21ef8, 0x21efa, 0x21efc, + 0x21efe, 0x21f59, 0x21f5b, 0x21f5d, 0x21f5f, 0x22102, 0x22107, 0x22115, 0x22124, + 0x22126, 0x22128, 0x2213e, 0x2213f, 0x22145, 0x22183, 0x22c60, 0x22c67, 0x22c69, + 0x22c6b, 0x22c72, 0x22c75, 0x22c82, 0x22c84, 0x22c86, 0x22c88, 0x22c8a, 0x22c8c, + 0x22c8e, 0x22c90, 0x22c92, 0x22c94, 0x22c96, 0x22c98, 0x22c9a, 0x22c9c, 0x22c9e, + 0x22ca0, 0x22ca2, 0x22ca4, 0x22ca6, 0x22ca8, 0x22caa, 0x22cac, 0x22cae, 0x22cb0, + 0x22cb2, 0x22cb4, 0x22cb6, 0x22cb8, 0x22cba, 0x22cbc, 0x22cbe, 0x22cc0, 0x22cc2, + 0x22cc4, 0x22cc6, 0x22cc8, 0x22cca, 0x22ccc, 0x22cce, 0x22cd0, 0x22cd2, 0x22cd4, + 0x22cd6, 0x22cd8, 0x22cda, 0x22cdc, 0x22cde, 0x22ce0, 0x22ce2, 0x22ceb, 0x22ced, + 0x22cf2, 0x2a640, 0x2a642, 0x2a644, 0x2a646, 0x2a648, 0x2a64a, 0x2a64c, 0x2a64e, + 0x2a650, 0x2a652, 0x2a654, 0x2a656, 0x2a658, 0x2a65a, 0x2a65c, 0x2a65e, 0x2a660, + 0x2a662, 0x2a664, 0x2a666, 0x2a668, 0x2a66a, 0x2a66c, 0x2a680, 0x2a682, 0x2a684, + 0x2a686, 0x2a688, 0x2a68a, 0x2a68c, 0x2a68e, 0x2a690, 0x2a692, 0x2a694, 0x2a696, + 0x2a698, 0x2a69a, 0x2a722, 0x2a724, 0x2a726, 0x2a728, 0x2a72a, 0x2a72c, 0x2a72e, + 0x2a732, 0x2a734, 0x2a736, 0x2a738, 0x2a73a, 0x2a73c, 0x2a73e, 0x2a740, 0x2a742, + 0x2a744, 0x2a746, 0x2a748, 0x2a74a, 0x2a74c, 0x2a74e, 0x2a750, 0x2a752, 0x2a754, + 0x2a756, 0x2a758, 0x2a75a, 0x2a75c, 0x2a75e, 0x2a760, 0x2a762, 0x2a764, 0x2a766, + 0x2a768, 0x2a76a, 0x2a76c, 0x2a76e, 0x2a779, 0x2a77b, 0x2a77d, 0x2a77e, 0x2a780, + 0x2a782, 0x2a784, 0x2a786, 0x2a78b, 0x2a78d, 0x2a790, 0x2a792, 0x2a796, 0x2a798, + 0x2a79a, 0x2a79c, 0x2a79e, 0x2a7a0, 0x2a7a2, 0x2a7a4, 0x2a7a6, 0x2a7a8, 0x2a7b6, + 0x30100, 0x30102, 0x30104, 0x30106, 0x30108, 0x3010a, 0x3010c, 0x3010e, 0x30110, + 0x30112, 0x30114, 0x30116, 0x30118, 0x3011a, 0x3011c, 0x3011e, 0x30120, 0x30122, + 0x30124, 0x30126, 0x30128, 0x3012a, 0x3012c, 0x3012e, 0x30130, 0x30132, 0x30134, + 0x30136, 0x30139, 0x3013b, 0x3013d, 0x3013f, 0x30141, 0x30143, 0x30145, 0x30147, + 0x3014a, 0x3014c, 0x3014e, 0x30150, 0x30152, 0x30154, 0x30156, 0x30158, 0x3015a, + 0x3015c, 0x3015e, 0x30160, 0x30162, 0x30164, 0x30166, 0x30168, 0x3016a, 0x3016c, + 0x3016e, 0x30170, 0x30172, 0x30174, 0x30176, 0x30178, 0x30179, 0x3017b, 0x3017d, + 0x30181, 0x30182, 0x30184, 0x30186, 0x30187, 0x30193, 0x30194, 0x3019c, 0x3019d, + 0x3019f, 0x301a0, 0x301a2, 0x301a4, 0x301a6, 0x301a7, 0x301a9, 0x301ac, 0x301ae, + 0x301af, 0x301b5, 0x301b7, 0x301b8, 0x301bc, 0x301c4, 0x301c7, 0x301ca, 0x301cd, + 0x301cf, 0x301d1, 0x301d3, 0x301d5, 0x301d7, 0x301d9, 0x301db, 0x301de, 0x301e0, + 0x301e2, 0x301e4, 0x301e6, 0x301e8, 0x301ea, 0x301ec, 0x301ee, 0x301f1, 0x301f4, + 0x301fa, 0x301fc, 0x301fe, 0x30200, 0x30202, 0x30204, 0x30206, 0x30208, 0x3020a, + 0x3020c, 0x3020e, 0x30210, 0x30212, 0x30214, 0x30216, 0x30218, 0x3021a, 0x3021c, + 0x3021e, 0x30220, 0x30222, 0x30224, 0x30226, 0x30228, 0x3022a, 0x3022c, 0x3022e, + 0x30230, 0x30232, 0x3023a, 0x3023b, 0x3023d, 0x3023e, 0x30241, 0x30248, 0x3024a, + 0x3024c, 0x3024e, 0x30370, 0x30372, 0x30376, 0x3037f, 0x30386, 0x3038c, 0x3038e, + 0x3038f, 0x303cf, 0x303d8, 0x303da, 0x303dc, 0x303de, 0x303e0, 0x303e2, 0x303e4, + 0x303e6, 0x303e8, 0x303ea, 0x303ec, 0x303ee, 0x303f4, 0x303f7, 0x303f9, 0x303fa, + 0x30460, 0x30462, 0x30464, 0x30466, 0x30468, 0x3046a, 0x3046c, 0x3046e, 0x30470, + 0x30472, 0x30474, 0x30476, 0x30478, 0x3047a, 0x3047c, 0x3047e, 0x30480, 0x3048a, + 0x3048c, 0x3048e, 0x30490, 0x30492, 0x30494, 0x30496, 0x30498, 0x3049a, 0x3049c, + 0x3049e, 0x304a0, 0x304a2, 0x304a4, 0x304a6, 0x304a8, 0x304aa, 0x304ac, 0x304ae, + 0x304b0, 0x304b2, 0x304b4, 0x304b6, 0x304b8, 0x304ba, 0x304bc, 0x304be, 0x304c0, + 0x304c1, 0x304c3, 0x304c5, 0x304c7, 0x304c9, 0x304cb, 0x304cd, 0x304d0, 0x304d2, + 0x304d4, 0x304d6, 0x304d8, 0x304da, 0x304dc, 0x304de, 0x304e0, 0x304e2, 0x304e4, + 0x304e6, 0x304e8, 0x304ea, 0x304ec, 0x304ee, 0x304f0, 0x304f2, 0x304f4, 0x304f6, + 0x304f8, 0x304fa, 0x304fc, 0x304fe, 0x30500, 0x30502, 0x30504, 0x30506, 0x30508, + 0x3050a, 0x3050c, 0x3050e, 0x30510, 0x30512, 0x30514, 0x30516, 0x30518, 0x3051a, + 0x3051c, 0x3051e, 0x30520, 0x30522, 0x30524, 0x30526, 0x30528, 0x3052a, 0x3052c, + 0x3052e, 0x310c7, 0x310cd, 0x31e00, 0x31e02, 0x31e04, 0x31e06, 0x31e08, 0x31e0a, + 0x31e0c, 0x31e0e, 0x31e10, 0x31e12, 0x31e14, 0x31e16, 0x31e18, 0x31e1a, 0x31e1c, + 0x31e1e, 0x31e20, 0x31e22, 0x31e24, 0x31e26, 0x31e28, 0x31e2a, 0x31e2c, 0x31e2e, + 0x31e30, 0x31e32, 0x31e34, 0x31e36, 0x31e38, 0x31e3a, 0x31e3c, 0x31e3e, 0x31e40, + 0x31e42, 0x31e44, 0x31e46, 0x31e48, 0x31e4a, 0x31e4c, 0x31e4e, 0x31e50, 0x31e52, + 0x31e54, 0x31e56, 0x31e58, 0x31e5a, 0x31e5c, 0x31e5e, 0x31e60, 0x31e62, 0x31e64, + 0x31e66, 0x31e68, 0x31e6a, 0x31e6c, 0x31e6e, 0x31e70, 0x31e72, 0x31e74, 0x31e76, + 0x31e78, 0x31e7a, 0x31e7c, 0x31e7e, 0x31e80, 0x31e82, 0x31e84, 0x31e86, 0x31e88, + 0x31e8a, 0x31e8c, 0x31e8e, 0x31e90, 0x31e92, 0x31e94, 0x31e9e, 0x31ea0, 0x31ea2, + 0x31ea4, 0x31ea6, 0x31ea8, 0x31eaa, 0x31eac, 0x31eae, 0x31eb0, 0x31eb2, 0x31eb4, + 0x31eb6, 0x31eb8, 0x31eba, 0x31ebc, 0x31ebe, 0x31ec0, 0x31ec2, 0x31ec4, 0x31ec6, + 0x31ec8, 0x31eca, 0x31ecc, 0x31ece, 0x31ed0, 0x31ed2, 0x31ed4, 0x31ed6, 0x31ed8, + 0x31eda, 0x31edc, 0x31ede, 0x31ee0, 0x31ee2, 0x31ee4, 0x31ee6, 0x31ee8, 0x31eea, + 0x31eec, 0x31eee, 0x31ef0, 0x31ef2, 0x31ef4, 0x31ef6, 0x31ef8, 0x31efa, 0x31efc, + 0x31efe, 0x31f59, 0x31f5b, 0x31f5d, 0x31f5f, 0x32102, 0x32107, 0x32115, 0x32124, + 0x32126, 0x32128, 0x3213e, 0x3213f, 0x32145, 0x32183, 0x32c60, 0x32c67, 0x32c69, + 0x32c6b, 0x32c72, 0x32c75, 0x32c82, 0x32c84, 0x32c86, 0x32c88, 0x32c8a, 0x32c8c, + 0x32c8e, 0x32c90, 0x32c92, 0x32c94, 0x32c96, 0x32c98, 0x32c9a, 0x32c9c, 0x32c9e, + 0x32ca0, 0x32ca2, 0x32ca4, 0x32ca6, 0x32ca8, 0x32caa, 0x32cac, 0x32cae, 0x32cb0, + 0x32cb2, 0x32cb4, 0x32cb6, 0x32cb8, 0x32cba, 0x32cbc, 0x32cbe, 0x32cc0, 0x32cc2, + 0x32cc4, 0x32cc6, 0x32cc8, 0x32cca, 0x32ccc, 0x32cce, 0x32cd0, 0x32cd2, 0x32cd4, + 0x32cd6, 0x32cd8, 0x32cda, 0x32cdc, 0x32cde, 0x32ce0, 0x32ce2, 0x32ceb, 0x32ced, + 0x32cf2, 0x3a640, 0x3a642, 0x3a644, 0x3a646, 0x3a648, 0x3a64a, 0x3a64c, 0x3a64e, + 0x3a650, 0x3a652, 0x3a654, 0x3a656, 0x3a658, 0x3a65a, 0x3a65c, 0x3a65e, 0x3a660, + 0x3a662, 0x3a664, 0x3a666, 0x3a668, 0x3a66a, 0x3a66c, 0x3a680, 0x3a682, 0x3a684, + 0x3a686, 0x3a688, 0x3a68a, 0x3a68c, 0x3a68e, 0x3a690, 0x3a692, 0x3a694, 0x3a696, + 0x3a698, 0x3a69a, 0x3a722, 0x3a724, 0x3a726, 0x3a728, 0x3a72a, 0x3a72c, 0x3a72e, + 0x3a732, 0x3a734, 0x3a736, 0x3a738, 0x3a73a, 0x3a73c, 0x3a73e, 0x3a740, 0x3a742, + 0x3a744, 0x3a746, 0x3a748, 0x3a74a, 0x3a74c, 0x3a74e, 0x3a750, 0x3a752, 0x3a754, + 0x3a756, 0x3a758, 0x3a75a, 0x3a75c, 0x3a75e, 0x3a760, 0x3a762, 0x3a764, 0x3a766, + 0x3a768, 0x3a76a, 0x3a76c, 0x3a76e, 0x3a779, 0x3a77b, 0x3a77d, 0x3a77e, 0x3a780, + 0x3a782, 0x3a784, 0x3a786, 0x3a78b, 0x3a78d, 0x3a790, 0x3a792, 0x3a796, 0x3a798, + 0x3a79a, 0x3a79c, 0x3a79e, 0x3a7a0, 0x3a7a2, 0x3a7a4, 0x3a7a6, 0x3a7a8, 0x3a7b6, + 0x40100, 0x40102, 0x40104, 0x40106, 0x40108, 0x4010a, 0x4010c, 0x4010e, 0x40110, + 0x40112, 0x40114, 0x40116, 0x40118, 0x4011a, 0x4011c, 0x4011e, 0x40120, 0x40122, + 0x40124, 0x40126, 0x40128, 0x4012a, 0x4012c, 0x4012e, 0x40130, 0x40132, 0x40134, + 0x40136, 0x40139, 0x4013b, 0x4013d, 0x4013f, 0x40141, 0x40143, 0x40145, 0x40147, + 0x4014a, 0x4014c, 0x4014e, 0x40150, 0x40152, 0x40154, 0x40156, 0x40158, 0x4015a, + 0x4015c, 0x4015e, 0x40160, 0x40162, 0x40164, 0x40166, 0x40168, 0x4016a, 0x4016c, + 0x4016e, 0x40170, 0x40172, 0x40174, 0x40176, 0x40178, 0x40179, 0x4017b, 0x4017d, + 0x40181, 0x40182, 0x40184, 0x40186, 0x40187, 0x40193, 0x40194, 0x4019c, 0x4019d, + 0x4019f, 0x401a0, 0x401a2, 0x401a4, 0x401a6, 0x401a7, 0x401a9, 0x401ac, 0x401ae, + 0x401af, 0x401b5, 0x401b7, 0x401b8, 0x401bc, 0x401c4, 0x401c7, 0x401ca, 0x401cd, + 0x401cf, 0x401d1, 0x401d3, 0x401d5, 0x401d7, 0x401d9, 0x401db, 0x401de, 0x401e0, + 0x401e2, 0x401e4, 0x401e6, 0x401e8, 0x401ea, 0x401ec, 0x401ee, 0x401f1, 0x401f4, + 0x401fa, 0x401fc, 0x401fe, 0x40200, 0x40202, 0x40204, 0x40206, 0x40208, 0x4020a, + 0x4020c, 0x4020e, 0x40210, 0x40212, 0x40214, 0x40216, 0x40218, 0x4021a, 0x4021c, + 0x4021e, 0x40220, 0x40222, 0x40224, 0x40226, 0x40228, 0x4022a, 0x4022c, 0x4022e, + 0x40230, 0x40232, 0x4023a, 0x4023b, 0x4023d, 0x4023e, 0x40241, 0x40248, 0x4024a, + 0x4024c, 0x4024e, 0x40370, 0x40372, 0x40376, 0x4037f, 0x40386, 0x4038c, 0x4038e, + 0x4038f, 0x403cf, 0x403d8, 0x403da, 0x403dc, 0x403de, 0x403e0, 0x403e2, 0x403e4, + 0x403e6, 0x403e8, 0x403ea, 0x403ec, 0x403ee, 0x403f4, 0x403f7, 0x403f9, 0x403fa, + 0x40460, 0x40462, 0x40464, 0x40466, 0x40468, 0x4046a, 0x4046c, 0x4046e, 0x40470, + 0x40472, 0x40474, 0x40476, 0x40478, 0x4047a, 0x4047c, 0x4047e, 0x40480, 0x4048a, + 0x4048c, 0x4048e, 0x40490, 0x40492, 0x40494, 0x40496, 0x40498, 0x4049a, 0x4049c, + 0x4049e, 0x404a0, 0x404a2, 0x404a4, 0x404a6, 0x404a8, 0x404aa, 0x404ac, 0x404ae, + 0x404b0, 0x404b2, 0x404b4, 0x404b6, 0x404b8, 0x404ba, 0x404bc, 0x404be, 0x404c0, + 0x404c1, 0x404c3, 0x404c5, 0x404c7, 0x404c9, 0x404cb, 0x404cd, 0x404d0, 0x404d2, + 0x404d4, 0x404d6, 0x404d8, 0x404da, 0x404dc, 0x404de, 0x404e0, 0x404e2, 0x404e4, + 0x404e6, 0x404e8, 0x404ea, 0x404ec, 0x404ee, 0x404f0, 0x404f2, 0x404f4, 0x404f6, + 0x404f8, 0x404fa, 0x404fc, 0x404fe, 0x40500, 0x40502, 0x40504, 0x40506, 0x40508, + 0x4050a, 0x4050c, 0x4050e, 0x40510, 0x40512, 0x40514, 0x40516, 0x40518, 0x4051a, + 0x4051c, 0x4051e, 0x40520, 0x40522, 0x40524, 0x40526, 0x40528, 0x4052a, 0x4052c, + 0x4052e, 0x410c7, 0x410cd, 0x41e00, 0x41e02, 0x41e04, 0x41e06, 0x41e08, 0x41e0a, + 0x41e0c, 0x41e0e, 0x41e10, 0x41e12, 0x41e14, 0x41e16, 0x41e18, 0x41e1a, 0x41e1c, + 0x41e1e, 0x41e20, 0x41e22, 0x41e24, 0x41e26, 0x41e28, 0x41e2a, 0x41e2c, 0x41e2e, + 0x41e30, 0x41e32, 0x41e34, 0x41e36, 0x41e38, 0x41e3a, 0x41e3c, 0x41e3e, 0x41e40, + 0x41e42, 0x41e44, 0x41e46, 0x41e48, 0x41e4a, 0x41e4c, 0x41e4e, 0x41e50, 0x41e52, + 0x41e54, 0x41e56, 0x41e58, 0x41e5a, 0x41e5c, 0x41e5e, 0x41e60, 0x41e62, 0x41e64, + 0x41e66, 0x41e68, 0x41e6a, 0x41e6c, 0x41e6e, 0x41e70, 0x41e72, 0x41e74, 0x41e76, + 0x41e78, 0x41e7a, 0x41e7c, 0x41e7e, 0x41e80, 0x41e82, 0x41e84, 0x41e86, 0x41e88, + 0x41e8a, 0x41e8c, 0x41e8e, 0x41e90, 0x41e92, 0x41e94, 0x41e9e, 0x41ea0, 0x41ea2, + 0x41ea4, 0x41ea6, 0x41ea8, 0x41eaa, 0x41eac, 0x41eae, 0x41eb0, 0x41eb2, 0x41eb4, + 0x41eb6, 0x41eb8, 0x41eba, 0x41ebc, 0x41ebe, 0x41ec0, 0x41ec2, 0x41ec4, 0x41ec6, + 0x41ec8, 0x41eca, 0x41ecc, 0x41ece, 0x41ed0, 0x41ed2, 0x41ed4, 0x41ed6, 0x41ed8, + 0x41eda, 0x41edc, 0x41ede, 0x41ee0, 0x41ee2, 0x41ee4, 0x41ee6, 0x41ee8, 0x41eea, + 0x41eec, 0x41eee, 0x41ef0, 0x41ef2, 0x41ef4, 0x41ef6, 0x41ef8, 0x41efa, 0x41efc, + 0x41efe, 0x41f59, 0x41f5b, 0x41f5d, 0x41f5f, 0x42102, 0x42107, 0x42115, 0x42124, + 0x42126, 0x42128, 0x4213e, 0x4213f, 0x42145, 0x42183, 0x42c60, 0x42c67, 0x42c69, + 0x42c6b, 0x42c72, 0x42c75, 0x42c82, 0x42c84, 0x42c86, 0x42c88, 0x42c8a, 0x42c8c, + 0x42c8e, 0x42c90, 0x42c92, 0x42c94, 0x42c96, 0x42c98, 0x42c9a, 0x42c9c, 0x42c9e, + 0x42ca0, 0x42ca2, 0x42ca4, 0x42ca6, 0x42ca8, 0x42caa, 0x42cac, 0x42cae, 0x42cb0, + 0x42cb2, 0x42cb4, 0x42cb6, 0x42cb8, 0x42cba, 0x42cbc, 0x42cbe, 0x42cc0, 0x42cc2, + 0x42cc4, 0x42cc6, 0x42cc8, 0x42cca, 0x42ccc, 0x42cce, 0x42cd0, 0x42cd2, 0x42cd4, + 0x42cd6, 0x42cd8, 0x42cda, 0x42cdc, 0x42cde, 0x42ce0, 0x42ce2, 0x42ceb, 0x42ced, + 0x42cf2, 0x4a640, 0x4a642, 0x4a644, 0x4a646, 0x4a648, 0x4a64a, 0x4a64c, 0x4a64e, + 0x4a650, 0x4a652, 0x4a654, 0x4a656, 0x4a658, 0x4a65a, 0x4a65c, 0x4a65e, 0x4a660, + 0x4a662, 0x4a664, 0x4a666, 0x4a668, 0x4a66a, 0x4a66c, 0x4a680, 0x4a682, 0x4a684, + 0x4a686, 0x4a688, 0x4a68a, 0x4a68c, 0x4a68e, 0x4a690, 0x4a692, 0x4a694, 0x4a696, + 0x4a698, 0x4a69a, 0x4a722, 0x4a724, 0x4a726, 0x4a728, 0x4a72a, 0x4a72c, 0x4a72e, + 0x4a732, 0x4a734, 0x4a736, 0x4a738, 0x4a73a, 0x4a73c, 0x4a73e, 0x4a740, 0x4a742, + 0x4a744, 0x4a746, 0x4a748, 0x4a74a, 0x4a74c, 0x4a74e, 0x4a750, 0x4a752, 0x4a754, + 0x4a756, 0x4a758, 0x4a75a, 0x4a75c, 0x4a75e, 0x4a760, 0x4a762, 0x4a764, 0x4a766, + 0x4a768, 0x4a76a, 0x4a76c, 0x4a76e, 0x4a779, 0x4a77b, 0x4a77d, 0x4a77e, 0x4a780, + 0x4a782, 0x4a784, 0x4a786, 0x4a78b, 0x4a78d, 0x4a790, 0x4a792, 0x4a796, 0x4a798, + 0x4a79a, 0x4a79c, 0x4a79e, 0x4a7a0, 0x4a7a2, 0x4a7a4, 0x4a7a6, 0x4a7a8, 0x4a7b6, + 0x50100, 0x50102, 0x50104, 0x50106, 0x50108, 0x5010a, 0x5010c, 0x5010e, 0x50110, + 0x50112, 0x50114, 0x50116, 0x50118, 0x5011a, 0x5011c, 0x5011e, 0x50120, 0x50122, + 0x50124, 0x50126, 0x50128, 0x5012a, 0x5012c, 0x5012e, 0x50130, 0x50132, 0x50134, + 0x50136, 0x50139, 0x5013b, 0x5013d, 0x5013f, 0x50141, 0x50143, 0x50145, 0x50147, + 0x5014a, 0x5014c, 0x5014e, 0x50150, 0x50152, 0x50154, 0x50156, 0x50158, 0x5015a, + 0x5015c, 0x5015e, 0x50160, 0x50162, 0x50164, 0x50166, 0x50168, 0x5016a, 0x5016c, + 0x5016e, 0x50170, 0x50172, 0x50174, 0x50176, 0x50178, 0x50179, 0x5017b, 0x5017d, + 0x50181, 0x50182, 0x50184, 0x50186, 0x50187, 0x50193, 0x50194, 0x5019c, 0x5019d, + 0x5019f, 0x501a0, 0x501a2, 0x501a4, 0x501a6, 0x501a7, 0x501a9, 0x501ac, 0x501ae, + 0x501af, 0x501b5, 0x501b7, 0x501b8, 0x501bc, 0x501c4, 0x501c7, 0x501ca, 0x501cd, + 0x501cf, 0x501d1, 0x501d3, 0x501d5, 0x501d7, 0x501d9, 0x501db, 0x501de, 0x501e0, + 0x501e2, 0x501e4, 0x501e6, 0x501e8, 0x501ea, 0x501ec, 0x501ee, 0x501f1, 0x501f4, + 0x501fa, 0x501fc, 0x501fe, 0x50200, 0x50202, 0x50204, 0x50206, 0x50208, 0x5020a, + 0x5020c, 0x5020e, 0x50210, 0x50212, 0x50214, 0x50216, 0x50218, 0x5021a, 0x5021c, + 0x5021e, 0x50220, 0x50222, 0x50224, 0x50226, 0x50228, 0x5022a, 0x5022c, 0x5022e, + 0x50230, 0x50232, 0x5023a, 0x5023b, 0x5023d, 0x5023e, 0x50241, 0x50248, 0x5024a, + 0x5024c, 0x5024e, 0x50370, 0x50372, 0x50376, 0x5037f, 0x50386, 0x5038c, 0x5038e, + 0x5038f, 0x503cf, 0x503d8, 0x503da, 0x503dc, 0x503de, 0x503e0, 0x503e2, 0x503e4, + 0x503e6, 0x503e8, 0x503ea, 0x503ec, 0x503ee, 0x503f4, 0x503f7, 0x503f9, 0x503fa, + 0x50460, 0x50462, 0x50464, 0x50466, 0x50468, 0x5046a, 0x5046c, 0x5046e, 0x50470, + 0x50472, 0x50474, 0x50476, 0x50478, 0x5047a, 0x5047c, 0x5047e, 0x50480, 0x5048a, + 0x5048c, 0x5048e, 0x50490, 0x50492, 0x50494, 0x50496, 0x50498, 0x5049a, 0x5049c, + 0x5049e, 0x504a0, 0x504a2, 0x504a4, 0x504a6, 0x504a8, 0x504aa, 0x504ac, 0x504ae, + 0x504b0, 0x504b2, 0x504b4, 0x504b6, 0x504b8, 0x504ba, 0x504bc, 0x504be, 0x504c0, + 0x504c1, 0x504c3, 0x504c5, 0x504c7, 0x504c9, 0x504cb, 0x504cd, 0x504d0, 0x504d2, + 0x504d4, 0x504d6, 0x504d8, 0x504da, 0x504dc, 0x504de, 0x504e0, 0x504e2, 0x504e4, + 0x504e6, 0x504e8, 0x504ea, 0x504ec, 0x504ee, 0x504f0, 0x504f2, 0x504f4, 0x504f6, + 0x504f8, 0x504fa, 0x504fc, 0x504fe, 0x50500, 0x50502, 0x50504, 0x50506, 0x50508, + 0x5050a, 0x5050c, 0x5050e, 0x50510, 0x50512, 0x50514, 0x50516, 0x50518, 0x5051a, + 0x5051c, 0x5051e, 0x50520, 0x50522, 0x50524, 0x50526, 0x50528, 0x5052a, 0x5052c, + 0x5052e, 0x510c7, 0x510cd, 0x51e00, 0x51e02, 0x51e04, 0x51e06, 0x51e08, 0x51e0a, + 0x51e0c, 0x51e0e, 0x51e10, 0x51e12, 0x51e14, 0x51e16, 0x51e18, 0x51e1a, 0x51e1c, + 0x51e1e, 0x51e20, 0x51e22, 0x51e24, 0x51e26, 0x51e28, 0x51e2a, 0x51e2c, 0x51e2e, + 0x51e30, 0x51e32, 0x51e34, 0x51e36, 0x51e38, 0x51e3a, 0x51e3c, 0x51e3e, 0x51e40, + 0x51e42, 0x51e44, 0x51e46, 0x51e48, 0x51e4a, 0x51e4c, 0x51e4e, 0x51e50, 0x51e52, + 0x51e54, 0x51e56, 0x51e58, 0x51e5a, 0x51e5c, 0x51e5e, 0x51e60, 0x51e62, 0x51e64, + 0x51e66, 0x51e68, 0x51e6a, 0x51e6c, 0x51e6e, 0x51e70, 0x51e72, 0x51e74, 0x51e76, + 0x51e78, 0x51e7a, 0x51e7c, 0x51e7e, 0x51e80, 0x51e82, 0x51e84, 0x51e86, 0x51e88, + 0x51e8a, 0x51e8c, 0x51e8e, 0x51e90, 0x51e92, 0x51e94, 0x51e9e, 0x51ea0, 0x51ea2, + 0x51ea4, 0x51ea6, 0x51ea8, 0x51eaa, 0x51eac, 0x51eae, 0x51eb0, 0x51eb2, 0x51eb4, + 0x51eb6, 0x51eb8, 0x51eba, 0x51ebc, 0x51ebe, 0x51ec0, 0x51ec2, 0x51ec4, 0x51ec6, + 0x51ec8, 0x51eca, 0x51ecc, 0x51ece, 0x51ed0, 0x51ed2, 0x51ed4, 0x51ed6, 0x51ed8, + 0x51eda, 0x51edc, 0x51ede, 0x51ee0, 0x51ee2, 0x51ee4, 0x51ee6, 0x51ee8, 0x51eea, + 0x51eec, 0x51eee, 0x51ef0, 0x51ef2, 0x51ef4, 0x51ef6, 0x51ef8, 0x51efa, 0x51efc, + 0x51efe, 0x51f59, 0x51f5b, 0x51f5d, 0x51f5f, 0x52102, 0x52107, 0x52115, 0x52124, + 0x52126, 0x52128, 0x5213e, 0x5213f, 0x52145, 0x52183, 0x52c60, 0x52c67, 0x52c69, + 0x52c6b, 0x52c72, 0x52c75, 0x52c82, 0x52c84, 0x52c86, 0x52c88, 0x52c8a, 0x52c8c, + 0x52c8e, 0x52c90, 0x52c92, 0x52c94, 0x52c96, 0x52c98, 0x52c9a, 0x52c9c, 0x52c9e, + 0x52ca0, 0x52ca2, 0x52ca4, 0x52ca6, 0x52ca8, 0x52caa, 0x52cac, 0x52cae, 0x52cb0, + 0x52cb2, 0x52cb4, 0x52cb6, 0x52cb8, 0x52cba, 0x52cbc, 0x52cbe, 0x52cc0, 0x52cc2, + 0x52cc4, 0x52cc6, 0x52cc8, 0x52cca, 0x52ccc, 0x52cce, 0x52cd0, 0x52cd2, 0x52cd4, + 0x52cd6, 0x52cd8, 0x52cda, 0x52cdc, 0x52cde, 0x52ce0, 0x52ce2, 0x52ceb, 0x52ced, + 0x52cf2, 0x5a640, 0x5a642, 0x5a644, 0x5a646, 0x5a648, 0x5a64a, 0x5a64c, 0x5a64e, + 0x5a650, 0x5a652, 0x5a654, 0x5a656, 0x5a658, 0x5a65a, 0x5a65c, 0x5a65e, 0x5a660, + 0x5a662, 0x5a664, 0x5a666, 0x5a668, 0x5a66a, 0x5a66c, 0x5a680, 0x5a682, 0x5a684, + 0x5a686, 0x5a688, 0x5a68a, 0x5a68c, 0x5a68e, 0x5a690, 0x5a692, 0x5a694, 0x5a696, + 0x5a698, 0x5a69a, 0x5a722, 0x5a724, 0x5a726, 0x5a728, 0x5a72a, 0x5a72c, 0x5a72e, + 0x5a732, 0x5a734, 0x5a736, 0x5a738, 0x5a73a, 0x5a73c, 0x5a73e, 0x5a740, 0x5a742, + 0x5a744, 0x5a746, 0x5a748, 0x5a74a, 0x5a74c, 0x5a74e, 0x5a750, 0x5a752, 0x5a754, + 0x5a756, 0x5a758, 0x5a75a, 0x5a75c, 0x5a75e, 0x5a760, 0x5a762, 0x5a764, 0x5a766, + 0x5a768, 0x5a76a, 0x5a76c, 0x5a76e, 0x5a779, 0x5a77b, 0x5a77d, 0x5a77e, 0x5a780, + 0x5a782, 0x5a784, 0x5a786, 0x5a78b, 0x5a78d, 0x5a790, 0x5a792, 0x5a796, 0x5a798, + 0x5a79a, 0x5a79c, 0x5a79e, 0x5a7a0, 0x5a7a2, 0x5a7a4, 0x5a7a6, 0x5a7a8, 0x5a7b6, + 0x60100, 0x60102, 0x60104, 0x60106, 0x60108, 0x6010a, 0x6010c, 0x6010e, 0x60110, + 0x60112, 0x60114, 0x60116, 0x60118, 0x6011a, 0x6011c, 0x6011e, 0x60120, 0x60122, + 0x60124, 0x60126, 0x60128, 0x6012a, 0x6012c, 0x6012e, 0x60130, 0x60132, 0x60134, + 0x60136, 0x60139, 0x6013b, 0x6013d, 0x6013f, 0x60141, 0x60143, 0x60145, 0x60147, + 0x6014a, 0x6014c, 0x6014e, 0x60150, 0x60152, 0x60154, 0x60156, 0x60158, 0x6015a, + 0x6015c, 0x6015e, 0x60160, 0x60162, 0x60164, 0x60166, 0x60168, 0x6016a, 0x6016c, + 0x6016e, 0x60170, 0x60172, 0x60174, 0x60176, 0x60178, 0x60179, 0x6017b, 0x6017d, + 0x60181, 0x60182, 0x60184, 0x60186, 0x60187, 0x60193, 0x60194, 0x6019c, 0x6019d, + 0x6019f, 0x601a0, 0x601a2, 0x601a4, 0x601a6, 0x601a7, 0x601a9, 0x601ac, 0x601ae, + 0x601af, 0x601b5, 0x601b7, 0x601b8, 0x601bc, 0x601c4, 0x601c7, 0x601ca, 0x601cd, + 0x601cf, 0x601d1, 0x601d3, 0x601d5, 0x601d7, 0x601d9, 0x601db, 0x601de, 0x601e0, + 0x601e2, 0x601e4, 0x601e6, 0x601e8, 0x601ea, 0x601ec, 0x601ee, 0x601f1, 0x601f4, + 0x601fa, 0x601fc, 0x601fe, 0x60200, 0x60202, 0x60204, 0x60206, 0x60208, 0x6020a, + 0x6020c, 0x6020e, 0x60210, 0x60212, 0x60214, 0x60216, 0x60218, 0x6021a, 0x6021c, + 0x6021e, 0x60220, 0x60222, 0x60224, 0x60226, 0x60228, 0x6022a, 0x6022c, 0x6022e, + 0x60230, 0x60232, 0x6023a, 0x6023b, 0x6023d, 0x6023e, 0x60241, 0x60248, 0x6024a, + 0x6024c, 0x6024e, 0x60370, 0x60372, 0x60376, 0x6037f, 0x60386, 0x6038c, 0x6038e, + 0x6038f, 0x603cf, 0x603d8, 0x603da, 0x603dc, 0x603de, 0x603e0, 0x603e2, 0x603e4, + 0x603e6, 0x603e8, 0x603ea, 0x603ec, 0x603ee, 0x603f4, 0x603f7, 0x603f9, 0x603fa, + 0x60460, 0x60462, 0x60464, 0x60466, 0x60468, 0x6046a, 0x6046c, 0x6046e, 0x60470, + 0x60472, 0x60474, 0x60476, 0x60478, 0x6047a, 0x6047c, 0x6047e, 0x60480, 0x6048a, + 0x6048c, 0x6048e, 0x60490, 0x60492, 0x60494, 0x60496, 0x60498, 0x6049a, 0x6049c, + 0x6049e, 0x604a0, 0x604a2, 0x604a4, 0x604a6, 0x604a8, 0x604aa, 0x604ac, 0x604ae, + 0x604b0, 0x604b2, 0x604b4, 0x604b6, 0x604b8, 0x604ba, 0x604bc, 0x604be, 0x604c0, + 0x604c1, 0x604c3, 0x604c5, 0x604c7, 0x604c9, 0x604cb, 0x604cd, 0x604d0, 0x604d2, + 0x604d4, 0x604d6, 0x604d8, 0x604da, 0x604dc, 0x604de, 0x604e0, 0x604e2, 0x604e4, + 0x604e6, 0x604e8, 0x604ea, 0x604ec, 0x604ee, 0x604f0, 0x604f2, 0x604f4, 0x604f6, + 0x604f8, 0x604fa, 0x604fc, 0x604fe, 0x60500, 0x60502, 0x60504, 0x60506, 0x60508, + 0x6050a, 0x6050c, 0x6050e, 0x60510, 0x60512, 0x60514, 0x60516, 0x60518, 0x6051a, + 0x6051c, 0x6051e, 0x60520, 0x60522, 0x60524, 0x60526, 0x60528, 0x6052a, 0x6052c, + 0x6052e, 0x610c7, 0x610cd, 0x61e00, 0x61e02, 0x61e04, 0x61e06, 0x61e08, 0x61e0a, + 0x61e0c, 0x61e0e, 0x61e10, 0x61e12, 0x61e14, 0x61e16, 0x61e18, 0x61e1a, 0x61e1c, + 0x61e1e, 0x61e20, 0x61e22, 0x61e24, 0x61e26, 0x61e28, 0x61e2a, 0x61e2c, 0x61e2e, + 0x61e30, 0x61e32, 0x61e34, 0x61e36, 0x61e38, 0x61e3a, 0x61e3c, 0x61e3e, 0x61e40, + 0x61e42, 0x61e44, 0x61e46, 0x61e48, 0x61e4a, 0x61e4c, 0x61e4e, 0x61e50, 0x61e52, + 0x61e54, 0x61e56, 0x61e58, 0x61e5a, 0x61e5c, 0x61e5e, 0x61e60, 0x61e62, 0x61e64, + 0x61e66, 0x61e68, 0x61e6a, 0x61e6c, 0x61e6e, 0x61e70, 0x61e72, 0x61e74, 0x61e76, + 0x61e78, 0x61e7a, 0x61e7c, 0x61e7e, 0x61e80, 0x61e82, 0x61e84, 0x61e86, 0x61e88, + 0x61e8a, 0x61e8c, 0x61e8e, 0x61e90, 0x61e92, 0x61e94, 0x61e9e, 0x61ea0, 0x61ea2, + 0x61ea4, 0x61ea6, 0x61ea8, 0x61eaa, 0x61eac, 0x61eae, 0x61eb0, 0x61eb2, 0x61eb4, + 0x61eb6, 0x61eb8, 0x61eba, 0x61ebc, 0x61ebe, 0x61ec0, 0x61ec2, 0x61ec4, 0x61ec6, + 0x61ec8, 0x61eca, 0x61ecc, 0x61ece, 0x61ed0, 0x61ed2, 0x61ed4, 0x61ed6, 0x61ed8, + 0x61eda, 0x61edc, 0x61ede, 0x61ee0, 0x61ee2, 0x61ee4, 0x61ee6, 0x61ee8, 0x61eea, + 0x61eec, 0x61eee, 0x61ef0, 0x61ef2, 0x61ef4, 0x61ef6, 0x61ef8, 0x61efa, 0x61efc, + 0x61efe, 0x61f59, 0x61f5b, 0x61f5d, 0x61f5f, 0x62102, 0x62107, 0x62115, 0x62124, + 0x62126, 0x62128, 0x6213e, 0x6213f, 0x62145, 0x62183, 0x62c60, 0x62c67, 0x62c69, + 0x62c6b, 0x62c72, 0x62c75, 0x62c82, 0x62c84, 0x62c86, 0x62c88, 0x62c8a, 0x62c8c, + 0x62c8e, 0x62c90, 0x62c92, 0x62c94, 0x62c96, 0x62c98, 0x62c9a, 0x62c9c, 0x62c9e, + 0x62ca0, 0x62ca2, 0x62ca4, 0x62ca6, 0x62ca8, 0x62caa, 0x62cac, 0x62cae, 0x62cb0, + 0x62cb2, 0x62cb4, 0x62cb6, 0x62cb8, 0x62cba, 0x62cbc, 0x62cbe, 0x62cc0, 0x62cc2, + 0x62cc4, 0x62cc6, 0x62cc8, 0x62cca, 0x62ccc, 0x62cce, 0x62cd0, 0x62cd2, 0x62cd4, + 0x62cd6, 0x62cd8, 0x62cda, 0x62cdc, 0x62cde, 0x62ce0, 0x62ce2, 0x62ceb, 0x62ced, + 0x62cf2, 0x6a640, 0x6a642, 0x6a644, 0x6a646, 0x6a648, 0x6a64a, 0x6a64c, 0x6a64e, + 0x6a650, 0x6a652, 0x6a654, 0x6a656, 0x6a658, 0x6a65a, 0x6a65c, 0x6a65e, 0x6a660, + 0x6a662, 0x6a664, 0x6a666, 0x6a668, 0x6a66a, 0x6a66c, 0x6a680, 0x6a682, 0x6a684, + 0x6a686, 0x6a688, 0x6a68a, 0x6a68c, 0x6a68e, 0x6a690, 0x6a692, 0x6a694, 0x6a696, + 0x6a698, 0x6a69a, 0x6a722, 0x6a724, 0x6a726, 0x6a728, 0x6a72a, 0x6a72c, 0x6a72e, + 0x6a732, 0x6a734, 0x6a736, 0x6a738, 0x6a73a, 0x6a73c, 0x6a73e, 0x6a740, 0x6a742, + 0x6a744, 0x6a746, 0x6a748, 0x6a74a, 0x6a74c, 0x6a74e, 0x6a750, 0x6a752, 0x6a754, + 0x6a756, 0x6a758, 0x6a75a, 0x6a75c, 0x6a75e, 0x6a760, 0x6a762, 0x6a764, 0x6a766, + 0x6a768, 0x6a76a, 0x6a76c, 0x6a76e, 0x6a779, 0x6a77b, 0x6a77d, 0x6a77e, 0x6a780, + 0x6a782, 0x6a784, 0x6a786, 0x6a78b, 0x6a78d, 0x6a790, 0x6a792, 0x6a796, 0x6a798, + 0x6a79a, 0x6a79c, 0x6a79e, 0x6a7a0, 0x6a7a2, 0x6a7a4, 0x6a7a6, 0x6a7a8, 0x6a7b6, + 0x70100, 0x70102, 0x70104, 0x70106, 0x70108, 0x7010a, 0x7010c, 0x7010e, 0x70110, + 0x70112, 0x70114, 0x70116, 0x70118, 0x7011a, 0x7011c, 0x7011e, 0x70120, 0x70122, + 0x70124, 0x70126, 0x70128, 0x7012a, 0x7012c, 0x7012e, 0x70130, 0x70132, 0x70134, + 0x70136, 0x70139, 0x7013b, 0x7013d, 0x7013f, 0x70141, 0x70143, 0x70145, 0x70147, + 0x7014a, 0x7014c, 0x7014e, 0x70150, 0x70152, 0x70154, 0x70156, 0x70158, 0x7015a, + 0x7015c, 0x7015e, 0x70160, 0x70162, 0x70164, 0x70166, 0x70168, 0x7016a, 0x7016c, + 0x7016e, 0x70170, 0x70172, 0x70174, 0x70176, 0x70178, 0x70179, 0x7017b, 0x7017d, + 0x70181, 0x70182, 0x70184, 0x70186, 0x70187, 0x70193, 0x70194, 0x7019c, 0x7019d, + 0x7019f, 0x701a0, 0x701a2, 0x701a4, 0x701a6, 0x701a7, 0x701a9, 0x701ac, 0x701ae, + 0x701af, 0x701b5, 0x701b7, 0x701b8, 0x701bc, 0x701c4, 0x701c7, 0x701ca, 0x701cd, + 0x701cf, 0x701d1, 0x701d3, 0x701d5, 0x701d7, 0x701d9, 0x701db, 0x701de, 0x701e0, + 0x701e2, 0x701e4, 0x701e6, 0x701e8, 0x701ea, 0x701ec, 0x701ee, 0x701f1, 0x701f4, + 0x701fa, 0x701fc, 0x701fe, 0x70200, 0x70202, 0x70204, 0x70206, 0x70208, 0x7020a, + 0x7020c, 0x7020e, 0x70210, 0x70212, 0x70214, 0x70216, 0x70218, 0x7021a, 0x7021c, + 0x7021e, 0x70220, 0x70222, 0x70224, 0x70226, 0x70228, 0x7022a, 0x7022c, 0x7022e, + 0x70230, 0x70232, 0x7023a, 0x7023b, 0x7023d, 0x7023e, 0x70241, 0x70248, 0x7024a, + 0x7024c, 0x7024e, 0x70370, 0x70372, 0x70376, 0x7037f, 0x70386, 0x7038c, 0x7038e, + 0x7038f, 0x703cf, 0x703d8, 0x703da, 0x703dc, 0x703de, 0x703e0, 0x703e2, 0x703e4, + 0x703e6, 0x703e8, 0x703ea, 0x703ec, 0x703ee, 0x703f4, 0x703f7, 0x703f9, 0x703fa, + 0x70460, 0x70462, 0x70464, 0x70466, 0x70468, 0x7046a, 0x7046c, 0x7046e, 0x70470, + 0x70472, 0x70474, 0x70476, 0x70478, 0x7047a, 0x7047c, 0x7047e, 0x70480, 0x7048a, + 0x7048c, 0x7048e, 0x70490, 0x70492, 0x70494, 0x70496, 0x70498, 0x7049a, 0x7049c, + 0x7049e, 0x704a0, 0x704a2, 0x704a4, 0x704a6, 0x704a8, 0x704aa, 0x704ac, 0x704ae, + 0x704b0, 0x704b2, 0x704b4, 0x704b6, 0x704b8, 0x704ba, 0x704bc, 0x704be, 0x704c0, + 0x704c1, 0x704c3, 0x704c5, 0x704c7, 0x704c9, 0x704cb, 0x704cd, 0x704d0, 0x704d2, + 0x704d4, 0x704d6, 0x704d8, 0x704da, 0x704dc, 0x704de, 0x704e0, 0x704e2, 0x704e4, + 0x704e6, 0x704e8, 0x704ea, 0x704ec, 0x704ee, 0x704f0, 0x704f2, 0x704f4, 0x704f6, + 0x704f8, 0x704fa, 0x704fc, 0x704fe, 0x70500, 0x70502, 0x70504, 0x70506, 0x70508, + 0x7050a, 0x7050c, 0x7050e, 0x70510, 0x70512, 0x70514, 0x70516, 0x70518, 0x7051a, + 0x7051c, 0x7051e, 0x70520, 0x70522, 0x70524, 0x70526, 0x70528, 0x7052a, 0x7052c, + 0x7052e, 0x710c7, 0x710cd, 0x71e00, 0x71e02, 0x71e04, 0x71e06, 0x71e08, 0x71e0a, + 0x71e0c, 0x71e0e, 0x71e10, 0x71e12, 0x71e14, 0x71e16, 0x71e18, 0x71e1a, 0x71e1c, + 0x71e1e, 0x71e20, 0x71e22, 0x71e24, 0x71e26, 0x71e28, 0x71e2a, 0x71e2c, 0x71e2e, + 0x71e30, 0x71e32, 0x71e34, 0x71e36, 0x71e38, 0x71e3a, 0x71e3c, 0x71e3e, 0x71e40, + 0x71e42, 0x71e44, 0x71e46, 0x71e48, 0x71e4a, 0x71e4c, 0x71e4e, 0x71e50, 0x71e52, + 0x71e54, 0x71e56, 0x71e58, 0x71e5a, 0x71e5c, 0x71e5e, 0x71e60, 0x71e62, 0x71e64, + 0x71e66, 0x71e68, 0x71e6a, 0x71e6c, 0x71e6e, 0x71e70, 0x71e72, 0x71e74, 0x71e76, + 0x71e78, 0x71e7a, 0x71e7c, 0x71e7e, 0x71e80, 0x71e82, 0x71e84, 0x71e86, 0x71e88, + 0x71e8a, 0x71e8c, 0x71e8e, 0x71e90, 0x71e92, 0x71e94, 0x71e9e, 0x71ea0, 0x71ea2, + 0x71ea4, 0x71ea6, 0x71ea8, 0x71eaa, 0x71eac, 0x71eae, 0x71eb0, 0x71eb2, 0x71eb4, + 0x71eb6, 0x71eb8, 0x71eba, 0x71ebc, 0x71ebe, 0x71ec0, 0x71ec2, 0x71ec4, 0x71ec6, + 0x71ec8, 0x71eca, 0x71ecc, 0x71ece, 0x71ed0, 0x71ed2, 0x71ed4, 0x71ed6, 0x71ed8, + 0x71eda, 0x71edc, 0x71ede, 0x71ee0, 0x71ee2, 0x71ee4, 0x71ee6, 0x71ee8, 0x71eea, + 0x71eec, 0x71eee, 0x71ef0, 0x71ef2, 0x71ef4, 0x71ef6, 0x71ef8, 0x71efa, 0x71efc, + 0x71efe, 0x71f59, 0x71f5b, 0x71f5d, 0x71f5f, 0x72102, 0x72107, 0x72115, 0x72124, + 0x72126, 0x72128, 0x7213e, 0x7213f, 0x72145, 0x72183, 0x72c60, 0x72c67, 0x72c69, + 0x72c6b, 0x72c72, 0x72c75, 0x72c82, 0x72c84, 0x72c86, 0x72c88, 0x72c8a, 0x72c8c, + 0x72c8e, 0x72c90, 0x72c92, 0x72c94, 0x72c96, 0x72c98, 0x72c9a, 0x72c9c, 0x72c9e, + 0x72ca0, 0x72ca2, 0x72ca4, 0x72ca6, 0x72ca8, 0x72caa, 0x72cac, 0x72cae, 0x72cb0, + 0x72cb2, 0x72cb4, 0x72cb6, 0x72cb8, 0x72cba, 0x72cbc, 0x72cbe, 0x72cc0, 0x72cc2, + 0x72cc4, 0x72cc6, 0x72cc8, 0x72cca, 0x72ccc, 0x72cce, 0x72cd0, 0x72cd2, 0x72cd4, + 0x72cd6, 0x72cd8, 0x72cda, 0x72cdc, 0x72cde, 0x72ce0, 0x72ce2, 0x72ceb, 0x72ced, + 0x72cf2, 0x7a640, 0x7a642, 0x7a644, 0x7a646, 0x7a648, 0x7a64a, 0x7a64c, 0x7a64e, + 0x7a650, 0x7a652, 0x7a654, 0x7a656, 0x7a658, 0x7a65a, 0x7a65c, 0x7a65e, 0x7a660, + 0x7a662, 0x7a664, 0x7a666, 0x7a668, 0x7a66a, 0x7a66c, 0x7a680, 0x7a682, 0x7a684, + 0x7a686, 0x7a688, 0x7a68a, 0x7a68c, 0x7a68e, 0x7a690, 0x7a692, 0x7a694, 0x7a696, + 0x7a698, 0x7a69a, 0x7a722, 0x7a724, 0x7a726, 0x7a728, 0x7a72a, 0x7a72c, 0x7a72e, + 0x7a732, 0x7a734, 0x7a736, 0x7a738, 0x7a73a, 0x7a73c, 0x7a73e, 0x7a740, 0x7a742, + 0x7a744, 0x7a746, 0x7a748, 0x7a74a, 0x7a74c, 0x7a74e, 0x7a750, 0x7a752, 0x7a754, + 0x7a756, 0x7a758, 0x7a75a, 0x7a75c, 0x7a75e, 0x7a760, 0x7a762, 0x7a764, 0x7a766, + 0x7a768, 0x7a76a, 0x7a76c, 0x7a76e, 0x7a779, 0x7a77b, 0x7a77d, 0x7a77e, 0x7a780, + 0x7a782, 0x7a784, 0x7a786, 0x7a78b, 0x7a78d, 0x7a790, 0x7a792, 0x7a796, 0x7a798, + 0x7a79a, 0x7a79c, 0x7a79e, 0x7a7a0, 0x7a7a2, 0x7a7a4, 0x7a7a6, 0x7a7a8, 0x7a7b6, + 0x80100, 0x80102, 0x80104, 0x80106, 0x80108, 0x8010a, 0x8010c, 0x8010e, 0x80110, + 0x80112, 0x80114, 0x80116, 0x80118, 0x8011a, 0x8011c, 0x8011e, 0x80120, 0x80122, + 0x80124, 0x80126, 0x80128, 0x8012a, 0x8012c, 0x8012e, 0x80130, 0x80132, 0x80134, + 0x80136, 0x80139, 0x8013b, 0x8013d, 0x8013f, 0x80141, 0x80143, 0x80145, 0x80147, + 0x8014a, 0x8014c, 0x8014e, 0x80150, 0x80152, 0x80154, 0x80156, 0x80158, 0x8015a, + 0x8015c, 0x8015e, 0x80160, 0x80162, 0x80164, 0x80166, 0x80168, 0x8016a, 0x8016c, + 0x8016e, 0x80170, 0x80172, 0x80174, 0x80176, 0x80178, 0x80179, 0x8017b, 0x8017d, + 0x80181, 0x80182, 0x80184, 0x80186, 0x80187, 0x80193, 0x80194, 0x8019c, 0x8019d, + 0x8019f, 0x801a0, 0x801a2, 0x801a4, 0x801a6, 0x801a7, 0x801a9, 0x801ac, 0x801ae, + 0x801af, 0x801b5, 0x801b7, 0x801b8, 0x801bc, 0x801c4, 0x801c7, 0x801ca, 0x801cd, + 0x801cf, 0x801d1, 0x801d3, 0x801d5, 0x801d7, 0x801d9, 0x801db, 0x801de, 0x801e0, + 0x801e2, 0x801e4, 0x801e6, 0x801e8, 0x801ea, 0x801ec, 0x801ee, 0x801f1, 0x801f4, + 0x801fa, 0x801fc, 0x801fe, 0x80200, 0x80202, 0x80204, 0x80206, 0x80208, 0x8020a, + 0x8020c, 0x8020e, 0x80210, 0x80212, 0x80214, 0x80216, 0x80218, 0x8021a, 0x8021c, + 0x8021e, 0x80220, 0x80222, 0x80224, 0x80226, 0x80228, 0x8022a, 0x8022c, 0x8022e, + 0x80230, 0x80232, 0x8023a, 0x8023b, 0x8023d, 0x8023e, 0x80241, 0x80248, 0x8024a, + 0x8024c, 0x8024e, 0x80370, 0x80372, 0x80376, 0x8037f, 0x80386, 0x8038c, 0x8038e, + 0x8038f, 0x803cf, 0x803d8, 0x803da, 0x803dc, 0x803de, 0x803e0, 0x803e2, 0x803e4, + 0x803e6, 0x803e8, 0x803ea, 0x803ec, 0x803ee, 0x803f4, 0x803f7, 0x803f9, 0x803fa, + 0x80460, 0x80462, 0x80464, 0x80466, 0x80468, 0x8046a, 0x8046c, 0x8046e, 0x80470, + 0x80472, 0x80474, 0x80476, 0x80478, 0x8047a, 0x8047c, 0x8047e, 0x80480, 0x8048a, + 0x8048c, 0x8048e, 0x80490, 0x80492, 0x80494, 0x80496, 0x80498, 0x8049a, 0x8049c, + 0x8049e, 0x804a0, 0x804a2, 0x804a4, 0x804a6, 0x804a8, 0x804aa, 0x804ac, 0x804ae, + 0x804b0, 0x804b2, 0x804b4, 0x804b6, 0x804b8, 0x804ba, 0x804bc, 0x804be, 0x804c0, + 0x804c1, 0x804c3, 0x804c5, 0x804c7, 0x804c9, 0x804cb, 0x804cd, 0x804d0, 0x804d2, + 0x804d4, 0x804d6, 0x804d8, 0x804da, 0x804dc, 0x804de, 0x804e0, 0x804e2, 0x804e4, + 0x804e6, 0x804e8, 0x804ea, 0x804ec, 0x804ee, 0x804f0, 0x804f2, 0x804f4, 0x804f6, + 0x804f8, 0x804fa, 0x804fc, 0x804fe, 0x80500, 0x80502, 0x80504, 0x80506, 0x80508, + 0x8050a, 0x8050c, 0x8050e, 0x80510, 0x80512, 0x80514, 0x80516, 0x80518, 0x8051a, + 0x8051c, 0x8051e, 0x80520, 0x80522, 0x80524, 0x80526, 0x80528, 0x8052a, 0x8052c, + 0x8052e, 0x810c7, 0x810cd, 0x81e00, 0x81e02, 0x81e04, 0x81e06, 0x81e08, 0x81e0a, + 0x81e0c, 0x81e0e, 0x81e10, 0x81e12, 0x81e14, 0x81e16, 0x81e18, 0x81e1a, 0x81e1c, + 0x81e1e, 0x81e20, 0x81e22, 0x81e24, 0x81e26, 0x81e28, 0x81e2a, 0x81e2c, 0x81e2e, + 0x81e30, 0x81e32, 0x81e34, 0x81e36, 0x81e38, 0x81e3a, 0x81e3c, 0x81e3e, 0x81e40, + 0x81e42, 0x81e44, 0x81e46, 0x81e48, 0x81e4a, 0x81e4c, 0x81e4e, 0x81e50, 0x81e52, + 0x81e54, 0x81e56, 0x81e58, 0x81e5a, 0x81e5c, 0x81e5e, 0x81e60, 0x81e62, 0x81e64, + 0x81e66, 0x81e68, 0x81e6a, 0x81e6c, 0x81e6e, 0x81e70, 0x81e72, 0x81e74, 0x81e76, + 0x81e78, 0x81e7a, 0x81e7c, 0x81e7e, 0x81e80, 0x81e82, 0x81e84, 0x81e86, 0x81e88, + 0x81e8a, 0x81e8c, 0x81e8e, 0x81e90, 0x81e92, 0x81e94, 0x81e9e, 0x81ea0, 0x81ea2, + 0x81ea4, 0x81ea6, 0x81ea8, 0x81eaa, 0x81eac, 0x81eae, 0x81eb0, 0x81eb2, 0x81eb4, + 0x81eb6, 0x81eb8, 0x81eba, 0x81ebc, 0x81ebe, 0x81ec0, 0x81ec2, 0x81ec4, 0x81ec6, + 0x81ec8, 0x81eca, 0x81ecc, 0x81ece, 0x81ed0, 0x81ed2, 0x81ed4, 0x81ed6, 0x81ed8, + 0x81eda, 0x81edc, 0x81ede, 0x81ee0, 0x81ee2, 0x81ee4, 0x81ee6, 0x81ee8, 0x81eea, + 0x81eec, 0x81eee, 0x81ef0, 0x81ef2, 0x81ef4, 0x81ef6, 0x81ef8, 0x81efa, 0x81efc, + 0x81efe, 0x81f59, 0x81f5b, 0x81f5d, 0x81f5f, 0x82102, 0x82107, 0x82115, 0x82124, + 0x82126, 0x82128, 0x8213e, 0x8213f, 0x82145, 0x82183, 0x82c60, 0x82c67, 0x82c69, + 0x82c6b, 0x82c72, 0x82c75, 0x82c82, 0x82c84, 0x82c86, 0x82c88, 0x82c8a, 0x82c8c, + 0x82c8e, 0x82c90, 0x82c92, 0x82c94, 0x82c96, 0x82c98, 0x82c9a, 0x82c9c, 0x82c9e, + 0x82ca0, 0x82ca2, 0x82ca4, 0x82ca6, 0x82ca8, 0x82caa, 0x82cac, 0x82cae, 0x82cb0, + 0x82cb2, 0x82cb4, 0x82cb6, 0x82cb8, 0x82cba, 0x82cbc, 0x82cbe, 0x82cc0, 0x82cc2, + 0x82cc4, 0x82cc6, 0x82cc8, 0x82cca, 0x82ccc, 0x82cce, 0x82cd0, 0x82cd2, 0x82cd4, + 0x82cd6, 0x82cd8, 0x82cda, 0x82cdc, 0x82cde, 0x82ce0, 0x82ce2, 0x82ceb, 0x82ced, + 0x82cf2, 0x8a640, 0x8a642, 0x8a644, 0x8a646, 0x8a648, 0x8a64a, 0x8a64c, 0x8a64e, + 0x8a650, 0x8a652, 0x8a654, 0x8a656, 0x8a658, 0x8a65a, 0x8a65c, 0x8a65e, 0x8a660, + 0x8a662, 0x8a664, 0x8a666, 0x8a668, 0x8a66a, 0x8a66c, 0x8a680, 0x8a682, 0x8a684, + 0x8a686, 0x8a688, 0x8a68a, 0x8a68c, 0x8a68e, 0x8a690, 0x8a692, 0x8a694, 0x8a696, + 0x8a698, 0x8a69a, 0x8a722, 0x8a724, 0x8a726, 0x8a728, 0x8a72a, 0x8a72c, 0x8a72e, + 0x8a732, 0x8a734, 0x8a736, 0x8a738, 0x8a73a, 0x8a73c, 0x8a73e, 0x8a740, 0x8a742, + 0x8a744, 0x8a746, 0x8a748, 0x8a74a, 0x8a74c, 0x8a74e, 0x8a750, 0x8a752, 0x8a754, + 0x8a756, 0x8a758, 0x8a75a, 0x8a75c, 0x8a75e, 0x8a760, 0x8a762, 0x8a764, 0x8a766, + 0x8a768, 0x8a76a, 0x8a76c, 0x8a76e, 0x8a779, 0x8a77b, 0x8a77d, 0x8a77e, 0x8a780, + 0x8a782, 0x8a784, 0x8a786, 0x8a78b, 0x8a78d, 0x8a790, 0x8a792, 0x8a796, 0x8a798, + 0x8a79a, 0x8a79c, 0x8a79e, 0x8a7a0, 0x8a7a2, 0x8a7a4, 0x8a7a6, 0x8a7a8, 0x8a7b6, + 0x90100, 0x90102, 0x90104, 0x90106, 0x90108, 0x9010a, 0x9010c, 0x9010e, 0x90110, + 0x90112, 0x90114, 0x90116, 0x90118, 0x9011a, 0x9011c, 0x9011e, 0x90120, 0x90122, + 0x90124, 0x90126, 0x90128, 0x9012a, 0x9012c, 0x9012e, 0x90130, 0x90132, 0x90134, + 0x90136, 0x90139, 0x9013b, 0x9013d, 0x9013f, 0x90141, 0x90143, 0x90145, 0x90147, + 0x9014a, 0x9014c, 0x9014e, 0x90150, 0x90152, 0x90154, 0x90156, 0x90158, 0x9015a, + 0x9015c, 0x9015e, 0x90160, 0x90162, 0x90164, 0x90166, 0x90168, 0x9016a, 0x9016c, + 0x9016e, 0x90170, 0x90172, 0x90174, 0x90176, 0x90178, 0x90179, 0x9017b, 0x9017d, + 0x90181, 0x90182, 0x90184, 0x90186, 0x90187, 0x90193, 0x90194, 0x9019c, 0x9019d, + 0x9019f, 0x901a0, 0x901a2, 0x901a4, 0x901a6, 0x901a7, 0x901a9, 0x901ac, 0x901ae, + 0x901af, 0x901b5, 0x901b7, 0x901b8, 0x901bc, 0x901c4, 0x901c7, 0x901ca, 0x901cd, + 0x901cf, 0x901d1, 0x901d3, 0x901d5, 0x901d7, 0x901d9, 0x901db, 0x901de, 0x901e0, + 0x901e2, 0x901e4, 0x901e6, 0x901e8, 0x901ea, 0x901ec, 0x901ee, 0x901f1, 0x901f4, + 0x901fa, 0x901fc, 0x901fe, 0x90200, 0x90202, 0x90204, 0x90206, 0x90208, 0x9020a, + 0x9020c, 0x9020e, 0x90210, 0x90212, 0x90214, 0x90216, 0x90218, 0x9021a, 0x9021c, + 0x9021e, 0x90220, 0x90222, 0x90224, 0x90226, 0x90228, 0x9022a, 0x9022c, 0x9022e, + 0x90230, 0x90232, 0x9023a, 0x9023b, 0x9023d, 0x9023e, 0x90241, 0x90248, 0x9024a, + 0x9024c, 0x9024e, 0x90370, 0x90372, 0x90376, 0x9037f, 0x90386, 0x9038c, 0x9038e, + 0x9038f, 0x903cf, 0x903d8, 0x903da, 0x903dc, 0x903de, 0x903e0, 0x903e2, 0x903e4, + 0x903e6, 0x903e8, 0x903ea, 0x903ec, 0x903ee, 0x903f4, 0x903f7, 0x903f9, 0x903fa, + 0x90460, 0x90462, 0x90464, 0x90466, 0x90468, 0x9046a, 0x9046c, 0x9046e, 0x90470, + 0x90472, 0x90474, 0x90476, 0x90478, 0x9047a, 0x9047c, 0x9047e, 0x90480, 0x9048a, + 0x9048c, 0x9048e, 0x90490, 0x90492, 0x90494, 0x90496, 0x90498, 0x9049a, 0x9049c, + 0x9049e, 0x904a0, 0x904a2, 0x904a4, 0x904a6, 0x904a8, 0x904aa, 0x904ac, 0x904ae, + 0x904b0, 0x904b2, 0x904b4, 0x904b6, 0x904b8, 0x904ba, 0x904bc, 0x904be, 0x904c0, + 0x904c1, 0x904c3, 0x904c5, 0x904c7, 0x904c9, 0x904cb, 0x904cd, 0x904d0, 0x904d2, + 0x904d4, 0x904d6, 0x904d8, 0x904da, 0x904dc, 0x904de, 0x904e0, 0x904e2, 0x904e4, + 0x904e6, 0x904e8, 0x904ea, 0x904ec, 0x904ee, 0x904f0, 0x904f2, 0x904f4, 0x904f6, + 0x904f8, 0x904fa, 0x904fc, 0x904fe, 0x90500, 0x90502, 0x90504, 0x90506, 0x90508, + 0x9050a, 0x9050c, 0x9050e, 0x90510, 0x90512, 0x90514, 0x90516, 0x90518, 0x9051a, + 0x9051c, 0x9051e, 0x90520, 0x90522, 0x90524, 0x90526, 0x90528, 0x9052a, 0x9052c, + 0x9052e, 0x910c7, 0x910cd, 0x91e00, 0x91e02, 0x91e04, 0x91e06, 0x91e08, 0x91e0a, + 0x91e0c, 0x91e0e, 0x91e10, 0x91e12, 0x91e14, 0x91e16, 0x91e18, 0x91e1a, 0x91e1c, + 0x91e1e, 0x91e20, 0x91e22, 0x91e24, 0x91e26, 0x91e28, 0x91e2a, 0x91e2c, 0x91e2e, + 0x91e30, 0x91e32, 0x91e34, 0x91e36, 0x91e38, 0x91e3a, 0x91e3c, 0x91e3e, 0x91e40, + 0x91e42, 0x91e44, 0x91e46, 0x91e48, 0x91e4a, 0x91e4c, 0x91e4e, 0x91e50, 0x91e52, + 0x91e54, 0x91e56, 0x91e58, 0x91e5a, 0x91e5c, 0x91e5e, 0x91e60, 0x91e62, 0x91e64, + 0x91e66, 0x91e68, 0x91e6a, 0x91e6c, 0x91e6e, 0x91e70, 0x91e72, 0x91e74, 0x91e76, + 0x91e78, 0x91e7a, 0x91e7c, 0x91e7e, 0x91e80, 0x91e82, 0x91e84, 0x91e86, 0x91e88, + 0x91e8a, 0x91e8c, 0x91e8e, 0x91e90, 0x91e92, 0x91e94, 0x91e9e, 0x91ea0, 0x91ea2, + 0x91ea4, 0x91ea6, 0x91ea8, 0x91eaa, 0x91eac, 0x91eae, 0x91eb0, 0x91eb2, 0x91eb4, + 0x91eb6, 0x91eb8, 0x91eba, 0x91ebc, 0x91ebe, 0x91ec0, 0x91ec2, 0x91ec4, 0x91ec6, + 0x91ec8, 0x91eca, 0x91ecc, 0x91ece, 0x91ed0, 0x91ed2, 0x91ed4, 0x91ed6, 0x91ed8, + 0x91eda, 0x91edc, 0x91ede, 0x91ee0, 0x91ee2, 0x91ee4, 0x91ee6, 0x91ee8, 0x91eea, + 0x91eec, 0x91eee, 0x91ef0, 0x91ef2, 0x91ef4, 0x91ef6, 0x91ef8, 0x91efa, 0x91efc, + 0x91efe, 0x91f59, 0x91f5b, 0x91f5d, 0x91f5f, 0x92102, 0x92107, 0x92115, 0x92124, + 0x92126, 0x92128, 0x9213e, 0x9213f, 0x92145, 0x92183, 0x92c60, 0x92c67, 0x92c69, + 0x92c6b, 0x92c72, 0x92c75, 0x92c82, 0x92c84, 0x92c86, 0x92c88, 0x92c8a, 0x92c8c, + 0x92c8e, 0x92c90, 0x92c92, 0x92c94, 0x92c96, 0x92c98, 0x92c9a, 0x92c9c, 0x92c9e, + 0x92ca0, 0x92ca2, 0x92ca4, 0x92ca6, 0x92ca8, 0x92caa, 0x92cac, 0x92cae, 0x92cb0, + 0x92cb2, 0x92cb4, 0x92cb6, 0x92cb8, 0x92cba, 0x92cbc, 0x92cbe, 0x92cc0, 0x92cc2, + 0x92cc4, 0x92cc6, 0x92cc8, 0x92cca, 0x92ccc, 0x92cce, 0x92cd0, 0x92cd2, 0x92cd4, + 0x92cd6, 0x92cd8, 0x92cda, 0x92cdc, 0x92cde, 0x92ce0, 0x92ce2, 0x92ceb, 0x92ced, + 0x92cf2, 0x9a640, 0x9a642, 0x9a644, 0x9a646, 0x9a648, 0x9a64a, 0x9a64c, 0x9a64e, + 0x9a650, 0x9a652, 0x9a654, 0x9a656, 0x9a658, 0x9a65a, 0x9a65c, 0x9a65e, 0x9a660, + 0x9a662, 0x9a664, 0x9a666, 0x9a668, 0x9a66a, 0x9a66c, 0x9a680, 0x9a682, 0x9a684, + 0x9a686, 0x9a688, 0x9a68a, 0x9a68c, 0x9a68e, 0x9a690, 0x9a692, 0x9a694, 0x9a696, + 0x9a698, 0x9a69a, 0x9a722, 0x9a724, 0x9a726, 0x9a728, 0x9a72a, 0x9a72c, 0x9a72e, + 0x9a732, 0x9a734, 0x9a736, 0x9a738, 0x9a73a, 0x9a73c, 0x9a73e, 0x9a740, 0x9a742, + 0x9a744, 0x9a746, 0x9a748, 0x9a74a, 0x9a74c, 0x9a74e, 0x9a750, 0x9a752, 0x9a754, + 0x9a756, 0x9a758, 0x9a75a, 0x9a75c, 0x9a75e, 0x9a760, 0x9a762, 0x9a764, 0x9a766, + 0x9a768, 0x9a76a, 0x9a76c, 0x9a76e, 0x9a779, 0x9a77b, 0x9a77d, 0x9a77e, 0x9a780, + 0x9a782, 0x9a784, 0x9a786, 0x9a78b, 0x9a78d, 0x9a790, 0x9a792, 0x9a796, 0x9a798, + 0x9a79a, 0x9a79c, 0x9a79e, 0x9a7a0, 0x9a7a2, 0x9a7a4, 0x9a7a6, 0x9a7a8, 0x9a7b6, + 0xa0100, 0xa0102, 0xa0104, 0xa0106, 0xa0108, 0xa010a, 0xa010c, 0xa010e, 0xa0110, + 0xa0112, 0xa0114, 0xa0116, 0xa0118, 0xa011a, 0xa011c, 0xa011e, 0xa0120, 0xa0122, + 0xa0124, 0xa0126, 0xa0128, 0xa012a, 0xa012c, 0xa012e, 0xa0130, 0xa0132, 0xa0134, + 0xa0136, 0xa0139, 0xa013b, 0xa013d, 0xa013f, 0xa0141, 0xa0143, 0xa0145, 0xa0147, + 0xa014a, 0xa014c, 0xa014e, 0xa0150, 0xa0152, 0xa0154, 0xa0156, 0xa0158, 0xa015a, + 0xa015c, 0xa015e, 0xa0160, 0xa0162, 0xa0164, 0xa0166, 0xa0168, 0xa016a, 0xa016c, + 0xa016e, 0xa0170, 0xa0172, 0xa0174, 0xa0176, 0xa0178, 0xa0179, 0xa017b, 0xa017d, + 0xa0181, 0xa0182, 0xa0184, 0xa0186, 0xa0187, 0xa0193, 0xa0194, 0xa019c, 0xa019d, + 0xa019f, 0xa01a0, 0xa01a2, 0xa01a4, 0xa01a6, 0xa01a7, 0xa01a9, 0xa01ac, 0xa01ae, + 0xa01af, 0xa01b5, 0xa01b7, 0xa01b8, 0xa01bc, 0xa01c4, 0xa01c7, 0xa01ca, 0xa01cd, + 0xa01cf, 0xa01d1, 0xa01d3, 0xa01d5, 0xa01d7, 0xa01d9, 0xa01db, 0xa01de, 0xa01e0, + 0xa01e2, 0xa01e4, 0xa01e6, 0xa01e8, 0xa01ea, 0xa01ec, 0xa01ee, 0xa01f1, 0xa01f4, + 0xa01fa, 0xa01fc, 0xa01fe, 0xa0200, 0xa0202, 0xa0204, 0xa0206, 0xa0208, 0xa020a, + 0xa020c, 0xa020e, 0xa0210, 0xa0212, 0xa0214, 0xa0216, 0xa0218, 0xa021a, 0xa021c, + 0xa021e, 0xa0220, 0xa0222, 0xa0224, 0xa0226, 0xa0228, 0xa022a, 0xa022c, 0xa022e, + 0xa0230, 0xa0232, 0xa023a, 0xa023b, 0xa023d, 0xa023e, 0xa0241, 0xa0248, 0xa024a, + 0xa024c, 0xa024e, 0xa0370, 0xa0372, 0xa0376, 0xa037f, 0xa0386, 0xa038c, 0xa038e, + 0xa038f, 0xa03cf, 0xa03d8, 0xa03da, 0xa03dc, 0xa03de, 0xa03e0, 0xa03e2, 0xa03e4, + 0xa03e6, 0xa03e8, 0xa03ea, 0xa03ec, 0xa03ee, 0xa03f4, 0xa03f7, 0xa03f9, 0xa03fa, + 0xa0460, 0xa0462, 0xa0464, 0xa0466, 0xa0468, 0xa046a, 0xa046c, 0xa046e, 0xa0470, + 0xa0472, 0xa0474, 0xa0476, 0xa0478, 0xa047a, 0xa047c, 0xa047e, 0xa0480, 0xa048a, + 0xa048c, 0xa048e, 0xa0490, 0xa0492, 0xa0494, 0xa0496, 0xa0498, 0xa049a, 0xa049c, + 0xa049e, 0xa04a0, 0xa04a2, 0xa04a4, 0xa04a6, 0xa04a8, 0xa04aa, 0xa04ac, 0xa04ae, + 0xa04b0, 0xa04b2, 0xa04b4, 0xa04b6, 0xa04b8, 0xa04ba, 0xa04bc, 0xa04be, 0xa04c0, + 0xa04c1, 0xa04c3, 0xa04c5, 0xa04c7, 0xa04c9, 0xa04cb, 0xa04cd, 0xa04d0, 0xa04d2, + 0xa04d4, 0xa04d6, 0xa04d8, 0xa04da, 0xa04dc, 0xa04de, 0xa04e0, 0xa04e2, 0xa04e4, + 0xa04e6, 0xa04e8, 0xa04ea, 0xa04ec, 0xa04ee, 0xa04f0, 0xa04f2, 0xa04f4, 0xa04f6, + 0xa04f8, 0xa04fa, 0xa04fc, 0xa04fe, 0xa0500, 0xa0502, 0xa0504, 0xa0506, 0xa0508, + 0xa050a, 0xa050c, 0xa050e, 0xa0510, 0xa0512, 0xa0514, 0xa0516, 0xa0518, 0xa051a, + 0xa051c, 0xa051e, 0xa0520, 0xa0522, 0xa0524, 0xa0526, 0xa0528, 0xa052a, 0xa052c, + 0xa052e, 0xa10c7, 0xa10cd, 0xa1e00, 0xa1e02, 0xa1e04, 0xa1e06, 0xa1e08, 0xa1e0a, + 0xa1e0c, 0xa1e0e, 0xa1e10, 0xa1e12, 0xa1e14, 0xa1e16, 0xa1e18, 0xa1e1a, 0xa1e1c, + 0xa1e1e, 0xa1e20, 0xa1e22, 0xa1e24, 0xa1e26, 0xa1e28, 0xa1e2a, 0xa1e2c, 0xa1e2e, + 0xa1e30, 0xa1e32, 0xa1e34, 0xa1e36, 0xa1e38, 0xa1e3a, 0xa1e3c, 0xa1e3e, 0xa1e40, + 0xa1e42, 0xa1e44, 0xa1e46, 0xa1e48, 0xa1e4a, 0xa1e4c, 0xa1e4e, 0xa1e50, 0xa1e52, + 0xa1e54, 0xa1e56, 0xa1e58, 0xa1e5a, 0xa1e5c, 0xa1e5e, 0xa1e60, 0xa1e62, 0xa1e64, + 0xa1e66, 0xa1e68, 0xa1e6a, 0xa1e6c, 0xa1e6e, 0xa1e70, 0xa1e72, 0xa1e74, 0xa1e76, + 0xa1e78, 0xa1e7a, 0xa1e7c, 0xa1e7e, 0xa1e80, 0xa1e82, 0xa1e84, 0xa1e86, 0xa1e88, + 0xa1e8a, 0xa1e8c, 0xa1e8e, 0xa1e90, 0xa1e92, 0xa1e94, 0xa1e9e, 0xa1ea0, 0xa1ea2, + 0xa1ea4, 0xa1ea6, 0xa1ea8, 0xa1eaa, 0xa1eac, 0xa1eae, 0xa1eb0, 0xa1eb2, 0xa1eb4, + 0xa1eb6, 0xa1eb8, 0xa1eba, 0xa1ebc, 0xa1ebe, 0xa1ec0, 0xa1ec2, 0xa1ec4, 0xa1ec6, + 0xa1ec8, 0xa1eca, 0xa1ecc, 0xa1ece, 0xa1ed0, 0xa1ed2, 0xa1ed4, 0xa1ed6, 0xa1ed8, + 0xa1eda, 0xa1edc, 0xa1ede, 0xa1ee0, 0xa1ee2, 0xa1ee4, 0xa1ee6, 0xa1ee8, 0xa1eea, + 0xa1eec, 0xa1eee, 0xa1ef0, 0xa1ef2, 0xa1ef4, 0xa1ef6, 0xa1ef8, 0xa1efa, 0xa1efc, + 0xa1efe, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1f5f, 0xa2102, 0xa2107, 0xa2115, 0xa2124, + 0xa2126, 0xa2128, 0xa213e, 0xa213f, 0xa2145, 0xa2183, 0xa2c60, 0xa2c67, 0xa2c69, + 0xa2c6b, 0xa2c72, 0xa2c75, 0xa2c82, 0xa2c84, 0xa2c86, 0xa2c88, 0xa2c8a, 0xa2c8c, + 0xa2c8e, 0xa2c90, 0xa2c92, 0xa2c94, 0xa2c96, 0xa2c98, 0xa2c9a, 0xa2c9c, 0xa2c9e, + 0xa2ca0, 0xa2ca2, 0xa2ca4, 0xa2ca6, 0xa2ca8, 0xa2caa, 0xa2cac, 0xa2cae, 0xa2cb0, + 0xa2cb2, 0xa2cb4, 0xa2cb6, 0xa2cb8, 0xa2cba, 0xa2cbc, 0xa2cbe, 0xa2cc0, 0xa2cc2, + 0xa2cc4, 0xa2cc6, 0xa2cc8, 0xa2cca, 0xa2ccc, 0xa2cce, 0xa2cd0, 0xa2cd2, 0xa2cd4, + 0xa2cd6, 0xa2cd8, 0xa2cda, 0xa2cdc, 0xa2cde, 0xa2ce0, 0xa2ce2, 0xa2ceb, 0xa2ced, + 0xa2cf2, 0xaa640, 0xaa642, 0xaa644, 0xaa646, 0xaa648, 0xaa64a, 0xaa64c, 0xaa64e, + 0xaa650, 0xaa652, 0xaa654, 0xaa656, 0xaa658, 0xaa65a, 0xaa65c, 0xaa65e, 0xaa660, + 0xaa662, 0xaa664, 0xaa666, 0xaa668, 0xaa66a, 0xaa66c, 0xaa680, 0xaa682, 0xaa684, + 0xaa686, 0xaa688, 0xaa68a, 0xaa68c, 0xaa68e, 0xaa690, 0xaa692, 0xaa694, 0xaa696, + 0xaa698, 0xaa69a, 0xaa722, 0xaa724, 0xaa726, 0xaa728, 0xaa72a, 0xaa72c, 0xaa72e, + 0xaa732, 0xaa734, 0xaa736, 0xaa738, 0xaa73a, 0xaa73c, 0xaa73e, 0xaa740, 0xaa742, + 0xaa744, 0xaa746, 0xaa748, 0xaa74a, 0xaa74c, 0xaa74e, 0xaa750, 0xaa752, 0xaa754, + 0xaa756, 0xaa758, 0xaa75a, 0xaa75c, 0xaa75e, 0xaa760, 0xaa762, 0xaa764, 0xaa766, + 0xaa768, 0xaa76a, 0xaa76c, 0xaa76e, 0xaa779, 0xaa77b, 0xaa77d, 0xaa77e, 0xaa780, + 0xaa782, 0xaa784, 0xaa786, 0xaa78b, 0xaa78d, 0xaa790, 0xaa792, 0xaa796, 0xaa798, + 0xaa79a, 0xaa79c, 0xaa79e, 0xaa7a0, 0xaa7a2, 0xaa7a4, 0xaa7a6, 0xaa7a8, 0xaa7b6, + 0xb0100, 0xb0102, 0xb0104, 0xb0106, 0xb0108, 0xb010a, 0xb010c, 0xb010e, 0xb0110, + 0xb0112, 0xb0114, 0xb0116, 0xb0118, 0xb011a, 0xb011c, 0xb011e, 0xb0120, 0xb0122, + 0xb0124, 0xb0126, 0xb0128, 0xb012a, 0xb012c, 0xb012e, 0xb0130, 0xb0132, 0xb0134, + 0xb0136, 0xb0139, 0xb013b, 0xb013d, 0xb013f, 0xb0141, 0xb0143, 0xb0145, 0xb0147, + 0xb014a, 0xb014c, 0xb014e, 0xb0150, 0xb0152, 0xb0154, 0xb0156, 0xb0158, 0xb015a, + 0xb015c, 0xb015e, 0xb0160, 0xb0162, 0xb0164, 0xb0166, 0xb0168, 0xb016a, 0xb016c, + 0xb016e, 0xb0170, 0xb0172, 0xb0174, 0xb0176, 0xb0178, 0xb0179, 0xb017b, 0xb017d, + 0xb0181, 0xb0182, 0xb0184, 0xb0186, 0xb0187, 0xb0193, 0xb0194, 0xb019c, 0xb019d, + 0xb019f, 0xb01a0, 0xb01a2, 0xb01a4, 0xb01a6, 0xb01a7, 0xb01a9, 0xb01ac, 0xb01ae, + 0xb01af, 0xb01b5, 0xb01b7, 0xb01b8, 0xb01bc, 0xb01c4, 0xb01c7, 0xb01ca, 0xb01cd, + 0xb01cf, 0xb01d1, 0xb01d3, 0xb01d5, 0xb01d7, 0xb01d9, 0xb01db, 0xb01de, 0xb01e0, + 0xb01e2, 0xb01e4, 0xb01e6, 0xb01e8, 0xb01ea, 0xb01ec, 0xb01ee, 0xb01f1, 0xb01f4, + 0xb01fa, 0xb01fc, 0xb01fe, 0xb0200, 0xb0202, 0xb0204, 0xb0206, 0xb0208, 0xb020a, + 0xb020c, 0xb020e, 0xb0210, 0xb0212, 0xb0214, 0xb0216, 0xb0218, 0xb021a, 0xb021c, + 0xb021e, 0xb0220, 0xb0222, 0xb0224, 0xb0226, 0xb0228, 0xb022a, 0xb022c, 0xb022e, + 0xb0230, 0xb0232, 0xb023a, 0xb023b, 0xb023d, 0xb023e, 0xb0241, 0xb0248, 0xb024a, + 0xb024c, 0xb024e, 0xb0370, 0xb0372, 0xb0376, 0xb037f, 0xb0386, 0xb038c, 0xb038e, + 0xb038f, 0xb03cf, 0xb03d8, 0xb03da, 0xb03dc, 0xb03de, 0xb03e0, 0xb03e2, 0xb03e4, + 0xb03e6, 0xb03e8, 0xb03ea, 0xb03ec, 0xb03ee, 0xb03f4, 0xb03f7, 0xb03f9, 0xb03fa, + 0xb0460, 0xb0462, 0xb0464, 0xb0466, 0xb0468, 0xb046a, 0xb046c, 0xb046e, 0xb0470, + 0xb0472, 0xb0474, 0xb0476, 0xb0478, 0xb047a, 0xb047c, 0xb047e, 0xb0480, 0xb048a, + 0xb048c, 0xb048e, 0xb0490, 0xb0492, 0xb0494, 0xb0496, 0xb0498, 0xb049a, 0xb049c, + 0xb049e, 0xb04a0, 0xb04a2, 0xb04a4, 0xb04a6, 0xb04a8, 0xb04aa, 0xb04ac, 0xb04ae, + 0xb04b0, 0xb04b2, 0xb04b4, 0xb04b6, 0xb04b8, 0xb04ba, 0xb04bc, 0xb04be, 0xb04c0, + 0xb04c1, 0xb04c3, 0xb04c5, 0xb04c7, 0xb04c9, 0xb04cb, 0xb04cd, 0xb04d0, 0xb04d2, + 0xb04d4, 0xb04d6, 0xb04d8, 0xb04da, 0xb04dc, 0xb04de, 0xb04e0, 0xb04e2, 0xb04e4, + 0xb04e6, 0xb04e8, 0xb04ea, 0xb04ec, 0xb04ee, 0xb04f0, 0xb04f2, 0xb04f4, 0xb04f6, + 0xb04f8, 0xb04fa, 0xb04fc, 0xb04fe, 0xb0500, 0xb0502, 0xb0504, 0xb0506, 0xb0508, + 0xb050a, 0xb050c, 0xb050e, 0xb0510, 0xb0512, 0xb0514, 0xb0516, 0xb0518, 0xb051a, + 0xb051c, 0xb051e, 0xb0520, 0xb0522, 0xb0524, 0xb0526, 0xb0528, 0xb052a, 0xb052c, + 0xb052e, 0xb10c7, 0xb10cd, 0xb1e00, 0xb1e02, 0xb1e04, 0xb1e06, 0xb1e08, 0xb1e0a, + 0xb1e0c, 0xb1e0e, 0xb1e10, 0xb1e12, 0xb1e14, 0xb1e16, 0xb1e18, 0xb1e1a, 0xb1e1c, + 0xb1e1e, 0xb1e20, 0xb1e22, 0xb1e24, 0xb1e26, 0xb1e28, 0xb1e2a, 0xb1e2c, 0xb1e2e, + 0xb1e30, 0xb1e32, 0xb1e34, 0xb1e36, 0xb1e38, 0xb1e3a, 0xb1e3c, 0xb1e3e, 0xb1e40, + 0xb1e42, 0xb1e44, 0xb1e46, 0xb1e48, 0xb1e4a, 0xb1e4c, 0xb1e4e, 0xb1e50, 0xb1e52, + 0xb1e54, 0xb1e56, 0xb1e58, 0xb1e5a, 0xb1e5c, 0xb1e5e, 0xb1e60, 0xb1e62, 0xb1e64, + 0xb1e66, 0xb1e68, 0xb1e6a, 0xb1e6c, 0xb1e6e, 0xb1e70, 0xb1e72, 0xb1e74, 0xb1e76, + 0xb1e78, 0xb1e7a, 0xb1e7c, 0xb1e7e, 0xb1e80, 0xb1e82, 0xb1e84, 0xb1e86, 0xb1e88, + 0xb1e8a, 0xb1e8c, 0xb1e8e, 0xb1e90, 0xb1e92, 0xb1e94, 0xb1e9e, 0xb1ea0, 0xb1ea2, + 0xb1ea4, 0xb1ea6, 0xb1ea8, 0xb1eaa, 0xb1eac, 0xb1eae, 0xb1eb0, 0xb1eb2, 0xb1eb4, + 0xb1eb6, 0xb1eb8, 0xb1eba, 0xb1ebc, 0xb1ebe, 0xb1ec0, 0xb1ec2, 0xb1ec4, 0xb1ec6, + 0xb1ec8, 0xb1eca, 0xb1ecc, 0xb1ece, 0xb1ed0, 0xb1ed2, 0xb1ed4, 0xb1ed6, 0xb1ed8, + 0xb1eda, 0xb1edc, 0xb1ede, 0xb1ee0, 0xb1ee2, 0xb1ee4, 0xb1ee6, 0xb1ee8, 0xb1eea, + 0xb1eec, 0xb1eee, 0xb1ef0, 0xb1ef2, 0xb1ef4, 0xb1ef6, 0xb1ef8, 0xb1efa, 0xb1efc, + 0xb1efe, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1f5f, 0xb2102, 0xb2107, 0xb2115, 0xb2124, + 0xb2126, 0xb2128, 0xb213e, 0xb213f, 0xb2145, 0xb2183, 0xb2c60, 0xb2c67, 0xb2c69, + 0xb2c6b, 0xb2c72, 0xb2c75, 0xb2c82, 0xb2c84, 0xb2c86, 0xb2c88, 0xb2c8a, 0xb2c8c, + 0xb2c8e, 0xb2c90, 0xb2c92, 0xb2c94, 0xb2c96, 0xb2c98, 0xb2c9a, 0xb2c9c, 0xb2c9e, + 0xb2ca0, 0xb2ca2, 0xb2ca4, 0xb2ca6, 0xb2ca8, 0xb2caa, 0xb2cac, 0xb2cae, 0xb2cb0, + 0xb2cb2, 0xb2cb4, 0xb2cb6, 0xb2cb8, 0xb2cba, 0xb2cbc, 0xb2cbe, 0xb2cc0, 0xb2cc2, + 0xb2cc4, 0xb2cc6, 0xb2cc8, 0xb2cca, 0xb2ccc, 0xb2cce, 0xb2cd0, 0xb2cd2, 0xb2cd4, + 0xb2cd6, 0xb2cd8, 0xb2cda, 0xb2cdc, 0xb2cde, 0xb2ce0, 0xb2ce2, 0xb2ceb, 0xb2ced, + 0xb2cf2, 0xba640, 0xba642, 0xba644, 0xba646, 0xba648, 0xba64a, 0xba64c, 0xba64e, + 0xba650, 0xba652, 0xba654, 0xba656, 0xba658, 0xba65a, 0xba65c, 0xba65e, 0xba660, + 0xba662, 0xba664, 0xba666, 0xba668, 0xba66a, 0xba66c, 0xba680, 0xba682, 0xba684, + 0xba686, 0xba688, 0xba68a, 0xba68c, 0xba68e, 0xba690, 0xba692, 0xba694, 0xba696, + 0xba698, 0xba69a, 0xba722, 0xba724, 0xba726, 0xba728, 0xba72a, 0xba72c, 0xba72e, + 0xba732, 0xba734, 0xba736, 0xba738, 0xba73a, 0xba73c, 0xba73e, 0xba740, 0xba742, + 0xba744, 0xba746, 0xba748, 0xba74a, 0xba74c, 0xba74e, 0xba750, 0xba752, 0xba754, + 0xba756, 0xba758, 0xba75a, 0xba75c, 0xba75e, 0xba760, 0xba762, 0xba764, 0xba766, + 0xba768, 0xba76a, 0xba76c, 0xba76e, 0xba779, 0xba77b, 0xba77d, 0xba77e, 0xba780, + 0xba782, 0xba784, 0xba786, 0xba78b, 0xba78d, 0xba790, 0xba792, 0xba796, 0xba798, + 0xba79a, 0xba79c, 0xba79e, 0xba7a0, 0xba7a2, 0xba7a4, 0xba7a6, 0xba7a8, 0xba7b6, + 0xc0100, 0xc0102, 0xc0104, 0xc0106, 0xc0108, 0xc010a, 0xc010c, 0xc010e, 0xc0110, + 0xc0112, 0xc0114, 0xc0116, 0xc0118, 0xc011a, 0xc011c, 0xc011e, 0xc0120, 0xc0122, + 0xc0124, 0xc0126, 0xc0128, 0xc012a, 0xc012c, 0xc012e, 0xc0130, 0xc0132, 0xc0134, + 0xc0136, 0xc0139, 0xc013b, 0xc013d, 0xc013f, 0xc0141, 0xc0143, 0xc0145, 0xc0147, + 0xc014a, 0xc014c, 0xc014e, 0xc0150, 0xc0152, 0xc0154, 0xc0156, 0xc0158, 0xc015a, + 0xc015c, 0xc015e, 0xc0160, 0xc0162, 0xc0164, 0xc0166, 0xc0168, 0xc016a, 0xc016c, + 0xc016e, 0xc0170, 0xc0172, 0xc0174, 0xc0176, 0xc0178, 0xc0179, 0xc017b, 0xc017d, + 0xc0181, 0xc0182, 0xc0184, 0xc0186, 0xc0187, 0xc0193, 0xc0194, 0xc019c, 0xc019d, + 0xc019f, 0xc01a0, 0xc01a2, 0xc01a4, 0xc01a6, 0xc01a7, 0xc01a9, 0xc01ac, 0xc01ae, + 0xc01af, 0xc01b5, 0xc01b7, 0xc01b8, 0xc01bc, 0xc01c4, 0xc01c7, 0xc01ca, 0xc01cd, + 0xc01cf, 0xc01d1, 0xc01d3, 0xc01d5, 0xc01d7, 0xc01d9, 0xc01db, 0xc01de, 0xc01e0, + 0xc01e2, 0xc01e4, 0xc01e6, 0xc01e8, 0xc01ea, 0xc01ec, 0xc01ee, 0xc01f1, 0xc01f4, + 0xc01fa, 0xc01fc, 0xc01fe, 0xc0200, 0xc0202, 0xc0204, 0xc0206, 0xc0208, 0xc020a, + 0xc020c, 0xc020e, 0xc0210, 0xc0212, 0xc0214, 0xc0216, 0xc0218, 0xc021a, 0xc021c, + 0xc021e, 0xc0220, 0xc0222, 0xc0224, 0xc0226, 0xc0228, 0xc022a, 0xc022c, 0xc022e, + 0xc0230, 0xc0232, 0xc023a, 0xc023b, 0xc023d, 0xc023e, 0xc0241, 0xc0248, 0xc024a, + 0xc024c, 0xc024e, 0xc0370, 0xc0372, 0xc0376, 0xc037f, 0xc0386, 0xc038c, 0xc038e, + 0xc038f, 0xc03cf, 0xc03d8, 0xc03da, 0xc03dc, 0xc03de, 0xc03e0, 0xc03e2, 0xc03e4, + 0xc03e6, 0xc03e8, 0xc03ea, 0xc03ec, 0xc03ee, 0xc03f4, 0xc03f7, 0xc03f9, 0xc03fa, + 0xc0460, 0xc0462, 0xc0464, 0xc0466, 0xc0468, 0xc046a, 0xc046c, 0xc046e, 0xc0470, + 0xc0472, 0xc0474, 0xc0476, 0xc0478, 0xc047a, 0xc047c, 0xc047e, 0xc0480, 0xc048a, + 0xc048c, 0xc048e, 0xc0490, 0xc0492, 0xc0494, 0xc0496, 0xc0498, 0xc049a, 0xc049c, + 0xc049e, 0xc04a0, 0xc04a2, 0xc04a4, 0xc04a6, 0xc04a8, 0xc04aa, 0xc04ac, 0xc04ae, + 0xc04b0, 0xc04b2, 0xc04b4, 0xc04b6, 0xc04b8, 0xc04ba, 0xc04bc, 0xc04be, 0xc04c0, + 0xc04c1, 0xc04c3, 0xc04c5, 0xc04c7, 0xc04c9, 0xc04cb, 0xc04cd, 0xc04d0, 0xc04d2, + 0xc04d4, 0xc04d6, 0xc04d8, 0xc04da, 0xc04dc, 0xc04de, 0xc04e0, 0xc04e2, 0xc04e4, + 0xc04e6, 0xc04e8, 0xc04ea, 0xc04ec, 0xc04ee, 0xc04f0, 0xc04f2, 0xc04f4, 0xc04f6, + 0xc04f8, 0xc04fa, 0xc04fc, 0xc04fe, 0xc0500, 0xc0502, 0xc0504, 0xc0506, 0xc0508, + 0xc050a, 0xc050c, 0xc050e, 0xc0510, 0xc0512, 0xc0514, 0xc0516, 0xc0518, 0xc051a, + 0xc051c, 0xc051e, 0xc0520, 0xc0522, 0xc0524, 0xc0526, 0xc0528, 0xc052a, 0xc052c, + 0xc052e, 0xc10c7, 0xc10cd, 0xc1e00, 0xc1e02, 0xc1e04, 0xc1e06, 0xc1e08, 0xc1e0a, + 0xc1e0c, 0xc1e0e, 0xc1e10, 0xc1e12, 0xc1e14, 0xc1e16, 0xc1e18, 0xc1e1a, 0xc1e1c, + 0xc1e1e, 0xc1e20, 0xc1e22, 0xc1e24, 0xc1e26, 0xc1e28, 0xc1e2a, 0xc1e2c, 0xc1e2e, + 0xc1e30, 0xc1e32, 0xc1e34, 0xc1e36, 0xc1e38, 0xc1e3a, 0xc1e3c, 0xc1e3e, 0xc1e40, + 0xc1e42, 0xc1e44, 0xc1e46, 0xc1e48, 0xc1e4a, 0xc1e4c, 0xc1e4e, 0xc1e50, 0xc1e52, + 0xc1e54, 0xc1e56, 0xc1e58, 0xc1e5a, 0xc1e5c, 0xc1e5e, 0xc1e60, 0xc1e62, 0xc1e64, + 0xc1e66, 0xc1e68, 0xc1e6a, 0xc1e6c, 0xc1e6e, 0xc1e70, 0xc1e72, 0xc1e74, 0xc1e76, + 0xc1e78, 0xc1e7a, 0xc1e7c, 0xc1e7e, 0xc1e80, 0xc1e82, 0xc1e84, 0xc1e86, 0xc1e88, + 0xc1e8a, 0xc1e8c, 0xc1e8e, 0xc1e90, 0xc1e92, 0xc1e94, 0xc1e9e, 0xc1ea0, 0xc1ea2, + 0xc1ea4, 0xc1ea6, 0xc1ea8, 0xc1eaa, 0xc1eac, 0xc1eae, 0xc1eb0, 0xc1eb2, 0xc1eb4, + 0xc1eb6, 0xc1eb8, 0xc1eba, 0xc1ebc, 0xc1ebe, 0xc1ec0, 0xc1ec2, 0xc1ec4, 0xc1ec6, + 0xc1ec8, 0xc1eca, 0xc1ecc, 0xc1ece, 0xc1ed0, 0xc1ed2, 0xc1ed4, 0xc1ed6, 0xc1ed8, + 0xc1eda, 0xc1edc, 0xc1ede, 0xc1ee0, 0xc1ee2, 0xc1ee4, 0xc1ee6, 0xc1ee8, 0xc1eea, + 0xc1eec, 0xc1eee, 0xc1ef0, 0xc1ef2, 0xc1ef4, 0xc1ef6, 0xc1ef8, 0xc1efa, 0xc1efc, + 0xc1efe, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1f5f, 0xc2102, 0xc2107, 0xc2115, 0xc2124, + 0xc2126, 0xc2128, 0xc213e, 0xc213f, 0xc2145, 0xc2183, 0xc2c60, 0xc2c67, 0xc2c69, + 0xc2c6b, 0xc2c72, 0xc2c75, 0xc2c82, 0xc2c84, 0xc2c86, 0xc2c88, 0xc2c8a, 0xc2c8c, + 0xc2c8e, 0xc2c90, 0xc2c92, 0xc2c94, 0xc2c96, 0xc2c98, 0xc2c9a, 0xc2c9c, 0xc2c9e, + 0xc2ca0, 0xc2ca2, 0xc2ca4, 0xc2ca6, 0xc2ca8, 0xc2caa, 0xc2cac, 0xc2cae, 0xc2cb0, + 0xc2cb2, 0xc2cb4, 0xc2cb6, 0xc2cb8, 0xc2cba, 0xc2cbc, 0xc2cbe, 0xc2cc0, 0xc2cc2, + 0xc2cc4, 0xc2cc6, 0xc2cc8, 0xc2cca, 0xc2ccc, 0xc2cce, 0xc2cd0, 0xc2cd2, 0xc2cd4, + 0xc2cd6, 0xc2cd8, 0xc2cda, 0xc2cdc, 0xc2cde, 0xc2ce0, 0xc2ce2, 0xc2ceb, 0xc2ced, + 0xc2cf2, 0xca640, 0xca642, 0xca644, 0xca646, 0xca648, 0xca64a, 0xca64c, 0xca64e, + 0xca650, 0xca652, 0xca654, 0xca656, 0xca658, 0xca65a, 0xca65c, 0xca65e, 0xca660, + 0xca662, 0xca664, 0xca666, 0xca668, 0xca66a, 0xca66c, 0xca680, 0xca682, 0xca684, + 0xca686, 0xca688, 0xca68a, 0xca68c, 0xca68e, 0xca690, 0xca692, 0xca694, 0xca696, + 0xca698, 0xca69a, 0xca722, 0xca724, 0xca726, 0xca728, 0xca72a, 0xca72c, 0xca72e, + 0xca732, 0xca734, 0xca736, 0xca738, 0xca73a, 0xca73c, 0xca73e, 0xca740, 0xca742, + 0xca744, 0xca746, 0xca748, 0xca74a, 0xca74c, 0xca74e, 0xca750, 0xca752, 0xca754, + 0xca756, 0xca758, 0xca75a, 0xca75c, 0xca75e, 0xca760, 0xca762, 0xca764, 0xca766, + 0xca768, 0xca76a, 0xca76c, 0xca76e, 0xca779, 0xca77b, 0xca77d, 0xca77e, 0xca780, + 0xca782, 0xca784, 0xca786, 0xca78b, 0xca78d, 0xca790, 0xca792, 0xca796, 0xca798, + 0xca79a, 0xca79c, 0xca79e, 0xca7a0, 0xca7a2, 0xca7a4, 0xca7a6, 0xca7a8, 0xca7b6, + 0xd0100, 0xd0102, 0xd0104, 0xd0106, 0xd0108, 0xd010a, 0xd010c, 0xd010e, 0xd0110, + 0xd0112, 0xd0114, 0xd0116, 0xd0118, 0xd011a, 0xd011c, 0xd011e, 0xd0120, 0xd0122, + 0xd0124, 0xd0126, 0xd0128, 0xd012a, 0xd012c, 0xd012e, 0xd0130, 0xd0132, 0xd0134, + 0xd0136, 0xd0139, 0xd013b, 0xd013d, 0xd013f, 0xd0141, 0xd0143, 0xd0145, 0xd0147, + 0xd014a, 0xd014c, 0xd014e, 0xd0150, 0xd0152, 0xd0154, 0xd0156, 0xd0158, 0xd015a, + 0xd015c, 0xd015e, 0xd0160, 0xd0162, 0xd0164, 0xd0166, 0xd0168, 0xd016a, 0xd016c, + 0xd016e, 0xd0170, 0xd0172, 0xd0174, 0xd0176, 0xd0178, 0xd0179, 0xd017b, 0xd017d, + 0xd0181, 0xd0182, 0xd0184, 0xd0186, 0xd0187, 0xd0193, 0xd0194, 0xd019c, 0xd019d, + 0xd019f, 0xd01a0, 0xd01a2, 0xd01a4, 0xd01a6, 0xd01a7, 0xd01a9, 0xd01ac, 0xd01ae, + 0xd01af, 0xd01b5, 0xd01b7, 0xd01b8, 0xd01bc, 0xd01c4, 0xd01c7, 0xd01ca, 0xd01cd, + 0xd01cf, 0xd01d1, 0xd01d3, 0xd01d5, 0xd01d7, 0xd01d9, 0xd01db, 0xd01de, 0xd01e0, + 0xd01e2, 0xd01e4, 0xd01e6, 0xd01e8, 0xd01ea, 0xd01ec, 0xd01ee, 0xd01f1, 0xd01f4, + 0xd01fa, 0xd01fc, 0xd01fe, 0xd0200, 0xd0202, 0xd0204, 0xd0206, 0xd0208, 0xd020a, + 0xd020c, 0xd020e, 0xd0210, 0xd0212, 0xd0214, 0xd0216, 0xd0218, 0xd021a, 0xd021c, + 0xd021e, 0xd0220, 0xd0222, 0xd0224, 0xd0226, 0xd0228, 0xd022a, 0xd022c, 0xd022e, + 0xd0230, 0xd0232, 0xd023a, 0xd023b, 0xd023d, 0xd023e, 0xd0241, 0xd0248, 0xd024a, + 0xd024c, 0xd024e, 0xd0370, 0xd0372, 0xd0376, 0xd037f, 0xd0386, 0xd038c, 0xd038e, + 0xd038f, 0xd03cf, 0xd03d8, 0xd03da, 0xd03dc, 0xd03de, 0xd03e0, 0xd03e2, 0xd03e4, + 0xd03e6, 0xd03e8, 0xd03ea, 0xd03ec, 0xd03ee, 0xd03f4, 0xd03f7, 0xd03f9, 0xd03fa, + 0xd0460, 0xd0462, 0xd0464, 0xd0466, 0xd0468, 0xd046a, 0xd046c, 0xd046e, 0xd0470, + 0xd0472, 0xd0474, 0xd0476, 0xd0478, 0xd047a, 0xd047c, 0xd047e, 0xd0480, 0xd048a, + 0xd048c, 0xd048e, 0xd0490, 0xd0492, 0xd0494, 0xd0496, 0xd0498, 0xd049a, 0xd049c, + 0xd049e, 0xd04a0, 0xd04a2, 0xd04a4, 0xd04a6, 0xd04a8, 0xd04aa, 0xd04ac, 0xd04ae, + 0xd04b0, 0xd04b2, 0xd04b4, 0xd04b6, 0xd04b8, 0xd04ba, 0xd04bc, 0xd04be, 0xd04c0, + 0xd04c1, 0xd04c3, 0xd04c5, 0xd04c7, 0xd04c9, 0xd04cb, 0xd04cd, 0xd04d0, 0xd04d2, + 0xd04d4, 0xd04d6, 0xd04d8, 0xd04da, 0xd04dc, 0xd04de, 0xd04e0, 0xd04e2, 0xd04e4, + 0xd04e6, 0xd04e8, 0xd04ea, 0xd04ec, 0xd04ee, 0xd04f0, 0xd04f2, 0xd04f4, 0xd04f6, + 0xd04f8, 0xd04fa, 0xd04fc, 0xd04fe, 0xd0500, 0xd0502, 0xd0504, 0xd0506, 0xd0508, + 0xd050a, 0xd050c, 0xd050e, 0xd0510, 0xd0512, 0xd0514, 0xd0516, 0xd0518, 0xd051a, + 0xd051c, 0xd051e, 0xd0520, 0xd0522, 0xd0524, 0xd0526, 0xd0528, 0xd052a, 0xd052c, + 0xd052e, 0xd10c7, 0xd10cd, 0xd1e00, 0xd1e02, 0xd1e04, 0xd1e06, 0xd1e08, 0xd1e0a, + 0xd1e0c, 0xd1e0e, 0xd1e10, 0xd1e12, 0xd1e14, 0xd1e16, 0xd1e18, 0xd1e1a, 0xd1e1c, + 0xd1e1e, 0xd1e20, 0xd1e22, 0xd1e24, 0xd1e26, 0xd1e28, 0xd1e2a, 0xd1e2c, 0xd1e2e, + 0xd1e30, 0xd1e32, 0xd1e34, 0xd1e36, 0xd1e38, 0xd1e3a, 0xd1e3c, 0xd1e3e, 0xd1e40, + 0xd1e42, 0xd1e44, 0xd1e46, 0xd1e48, 0xd1e4a, 0xd1e4c, 0xd1e4e, 0xd1e50, 0xd1e52, + 0xd1e54, 0xd1e56, 0xd1e58, 0xd1e5a, 0xd1e5c, 0xd1e5e, 0xd1e60, 0xd1e62, 0xd1e64, + 0xd1e66, 0xd1e68, 0xd1e6a, 0xd1e6c, 0xd1e6e, 0xd1e70, 0xd1e72, 0xd1e74, 0xd1e76, + 0xd1e78, 0xd1e7a, 0xd1e7c, 0xd1e7e, 0xd1e80, 0xd1e82, 0xd1e84, 0xd1e86, 0xd1e88, + 0xd1e8a, 0xd1e8c, 0xd1e8e, 0xd1e90, 0xd1e92, 0xd1e94, 0xd1e9e, 0xd1ea0, 0xd1ea2, + 0xd1ea4, 0xd1ea6, 0xd1ea8, 0xd1eaa, 0xd1eac, 0xd1eae, 0xd1eb0, 0xd1eb2, 0xd1eb4, + 0xd1eb6, 0xd1eb8, 0xd1eba, 0xd1ebc, 0xd1ebe, 0xd1ec0, 0xd1ec2, 0xd1ec4, 0xd1ec6, + 0xd1ec8, 0xd1eca, 0xd1ecc, 0xd1ece, 0xd1ed0, 0xd1ed2, 0xd1ed4, 0xd1ed6, 0xd1ed8, + 0xd1eda, 0xd1edc, 0xd1ede, 0xd1ee0, 0xd1ee2, 0xd1ee4, 0xd1ee6, 0xd1ee8, 0xd1eea, + 0xd1eec, 0xd1eee, 0xd1ef0, 0xd1ef2, 0xd1ef4, 0xd1ef6, 0xd1ef8, 0xd1efa, 0xd1efc, + 0xd1efe, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1f5f, 0xd2102, 0xd2107, 0xd2115, 0xd2124, + 0xd2126, 0xd2128, 0xd213e, 0xd213f, 0xd2145, 0xd2183, 0xd2c60, 0xd2c67, 0xd2c69, + 0xd2c6b, 0xd2c72, 0xd2c75, 0xd2c82, 0xd2c84, 0xd2c86, 0xd2c88, 0xd2c8a, 0xd2c8c, + 0xd2c8e, 0xd2c90, 0xd2c92, 0xd2c94, 0xd2c96, 0xd2c98, 0xd2c9a, 0xd2c9c, 0xd2c9e, + 0xd2ca0, 0xd2ca2, 0xd2ca4, 0xd2ca6, 0xd2ca8, 0xd2caa, 0xd2cac, 0xd2cae, 0xd2cb0, + 0xd2cb2, 0xd2cb4, 0xd2cb6, 0xd2cb8, 0xd2cba, 0xd2cbc, 0xd2cbe, 0xd2cc0, 0xd2cc2, + 0xd2cc4, 0xd2cc6, 0xd2cc8, 0xd2cca, 0xd2ccc, 0xd2cce, 0xd2cd0, 0xd2cd2, 0xd2cd4, + 0xd2cd6, 0xd2cd8, 0xd2cda, 0xd2cdc, 0xd2cde, 0xd2ce0, 0xd2ce2, 0xd2ceb, 0xd2ced, + 0xd2cf2, 0xda640, 0xda642, 0xda644, 0xda646, 0xda648, 0xda64a, 0xda64c, 0xda64e, + 0xda650, 0xda652, 0xda654, 0xda656, 0xda658, 0xda65a, 0xda65c, 0xda65e, 0xda660, + 0xda662, 0xda664, 0xda666, 0xda668, 0xda66a, 0xda66c, 0xda680, 0xda682, 0xda684, + 0xda686, 0xda688, 0xda68a, 0xda68c, 0xda68e, 0xda690, 0xda692, 0xda694, 0xda696, + 0xda698, 0xda69a, 0xda722, 0xda724, 0xda726, 0xda728, 0xda72a, 0xda72c, 0xda72e, + 0xda732, 0xda734, 0xda736, 0xda738, 0xda73a, 0xda73c, 0xda73e, 0xda740, 0xda742, + 0xda744, 0xda746, 0xda748, 0xda74a, 0xda74c, 0xda74e, 0xda750, 0xda752, 0xda754, + 0xda756, 0xda758, 0xda75a, 0xda75c, 0xda75e, 0xda760, 0xda762, 0xda764, 0xda766, + 0xda768, 0xda76a, 0xda76c, 0xda76e, 0xda779, 0xda77b, 0xda77d, 0xda77e, 0xda780, + 0xda782, 0xda784, 0xda786, 0xda78b, 0xda78d, 0xda790, 0xda792, 0xda796, 0xda798, + 0xda79a, 0xda79c, 0xda79e, 0xda7a0, 0xda7a2, 0xda7a4, 0xda7a6, 0xda7a8, 0xda7b6, + 0xe0100, 0xe0102, 0xe0104, 0xe0106, 0xe0108, 0xe010a, 0xe010c, 0xe010e, 0xe0110, + 0xe0112, 0xe0114, 0xe0116, 0xe0118, 0xe011a, 0xe011c, 0xe011e, 0xe0120, 0xe0122, + 0xe0124, 0xe0126, 0xe0128, 0xe012a, 0xe012c, 0xe012e, 0xe0130, 0xe0132, 0xe0134, + 0xe0136, 0xe0139, 0xe013b, 0xe013d, 0xe013f, 0xe0141, 0xe0143, 0xe0145, 0xe0147, + 0xe014a, 0xe014c, 0xe014e, 0xe0150, 0xe0152, 0xe0154, 0xe0156, 0xe0158, 0xe015a, + 0xe015c, 0xe015e, 0xe0160, 0xe0162, 0xe0164, 0xe0166, 0xe0168, 0xe016a, 0xe016c, + 0xe016e, 0xe0170, 0xe0172, 0xe0174, 0xe0176, 0xe0178, 0xe0179, 0xe017b, 0xe017d, + 0xe0181, 0xe0182, 0xe0184, 0xe0186, 0xe0187, 0xe0193, 0xe0194, 0xe019c, 0xe019d, + 0xe019f, 0xe01a0, 0xe01a2, 0xe01a4, 0xe01a6, 0xe01a7, 0xe01a9, 0xe01ac, 0xe01ae, + 0xe01af, 0xe01b5, 0xe01b7, 0xe01b8, 0xe01bc, 0xe01c4, 0xe01c7, 0xe01ca, 0xe01cd, + 0xe01cf, 0xe01d1, 0xe01d3, 0xe01d5, 0xe01d7, 0xe01d9, 0xe01db, 0xe01de, 0xe01e0, + 0xe01e2, 0xe01e4, 0xe01e6, 0xe01e8, 0xe01ea, 0xe01ec, 0xe01ee, 0xe01f1, 0xe01f4, + 0xe01fa, 0xe01fc, 0xe01fe, 0xe0200, 0xe0202, 0xe0204, 0xe0206, 0xe0208, 0xe020a, + 0xe020c, 0xe020e, 0xe0210, 0xe0212, 0xe0214, 0xe0216, 0xe0218, 0xe021a, 0xe021c, + 0xe021e, 0xe0220, 0xe0222, 0xe0224, 0xe0226, 0xe0228, 0xe022a, 0xe022c, 0xe022e, + 0xe0230, 0xe0232, 0xe023a, 0xe023b, 0xe023d, 0xe023e, 0xe0241, 0xe0248, 0xe024a, + 0xe024c, 0xe024e, 0xe0370, 0xe0372, 0xe0376, 0xe037f, 0xe0386, 0xe038c, 0xe038e, + 0xe038f, 0xe03cf, 0xe03d8, 0xe03da, 0xe03dc, 0xe03de, 0xe03e0, 0xe03e2, 0xe03e4, + 0xe03e6, 0xe03e8, 0xe03ea, 0xe03ec, 0xe03ee, 0xe03f4, 0xe03f7, 0xe03f9, 0xe03fa, + 0xe0460, 0xe0462, 0xe0464, 0xe0466, 0xe0468, 0xe046a, 0xe046c, 0xe046e, 0xe0470, + 0xe0472, 0xe0474, 0xe0476, 0xe0478, 0xe047a, 0xe047c, 0xe047e, 0xe0480, 0xe048a, + 0xe048c, 0xe048e, 0xe0490, 0xe0492, 0xe0494, 0xe0496, 0xe0498, 0xe049a, 0xe049c, + 0xe049e, 0xe04a0, 0xe04a2, 0xe04a4, 0xe04a6, 0xe04a8, 0xe04aa, 0xe04ac, 0xe04ae, + 0xe04b0, 0xe04b2, 0xe04b4, 0xe04b6, 0xe04b8, 0xe04ba, 0xe04bc, 0xe04be, 0xe04c0, + 0xe04c1, 0xe04c3, 0xe04c5, 0xe04c7, 0xe04c9, 0xe04cb, 0xe04cd, 0xe04d0, 0xe04d2, + 0xe04d4, 0xe04d6, 0xe04d8, 0xe04da, 0xe04dc, 0xe04de, 0xe04e0, 0xe04e2, 0xe04e4, + 0xe04e6, 0xe04e8, 0xe04ea, 0xe04ec, 0xe04ee, 0xe04f0, 0xe04f2, 0xe04f4, 0xe04f6, + 0xe04f8, 0xe04fa, 0xe04fc, 0xe04fe, 0xe0500, 0xe0502, 0xe0504, 0xe0506, 0xe0508, + 0xe050a, 0xe050c, 0xe050e, 0xe0510, 0xe0512, 0xe0514, 0xe0516, 0xe0518, 0xe051a, + 0xe051c, 0xe051e, 0xe0520, 0xe0522, 0xe0524, 0xe0526, 0xe0528, 0xe052a, 0xe052c, + 0xe052e, 0xe10c7, 0xe10cd, 0xe1e00, 0xe1e02, 0xe1e04, 0xe1e06, 0xe1e08, 0xe1e0a, + 0xe1e0c, 0xe1e0e, 0xe1e10, 0xe1e12, 0xe1e14, 0xe1e16, 0xe1e18, 0xe1e1a, 0xe1e1c, + 0xe1e1e, 0xe1e20, 0xe1e22, 0xe1e24, 0xe1e26, 0xe1e28, 0xe1e2a, 0xe1e2c, 0xe1e2e, + 0xe1e30, 0xe1e32, 0xe1e34, 0xe1e36, 0xe1e38, 0xe1e3a, 0xe1e3c, 0xe1e3e, 0xe1e40, + 0xe1e42, 0xe1e44, 0xe1e46, 0xe1e48, 0xe1e4a, 0xe1e4c, 0xe1e4e, 0xe1e50, 0xe1e52, + 0xe1e54, 0xe1e56, 0xe1e58, 0xe1e5a, 0xe1e5c, 0xe1e5e, 0xe1e60, 0xe1e62, 0xe1e64, + 0xe1e66, 0xe1e68, 0xe1e6a, 0xe1e6c, 0xe1e6e, 0xe1e70, 0xe1e72, 0xe1e74, 0xe1e76, + 0xe1e78, 0xe1e7a, 0xe1e7c, 0xe1e7e, 0xe1e80, 0xe1e82, 0xe1e84, 0xe1e86, 0xe1e88, + 0xe1e8a, 0xe1e8c, 0xe1e8e, 0xe1e90, 0xe1e92, 0xe1e94, 0xe1e9e, 0xe1ea0, 0xe1ea2, + 0xe1ea4, 0xe1ea6, 0xe1ea8, 0xe1eaa, 0xe1eac, 0xe1eae, 0xe1eb0, 0xe1eb2, 0xe1eb4, + 0xe1eb6, 0xe1eb8, 0xe1eba, 0xe1ebc, 0xe1ebe, 0xe1ec0, 0xe1ec2, 0xe1ec4, 0xe1ec6, + 0xe1ec8, 0xe1eca, 0xe1ecc, 0xe1ece, 0xe1ed0, 0xe1ed2, 0xe1ed4, 0xe1ed6, 0xe1ed8, + 0xe1eda, 0xe1edc, 0xe1ede, 0xe1ee0, 0xe1ee2, 0xe1ee4, 0xe1ee6, 0xe1ee8, 0xe1eea, + 0xe1eec, 0xe1eee, 0xe1ef0, 0xe1ef2, 0xe1ef4, 0xe1ef6, 0xe1ef8, 0xe1efa, 0xe1efc, + 0xe1efe, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1f5f, 0xe2102, 0xe2107, 0xe2115, 0xe2124, + 0xe2126, 0xe2128, 0xe213e, 0xe213f, 0xe2145, 0xe2183, 0xe2c60, 0xe2c67, 0xe2c69, + 0xe2c6b, 0xe2c72, 0xe2c75, 0xe2c82, 0xe2c84, 0xe2c86, 0xe2c88, 0xe2c8a, 0xe2c8c, + 0xe2c8e, 0xe2c90, 0xe2c92, 0xe2c94, 0xe2c96, 0xe2c98, 0xe2c9a, 0xe2c9c, 0xe2c9e, + 0xe2ca0, 0xe2ca2, 0xe2ca4, 0xe2ca6, 0xe2ca8, 0xe2caa, 0xe2cac, 0xe2cae, 0xe2cb0, + 0xe2cb2, 0xe2cb4, 0xe2cb6, 0xe2cb8, 0xe2cba, 0xe2cbc, 0xe2cbe, 0xe2cc0, 0xe2cc2, + 0xe2cc4, 0xe2cc6, 0xe2cc8, 0xe2cca, 0xe2ccc, 0xe2cce, 0xe2cd0, 0xe2cd2, 0xe2cd4, + 0xe2cd6, 0xe2cd8, 0xe2cda, 0xe2cdc, 0xe2cde, 0xe2ce0, 0xe2ce2, 0xe2ceb, 0xe2ced, + 0xe2cf2, 0xea640, 0xea642, 0xea644, 0xea646, 0xea648, 0xea64a, 0xea64c, 0xea64e, + 0xea650, 0xea652, 0xea654, 0xea656, 0xea658, 0xea65a, 0xea65c, 0xea65e, 0xea660, + 0xea662, 0xea664, 0xea666, 0xea668, 0xea66a, 0xea66c, 0xea680, 0xea682, 0xea684, + 0xea686, 0xea688, 0xea68a, 0xea68c, 0xea68e, 0xea690, 0xea692, 0xea694, 0xea696, + 0xea698, 0xea69a, 0xea722, 0xea724, 0xea726, 0xea728, 0xea72a, 0xea72c, 0xea72e, + 0xea732, 0xea734, 0xea736, 0xea738, 0xea73a, 0xea73c, 0xea73e, 0xea740, 0xea742, + 0xea744, 0xea746, 0xea748, 0xea74a, 0xea74c, 0xea74e, 0xea750, 0xea752, 0xea754, + 0xea756, 0xea758, 0xea75a, 0xea75c, 0xea75e, 0xea760, 0xea762, 0xea764, 0xea766, + 0xea768, 0xea76a, 0xea76c, 0xea76e, 0xea779, 0xea77b, 0xea77d, 0xea77e, 0xea780, + 0xea782, 0xea784, 0xea786, 0xea78b, 0xea78d, 0xea790, 0xea792, 0xea796, 0xea798, + 0xea79a, 0xea79c, 0xea79e, 0xea7a0, 0xea7a2, 0xea7a4, 0xea7a6, 0xea7a8, 0xea7b6, + 0xf0100, 0xf0102, 0xf0104, 0xf0106, 0xf0108, 0xf010a, 0xf010c, 0xf010e, 0xf0110, + 0xf0112, 0xf0114, 0xf0116, 0xf0118, 0xf011a, 0xf011c, 0xf011e, 0xf0120, 0xf0122, + 0xf0124, 0xf0126, 0xf0128, 0xf012a, 0xf012c, 0xf012e, 0xf0130, 0xf0132, 0xf0134, + 0xf0136, 0xf0139, 0xf013b, 0xf013d, 0xf013f, 0xf0141, 0xf0143, 0xf0145, 0xf0147, + 0xf014a, 0xf014c, 0xf014e, 0xf0150, 0xf0152, 0xf0154, 0xf0156, 0xf0158, 0xf015a, + 0xf015c, 0xf015e, 0xf0160, 0xf0162, 0xf0164, 0xf0166, 0xf0168, 0xf016a, 0xf016c, + 0xf016e, 0xf0170, 0xf0172, 0xf0174, 0xf0176, 0xf0178, 0xf0179, 0xf017b, 0xf017d, + 0xf0181, 0xf0182, 0xf0184, 0xf0186, 0xf0187, 0xf0193, 0xf0194, 0xf019c, 0xf019d, + 0xf019f, 0xf01a0, 0xf01a2, 0xf01a4, 0xf01a6, 0xf01a7, 0xf01a9, 0xf01ac, 0xf01ae, + 0xf01af, 0xf01b5, 0xf01b7, 0xf01b8, 0xf01bc, 0xf01c4, 0xf01c7, 0xf01ca, 0xf01cd, + 0xf01cf, 0xf01d1, 0xf01d3, 0xf01d5, 0xf01d7, 0xf01d9, 0xf01db, 0xf01de, 0xf01e0, + 0xf01e2, 0xf01e4, 0xf01e6, 0xf01e8, 0xf01ea, 0xf01ec, 0xf01ee, 0xf01f1, 0xf01f4, + 0xf01fa, 0xf01fc, 0xf01fe, 0xf0200, 0xf0202, 0xf0204, 0xf0206, 0xf0208, 0xf020a, + 0xf020c, 0xf020e, 0xf0210, 0xf0212, 0xf0214, 0xf0216, 0xf0218, 0xf021a, 0xf021c, + 0xf021e, 0xf0220, 0xf0222, 0xf0224, 0xf0226, 0xf0228, 0xf022a, 0xf022c, 0xf022e, + 0xf0230, 0xf0232, 0xf023a, 0xf023b, 0xf023d, 0xf023e, 0xf0241, 0xf0248, 0xf024a, + 0xf024c, 0xf024e, 0xf0370, 0xf0372, 0xf0376, 0xf037f, 0xf0386, 0xf038c, 0xf038e, + 0xf038f, 0xf03cf, 0xf03d8, 0xf03da, 0xf03dc, 0xf03de, 0xf03e0, 0xf03e2, 0xf03e4, + 0xf03e6, 0xf03e8, 0xf03ea, 0xf03ec, 0xf03ee, 0xf03f4, 0xf03f7, 0xf03f9, 0xf03fa, + 0xf0460, 0xf0462, 0xf0464, 0xf0466, 0xf0468, 0xf046a, 0xf046c, 0xf046e, 0xf0470, + 0xf0472, 0xf0474, 0xf0476, 0xf0478, 0xf047a, 0xf047c, 0xf047e, 0xf0480, 0xf048a, + 0xf048c, 0xf048e, 0xf0490, 0xf0492, 0xf0494, 0xf0496, 0xf0498, 0xf049a, 0xf049c, + 0xf049e, 0xf04a0, 0xf04a2, 0xf04a4, 0xf04a6, 0xf04a8, 0xf04aa, 0xf04ac, 0xf04ae, + 0xf04b0, 0xf04b2, 0xf04b4, 0xf04b6, 0xf04b8, 0xf04ba, 0xf04bc, 0xf04be, 0xf04c0, + 0xf04c1, 0xf04c3, 0xf04c5, 0xf04c7, 0xf04c9, 0xf04cb, 0xf04cd, 0xf04d0, 0xf04d2, + 0xf04d4, 0xf04d6, 0xf04d8, 0xf04da, 0xf04dc, 0xf04de, 0xf04e0, 0xf04e2, 0xf04e4, + 0xf04e6, 0xf04e8, 0xf04ea, 0xf04ec, 0xf04ee, 0xf04f0, 0xf04f2, 0xf04f4, 0xf04f6, + 0xf04f8, 0xf04fa, 0xf04fc, 0xf04fe, 0xf0500, 0xf0502, 0xf0504, 0xf0506, 0xf0508, + 0xf050a, 0xf050c, 0xf050e, 0xf0510, 0xf0512, 0xf0514, 0xf0516, 0xf0518, 0xf051a, + 0xf051c, 0xf051e, 0xf0520, 0xf0522, 0xf0524, 0xf0526, 0xf0528, 0xf052a, 0xf052c, + 0xf052e, 0xf10c7, 0xf10cd, 0xf1e00, 0xf1e02, 0xf1e04, 0xf1e06, 0xf1e08, 0xf1e0a, + 0xf1e0c, 0xf1e0e, 0xf1e10, 0xf1e12, 0xf1e14, 0xf1e16, 0xf1e18, 0xf1e1a, 0xf1e1c, + 0xf1e1e, 0xf1e20, 0xf1e22, 0xf1e24, 0xf1e26, 0xf1e28, 0xf1e2a, 0xf1e2c, 0xf1e2e, + 0xf1e30, 0xf1e32, 0xf1e34, 0xf1e36, 0xf1e38, 0xf1e3a, 0xf1e3c, 0xf1e3e, 0xf1e40, + 0xf1e42, 0xf1e44, 0xf1e46, 0xf1e48, 0xf1e4a, 0xf1e4c, 0xf1e4e, 0xf1e50, 0xf1e52, + 0xf1e54, 0xf1e56, 0xf1e58, 0xf1e5a, 0xf1e5c, 0xf1e5e, 0xf1e60, 0xf1e62, 0xf1e64, + 0xf1e66, 0xf1e68, 0xf1e6a, 0xf1e6c, 0xf1e6e, 0xf1e70, 0xf1e72, 0xf1e74, 0xf1e76, + 0xf1e78, 0xf1e7a, 0xf1e7c, 0xf1e7e, 0xf1e80, 0xf1e82, 0xf1e84, 0xf1e86, 0xf1e88, + 0xf1e8a, 0xf1e8c, 0xf1e8e, 0xf1e90, 0xf1e92, 0xf1e94, 0xf1e9e, 0xf1ea0, 0xf1ea2, + 0xf1ea4, 0xf1ea6, 0xf1ea8, 0xf1eaa, 0xf1eac, 0xf1eae, 0xf1eb0, 0xf1eb2, 0xf1eb4, + 0xf1eb6, 0xf1eb8, 0xf1eba, 0xf1ebc, 0xf1ebe, 0xf1ec0, 0xf1ec2, 0xf1ec4, 0xf1ec6, + 0xf1ec8, 0xf1eca, 0xf1ecc, 0xf1ece, 0xf1ed0, 0xf1ed2, 0xf1ed4, 0xf1ed6, 0xf1ed8, + 0xf1eda, 0xf1edc, 0xf1ede, 0xf1ee0, 0xf1ee2, 0xf1ee4, 0xf1ee6, 0xf1ee8, 0xf1eea, + 0xf1eec, 0xf1eee, 0xf1ef0, 0xf1ef2, 0xf1ef4, 0xf1ef6, 0xf1ef8, 0xf1efa, 0xf1efc, + 0xf1efe, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1f5f, 0xf2102, 0xf2107, 0xf2115, 0xf2124, + 0xf2126, 0xf2128, 0xf213e, 0xf213f, 0xf2145, 0xf2183, 0xf2c60, 0xf2c67, 0xf2c69, + 0xf2c6b, 0xf2c72, 0xf2c75, 0xf2c82, 0xf2c84, 0xf2c86, 0xf2c88, 0xf2c8a, 0xf2c8c, + 0xf2c8e, 0xf2c90, 0xf2c92, 0xf2c94, 0xf2c96, 0xf2c98, 0xf2c9a, 0xf2c9c, 0xf2c9e, + 0xf2ca0, 0xf2ca2, 0xf2ca4, 0xf2ca6, 0xf2ca8, 0xf2caa, 0xf2cac, 0xf2cae, 0xf2cb0, + 0xf2cb2, 0xf2cb4, 0xf2cb6, 0xf2cb8, 0xf2cba, 0xf2cbc, 0xf2cbe, 0xf2cc0, 0xf2cc2, + 0xf2cc4, 0xf2cc6, 0xf2cc8, 0xf2cca, 0xf2ccc, 0xf2cce, 0xf2cd0, 0xf2cd2, 0xf2cd4, + 0xf2cd6, 0xf2cd8, 0xf2cda, 0xf2cdc, 0xf2cde, 0xf2ce0, 0xf2ce2, 0xf2ceb, 0xf2ced, + 0xf2cf2, 0xfa640, 0xfa642, 0xfa644, 0xfa646, 0xfa648, 0xfa64a, 0xfa64c, 0xfa64e, + 0xfa650, 0xfa652, 0xfa654, 0xfa656, 0xfa658, 0xfa65a, 0xfa65c, 0xfa65e, 0xfa660, + 0xfa662, 0xfa664, 0xfa666, 0xfa668, 0xfa66a, 0xfa66c, 0xfa680, 0xfa682, 0xfa684, + 0xfa686, 0xfa688, 0xfa68a, 0xfa68c, 0xfa68e, 0xfa690, 0xfa692, 0xfa694, 0xfa696, + 0xfa698, 0xfa69a, 0xfa722, 0xfa724, 0xfa726, 0xfa728, 0xfa72a, 0xfa72c, 0xfa72e, + 0xfa732, 0xfa734, 0xfa736, 0xfa738, 0xfa73a, 0xfa73c, 0xfa73e, 0xfa740, 0xfa742, + 0xfa744, 0xfa746, 0xfa748, 0xfa74a, 0xfa74c, 0xfa74e, 0xfa750, 0xfa752, 0xfa754, + 0xfa756, 0xfa758, 0xfa75a, 0xfa75c, 0xfa75e, 0xfa760, 0xfa762, 0xfa764, 0xfa766, + 0xfa768, 0xfa76a, 0xfa76c, 0xfa76e, 0xfa779, 0xfa77b, 0xfa77d, 0xfa77e, 0xfa780, + 0xfa782, 0xfa784, 0xfa786, 0xfa78b, 0xfa78d, 0xfa790, 0xfa792, 0xfa796, 0xfa798, + 0xfa79a, 0xfa79c, 0xfa79e, 0xfa7a0, 0xfa7a2, 0xfa7a4, 0xfa7a6, 0xfa7a8, 0xfa7b6, + 0x100100, 0x100102, 0x100104, 0x100106, 0x100108, 0x10010a, 0x10010c, 0x10010e, 0x100110, + 0x100112, 0x100114, 0x100116, 0x100118, 0x10011a, 0x10011c, 0x10011e, 0x100120, 0x100122, + 0x100124, 0x100126, 0x100128, 0x10012a, 0x10012c, 0x10012e, 0x100130, 0x100132, 0x100134, + 0x100136, 0x100139, 0x10013b, 0x10013d, 0x10013f, 0x100141, 0x100143, 0x100145, 0x100147, + 0x10014a, 0x10014c, 0x10014e, 0x100150, 0x100152, 0x100154, 0x100156, 0x100158, 0x10015a, + 0x10015c, 0x10015e, 0x100160, 0x100162, 0x100164, 0x100166, 0x100168, 0x10016a, 0x10016c, + 0x10016e, 0x100170, 0x100172, 0x100174, 0x100176, 0x100178, 0x100179, 0x10017b, 0x10017d, + 0x100181, 0x100182, 0x100184, 0x100186, 0x100187, 0x100193, 0x100194, 0x10019c, 0x10019d, + 0x10019f, 0x1001a0, 0x1001a2, 0x1001a4, 0x1001a6, 0x1001a7, 0x1001a9, 0x1001ac, 0x1001ae, + 0x1001af, 0x1001b5, 0x1001b7, 0x1001b8, 0x1001bc, 0x1001c4, 0x1001c7, 0x1001ca, 0x1001cd, + 0x1001cf, 0x1001d1, 0x1001d3, 0x1001d5, 0x1001d7, 0x1001d9, 0x1001db, 0x1001de, 0x1001e0, + 0x1001e2, 0x1001e4, 0x1001e6, 0x1001e8, 0x1001ea, 0x1001ec, 0x1001ee, 0x1001f1, 0x1001f4, + 0x1001fa, 0x1001fc, 0x1001fe, 0x100200, 0x100202, 0x100204, 0x100206, 0x100208, 0x10020a, + 0x10020c, 0x10020e, 0x100210, 0x100212, 0x100214, 0x100216, 0x100218, 0x10021a, 0x10021c, + 0x10021e, 0x100220, 0x100222, 0x100224, 0x100226, 0x100228, 0x10022a, 0x10022c, 0x10022e, + 0x100230, 0x100232, 0x10023a, 0x10023b, 0x10023d, 0x10023e, 0x100241, 0x100248, 0x10024a, + 0x10024c, 0x10024e, 0x100370, 0x100372, 0x100376, 0x10037f, 0x100386, 0x10038c, 0x10038e, + 0x10038f, 0x1003cf, 0x1003d8, 0x1003da, 0x1003dc, 0x1003de, 0x1003e0, 0x1003e2, 0x1003e4, + 0x1003e6, 0x1003e8, 0x1003ea, 0x1003ec, 0x1003ee, 0x1003f4, 0x1003f7, 0x1003f9, 0x1003fa, + 0x100460, 0x100462, 0x100464, 0x100466, 0x100468, 0x10046a, 0x10046c, 0x10046e, 0x100470, + 0x100472, 0x100474, 0x100476, 0x100478, 0x10047a, 0x10047c, 0x10047e, 0x100480, 0x10048a, + 0x10048c, 0x10048e, 0x100490, 0x100492, 0x100494, 0x100496, 0x100498, 0x10049a, 0x10049c, + 0x10049e, 0x1004a0, 0x1004a2, 0x1004a4, 0x1004a6, 0x1004a8, 0x1004aa, 0x1004ac, 0x1004ae, + 0x1004b0, 0x1004b2, 0x1004b4, 0x1004b6, 0x1004b8, 0x1004ba, 0x1004bc, 0x1004be, 0x1004c0, + 0x1004c1, 0x1004c3, 0x1004c5, 0x1004c7, 0x1004c9, 0x1004cb, 0x1004cd, 0x1004d0, 0x1004d2, + 0x1004d4, 0x1004d6, 0x1004d8, 0x1004da, 0x1004dc, 0x1004de, 0x1004e0, 0x1004e2, 0x1004e4, + 0x1004e6, 0x1004e8, 0x1004ea, 0x1004ec, 0x1004ee, 0x1004f0, 0x1004f2, 0x1004f4, 0x1004f6, + 0x1004f8, 0x1004fa, 0x1004fc, 0x1004fe, 0x100500, 0x100502, 0x100504, 0x100506, 0x100508, + 0x10050a, 0x10050c, 0x10050e, 0x100510, 0x100512, 0x100514, 0x100516, 0x100518, 0x10051a, + 0x10051c, 0x10051e, 0x100520, 0x100522, 0x100524, 0x100526, 0x100528, 0x10052a, 0x10052c, + 0x10052e, 0x1010c7, 0x1010cd, 0x101e00, 0x101e02, 0x101e04, 0x101e06, 0x101e08, 0x101e0a, + 0x101e0c, 0x101e0e, 0x101e10, 0x101e12, 0x101e14, 0x101e16, 0x101e18, 0x101e1a, 0x101e1c, + 0x101e1e, 0x101e20, 0x101e22, 0x101e24, 0x101e26, 0x101e28, 0x101e2a, 0x101e2c, 0x101e2e, + 0x101e30, 0x101e32, 0x101e34, 0x101e36, 0x101e38, 0x101e3a, 0x101e3c, 0x101e3e, 0x101e40, + 0x101e42, 0x101e44, 0x101e46, 0x101e48, 0x101e4a, 0x101e4c, 0x101e4e, 0x101e50, 0x101e52, + 0x101e54, 0x101e56, 0x101e58, 0x101e5a, 0x101e5c, 0x101e5e, 0x101e60, 0x101e62, 0x101e64, + 0x101e66, 0x101e68, 0x101e6a, 0x101e6c, 0x101e6e, 0x101e70, 0x101e72, 0x101e74, 0x101e76, + 0x101e78, 0x101e7a, 0x101e7c, 0x101e7e, 0x101e80, 0x101e82, 0x101e84, 0x101e86, 0x101e88, + 0x101e8a, 0x101e8c, 0x101e8e, 0x101e90, 0x101e92, 0x101e94, 0x101e9e, 0x101ea0, 0x101ea2, + 0x101ea4, 0x101ea6, 0x101ea8, 0x101eaa, 0x101eac, 0x101eae, 0x101eb0, 0x101eb2, 0x101eb4, + 0x101eb6, 0x101eb8, 0x101eba, 0x101ebc, 0x101ebe, 0x101ec0, 0x101ec2, 0x101ec4, 0x101ec6, + 0x101ec8, 0x101eca, 0x101ecc, 0x101ece, 0x101ed0, 0x101ed2, 0x101ed4, 0x101ed6, 0x101ed8, + 0x101eda, 0x101edc, 0x101ede, 0x101ee0, 0x101ee2, 0x101ee4, 0x101ee6, 0x101ee8, 0x101eea, + 0x101eec, 0x101eee, 0x101ef0, 0x101ef2, 0x101ef4, 0x101ef6, 0x101ef8, 0x101efa, 0x101efc, + 0x101efe, 0x101f59, 0x101f5b, 0x101f5d, 0x101f5f, 0x102102, 0x102107, 0x102115, 0x102124, + 0x102126, 0x102128, 0x10213e, 0x10213f, 0x102145, 0x102183, 0x102c60, 0x102c67, 0x102c69, + 0x102c6b, 0x102c72, 0x102c75, 0x102c82, 0x102c84, 0x102c86, 0x102c88, 0x102c8a, 0x102c8c, + 0x102c8e, 0x102c90, 0x102c92, 0x102c94, 0x102c96, 0x102c98, 0x102c9a, 0x102c9c, 0x102c9e, + 0x102ca0, 0x102ca2, 0x102ca4, 0x102ca6, 0x102ca8, 0x102caa, 0x102cac, 0x102cae, 0x102cb0, + 0x102cb2, 0x102cb4, 0x102cb6, 0x102cb8, 0x102cba, 0x102cbc, 0x102cbe, 0x102cc0, 0x102cc2, + 0x102cc4, 0x102cc6, 0x102cc8, 0x102cca, 0x102ccc, 0x102cce, 0x102cd0, 0x102cd2, 0x102cd4, + 0x102cd6, 0x102cd8, 0x102cda, 0x102cdc, 0x102cde, 0x102ce0, 0x102ce2, 0x102ceb, 0x102ced, + 0x102cf2, 0x10a640, 0x10a642, 0x10a644, 0x10a646, 0x10a648, 0x10a64a, 0x10a64c, 0x10a64e, + 0x10a650, 0x10a652, 0x10a654, 0x10a656, 0x10a658, 0x10a65a, 0x10a65c, 0x10a65e, 0x10a660, + 0x10a662, 0x10a664, 0x10a666, 0x10a668, 0x10a66a, 0x10a66c, 0x10a680, 0x10a682, 0x10a684, + 0x10a686, 0x10a688, 0x10a68a, 0x10a68c, 0x10a68e, 0x10a690, 0x10a692, 0x10a694, 0x10a696, + 0x10a698, 0x10a69a, 0x10a722, 0x10a724, 0x10a726, 0x10a728, 0x10a72a, 0x10a72c, 0x10a72e, + 0x10a732, 0x10a734, 0x10a736, 0x10a738, 0x10a73a, 0x10a73c, 0x10a73e, 0x10a740, 0x10a742, + 0x10a744, 0x10a746, 0x10a748, 0x10a74a, 0x10a74c, 0x10a74e, 0x10a750, 0x10a752, 0x10a754, + 0x10a756, 0x10a758, 0x10a75a, 0x10a75c, 0x10a75e, 0x10a760, 0x10a762, 0x10a764, 0x10a766, + 0x10a768, 0x10a76a, 0x10a76c, 0x10a76e, 0x10a779, 0x10a77b, 0x10a77d, 0x10a77e, 0x10a780, + 0x10a782, 0x10a784, 0x10a786, 0x10a78b, 0x10a78d, 0x10a790, 0x10a792, 0x10a796, 0x10a798, + 0x10a79a, 0x10a79c, 0x10a79e, 0x10a7a0, 0x10a7a2, 0x10a7a4, 0x10a7a6, 0x10a7a8, 0x10a7b6 #endif }; @@ -615,63 +4879,63 @@ static const crange graphRangeTable[] = { {0x559, 0x55f}, {0x561, 0x587}, {0x58d, 0x58f}, {0x591, 0x5c7}, {0x5d0, 0x5ea}, {0x5f0, 0x5f4}, {0x606, 0x61b}, {0x61e, 0x6dc}, {0x6de, 0x70d}, {0x710, 0x74a}, {0x74d, 0x7b1}, {0x7c0, 0x7fa}, - {0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x8a0, 0x8b4}, - {0x8b6, 0x8bd}, {0x8d4, 0x8e1}, {0x8e3, 0x983}, {0x985, 0x98c}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9bc, 0x9c4}, - {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fb}, {0xa01, 0xa03}, - {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa3e, 0xa42}, - {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa75}, {0xa81, 0xa83}, - {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, - {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, - {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xb01, 0xb03}, {0xb05, 0xb0c}, - {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb3c, 0xb44}, - {0xb4b, 0xb4d}, {0xb5f, 0xb63}, {0xb66, 0xb77}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, - {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd}, {0xbe6, 0xbfa}, - {0xc00, 0xc03}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, - {0xc2a, 0xc39}, {0xc3d, 0xc44}, {0xc46, 0xc48}, {0xc4a, 0xc4d}, - {0xc58, 0xc5a}, {0xc60, 0xc63}, {0xc66, 0xc6f}, {0xc78, 0xc83}, - {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, - {0xcb5, 0xcb9}, {0xcbc, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, - {0xce0, 0xce3}, {0xce6, 0xcef}, {0xd01, 0xd03}, {0xd05, 0xd0c}, - {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd3d, 0xd44}, {0xd46, 0xd48}, - {0xd4a, 0xd4f}, {0xd54, 0xd63}, {0xd66, 0xd7f}, {0xd85, 0xd96}, - {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xdcf, 0xdd4}, - {0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, {0xe01, 0xe3a}, - {0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, - {0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd}, - {0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c}, - {0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda}, - {0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, - {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, - {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, - {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c}, - {0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1400, 0x167f}, - {0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1714}, - {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, {0x176e, 0x1770}, - {0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1800, 0x180d}, - {0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, {0x18b0, 0x18f5}, - {0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, {0x1944, 0x196d}, - {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, {0x19d0, 0x19da}, - {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, {0x1a7f, 0x1a89}, - {0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, {0x1b00, 0x1b4b}, - {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, {0x1c3b, 0x1c49}, - {0x1c4d, 0x1c88}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf6}, {0x1d00, 0x1df5}, - {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, - {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4}, - {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4}, - {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, {0x2074, 0x208e}, - {0x2090, 0x209c}, {0x20a0, 0x20be}, {0x20d0, 0x20f0}, {0x2100, 0x218b}, - {0x2190, 0x23fe}, {0x2400, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73}, - {0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd1}, + {0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x860, 0x86a}, + {0x8a0, 0x8b4}, {0x8b6, 0x8bd}, {0x8d4, 0x8e1}, {0x8e3, 0x983}, + {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, + {0x9bc, 0x9c4}, {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fd}, + {0xa01, 0xa03}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, + {0xa3e, 0xa42}, {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa75}, + {0xa81, 0xa83}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, + {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9}, + {0xacb, 0xacd}, {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xaf9, 0xaff}, + {0xb01, 0xb03}, {0xb05, 0xb0c}, {0xb13, 0xb28}, {0xb2a, 0xb30}, + {0xb35, 0xb39}, {0xb3c, 0xb44}, {0xb4b, 0xb4d}, {0xb5f, 0xb63}, + {0xb66, 0xb77}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, + {0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, + {0xbca, 0xbcd}, {0xbe6, 0xbfa}, {0xc00, 0xc03}, {0xc05, 0xc0c}, + {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc44}, + {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc58, 0xc5a}, {0xc60, 0xc63}, + {0xc66, 0xc6f}, {0xc78, 0xc83}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, + {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbc, 0xcc4}, + {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3}, {0xce6, 0xcef}, + {0xd00, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd44}, + {0xd46, 0xd48}, {0xd4a, 0xd4f}, {0xd54, 0xd63}, {0xd66, 0xd7f}, + {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, + {0xdcf, 0xdd4}, {0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, + {0xe01, 0xe3a}, {0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, + {0xea1, 0xea3}, {0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, + {0xec8, 0xecd}, {0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, + {0xf49, 0xf6c}, {0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, + {0xfce, 0xfda}, {0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, + {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, + {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, + {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, + {0x135d, 0x137c}, {0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, + {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, + {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, + {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, + {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, + {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, + {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, + {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, + {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, + {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, + {0x1c3b, 0x1c49}, {0x1c4d, 0x1c88}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf9}, + {0x1d00, 0x1df9}, {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, + {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, + {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, + {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, + {0x2074, 0x208e}, {0x2090, 0x209c}, {0x20a0, 0x20bf}, {0x20d0, 0x20f0}, + {0x2100, 0x218b}, {0x2190, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73}, + {0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd2}, {0x2bec, 0x2bef}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3}, {0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, - {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e44}, + {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e49}, {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, - {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312d}, + {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312e}, {0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e}, - {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fd5}, {0xa000, 0xa48c}, + {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fea}, {0xa000, 0xa48c}, {0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7ae}, {0xa7b0, 0xa7b7}, {0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877}, {0xa880, 0xa8c5}, {0xa8ce, 0xa8d9}, {0xa8e0, 0xa8fd}, {0xa900, 0xa953}, @@ -680,10 +4944,6 @@ static const crange graphRangeTable[] = { {0xaadb, 0xaaf6}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab65}, {0xab70, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, - {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, - {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, - {0xde00, 0xde3e}, {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, - {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19}, @@ -691,61 +4951,1222 @@ static const crange graphRangeTable[] = { {0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6}, {0xffe8, 0xffee} #if TCL_UTF_MAX > 4 - ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, - {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133}, - {0x10137, 0x1018e}, {0x10190, 0x1019b}, {0x101d0, 0x101fd}, {0x10280, 0x1029c}, - {0x102a0, 0x102d0}, {0x102e0, 0x102fb}, {0x10300, 0x10323}, {0x10330, 0x1034a}, - {0x10350, 0x1037a}, {0x10380, 0x1039d}, {0x1039f, 0x103c3}, {0x103c8, 0x103d5}, - {0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, - {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755}, - {0x10760, 0x10767}, {0x10800, 0x10805}, {0x1080a, 0x10835}, {0x1083f, 0x10855}, - {0x10857, 0x1089e}, {0x108a7, 0x108af}, {0x108e0, 0x108f2}, {0x108fb, 0x1091b}, - {0x1091f, 0x10939}, {0x10980, 0x109b7}, {0x109bc, 0x109cf}, {0x109d2, 0x10a03}, - {0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a38, 0x10a3a}, - {0x10a3f, 0x10a47}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6}, - {0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72}, - {0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48}, - {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10cfa, 0x10cff}, {0x10e60, 0x10e7e}, - {0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1}, - {0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11143}, - {0x11150, 0x11176}, {0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4}, - {0x11200, 0x11211}, {0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, - {0x1128f, 0x1129d}, {0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9}, - {0x11300, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, - {0x11335, 0x11339}, {0x1133c, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363}, - {0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11400, 0x11459}, {0x11480, 0x114c7}, - {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644}, - {0x11650, 0x11659}, {0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, - {0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2}, - {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45}, - {0x11c50, 0x11c6c}, {0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6}, - {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474}, {0x12480, 0x12543}, - {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, - {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45}, - {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, - {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x17000, 0x187ec}, - {0x18800, 0x18af2}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, - {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, - {0x1d129, 0x1d172}, {0x1d17b, 0x1d1e8}, {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, - {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, - {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, - {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006}, - {0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4}, - {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, {0x1e950, 0x1e959}, {0x1ee00, 0x1ee03}, - {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, - {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, - {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, - {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, {0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, - {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, {0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, - {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202}, - {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, {0x1f300, 0x1f6d2}, {0x1f6e0, 0x1f6ec}, - {0x1f6f0, 0x1f6f6}, {0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, - {0x1f810, 0x1f847}, {0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, - {0x1f910, 0x1f91e}, {0x1f920, 0x1f927}, {0x1f933, 0x1f93e}, {0x1f940, 0x1f94b}, - {0x1f950, 0x1f95e}, {0x1f980, 0x1f991}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, - {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef} + ,{0x10021, 0x1007e}, {0x100a1, 0x100ac}, {0x100ae, 0x10377}, {0x1037a, 0x1037f}, + {0x10384, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x1052f}, {0x10531, 0x10556}, + {0x10559, 0x1055f}, {0x10561, 0x10587}, {0x1058d, 0x1058f}, {0x10591, 0x105c7}, + {0x105d0, 0x105ea}, {0x105f0, 0x105f4}, {0x10606, 0x1061b}, {0x1061e, 0x106dc}, + {0x106de, 0x1070d}, {0x10710, 0x1074a}, {0x1074d, 0x107b1}, {0x107c0, 0x107fa}, + {0x10800, 0x1082d}, {0x10830, 0x1083e}, {0x10840, 0x1085b}, {0x10860, 0x1086a}, + {0x108a0, 0x108b4}, {0x108b6, 0x108bd}, {0x108d4, 0x108e1}, {0x108e3, 0x10983}, + {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, + {0x109bc, 0x109c4}, {0x109cb, 0x109ce}, {0x109df, 0x109e3}, {0x109e6, 0x109fd}, + {0x10a01, 0x10a03}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, + {0x10a3e, 0x10a42}, {0x10a4b, 0x10a4d}, {0x10a59, 0x10a5c}, {0x10a66, 0x10a75}, + {0x10a81, 0x10a83}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, {0x10a93, 0x10aa8}, + {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10abc, 0x10ac5}, {0x10ac7, 0x10ac9}, + {0x10acb, 0x10acd}, {0x10ae0, 0x10ae3}, {0x10ae6, 0x10af1}, {0x10af9, 0x10aff}, + {0x10b01, 0x10b03}, {0x10b05, 0x10b0c}, {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, + {0x10b35, 0x10b39}, {0x10b3c, 0x10b44}, {0x10b4b, 0x10b4d}, {0x10b5f, 0x10b63}, + {0x10b66, 0x10b77}, {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, + {0x10ba8, 0x10baa}, {0x10bae, 0x10bb9}, {0x10bbe, 0x10bc2}, {0x10bc6, 0x10bc8}, + {0x10bca, 0x10bcd}, {0x10be6, 0x10bfa}, {0x10c00, 0x10c03}, {0x10c05, 0x10c0c}, + {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, {0x10c2a, 0x10c39}, {0x10c3d, 0x10c44}, + {0x10c46, 0x10c48}, {0x10c4a, 0x10c4d}, {0x10c58, 0x10c5a}, {0x10c60, 0x10c63}, + {0x10c66, 0x10c6f}, {0x10c78, 0x10c83}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, + {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10cbc, 0x10cc4}, + {0x10cc6, 0x10cc8}, {0x10cca, 0x10ccd}, {0x10ce0, 0x10ce3}, {0x10ce6, 0x10cef}, + {0x10d00, 0x10d03}, {0x10d05, 0x10d0c}, {0x10d0e, 0x10d10}, {0x10d12, 0x10d44}, + {0x10d46, 0x10d48}, {0x10d4a, 0x10d4f}, {0x10d54, 0x10d63}, {0x10d66, 0x10d7f}, + {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, {0x10dc0, 0x10dc6}, + {0x10dcf, 0x10dd4}, {0x10dd8, 0x10ddf}, {0x10de6, 0x10def}, {0x10df2, 0x10df4}, + {0x10e01, 0x10e3a}, {0x10e3f, 0x10e5b}, {0x10e94, 0x10e97}, {0x10e99, 0x10e9f}, + {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb9}, {0x10ebb, 0x10ebd}, {0x10ec0, 0x10ec4}, + {0x10ec8, 0x10ecd}, {0x10ed0, 0x10ed9}, {0x10edc, 0x10edf}, {0x10f00, 0x10f47}, + {0x10f49, 0x10f6c}, {0x10f71, 0x10f97}, {0x10f99, 0x10fbc}, {0x10fbe, 0x10fcc}, + {0x10fce, 0x10fda}, {0x11000, 0x110c5}, {0x110d0, 0x11248}, {0x1124a, 0x1124d}, + {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, {0x1128a, 0x1128d}, + {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, {0x112c2, 0x112c5}, + {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, {0x11318, 0x1135a}, + {0x1135d, 0x1137c}, {0x11380, 0x11399}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, + {0x11400, 0x1167f}, {0x11681, 0x1169c}, {0x116a0, 0x116f8}, {0x11700, 0x1170c}, + {0x1170e, 0x11714}, {0x11720, 0x11736}, {0x11740, 0x11753}, {0x11760, 0x1176c}, + {0x1176e, 0x11770}, {0x11780, 0x117dd}, {0x117e0, 0x117e9}, {0x117f0, 0x117f9}, + {0x11800, 0x1180d}, {0x11810, 0x11819}, {0x11820, 0x11877}, {0x11880, 0x118aa}, + {0x118b0, 0x118f5}, {0x11900, 0x1191e}, {0x11920, 0x1192b}, {0x11930, 0x1193b}, + {0x11944, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, {0x119b0, 0x119c9}, + {0x119d0, 0x119da}, {0x119de, 0x11a1b}, {0x11a1e, 0x11a5e}, {0x11a60, 0x11a7c}, + {0x11a7f, 0x11a89}, {0x11a90, 0x11a99}, {0x11aa0, 0x11aad}, {0x11ab0, 0x11abe}, + {0x11b00, 0x11b4b}, {0x11b50, 0x11b7c}, {0x11b80, 0x11bf3}, {0x11bfc, 0x11c37}, + {0x11c3b, 0x11c49}, {0x11c4d, 0x11c88}, {0x11cc0, 0x11cc7}, {0x11cd0, 0x11cf9}, + {0x11d00, 0x11df9}, {0x11dfb, 0x11f15}, {0x11f18, 0x11f1d}, {0x11f20, 0x11f45}, + {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, {0x11f80, 0x11fb4}, + {0x11fb6, 0x11fc4}, {0x11fc6, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fdd, 0x11fef}, + {0x11ff2, 0x11ff4}, {0x11ff6, 0x11ffe}, {0x12010, 0x12027}, {0x12030, 0x1205e}, + {0x12074, 0x1208e}, {0x12090, 0x1209c}, {0x120a0, 0x120bf}, {0x120d0, 0x120f0}, + {0x12100, 0x1218b}, {0x12190, 0x12426}, {0x12440, 0x1244a}, {0x12460, 0x12b73}, + {0x12b76, 0x12b95}, {0x12b98, 0x12bb9}, {0x12bbd, 0x12bc8}, {0x12bca, 0x12bd2}, + {0x12bec, 0x12bef}, {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12cf3}, + {0x12cf9, 0x12d25}, {0x12d30, 0x12d67}, {0x12d7f, 0x12d96}, {0x12da0, 0x12da6}, + {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, + {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x12de0, 0x12e49}, + {0x12e80, 0x12e99}, {0x12e9b, 0x12ef3}, {0x12f00, 0x12fd5}, {0x12ff0, 0x12ffb}, + {0x13001, 0x1303f}, {0x13041, 0x13096}, {0x13099, 0x130ff}, {0x13105, 0x1312e}, + {0x13131, 0x1318e}, {0x13190, 0x131ba}, {0x131c0, 0x131e3}, {0x131f0, 0x1321e}, + {0x13220, 0x132fe}, {0x13300, 0x14db5}, {0x14dc0, 0x19fea}, {0x1a000, 0x1a48c}, + {0x1a490, 0x1a4c6}, {0x1a4d0, 0x1a62b}, {0x1a640, 0x1a6f7}, {0x1a700, 0x1a7ae}, + {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a82b}, {0x1a830, 0x1a839}, {0x1a840, 0x1a877}, + {0x1a880, 0x1a8c5}, {0x1a8ce, 0x1a8d9}, {0x1a8e0, 0x1a8fd}, {0x1a900, 0x1a953}, + {0x1a95f, 0x1a97c}, {0x1a980, 0x1a9cd}, {0x1a9cf, 0x1a9d9}, {0x1a9de, 0x1a9fe}, + {0x1aa00, 0x1aa36}, {0x1aa40, 0x1aa4d}, {0x1aa50, 0x1aa59}, {0x1aa5c, 0x1aac2}, + {0x1aadb, 0x1aaf6}, {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, + {0x1ab20, 0x1ab26}, {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab65}, {0x1ab70, 0x1abed}, + {0x1abf0, 0x1abf9}, {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, + {0x1f900, 0x1fa6d}, {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, + {0x1fb1d, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbc1}, {0x1fbd3, 0x1fd3f}, + {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfd}, {0x1fe00, 0x1fe19}, + {0x1fe20, 0x1fe52}, {0x1fe54, 0x1fe66}, {0x1fe68, 0x1fe6b}, {0x1fe70, 0x1fe74}, + {0x1fe76, 0x1fefc}, {0x1ff01, 0x1ffbe}, {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, + {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, {0x1ffe0, 0x1ffe6}, {0x1ffe8, 0x1ffee}, + {0x20021, 0x2007e}, {0x200a1, 0x200ac}, {0x200ae, 0x20377}, {0x2037a, 0x2037f}, + {0x20384, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x2052f}, {0x20531, 0x20556}, + {0x20559, 0x2055f}, {0x20561, 0x20587}, {0x2058d, 0x2058f}, {0x20591, 0x205c7}, + {0x205d0, 0x205ea}, {0x205f0, 0x205f4}, {0x20606, 0x2061b}, {0x2061e, 0x206dc}, + {0x206de, 0x2070d}, {0x20710, 0x2074a}, {0x2074d, 0x207b1}, {0x207c0, 0x207fa}, + {0x20800, 0x2082d}, {0x20830, 0x2083e}, {0x20840, 0x2085b}, {0x20860, 0x2086a}, + {0x208a0, 0x208b4}, {0x208b6, 0x208bd}, {0x208d4, 0x208e1}, {0x208e3, 0x20983}, + {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, + {0x209bc, 0x209c4}, {0x209cb, 0x209ce}, {0x209df, 0x209e3}, {0x209e6, 0x209fd}, + {0x20a01, 0x20a03}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, + {0x20a3e, 0x20a42}, {0x20a4b, 0x20a4d}, {0x20a59, 0x20a5c}, {0x20a66, 0x20a75}, + {0x20a81, 0x20a83}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, {0x20a93, 0x20aa8}, + {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20abc, 0x20ac5}, {0x20ac7, 0x20ac9}, + {0x20acb, 0x20acd}, {0x20ae0, 0x20ae3}, {0x20ae6, 0x20af1}, {0x20af9, 0x20aff}, + {0x20b01, 0x20b03}, {0x20b05, 0x20b0c}, {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, + {0x20b35, 0x20b39}, {0x20b3c, 0x20b44}, {0x20b4b, 0x20b4d}, {0x20b5f, 0x20b63}, + {0x20b66, 0x20b77}, {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, + {0x20ba8, 0x20baa}, {0x20bae, 0x20bb9}, {0x20bbe, 0x20bc2}, {0x20bc6, 0x20bc8}, + {0x20bca, 0x20bcd}, {0x20be6, 0x20bfa}, {0x20c00, 0x20c03}, {0x20c05, 0x20c0c}, + {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, {0x20c2a, 0x20c39}, {0x20c3d, 0x20c44}, + {0x20c46, 0x20c48}, {0x20c4a, 0x20c4d}, {0x20c58, 0x20c5a}, {0x20c60, 0x20c63}, + {0x20c66, 0x20c6f}, {0x20c78, 0x20c83}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, + {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20cbc, 0x20cc4}, + {0x20cc6, 0x20cc8}, {0x20cca, 0x20ccd}, {0x20ce0, 0x20ce3}, {0x20ce6, 0x20cef}, + {0x20d00, 0x20d03}, {0x20d05, 0x20d0c}, {0x20d0e, 0x20d10}, {0x20d12, 0x20d44}, + {0x20d46, 0x20d48}, {0x20d4a, 0x20d4f}, {0x20d54, 0x20d63}, {0x20d66, 0x20d7f}, + {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, {0x20dc0, 0x20dc6}, + {0x20dcf, 0x20dd4}, {0x20dd8, 0x20ddf}, {0x20de6, 0x20def}, {0x20df2, 0x20df4}, + {0x20e01, 0x20e3a}, {0x20e3f, 0x20e5b}, {0x20e94, 0x20e97}, {0x20e99, 0x20e9f}, + {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb9}, {0x20ebb, 0x20ebd}, {0x20ec0, 0x20ec4}, + {0x20ec8, 0x20ecd}, {0x20ed0, 0x20ed9}, {0x20edc, 0x20edf}, {0x20f00, 0x20f47}, + {0x20f49, 0x20f6c}, {0x20f71, 0x20f97}, {0x20f99, 0x20fbc}, {0x20fbe, 0x20fcc}, + {0x20fce, 0x20fda}, {0x21000, 0x210c5}, {0x210d0, 0x21248}, {0x2124a, 0x2124d}, + {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, {0x2128a, 0x2128d}, + {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, {0x212c2, 0x212c5}, + {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, {0x21318, 0x2135a}, + {0x2135d, 0x2137c}, {0x21380, 0x21399}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, + {0x21400, 0x2167f}, {0x21681, 0x2169c}, {0x216a0, 0x216f8}, {0x21700, 0x2170c}, + {0x2170e, 0x21714}, {0x21720, 0x21736}, {0x21740, 0x21753}, {0x21760, 0x2176c}, + {0x2176e, 0x21770}, {0x21780, 0x217dd}, {0x217e0, 0x217e9}, {0x217f0, 0x217f9}, + {0x21800, 0x2180d}, {0x21810, 0x21819}, {0x21820, 0x21877}, {0x21880, 0x218aa}, + {0x218b0, 0x218f5}, {0x21900, 0x2191e}, {0x21920, 0x2192b}, {0x21930, 0x2193b}, + {0x21944, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, {0x219b0, 0x219c9}, + {0x219d0, 0x219da}, {0x219de, 0x21a1b}, {0x21a1e, 0x21a5e}, {0x21a60, 0x21a7c}, + {0x21a7f, 0x21a89}, {0x21a90, 0x21a99}, {0x21aa0, 0x21aad}, {0x21ab0, 0x21abe}, + {0x21b00, 0x21b4b}, {0x21b50, 0x21b7c}, {0x21b80, 0x21bf3}, {0x21bfc, 0x21c37}, + {0x21c3b, 0x21c49}, {0x21c4d, 0x21c88}, {0x21cc0, 0x21cc7}, {0x21cd0, 0x21cf9}, + {0x21d00, 0x21df9}, {0x21dfb, 0x21f15}, {0x21f18, 0x21f1d}, {0x21f20, 0x21f45}, + {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, {0x21f80, 0x21fb4}, + {0x21fb6, 0x21fc4}, {0x21fc6, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fdd, 0x21fef}, + {0x21ff2, 0x21ff4}, {0x21ff6, 0x21ffe}, {0x22010, 0x22027}, {0x22030, 0x2205e}, + {0x22074, 0x2208e}, {0x22090, 0x2209c}, {0x220a0, 0x220bf}, {0x220d0, 0x220f0}, + {0x22100, 0x2218b}, {0x22190, 0x22426}, {0x22440, 0x2244a}, {0x22460, 0x22b73}, + {0x22b76, 0x22b95}, {0x22b98, 0x22bb9}, {0x22bbd, 0x22bc8}, {0x22bca, 0x22bd2}, + {0x22bec, 0x22bef}, {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22cf3}, + {0x22cf9, 0x22d25}, {0x22d30, 0x22d67}, {0x22d7f, 0x22d96}, {0x22da0, 0x22da6}, + {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, + {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x22de0, 0x22e49}, + {0x22e80, 0x22e99}, {0x22e9b, 0x22ef3}, {0x22f00, 0x22fd5}, {0x22ff0, 0x22ffb}, + {0x23001, 0x2303f}, {0x23041, 0x23096}, {0x23099, 0x230ff}, {0x23105, 0x2312e}, + {0x23131, 0x2318e}, {0x23190, 0x231ba}, {0x231c0, 0x231e3}, {0x231f0, 0x2321e}, + {0x23220, 0x232fe}, {0x23300, 0x24db5}, {0x24dc0, 0x29fea}, {0x2a000, 0x2a48c}, + {0x2a490, 0x2a4c6}, {0x2a4d0, 0x2a62b}, {0x2a640, 0x2a6f7}, {0x2a700, 0x2a7ae}, + {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a82b}, {0x2a830, 0x2a839}, {0x2a840, 0x2a877}, + {0x2a880, 0x2a8c5}, {0x2a8ce, 0x2a8d9}, {0x2a8e0, 0x2a8fd}, {0x2a900, 0x2a953}, + {0x2a95f, 0x2a97c}, {0x2a980, 0x2a9cd}, {0x2a9cf, 0x2a9d9}, {0x2a9de, 0x2a9fe}, + {0x2aa00, 0x2aa36}, {0x2aa40, 0x2aa4d}, {0x2aa50, 0x2aa59}, {0x2aa5c, 0x2aac2}, + {0x2aadb, 0x2aaf6}, {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, + {0x2ab20, 0x2ab26}, {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab65}, {0x2ab70, 0x2abed}, + {0x2abf0, 0x2abf9}, {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, + {0x2f900, 0x2fa6d}, {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, + {0x2fb1d, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbc1}, {0x2fbd3, 0x2fd3f}, + {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfd}, {0x2fe00, 0x2fe19}, + {0x2fe20, 0x2fe52}, {0x2fe54, 0x2fe66}, {0x2fe68, 0x2fe6b}, {0x2fe70, 0x2fe74}, + {0x2fe76, 0x2fefc}, {0x2ff01, 0x2ffbe}, {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, + {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, {0x2ffe0, 0x2ffe6}, {0x2ffe8, 0x2ffee}, + {0x30021, 0x3007e}, {0x300a1, 0x300ac}, {0x300ae, 0x30377}, {0x3037a, 0x3037f}, + {0x30384, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x3052f}, {0x30531, 0x30556}, + {0x30559, 0x3055f}, {0x30561, 0x30587}, {0x3058d, 0x3058f}, {0x30591, 0x305c7}, + {0x305d0, 0x305ea}, {0x305f0, 0x305f4}, {0x30606, 0x3061b}, {0x3061e, 0x306dc}, + {0x306de, 0x3070d}, {0x30710, 0x3074a}, {0x3074d, 0x307b1}, {0x307c0, 0x307fa}, + {0x30800, 0x3082d}, {0x30830, 0x3083e}, {0x30840, 0x3085b}, {0x30860, 0x3086a}, + {0x308a0, 0x308b4}, {0x308b6, 0x308bd}, {0x308d4, 0x308e1}, {0x308e3, 0x30983}, + {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, + {0x309bc, 0x309c4}, {0x309cb, 0x309ce}, {0x309df, 0x309e3}, {0x309e6, 0x309fd}, + {0x30a01, 0x30a03}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, + {0x30a3e, 0x30a42}, {0x30a4b, 0x30a4d}, {0x30a59, 0x30a5c}, {0x30a66, 0x30a75}, + {0x30a81, 0x30a83}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, {0x30a93, 0x30aa8}, + {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30abc, 0x30ac5}, {0x30ac7, 0x30ac9}, + {0x30acb, 0x30acd}, {0x30ae0, 0x30ae3}, {0x30ae6, 0x30af1}, {0x30af9, 0x30aff}, + {0x30b01, 0x30b03}, {0x30b05, 0x30b0c}, {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, + {0x30b35, 0x30b39}, {0x30b3c, 0x30b44}, {0x30b4b, 0x30b4d}, {0x30b5f, 0x30b63}, + {0x30b66, 0x30b77}, {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, + {0x30ba8, 0x30baa}, {0x30bae, 0x30bb9}, {0x30bbe, 0x30bc2}, {0x30bc6, 0x30bc8}, + {0x30bca, 0x30bcd}, {0x30be6, 0x30bfa}, {0x30c00, 0x30c03}, {0x30c05, 0x30c0c}, + {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, {0x30c2a, 0x30c39}, {0x30c3d, 0x30c44}, + {0x30c46, 0x30c48}, {0x30c4a, 0x30c4d}, {0x30c58, 0x30c5a}, {0x30c60, 0x30c63}, + {0x30c66, 0x30c6f}, {0x30c78, 0x30c83}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, + {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30cbc, 0x30cc4}, + {0x30cc6, 0x30cc8}, {0x30cca, 0x30ccd}, {0x30ce0, 0x30ce3}, {0x30ce6, 0x30cef}, + {0x30d00, 0x30d03}, {0x30d05, 0x30d0c}, {0x30d0e, 0x30d10}, {0x30d12, 0x30d44}, + {0x30d46, 0x30d48}, {0x30d4a, 0x30d4f}, {0x30d54, 0x30d63}, {0x30d66, 0x30d7f}, + {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, {0x30dc0, 0x30dc6}, + {0x30dcf, 0x30dd4}, {0x30dd8, 0x30ddf}, {0x30de6, 0x30def}, {0x30df2, 0x30df4}, + {0x30e01, 0x30e3a}, {0x30e3f, 0x30e5b}, {0x30e94, 0x30e97}, {0x30e99, 0x30e9f}, + {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb9}, {0x30ebb, 0x30ebd}, {0x30ec0, 0x30ec4}, + {0x30ec8, 0x30ecd}, {0x30ed0, 0x30ed9}, {0x30edc, 0x30edf}, {0x30f00, 0x30f47}, + {0x30f49, 0x30f6c}, {0x30f71, 0x30f97}, {0x30f99, 0x30fbc}, {0x30fbe, 0x30fcc}, + {0x30fce, 0x30fda}, {0x31000, 0x310c5}, {0x310d0, 0x31248}, {0x3124a, 0x3124d}, + {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, {0x3128a, 0x3128d}, + {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, {0x312c2, 0x312c5}, + {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, {0x31318, 0x3135a}, + {0x3135d, 0x3137c}, {0x31380, 0x31399}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, + {0x31400, 0x3167f}, {0x31681, 0x3169c}, {0x316a0, 0x316f8}, {0x31700, 0x3170c}, + {0x3170e, 0x31714}, {0x31720, 0x31736}, {0x31740, 0x31753}, {0x31760, 0x3176c}, + {0x3176e, 0x31770}, {0x31780, 0x317dd}, {0x317e0, 0x317e9}, {0x317f0, 0x317f9}, + {0x31800, 0x3180d}, {0x31810, 0x31819}, {0x31820, 0x31877}, {0x31880, 0x318aa}, + {0x318b0, 0x318f5}, {0x31900, 0x3191e}, {0x31920, 0x3192b}, {0x31930, 0x3193b}, + {0x31944, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, {0x319b0, 0x319c9}, + {0x319d0, 0x319da}, {0x319de, 0x31a1b}, {0x31a1e, 0x31a5e}, {0x31a60, 0x31a7c}, + {0x31a7f, 0x31a89}, {0x31a90, 0x31a99}, {0x31aa0, 0x31aad}, {0x31ab0, 0x31abe}, + {0x31b00, 0x31b4b}, {0x31b50, 0x31b7c}, {0x31b80, 0x31bf3}, {0x31bfc, 0x31c37}, + {0x31c3b, 0x31c49}, {0x31c4d, 0x31c88}, {0x31cc0, 0x31cc7}, {0x31cd0, 0x31cf9}, + {0x31d00, 0x31df9}, {0x31dfb, 0x31f15}, {0x31f18, 0x31f1d}, {0x31f20, 0x31f45}, + {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, {0x31f80, 0x31fb4}, + {0x31fb6, 0x31fc4}, {0x31fc6, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fdd, 0x31fef}, + {0x31ff2, 0x31ff4}, {0x31ff6, 0x31ffe}, {0x32010, 0x32027}, {0x32030, 0x3205e}, + {0x32074, 0x3208e}, {0x32090, 0x3209c}, {0x320a0, 0x320bf}, {0x320d0, 0x320f0}, + {0x32100, 0x3218b}, {0x32190, 0x32426}, {0x32440, 0x3244a}, {0x32460, 0x32b73}, + {0x32b76, 0x32b95}, {0x32b98, 0x32bb9}, {0x32bbd, 0x32bc8}, {0x32bca, 0x32bd2}, + {0x32bec, 0x32bef}, {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32cf3}, + {0x32cf9, 0x32d25}, {0x32d30, 0x32d67}, {0x32d7f, 0x32d96}, {0x32da0, 0x32da6}, + {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, + {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x32de0, 0x32e49}, + {0x32e80, 0x32e99}, {0x32e9b, 0x32ef3}, {0x32f00, 0x32fd5}, {0x32ff0, 0x32ffb}, + {0x33001, 0x3303f}, {0x33041, 0x33096}, {0x33099, 0x330ff}, {0x33105, 0x3312e}, + {0x33131, 0x3318e}, {0x33190, 0x331ba}, {0x331c0, 0x331e3}, {0x331f0, 0x3321e}, + {0x33220, 0x332fe}, {0x33300, 0x34db5}, {0x34dc0, 0x39fea}, {0x3a000, 0x3a48c}, + {0x3a490, 0x3a4c6}, {0x3a4d0, 0x3a62b}, {0x3a640, 0x3a6f7}, {0x3a700, 0x3a7ae}, + {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a82b}, {0x3a830, 0x3a839}, {0x3a840, 0x3a877}, + {0x3a880, 0x3a8c5}, {0x3a8ce, 0x3a8d9}, {0x3a8e0, 0x3a8fd}, {0x3a900, 0x3a953}, + {0x3a95f, 0x3a97c}, {0x3a980, 0x3a9cd}, {0x3a9cf, 0x3a9d9}, {0x3a9de, 0x3a9fe}, + {0x3aa00, 0x3aa36}, {0x3aa40, 0x3aa4d}, {0x3aa50, 0x3aa59}, {0x3aa5c, 0x3aac2}, + {0x3aadb, 0x3aaf6}, {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, + {0x3ab20, 0x3ab26}, {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab65}, {0x3ab70, 0x3abed}, + {0x3abf0, 0x3abf9}, {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, + {0x3f900, 0x3fa6d}, {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, + {0x3fb1d, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbc1}, {0x3fbd3, 0x3fd3f}, + {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfd}, {0x3fe00, 0x3fe19}, + {0x3fe20, 0x3fe52}, {0x3fe54, 0x3fe66}, {0x3fe68, 0x3fe6b}, {0x3fe70, 0x3fe74}, + {0x3fe76, 0x3fefc}, {0x3ff01, 0x3ffbe}, {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, + {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, {0x3ffe0, 0x3ffe6}, {0x3ffe8, 0x3ffee}, + {0x40021, 0x4007e}, {0x400a1, 0x400ac}, {0x400ae, 0x40377}, {0x4037a, 0x4037f}, + {0x40384, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x4052f}, {0x40531, 0x40556}, + {0x40559, 0x4055f}, {0x40561, 0x40587}, {0x4058d, 0x4058f}, {0x40591, 0x405c7}, + {0x405d0, 0x405ea}, {0x405f0, 0x405f4}, {0x40606, 0x4061b}, {0x4061e, 0x406dc}, + {0x406de, 0x4070d}, {0x40710, 0x4074a}, {0x4074d, 0x407b1}, {0x407c0, 0x407fa}, + {0x40800, 0x4082d}, {0x40830, 0x4083e}, {0x40840, 0x4085b}, {0x40860, 0x4086a}, + {0x408a0, 0x408b4}, {0x408b6, 0x408bd}, {0x408d4, 0x408e1}, {0x408e3, 0x40983}, + {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, + {0x409bc, 0x409c4}, {0x409cb, 0x409ce}, {0x409df, 0x409e3}, {0x409e6, 0x409fd}, + {0x40a01, 0x40a03}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, + {0x40a3e, 0x40a42}, {0x40a4b, 0x40a4d}, {0x40a59, 0x40a5c}, {0x40a66, 0x40a75}, + {0x40a81, 0x40a83}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, {0x40a93, 0x40aa8}, + {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40abc, 0x40ac5}, {0x40ac7, 0x40ac9}, + {0x40acb, 0x40acd}, {0x40ae0, 0x40ae3}, {0x40ae6, 0x40af1}, {0x40af9, 0x40aff}, + {0x40b01, 0x40b03}, {0x40b05, 0x40b0c}, {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, + {0x40b35, 0x40b39}, {0x40b3c, 0x40b44}, {0x40b4b, 0x40b4d}, {0x40b5f, 0x40b63}, + {0x40b66, 0x40b77}, {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, + {0x40ba8, 0x40baa}, {0x40bae, 0x40bb9}, {0x40bbe, 0x40bc2}, {0x40bc6, 0x40bc8}, + {0x40bca, 0x40bcd}, {0x40be6, 0x40bfa}, {0x40c00, 0x40c03}, {0x40c05, 0x40c0c}, + {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, {0x40c2a, 0x40c39}, {0x40c3d, 0x40c44}, + {0x40c46, 0x40c48}, {0x40c4a, 0x40c4d}, {0x40c58, 0x40c5a}, {0x40c60, 0x40c63}, + {0x40c66, 0x40c6f}, {0x40c78, 0x40c83}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, + {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40cbc, 0x40cc4}, + {0x40cc6, 0x40cc8}, {0x40cca, 0x40ccd}, {0x40ce0, 0x40ce3}, {0x40ce6, 0x40cef}, + {0x40d00, 0x40d03}, {0x40d05, 0x40d0c}, {0x40d0e, 0x40d10}, {0x40d12, 0x40d44}, + {0x40d46, 0x40d48}, {0x40d4a, 0x40d4f}, {0x40d54, 0x40d63}, {0x40d66, 0x40d7f}, + {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, {0x40dc0, 0x40dc6}, + {0x40dcf, 0x40dd4}, {0x40dd8, 0x40ddf}, {0x40de6, 0x40def}, {0x40df2, 0x40df4}, + {0x40e01, 0x40e3a}, {0x40e3f, 0x40e5b}, {0x40e94, 0x40e97}, {0x40e99, 0x40e9f}, + {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb9}, {0x40ebb, 0x40ebd}, {0x40ec0, 0x40ec4}, + {0x40ec8, 0x40ecd}, {0x40ed0, 0x40ed9}, {0x40edc, 0x40edf}, {0x40f00, 0x40f47}, + {0x40f49, 0x40f6c}, {0x40f71, 0x40f97}, {0x40f99, 0x40fbc}, {0x40fbe, 0x40fcc}, + {0x40fce, 0x40fda}, {0x41000, 0x410c5}, {0x410d0, 0x41248}, {0x4124a, 0x4124d}, + {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, {0x4128a, 0x4128d}, + {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, {0x412c2, 0x412c5}, + {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, {0x41318, 0x4135a}, + {0x4135d, 0x4137c}, {0x41380, 0x41399}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, + {0x41400, 0x4167f}, {0x41681, 0x4169c}, {0x416a0, 0x416f8}, {0x41700, 0x4170c}, + {0x4170e, 0x41714}, {0x41720, 0x41736}, {0x41740, 0x41753}, {0x41760, 0x4176c}, + {0x4176e, 0x41770}, {0x41780, 0x417dd}, {0x417e0, 0x417e9}, {0x417f0, 0x417f9}, + {0x41800, 0x4180d}, {0x41810, 0x41819}, {0x41820, 0x41877}, {0x41880, 0x418aa}, + {0x418b0, 0x418f5}, {0x41900, 0x4191e}, {0x41920, 0x4192b}, {0x41930, 0x4193b}, + {0x41944, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, {0x419b0, 0x419c9}, + {0x419d0, 0x419da}, {0x419de, 0x41a1b}, {0x41a1e, 0x41a5e}, {0x41a60, 0x41a7c}, + {0x41a7f, 0x41a89}, {0x41a90, 0x41a99}, {0x41aa0, 0x41aad}, {0x41ab0, 0x41abe}, + {0x41b00, 0x41b4b}, {0x41b50, 0x41b7c}, {0x41b80, 0x41bf3}, {0x41bfc, 0x41c37}, + {0x41c3b, 0x41c49}, {0x41c4d, 0x41c88}, {0x41cc0, 0x41cc7}, {0x41cd0, 0x41cf9}, + {0x41d00, 0x41df9}, {0x41dfb, 0x41f15}, {0x41f18, 0x41f1d}, {0x41f20, 0x41f45}, + {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, {0x41f80, 0x41fb4}, + {0x41fb6, 0x41fc4}, {0x41fc6, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fdd, 0x41fef}, + {0x41ff2, 0x41ff4}, {0x41ff6, 0x41ffe}, {0x42010, 0x42027}, {0x42030, 0x4205e}, + {0x42074, 0x4208e}, {0x42090, 0x4209c}, {0x420a0, 0x420bf}, {0x420d0, 0x420f0}, + {0x42100, 0x4218b}, {0x42190, 0x42426}, {0x42440, 0x4244a}, {0x42460, 0x42b73}, + {0x42b76, 0x42b95}, {0x42b98, 0x42bb9}, {0x42bbd, 0x42bc8}, {0x42bca, 0x42bd2}, + {0x42bec, 0x42bef}, {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42cf3}, + {0x42cf9, 0x42d25}, {0x42d30, 0x42d67}, {0x42d7f, 0x42d96}, {0x42da0, 0x42da6}, + {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, + {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x42de0, 0x42e49}, + {0x42e80, 0x42e99}, {0x42e9b, 0x42ef3}, {0x42f00, 0x42fd5}, {0x42ff0, 0x42ffb}, + {0x43001, 0x4303f}, {0x43041, 0x43096}, {0x43099, 0x430ff}, {0x43105, 0x4312e}, + {0x43131, 0x4318e}, {0x43190, 0x431ba}, {0x431c0, 0x431e3}, {0x431f0, 0x4321e}, + {0x43220, 0x432fe}, {0x43300, 0x44db5}, {0x44dc0, 0x49fea}, {0x4a000, 0x4a48c}, + {0x4a490, 0x4a4c6}, {0x4a4d0, 0x4a62b}, {0x4a640, 0x4a6f7}, {0x4a700, 0x4a7ae}, + {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a82b}, {0x4a830, 0x4a839}, {0x4a840, 0x4a877}, + {0x4a880, 0x4a8c5}, {0x4a8ce, 0x4a8d9}, {0x4a8e0, 0x4a8fd}, {0x4a900, 0x4a953}, + {0x4a95f, 0x4a97c}, {0x4a980, 0x4a9cd}, {0x4a9cf, 0x4a9d9}, {0x4a9de, 0x4a9fe}, + {0x4aa00, 0x4aa36}, {0x4aa40, 0x4aa4d}, {0x4aa50, 0x4aa59}, {0x4aa5c, 0x4aac2}, + {0x4aadb, 0x4aaf6}, {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, + {0x4ab20, 0x4ab26}, {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab65}, {0x4ab70, 0x4abed}, + {0x4abf0, 0x4abf9}, {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, + {0x4f900, 0x4fa6d}, {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, + {0x4fb1d, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbc1}, {0x4fbd3, 0x4fd3f}, + {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfd}, {0x4fe00, 0x4fe19}, + {0x4fe20, 0x4fe52}, {0x4fe54, 0x4fe66}, {0x4fe68, 0x4fe6b}, {0x4fe70, 0x4fe74}, + {0x4fe76, 0x4fefc}, {0x4ff01, 0x4ffbe}, {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, + {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, {0x4ffe0, 0x4ffe6}, {0x4ffe8, 0x4ffee}, + {0x50021, 0x5007e}, {0x500a1, 0x500ac}, {0x500ae, 0x50377}, {0x5037a, 0x5037f}, + {0x50384, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x5052f}, {0x50531, 0x50556}, + {0x50559, 0x5055f}, {0x50561, 0x50587}, {0x5058d, 0x5058f}, {0x50591, 0x505c7}, + {0x505d0, 0x505ea}, {0x505f0, 0x505f4}, {0x50606, 0x5061b}, {0x5061e, 0x506dc}, + {0x506de, 0x5070d}, {0x50710, 0x5074a}, {0x5074d, 0x507b1}, {0x507c0, 0x507fa}, + {0x50800, 0x5082d}, {0x50830, 0x5083e}, {0x50840, 0x5085b}, {0x50860, 0x5086a}, + {0x508a0, 0x508b4}, {0x508b6, 0x508bd}, {0x508d4, 0x508e1}, {0x508e3, 0x50983}, + {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, + {0x509bc, 0x509c4}, {0x509cb, 0x509ce}, {0x509df, 0x509e3}, {0x509e6, 0x509fd}, + {0x50a01, 0x50a03}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, + {0x50a3e, 0x50a42}, {0x50a4b, 0x50a4d}, {0x50a59, 0x50a5c}, {0x50a66, 0x50a75}, + {0x50a81, 0x50a83}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, {0x50a93, 0x50aa8}, + {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50abc, 0x50ac5}, {0x50ac7, 0x50ac9}, + {0x50acb, 0x50acd}, {0x50ae0, 0x50ae3}, {0x50ae6, 0x50af1}, {0x50af9, 0x50aff}, + {0x50b01, 0x50b03}, {0x50b05, 0x50b0c}, {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, + {0x50b35, 0x50b39}, {0x50b3c, 0x50b44}, {0x50b4b, 0x50b4d}, {0x50b5f, 0x50b63}, + {0x50b66, 0x50b77}, {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, + {0x50ba8, 0x50baa}, {0x50bae, 0x50bb9}, {0x50bbe, 0x50bc2}, {0x50bc6, 0x50bc8}, + {0x50bca, 0x50bcd}, {0x50be6, 0x50bfa}, {0x50c00, 0x50c03}, {0x50c05, 0x50c0c}, + {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, {0x50c2a, 0x50c39}, {0x50c3d, 0x50c44}, + {0x50c46, 0x50c48}, {0x50c4a, 0x50c4d}, {0x50c58, 0x50c5a}, {0x50c60, 0x50c63}, + {0x50c66, 0x50c6f}, {0x50c78, 0x50c83}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, + {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50cbc, 0x50cc4}, + {0x50cc6, 0x50cc8}, {0x50cca, 0x50ccd}, {0x50ce0, 0x50ce3}, {0x50ce6, 0x50cef}, + {0x50d00, 0x50d03}, {0x50d05, 0x50d0c}, {0x50d0e, 0x50d10}, {0x50d12, 0x50d44}, + {0x50d46, 0x50d48}, {0x50d4a, 0x50d4f}, {0x50d54, 0x50d63}, {0x50d66, 0x50d7f}, + {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, {0x50dc0, 0x50dc6}, + {0x50dcf, 0x50dd4}, {0x50dd8, 0x50ddf}, {0x50de6, 0x50def}, {0x50df2, 0x50df4}, + {0x50e01, 0x50e3a}, {0x50e3f, 0x50e5b}, {0x50e94, 0x50e97}, {0x50e99, 0x50e9f}, + {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb9}, {0x50ebb, 0x50ebd}, {0x50ec0, 0x50ec4}, + {0x50ec8, 0x50ecd}, {0x50ed0, 0x50ed9}, {0x50edc, 0x50edf}, {0x50f00, 0x50f47}, + {0x50f49, 0x50f6c}, {0x50f71, 0x50f97}, {0x50f99, 0x50fbc}, {0x50fbe, 0x50fcc}, + {0x50fce, 0x50fda}, {0x51000, 0x510c5}, {0x510d0, 0x51248}, {0x5124a, 0x5124d}, + {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, {0x5128a, 0x5128d}, + {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, {0x512c2, 0x512c5}, + {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, {0x51318, 0x5135a}, + {0x5135d, 0x5137c}, {0x51380, 0x51399}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, + {0x51400, 0x5167f}, {0x51681, 0x5169c}, {0x516a0, 0x516f8}, {0x51700, 0x5170c}, + {0x5170e, 0x51714}, {0x51720, 0x51736}, {0x51740, 0x51753}, {0x51760, 0x5176c}, + {0x5176e, 0x51770}, {0x51780, 0x517dd}, {0x517e0, 0x517e9}, {0x517f0, 0x517f9}, + {0x51800, 0x5180d}, {0x51810, 0x51819}, {0x51820, 0x51877}, {0x51880, 0x518aa}, + {0x518b0, 0x518f5}, {0x51900, 0x5191e}, {0x51920, 0x5192b}, {0x51930, 0x5193b}, + {0x51944, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, {0x519b0, 0x519c9}, + {0x519d0, 0x519da}, {0x519de, 0x51a1b}, {0x51a1e, 0x51a5e}, {0x51a60, 0x51a7c}, + {0x51a7f, 0x51a89}, {0x51a90, 0x51a99}, {0x51aa0, 0x51aad}, {0x51ab0, 0x51abe}, + {0x51b00, 0x51b4b}, {0x51b50, 0x51b7c}, {0x51b80, 0x51bf3}, {0x51bfc, 0x51c37}, + {0x51c3b, 0x51c49}, {0x51c4d, 0x51c88}, {0x51cc0, 0x51cc7}, {0x51cd0, 0x51cf9}, + {0x51d00, 0x51df9}, {0x51dfb, 0x51f15}, {0x51f18, 0x51f1d}, {0x51f20, 0x51f45}, + {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, {0x51f80, 0x51fb4}, + {0x51fb6, 0x51fc4}, {0x51fc6, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fdd, 0x51fef}, + {0x51ff2, 0x51ff4}, {0x51ff6, 0x51ffe}, {0x52010, 0x52027}, {0x52030, 0x5205e}, + {0x52074, 0x5208e}, {0x52090, 0x5209c}, {0x520a0, 0x520bf}, {0x520d0, 0x520f0}, + {0x52100, 0x5218b}, {0x52190, 0x52426}, {0x52440, 0x5244a}, {0x52460, 0x52b73}, + {0x52b76, 0x52b95}, {0x52b98, 0x52bb9}, {0x52bbd, 0x52bc8}, {0x52bca, 0x52bd2}, + {0x52bec, 0x52bef}, {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52cf3}, + {0x52cf9, 0x52d25}, {0x52d30, 0x52d67}, {0x52d7f, 0x52d96}, {0x52da0, 0x52da6}, + {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, + {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x52de0, 0x52e49}, + {0x52e80, 0x52e99}, {0x52e9b, 0x52ef3}, {0x52f00, 0x52fd5}, {0x52ff0, 0x52ffb}, + {0x53001, 0x5303f}, {0x53041, 0x53096}, {0x53099, 0x530ff}, {0x53105, 0x5312e}, + {0x53131, 0x5318e}, {0x53190, 0x531ba}, {0x531c0, 0x531e3}, {0x531f0, 0x5321e}, + {0x53220, 0x532fe}, {0x53300, 0x54db5}, {0x54dc0, 0x59fea}, {0x5a000, 0x5a48c}, + {0x5a490, 0x5a4c6}, {0x5a4d0, 0x5a62b}, {0x5a640, 0x5a6f7}, {0x5a700, 0x5a7ae}, + {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a82b}, {0x5a830, 0x5a839}, {0x5a840, 0x5a877}, + {0x5a880, 0x5a8c5}, {0x5a8ce, 0x5a8d9}, {0x5a8e0, 0x5a8fd}, {0x5a900, 0x5a953}, + {0x5a95f, 0x5a97c}, {0x5a980, 0x5a9cd}, {0x5a9cf, 0x5a9d9}, {0x5a9de, 0x5a9fe}, + {0x5aa00, 0x5aa36}, {0x5aa40, 0x5aa4d}, {0x5aa50, 0x5aa59}, {0x5aa5c, 0x5aac2}, + {0x5aadb, 0x5aaf6}, {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, + {0x5ab20, 0x5ab26}, {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab65}, {0x5ab70, 0x5abed}, + {0x5abf0, 0x5abf9}, {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, + {0x5f900, 0x5fa6d}, {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, + {0x5fb1d, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbc1}, {0x5fbd3, 0x5fd3f}, + {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfd}, {0x5fe00, 0x5fe19}, + {0x5fe20, 0x5fe52}, {0x5fe54, 0x5fe66}, {0x5fe68, 0x5fe6b}, {0x5fe70, 0x5fe74}, + {0x5fe76, 0x5fefc}, {0x5ff01, 0x5ffbe}, {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, + {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, {0x5ffe0, 0x5ffe6}, {0x5ffe8, 0x5ffee}, + {0x60021, 0x6007e}, {0x600a1, 0x600ac}, {0x600ae, 0x60377}, {0x6037a, 0x6037f}, + {0x60384, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x6052f}, {0x60531, 0x60556}, + {0x60559, 0x6055f}, {0x60561, 0x60587}, {0x6058d, 0x6058f}, {0x60591, 0x605c7}, + {0x605d0, 0x605ea}, {0x605f0, 0x605f4}, {0x60606, 0x6061b}, {0x6061e, 0x606dc}, + {0x606de, 0x6070d}, {0x60710, 0x6074a}, {0x6074d, 0x607b1}, {0x607c0, 0x607fa}, + {0x60800, 0x6082d}, {0x60830, 0x6083e}, {0x60840, 0x6085b}, {0x60860, 0x6086a}, + {0x608a0, 0x608b4}, {0x608b6, 0x608bd}, {0x608d4, 0x608e1}, {0x608e3, 0x60983}, + {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, + {0x609bc, 0x609c4}, {0x609cb, 0x609ce}, {0x609df, 0x609e3}, {0x609e6, 0x609fd}, + {0x60a01, 0x60a03}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, + {0x60a3e, 0x60a42}, {0x60a4b, 0x60a4d}, {0x60a59, 0x60a5c}, {0x60a66, 0x60a75}, + {0x60a81, 0x60a83}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, {0x60a93, 0x60aa8}, + {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60abc, 0x60ac5}, {0x60ac7, 0x60ac9}, + {0x60acb, 0x60acd}, {0x60ae0, 0x60ae3}, {0x60ae6, 0x60af1}, {0x60af9, 0x60aff}, + {0x60b01, 0x60b03}, {0x60b05, 0x60b0c}, {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, + {0x60b35, 0x60b39}, {0x60b3c, 0x60b44}, {0x60b4b, 0x60b4d}, {0x60b5f, 0x60b63}, + {0x60b66, 0x60b77}, {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, + {0x60ba8, 0x60baa}, {0x60bae, 0x60bb9}, {0x60bbe, 0x60bc2}, {0x60bc6, 0x60bc8}, + {0x60bca, 0x60bcd}, {0x60be6, 0x60bfa}, {0x60c00, 0x60c03}, {0x60c05, 0x60c0c}, + {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, {0x60c2a, 0x60c39}, {0x60c3d, 0x60c44}, + {0x60c46, 0x60c48}, {0x60c4a, 0x60c4d}, {0x60c58, 0x60c5a}, {0x60c60, 0x60c63}, + {0x60c66, 0x60c6f}, {0x60c78, 0x60c83}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, + {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60cbc, 0x60cc4}, + {0x60cc6, 0x60cc8}, {0x60cca, 0x60ccd}, {0x60ce0, 0x60ce3}, {0x60ce6, 0x60cef}, + {0x60d00, 0x60d03}, {0x60d05, 0x60d0c}, {0x60d0e, 0x60d10}, {0x60d12, 0x60d44}, + {0x60d46, 0x60d48}, {0x60d4a, 0x60d4f}, {0x60d54, 0x60d63}, {0x60d66, 0x60d7f}, + {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, {0x60dc0, 0x60dc6}, + {0x60dcf, 0x60dd4}, {0x60dd8, 0x60ddf}, {0x60de6, 0x60def}, {0x60df2, 0x60df4}, + {0x60e01, 0x60e3a}, {0x60e3f, 0x60e5b}, {0x60e94, 0x60e97}, {0x60e99, 0x60e9f}, + {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb9}, {0x60ebb, 0x60ebd}, {0x60ec0, 0x60ec4}, + {0x60ec8, 0x60ecd}, {0x60ed0, 0x60ed9}, {0x60edc, 0x60edf}, {0x60f00, 0x60f47}, + {0x60f49, 0x60f6c}, {0x60f71, 0x60f97}, {0x60f99, 0x60fbc}, {0x60fbe, 0x60fcc}, + {0x60fce, 0x60fda}, {0x61000, 0x610c5}, {0x610d0, 0x61248}, {0x6124a, 0x6124d}, + {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, {0x6128a, 0x6128d}, + {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, {0x612c2, 0x612c5}, + {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, {0x61318, 0x6135a}, + {0x6135d, 0x6137c}, {0x61380, 0x61399}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, + {0x61400, 0x6167f}, {0x61681, 0x6169c}, {0x616a0, 0x616f8}, {0x61700, 0x6170c}, + {0x6170e, 0x61714}, {0x61720, 0x61736}, {0x61740, 0x61753}, {0x61760, 0x6176c}, + {0x6176e, 0x61770}, {0x61780, 0x617dd}, {0x617e0, 0x617e9}, {0x617f0, 0x617f9}, + {0x61800, 0x6180d}, {0x61810, 0x61819}, {0x61820, 0x61877}, {0x61880, 0x618aa}, + {0x618b0, 0x618f5}, {0x61900, 0x6191e}, {0x61920, 0x6192b}, {0x61930, 0x6193b}, + {0x61944, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, {0x619b0, 0x619c9}, + {0x619d0, 0x619da}, {0x619de, 0x61a1b}, {0x61a1e, 0x61a5e}, {0x61a60, 0x61a7c}, + {0x61a7f, 0x61a89}, {0x61a90, 0x61a99}, {0x61aa0, 0x61aad}, {0x61ab0, 0x61abe}, + {0x61b00, 0x61b4b}, {0x61b50, 0x61b7c}, {0x61b80, 0x61bf3}, {0x61bfc, 0x61c37}, + {0x61c3b, 0x61c49}, {0x61c4d, 0x61c88}, {0x61cc0, 0x61cc7}, {0x61cd0, 0x61cf9}, + {0x61d00, 0x61df9}, {0x61dfb, 0x61f15}, {0x61f18, 0x61f1d}, {0x61f20, 0x61f45}, + {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, {0x61f80, 0x61fb4}, + {0x61fb6, 0x61fc4}, {0x61fc6, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fdd, 0x61fef}, + {0x61ff2, 0x61ff4}, {0x61ff6, 0x61ffe}, {0x62010, 0x62027}, {0x62030, 0x6205e}, + {0x62074, 0x6208e}, {0x62090, 0x6209c}, {0x620a0, 0x620bf}, {0x620d0, 0x620f0}, + {0x62100, 0x6218b}, {0x62190, 0x62426}, {0x62440, 0x6244a}, {0x62460, 0x62b73}, + {0x62b76, 0x62b95}, {0x62b98, 0x62bb9}, {0x62bbd, 0x62bc8}, {0x62bca, 0x62bd2}, + {0x62bec, 0x62bef}, {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62cf3}, + {0x62cf9, 0x62d25}, {0x62d30, 0x62d67}, {0x62d7f, 0x62d96}, {0x62da0, 0x62da6}, + {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, + {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x62de0, 0x62e49}, + {0x62e80, 0x62e99}, {0x62e9b, 0x62ef3}, {0x62f00, 0x62fd5}, {0x62ff0, 0x62ffb}, + {0x63001, 0x6303f}, {0x63041, 0x63096}, {0x63099, 0x630ff}, {0x63105, 0x6312e}, + {0x63131, 0x6318e}, {0x63190, 0x631ba}, {0x631c0, 0x631e3}, {0x631f0, 0x6321e}, + {0x63220, 0x632fe}, {0x63300, 0x64db5}, {0x64dc0, 0x69fea}, {0x6a000, 0x6a48c}, + {0x6a490, 0x6a4c6}, {0x6a4d0, 0x6a62b}, {0x6a640, 0x6a6f7}, {0x6a700, 0x6a7ae}, + {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a82b}, {0x6a830, 0x6a839}, {0x6a840, 0x6a877}, + {0x6a880, 0x6a8c5}, {0x6a8ce, 0x6a8d9}, {0x6a8e0, 0x6a8fd}, {0x6a900, 0x6a953}, + {0x6a95f, 0x6a97c}, {0x6a980, 0x6a9cd}, {0x6a9cf, 0x6a9d9}, {0x6a9de, 0x6a9fe}, + {0x6aa00, 0x6aa36}, {0x6aa40, 0x6aa4d}, {0x6aa50, 0x6aa59}, {0x6aa5c, 0x6aac2}, + {0x6aadb, 0x6aaf6}, {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, + {0x6ab20, 0x6ab26}, {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab65}, {0x6ab70, 0x6abed}, + {0x6abf0, 0x6abf9}, {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, + {0x6f900, 0x6fa6d}, {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, + {0x6fb1d, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbc1}, {0x6fbd3, 0x6fd3f}, + {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfd}, {0x6fe00, 0x6fe19}, + {0x6fe20, 0x6fe52}, {0x6fe54, 0x6fe66}, {0x6fe68, 0x6fe6b}, {0x6fe70, 0x6fe74}, + {0x6fe76, 0x6fefc}, {0x6ff01, 0x6ffbe}, {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, + {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, {0x6ffe0, 0x6ffe6}, {0x6ffe8, 0x6ffee}, + {0x70021, 0x7007e}, {0x700a1, 0x700ac}, {0x700ae, 0x70377}, {0x7037a, 0x7037f}, + {0x70384, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x7052f}, {0x70531, 0x70556}, + {0x70559, 0x7055f}, {0x70561, 0x70587}, {0x7058d, 0x7058f}, {0x70591, 0x705c7}, + {0x705d0, 0x705ea}, {0x705f0, 0x705f4}, {0x70606, 0x7061b}, {0x7061e, 0x706dc}, + {0x706de, 0x7070d}, {0x70710, 0x7074a}, {0x7074d, 0x707b1}, {0x707c0, 0x707fa}, + {0x70800, 0x7082d}, {0x70830, 0x7083e}, {0x70840, 0x7085b}, {0x70860, 0x7086a}, + {0x708a0, 0x708b4}, {0x708b6, 0x708bd}, {0x708d4, 0x708e1}, {0x708e3, 0x70983}, + {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, + {0x709bc, 0x709c4}, {0x709cb, 0x709ce}, {0x709df, 0x709e3}, {0x709e6, 0x709fd}, + {0x70a01, 0x70a03}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, + {0x70a3e, 0x70a42}, {0x70a4b, 0x70a4d}, {0x70a59, 0x70a5c}, {0x70a66, 0x70a75}, + {0x70a81, 0x70a83}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, {0x70a93, 0x70aa8}, + {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70abc, 0x70ac5}, {0x70ac7, 0x70ac9}, + {0x70acb, 0x70acd}, {0x70ae0, 0x70ae3}, {0x70ae6, 0x70af1}, {0x70af9, 0x70aff}, + {0x70b01, 0x70b03}, {0x70b05, 0x70b0c}, {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, + {0x70b35, 0x70b39}, {0x70b3c, 0x70b44}, {0x70b4b, 0x70b4d}, {0x70b5f, 0x70b63}, + {0x70b66, 0x70b77}, {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, + {0x70ba8, 0x70baa}, {0x70bae, 0x70bb9}, {0x70bbe, 0x70bc2}, {0x70bc6, 0x70bc8}, + {0x70bca, 0x70bcd}, {0x70be6, 0x70bfa}, {0x70c00, 0x70c03}, {0x70c05, 0x70c0c}, + {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, {0x70c2a, 0x70c39}, {0x70c3d, 0x70c44}, + {0x70c46, 0x70c48}, {0x70c4a, 0x70c4d}, {0x70c58, 0x70c5a}, {0x70c60, 0x70c63}, + {0x70c66, 0x70c6f}, {0x70c78, 0x70c83}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, + {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70cbc, 0x70cc4}, + {0x70cc6, 0x70cc8}, {0x70cca, 0x70ccd}, {0x70ce0, 0x70ce3}, {0x70ce6, 0x70cef}, + {0x70d00, 0x70d03}, {0x70d05, 0x70d0c}, {0x70d0e, 0x70d10}, {0x70d12, 0x70d44}, + {0x70d46, 0x70d48}, {0x70d4a, 0x70d4f}, {0x70d54, 0x70d63}, {0x70d66, 0x70d7f}, + {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, {0x70dc0, 0x70dc6}, + {0x70dcf, 0x70dd4}, {0x70dd8, 0x70ddf}, {0x70de6, 0x70def}, {0x70df2, 0x70df4}, + {0x70e01, 0x70e3a}, {0x70e3f, 0x70e5b}, {0x70e94, 0x70e97}, {0x70e99, 0x70e9f}, + {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb9}, {0x70ebb, 0x70ebd}, {0x70ec0, 0x70ec4}, + {0x70ec8, 0x70ecd}, {0x70ed0, 0x70ed9}, {0x70edc, 0x70edf}, {0x70f00, 0x70f47}, + {0x70f49, 0x70f6c}, {0x70f71, 0x70f97}, {0x70f99, 0x70fbc}, {0x70fbe, 0x70fcc}, + {0x70fce, 0x70fda}, {0x71000, 0x710c5}, {0x710d0, 0x71248}, {0x7124a, 0x7124d}, + {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, {0x7128a, 0x7128d}, + {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, {0x712c2, 0x712c5}, + {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, {0x71318, 0x7135a}, + {0x7135d, 0x7137c}, {0x71380, 0x71399}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, + {0x71400, 0x7167f}, {0x71681, 0x7169c}, {0x716a0, 0x716f8}, {0x71700, 0x7170c}, + {0x7170e, 0x71714}, {0x71720, 0x71736}, {0x71740, 0x71753}, {0x71760, 0x7176c}, + {0x7176e, 0x71770}, {0x71780, 0x717dd}, {0x717e0, 0x717e9}, {0x717f0, 0x717f9}, + {0x71800, 0x7180d}, {0x71810, 0x71819}, {0x71820, 0x71877}, {0x71880, 0x718aa}, + {0x718b0, 0x718f5}, {0x71900, 0x7191e}, {0x71920, 0x7192b}, {0x71930, 0x7193b}, + {0x71944, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, {0x719b0, 0x719c9}, + {0x719d0, 0x719da}, {0x719de, 0x71a1b}, {0x71a1e, 0x71a5e}, {0x71a60, 0x71a7c}, + {0x71a7f, 0x71a89}, {0x71a90, 0x71a99}, {0x71aa0, 0x71aad}, {0x71ab0, 0x71abe}, + {0x71b00, 0x71b4b}, {0x71b50, 0x71b7c}, {0x71b80, 0x71bf3}, {0x71bfc, 0x71c37}, + {0x71c3b, 0x71c49}, {0x71c4d, 0x71c88}, {0x71cc0, 0x71cc7}, {0x71cd0, 0x71cf9}, + {0x71d00, 0x71df9}, {0x71dfb, 0x71f15}, {0x71f18, 0x71f1d}, {0x71f20, 0x71f45}, + {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, {0x71f80, 0x71fb4}, + {0x71fb6, 0x71fc4}, {0x71fc6, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fdd, 0x71fef}, + {0x71ff2, 0x71ff4}, {0x71ff6, 0x71ffe}, {0x72010, 0x72027}, {0x72030, 0x7205e}, + {0x72074, 0x7208e}, {0x72090, 0x7209c}, {0x720a0, 0x720bf}, {0x720d0, 0x720f0}, + {0x72100, 0x7218b}, {0x72190, 0x72426}, {0x72440, 0x7244a}, {0x72460, 0x72b73}, + {0x72b76, 0x72b95}, {0x72b98, 0x72bb9}, {0x72bbd, 0x72bc8}, {0x72bca, 0x72bd2}, + {0x72bec, 0x72bef}, {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72cf3}, + {0x72cf9, 0x72d25}, {0x72d30, 0x72d67}, {0x72d7f, 0x72d96}, {0x72da0, 0x72da6}, + {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, + {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x72de0, 0x72e49}, + {0x72e80, 0x72e99}, {0x72e9b, 0x72ef3}, {0x72f00, 0x72fd5}, {0x72ff0, 0x72ffb}, + {0x73001, 0x7303f}, {0x73041, 0x73096}, {0x73099, 0x730ff}, {0x73105, 0x7312e}, + {0x73131, 0x7318e}, {0x73190, 0x731ba}, {0x731c0, 0x731e3}, {0x731f0, 0x7321e}, + {0x73220, 0x732fe}, {0x73300, 0x74db5}, {0x74dc0, 0x79fea}, {0x7a000, 0x7a48c}, + {0x7a490, 0x7a4c6}, {0x7a4d0, 0x7a62b}, {0x7a640, 0x7a6f7}, {0x7a700, 0x7a7ae}, + {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a82b}, {0x7a830, 0x7a839}, {0x7a840, 0x7a877}, + {0x7a880, 0x7a8c5}, {0x7a8ce, 0x7a8d9}, {0x7a8e0, 0x7a8fd}, {0x7a900, 0x7a953}, + {0x7a95f, 0x7a97c}, {0x7a980, 0x7a9cd}, {0x7a9cf, 0x7a9d9}, {0x7a9de, 0x7a9fe}, + {0x7aa00, 0x7aa36}, {0x7aa40, 0x7aa4d}, {0x7aa50, 0x7aa59}, {0x7aa5c, 0x7aac2}, + {0x7aadb, 0x7aaf6}, {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, + {0x7ab20, 0x7ab26}, {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab65}, {0x7ab70, 0x7abed}, + {0x7abf0, 0x7abf9}, {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, + {0x7f900, 0x7fa6d}, {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, + {0x7fb1d, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbc1}, {0x7fbd3, 0x7fd3f}, + {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfd}, {0x7fe00, 0x7fe19}, + {0x7fe20, 0x7fe52}, {0x7fe54, 0x7fe66}, {0x7fe68, 0x7fe6b}, {0x7fe70, 0x7fe74}, + {0x7fe76, 0x7fefc}, {0x7ff01, 0x7ffbe}, {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, + {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, {0x7ffe0, 0x7ffe6}, {0x7ffe8, 0x7ffee}, + {0x80021, 0x8007e}, {0x800a1, 0x800ac}, {0x800ae, 0x80377}, {0x8037a, 0x8037f}, + {0x80384, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x8052f}, {0x80531, 0x80556}, + {0x80559, 0x8055f}, {0x80561, 0x80587}, {0x8058d, 0x8058f}, {0x80591, 0x805c7}, + {0x805d0, 0x805ea}, {0x805f0, 0x805f4}, {0x80606, 0x8061b}, {0x8061e, 0x806dc}, + {0x806de, 0x8070d}, {0x80710, 0x8074a}, {0x8074d, 0x807b1}, {0x807c0, 0x807fa}, + {0x80800, 0x8082d}, {0x80830, 0x8083e}, {0x80840, 0x8085b}, {0x80860, 0x8086a}, + {0x808a0, 0x808b4}, {0x808b6, 0x808bd}, {0x808d4, 0x808e1}, {0x808e3, 0x80983}, + {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, + {0x809bc, 0x809c4}, {0x809cb, 0x809ce}, {0x809df, 0x809e3}, {0x809e6, 0x809fd}, + {0x80a01, 0x80a03}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, + {0x80a3e, 0x80a42}, {0x80a4b, 0x80a4d}, {0x80a59, 0x80a5c}, {0x80a66, 0x80a75}, + {0x80a81, 0x80a83}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, {0x80a93, 0x80aa8}, + {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80abc, 0x80ac5}, {0x80ac7, 0x80ac9}, + {0x80acb, 0x80acd}, {0x80ae0, 0x80ae3}, {0x80ae6, 0x80af1}, {0x80af9, 0x80aff}, + {0x80b01, 0x80b03}, {0x80b05, 0x80b0c}, {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, + {0x80b35, 0x80b39}, {0x80b3c, 0x80b44}, {0x80b4b, 0x80b4d}, {0x80b5f, 0x80b63}, + {0x80b66, 0x80b77}, {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, + {0x80ba8, 0x80baa}, {0x80bae, 0x80bb9}, {0x80bbe, 0x80bc2}, {0x80bc6, 0x80bc8}, + {0x80bca, 0x80bcd}, {0x80be6, 0x80bfa}, {0x80c00, 0x80c03}, {0x80c05, 0x80c0c}, + {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, {0x80c2a, 0x80c39}, {0x80c3d, 0x80c44}, + {0x80c46, 0x80c48}, {0x80c4a, 0x80c4d}, {0x80c58, 0x80c5a}, {0x80c60, 0x80c63}, + {0x80c66, 0x80c6f}, {0x80c78, 0x80c83}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, + {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80cbc, 0x80cc4}, + {0x80cc6, 0x80cc8}, {0x80cca, 0x80ccd}, {0x80ce0, 0x80ce3}, {0x80ce6, 0x80cef}, + {0x80d00, 0x80d03}, {0x80d05, 0x80d0c}, {0x80d0e, 0x80d10}, {0x80d12, 0x80d44}, + {0x80d46, 0x80d48}, {0x80d4a, 0x80d4f}, {0x80d54, 0x80d63}, {0x80d66, 0x80d7f}, + {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, {0x80dc0, 0x80dc6}, + {0x80dcf, 0x80dd4}, {0x80dd8, 0x80ddf}, {0x80de6, 0x80def}, {0x80df2, 0x80df4}, + {0x80e01, 0x80e3a}, {0x80e3f, 0x80e5b}, {0x80e94, 0x80e97}, {0x80e99, 0x80e9f}, + {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb9}, {0x80ebb, 0x80ebd}, {0x80ec0, 0x80ec4}, + {0x80ec8, 0x80ecd}, {0x80ed0, 0x80ed9}, {0x80edc, 0x80edf}, {0x80f00, 0x80f47}, + {0x80f49, 0x80f6c}, {0x80f71, 0x80f97}, {0x80f99, 0x80fbc}, {0x80fbe, 0x80fcc}, + {0x80fce, 0x80fda}, {0x81000, 0x810c5}, {0x810d0, 0x81248}, {0x8124a, 0x8124d}, + {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, {0x8128a, 0x8128d}, + {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, {0x812c2, 0x812c5}, + {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, {0x81318, 0x8135a}, + {0x8135d, 0x8137c}, {0x81380, 0x81399}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, + {0x81400, 0x8167f}, {0x81681, 0x8169c}, {0x816a0, 0x816f8}, {0x81700, 0x8170c}, + {0x8170e, 0x81714}, {0x81720, 0x81736}, {0x81740, 0x81753}, {0x81760, 0x8176c}, + {0x8176e, 0x81770}, {0x81780, 0x817dd}, {0x817e0, 0x817e9}, {0x817f0, 0x817f9}, + {0x81800, 0x8180d}, {0x81810, 0x81819}, {0x81820, 0x81877}, {0x81880, 0x818aa}, + {0x818b0, 0x818f5}, {0x81900, 0x8191e}, {0x81920, 0x8192b}, {0x81930, 0x8193b}, + {0x81944, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, {0x819b0, 0x819c9}, + {0x819d0, 0x819da}, {0x819de, 0x81a1b}, {0x81a1e, 0x81a5e}, {0x81a60, 0x81a7c}, + {0x81a7f, 0x81a89}, {0x81a90, 0x81a99}, {0x81aa0, 0x81aad}, {0x81ab0, 0x81abe}, + {0x81b00, 0x81b4b}, {0x81b50, 0x81b7c}, {0x81b80, 0x81bf3}, {0x81bfc, 0x81c37}, + {0x81c3b, 0x81c49}, {0x81c4d, 0x81c88}, {0x81cc0, 0x81cc7}, {0x81cd0, 0x81cf9}, + {0x81d00, 0x81df9}, {0x81dfb, 0x81f15}, {0x81f18, 0x81f1d}, {0x81f20, 0x81f45}, + {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, {0x81f80, 0x81fb4}, + {0x81fb6, 0x81fc4}, {0x81fc6, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fdd, 0x81fef}, + {0x81ff2, 0x81ff4}, {0x81ff6, 0x81ffe}, {0x82010, 0x82027}, {0x82030, 0x8205e}, + {0x82074, 0x8208e}, {0x82090, 0x8209c}, {0x820a0, 0x820bf}, {0x820d0, 0x820f0}, + {0x82100, 0x8218b}, {0x82190, 0x82426}, {0x82440, 0x8244a}, {0x82460, 0x82b73}, + {0x82b76, 0x82b95}, {0x82b98, 0x82bb9}, {0x82bbd, 0x82bc8}, {0x82bca, 0x82bd2}, + {0x82bec, 0x82bef}, {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82cf3}, + {0x82cf9, 0x82d25}, {0x82d30, 0x82d67}, {0x82d7f, 0x82d96}, {0x82da0, 0x82da6}, + {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, + {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x82de0, 0x82e49}, + {0x82e80, 0x82e99}, {0x82e9b, 0x82ef3}, {0x82f00, 0x82fd5}, {0x82ff0, 0x82ffb}, + {0x83001, 0x8303f}, {0x83041, 0x83096}, {0x83099, 0x830ff}, {0x83105, 0x8312e}, + {0x83131, 0x8318e}, {0x83190, 0x831ba}, {0x831c0, 0x831e3}, {0x831f0, 0x8321e}, + {0x83220, 0x832fe}, {0x83300, 0x84db5}, {0x84dc0, 0x89fea}, {0x8a000, 0x8a48c}, + {0x8a490, 0x8a4c6}, {0x8a4d0, 0x8a62b}, {0x8a640, 0x8a6f7}, {0x8a700, 0x8a7ae}, + {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a82b}, {0x8a830, 0x8a839}, {0x8a840, 0x8a877}, + {0x8a880, 0x8a8c5}, {0x8a8ce, 0x8a8d9}, {0x8a8e0, 0x8a8fd}, {0x8a900, 0x8a953}, + {0x8a95f, 0x8a97c}, {0x8a980, 0x8a9cd}, {0x8a9cf, 0x8a9d9}, {0x8a9de, 0x8a9fe}, + {0x8aa00, 0x8aa36}, {0x8aa40, 0x8aa4d}, {0x8aa50, 0x8aa59}, {0x8aa5c, 0x8aac2}, + {0x8aadb, 0x8aaf6}, {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, + {0x8ab20, 0x8ab26}, {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab65}, {0x8ab70, 0x8abed}, + {0x8abf0, 0x8abf9}, {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, + {0x8f900, 0x8fa6d}, {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, + {0x8fb1d, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbc1}, {0x8fbd3, 0x8fd3f}, + {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfd}, {0x8fe00, 0x8fe19}, + {0x8fe20, 0x8fe52}, {0x8fe54, 0x8fe66}, {0x8fe68, 0x8fe6b}, {0x8fe70, 0x8fe74}, + {0x8fe76, 0x8fefc}, {0x8ff01, 0x8ffbe}, {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, + {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, {0x8ffe0, 0x8ffe6}, {0x8ffe8, 0x8ffee}, + {0x90021, 0x9007e}, {0x900a1, 0x900ac}, {0x900ae, 0x90377}, {0x9037a, 0x9037f}, + {0x90384, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x9052f}, {0x90531, 0x90556}, + {0x90559, 0x9055f}, {0x90561, 0x90587}, {0x9058d, 0x9058f}, {0x90591, 0x905c7}, + {0x905d0, 0x905ea}, {0x905f0, 0x905f4}, {0x90606, 0x9061b}, {0x9061e, 0x906dc}, + {0x906de, 0x9070d}, {0x90710, 0x9074a}, {0x9074d, 0x907b1}, {0x907c0, 0x907fa}, + {0x90800, 0x9082d}, {0x90830, 0x9083e}, {0x90840, 0x9085b}, {0x90860, 0x9086a}, + {0x908a0, 0x908b4}, {0x908b6, 0x908bd}, {0x908d4, 0x908e1}, {0x908e3, 0x90983}, + {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, + {0x909bc, 0x909c4}, {0x909cb, 0x909ce}, {0x909df, 0x909e3}, {0x909e6, 0x909fd}, + {0x90a01, 0x90a03}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, + {0x90a3e, 0x90a42}, {0x90a4b, 0x90a4d}, {0x90a59, 0x90a5c}, {0x90a66, 0x90a75}, + {0x90a81, 0x90a83}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, {0x90a93, 0x90aa8}, + {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90abc, 0x90ac5}, {0x90ac7, 0x90ac9}, + {0x90acb, 0x90acd}, {0x90ae0, 0x90ae3}, {0x90ae6, 0x90af1}, {0x90af9, 0x90aff}, + {0x90b01, 0x90b03}, {0x90b05, 0x90b0c}, {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, + {0x90b35, 0x90b39}, {0x90b3c, 0x90b44}, {0x90b4b, 0x90b4d}, {0x90b5f, 0x90b63}, + {0x90b66, 0x90b77}, {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, + {0x90ba8, 0x90baa}, {0x90bae, 0x90bb9}, {0x90bbe, 0x90bc2}, {0x90bc6, 0x90bc8}, + {0x90bca, 0x90bcd}, {0x90be6, 0x90bfa}, {0x90c00, 0x90c03}, {0x90c05, 0x90c0c}, + {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, {0x90c2a, 0x90c39}, {0x90c3d, 0x90c44}, + {0x90c46, 0x90c48}, {0x90c4a, 0x90c4d}, {0x90c58, 0x90c5a}, {0x90c60, 0x90c63}, + {0x90c66, 0x90c6f}, {0x90c78, 0x90c83}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, + {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90cbc, 0x90cc4}, + {0x90cc6, 0x90cc8}, {0x90cca, 0x90ccd}, {0x90ce0, 0x90ce3}, {0x90ce6, 0x90cef}, + {0x90d00, 0x90d03}, {0x90d05, 0x90d0c}, {0x90d0e, 0x90d10}, {0x90d12, 0x90d44}, + {0x90d46, 0x90d48}, {0x90d4a, 0x90d4f}, {0x90d54, 0x90d63}, {0x90d66, 0x90d7f}, + {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, {0x90dc0, 0x90dc6}, + {0x90dcf, 0x90dd4}, {0x90dd8, 0x90ddf}, {0x90de6, 0x90def}, {0x90df2, 0x90df4}, + {0x90e01, 0x90e3a}, {0x90e3f, 0x90e5b}, {0x90e94, 0x90e97}, {0x90e99, 0x90e9f}, + {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb9}, {0x90ebb, 0x90ebd}, {0x90ec0, 0x90ec4}, + {0x90ec8, 0x90ecd}, {0x90ed0, 0x90ed9}, {0x90edc, 0x90edf}, {0x90f00, 0x90f47}, + {0x90f49, 0x90f6c}, {0x90f71, 0x90f97}, {0x90f99, 0x90fbc}, {0x90fbe, 0x90fcc}, + {0x90fce, 0x90fda}, {0x91000, 0x910c5}, {0x910d0, 0x91248}, {0x9124a, 0x9124d}, + {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, {0x9128a, 0x9128d}, + {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, {0x912c2, 0x912c5}, + {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, {0x91318, 0x9135a}, + {0x9135d, 0x9137c}, {0x91380, 0x91399}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, + {0x91400, 0x9167f}, {0x91681, 0x9169c}, {0x916a0, 0x916f8}, {0x91700, 0x9170c}, + {0x9170e, 0x91714}, {0x91720, 0x91736}, {0x91740, 0x91753}, {0x91760, 0x9176c}, + {0x9176e, 0x91770}, {0x91780, 0x917dd}, {0x917e0, 0x917e9}, {0x917f0, 0x917f9}, + {0x91800, 0x9180d}, {0x91810, 0x91819}, {0x91820, 0x91877}, {0x91880, 0x918aa}, + {0x918b0, 0x918f5}, {0x91900, 0x9191e}, {0x91920, 0x9192b}, {0x91930, 0x9193b}, + {0x91944, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, {0x919b0, 0x919c9}, + {0x919d0, 0x919da}, {0x919de, 0x91a1b}, {0x91a1e, 0x91a5e}, {0x91a60, 0x91a7c}, + {0x91a7f, 0x91a89}, {0x91a90, 0x91a99}, {0x91aa0, 0x91aad}, {0x91ab0, 0x91abe}, + {0x91b00, 0x91b4b}, {0x91b50, 0x91b7c}, {0x91b80, 0x91bf3}, {0x91bfc, 0x91c37}, + {0x91c3b, 0x91c49}, {0x91c4d, 0x91c88}, {0x91cc0, 0x91cc7}, {0x91cd0, 0x91cf9}, + {0x91d00, 0x91df9}, {0x91dfb, 0x91f15}, {0x91f18, 0x91f1d}, {0x91f20, 0x91f45}, + {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, {0x91f80, 0x91fb4}, + {0x91fb6, 0x91fc4}, {0x91fc6, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fdd, 0x91fef}, + {0x91ff2, 0x91ff4}, {0x91ff6, 0x91ffe}, {0x92010, 0x92027}, {0x92030, 0x9205e}, + {0x92074, 0x9208e}, {0x92090, 0x9209c}, {0x920a0, 0x920bf}, {0x920d0, 0x920f0}, + {0x92100, 0x9218b}, {0x92190, 0x92426}, {0x92440, 0x9244a}, {0x92460, 0x92b73}, + {0x92b76, 0x92b95}, {0x92b98, 0x92bb9}, {0x92bbd, 0x92bc8}, {0x92bca, 0x92bd2}, + {0x92bec, 0x92bef}, {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92cf3}, + {0x92cf9, 0x92d25}, {0x92d30, 0x92d67}, {0x92d7f, 0x92d96}, {0x92da0, 0x92da6}, + {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, + {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x92de0, 0x92e49}, + {0x92e80, 0x92e99}, {0x92e9b, 0x92ef3}, {0x92f00, 0x92fd5}, {0x92ff0, 0x92ffb}, + {0x93001, 0x9303f}, {0x93041, 0x93096}, {0x93099, 0x930ff}, {0x93105, 0x9312e}, + {0x93131, 0x9318e}, {0x93190, 0x931ba}, {0x931c0, 0x931e3}, {0x931f0, 0x9321e}, + {0x93220, 0x932fe}, {0x93300, 0x94db5}, {0x94dc0, 0x99fea}, {0x9a000, 0x9a48c}, + {0x9a490, 0x9a4c6}, {0x9a4d0, 0x9a62b}, {0x9a640, 0x9a6f7}, {0x9a700, 0x9a7ae}, + {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a82b}, {0x9a830, 0x9a839}, {0x9a840, 0x9a877}, + {0x9a880, 0x9a8c5}, {0x9a8ce, 0x9a8d9}, {0x9a8e0, 0x9a8fd}, {0x9a900, 0x9a953}, + {0x9a95f, 0x9a97c}, {0x9a980, 0x9a9cd}, {0x9a9cf, 0x9a9d9}, {0x9a9de, 0x9a9fe}, + {0x9aa00, 0x9aa36}, {0x9aa40, 0x9aa4d}, {0x9aa50, 0x9aa59}, {0x9aa5c, 0x9aac2}, + {0x9aadb, 0x9aaf6}, {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, + {0x9ab20, 0x9ab26}, {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab65}, {0x9ab70, 0x9abed}, + {0x9abf0, 0x9abf9}, {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, + {0x9f900, 0x9fa6d}, {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, + {0x9fb1d, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbc1}, {0x9fbd3, 0x9fd3f}, + {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfd}, {0x9fe00, 0x9fe19}, + {0x9fe20, 0x9fe52}, {0x9fe54, 0x9fe66}, {0x9fe68, 0x9fe6b}, {0x9fe70, 0x9fe74}, + {0x9fe76, 0x9fefc}, {0x9ff01, 0x9ffbe}, {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, + {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, {0x9ffe0, 0x9ffe6}, {0x9ffe8, 0x9ffee}, + {0xa0021, 0xa007e}, {0xa00a1, 0xa00ac}, {0xa00ae, 0xa0377}, {0xa037a, 0xa037f}, + {0xa0384, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa052f}, {0xa0531, 0xa0556}, + {0xa0559, 0xa055f}, {0xa0561, 0xa0587}, {0xa058d, 0xa058f}, {0xa0591, 0xa05c7}, + {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f4}, {0xa0606, 0xa061b}, {0xa061e, 0xa06dc}, + {0xa06de, 0xa070d}, {0xa0710, 0xa074a}, {0xa074d, 0xa07b1}, {0xa07c0, 0xa07fa}, + {0xa0800, 0xa082d}, {0xa0830, 0xa083e}, {0xa0840, 0xa085b}, {0xa0860, 0xa086a}, + {0xa08a0, 0xa08b4}, {0xa08b6, 0xa08bd}, {0xa08d4, 0xa08e1}, {0xa08e3, 0xa0983}, + {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, + {0xa09bc, 0xa09c4}, {0xa09cb, 0xa09ce}, {0xa09df, 0xa09e3}, {0xa09e6, 0xa09fd}, + {0xa0a01, 0xa0a03}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, + {0xa0a3e, 0xa0a42}, {0xa0a4b, 0xa0a4d}, {0xa0a59, 0xa0a5c}, {0xa0a66, 0xa0a75}, + {0xa0a81, 0xa0a83}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, {0xa0a93, 0xa0aa8}, + {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0abc, 0xa0ac5}, {0xa0ac7, 0xa0ac9}, + {0xa0acb, 0xa0acd}, {0xa0ae0, 0xa0ae3}, {0xa0ae6, 0xa0af1}, {0xa0af9, 0xa0aff}, + {0xa0b01, 0xa0b03}, {0xa0b05, 0xa0b0c}, {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, + {0xa0b35, 0xa0b39}, {0xa0b3c, 0xa0b44}, {0xa0b4b, 0xa0b4d}, {0xa0b5f, 0xa0b63}, + {0xa0b66, 0xa0b77}, {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, + {0xa0ba8, 0xa0baa}, {0xa0bae, 0xa0bb9}, {0xa0bbe, 0xa0bc2}, {0xa0bc6, 0xa0bc8}, + {0xa0bca, 0xa0bcd}, {0xa0be6, 0xa0bfa}, {0xa0c00, 0xa0c03}, {0xa0c05, 0xa0c0c}, + {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, {0xa0c2a, 0xa0c39}, {0xa0c3d, 0xa0c44}, + {0xa0c46, 0xa0c48}, {0xa0c4a, 0xa0c4d}, {0xa0c58, 0xa0c5a}, {0xa0c60, 0xa0c63}, + {0xa0c66, 0xa0c6f}, {0xa0c78, 0xa0c83}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, + {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0cbc, 0xa0cc4}, + {0xa0cc6, 0xa0cc8}, {0xa0cca, 0xa0ccd}, {0xa0ce0, 0xa0ce3}, {0xa0ce6, 0xa0cef}, + {0xa0d00, 0xa0d03}, {0xa0d05, 0xa0d0c}, {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d44}, + {0xa0d46, 0xa0d48}, {0xa0d4a, 0xa0d4f}, {0xa0d54, 0xa0d63}, {0xa0d66, 0xa0d7f}, + {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, {0xa0dc0, 0xa0dc6}, + {0xa0dcf, 0xa0dd4}, {0xa0dd8, 0xa0ddf}, {0xa0de6, 0xa0def}, {0xa0df2, 0xa0df4}, + {0xa0e01, 0xa0e3a}, {0xa0e3f, 0xa0e5b}, {0xa0e94, 0xa0e97}, {0xa0e99, 0xa0e9f}, + {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb9}, {0xa0ebb, 0xa0ebd}, {0xa0ec0, 0xa0ec4}, + {0xa0ec8, 0xa0ecd}, {0xa0ed0, 0xa0ed9}, {0xa0edc, 0xa0edf}, {0xa0f00, 0xa0f47}, + {0xa0f49, 0xa0f6c}, {0xa0f71, 0xa0f97}, {0xa0f99, 0xa0fbc}, {0xa0fbe, 0xa0fcc}, + {0xa0fce, 0xa0fda}, {0xa1000, 0xa10c5}, {0xa10d0, 0xa1248}, {0xa124a, 0xa124d}, + {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, {0xa128a, 0xa128d}, + {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, {0xa12c2, 0xa12c5}, + {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, {0xa1318, 0xa135a}, + {0xa135d, 0xa137c}, {0xa1380, 0xa1399}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, + {0xa1400, 0xa167f}, {0xa1681, 0xa169c}, {0xa16a0, 0xa16f8}, {0xa1700, 0xa170c}, + {0xa170e, 0xa1714}, {0xa1720, 0xa1736}, {0xa1740, 0xa1753}, {0xa1760, 0xa176c}, + {0xa176e, 0xa1770}, {0xa1780, 0xa17dd}, {0xa17e0, 0xa17e9}, {0xa17f0, 0xa17f9}, + {0xa1800, 0xa180d}, {0xa1810, 0xa1819}, {0xa1820, 0xa1877}, {0xa1880, 0xa18aa}, + {0xa18b0, 0xa18f5}, {0xa1900, 0xa191e}, {0xa1920, 0xa192b}, {0xa1930, 0xa193b}, + {0xa1944, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, {0xa19b0, 0xa19c9}, + {0xa19d0, 0xa19da}, {0xa19de, 0xa1a1b}, {0xa1a1e, 0xa1a5e}, {0xa1a60, 0xa1a7c}, + {0xa1a7f, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1aa0, 0xa1aad}, {0xa1ab0, 0xa1abe}, + {0xa1b00, 0xa1b4b}, {0xa1b50, 0xa1b7c}, {0xa1b80, 0xa1bf3}, {0xa1bfc, 0xa1c37}, + {0xa1c3b, 0xa1c49}, {0xa1c4d, 0xa1c88}, {0xa1cc0, 0xa1cc7}, {0xa1cd0, 0xa1cf9}, + {0xa1d00, 0xa1df9}, {0xa1dfb, 0xa1f15}, {0xa1f18, 0xa1f1d}, {0xa1f20, 0xa1f45}, + {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, {0xa1f80, 0xa1fb4}, + {0xa1fb6, 0xa1fc4}, {0xa1fc6, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fdd, 0xa1fef}, + {0xa1ff2, 0xa1ff4}, {0xa1ff6, 0xa1ffe}, {0xa2010, 0xa2027}, {0xa2030, 0xa205e}, + {0xa2074, 0xa208e}, {0xa2090, 0xa209c}, {0xa20a0, 0xa20bf}, {0xa20d0, 0xa20f0}, + {0xa2100, 0xa218b}, {0xa2190, 0xa2426}, {0xa2440, 0xa244a}, {0xa2460, 0xa2b73}, + {0xa2b76, 0xa2b95}, {0xa2b98, 0xa2bb9}, {0xa2bbd, 0xa2bc8}, {0xa2bca, 0xa2bd2}, + {0xa2bec, 0xa2bef}, {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2cf3}, + {0xa2cf9, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d7f, 0xa2d96}, {0xa2da0, 0xa2da6}, + {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, + {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa2de0, 0xa2e49}, + {0xa2e80, 0xa2e99}, {0xa2e9b, 0xa2ef3}, {0xa2f00, 0xa2fd5}, {0xa2ff0, 0xa2ffb}, + {0xa3001, 0xa303f}, {0xa3041, 0xa3096}, {0xa3099, 0xa30ff}, {0xa3105, 0xa312e}, + {0xa3131, 0xa318e}, {0xa3190, 0xa31ba}, {0xa31c0, 0xa31e3}, {0xa31f0, 0xa321e}, + {0xa3220, 0xa32fe}, {0xa3300, 0xa4db5}, {0xa4dc0, 0xa9fea}, {0xaa000, 0xaa48c}, + {0xaa490, 0xaa4c6}, {0xaa4d0, 0xaa62b}, {0xaa640, 0xaa6f7}, {0xaa700, 0xaa7ae}, + {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa82b}, {0xaa830, 0xaa839}, {0xaa840, 0xaa877}, + {0xaa880, 0xaa8c5}, {0xaa8ce, 0xaa8d9}, {0xaa8e0, 0xaa8fd}, {0xaa900, 0xaa953}, + {0xaa95f, 0xaa97c}, {0xaa980, 0xaa9cd}, {0xaa9cf, 0xaa9d9}, {0xaa9de, 0xaa9fe}, + {0xaaa00, 0xaaa36}, {0xaaa40, 0xaaa4d}, {0xaaa50, 0xaaa59}, {0xaaa5c, 0xaaac2}, + {0xaaadb, 0xaaaf6}, {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, + {0xaab20, 0xaab26}, {0xaab28, 0xaab2e}, {0xaab30, 0xaab65}, {0xaab70, 0xaabed}, + {0xaabf0, 0xaabf9}, {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, + {0xaf900, 0xafa6d}, {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, + {0xafb1d, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbc1}, {0xafbd3, 0xafd3f}, + {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfd}, {0xafe00, 0xafe19}, + {0xafe20, 0xafe52}, {0xafe54, 0xafe66}, {0xafe68, 0xafe6b}, {0xafe70, 0xafe74}, + {0xafe76, 0xafefc}, {0xaff01, 0xaffbe}, {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, + {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, {0xaffe0, 0xaffe6}, {0xaffe8, 0xaffee}, + {0xb0021, 0xb007e}, {0xb00a1, 0xb00ac}, {0xb00ae, 0xb0377}, {0xb037a, 0xb037f}, + {0xb0384, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb052f}, {0xb0531, 0xb0556}, + {0xb0559, 0xb055f}, {0xb0561, 0xb0587}, {0xb058d, 0xb058f}, {0xb0591, 0xb05c7}, + {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f4}, {0xb0606, 0xb061b}, {0xb061e, 0xb06dc}, + {0xb06de, 0xb070d}, {0xb0710, 0xb074a}, {0xb074d, 0xb07b1}, {0xb07c0, 0xb07fa}, + {0xb0800, 0xb082d}, {0xb0830, 0xb083e}, {0xb0840, 0xb085b}, {0xb0860, 0xb086a}, + {0xb08a0, 0xb08b4}, {0xb08b6, 0xb08bd}, {0xb08d4, 0xb08e1}, {0xb08e3, 0xb0983}, + {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, + {0xb09bc, 0xb09c4}, {0xb09cb, 0xb09ce}, {0xb09df, 0xb09e3}, {0xb09e6, 0xb09fd}, + {0xb0a01, 0xb0a03}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, + {0xb0a3e, 0xb0a42}, {0xb0a4b, 0xb0a4d}, {0xb0a59, 0xb0a5c}, {0xb0a66, 0xb0a75}, + {0xb0a81, 0xb0a83}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, {0xb0a93, 0xb0aa8}, + {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0abc, 0xb0ac5}, {0xb0ac7, 0xb0ac9}, + {0xb0acb, 0xb0acd}, {0xb0ae0, 0xb0ae3}, {0xb0ae6, 0xb0af1}, {0xb0af9, 0xb0aff}, + {0xb0b01, 0xb0b03}, {0xb0b05, 0xb0b0c}, {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, + {0xb0b35, 0xb0b39}, {0xb0b3c, 0xb0b44}, {0xb0b4b, 0xb0b4d}, {0xb0b5f, 0xb0b63}, + {0xb0b66, 0xb0b77}, {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, + {0xb0ba8, 0xb0baa}, {0xb0bae, 0xb0bb9}, {0xb0bbe, 0xb0bc2}, {0xb0bc6, 0xb0bc8}, + {0xb0bca, 0xb0bcd}, {0xb0be6, 0xb0bfa}, {0xb0c00, 0xb0c03}, {0xb0c05, 0xb0c0c}, + {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, {0xb0c2a, 0xb0c39}, {0xb0c3d, 0xb0c44}, + {0xb0c46, 0xb0c48}, {0xb0c4a, 0xb0c4d}, {0xb0c58, 0xb0c5a}, {0xb0c60, 0xb0c63}, + {0xb0c66, 0xb0c6f}, {0xb0c78, 0xb0c83}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, + {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0cbc, 0xb0cc4}, + {0xb0cc6, 0xb0cc8}, {0xb0cca, 0xb0ccd}, {0xb0ce0, 0xb0ce3}, {0xb0ce6, 0xb0cef}, + {0xb0d00, 0xb0d03}, {0xb0d05, 0xb0d0c}, {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d44}, + {0xb0d46, 0xb0d48}, {0xb0d4a, 0xb0d4f}, {0xb0d54, 0xb0d63}, {0xb0d66, 0xb0d7f}, + {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, {0xb0dc0, 0xb0dc6}, + {0xb0dcf, 0xb0dd4}, {0xb0dd8, 0xb0ddf}, {0xb0de6, 0xb0def}, {0xb0df2, 0xb0df4}, + {0xb0e01, 0xb0e3a}, {0xb0e3f, 0xb0e5b}, {0xb0e94, 0xb0e97}, {0xb0e99, 0xb0e9f}, + {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb9}, {0xb0ebb, 0xb0ebd}, {0xb0ec0, 0xb0ec4}, + {0xb0ec8, 0xb0ecd}, {0xb0ed0, 0xb0ed9}, {0xb0edc, 0xb0edf}, {0xb0f00, 0xb0f47}, + {0xb0f49, 0xb0f6c}, {0xb0f71, 0xb0f97}, {0xb0f99, 0xb0fbc}, {0xb0fbe, 0xb0fcc}, + {0xb0fce, 0xb0fda}, {0xb1000, 0xb10c5}, {0xb10d0, 0xb1248}, {0xb124a, 0xb124d}, + {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, {0xb128a, 0xb128d}, + {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, {0xb12c2, 0xb12c5}, + {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, {0xb1318, 0xb135a}, + {0xb135d, 0xb137c}, {0xb1380, 0xb1399}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, + {0xb1400, 0xb167f}, {0xb1681, 0xb169c}, {0xb16a0, 0xb16f8}, {0xb1700, 0xb170c}, + {0xb170e, 0xb1714}, {0xb1720, 0xb1736}, {0xb1740, 0xb1753}, {0xb1760, 0xb176c}, + {0xb176e, 0xb1770}, {0xb1780, 0xb17dd}, {0xb17e0, 0xb17e9}, {0xb17f0, 0xb17f9}, + {0xb1800, 0xb180d}, {0xb1810, 0xb1819}, {0xb1820, 0xb1877}, {0xb1880, 0xb18aa}, + {0xb18b0, 0xb18f5}, {0xb1900, 0xb191e}, {0xb1920, 0xb192b}, {0xb1930, 0xb193b}, + {0xb1944, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, {0xb19b0, 0xb19c9}, + {0xb19d0, 0xb19da}, {0xb19de, 0xb1a1b}, {0xb1a1e, 0xb1a5e}, {0xb1a60, 0xb1a7c}, + {0xb1a7f, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1aa0, 0xb1aad}, {0xb1ab0, 0xb1abe}, + {0xb1b00, 0xb1b4b}, {0xb1b50, 0xb1b7c}, {0xb1b80, 0xb1bf3}, {0xb1bfc, 0xb1c37}, + {0xb1c3b, 0xb1c49}, {0xb1c4d, 0xb1c88}, {0xb1cc0, 0xb1cc7}, {0xb1cd0, 0xb1cf9}, + {0xb1d00, 0xb1df9}, {0xb1dfb, 0xb1f15}, {0xb1f18, 0xb1f1d}, {0xb1f20, 0xb1f45}, + {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, {0xb1f80, 0xb1fb4}, + {0xb1fb6, 0xb1fc4}, {0xb1fc6, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fdd, 0xb1fef}, + {0xb1ff2, 0xb1ff4}, {0xb1ff6, 0xb1ffe}, {0xb2010, 0xb2027}, {0xb2030, 0xb205e}, + {0xb2074, 0xb208e}, {0xb2090, 0xb209c}, {0xb20a0, 0xb20bf}, {0xb20d0, 0xb20f0}, + {0xb2100, 0xb218b}, {0xb2190, 0xb2426}, {0xb2440, 0xb244a}, {0xb2460, 0xb2b73}, + {0xb2b76, 0xb2b95}, {0xb2b98, 0xb2bb9}, {0xb2bbd, 0xb2bc8}, {0xb2bca, 0xb2bd2}, + {0xb2bec, 0xb2bef}, {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2cf3}, + {0xb2cf9, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d7f, 0xb2d96}, {0xb2da0, 0xb2da6}, + {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, + {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb2de0, 0xb2e49}, + {0xb2e80, 0xb2e99}, {0xb2e9b, 0xb2ef3}, {0xb2f00, 0xb2fd5}, {0xb2ff0, 0xb2ffb}, + {0xb3001, 0xb303f}, {0xb3041, 0xb3096}, {0xb3099, 0xb30ff}, {0xb3105, 0xb312e}, + {0xb3131, 0xb318e}, {0xb3190, 0xb31ba}, {0xb31c0, 0xb31e3}, {0xb31f0, 0xb321e}, + {0xb3220, 0xb32fe}, {0xb3300, 0xb4db5}, {0xb4dc0, 0xb9fea}, {0xba000, 0xba48c}, + {0xba490, 0xba4c6}, {0xba4d0, 0xba62b}, {0xba640, 0xba6f7}, {0xba700, 0xba7ae}, + {0xba7b0, 0xba7b7}, {0xba7f7, 0xba82b}, {0xba830, 0xba839}, {0xba840, 0xba877}, + {0xba880, 0xba8c5}, {0xba8ce, 0xba8d9}, {0xba8e0, 0xba8fd}, {0xba900, 0xba953}, + {0xba95f, 0xba97c}, {0xba980, 0xba9cd}, {0xba9cf, 0xba9d9}, {0xba9de, 0xba9fe}, + {0xbaa00, 0xbaa36}, {0xbaa40, 0xbaa4d}, {0xbaa50, 0xbaa59}, {0xbaa5c, 0xbaac2}, + {0xbaadb, 0xbaaf6}, {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, + {0xbab20, 0xbab26}, {0xbab28, 0xbab2e}, {0xbab30, 0xbab65}, {0xbab70, 0xbabed}, + {0xbabf0, 0xbabf9}, {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, + {0xbf900, 0xbfa6d}, {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, + {0xbfb1d, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbc1}, {0xbfbd3, 0xbfd3f}, + {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfd}, {0xbfe00, 0xbfe19}, + {0xbfe20, 0xbfe52}, {0xbfe54, 0xbfe66}, {0xbfe68, 0xbfe6b}, {0xbfe70, 0xbfe74}, + {0xbfe76, 0xbfefc}, {0xbff01, 0xbffbe}, {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, + {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, {0xbffe0, 0xbffe6}, {0xbffe8, 0xbffee}, + {0xc0021, 0xc007e}, {0xc00a1, 0xc00ac}, {0xc00ae, 0xc0377}, {0xc037a, 0xc037f}, + {0xc0384, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc052f}, {0xc0531, 0xc0556}, + {0xc0559, 0xc055f}, {0xc0561, 0xc0587}, {0xc058d, 0xc058f}, {0xc0591, 0xc05c7}, + {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f4}, {0xc0606, 0xc061b}, {0xc061e, 0xc06dc}, + {0xc06de, 0xc070d}, {0xc0710, 0xc074a}, {0xc074d, 0xc07b1}, {0xc07c0, 0xc07fa}, + {0xc0800, 0xc082d}, {0xc0830, 0xc083e}, {0xc0840, 0xc085b}, {0xc0860, 0xc086a}, + {0xc08a0, 0xc08b4}, {0xc08b6, 0xc08bd}, {0xc08d4, 0xc08e1}, {0xc08e3, 0xc0983}, + {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, + {0xc09bc, 0xc09c4}, {0xc09cb, 0xc09ce}, {0xc09df, 0xc09e3}, {0xc09e6, 0xc09fd}, + {0xc0a01, 0xc0a03}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, + {0xc0a3e, 0xc0a42}, {0xc0a4b, 0xc0a4d}, {0xc0a59, 0xc0a5c}, {0xc0a66, 0xc0a75}, + {0xc0a81, 0xc0a83}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, {0xc0a93, 0xc0aa8}, + {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0abc, 0xc0ac5}, {0xc0ac7, 0xc0ac9}, + {0xc0acb, 0xc0acd}, {0xc0ae0, 0xc0ae3}, {0xc0ae6, 0xc0af1}, {0xc0af9, 0xc0aff}, + {0xc0b01, 0xc0b03}, {0xc0b05, 0xc0b0c}, {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, + {0xc0b35, 0xc0b39}, {0xc0b3c, 0xc0b44}, {0xc0b4b, 0xc0b4d}, {0xc0b5f, 0xc0b63}, + {0xc0b66, 0xc0b77}, {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, + {0xc0ba8, 0xc0baa}, {0xc0bae, 0xc0bb9}, {0xc0bbe, 0xc0bc2}, {0xc0bc6, 0xc0bc8}, + {0xc0bca, 0xc0bcd}, {0xc0be6, 0xc0bfa}, {0xc0c00, 0xc0c03}, {0xc0c05, 0xc0c0c}, + {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, {0xc0c2a, 0xc0c39}, {0xc0c3d, 0xc0c44}, + {0xc0c46, 0xc0c48}, {0xc0c4a, 0xc0c4d}, {0xc0c58, 0xc0c5a}, {0xc0c60, 0xc0c63}, + {0xc0c66, 0xc0c6f}, {0xc0c78, 0xc0c83}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, + {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0cbc, 0xc0cc4}, + {0xc0cc6, 0xc0cc8}, {0xc0cca, 0xc0ccd}, {0xc0ce0, 0xc0ce3}, {0xc0ce6, 0xc0cef}, + {0xc0d00, 0xc0d03}, {0xc0d05, 0xc0d0c}, {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d44}, + {0xc0d46, 0xc0d48}, {0xc0d4a, 0xc0d4f}, {0xc0d54, 0xc0d63}, {0xc0d66, 0xc0d7f}, + {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, {0xc0dc0, 0xc0dc6}, + {0xc0dcf, 0xc0dd4}, {0xc0dd8, 0xc0ddf}, {0xc0de6, 0xc0def}, {0xc0df2, 0xc0df4}, + {0xc0e01, 0xc0e3a}, {0xc0e3f, 0xc0e5b}, {0xc0e94, 0xc0e97}, {0xc0e99, 0xc0e9f}, + {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb9}, {0xc0ebb, 0xc0ebd}, {0xc0ec0, 0xc0ec4}, + {0xc0ec8, 0xc0ecd}, {0xc0ed0, 0xc0ed9}, {0xc0edc, 0xc0edf}, {0xc0f00, 0xc0f47}, + {0xc0f49, 0xc0f6c}, {0xc0f71, 0xc0f97}, {0xc0f99, 0xc0fbc}, {0xc0fbe, 0xc0fcc}, + {0xc0fce, 0xc0fda}, {0xc1000, 0xc10c5}, {0xc10d0, 0xc1248}, {0xc124a, 0xc124d}, + {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, {0xc128a, 0xc128d}, + {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, {0xc12c2, 0xc12c5}, + {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, {0xc1318, 0xc135a}, + {0xc135d, 0xc137c}, {0xc1380, 0xc1399}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, + {0xc1400, 0xc167f}, {0xc1681, 0xc169c}, {0xc16a0, 0xc16f8}, {0xc1700, 0xc170c}, + {0xc170e, 0xc1714}, {0xc1720, 0xc1736}, {0xc1740, 0xc1753}, {0xc1760, 0xc176c}, + {0xc176e, 0xc1770}, {0xc1780, 0xc17dd}, {0xc17e0, 0xc17e9}, {0xc17f0, 0xc17f9}, + {0xc1800, 0xc180d}, {0xc1810, 0xc1819}, {0xc1820, 0xc1877}, {0xc1880, 0xc18aa}, + {0xc18b0, 0xc18f5}, {0xc1900, 0xc191e}, {0xc1920, 0xc192b}, {0xc1930, 0xc193b}, + {0xc1944, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, {0xc19b0, 0xc19c9}, + {0xc19d0, 0xc19da}, {0xc19de, 0xc1a1b}, {0xc1a1e, 0xc1a5e}, {0xc1a60, 0xc1a7c}, + {0xc1a7f, 0xc1a89}, {0xc1a90, 0xc1a99}, {0xc1aa0, 0xc1aad}, {0xc1ab0, 0xc1abe}, + {0xc1b00, 0xc1b4b}, {0xc1b50, 0xc1b7c}, {0xc1b80, 0xc1bf3}, {0xc1bfc, 0xc1c37}, + {0xc1c3b, 0xc1c49}, {0xc1c4d, 0xc1c88}, {0xc1cc0, 0xc1cc7}, {0xc1cd0, 0xc1cf9}, + {0xc1d00, 0xc1df9}, {0xc1dfb, 0xc1f15}, {0xc1f18, 0xc1f1d}, {0xc1f20, 0xc1f45}, + {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, {0xc1f80, 0xc1fb4}, + {0xc1fb6, 0xc1fc4}, {0xc1fc6, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fdd, 0xc1fef}, + {0xc1ff2, 0xc1ff4}, {0xc1ff6, 0xc1ffe}, {0xc2010, 0xc2027}, {0xc2030, 0xc205e}, + {0xc2074, 0xc208e}, {0xc2090, 0xc209c}, {0xc20a0, 0xc20bf}, {0xc20d0, 0xc20f0}, + {0xc2100, 0xc218b}, {0xc2190, 0xc2426}, {0xc2440, 0xc244a}, {0xc2460, 0xc2b73}, + {0xc2b76, 0xc2b95}, {0xc2b98, 0xc2bb9}, {0xc2bbd, 0xc2bc8}, {0xc2bca, 0xc2bd2}, + {0xc2bec, 0xc2bef}, {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2cf3}, + {0xc2cf9, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d7f, 0xc2d96}, {0xc2da0, 0xc2da6}, + {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, + {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc2de0, 0xc2e49}, + {0xc2e80, 0xc2e99}, {0xc2e9b, 0xc2ef3}, {0xc2f00, 0xc2fd5}, {0xc2ff0, 0xc2ffb}, + {0xc3001, 0xc303f}, {0xc3041, 0xc3096}, {0xc3099, 0xc30ff}, {0xc3105, 0xc312e}, + {0xc3131, 0xc318e}, {0xc3190, 0xc31ba}, {0xc31c0, 0xc31e3}, {0xc31f0, 0xc321e}, + {0xc3220, 0xc32fe}, {0xc3300, 0xc4db5}, {0xc4dc0, 0xc9fea}, {0xca000, 0xca48c}, + {0xca490, 0xca4c6}, {0xca4d0, 0xca62b}, {0xca640, 0xca6f7}, {0xca700, 0xca7ae}, + {0xca7b0, 0xca7b7}, {0xca7f7, 0xca82b}, {0xca830, 0xca839}, {0xca840, 0xca877}, + {0xca880, 0xca8c5}, {0xca8ce, 0xca8d9}, {0xca8e0, 0xca8fd}, {0xca900, 0xca953}, + {0xca95f, 0xca97c}, {0xca980, 0xca9cd}, {0xca9cf, 0xca9d9}, {0xca9de, 0xca9fe}, + {0xcaa00, 0xcaa36}, {0xcaa40, 0xcaa4d}, {0xcaa50, 0xcaa59}, {0xcaa5c, 0xcaac2}, + {0xcaadb, 0xcaaf6}, {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, + {0xcab20, 0xcab26}, {0xcab28, 0xcab2e}, {0xcab30, 0xcab65}, {0xcab70, 0xcabed}, + {0xcabf0, 0xcabf9}, {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, + {0xcf900, 0xcfa6d}, {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, + {0xcfb1d, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbc1}, {0xcfbd3, 0xcfd3f}, + {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfd}, {0xcfe00, 0xcfe19}, + {0xcfe20, 0xcfe52}, {0xcfe54, 0xcfe66}, {0xcfe68, 0xcfe6b}, {0xcfe70, 0xcfe74}, + {0xcfe76, 0xcfefc}, {0xcff01, 0xcffbe}, {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, + {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, {0xcffe0, 0xcffe6}, {0xcffe8, 0xcffee}, + {0xd0021, 0xd007e}, {0xd00a1, 0xd00ac}, {0xd00ae, 0xd0377}, {0xd037a, 0xd037f}, + {0xd0384, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd052f}, {0xd0531, 0xd0556}, + {0xd0559, 0xd055f}, {0xd0561, 0xd0587}, {0xd058d, 0xd058f}, {0xd0591, 0xd05c7}, + {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f4}, {0xd0606, 0xd061b}, {0xd061e, 0xd06dc}, + {0xd06de, 0xd070d}, {0xd0710, 0xd074a}, {0xd074d, 0xd07b1}, {0xd07c0, 0xd07fa}, + {0xd0800, 0xd082d}, {0xd0830, 0xd083e}, {0xd0840, 0xd085b}, {0xd0860, 0xd086a}, + {0xd08a0, 0xd08b4}, {0xd08b6, 0xd08bd}, {0xd08d4, 0xd08e1}, {0xd08e3, 0xd0983}, + {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, + {0xd09bc, 0xd09c4}, {0xd09cb, 0xd09ce}, {0xd09df, 0xd09e3}, {0xd09e6, 0xd09fd}, + {0xd0a01, 0xd0a03}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, + {0xd0a3e, 0xd0a42}, {0xd0a4b, 0xd0a4d}, {0xd0a59, 0xd0a5c}, {0xd0a66, 0xd0a75}, + {0xd0a81, 0xd0a83}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, {0xd0a93, 0xd0aa8}, + {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0abc, 0xd0ac5}, {0xd0ac7, 0xd0ac9}, + {0xd0acb, 0xd0acd}, {0xd0ae0, 0xd0ae3}, {0xd0ae6, 0xd0af1}, {0xd0af9, 0xd0aff}, + {0xd0b01, 0xd0b03}, {0xd0b05, 0xd0b0c}, {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, + {0xd0b35, 0xd0b39}, {0xd0b3c, 0xd0b44}, {0xd0b4b, 0xd0b4d}, {0xd0b5f, 0xd0b63}, + {0xd0b66, 0xd0b77}, {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, + {0xd0ba8, 0xd0baa}, {0xd0bae, 0xd0bb9}, {0xd0bbe, 0xd0bc2}, {0xd0bc6, 0xd0bc8}, + {0xd0bca, 0xd0bcd}, {0xd0be6, 0xd0bfa}, {0xd0c00, 0xd0c03}, {0xd0c05, 0xd0c0c}, + {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, {0xd0c2a, 0xd0c39}, {0xd0c3d, 0xd0c44}, + {0xd0c46, 0xd0c48}, {0xd0c4a, 0xd0c4d}, {0xd0c58, 0xd0c5a}, {0xd0c60, 0xd0c63}, + {0xd0c66, 0xd0c6f}, {0xd0c78, 0xd0c83}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, + {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0cbc, 0xd0cc4}, + {0xd0cc6, 0xd0cc8}, {0xd0cca, 0xd0ccd}, {0xd0ce0, 0xd0ce3}, {0xd0ce6, 0xd0cef}, + {0xd0d00, 0xd0d03}, {0xd0d05, 0xd0d0c}, {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d44}, + {0xd0d46, 0xd0d48}, {0xd0d4a, 0xd0d4f}, {0xd0d54, 0xd0d63}, {0xd0d66, 0xd0d7f}, + {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, {0xd0dc0, 0xd0dc6}, + {0xd0dcf, 0xd0dd4}, {0xd0dd8, 0xd0ddf}, {0xd0de6, 0xd0def}, {0xd0df2, 0xd0df4}, + {0xd0e01, 0xd0e3a}, {0xd0e3f, 0xd0e5b}, {0xd0e94, 0xd0e97}, {0xd0e99, 0xd0e9f}, + {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb9}, {0xd0ebb, 0xd0ebd}, {0xd0ec0, 0xd0ec4}, + {0xd0ec8, 0xd0ecd}, {0xd0ed0, 0xd0ed9}, {0xd0edc, 0xd0edf}, {0xd0f00, 0xd0f47}, + {0xd0f49, 0xd0f6c}, {0xd0f71, 0xd0f97}, {0xd0f99, 0xd0fbc}, {0xd0fbe, 0xd0fcc}, + {0xd0fce, 0xd0fda}, {0xd1000, 0xd10c5}, {0xd10d0, 0xd1248}, {0xd124a, 0xd124d}, + {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, {0xd128a, 0xd128d}, + {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, {0xd12c2, 0xd12c5}, + {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, {0xd1318, 0xd135a}, + {0xd135d, 0xd137c}, {0xd1380, 0xd1399}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, + {0xd1400, 0xd167f}, {0xd1681, 0xd169c}, {0xd16a0, 0xd16f8}, {0xd1700, 0xd170c}, + {0xd170e, 0xd1714}, {0xd1720, 0xd1736}, {0xd1740, 0xd1753}, {0xd1760, 0xd176c}, + {0xd176e, 0xd1770}, {0xd1780, 0xd17dd}, {0xd17e0, 0xd17e9}, {0xd17f0, 0xd17f9}, + {0xd1800, 0xd180d}, {0xd1810, 0xd1819}, {0xd1820, 0xd1877}, {0xd1880, 0xd18aa}, + {0xd18b0, 0xd18f5}, {0xd1900, 0xd191e}, {0xd1920, 0xd192b}, {0xd1930, 0xd193b}, + {0xd1944, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, {0xd19b0, 0xd19c9}, + {0xd19d0, 0xd19da}, {0xd19de, 0xd1a1b}, {0xd1a1e, 0xd1a5e}, {0xd1a60, 0xd1a7c}, + {0xd1a7f, 0xd1a89}, {0xd1a90, 0xd1a99}, {0xd1aa0, 0xd1aad}, {0xd1ab0, 0xd1abe}, + {0xd1b00, 0xd1b4b}, {0xd1b50, 0xd1b7c}, {0xd1b80, 0xd1bf3}, {0xd1bfc, 0xd1c37}, + {0xd1c3b, 0xd1c49}, {0xd1c4d, 0xd1c88}, {0xd1cc0, 0xd1cc7}, {0xd1cd0, 0xd1cf9}, + {0xd1d00, 0xd1df9}, {0xd1dfb, 0xd1f15}, {0xd1f18, 0xd1f1d}, {0xd1f20, 0xd1f45}, + {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, {0xd1f80, 0xd1fb4}, + {0xd1fb6, 0xd1fc4}, {0xd1fc6, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fdd, 0xd1fef}, + {0xd1ff2, 0xd1ff4}, {0xd1ff6, 0xd1ffe}, {0xd2010, 0xd2027}, {0xd2030, 0xd205e}, + {0xd2074, 0xd208e}, {0xd2090, 0xd209c}, {0xd20a0, 0xd20bf}, {0xd20d0, 0xd20f0}, + {0xd2100, 0xd218b}, {0xd2190, 0xd2426}, {0xd2440, 0xd244a}, {0xd2460, 0xd2b73}, + {0xd2b76, 0xd2b95}, {0xd2b98, 0xd2bb9}, {0xd2bbd, 0xd2bc8}, {0xd2bca, 0xd2bd2}, + {0xd2bec, 0xd2bef}, {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2cf3}, + {0xd2cf9, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d7f, 0xd2d96}, {0xd2da0, 0xd2da6}, + {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, + {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd2de0, 0xd2e49}, + {0xd2e80, 0xd2e99}, {0xd2e9b, 0xd2ef3}, {0xd2f00, 0xd2fd5}, {0xd2ff0, 0xd2ffb}, + {0xd3001, 0xd303f}, {0xd3041, 0xd3096}, {0xd3099, 0xd30ff}, {0xd3105, 0xd312e}, + {0xd3131, 0xd318e}, {0xd3190, 0xd31ba}, {0xd31c0, 0xd31e3}, {0xd31f0, 0xd321e}, + {0xd3220, 0xd32fe}, {0xd3300, 0xd4db5}, {0xd4dc0, 0xd9fea}, {0xda000, 0xda48c}, + {0xda490, 0xda4c6}, {0xda4d0, 0xda62b}, {0xda640, 0xda6f7}, {0xda700, 0xda7ae}, + {0xda7b0, 0xda7b7}, {0xda7f7, 0xda82b}, {0xda830, 0xda839}, {0xda840, 0xda877}, + {0xda880, 0xda8c5}, {0xda8ce, 0xda8d9}, {0xda8e0, 0xda8fd}, {0xda900, 0xda953}, + {0xda95f, 0xda97c}, {0xda980, 0xda9cd}, {0xda9cf, 0xda9d9}, {0xda9de, 0xda9fe}, + {0xdaa00, 0xdaa36}, {0xdaa40, 0xdaa4d}, {0xdaa50, 0xdaa59}, {0xdaa5c, 0xdaac2}, + {0xdaadb, 0xdaaf6}, {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, + {0xdab20, 0xdab26}, {0xdab28, 0xdab2e}, {0xdab30, 0xdab65}, {0xdab70, 0xdabed}, + {0xdabf0, 0xdabf9}, {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, + {0xdf900, 0xdfa6d}, {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, + {0xdfb1d, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbc1}, {0xdfbd3, 0xdfd3f}, + {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfd}, {0xdfe00, 0xdfe19}, + {0xdfe20, 0xdfe52}, {0xdfe54, 0xdfe66}, {0xdfe68, 0xdfe6b}, {0xdfe70, 0xdfe74}, + {0xdfe76, 0xdfefc}, {0xdff01, 0xdffbe}, {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, + {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, {0xdffe0, 0xdffe6}, {0xdffe8, 0xdffee}, + {0xe0021, 0xe007e}, {0xe00a1, 0xe00ac}, {0xe00ae, 0xe0377}, {0xe037a, 0xe037f}, + {0xe0384, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe052f}, {0xe0531, 0xe0556}, + {0xe0559, 0xe055f}, {0xe0561, 0xe0587}, {0xe058d, 0xe058f}, {0xe0591, 0xe05c7}, + {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f4}, {0xe0606, 0xe061b}, {0xe061e, 0xe06dc}, + {0xe06de, 0xe070d}, {0xe0710, 0xe074a}, {0xe074d, 0xe07b1}, {0xe07c0, 0xe07fa}, + {0xe0800, 0xe082d}, {0xe0830, 0xe083e}, {0xe0840, 0xe085b}, {0xe0860, 0xe086a}, + {0xe08a0, 0xe08b4}, {0xe08b6, 0xe08bd}, {0xe08d4, 0xe08e1}, {0xe08e3, 0xe0983}, + {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, + {0xe09bc, 0xe09c4}, {0xe09cb, 0xe09ce}, {0xe09df, 0xe09e3}, {0xe09e6, 0xe09fd}, + {0xe0a01, 0xe0a03}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, + {0xe0a3e, 0xe0a42}, {0xe0a4b, 0xe0a4d}, {0xe0a59, 0xe0a5c}, {0xe0a66, 0xe0a75}, + {0xe0a81, 0xe0a83}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, {0xe0a93, 0xe0aa8}, + {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0abc, 0xe0ac5}, {0xe0ac7, 0xe0ac9}, + {0xe0acb, 0xe0acd}, {0xe0ae0, 0xe0ae3}, {0xe0ae6, 0xe0af1}, {0xe0af9, 0xe0aff}, + {0xe0b01, 0xe0b03}, {0xe0b05, 0xe0b0c}, {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, + {0xe0b35, 0xe0b39}, {0xe0b3c, 0xe0b44}, {0xe0b4b, 0xe0b4d}, {0xe0b5f, 0xe0b63}, + {0xe0b66, 0xe0b77}, {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, + {0xe0ba8, 0xe0baa}, {0xe0bae, 0xe0bb9}, {0xe0bbe, 0xe0bc2}, {0xe0bc6, 0xe0bc8}, + {0xe0bca, 0xe0bcd}, {0xe0be6, 0xe0bfa}, {0xe0c00, 0xe0c03}, {0xe0c05, 0xe0c0c}, + {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, {0xe0c2a, 0xe0c39}, {0xe0c3d, 0xe0c44}, + {0xe0c46, 0xe0c48}, {0xe0c4a, 0xe0c4d}, {0xe0c58, 0xe0c5a}, {0xe0c60, 0xe0c63}, + {0xe0c66, 0xe0c6f}, {0xe0c78, 0xe0c83}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, + {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0cbc, 0xe0cc4}, + {0xe0cc6, 0xe0cc8}, {0xe0cca, 0xe0ccd}, {0xe0ce0, 0xe0ce3}, {0xe0ce6, 0xe0cef}, + {0xe0d00, 0xe0d03}, {0xe0d05, 0xe0d0c}, {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d44}, + {0xe0d46, 0xe0d48}, {0xe0d4a, 0xe0d4f}, {0xe0d54, 0xe0d63}, {0xe0d66, 0xe0d7f}, + {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, {0xe0dc0, 0xe0dc6}, + {0xe0dcf, 0xe0dd4}, {0xe0dd8, 0xe0ddf}, {0xe0de6, 0xe0def}, {0xe0df2, 0xe0df4}, + {0xe0e01, 0xe0e3a}, {0xe0e3f, 0xe0e5b}, {0xe0e94, 0xe0e97}, {0xe0e99, 0xe0e9f}, + {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb9}, {0xe0ebb, 0xe0ebd}, {0xe0ec0, 0xe0ec4}, + {0xe0ec8, 0xe0ecd}, {0xe0ed0, 0xe0ed9}, {0xe0edc, 0xe0edf}, {0xe0f00, 0xe0f47}, + {0xe0f49, 0xe0f6c}, {0xe0f71, 0xe0f97}, {0xe0f99, 0xe0fbc}, {0xe0fbe, 0xe0fcc}, + {0xe0fce, 0xe0fda}, {0xe1000, 0xe10c5}, {0xe10d0, 0xe1248}, {0xe124a, 0xe124d}, + {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, {0xe128a, 0xe128d}, + {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, {0xe12c2, 0xe12c5}, + {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, {0xe1318, 0xe135a}, + {0xe135d, 0xe137c}, {0xe1380, 0xe1399}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, + {0xe1400, 0xe167f}, {0xe1681, 0xe169c}, {0xe16a0, 0xe16f8}, {0xe1700, 0xe170c}, + {0xe170e, 0xe1714}, {0xe1720, 0xe1736}, {0xe1740, 0xe1753}, {0xe1760, 0xe176c}, + {0xe176e, 0xe1770}, {0xe1780, 0xe17dd}, {0xe17e0, 0xe17e9}, {0xe17f0, 0xe17f9}, + {0xe1800, 0xe180d}, {0xe1810, 0xe1819}, {0xe1820, 0xe1877}, {0xe1880, 0xe18aa}, + {0xe18b0, 0xe18f5}, {0xe1900, 0xe191e}, {0xe1920, 0xe192b}, {0xe1930, 0xe193b}, + {0xe1944, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, {0xe19b0, 0xe19c9}, + {0xe19d0, 0xe19da}, {0xe19de, 0xe1a1b}, {0xe1a1e, 0xe1a5e}, {0xe1a60, 0xe1a7c}, + {0xe1a7f, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1aa0, 0xe1aad}, {0xe1ab0, 0xe1abe}, + {0xe1b00, 0xe1b4b}, {0xe1b50, 0xe1b7c}, {0xe1b80, 0xe1bf3}, {0xe1bfc, 0xe1c37}, + {0xe1c3b, 0xe1c49}, {0xe1c4d, 0xe1c88}, {0xe1cc0, 0xe1cc7}, {0xe1cd0, 0xe1cf9}, + {0xe1d00, 0xe1df9}, {0xe1dfb, 0xe1f15}, {0xe1f18, 0xe1f1d}, {0xe1f20, 0xe1f45}, + {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, {0xe1f80, 0xe1fb4}, + {0xe1fb6, 0xe1fc4}, {0xe1fc6, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fdd, 0xe1fef}, + {0xe1ff2, 0xe1ff4}, {0xe1ff6, 0xe1ffe}, {0xe2010, 0xe2027}, {0xe2030, 0xe205e}, + {0xe2074, 0xe208e}, {0xe2090, 0xe209c}, {0xe20a0, 0xe20bf}, {0xe20d0, 0xe20f0}, + {0xe2100, 0xe218b}, {0xe2190, 0xe2426}, {0xe2440, 0xe244a}, {0xe2460, 0xe2b73}, + {0xe2b76, 0xe2b95}, {0xe2b98, 0xe2bb9}, {0xe2bbd, 0xe2bc8}, {0xe2bca, 0xe2bd2}, + {0xe2bec, 0xe2bef}, {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2cf3}, + {0xe2cf9, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d7f, 0xe2d96}, {0xe2da0, 0xe2da6}, + {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, + {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe2de0, 0xe2e49}, + {0xe2e80, 0xe2e99}, {0xe2e9b, 0xe2ef3}, {0xe2f00, 0xe2fd5}, {0xe2ff0, 0xe2ffb}, + {0xe3001, 0xe303f}, {0xe3041, 0xe3096}, {0xe3099, 0xe30ff}, {0xe3105, 0xe312e}, + {0xe3131, 0xe318e}, {0xe3190, 0xe31ba}, {0xe31c0, 0xe31e3}, {0xe31f0, 0xe321e}, + {0xe3220, 0xe32fe}, {0xe3300, 0xe4db5}, {0xe4dc0, 0xe9fea}, {0xea000, 0xea48c}, + {0xea490, 0xea4c6}, {0xea4d0, 0xea62b}, {0xea640, 0xea6f7}, {0xea700, 0xea7ae}, + {0xea7b0, 0xea7b7}, {0xea7f7, 0xea82b}, {0xea830, 0xea839}, {0xea840, 0xea877}, + {0xea880, 0xea8c5}, {0xea8ce, 0xea8d9}, {0xea8e0, 0xea8fd}, {0xea900, 0xea953}, + {0xea95f, 0xea97c}, {0xea980, 0xea9cd}, {0xea9cf, 0xea9d9}, {0xea9de, 0xea9fe}, + {0xeaa00, 0xeaa36}, {0xeaa40, 0xeaa4d}, {0xeaa50, 0xeaa59}, {0xeaa5c, 0xeaac2}, + {0xeaadb, 0xeaaf6}, {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, + {0xeab20, 0xeab26}, {0xeab28, 0xeab2e}, {0xeab30, 0xeab65}, {0xeab70, 0xeabed}, + {0xeabf0, 0xeabf9}, {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, + {0xef900, 0xefa6d}, {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, + {0xefb1d, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbc1}, {0xefbd3, 0xefd3f}, + {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfd}, {0xefe00, 0xefe19}, + {0xefe20, 0xefe52}, {0xefe54, 0xefe66}, {0xefe68, 0xefe6b}, {0xefe70, 0xefe74}, + {0xefe76, 0xefefc}, {0xeff01, 0xeffbe}, {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, + {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, {0xeffe0, 0xeffe6}, {0xeffe8, 0xeffee}, + {0xf0021, 0xf007e}, {0xf00a1, 0xf00ac}, {0xf00ae, 0xf0377}, {0xf037a, 0xf037f}, + {0xf0384, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf052f}, {0xf0531, 0xf0556}, + {0xf0559, 0xf055f}, {0xf0561, 0xf0587}, {0xf058d, 0xf058f}, {0xf0591, 0xf05c7}, + {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f4}, {0xf0606, 0xf061b}, {0xf061e, 0xf06dc}, + {0xf06de, 0xf070d}, {0xf0710, 0xf074a}, {0xf074d, 0xf07b1}, {0xf07c0, 0xf07fa}, + {0xf0800, 0xf082d}, {0xf0830, 0xf083e}, {0xf0840, 0xf085b}, {0xf0860, 0xf086a}, + {0xf08a0, 0xf08b4}, {0xf08b6, 0xf08bd}, {0xf08d4, 0xf08e1}, {0xf08e3, 0xf0983}, + {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, + {0xf09bc, 0xf09c4}, {0xf09cb, 0xf09ce}, {0xf09df, 0xf09e3}, {0xf09e6, 0xf09fd}, + {0xf0a01, 0xf0a03}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, + {0xf0a3e, 0xf0a42}, {0xf0a4b, 0xf0a4d}, {0xf0a59, 0xf0a5c}, {0xf0a66, 0xf0a75}, + {0xf0a81, 0xf0a83}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, {0xf0a93, 0xf0aa8}, + {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0abc, 0xf0ac5}, {0xf0ac7, 0xf0ac9}, + {0xf0acb, 0xf0acd}, {0xf0ae0, 0xf0ae3}, {0xf0ae6, 0xf0af1}, {0xf0af9, 0xf0aff}, + {0xf0b01, 0xf0b03}, {0xf0b05, 0xf0b0c}, {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, + {0xf0b35, 0xf0b39}, {0xf0b3c, 0xf0b44}, {0xf0b4b, 0xf0b4d}, {0xf0b5f, 0xf0b63}, + {0xf0b66, 0xf0b77}, {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, + {0xf0ba8, 0xf0baa}, {0xf0bae, 0xf0bb9}, {0xf0bbe, 0xf0bc2}, {0xf0bc6, 0xf0bc8}, + {0xf0bca, 0xf0bcd}, {0xf0be6, 0xf0bfa}, {0xf0c00, 0xf0c03}, {0xf0c05, 0xf0c0c}, + {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, {0xf0c2a, 0xf0c39}, {0xf0c3d, 0xf0c44}, + {0xf0c46, 0xf0c48}, {0xf0c4a, 0xf0c4d}, {0xf0c58, 0xf0c5a}, {0xf0c60, 0xf0c63}, + {0xf0c66, 0xf0c6f}, {0xf0c78, 0xf0c83}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, + {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0cbc, 0xf0cc4}, + {0xf0cc6, 0xf0cc8}, {0xf0cca, 0xf0ccd}, {0xf0ce0, 0xf0ce3}, {0xf0ce6, 0xf0cef}, + {0xf0d00, 0xf0d03}, {0xf0d05, 0xf0d0c}, {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d44}, + {0xf0d46, 0xf0d48}, {0xf0d4a, 0xf0d4f}, {0xf0d54, 0xf0d63}, {0xf0d66, 0xf0d7f}, + {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, {0xf0dc0, 0xf0dc6}, + {0xf0dcf, 0xf0dd4}, {0xf0dd8, 0xf0ddf}, {0xf0de6, 0xf0def}, {0xf0df2, 0xf0df4}, + {0xf0e01, 0xf0e3a}, {0xf0e3f, 0xf0e5b}, {0xf0e94, 0xf0e97}, {0xf0e99, 0xf0e9f}, + {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb9}, {0xf0ebb, 0xf0ebd}, {0xf0ec0, 0xf0ec4}, + {0xf0ec8, 0xf0ecd}, {0xf0ed0, 0xf0ed9}, {0xf0edc, 0xf0edf}, {0xf0f00, 0xf0f47}, + {0xf0f49, 0xf0f6c}, {0xf0f71, 0xf0f97}, {0xf0f99, 0xf0fbc}, {0xf0fbe, 0xf0fcc}, + {0xf0fce, 0xf0fda}, {0xf1000, 0xf10c5}, {0xf10d0, 0xf1248}, {0xf124a, 0xf124d}, + {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, {0xf128a, 0xf128d}, + {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, {0xf12c2, 0xf12c5}, + {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, {0xf1318, 0xf135a}, + {0xf135d, 0xf137c}, {0xf1380, 0xf1399}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, + {0xf1400, 0xf167f}, {0xf1681, 0xf169c}, {0xf16a0, 0xf16f8}, {0xf1700, 0xf170c}, + {0xf170e, 0xf1714}, {0xf1720, 0xf1736}, {0xf1740, 0xf1753}, {0xf1760, 0xf176c}, + {0xf176e, 0xf1770}, {0xf1780, 0xf17dd}, {0xf17e0, 0xf17e9}, {0xf17f0, 0xf17f9}, + {0xf1800, 0xf180d}, {0xf1810, 0xf1819}, {0xf1820, 0xf1877}, {0xf1880, 0xf18aa}, + {0xf18b0, 0xf18f5}, {0xf1900, 0xf191e}, {0xf1920, 0xf192b}, {0xf1930, 0xf193b}, + {0xf1944, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, {0xf19b0, 0xf19c9}, + {0xf19d0, 0xf19da}, {0xf19de, 0xf1a1b}, {0xf1a1e, 0xf1a5e}, {0xf1a60, 0xf1a7c}, + {0xf1a7f, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1aa0, 0xf1aad}, {0xf1ab0, 0xf1abe}, + {0xf1b00, 0xf1b4b}, {0xf1b50, 0xf1b7c}, {0xf1b80, 0xf1bf3}, {0xf1bfc, 0xf1c37}, + {0xf1c3b, 0xf1c49}, {0xf1c4d, 0xf1c88}, {0xf1cc0, 0xf1cc7}, {0xf1cd0, 0xf1cf9}, + {0xf1d00, 0xf1df9}, {0xf1dfb, 0xf1f15}, {0xf1f18, 0xf1f1d}, {0xf1f20, 0xf1f45}, + {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, {0xf1f80, 0xf1fb4}, + {0xf1fb6, 0xf1fc4}, {0xf1fc6, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fdd, 0xf1fef}, + {0xf1ff2, 0xf1ff4}, {0xf1ff6, 0xf1ffe}, {0xf2010, 0xf2027}, {0xf2030, 0xf205e}, + {0xf2074, 0xf208e}, {0xf2090, 0xf209c}, {0xf20a0, 0xf20bf}, {0xf20d0, 0xf20f0}, + {0xf2100, 0xf218b}, {0xf2190, 0xf2426}, {0xf2440, 0xf244a}, {0xf2460, 0xf2b73}, + {0xf2b76, 0xf2b95}, {0xf2b98, 0xf2bb9}, {0xf2bbd, 0xf2bc8}, {0xf2bca, 0xf2bd2}, + {0xf2bec, 0xf2bef}, {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2cf3}, + {0xf2cf9, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d7f, 0xf2d96}, {0xf2da0, 0xf2da6}, + {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, + {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf2de0, 0xf2e49}, + {0xf2e80, 0xf2e99}, {0xf2e9b, 0xf2ef3}, {0xf2f00, 0xf2fd5}, {0xf2ff0, 0xf2ffb}, + {0xf3001, 0xf303f}, {0xf3041, 0xf3096}, {0xf3099, 0xf30ff}, {0xf3105, 0xf312e}, + {0xf3131, 0xf318e}, {0xf3190, 0xf31ba}, {0xf31c0, 0xf31e3}, {0xf31f0, 0xf321e}, + {0xf3220, 0xf32fe}, {0xf3300, 0xf4db5}, {0xf4dc0, 0xf9fea}, {0xfa000, 0xfa48c}, + {0xfa490, 0xfa4c6}, {0xfa4d0, 0xfa62b}, {0xfa640, 0xfa6f7}, {0xfa700, 0xfa7ae}, + {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa82b}, {0xfa830, 0xfa839}, {0xfa840, 0xfa877}, + {0xfa880, 0xfa8c5}, {0xfa8ce, 0xfa8d9}, {0xfa8e0, 0xfa8fd}, {0xfa900, 0xfa953}, + {0xfa95f, 0xfa97c}, {0xfa980, 0xfa9cd}, {0xfa9cf, 0xfa9d9}, {0xfa9de, 0xfa9fe}, + {0xfaa00, 0xfaa36}, {0xfaa40, 0xfaa4d}, {0xfaa50, 0xfaa59}, {0xfaa5c, 0xfaac2}, + {0xfaadb, 0xfaaf6}, {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, + {0xfab20, 0xfab26}, {0xfab28, 0xfab2e}, {0xfab30, 0xfab65}, {0xfab70, 0xfabed}, + {0xfabf0, 0xfabf9}, {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, + {0xff900, 0xffa6d}, {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, + {0xffb1d, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbc1}, {0xffbd3, 0xffd3f}, + {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfd}, {0xffe00, 0xffe19}, + {0xffe20, 0xffe52}, {0xffe54, 0xffe66}, {0xffe68, 0xffe6b}, {0xffe70, 0xffe74}, + {0xffe76, 0xffefc}, {0xfff01, 0xfffbe}, {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, + {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, {0xfffe0, 0xfffe6}, {0xfffe8, 0xfffee}, + {0x100021, 0x10007e}, {0x1000a1, 0x1000ac}, {0x1000ae, 0x100377}, {0x10037a, 0x10037f}, + {0x100384, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x10052f}, {0x100531, 0x100556}, + {0x100559, 0x10055f}, {0x100561, 0x100587}, {0x10058d, 0x10058f}, {0x100591, 0x1005c7}, + {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f4}, {0x100606, 0x10061b}, {0x10061e, 0x1006dc}, + {0x1006de, 0x10070d}, {0x100710, 0x10074a}, {0x10074d, 0x1007b1}, {0x1007c0, 0x1007fa}, + {0x100800, 0x10082d}, {0x100830, 0x10083e}, {0x100840, 0x10085b}, {0x100860, 0x10086a}, + {0x1008a0, 0x1008b4}, {0x1008b6, 0x1008bd}, {0x1008d4, 0x1008e1}, {0x1008e3, 0x100983}, + {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, + {0x1009bc, 0x1009c4}, {0x1009cb, 0x1009ce}, {0x1009df, 0x1009e3}, {0x1009e6, 0x1009fd}, + {0x100a01, 0x100a03}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, + {0x100a3e, 0x100a42}, {0x100a4b, 0x100a4d}, {0x100a59, 0x100a5c}, {0x100a66, 0x100a75}, + {0x100a81, 0x100a83}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, {0x100a93, 0x100aa8}, + {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100abc, 0x100ac5}, {0x100ac7, 0x100ac9}, + {0x100acb, 0x100acd}, {0x100ae0, 0x100ae3}, {0x100ae6, 0x100af1}, {0x100af9, 0x100aff}, + {0x100b01, 0x100b03}, {0x100b05, 0x100b0c}, {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, + {0x100b35, 0x100b39}, {0x100b3c, 0x100b44}, {0x100b4b, 0x100b4d}, {0x100b5f, 0x100b63}, + {0x100b66, 0x100b77}, {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, + {0x100ba8, 0x100baa}, {0x100bae, 0x100bb9}, {0x100bbe, 0x100bc2}, {0x100bc6, 0x100bc8}, + {0x100bca, 0x100bcd}, {0x100be6, 0x100bfa}, {0x100c00, 0x100c03}, {0x100c05, 0x100c0c}, + {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, {0x100c2a, 0x100c39}, {0x100c3d, 0x100c44}, + {0x100c46, 0x100c48}, {0x100c4a, 0x100c4d}, {0x100c58, 0x100c5a}, {0x100c60, 0x100c63}, + {0x100c66, 0x100c6f}, {0x100c78, 0x100c83}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, + {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100cbc, 0x100cc4}, + {0x100cc6, 0x100cc8}, {0x100cca, 0x100ccd}, {0x100ce0, 0x100ce3}, {0x100ce6, 0x100cef}, + {0x100d00, 0x100d03}, {0x100d05, 0x100d0c}, {0x100d0e, 0x100d10}, {0x100d12, 0x100d44}, + {0x100d46, 0x100d48}, {0x100d4a, 0x100d4f}, {0x100d54, 0x100d63}, {0x100d66, 0x100d7f}, + {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, {0x100dc0, 0x100dc6}, + {0x100dcf, 0x100dd4}, {0x100dd8, 0x100ddf}, {0x100de6, 0x100def}, {0x100df2, 0x100df4}, + {0x100e01, 0x100e3a}, {0x100e3f, 0x100e5b}, {0x100e94, 0x100e97}, {0x100e99, 0x100e9f}, + {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb9}, {0x100ebb, 0x100ebd}, {0x100ec0, 0x100ec4}, + {0x100ec8, 0x100ecd}, {0x100ed0, 0x100ed9}, {0x100edc, 0x100edf}, {0x100f00, 0x100f47}, + {0x100f49, 0x100f6c}, {0x100f71, 0x100f97}, {0x100f99, 0x100fbc}, {0x100fbe, 0x100fcc}, + {0x100fce, 0x100fda}, {0x101000, 0x1010c5}, {0x1010d0, 0x101248}, {0x10124a, 0x10124d}, + {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, {0x10128a, 0x10128d}, + {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, {0x1012c2, 0x1012c5}, + {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, {0x101318, 0x10135a}, + {0x10135d, 0x10137c}, {0x101380, 0x101399}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, + {0x101400, 0x10167f}, {0x101681, 0x10169c}, {0x1016a0, 0x1016f8}, {0x101700, 0x10170c}, + {0x10170e, 0x101714}, {0x101720, 0x101736}, {0x101740, 0x101753}, {0x101760, 0x10176c}, + {0x10176e, 0x101770}, {0x101780, 0x1017dd}, {0x1017e0, 0x1017e9}, {0x1017f0, 0x1017f9}, + {0x101800, 0x10180d}, {0x101810, 0x101819}, {0x101820, 0x101877}, {0x101880, 0x1018aa}, + {0x1018b0, 0x1018f5}, {0x101900, 0x10191e}, {0x101920, 0x10192b}, {0x101930, 0x10193b}, + {0x101944, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, {0x1019b0, 0x1019c9}, + {0x1019d0, 0x1019da}, {0x1019de, 0x101a1b}, {0x101a1e, 0x101a5e}, {0x101a60, 0x101a7c}, + {0x101a7f, 0x101a89}, {0x101a90, 0x101a99}, {0x101aa0, 0x101aad}, {0x101ab0, 0x101abe}, + {0x101b00, 0x101b4b}, {0x101b50, 0x101b7c}, {0x101b80, 0x101bf3}, {0x101bfc, 0x101c37}, + {0x101c3b, 0x101c49}, {0x101c4d, 0x101c88}, {0x101cc0, 0x101cc7}, {0x101cd0, 0x101cf9}, + {0x101d00, 0x101df9}, {0x101dfb, 0x101f15}, {0x101f18, 0x101f1d}, {0x101f20, 0x101f45}, + {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, {0x101f80, 0x101fb4}, + {0x101fb6, 0x101fc4}, {0x101fc6, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fdd, 0x101fef}, + {0x101ff2, 0x101ff4}, {0x101ff6, 0x101ffe}, {0x102010, 0x102027}, {0x102030, 0x10205e}, + {0x102074, 0x10208e}, {0x102090, 0x10209c}, {0x1020a0, 0x1020bf}, {0x1020d0, 0x1020f0}, + {0x102100, 0x10218b}, {0x102190, 0x102426}, {0x102440, 0x10244a}, {0x102460, 0x102b73}, + {0x102b76, 0x102b95}, {0x102b98, 0x102bb9}, {0x102bbd, 0x102bc8}, {0x102bca, 0x102bd2}, + {0x102bec, 0x102bef}, {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102cf3}, + {0x102cf9, 0x102d25}, {0x102d30, 0x102d67}, {0x102d7f, 0x102d96}, {0x102da0, 0x102da6}, + {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, + {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x102de0, 0x102e49}, + {0x102e80, 0x102e99}, {0x102e9b, 0x102ef3}, {0x102f00, 0x102fd5}, {0x102ff0, 0x102ffb}, + {0x103001, 0x10303f}, {0x103041, 0x103096}, {0x103099, 0x1030ff}, {0x103105, 0x10312e}, + {0x103131, 0x10318e}, {0x103190, 0x1031ba}, {0x1031c0, 0x1031e3}, {0x1031f0, 0x10321e}, + {0x103220, 0x1032fe}, {0x103300, 0x104db5}, {0x104dc0, 0x109fea}, {0x10a000, 0x10a48c}, + {0x10a490, 0x10a4c6}, {0x10a4d0, 0x10a62b}, {0x10a640, 0x10a6f7}, {0x10a700, 0x10a7ae}, + {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a82b}, {0x10a830, 0x10a839}, {0x10a840, 0x10a877}, + {0x10a880, 0x10a8c5}, {0x10a8ce, 0x10a8d9}, {0x10a8e0, 0x10a8fd}, {0x10a900, 0x10a953}, + {0x10a95f, 0x10a97c}, {0x10a980, 0x10a9cd}, {0x10a9cf, 0x10a9d9}, {0x10a9de, 0x10a9fe}, + {0x10aa00, 0x10aa36}, {0x10aa40, 0x10aa4d}, {0x10aa50, 0x10aa59}, {0x10aa5c, 0x10aac2}, + {0x10aadb, 0x10aaf6}, {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, + {0x10ab20, 0x10ab26}, {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab65}, {0x10ab70, 0x10abed}, + {0x10abf0, 0x10abf9}, {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, + {0x10f900, 0x10fa6d}, {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, + {0x10fb1d, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbc1}, {0x10fbd3, 0x10fd3f}, + {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfd}, {0x10fe00, 0x10fe19}, + {0x10fe20, 0x10fe52}, {0x10fe54, 0x10fe66}, {0x10fe68, 0x10fe6b}, {0x10fe70, 0x10fe74}, + {0x10fe76, 0x10fefc}, {0x10ff01, 0x10ffbe}, {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, + {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc}, {0x10ffe0, 0x10ffe6}, {0x10ffe8, 0x10ffee} #endif }; @@ -755,23 +6176,186 @@ static const chr graphCharTable[] = { 0x38c, 0x589, 0x58a, 0x85e, 0x98f, 0x990, 0x9b2, 0x9c7, 0x9c8, 0x9d7, 0x9dc, 0x9dd, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, 0xa39, 0xa3c, 0xa47, 0xa48, 0xa51, 0xa5e, 0xab2, 0xab3, - 0xad0, 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, - 0xb57, 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, - 0xb9f, 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, - 0xcde, 0xcf1, 0xcf2, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, - 0xe82, 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, - 0xeab, 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, - 0x1cf8, 0x1cf9, 0x1f59, 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, - 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd + 0xad0, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57, + 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, + 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, 0xcde, + 0xcf1, 0xcf2, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, 0xe82, + 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, + 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, 0x1f59, + 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, + 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd #if TCL_UTF_MAX > 4 - ,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, - 0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333, - 0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x118ff, 0x16a6e, 0x16a6f, - 0x16fe0, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, - 0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, - 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, - 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, - 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f930, 0x1f9c0 + ,0x1038c, 0x10589, 0x1058a, 0x1085e, 0x1098f, 0x10990, 0x109b2, 0x109c7, 0x109c8, + 0x109d7, 0x109dc, 0x109dd, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, + 0x10a38, 0x10a39, 0x10a3c, 0x10a47, 0x10a48, 0x10a51, 0x10a5e, 0x10ab2, 0x10ab3, + 0x10ad0, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b47, 0x10b48, 0x10b56, 0x10b57, + 0x10b5c, 0x10b5d, 0x10b82, 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, + 0x10ba3, 0x10ba4, 0x10bd0, 0x10bd7, 0x10c55, 0x10c56, 0x10cd5, 0x10cd6, 0x10cde, + 0x10cf1, 0x10cf2, 0x10d82, 0x10d83, 0x10dbd, 0x10dca, 0x10dd6, 0x10e81, 0x10e82, + 0x10e84, 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, + 0x10ec6, 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x11772, 0x11773, 0x11940, 0x11f59, + 0x11f5b, 0x11f5d, 0x12070, 0x12071, 0x12d27, 0x12d2d, 0x12d6f, 0x12d70, 0x1fb3e, + 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, 0x1fffc, 0x1fffd, 0x2038c, 0x20589, 0x2058a, + 0x2085e, 0x2098f, 0x20990, 0x209b2, 0x209c7, 0x209c8, 0x209d7, 0x209dc, 0x209dd, + 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, 0x20a38, 0x20a39, 0x20a3c, + 0x20a47, 0x20a48, 0x20a51, 0x20a5e, 0x20ab2, 0x20ab3, 0x20ad0, 0x20b0f, 0x20b10, + 0x20b32, 0x20b33, 0x20b47, 0x20b48, 0x20b56, 0x20b57, 0x20b5c, 0x20b5d, 0x20b82, + 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, + 0x20bd7, 0x20c55, 0x20c56, 0x20cd5, 0x20cd6, 0x20cde, 0x20cf1, 0x20cf2, 0x20d82, + 0x20d83, 0x20dbd, 0x20dca, 0x20dd6, 0x20e81, 0x20e82, 0x20e84, 0x20e87, 0x20e88, + 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20ec6, 0x210c7, 0x210cd, + 0x21258, 0x212c0, 0x21772, 0x21773, 0x21940, 0x21f59, 0x21f5b, 0x21f5d, 0x22070, + 0x22071, 0x22d27, 0x22d2d, 0x22d6f, 0x22d70, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, + 0x2fb44, 0x2fffc, 0x2fffd, 0x3038c, 0x30589, 0x3058a, 0x3085e, 0x3098f, 0x30990, + 0x309b2, 0x309c7, 0x309c8, 0x309d7, 0x309dc, 0x309dd, 0x30a0f, 0x30a10, 0x30a32, + 0x30a33, 0x30a35, 0x30a36, 0x30a38, 0x30a39, 0x30a3c, 0x30a47, 0x30a48, 0x30a51, + 0x30a5e, 0x30ab2, 0x30ab3, 0x30ad0, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b47, + 0x30b48, 0x30b56, 0x30b57, 0x30b5c, 0x30b5d, 0x30b82, 0x30b83, 0x30b99, 0x30b9a, + 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, 0x30bd7, 0x30c55, 0x30c56, + 0x30cd5, 0x30cd6, 0x30cde, 0x30cf1, 0x30cf2, 0x30d82, 0x30d83, 0x30dbd, 0x30dca, + 0x30dd6, 0x30e81, 0x30e82, 0x30e84, 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, + 0x30ea7, 0x30eaa, 0x30eab, 0x30ec6, 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x31772, + 0x31773, 0x31940, 0x31f59, 0x31f5b, 0x31f5d, 0x32070, 0x32071, 0x32d27, 0x32d2d, + 0x32d6f, 0x32d70, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, 0x3fffc, 0x3fffd, + 0x4038c, 0x40589, 0x4058a, 0x4085e, 0x4098f, 0x40990, 0x409b2, 0x409c7, 0x409c8, + 0x409d7, 0x409dc, 0x409dd, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, + 0x40a38, 0x40a39, 0x40a3c, 0x40a47, 0x40a48, 0x40a51, 0x40a5e, 0x40ab2, 0x40ab3, + 0x40ad0, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b47, 0x40b48, 0x40b56, 0x40b57, + 0x40b5c, 0x40b5d, 0x40b82, 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, + 0x40ba3, 0x40ba4, 0x40bd0, 0x40bd7, 0x40c55, 0x40c56, 0x40cd5, 0x40cd6, 0x40cde, + 0x40cf1, 0x40cf2, 0x40d82, 0x40d83, 0x40dbd, 0x40dca, 0x40dd6, 0x40e81, 0x40e82, + 0x40e84, 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, + 0x40ec6, 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x41772, 0x41773, 0x41940, 0x41f59, + 0x41f5b, 0x41f5d, 0x42070, 0x42071, 0x42d27, 0x42d2d, 0x42d6f, 0x42d70, 0x4fb3e, + 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, 0x4fffc, 0x4fffd, 0x5038c, 0x50589, 0x5058a, + 0x5085e, 0x5098f, 0x50990, 0x509b2, 0x509c7, 0x509c8, 0x509d7, 0x509dc, 0x509dd, + 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, 0x50a38, 0x50a39, 0x50a3c, + 0x50a47, 0x50a48, 0x50a51, 0x50a5e, 0x50ab2, 0x50ab3, 0x50ad0, 0x50b0f, 0x50b10, + 0x50b32, 0x50b33, 0x50b47, 0x50b48, 0x50b56, 0x50b57, 0x50b5c, 0x50b5d, 0x50b82, + 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, + 0x50bd7, 0x50c55, 0x50c56, 0x50cd5, 0x50cd6, 0x50cde, 0x50cf1, 0x50cf2, 0x50d82, + 0x50d83, 0x50dbd, 0x50dca, 0x50dd6, 0x50e81, 0x50e82, 0x50e84, 0x50e87, 0x50e88, + 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50ec6, 0x510c7, 0x510cd, + 0x51258, 0x512c0, 0x51772, 0x51773, 0x51940, 0x51f59, 0x51f5b, 0x51f5d, 0x52070, + 0x52071, 0x52d27, 0x52d2d, 0x52d6f, 0x52d70, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, + 0x5fb44, 0x5fffc, 0x5fffd, 0x6038c, 0x60589, 0x6058a, 0x6085e, 0x6098f, 0x60990, + 0x609b2, 0x609c7, 0x609c8, 0x609d7, 0x609dc, 0x609dd, 0x60a0f, 0x60a10, 0x60a32, + 0x60a33, 0x60a35, 0x60a36, 0x60a38, 0x60a39, 0x60a3c, 0x60a47, 0x60a48, 0x60a51, + 0x60a5e, 0x60ab2, 0x60ab3, 0x60ad0, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b47, + 0x60b48, 0x60b56, 0x60b57, 0x60b5c, 0x60b5d, 0x60b82, 0x60b83, 0x60b99, 0x60b9a, + 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, 0x60bd7, 0x60c55, 0x60c56, + 0x60cd5, 0x60cd6, 0x60cde, 0x60cf1, 0x60cf2, 0x60d82, 0x60d83, 0x60dbd, 0x60dca, + 0x60dd6, 0x60e81, 0x60e82, 0x60e84, 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, + 0x60ea7, 0x60eaa, 0x60eab, 0x60ec6, 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x61772, + 0x61773, 0x61940, 0x61f59, 0x61f5b, 0x61f5d, 0x62070, 0x62071, 0x62d27, 0x62d2d, + 0x62d6f, 0x62d70, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, 0x6fffc, 0x6fffd, + 0x7038c, 0x70589, 0x7058a, 0x7085e, 0x7098f, 0x70990, 0x709b2, 0x709c7, 0x709c8, + 0x709d7, 0x709dc, 0x709dd, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, + 0x70a38, 0x70a39, 0x70a3c, 0x70a47, 0x70a48, 0x70a51, 0x70a5e, 0x70ab2, 0x70ab3, + 0x70ad0, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b47, 0x70b48, 0x70b56, 0x70b57, + 0x70b5c, 0x70b5d, 0x70b82, 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, + 0x70ba3, 0x70ba4, 0x70bd0, 0x70bd7, 0x70c55, 0x70c56, 0x70cd5, 0x70cd6, 0x70cde, + 0x70cf1, 0x70cf2, 0x70d82, 0x70d83, 0x70dbd, 0x70dca, 0x70dd6, 0x70e81, 0x70e82, + 0x70e84, 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, + 0x70ec6, 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x71772, 0x71773, 0x71940, 0x71f59, + 0x71f5b, 0x71f5d, 0x72070, 0x72071, 0x72d27, 0x72d2d, 0x72d6f, 0x72d70, 0x7fb3e, + 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, 0x7fffc, 0x7fffd, 0x8038c, 0x80589, 0x8058a, + 0x8085e, 0x8098f, 0x80990, 0x809b2, 0x809c7, 0x809c8, 0x809d7, 0x809dc, 0x809dd, + 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, 0x80a38, 0x80a39, 0x80a3c, + 0x80a47, 0x80a48, 0x80a51, 0x80a5e, 0x80ab2, 0x80ab3, 0x80ad0, 0x80b0f, 0x80b10, + 0x80b32, 0x80b33, 0x80b47, 0x80b48, 0x80b56, 0x80b57, 0x80b5c, 0x80b5d, 0x80b82, + 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, + 0x80bd7, 0x80c55, 0x80c56, 0x80cd5, 0x80cd6, 0x80cde, 0x80cf1, 0x80cf2, 0x80d82, + 0x80d83, 0x80dbd, 0x80dca, 0x80dd6, 0x80e81, 0x80e82, 0x80e84, 0x80e87, 0x80e88, + 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80ec6, 0x810c7, 0x810cd, + 0x81258, 0x812c0, 0x81772, 0x81773, 0x81940, 0x81f59, 0x81f5b, 0x81f5d, 0x82070, + 0x82071, 0x82d27, 0x82d2d, 0x82d6f, 0x82d70, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, + 0x8fb44, 0x8fffc, 0x8fffd, 0x9038c, 0x90589, 0x9058a, 0x9085e, 0x9098f, 0x90990, + 0x909b2, 0x909c7, 0x909c8, 0x909d7, 0x909dc, 0x909dd, 0x90a0f, 0x90a10, 0x90a32, + 0x90a33, 0x90a35, 0x90a36, 0x90a38, 0x90a39, 0x90a3c, 0x90a47, 0x90a48, 0x90a51, + 0x90a5e, 0x90ab2, 0x90ab3, 0x90ad0, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b47, + 0x90b48, 0x90b56, 0x90b57, 0x90b5c, 0x90b5d, 0x90b82, 0x90b83, 0x90b99, 0x90b9a, + 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, 0x90bd7, 0x90c55, 0x90c56, + 0x90cd5, 0x90cd6, 0x90cde, 0x90cf1, 0x90cf2, 0x90d82, 0x90d83, 0x90dbd, 0x90dca, + 0x90dd6, 0x90e81, 0x90e82, 0x90e84, 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, + 0x90ea7, 0x90eaa, 0x90eab, 0x90ec6, 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x91772, + 0x91773, 0x91940, 0x91f59, 0x91f5b, 0x91f5d, 0x92070, 0x92071, 0x92d27, 0x92d2d, + 0x92d6f, 0x92d70, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, 0x9fffc, 0x9fffd, + 0xa038c, 0xa0589, 0xa058a, 0xa085e, 0xa098f, 0xa0990, 0xa09b2, 0xa09c7, 0xa09c8, + 0xa09d7, 0xa09dc, 0xa09dd, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, + 0xa0a38, 0xa0a39, 0xa0a3c, 0xa0a47, 0xa0a48, 0xa0a51, 0xa0a5e, 0xa0ab2, 0xa0ab3, + 0xa0ad0, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b47, 0xa0b48, 0xa0b56, 0xa0b57, + 0xa0b5c, 0xa0b5d, 0xa0b82, 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, + 0xa0ba3, 0xa0ba4, 0xa0bd0, 0xa0bd7, 0xa0c55, 0xa0c56, 0xa0cd5, 0xa0cd6, 0xa0cde, + 0xa0cf1, 0xa0cf2, 0xa0d82, 0xa0d83, 0xa0dbd, 0xa0dca, 0xa0dd6, 0xa0e81, 0xa0e82, + 0xa0e84, 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, + 0xa0ec6, 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa1772, 0xa1773, 0xa1940, 0xa1f59, + 0xa1f5b, 0xa1f5d, 0xa2070, 0xa2071, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2d70, 0xafb3e, + 0xafb40, 0xafb41, 0xafb43, 0xafb44, 0xafffc, 0xafffd, 0xb038c, 0xb0589, 0xb058a, + 0xb085e, 0xb098f, 0xb0990, 0xb09b2, 0xb09c7, 0xb09c8, 0xb09d7, 0xb09dc, 0xb09dd, + 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, 0xb0a38, 0xb0a39, 0xb0a3c, + 0xb0a47, 0xb0a48, 0xb0a51, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0ad0, 0xb0b0f, 0xb0b10, + 0xb0b32, 0xb0b33, 0xb0b47, 0xb0b48, 0xb0b56, 0xb0b57, 0xb0b5c, 0xb0b5d, 0xb0b82, + 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, + 0xb0bd7, 0xb0c55, 0xb0c56, 0xb0cd5, 0xb0cd6, 0xb0cde, 0xb0cf1, 0xb0cf2, 0xb0d82, + 0xb0d83, 0xb0dbd, 0xb0dca, 0xb0dd6, 0xb0e81, 0xb0e82, 0xb0e84, 0xb0e87, 0xb0e88, + 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0ec6, 0xb10c7, 0xb10cd, + 0xb1258, 0xb12c0, 0xb1772, 0xb1773, 0xb1940, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb2070, + 0xb2071, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2d70, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, + 0xbfb44, 0xbfffc, 0xbfffd, 0xc038c, 0xc0589, 0xc058a, 0xc085e, 0xc098f, 0xc0990, + 0xc09b2, 0xc09c7, 0xc09c8, 0xc09d7, 0xc09dc, 0xc09dd, 0xc0a0f, 0xc0a10, 0xc0a32, + 0xc0a33, 0xc0a35, 0xc0a36, 0xc0a38, 0xc0a39, 0xc0a3c, 0xc0a47, 0xc0a48, 0xc0a51, + 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0ad0, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b47, + 0xc0b48, 0xc0b56, 0xc0b57, 0xc0b5c, 0xc0b5d, 0xc0b82, 0xc0b83, 0xc0b99, 0xc0b9a, + 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, 0xc0bd7, 0xc0c55, 0xc0c56, + 0xc0cd5, 0xc0cd6, 0xc0cde, 0xc0cf1, 0xc0cf2, 0xc0d82, 0xc0d83, 0xc0dbd, 0xc0dca, + 0xc0dd6, 0xc0e81, 0xc0e82, 0xc0e84, 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, + 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0ec6, 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc1772, + 0xc1773, 0xc1940, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc2070, 0xc2071, 0xc2d27, 0xc2d2d, + 0xc2d6f, 0xc2d70, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, 0xcfffc, 0xcfffd, + 0xd038c, 0xd0589, 0xd058a, 0xd085e, 0xd098f, 0xd0990, 0xd09b2, 0xd09c7, 0xd09c8, + 0xd09d7, 0xd09dc, 0xd09dd, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, + 0xd0a38, 0xd0a39, 0xd0a3c, 0xd0a47, 0xd0a48, 0xd0a51, 0xd0a5e, 0xd0ab2, 0xd0ab3, + 0xd0ad0, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b47, 0xd0b48, 0xd0b56, 0xd0b57, + 0xd0b5c, 0xd0b5d, 0xd0b82, 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, + 0xd0ba3, 0xd0ba4, 0xd0bd0, 0xd0bd7, 0xd0c55, 0xd0c56, 0xd0cd5, 0xd0cd6, 0xd0cde, + 0xd0cf1, 0xd0cf2, 0xd0d82, 0xd0d83, 0xd0dbd, 0xd0dca, 0xd0dd6, 0xd0e81, 0xd0e82, + 0xd0e84, 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, + 0xd0ec6, 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd1772, 0xd1773, 0xd1940, 0xd1f59, + 0xd1f5b, 0xd1f5d, 0xd2070, 0xd2071, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2d70, 0xdfb3e, + 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, 0xdfffc, 0xdfffd, 0xe038c, 0xe0589, 0xe058a, + 0xe085e, 0xe098f, 0xe0990, 0xe09b2, 0xe09c7, 0xe09c8, 0xe09d7, 0xe09dc, 0xe09dd, + 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, 0xe0a38, 0xe0a39, 0xe0a3c, + 0xe0a47, 0xe0a48, 0xe0a51, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0ad0, 0xe0b0f, 0xe0b10, + 0xe0b32, 0xe0b33, 0xe0b47, 0xe0b48, 0xe0b56, 0xe0b57, 0xe0b5c, 0xe0b5d, 0xe0b82, + 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, + 0xe0bd7, 0xe0c55, 0xe0c56, 0xe0cd5, 0xe0cd6, 0xe0cde, 0xe0cf1, 0xe0cf2, 0xe0d82, + 0xe0d83, 0xe0dbd, 0xe0dca, 0xe0dd6, 0xe0e81, 0xe0e82, 0xe0e84, 0xe0e87, 0xe0e88, + 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0ec6, 0xe10c7, 0xe10cd, + 0xe1258, 0xe12c0, 0xe1772, 0xe1773, 0xe1940, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe2070, + 0xe2071, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2d70, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, + 0xefb44, 0xefffc, 0xefffd, 0xf038c, 0xf0589, 0xf058a, 0xf085e, 0xf098f, 0xf0990, + 0xf09b2, 0xf09c7, 0xf09c8, 0xf09d7, 0xf09dc, 0xf09dd, 0xf0a0f, 0xf0a10, 0xf0a32, + 0xf0a33, 0xf0a35, 0xf0a36, 0xf0a38, 0xf0a39, 0xf0a3c, 0xf0a47, 0xf0a48, 0xf0a51, + 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0ad0, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b47, + 0xf0b48, 0xf0b56, 0xf0b57, 0xf0b5c, 0xf0b5d, 0xf0b82, 0xf0b83, 0xf0b99, 0xf0b9a, + 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, 0xf0bd7, 0xf0c55, 0xf0c56, + 0xf0cd5, 0xf0cd6, 0xf0cde, 0xf0cf1, 0xf0cf2, 0xf0d82, 0xf0d83, 0xf0dbd, 0xf0dca, + 0xf0dd6, 0xf0e81, 0xf0e82, 0xf0e84, 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, + 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0ec6, 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf1772, + 0xf1773, 0xf1940, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf2070, 0xf2071, 0xf2d27, 0xf2d2d, + 0xf2d6f, 0xf2d70, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, 0xffffc, 0xffffd, + 0x10038c, 0x100589, 0x10058a, 0x10085e, 0x10098f, 0x100990, 0x1009b2, 0x1009c7, 0x1009c8, + 0x1009d7, 0x1009dc, 0x1009dd, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, + 0x100a38, 0x100a39, 0x100a3c, 0x100a47, 0x100a48, 0x100a51, 0x100a5e, 0x100ab2, 0x100ab3, + 0x100ad0, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b47, 0x100b48, 0x100b56, 0x100b57, + 0x100b5c, 0x100b5d, 0x100b82, 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, + 0x100ba3, 0x100ba4, 0x100bd0, 0x100bd7, 0x100c55, 0x100c56, 0x100cd5, 0x100cd6, 0x100cde, + 0x100cf1, 0x100cf2, 0x100d82, 0x100d83, 0x100dbd, 0x100dca, 0x100dd6, 0x100e81, 0x100e82, + 0x100e84, 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, + 0x100ec6, 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x101772, 0x101773, 0x101940, 0x101f59, + 0x101f5b, 0x101f5d, 0x102070, 0x102071, 0x102d27, 0x102d2d, 0x102d6f, 0x102d70, 0x10fb3e, + 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44, 0x10fffc, 0x10fffd #endif }; diff --git a/generic/tclUniData.c b/generic/tclUniData.c index d8b317a..9f05230 100644 --- a/generic/tclUniData.c +++ b/generic/tclUniData.c @@ -29,36 +29,36 @@ static const unsigned short pageMap[] = { 832, 864, 896, 928, 960, 992, 224, 1024, 224, 1056, 224, 224, 1088, 1120, 1152, 1184, 1216, 1248, 1280, 1312, 1344, 1376, 1408, 1344, 1344, 1440, 1472, 1504, 1536, 1568, 1344, 1344, 1600, 1632, 1664, 1696, 1728, - 1760, 1792, 1792, 1824, 1856, 1888, 1920, 1952, 1984, 2016, 2048, 2080, - 2112, 2144, 2176, 2208, 2240, 2272, 2304, 2336, 2368, 2400, 2432, 2464, - 2496, 2528, 2560, 2592, 2624, 2656, 2688, 2720, 2752, 2784, 2816, 2848, - 2880, 2912, 2944, 2976, 3008, 3040, 3072, 3104, 3136, 3168, 3200, 3232, - 3264, 1792, 3296, 3328, 3360, 1792, 3392, 3424, 3456, 3488, 3520, 3552, - 3584, 1792, 1344, 3616, 3648, 3680, 3712, 3744, 3776, 3808, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 3840, 1344, 3872, 3904, - 3936, 1344, 3968, 1344, 4000, 4032, 4064, 4096, 4096, 4128, 4160, 1344, + 1760, 1792, 1824, 1856, 1888, 1920, 1952, 1984, 2016, 2048, 2080, 2112, + 2144, 2176, 2208, 2240, 2272, 2304, 2336, 2368, 2400, 2432, 2464, 2496, + 2528, 2560, 2592, 2624, 2656, 2688, 2720, 2752, 2784, 2816, 2848, 2880, + 2912, 2944, 2976, 3008, 3040, 3072, 3104, 3136, 3168, 3200, 3232, 3264, + 3296, 1824, 3328, 3360, 3392, 1824, 3424, 3456, 3488, 3520, 3552, 3584, + 3616, 1824, 1344, 3648, 3680, 3712, 3744, 3776, 3808, 3840, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 3872, 1344, 3904, 3936, + 3968, 1344, 4000, 1344, 4032, 4064, 4096, 4128, 4128, 4160, 4192, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 4192, 4224, 1344, 1344, 4256, 4288, 4320, - 4352, 4384, 1344, 4416, 4448, 4480, 4512, 1344, 4544, 4576, 4608, 4640, - 1344, 4672, 4704, 4736, 4768, 4800, 1344, 4832, 4864, 4896, 4928, 1344, - 4960, 4992, 5024, 5056, 1792, 1792, 5088, 5120, 5152, 5184, 5216, 5248, - 1344, 5280, 1344, 5312, 5344, 5376, 5408, 1792, 5440, 5472, 5504, 5536, - 5568, 5600, 5632, 5568, 704, 5664, 224, 224, 224, 224, 5696, 224, 224, - 224, 5728, 5760, 5792, 5824, 5856, 5888, 5920, 5952, 5984, 6016, 6048, - 6080, 6112, 6144, 6176, 6208, 6240, 6272, 6304, 6336, 6368, 6400, 6432, - 6464, 6496, 6496, 6496, 6496, 6496, 6496, 6496, 6496, 6528, 6560, 4896, - 6592, 6624, 6656, 6688, 6720, 4896, 6752, 6784, 6816, 6848, 6880, 6912, - 6944, 4896, 4896, 4896, 4896, 4896, 6976, 7008, 7040, 4896, 4896, 4896, - 7072, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 7104, 7136, 4896, 7168, - 7200, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 6496, 6496, 6496, - 6496, 7232, 6496, 7264, 7296, 6496, 6496, 6496, 6496, 6496, 6496, 6496, - 6496, 4896, 7328, 7360, 7392, 7424, 7456, 7488, 7520, 7552, 7584, 7616, - 7648, 224, 224, 224, 7680, 7712, 7744, 1344, 7776, 7808, 7840, 7840, - 704, 7872, 7904, 7936, 1792, 7968, 4896, 4896, 8000, 4896, 4896, 4896, - 4896, 4896, 4896, 8032, 8064, 8096, 8128, 3200, 1344, 8160, 4160, 1344, - 8192, 8224, 8256, 1344, 1344, 8288, 8320, 4896, 8352, 8384, 8416, 8448, - 4896, 8416, 8480, 4896, 8384, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 4224, 4256, 1344, 1344, 4288, 4320, 4352, + 4384, 4416, 1344, 4448, 4480, 4512, 4544, 1344, 4576, 4608, 4640, 4672, + 1344, 4704, 4736, 4768, 4800, 4832, 1344, 4864, 4896, 4928, 4960, 1344, + 4992, 5024, 5056, 5088, 1824, 1824, 5120, 5152, 5184, 5216, 5248, 5280, + 1344, 5312, 1344, 5344, 5376, 5408, 5440, 1824, 5472, 5504, 5536, 5568, + 5600, 5632, 5664, 5600, 704, 5696, 224, 224, 224, 224, 5728, 224, 224, + 224, 5760, 5792, 5824, 5856, 5888, 5920, 5952, 5984, 6016, 6048, 6080, + 6112, 6144, 6176, 6208, 6240, 6272, 6304, 6336, 6368, 6400, 6432, 6464, + 6496, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6560, 6592, 4928, + 6624, 6656, 6688, 6720, 6752, 4928, 6784, 6816, 6848, 6880, 6912, 6944, + 6976, 4928, 4928, 4928, 4928, 4928, 7008, 7040, 7072, 4928, 4928, 4928, + 7104, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 7136, 7168, 4928, 7200, + 7232, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 6528, 6528, 6528, + 6528, 7264, 6528, 7296, 7328, 6528, 6528, 6528, 6528, 6528, 6528, 6528, + 6528, 4928, 7360, 7392, 7424, 7456, 7488, 7520, 7552, 7584, 7616, 7648, + 7680, 224, 224, 224, 7712, 7744, 7776, 1344, 7808, 7840, 7872, 7872, + 704, 7904, 7936, 7968, 1824, 8000, 4928, 4928, 8032, 4928, 4928, 4928, + 4928, 4928, 4928, 8064, 8096, 8128, 8160, 3232, 1344, 8192, 4192, 1344, + 8224, 8256, 8288, 1344, 1344, 8320, 8352, 4928, 8384, 8416, 8448, 8480, + 4928, 8448, 8512, 4928, 8416, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -75,7 +75,7 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 4672, 4896, 4896, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 4704, 4928, 4928, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -129,17 +129,16 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 4672, - 1792, 8512, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1792, 8544, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 8544, 4896, 8576, 5376, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 8608, 8640, 224, 8672, 8704, 1344, 1344, 8736, 8768, 8800, 224, - 8832, 8864, 8896, 1792, 8928, 8960, 8992, 1344, 9024, 9056, 9088, 9120, - 9152, 1632, 9184, 9216, 9248, 1920, 9280, 9312, 9344, 1344, 9376, 9408, - 9440, 1344, 9472, 9504, 9536, 9568, 9600, 9632, 9664, 9696, 9696, 1344, - 9728, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 8576, 4928, 8608, 5408, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 8640, 8672, 224, 8704, 8736, 1344, 1344, 8768, 8800, 8832, 224, + 8864, 8896, 8928, 1824, 8960, 8992, 9024, 1344, 9056, 9088, 9120, 9152, + 9184, 1632, 9216, 9248, 9280, 1952, 9312, 9344, 9376, 1344, 9408, 9440, + 9472, 1344, 9504, 9536, 9568, 9600, 9632, 9664, 9696, 9728, 9728, 1344, + 9760, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -167,211 +166,216 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 9760, 9792, 9824, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 9792, 9824, 9856, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 9920, 1344, 1344, 9952, 1792, 9984, 10016, - 10048, 1344, 1344, 10080, 10112, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 10144, 10176, 1344, 10208, 1344, 10240, 10272, - 10304, 10336, 10368, 10400, 1344, 1344, 1344, 10432, 10464, 64, 10496, - 10528, 10560, 4704, 10592, 10624 + 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 9952, 1344, 1344, 9984, 1824, 10016, 10048, + 10080, 1344, 1344, 10112, 10144, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 10176, 10208, 1344, 10240, 1344, 10272, 10304, + 10336, 10368, 10400, 10432, 1344, 1344, 1344, 10464, 10496, 64, 10528, + 10560, 10592, 4736, 10624, 10656 #if TCL_UTF_MAX > 3 - ,10656, 10688, 10720, 1792, 1344, 1344, 1344, 8320, 10752, 10784, 10816, - 10848, 10880, 10912, 10944, 10976, 1792, 1792, 1792, 1792, 9248, 1344, - 11008, 11040, 1344, 11072, 11104, 11136, 11168, 1344, 11200, 1792, - 11232, 11264, 11296, 1344, 11328, 11360, 11392, 11424, 1344, 11456, - 1344, 11488, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 7808, 4672, 10240, 1792, 1792, 1792, 1792, - 11520, 11552, 11584, 11616, 4704, 11648, 1792, 11680, 11712, 11744, - 1792, 1792, 1344, 11776, 11808, 6816, 11840, 11872, 11904, 11936, 11968, - 1792, 12000, 12032, 1344, 12064, 12096, 12128, 12160, 12192, 1792, - 1792, 1344, 1344, 12224, 1792, 12256, 12288, 12320, 12352, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 12384, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 12416, - 12448, 12480, 12512, 5216, 12544, 12576, 12608, 12640, 12672, 12704, - 12736, 5216, 12768, 12800, 12832, 12864, 12896, 1792, 1792, 12928, - 12960, 12992, 13024, 13056, 2336, 13088, 13120, 1792, 1792, 1792, 1792, - 1344, 13152, 13184, 1792, 1344, 13216, 13248, 1792, 1792, 1792, 1792, - 1792, 1344, 13280, 13312, 1792, 1344, 13344, 13376, 13408, 1344, 13440, - 13472, 1792, 13504, 13536, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 13568, 13600, 13632, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 13664, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 13696, 13728, 13760, - 13792, 13824, 13856, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 9952, 1792, - 1792, 1792, 10816, 10816, 10816, 13888, 1344, 1344, 1344, 1344, 1344, - 1344, 13920, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 13952, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 13984, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 13664, 4704, 14016, 1792, 1792, 10176, 14048, 1344, - 14080, 14112, 14144, 14176, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 14208, - 14240, 14272, 1792, 1792, 14304, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 14336, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 14368, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 14400, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 14432, 14464, 14496, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 4896, 4896, - 4896, 4896, 4896, 4896, 4896, 8032, 4896, 14528, 4896, 14560, 14592, - 14624, 4896, 14656, 4896, 4896, 14688, 1792, 1792, 1792, 1792, 1792, - 4896, 4896, 14720, 14752, 1792, 1792, 1792, 1792, 14784, 14816, 14848, - 14880, 14912, 14944, 14976, 15008, 15040, 15072, 15104, 15136, 15168, - 14784, 14816, 15200, 14880, 15232, 15264, 15296, 15008, 15328, 15360, - 15392, 15424, 15456, 15488, 15520, 15552, 15584, 15616, 15648, 4896, - 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 4896, 704, 15680, 704, 15712, 15744, 15776, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 15808, 15840, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, - 1344, 1344, 1344, 15872, 1792, 15904, 15936, 15968, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 16000, - 16032, 16064, 16096, 16128, 16160, 1792, 16192, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 4896, 16224, 4896, 4896, 8000, 16256, 16288, - 8032, 16320, 16352, 4896, 16224, 4896, 16384, 1792, 16416, 16448, 16480, - 16512, 1792, 1792, 1792, 1792, 1792, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 16544, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 16576, 16608, 4896, 4896, 4896, 8000, 4896, 4896, 16640, - 1792, 16224, 4896, 16672, 4896, 16704, 16736, 1792, 1792, 16768, 16800, - 16832, 1792, 16864, 1792, 10912, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, + ,10688, 10720, 10752, 1824, 1344, 1344, 1344, 8352, 10784, 10816, 10848, + 10880, 10912, 10944, 10976, 11008, 1824, 1824, 1824, 1824, 9280, 1344, + 11040, 11072, 1344, 11104, 11136, 11168, 11200, 1344, 11232, 1824, + 11264, 11296, 11328, 1344, 11360, 11392, 11424, 11456, 1344, 11488, + 1344, 11520, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 7840, 4704, 10272, 1824, 1824, 1824, 1824, + 11552, 11584, 11616, 11648, 4736, 11680, 1824, 11712, 11744, 11776, + 1824, 1824, 1344, 11808, 11840, 6848, 11872, 11904, 11936, 11968, 12000, + 1824, 12032, 12064, 1344, 12096, 12128, 12160, 12192, 12224, 1824, + 1824, 1344, 1344, 12256, 1824, 12288, 12320, 12352, 12384, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 12416, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 12448, + 12480, 12512, 12544, 5248, 12576, 12608, 12640, 12672, 12704, 12736, + 12768, 5248, 12800, 12832, 12864, 12896, 12928, 1824, 1824, 12960, + 12992, 13024, 13056, 13088, 2368, 13120, 13152, 1824, 1824, 1824, 1824, + 1344, 13184, 13216, 1824, 1344, 13248, 13280, 1824, 1824, 1824, 1824, + 1824, 1344, 13312, 13344, 1824, 1344, 13376, 13408, 13440, 1344, 13472, + 13504, 1824, 13536, 13568, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 13600, 13632, 13664, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 13696, 13728, 13760, 1344, 13792, 13824, 1344, + 13856, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 13888, 13920, + 13952, 13984, 14016, 14048, 1824, 1824, 14080, 14112, 14144, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 9984, 1824, 1824, 1824, 10848, 10848, 10848, 14176, 1344, 1344, 1344, + 1344, 1344, 1344, 14208, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 14240, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 14272, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 13856, 4736, 14304, 1824, 1824, 10208, + 14336, 1344, 14368, 14400, 14432, 14464, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, + 14496, 14528, 14560, 1824, 1824, 14592, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 14624, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 14656, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 4736, 1824, 1824, 10208, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 9856, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 14688, 14720, + 14752, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 4928, 4928, 4928, 4928, 4928, 4928, 4928, 8064, 4928, 14784, 4928, + 14816, 14848, 14880, 4928, 14912, 4928, 4928, 14944, 1824, 1824, 1824, + 1824, 1824, 4928, 4928, 14976, 15008, 1824, 1824, 1824, 1824, 15040, + 15072, 15104, 15136, 15168, 15200, 15232, 15264, 15296, 15328, 15360, + 15392, 15424, 15040, 15072, 15456, 15136, 15488, 15520, 15552, 15264, + 15584, 15616, 15648, 15680, 15712, 15744, 15776, 15808, 15840, 15872, + 15904, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 704, 15936, 704, 15968, 16000, + 16032, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 16064, 16096, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1344, 1344, 1344, 1344, 1344, 1344, 16128, 1824, 16160, 16192, + 16224, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 16256, 16288, 16320, 16352, 16384, 16416, 1824, 16448, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 4928, 16480, 4928, + 4928, 8032, 16512, 16544, 8064, 16576, 16608, 4928, 16480, 4928, 16640, + 1824, 16672, 16704, 16736, 16768, 16800, 1824, 1824, 1824, 1824, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 16832, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 16864, 16896, 4928, 4928, 4928, + 8032, 4928, 4928, 16864, 1824, 16480, 4928, 16928, 4928, 16960, 16992, + 1824, 1824, 16480, 8416, 17024, 17056, 17088, 1824, 17120, 6784, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -479,10 +483,10 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 7840, 1824, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 7808, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -490,11 +494,10 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 17152, 1344, 1344, 1344, 1344, 1344, 1344, 11360, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 16896, 1344, 1344, - 1344, 1344, 1344, 1344, 11328, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -506,39 +509,36 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 17184, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 14400, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 11328 + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 17216, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 11360 #endif /* TCL_UTF_MAX > 3 */ }; @@ -652,72 +652,74 @@ static const unsigned char groupMap[] = { 92, 92, 91, 92, 92, 92, 91, 92, 92, 92, 92, 92, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, - 92, 92, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 17, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 0, 0, 3, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 17, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 124, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, 15, 124, 124, 124, 92, 92, - 92, 92, 92, 92, 92, 92, 124, 124, 124, 124, 92, 124, 124, 15, 92, 92, - 92, 92, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, - 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 91, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 0, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, + 124, 92, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, + 124, 124, 92, 124, 124, 15, 92, 92, 92, 92, 92, 92, 92, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 92, 92, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 3, 91, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 0, 0, 0, + 15, 15, 15, 15, 0, 0, 92, 15, 124, 124, 124, 92, 92, 92, 92, 0, 0, + 124, 124, 0, 0, 124, 124, 92, 15, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, + 0, 0, 15, 15, 0, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 15, 15, 4, 4, 18, 18, 18, 18, 18, 18, 14, 4, 15, 3, 0, 0, 0, + 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 15, 15, 0, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, + 0, 15, 15, 0, 0, 92, 0, 124, 124, 124, 92, 92, 0, 0, 0, 0, 92, 92, + 0, 0, 92, 92, 92, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 0, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, 92, 15, + 15, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 124, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, + 92, 15, 124, 124, 124, 92, 92, 92, 92, 92, 0, 92, 92, 124, 0, 124, + 124, 92, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, + 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 4, 0, 0, 0, 0, 0, + 0, 0, 15, 92, 92, 92, 92, 92, 92, 0, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 15, 15, 15, 15, 15, 0, 15, 0, 0, 0, 15, 15, 15, 15, 0, 0, 92, 15, 124, - 124, 124, 92, 92, 92, 92, 0, 0, 124, 124, 0, 0, 124, 124, 92, 15, 0, - 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 15, 15, 0, 15, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 15, 4, 4, 18, 18, 18, 18, 18, - 18, 14, 4, 0, 0, 0, 0, 0, 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 0, - 0, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 0, 15, 15, 0, 15, 15, 0, 0, 92, 0, 124, 124, 124, - 92, 92, 0, 0, 0, 0, 92, 92, 0, 0, 92, 92, 92, 0, 0, 0, 92, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 0, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 92, 92, 15, 15, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 124, 124, 92, 92, 92, 92, - 92, 0, 92, 92, 124, 0, 124, 124, 92, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 3, 4, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 92, 124, - 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, - 15, 15, 0, 0, 92, 15, 124, 92, 124, 92, 92, 92, 92, 0, 0, 124, 124, - 0, 0, 124, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, 92, 124, 0, 0, 0, 0, 15, - 15, 0, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 14, - 15, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 0, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 15, 15, 0, 15, 15, 15, 15, 0, - 0, 0, 15, 15, 0, 15, 0, 15, 15, 0, 0, 0, 15, 15, 0, 0, 0, 15, 15, 15, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, - 124, 124, 92, 124, 124, 0, 0, 0, 124, 124, 124, 0, 124, 124, 124, 92, - 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 14, 14, 14, 14, 14, - 14, 4, 14, 0, 0, 0, 0, 0, 92, 124, 124, 124, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 92, - 92, 92, 124, 124, 124, 124, 0, 92, 92, 92, 0, 92, 92, 92, 92, 0, 0, - 0, 0, 0, 0, 0, 92, 92, 0, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, - 18, 18, 18, 18, 18, 14, 15, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 92, - 124, 124, 124, 124, 124, 0, 92, 124, 124, 0, 124, 124, 92, 92, 0, 0, - 0, 0, 0, 0, 0, 124, 124, 0, 0, 0, 0, 0, 0, 0, 15, 0, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, + 124, 92, 124, 92, 92, 92, 92, 0, 0, 124, 124, 0, 0, 124, 124, 92, 0, + 0, 0, 0, 0, 0, 0, 0, 92, 124, 0, 0, 0, 0, 15, 15, 0, 15, 15, 15, 92, + 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 14, 15, 18, 18, 18, 18, 18, + 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 0, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 15, 15, 15, 0, 15, 15, 15, 15, 0, 0, 0, 15, 15, 0, 15, 0, + 15, 15, 0, 0, 0, 15, 15, 0, 0, 0, 15, 15, 15, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 124, 124, 92, 124, + 124, 0, 0, 0, 124, 124, 124, 0, 124, 124, 124, 92, 0, 0, 15, 0, 0, + 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 14, 14, 14, 14, 14, 14, 4, 14, 0, + 0, 0, 0, 0, 92, 124, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 92, 92, 92, 124, + 124, 124, 124, 0, 92, 92, 92, 0, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, + 0, 92, 92, 0, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 92, 92, 0, 0, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 14, 15, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 92, 124, + 124, 124, 124, 124, 0, 92, 124, 124, 0, 124, 124, 92, 92, 0, 0, 0, + 0, 0, 0, 0, 124, 124, 0, 0, 0, 0, 0, 0, 0, 15, 0, 15, 15, 92, 92, 0, + 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 124, 124, 124, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 15, 124, 124, 124, 92, 92, 92, 92, 0, 124, 124, 124, 0, 124, 124, 124, 92, 15, 14, 0, 0, 0, 0, 15, 15, 15, 124, 18, 18, 18, 18, 18, 18, 18, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, @@ -857,7 +859,7 @@ static const unsigned char groupMap[] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 3, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 92, 92, 15, 15, 15, 15, 92, 15, 15, 15, 15, - 124, 124, 92, 15, 15, 0, 92, 92, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, + 124, 124, 92, 15, 15, 124, 92, 92, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, @@ -868,9 +870,9 @@ static const unsigned char groupMap[] = { 21, 21, 137, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 21, 21, 21, 21, 21, 138, 21, 21, 139, 21, 140, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, + 92, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, + 23, 24, 23, 24, 23, 24, 21, 21, 21, 21, 21, 138, 21, 21, 139, 21, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 0, 0, 141, 141, 141, 141, 141, 141, 0, 0, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, @@ -897,7 +899,7 @@ static const unsigned char groupMap[] = { 18, 18, 7, 7, 7, 5, 6, 91, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 7, 7, 7, 5, 6, 0, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 119, 119, 119, 119, 92, 119, 119, 119, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, @@ -930,7 +932,7 @@ static const unsigned char groupMap[] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, @@ -971,9 +973,9 @@ static const unsigned char groupMap[] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 0, 123, 123, 123, 123, @@ -996,7 +998,7 @@ static const unsigned char groupMap[] = { 0, 3, 3, 16, 20, 16, 20, 3, 3, 3, 16, 20, 3, 16, 20, 3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 3, 3, 8, 3, 16, 20, 3, 3, 16, 20, 5, 6, 5, 6, 5, 6, 5, 6, 3, 3, 3, 3, 3, 91, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 8, 3, 3, - 3, 3, 8, 3, 5, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 3, 8, 3, 5, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, @@ -1014,7 +1016,7 @@ static const unsigned char groupMap[] = { 15, 15, 15, 15, 15, 3, 91, 91, 91, 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 14, 14, 18, 18, 18, 18, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, @@ -1173,245 +1175,269 @@ static const unsigned char groupMap[] = { 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 18, 18, 18, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 127, 15, 15, 15, 15, 15, 15, 15, - 15, 127, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 127, 15, 15, 15, 15, 15, 15, + 15, 15, 127, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, 0, 0, 0, - 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 3, 15, 15, - 15, 15, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 3, 127, 127, 127, - 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 3, 15, 15, 15, 15, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 3, 127, + 127, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, + 194, 194, 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 195, 195, 195, 195, 195, 195, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 194, 194, 194, + 15, 15, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, + 194, 194, 194, 194, 194, 194, 194, 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, - 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, 15, - 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 0, 3, 18, 18, 18, 18, 18, 18, 18, 18, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 14, 14, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, - 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 18, 18, 18, 18, 18, 18, 0, 0, 0, 3, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 3, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 0, 0, 0, 18, 18, 15, 15, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 15, 92, 92, 92, 0, 92, 92, 0, 0, 0, 0, 0, 92, - 92, 92, 92, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 0, 0, 0, 0, 92, 92, 92, 0, 0, 0, 0, 92, 18, 18, 18, - 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 18, 18, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 92, 92, 0, 0, 0, 0, 18, 18, 18, 18, 18, 3, 3, 3, - 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, - 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 15, + 195, 195, 195, 195, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, + 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, + 0, 0, 0, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 3, 18, 18, 18, 18, 18, + 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 18, 18, 18, 18, 18, 18, + 18, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, + 0, 0, 18, 18, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 3, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 18, 18, 15, 15, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 15, 92, 92, 92, 0, 92, 92, + 0, 0, 0, 0, 0, 92, 92, 92, 92, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 92, 92, 92, 0, 0, 0, + 0, 92, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 18, 18, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 0, 0, 0, 0, 18, 18, 18, + 18, 18, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 18, 18, + 18, 18, 18, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 0, 0, 0, - 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 0, 124, 92, 124, 15, 15, 15, 15, 15, 15, 15, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 124, 92, 124, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, + 3, 3, 3, 3, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, + 92, 124, 124, 92, 92, 3, 3, 17, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, 3, 3, 3, 3, 0, 0, - 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 124, 124, 92, - 92, 3, 3, 17, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 92, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, - 92, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 15, 92, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 15, 15, 15, 15, 3, 3, + 3, 3, 3, 92, 92, 92, 3, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 3, + 15, 3, 3, 3, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 3, 3, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 124, 124, + 92, 124, 92, 92, 3, 3, 3, 3, 3, 3, 92, 0, 15, 15, 15, 15, 15, 15, 15, + 0, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 3, 0, + 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 124, 124, 0, 0, 124, + 124, 0, 0, 124, 124, 124, 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, + 0, 0, 15, 15, 15, 15, 15, 124, 124, 0, 0, 92, 92, 92, 92, 92, 92, 92, + 0, 0, 0, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, + 92, 92, 124, 92, 15, 15, 15, 15, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 0, 3, 0, 3, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 124, + 92, 124, 124, 124, 124, 92, 92, 124, 92, 92, 15, 15, 3, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, + 92, 92, 92, 92, 0, 0, 124, 124, 124, 124, 92, 92, 124, 92, 92, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 15, + 15, 15, 15, 92, 92, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, + 124, 124, 92, 124, 92, 92, 3, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, + 124, 124, 92, 92, 92, 92, 92, 92, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 124, 124, 15, 15, 15, 15, 3, 3, 3, 3, 3, 92, 92, - 92, 3, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 3, 15, 3, 3, 3, 0, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 124, 124, 124, 92, 92, 92, 124, 124, 92, 124, 92, 92, 3, - 3, 3, 3, 3, 3, 92, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 0, 15, 15, - 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 3, 0, 0, 0, 0, 0, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 124, - 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 92, 124, 124, 124, 124, 0, 0, 124, 124, 0, 0, 124, - 124, 124, 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 15, 15, 15, - 15, 15, 124, 124, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 92, 92, - 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, - 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, 92, 92, 124, 92, - 15, 15, 15, 15, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 3, - 0, 3, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 124, 92, 124, 124, 124, - 124, 92, 92, 124, 92, 92, 15, 15, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, - 0, 0, 124, 124, 124, 124, 92, 92, 124, 92, 92, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 92, - 92, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, 124, - 92, 92, 3, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, 124, 124, 92, 92, - 92, 92, 92, 92, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 92, 92, 92, 124, - 124, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 0, 0, 0, 0, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 18, 18, 3, 3, 3, 14, 10, 10, 10, 10, 10, 10, 10, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 92, 92, 92, 124, 124, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, + 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 3, 3, 3, 14, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 92, 92, 92, 92, 92, 92, 124, 124, 92, 92, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 92, 92, 92, 92, 92, 92, 124, 15, 92, 92, 92, 92, 3, + 3, 3, 3, 3, 3, 3, 3, 92, 0, 0, 0, 0, 0, 0, 0, 0, 15, 92, 92, 92, 92, + 92, 92, 124, 124, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 15, 15, 15, 15, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 124, 92, 92, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 124, 92, 92, 92, 92, 92, 92, 92, 0, 124, - 124, 124, 124, 92, 92, 124, 92, 15, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, + 15, 15, 15, 15, 15, 15, 15, 124, 92, 92, 92, 92, 92, 92, 92, 0, 92, + 92, 92, 92, 92, 92, 124, 92, 15, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 124, 92, 92, 92, 92, 92, 92, 92, 124, 92, 92, 124, 92, 92, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 92, 92, 92, 92, 92, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, - 92, 92, 92, 92, 3, 3, 3, 3, 3, 14, 14, 14, 14, 91, 91, 91, 91, 3, 14, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 18, - 18, 18, 18, 18, 18, 18, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 124, 124, 124, 124, 124, 124, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 92, 92, 92, 92, 92, 92, 0, 0, 0, 92, 0, 92, 92, 0, 92, + 92, 92, 92, 92, 92, 92, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 0, 3, 3, 3, 3, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 0, 0, 92, 92, 92, 92, 92, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, 3, 3, 14, 14, 14, 14, 91, 91, + 91, 91, 3, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 0, 18, 18, 18, 18, 18, 18, 18, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, - 14, 92, 92, 3, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, - 14, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 124, 124, 92, - 92, 92, 14, 14, 14, 124, 124, 124, 124, 124, 124, 17, 17, 17, 17, 17, - 17, 17, 17, 92, 92, 92, 92, 92, 92, 92, 92, 14, 14, 92, 92, 92, 92, - 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, - 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 92, 92, - 92, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107, 107, 107, + 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 14, 92, 92, 3, 17, + 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 124, 124, 92, 92, 92, 14, 14, 14, + 124, 124, 124, 124, 124, 124, 17, 17, 17, 17, 17, 17, 17, 17, 92, 92, + 92, 92, 92, 92, 92, 92, 14, 14, 92, 92, 92, 92, 92, 92, 92, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, 92, 92, 92, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 92, 92, 92, 14, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, + 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 0, 107, 107, 0, 0, 107, + 0, 0, 107, 107, 0, 0, 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, + 107, 107, 107, 21, 21, 21, 21, 0, 21, 0, 21, 21, 21, 21, 21, 21, 21, + 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 0, 107, 107, 107, 107, + 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, 107, 107, 0, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 107, + 107, 107, 107, 107, 0, 107, 0, 0, 0, 107, 107, 107, 107, 107, 107, + 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, - 21, 21, 21, 21, 21, 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, + 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 0, - 107, 107, 0, 0, 107, 0, 0, 107, 107, 0, 0, 107, 107, 107, 107, 0, 107, - 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 0, 21, 0, 21, 21, - 21, 21, 21, 21, 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 0, - 107, 107, 107, 107, 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, - 107, 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, - 107, 107, 0, 107, 107, 107, 107, 107, 0, 107, 0, 0, 0, 107, 107, 107, - 107, 107, 107, 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, + 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 0, 0, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, + 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 0, 0, 107, + 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -1419,89 +1445,81 @@ static const unsigned char groupMap[] = { 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, - 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, - 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 21, 0, 0, 9, 9, 9, 9, 9, 9, + 21, 21, 21, 21, 21, 21, 107, 21, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 14, 14, 14, 14, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, - 14, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, - 14, 14, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, - 92, 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 92, - 92, 0, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 92, 92, 14, 14, 14, 14, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 92, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, 14, 14, 3, + 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, + 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, + 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 92, 92, 0, 92, + 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, + 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 92, - 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 0, 0, 0, 0, 3, 3, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 0, 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 0, 15, 0, 15, 0, 15, 0, 15, 15, 15, 0, 15, 15, 0, 15, 0, 0, - 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 15, 0, 15, 0, 0, 15, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, - 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, - 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 92, 92, 92, 92, 92, + 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, + 3, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, + 15, 0, 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 15, + 0, 15, 0, 15, 0, 15, 15, 15, 0, 15, 15, 0, 15, 0, 0, 15, 0, 15, 0, + 15, 0, 15, 0, 15, 0, 15, 15, 0, 15, 0, 0, 15, 15, 15, 15, 0, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 0, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, + 15, 0, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, - 0, 0, 0, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 11, 11, 11, 11, 11, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 14, + 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 11, 11, 11, 11, 11, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, - 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, - 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, + 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, + 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 #endif /* TCL_UTF_MAX > 3 */ }; -- cgit v0.12 From cf0cf6ad90055ae80f8ed7ec6b87d145d31cfcff Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 May 2017 16:00:29 +0000 Subject: [19a8c9399d] Plug mem leak in TIP 459 machinery. --- generic/tclPkg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 9ad3cb7..3b0554a 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -224,6 +224,7 @@ static void PkgFilesCleanupProc(ClientData clientData, entry = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&pkgFiles->table); + ckfree(pkgFiles); return; } -- cgit v0.12 From 5badb6535fd037244cae95a25e9790c7dae3c7c8 Mon Sep 17 00:00:00 2001 From: griffin Date: Sat, 27 May 2017 22:17:21 +0000 Subject: Implement proposed 0d decimal radix prefix to compliment 0x,0b,0o. --- doc/GetInt.3 | 7 +++++-- doc/expr.n | 2 +- generic/tclStrToD.c | 16 +++++++++++++++- tests/cmdIL.test | 4 ++-- tests/util.test | 18 ++++++++++++++++++ 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/doc/GetInt.3 b/doc/GetInt.3 index 5a3304a..8d7a4d0 100644 --- a/doc/GetInt.3 +++ b/doc/GetInt.3 @@ -56,6 +56,9 @@ followed by white space. If the first two characters of \fIsrc\fR after the optional white space and sign are .QW \fB0x\fR then \fIsrc\fR is expected to be in hexadecimal form; otherwise, +if the first such characters are +.QW \fB0d\fR +then \fIsrc\fR is expected to be in decimal form; otherwise, if the first such characters are .QW \fB0o\fR then \fIsrc\fR is expected to be in octal form; otherwise, @@ -65,8 +68,8 @@ then \fIsrc\fR is expected to be in binary form; otherwise, if the first such character is .QW \fB0\fR then \fIsrc\fR -is expected to be in octal form; otherwise, \fIsrc\fR is -expected to be in decimal form. +is expected to be in octal form; otherwise, \fIsrc\fR +is expected to be in decimal form. .PP \fBTcl_GetDouble\fR expects \fIsrc\fR to consist of a floating-point number, which is: white space; a sign; a sequence of digits; a diff --git a/doc/expr.n b/doc/expr.n index cbb2395..3cd6d16 100644 --- a/doc/expr.n +++ b/doc/expr.n @@ -46,7 +46,7 @@ value is the form produced by the \fB%g\fR format specifier of Tcl's An expression consists of a combination of operands, operators, parentheses and commas, possibly with whitespace between any of these elements, which is ignored. -An integer operand may be specified in decimal, binary +An integer operand may be specified in decimal (the optional first two characters are \fB0d\fR), binary (the first two characters are \fB0b\fR), octal (the first two characters are \fB0o\fR), or hexadecimal (the first two characters are \fB0x\fR) form. For diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index c7fdc5a..cbdc3a0 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -482,7 +482,7 @@ TclParseNumber( { enum State { INITIAL, SIGNUM, ZERO, ZERO_X, - ZERO_O, ZERO_B, BINARY, + ZERO_O, ZERO_B, ZERO_D, BINARY, HEXADECIMAL, OCTAL, BAD_OCTAL, DECIMAL, LEADING_RADIX_POINT, FRACTION, EXPONENT_START, EXPONENT_SIGNUM, EXPONENT, @@ -664,6 +664,10 @@ TclParseNumber( state = ZERO_O; break; } + if (c == 'd' || c == 'D') { + state = ZERO_D; + break; + } #ifdef TCL_NO_DEPRECATED goto decimal; #endif @@ -880,6 +884,16 @@ TclParseNumber( state = BINARY; break; + case ZERO_D: + if (c == '0') { + numTrailZeros++; + } else if ( ! isdigit(UCHAR(c))) { + goto endgame; + } + state = DECIMAL; + flags |= TCL_PARSE_INTEGER_ONLY; + /* FALLTHROUGH */ + case DECIMAL: /* * Scanned an optional + or - followed by a string of decimal diff --git a/tests/cmdIL.test b/tests/cmdIL.test index 23a5f96..70ac6bb 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -219,8 +219,8 @@ test cmdIL-3.10 {SortCompare procedure, -integer option} -body { lsort -integer {3 q} } -returnCodes error -result {expected integer but got "q"} test cmdIL-3.11 {SortCompare procedure, -integer option} { - lsort -integer {35 21 0x20 30 0o23 100 8} -} {8 0o23 21 30 0x20 35 100} + lsort -integer {35 21 0x20 0d30 0o23 100 8} +} {8 0o23 21 0d30 0x20 35 100} test cmdIL-3.12 {SortCompare procedure, -real option} -body { lsort -real {6...4 3} } -returnCodes error -result {expected floating-point number but got "6...4"} diff --git a/tests/util.test b/tests/util.test index 22d120b..35fc642 100644 --- a/tests/util.test +++ b/tests/util.test @@ -553,6 +553,12 @@ test util-9.0.6 {TclGetIntForIndex} { test util-9.0.7 {TclGetIntForIndex} { string index abcd { 01 } } b +test util-9.0.8 {TclGetIntForIndex} { + string index abcd { 0d0 } +} a +test util-9.0.9 {TclGetIntForIndex} { + string index abcd { -0d0 } +} a test util-9.1.0 {TclGetIntForIndex} { string index abcd 3 } d @@ -565,6 +571,12 @@ test util-9.1.2 {TclGetIntForIndex} { test util-9.1.3 {TclGetIntForIndex} { string index abcdefghijk { 0xa } } k +test util-9.1.4 {TclGetIntForIndex} { + string index abcdefghijk 0d10 +} k +test util-9.1.5 {TclGetIntForIndex} { + string index abcdefghijk { 0d10 } +} k test util-9.2.0 {TclGetIntForIndex} { string index abcd end } d @@ -672,12 +684,18 @@ test util-9.30 {TclGetIntForIndex} -body { test util-9.31 {TclGetIntForIndex} -body { string index a 0x } -returnCodes error -match glob -result * +test util-9.31.1 {TclGetIntForIndex} -body { + string index a 0d +} -returnCodes error -match glob -result * test util-9.32 {TclGetIntForIndex} -body { string index a 0x1FFFFFFFF+0 } -returnCodes error -match glob -result * test util-9.33 {TclGetIntForIndex} -body { string index a 100000000000+0 } -returnCodes error -match glob -result * +test util-9.33.1 {TclGetIntForIndex} -body { + string index a 0d100000000000+0 +} -returnCodes error -match glob -result * test util-9.34 {TclGetIntForIndex} -body { string index a 1.0 } -returnCodes error -match glob -result * -- cgit v0.12 From 919fc5759927c4b114ccc7771b7bcf6193fb5b42 Mon Sep 17 00:00:00 2001 From: griffin Date: Sun, 28 May 2017 16:06:29 +0000 Subject: 0d in LinkVar --- generic/tclLink.c | 4 ++-- tests/link.test | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/generic/tclLink.c b/generic/tclLink.c index a39dfcd..7366acc 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -692,7 +692,7 @@ SetInvalidRealFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { /* * This function checks for integer representations, which are valid * when linking with C variables, but which are invalid in other - * contexts in Tcl. Handled are "+", "-", "", "0x", "0b" and "0o" + * contexts in Tcl. Handled are "+", "-", "", "0x", "0b", "0d" and "0o" * (upperand lowercase). See bug [39f6304c2e]. */ int @@ -701,7 +701,7 @@ GetInvalidIntFromObj(Tcl_Obj *objPtr, int *intPtr) const char *str = TclGetString(objPtr); if ((objPtr->length == 0) || - ((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) { + ((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoOdD", str[1]))) { *intPtr = 0; return TCL_OK; } else if ((objPtr->length == 1) && strchr("+-", str[0])) { diff --git a/tests/link.test b/tests/link.test index 6bff356..a12759d 100644 --- a/tests/link.test +++ b/tests/link.test @@ -173,6 +173,27 @@ test link-2.9 {writing C variables from Tcl} -constraints {testlink} -setup { set uwide 0 concat [testlink get] | $int $real $bool $string $wide $char $uchar $short $ushort $uint $long $ulong $float $uwide } -result {0 5000.0 0 0 0 0 0 0 0 0 0 0 -60.0 0 | 0 5000e 0 0 0 0 0 0 0 0 0 0 -60.00e+ 0} +test link-2.10 {writing C variables from Tcl} -constraints {testlink} -setup { + testlink delete +} -body { + testlink set 43 1.21 4 - 56785678 64 250 30000 60000 0xbaadbeef 12321 32123 3.25 1231231234 + testlink create 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + set int "0x" + set real "0b" + set bool 0 + set string "0" + set wide "0D" + set char "0X" + set uchar "0B" + set short "0D" + set ushort "0x" + set uint "0b" + set long "0d" + set ulong "0X" + set float "0B" + set uwide "0D" + concat [testlink get] | $int $real $bool $string $wide $char $uchar $short $ushort $uint $long $ulong $float $uwide +} -result {0 0.0 0 0 0 0 0 0 0 0 0 0 0.0 0 | 0x 0b 0 0 0D 0X 0B 0D 0x 0b 0d 0X 0B 0D} test link-3.1 {read-only variables} -constraints {testlink} -setup { testlink delete -- cgit v0.12 From ece8767c5cb0fc27a64b43df3c4558f14d3f5408 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 30 May 2017 08:46:12 +0000 Subject: small code review: resolves several warning on some compilers --- generic/tclClock.c | 6 +++--- generic/tclClockFmt.c | 8 ++++---- generic/tclDate.h | 2 +- generic/tclStrIdxTree.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index c980a27..0895bbb 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -606,7 +606,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) if (opts->localeObj == NULL) { Tcl_SetResult(opts->interp, - "locale not specified and no default locale set", TCL_STATIC); + (char*)"locale not specified and no default locale set", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badOption", NULL); return NULL; } @@ -3080,7 +3080,7 @@ ClockParseFmtScnArgs( if ((saw & (1 << CLC_ARGS_GMT)) && (saw & (1 << CLC_ARGS_TIMEZONE))) { - Tcl_SetResult(interp, "cannot use -gmt and -timezone in same call", TCL_STATIC); + Tcl_SetResult(interp, (char*)"cannot use -gmt and -timezone in same call", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } @@ -3335,7 +3335,7 @@ ClockScanObjCmd( /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { Tcl_SetResult(interp, - "legacy [clock scan] does not support -locale", TCL_STATIC); + (char*)"legacy [clock scan] does not support -locale", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index d923ede..0ec8817 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -607,7 +607,7 @@ static void ClockFmtObj_UpdateString(objPtr) Tcl_Obj *objPtr; { - char *name = "UNKNOWN"; + const char *name = "UNKNOWN"; int len; ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); @@ -1450,7 +1450,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, val = 7; } if (val > 7) { - Tcl_SetResult(opts->interp, "day of week is greater than 7", + Tcl_SetResult(opts->interp, (char*)"day of week is greater than 7", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); return TCL_ERROR; @@ -2400,14 +2400,14 @@ ClockScan( overflow: - Tcl_SetResult(opts->interp, "requested date too large to represent", + Tcl_SetResult(opts->interp, (char*)"requested date too large to represent", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); goto done; not_match: - Tcl_SetResult(opts->interp, "input string does not match supplied format", + Tcl_SetResult(opts->interp, (char*)"input string does not match supplied format", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); diff --git a/generic/tclDate.h b/generic/tclDate.h index e614f9d..abc231b 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -370,7 +370,7 @@ typedef struct ClockScanTokenMap { unsigned short int maxSize; unsigned short int offs; ClockScanTokenProc *parser; - void *data; + const void *data; } ClockScanTokenMap; typedef struct ClockScanToken { diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 291e481..0045ea5 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -469,7 +469,7 @@ TclStrIdxTreeTestObjCmd( int optionIndex; if (objc < 2) { - Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], options, @@ -481,7 +481,7 @@ TclStrIdxTreeTestObjCmd( switch (optionIndex) { case O_FINDEQUAL: if (objc < 4) { - Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); return TCL_ERROR; } cs = TclGetString(objv[2]); -- cgit v0.12 From 777941e35bfc3de3b0ec36322ddbd9953169ad2f Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 30 May 2017 16:41:48 +0000 Subject: [msgcat] revert changes of "msgcat" to previous state before clock-speedup, move this functionality to "clock.tcl"; additionally avoids the usage of catch (uses pair "dict exists/dict get" instead of). --- library/clock.tcl | 98 +++++++++++++++++++++++++++++++++--- library/msgcat/msgcat.tcl | 125 ++-------------------------------------------- tests/msgcat.test | 2 +- 3 files changed, 98 insertions(+), 127 deletions(-) diff --git a/library/clock.tcl b/library/clock.tcl index 94d2341..1f3c669 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -506,18 +506,103 @@ proc ::tcl::clock::Initialize {} { variable FormatProc; # Array mapping format group # and locale to the name of a procedure # that renders the given format + + variable mcLocales [dict create]; # Dictionary with loaded locales + variable mcMergedCat [dict create]; # Dictionary with merged locale catalogs } ::tcl::clock::Initialize #---------------------------------------------------------------------- -proc mcget {locale args} { - switch -- $locale system { - set locale [GetSystemLocale] +# mcget -- +# +# Return the merged translation catalog for the ::tcl::clock namespace +# Searching of catalog is similar to "msgcat::mc". +# +# Contrary to "msgcat::mc" may additionally load a package catalog +# on demand. +# +# Arguments: +# loc The locale used for translation. +# +# Results: +# Returns the dictionary object as whole catalog of the package/locale. +# +proc mcget {loc} { + variable mcMergedCat + switch -- $loc system { + set loc [GetSystemLocale] } current { - set locale [mclocale] + set loc [mclocale] + } + if {$loc eq {C}} { + set loclist [msgcat::PackagePreferences ::tcl::clock] + set loc [lindex $loclist 0] + } else { + set loc [string tolower $loc] + } + + # try to retrieve now if already available: + if {[dict exists $mcMergedCat $loc]} { + set mrgcat [dict get $mcMergedCat $loc] + return [dict smartref $mrgcat] + } + + # get locales list for given locale (de_de -> {de_de de {}}) + variable mcLocales + if {[dict exists $mcLocales $loc]} { + set loclist [dict get $mcLocales $loc] + } else { + # save current locale: + set prevloc [mclocale] + # lazy load catalog on demand (set it will load the catalog) + mcpackagelocale set $loc + set loclist [msgcat::GetPreferences $loc] + dict set $mcLocales $loc $loclist + # restore: + if {$prevloc ne $loc} { + mcpackagelocale set $prevloc + } + } + # get whole catalog: + mcMerge $loclist +} + +# mcMerge -- +# +# Merge message catalog dictionaries to one dictionary. +# +# Arguments: +# locales List of locales to merge. +# +# Results: +# Returns the (weak pointer) to merged dictionary of message catalog. +# +proc mcMerge {locales} { + variable mcMergedCat + if {[dict exists $mcMergedCat [set loc [lindex $locales 0]]]} { + set mrgcat [dict get $mcMergedCat $loc] + return [dict smartref $mrgcat] + } + # package msgcat currently does not provide possibility to get whole catalog: + upvar ::msgcat::Msgs Msgs + set ns ::tcl::clock + # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en): + if {[llength $locales] > 1} { + set mrgcat [mcMerge [lrange $locales 1 end]] + if {[dict exists $Msgs $ns $loc]} { + set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] + } + } else { + if {[dict exists $Msgs $ns $loc]} { + set mrgcat [dict get $Msgs $ns $loc] + } else { + set mrgcat [dict create] + } } - msgcat::mcget ::tcl::clock $locale {*}$args + dict set mcMergedCat $loc $mrgcat + # return smart reference (shared dict as object with exact one ref-counter) + return [dict smartref $mrgcat] } #---------------------------------------------------------------------- @@ -2004,13 +2089,14 @@ proc ::tcl::clock::ClearCaches {} { variable FormatProc variable LocaleFormats variable LocaleNumeralCache + variable mcMergedCat variable TimeZoneBad # tell backend - should invalidate: configure -clear # clear msgcat cache: - msgcat::ClearCaches ::tcl::clock + set mcMergedCat [dict create] foreach p [info procs [namespace current]::scanproc'*] { rename $p {} diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index f9f57db..928474d 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -225,65 +225,6 @@ proc msgcat::mc {src args} { } } -# msgcat::mcget -- -# -# Return the translation for the given string based on the given -# locale setting or the whole dictionary object of the package/locale. -# Searching of catalog is similar to "msgcat::mc". -# -# Contrary to "msgcat::mc" may additionally load a package catalog -# on demand. -# -# Arguments: -# ns The package namespace (as catalog selector). -# loc The locale used for translation. -# {src} The string to translate. -# {args} Args to pass to the format command -# -# Results: -# Returns the translated string. Propagates errors thrown by the -# format command. - -proc msgcat::mcget {ns loc args} { - if {$loc eq {C}} { - set loclist [PackagePreferences $ns] - set loc [lindex $loclist 0] - } else { - set loc [string tolower $loc] - variable PackageConfig - # get locales list for given locale (de_de -> {de_de de {}}) - if {[catch { - set loclist [dict get $PackageConfig locales $ns $loc] - }]} { - # lazy load catalog on demand - mcpackagelocale load $loc $ns - set loclist [dict get $PackageConfig locales $ns $loc] - } - } - if {![llength $args]} { - # get whole catalog: - return [msgcat::Merge $ns $loclist] - } - set src [lindex $args 0] - # search translation for each locale (regarding parent namespaces) - for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { - foreach loc $loclist { - set msgs [mcget $nscur $loc] - if {![catch { set val [dict get $msgs $src] }]} { - if {[llength $args] == 1} { - return $val - } - return [format $val {*}[lrange $args 1 end]] - } - } - } - # no translation : - if {[llength $args] == 1} { - return $src - } - return [format $src {*}[lrange $args 1 end]] -} - # msgcat::mcexists -- # # Check if a catalog item is set or if mc would invoke mcunknown. @@ -474,10 +415,6 @@ proc msgcat::mcloadedlocales {subcommand} { # items, if the former locale was the default locale. # Returns the normalized set locale. # The default locale is taken, if locale is not given. -# load -# Load a package locale without set it (lazy loading from mcget). -# Returns the normalized set locale. -# The default locale is taken, if locale is not given. # get # Get the locale valid for this package. # isset @@ -505,7 +442,7 @@ proc msgcat::mcloadedlocales {subcommand} { # Results: # Empty string, if not stated differently for the subcommand -proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { +proc msgcat::mcpackagelocale {subcommand {locale ""}} { # todo: implement using an ensemble variable Loclist variable LoadedLocales @@ -525,9 +462,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { } set locale [string tolower $locale] } - if {$ns eq ""} { - set ns [uplevel 1 {::namespace current}] - } + set ns [uplevel 1 {::namespace current}] switch -exact -- $subcommand { get { return [lindex [PackagePreferences $ns] 0] } @@ -535,7 +470,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { loaded { return [PackageLocales $ns] } present { return [expr {$locale in [PackageLocales $ns]} ]} isset { return [dict exists $PackageConfig loclist $ns] } - set - load { # set a package locale or add a package locale + set { # set a package locale or add a package locale # Copy the default locale if no package locale set so far if {![dict exists $PackageConfig loclist $ns]} { @@ -545,21 +480,17 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { # Check if changed set loclist [dict get $PackageConfig loclist $ns] - if {[llength [info level 0]] == 2 || $locale eq [lindex $loclist 0] } { + if {! [info exists locale] || $locale eq [lindex $loclist 0] } { return [lindex $loclist 0] } # Change loclist set loclist [GetPreferences $locale] set locale [lindex $loclist 0] - if {$subcommand eq {set}} { - # set loclist - dict set PackageConfig loclist $ns $loclist - } + dict set PackageConfig loclist $ns $loclist # load eventual missing locales set loadedLocales [dict get $PackageConfig loadedlocales $ns] - dict set PackageConfig locales $ns $locale $loclist if {$locale in $loadedLocales} { return $locale } set loadLocales [ListComplement $loadedLocales $loclist] dict set PackageConfig loadedlocales $ns\ @@ -590,7 +521,6 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { [dict get $PackageConfig loadedlocales $ns] $LoadedLocales] dict unset PackageConfig loadedlocales $ns dict unset PackageConfig loclist $ns - dict unset PackageConfig locales $ns # unset keys not in global loaded locales if {[dict exists $Msgs $ns]} { @@ -917,47 +847,6 @@ proc msgcat::Load {ns locales {callbackonly 0}} { return $x } -# msgcat::Merge -- -# -# Merge message catalog dictionaries to one dictionary. -# -# Arguments: -# ns Namespace (equal package) to load the message catalog. -# locales List of locales to merge. -# -# Results: -# Returns the merged dictionary of message catalogs. -proc msgcat::Merge {ns locales} { - variable Merged - if {![catch { - set mrgcat [dict get $Merged $ns [set loc [lindex $locales 0]]] - }]} { - return $mrgcat - } - variable Msgs - # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en): - if {[llength $locales] > 1} { - set mrgcat [msgcat::Merge $ns [lrange $locales 1 end]] - catch { - set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] - } - } else { - if {[catch { - set mrgcat [dict get $Msgs $ns $loc] - }]} { - set mrgcat [dict create] - } - } - dict set Merged $ns $loc $mrgcat - # return smart reference (shared dict as object with exact one ref-counter) - return [dict smartref $mrgcat] -} - -proc msgcat::ClearCaches {ns} { - variable Merged - dict unset Merged $ns -} - # msgcat::Invoke -- # # Invoke a set of registered callbacks. @@ -1030,7 +919,6 @@ proc msgcat::Invoke {index arglist {ns ""} {resultname ""} {failerror 0}} { proc msgcat::mcset {locale src {dest ""}} { variable Msgs - variable Merged if {[llength [info level 0]] == 3} { ;# dest not specified set dest $src } @@ -1040,7 +928,6 @@ proc msgcat::mcset {locale src {dest ""}} { set locale [string tolower $locale] dict set Msgs $ns $locale $src $dest - dict unset Merged $ns return $dest } @@ -1080,7 +967,6 @@ proc msgcat::mcflset {src {dest ""}} { proc msgcat::mcmset {locale pairs} { variable Msgs - variable Merged set length [llength $pairs] if {$length % 2} { @@ -1094,7 +980,6 @@ proc msgcat::mcmset {locale pairs} { foreach {src dest} $pairs { dict set Msgs $ns $locale $src $dest } - dict unset Merged $ns return [expr {$length / 2}] } diff --git a/tests/msgcat.test b/tests/msgcat.test index 584e420..1c3ce58 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -811,7 +811,7 @@ namespace eval ::msgcat::test { test msgcat-12.1 {mcpackagelocale no subcommand} -body { mcpackagelocale } -returnCodes 1\ - -result {wrong # args: should be "mcpackagelocale subcommand ?locale? ?ns?"} + -result {wrong # args: should be "mcpackagelocale subcommand ?locale?"} test msgcat-12.2 {mclpackagelocale wrong subcommand} -body { mcpackagelocale junk -- cgit v0.12 From 73b3bf53adc72f6c32efe40bccb4fbff9d0c4aeb Mon Sep 17 00:00:00 2001 From: stu Date: Wed, 31 May 2017 05:39:57 +0000 Subject: Fully remove SunOS-4* from tcl.m4. --- unix/configure | 7 ------- unix/tcl.m4 | 8 ++------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/unix/configure b/unix/configure index dfeb036..bef7c84 100755 --- a/unix/configure +++ b/unix/configure @@ -9971,13 +9971,6 @@ $as_echo "#define USE_FIONBIO 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 $as_echo "FIONBIO" >&6; } ;; - SunOS-4*) - -$as_echo "#define USE_FIONBIO 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 -$as_echo "FIONBIO" >&6; } - ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: O_NONBLOCK" >&5 $as_echo "O_NONBLOCK" >&6; } diff --git a/unix/tcl.m4 b/unix/tcl.m4 index e21cc20..2fc82e5 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -971,8 +971,8 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [ # shared libraries. The value of the symbol defaults to # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If -# dependent libraries should not be specified (as on -# SunOS 4.x, where they cause the link to fail, or in +# dependent libraries should not be specified (as on some +# SunOS systems, where they cause the link to fail, or in # general if Tcl and Tk aren't themselves shared # libraries), then this symbol has an empty string # as its value. @@ -2222,10 +2222,6 @@ AC_DEFUN([SC_BLOCKING_STYLE], [ AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) AC_MSG_RESULT([FIONBIO]) ;; - SunOS-4*) - AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) - AC_MSG_RESULT([FIONBIO]) - ;; *) AC_MSG_RESULT([O_NONBLOCK]) ;; -- cgit v0.12 From c05da96a3570bf04aa35293399fdca615ff2e04e Mon Sep 17 00:00:00 2001 From: stu Date: Wed, 31 May 2017 06:10:46 +0000 Subject: Unbreak on OpenBSD, again. Put back the old SHLIB_VERSION doings. On OpenBSD, Tcl's libs will need the extra version numbers probably forever. There's no point to adding the extra knob. On OpenBSD, the extra version numbers are used for dependency tracking. The extra version numbers must be on linkable libs (code will be linked to them, they have a corresponding .h file). Loadable libs (no code will be linked to them, they don't have a corresponding .h file. Usually a Tcl extension) don't need the burden (OpenBSD has to track the libs' dependencies) of the extra version numbers. Libs that are loadable and linkable are treated as linkable. I hope that clears things up. --- unix/configure | 4 +--- unix/tcl.m4 | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/unix/configure b/unix/configure index bef7c84..a9132b57 100755 --- a/unix/configure +++ b/unix/configure @@ -5085,9 +5085,7 @@ fi PLAT_SRCS="" LDAIX_SRC="" if test "x${SHLIB_VERSION}" = x; then : - SHLIB_VERSION=".1.0" -else - SHLIB_VERSION=".${SHLIB_VERSION}" + SHLIB_VERSION="1.0" fi case $system in AIX-*) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 2fc82e5..45922e0 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1098,7 +1098,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"]) + AS_IF([test "x${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"]) case $system in AIX-*) AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [ -- cgit v0.12 From bbb13bf5770d18267ef18b9fc47a0e198916725d Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 31 May 2017 08:24:42 +0000 Subject: performance of INST_STR_CONCAT1: closes [716b427f76f8f97a8d9a06043903c53bb2b592c2]: minor optimization in simplest cases, fixed performance regression of TclStringCatObjv usage from [fc9ed1e751180816384d569101950c1f8c4582ad], optimizes patterns like "$v[unset v]", "$v[set v {}]" etc. --- generic/tclExecute.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index cfcdd26..2d1c07f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2685,11 +2685,34 @@ TEBCresume( opnd = TclGetUInt1AtPtr(pc+1); + objv = &OBJ_AT_DEPTH(opnd-1); + /* minor optimization in simplest cases */ + switch (opnd) { + case 1: /* only one object */ + objResultPtr = *objv; + goto endINST_STR_CONCAT1; + case 2: /* two objects - check empty */ + if (objv[0]->bytes == &tclEmptyString) { + objResultPtr = objv[1]; + goto endINST_STR_CONCAT1; + } + else + if (objv[1]->bytes == &tclEmptyString) { + objResultPtr = objv[0]; + goto endINST_STR_CONCAT1; + } + break; + case 0: /* no objects - use new empty */ + TclNewObj(objResultPtr); + goto endINST_STR_CONCAT1; + } + /* do concat */ if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - opnd, &OBJ_AT_DEPTH(opnd-1), &objResultPtr)) { + opnd, objv, &objResultPtr)) { TRACE_ERROR(interp); goto gotError; } + endINST_STR_CONCAT1: TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(2, opnd, 1); -- cgit v0.12 From 60c071ed625b30818a7151b4e77272f8fe55edb3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 08:31:10 +0000 Subject: Remove "timerate" functionality: this definitely needs a TIP. Also undo changes in library/reg/pkgIndex.tcl, which are unrelated to clock functionality --- generic/tclBasic.c | 1 - generic/tclCmdMZ.c | 348 +---------------------------------------------- generic/tclInt.h | 3 - library/reg/pkgIndex.tcl | 12 +- 4 files changed, 2 insertions(+), 362 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4d392d0..0486383 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -285,7 +285,6 @@ static const CmdInfo builtInCmds[] = { {"source", Tcl_SourceObjCmd, NULL, TclNRSourceObjCmd, 0}, {"tell", Tcl_TellObjCmd, NULL, NULL, CMD_IS_SAFE}, {"time", Tcl_TimeObjCmd, NULL, NULL, CMD_IS_SAFE}, - {"timerate", Tcl_TimeRateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"unload", Tcl_UnloadObjCmd, NULL, NULL, 0}, {"update", Tcl_UpdateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"vwait", Tcl_VwaitObjCmd, NULL, NULL, CMD_IS_SAFE}, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 8c2c026..885a0bc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -17,7 +17,6 @@ */ #include "tclInt.h" -#include "tclCompile.h" #include "tclRegexp.h" #include "tclStringTrim.h" @@ -4147,7 +4146,7 @@ Tcl_TimeObjCmd( start = TclpGetWideClicks(); #endif while (i-- > 0) { - result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); + result = Tcl_EvalObjEx(interp, objPtr, 0); if (result != TCL_OK) { return result; } @@ -4187,351 +4186,6 @@ Tcl_TimeObjCmd( /* *---------------------------------------------------------------------- * - * Tcl_TimeRateObjCmd -- - * - * This object-based procedure is invoked to process the "timerate" Tcl - * command. - * This is similar to command "time", except the execution limited by - * given time (in milliseconds) instead of repetition count. - * - * Example: - * timerate {after 5} 1000 ; # equivalent for `time {after 5} [expr 1000/5]` - * - * Results: - * A standard Tcl object result. - * - * Side effects: - * See the user documentation. - * - *---------------------------------------------------------------------- - */ - -int -Tcl_TimeRateObjCmd( - ClientData dummy, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ -{ - static - double measureOverhead = 0; /* global measure-overhead */ - double overhead = -1; /* given measure-overhead */ - register Tcl_Obj *objPtr; - register int result, i; - Tcl_Obj *calibrate = NULL, *direct = NULL; - Tcl_WideInt count = 0; /* Holds repetition count */ - Tcl_WideInt maxms = -0x7FFFFFFFFFFFFFFFL; - /* Maximal running time (in milliseconds) */ - Tcl_WideInt threshold = 1; /* Current threshold for check time (faster - * repeat count without time check) */ - Tcl_WideInt maxIterTm = 1; /* Max time of some iteration as max threshold - * additionally avoid divide to zero (never < 1) */ - register Tcl_WideInt start, middle, stop; -#ifndef TCL_WIDE_CLICKS - Tcl_Time now; -#endif - - static const char *const options[] = { - "-direct", "-overhead", "-calibrate", "--", NULL - }; - enum options { - TMRT_EV_DIRECT, TMRT_OVERHEAD, TMRT_CALIBRATE, TMRT_LAST - }; - - NRE_callback *rootPtr; - ByteCode *codePtr = NULL; - - for (i = 1; i < objc - 1; i++) { - int index; - if (Tcl_GetIndexFromObj(NULL, objv[i], options, "option", TCL_EXACT, - &index) != TCL_OK) { - break; - } - if (index == TMRT_LAST) { - i++; - break; - } - switch (index) { - case TMRT_EV_DIRECT: - direct = objv[i]; - break; - case TMRT_OVERHEAD: - if (++i >= objc - 1) { - goto usage; - } - if (Tcl_GetDoubleFromObj(interp, objv[i], &overhead) != TCL_OK) { - return TCL_ERROR; - } - break; - case TMRT_CALIBRATE: - calibrate = objv[i]; - break; - } - } - - if (i >= objc || i < objc-2) { -usage: - Tcl_WrongNumArgs(interp, 1, objv, "?-direct? ?-calibrate? ?-overhead double? command ?time?"); - return TCL_ERROR; - } - objPtr = objv[i++]; - if (i < objc) { - result = TclGetWideIntFromObj(interp, objv[i], &maxms); - if (result != TCL_OK) { - return result; - } - } - - /* if calibrate */ - if (calibrate) { - - /* if no time specified for the calibration */ - if (maxms == -0x7FFFFFFFFFFFFFFFL) { - Tcl_Obj *clobjv[6]; - Tcl_WideInt maxCalTime = 5000; - double lastMeasureOverhead = measureOverhead; - - clobjv[0] = objv[0]; - i = 1; - if (direct) { - clobjv[i++] = direct; - } - clobjv[i++] = objPtr; - - /* reset last measurement overhead */ - measureOverhead = (double)0; - - /* self-call with 100 milliseconds to warm-up, - * before entering the calibration cycle */ - TclNewLongObj(clobjv[i], 100); - Tcl_IncrRefCount(clobjv[i]); - result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); - Tcl_DecrRefCount(clobjv[i]); - if (result != TCL_OK) { - return result; - } - - i--; - clobjv[i++] = calibrate; - clobjv[i++] = objPtr; - - /* set last measurement overhead to max */ - measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; - - /* calibration cycle until it'll be preciser */ - maxms = -1000; - do { - lastMeasureOverhead = measureOverhead; - TclNewLongObj(clobjv[i], (int)maxms); - Tcl_IncrRefCount(clobjv[i]); - result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); - Tcl_DecrRefCount(clobjv[i]); - if (result != TCL_OK) { - return result; - } - maxCalTime += maxms; - /* increase maxms for preciser calibration */ - maxms -= (-maxms / 4); - /* as long as new value more as 0.05% better */ - } while ( (measureOverhead >= lastMeasureOverhead - || measureOverhead / lastMeasureOverhead <= 0.9995) - && maxCalTime > 0 - ); - - return result; - } - if (maxms == 0) { - /* reset last measurement overhead */ - measureOverhead = 0; - Tcl_SetObjResult(interp, Tcl_NewLongObj(0)); - return TCL_OK; - } - - /* if time is negative - make current overhead more precise */ - if (maxms > 0) { - /* set last measurement overhead to max */ - measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; - } else { - maxms = -maxms; - } - - } - - if (maxms == -0x7FFFFFFFFFFFFFFFL) { - maxms = 1000; - } - if (overhead == -1) { - overhead = measureOverhead; - } - - /* be sure that resetting of result will not smudge the further measurement */ - Tcl_ResetResult(interp); - - /* compile object */ - if (!direct) { - if (TclInterpReady(interp) != TCL_OK) { - return TCL_ERROR; - } - codePtr = TclCompileObj(interp, objPtr, NULL, 0); - TclPreserveByteCode(codePtr); - } - - /* get start and stop time */ -#ifdef TCL_WIDE_CLICKS - start = middle = TclpGetWideClicks(); - /* time to stop execution (in wide clicks) */ - stop = start + (maxms * 1000 / TclpWideClickInMicrosec()); -#else - Tcl_GetTime(&now); - start = now.sec; start *= 1000000; start += now.usec; - middle = start; - /* time to stop execution (in microsecs) */ - stop = start + maxms * 1000; -#endif - - /* start measurement */ - while (1) { - /* eval single iteration */ - count++; - - if (!direct) { - /* precompiled */ - rootPtr = TOP_CB(interp); - result = TclNRExecuteByteCode(interp, codePtr); - result = TclNRRunCallbacks(interp, result, rootPtr); - } else { - /* eval */ - result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); - } - if (result != TCL_OK) { - goto done; - } - - /* don't check time up to threshold */ - if (--threshold > 0) continue; - - /* check stop time reached, estimate new threshold */ - #ifdef TCL_WIDE_CLICKS - middle = TclpGetWideClicks(); - #else - Tcl_GetTime(&now); - middle = now.sec; middle *= 1000000; middle += now.usec; - #endif - if (middle >= stop) { - break; - } - - /* don't calculate threshold by few iterations, because sometimes - * first iteration(s) can be too fast (cached, delayed clean up, etc) */ - if (count < 10) { - threshold = 1; continue; - } - - /* average iteration time in microsecs */ - threshold = (middle - start) / count; - if (threshold > maxIterTm) { - maxIterTm = threshold; - } - /* as relation between remaining time and time since last check */ - threshold = ((stop - middle) / maxIterTm) / 4; - if (threshold > 100000) { /* fix for too large threshold */ - threshold = 100000; - } - } - - { - Tcl_Obj *objarr[8], **objs = objarr; - Tcl_WideInt val; - const char *fmt; - - middle -= start; /* execution time in microsecs */ - - #ifdef TCL_WIDE_CLICKS - /* convert execution time in wide clicks to microsecs */ - middle *= TclpWideClickInMicrosec(); - #endif - - /* if not calibrate */ - if (!calibrate) { - /* minimize influence of measurement overhead */ - if (overhead > 0) { - /* estimate the time of overhead (microsecs) */ - Tcl_WideInt curOverhead = overhead * count; - if (middle > curOverhead) { - middle -= curOverhead; - } else { - middle = 1; - } - } - } else { - /* calibration - obtaining new measurement overhead */ - if (measureOverhead > (double)middle / count) { - measureOverhead = (double)middle / count; - } - objs[0] = Tcl_NewDoubleObj(measureOverhead); - TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */ - objs += 2; - } - - val = middle / count; /* microsecs per iteration */ - if (val >= 1000000) { - objs[0] = Tcl_NewWideIntObj(val); - } else { - if (val < 10) { fmt = "%.6f"; } else - if (val < 100) { fmt = "%.4f"; } else - if (val < 1000) { fmt = "%.3f"; } else - if (val < 10000) { fmt = "%.2f"; } else - { fmt = "%.1f"; }; - objs[0] = Tcl_ObjPrintf(fmt, ((double)middle)/count); - } - - objs[2] = Tcl_NewWideIntObj(count); /* iterations */ - - /* calculate speed as rate (count) per sec */ - if (!middle) middle++; /* +1 ms, just to avoid divide by zero */ - if (count < (0x7FFFFFFFFFFFFFFFL / 1000000)) { - val = (count * 1000000) / middle; - if (val < 100000) { - if (val < 100) { fmt = "%.3f"; } else - if (val < 1000) { fmt = "%.2f"; } else - { fmt = "%.1f"; }; - objs[4] = Tcl_ObjPrintf(fmt, ((double)(count * 1000000)) / middle); - } else { - objs[4] = Tcl_NewWideIntObj(val); - } - } else { - objs[4] = Tcl_NewWideIntObj((count / middle) * 1000000); - } - - /* estimated net execution time (in millisecs) */ - if (!calibrate) { - objs[6] = Tcl_ObjPrintf("%.3f", (double)middle / 1000); - TclNewLiteralStringObj(objs[7], "nett-ms"); - } - - /* - * Construct the result as a list because many programs have always parsed - * as such (extracting the first element, typically). - */ - - TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#"); /* mics/# */ - TclNewLiteralStringObj(objs[3], "#"); - TclNewLiteralStringObj(objs[5], "#/sec"); - Tcl_SetObjResult(interp, Tcl_NewListObj(8, objarr)); - } - -done: - - if (codePtr != NULL) { - TclReleaseByteCode(codePtr); - } - - return result; -} - -/* - *---------------------------------------------------------------------- - * * Tcl_TryObjCmd, TclNRTryObjCmd -- * * This procedure is invoked to process the "try" Tcl command. See the diff --git a/generic/tclInt.h b/generic/tclInt.h index 333a665..5bd4324 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3437,9 +3437,6 @@ MODULE_SCOPE int Tcl_ThrowObjCmd(ClientData dummy, Tcl_Interp *interp, MODULE_SCOPE int Tcl_TimeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Tcl_TimeRateObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); MODULE_SCOPE int Tcl_TraceObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index ab022ab..b1fe234 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,19 +1,9 @@ if {([info commands ::tcl::pkgconfig] eq "") - || ([info sharedlibextension] ne ".dll")} return + || ([info sharedlibextension] ne ".dll")} return if {[::tcl::pkgconfig get debug]} { - if {[info exists [file join $dir tclreg13g.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13g.dll] registry] - } else { - package ifneeded registry 1.3.2 \ - [list load tclreg13g registry] - } } else { - if {[info exists [file join $dir tclreg13.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13.dll] registry] - } else { - package ifneeded registry 1.3.2 \ - [list load tclreg13 registry] - } } -- cgit v0.12 From 4a9ae53836f768d0b615e5f98cedfb9dd5fbac7f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 08:59:28 +0000 Subject: More code review, e.g. use Tcl_SetObjResult in stead of Tcl_SetResult, preventing a (char *) type case. No functional changes. --- generic/tclClock.c | 176 +++++++++++++++++------------------ generic/tclClockFmt.c | 239 ++++++++++++++++++++++++------------------------ generic/tclDate.c | 12 +-- generic/tclDate.h | 10 +- generic/tclEnsemble.c | 4 +- generic/tclEnv.c | 2 +- generic/tclGetDate.y | 2 +- generic/tclInt.h | 2 +- generic/tclStrIdxTree.c | 36 ++++---- generic/tclStrIdxTree.h | 8 +- library/clock.tcl | 16 ++-- library/init.tcl | 6 +- unix/tclUnixTime.c | 2 +- win/tclWinTime.c | 8 +- 14 files changed, 261 insertions(+), 262 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 0895bbb..95b3e36 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -96,8 +96,8 @@ static int ClockConvertlocaltoutcObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ClockGetDateFields(ClientData clientData, - Tcl_Interp *interp, TclDateFields *fields, +static int ClockGetDateFields(ClientData clientData, + Tcl_Interp *interp, TclDateFields *fields, Tcl_Obj *timezoneObj, int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, @@ -130,7 +130,7 @@ static int ClockScanCommit( ClientData clientData, register DateInfo *info, register ClockFmtScnCmdArgs *opts); static int ClockFreeScan( - register DateInfo *info, + register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); static int ClockCalcRelTime( register DateInfo *info, ClockFmtScnCmdArgs *opts); @@ -267,10 +267,10 @@ TclClockInit( clientData = data; data->refCount++; } - cmdPtr = (Command *)Tcl_CreateObjCommand(interp, cmdName, + cmdPtr = (Command *)Tcl_CreateObjCommand(interp, cmdName, clockCmdPtr->objCmdProc, clientData, clockCmdPtr->clientData ? NULL : ClockDeleteCmdProc); - cmdPtr->compileProc = clockCmdPtr->compileProc ? + cmdPtr->compileProc = clockCmdPtr->compileProc ? clockCmdPtr->compileProc : TclCompileBasicMin0ArgCmd; } } @@ -386,7 +386,7 @@ NormTimezoneObj( { const char *tz; if ( timezoneObj == dataPtr->LastUnnormSetupTimeZone - && dataPtr->LastSetupTimeZone != NULL + && dataPtr->LastSetupTimeZone != NULL ) { return dataPtr->LastSetupTimeZone; } @@ -468,7 +468,7 @@ static inline Tcl_Obj * ClockGetCurrentLocale( ClockClientData *dataPtr, /* Client data containing literal pool */ Tcl_Interp *interp) /* Tcl interpreter */ -{ +{ if (Tcl_EvalObjv(interp, 1, &dataPtr->literals[LIT_GETCURRENTLOCALE], 0) != TCL_OK) { return NULL; } @@ -504,7 +504,7 @@ NormLocaleObj( { const char *loc; if ( localeObj == NULL || localeObj == dataPtr->CurrentLocale - || localeObj == dataPtr->literals[LIT_C] + || localeObj == dataPtr->literals[LIT_C] || localeObj == dataPtr->literals[LIT_CURRENT] ) { if (dataPtr->CurrentLocale == NULL) { @@ -555,8 +555,8 @@ NormLocaleObj( } *mcDictObj = dataPtr->CurrentLocaleDict; localeObj = dataPtr->CurrentLocale; - } - else + } + else if ( (localeObj->length == 6 /* system */ && strncasecmp(loc, Literals[LIT_SYSTEM], localeObj->length) == 0) @@ -565,8 +565,8 @@ NormLocaleObj( localeObj = ClockGetSystemLocale(dataPtr, interp); Tcl_SetObjRef(dataPtr->LastUsedLocale, localeObj); *mcDictObj = NULL; - } - else + } + else { *mcDictObj = NULL; } @@ -578,7 +578,7 @@ NormLocaleObj( * * ClockMCDict -- * - * Retrieves a localized storage dictionary object for the given + * Retrieves a localized storage dictionary object for the given * locale object. * * This corresponds with call `::tcl::clock::mcget locale`. @@ -600,13 +600,13 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) /* if locale was not yet used */ if ( !(opts->flags & CLF_LOCALE_USED) ) { - + opts->localeObj = NormLocaleObj(opts->clientData, opts->interp, opts->localeObj, &opts->mcDictObj); - + if (opts->localeObj == NULL) { - Tcl_SetResult(opts->interp, - (char*)"locale not specified and no default locale set", TCL_STATIC); + Tcl_SetObjResult(opts->interp, + Tcl_NewStringObj("locale not specified and no default locale set", -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "badOption", NULL); return NULL; } @@ -617,7 +617,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) int i; dataPtr->mcLiterals = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < MCLIT__END; ++i) { - Tcl_InitObjRef(dataPtr->mcLiterals[i], + Tcl_InitObjRef(dataPtr->mcLiterals[i], Tcl_NewStringObj(MsgCtLiterals[i], -1)); } } @@ -672,7 +672,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) MODULE_SCOPE Tcl_Obj * ClockMCGet( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey) { ClockClientData *dataPtr = opts->clientData; @@ -685,7 +685,7 @@ ClockMCGet( return NULL; } - Tcl_DictObjGet(opts->interp, opts->mcDictObj, + Tcl_DictObjGet(opts->interp, opts->mcDictObj, dataPtr->mcLiterals[mcKey], &valObj); return valObj; /* or NULL in obscure case if Tcl_DictObjGet failed */ @@ -708,7 +708,7 @@ ClockMCGet( MODULE_SCOPE Tcl_Obj * ClockMCGetIdx( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey) { ClockClientData *dataPtr = opts->clientData; @@ -725,8 +725,8 @@ ClockMCGetIdx( if (dataPtr->mcLitIdxs == NULL) { return NULL; } - - if (Tcl_DictObjGet(NULL, opts->mcDictObj, + + if (Tcl_DictObjGet(NULL, opts->mcDictObj, dataPtr->mcLitIdxs[mcKey], &valObj) != TCL_OK ) { return NULL; @@ -752,7 +752,7 @@ ClockMCGetIdx( MODULE_SCOPE int ClockMCSetIdx( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey, Tcl_Obj *valObj) { ClockClientData *dataPtr = opts->clientData; @@ -768,12 +768,12 @@ ClockMCSetIdx( int i; dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < MCLIT__END; ++i) { - Tcl_InitObjRef(dataPtr->mcLitIdxs[i], + Tcl_InitObjRef(dataPtr->mcLitIdxs[i], Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); } } - return Tcl_DictObjPut(opts->interp, opts->mcDictObj, + return Tcl_DictObjPut(opts->interp, opts->mcDictObj, dataPtr->mcLitIdxs[mcKey], valObj); } @@ -804,7 +804,7 @@ ClockConfigureObjCmd( Tcl_Obj *const objv[]) /* Parameter vector */ { ClockClientData *dataPtr = clientData; - + static const char *const options[] = { "-system-tz", "-setup-tz", "-default-locale", "-clear", @@ -821,7 +821,7 @@ ClockConfigureObjCmd( int i; for (i = 1; i < objc; i++) { - if (Tcl_GetIndexFromObj(interp, objv[i++], options, + if (Tcl_GetIndexFromObj(interp, objv[i++], options, "option", 0, &optionIndex) != TCL_OK) { Tcl_SetErrorCode(interp, "CLOCK", "badOption", Tcl_GetString(objv[i-1]), NULL); @@ -838,8 +838,8 @@ ClockConfigureObjCmd( Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); } dataPtr->LastTZEpoch = lastTZEpoch; - } - if (i+1 >= objc && dataPtr->SystemTimeZone != NULL + } + if (i+1 >= objc && dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == lastTZEpoch) { Tcl_SetObjResult(interp, dataPtr->SystemTimeZone); } @@ -874,7 +874,7 @@ ClockConfigureObjCmd( Tcl_SetObjRef(dataPtr->AnySetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->AnySetupTZData); } - } + } break; } } @@ -906,7 +906,7 @@ ClockConfigureObjCmd( continue; } if (i+1 >= objc) { - Tcl_SetObjResult(interp, + Tcl_SetObjResult(interp, Tcl_NewIntObj(dataPtr->currentYearCentury)); } break; @@ -921,7 +921,7 @@ ClockConfigureObjCmd( continue; } if (i+1 >= objc) { - Tcl_SetObjResult(interp, + Tcl_SetObjResult(interp, Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); } break; @@ -978,7 +978,7 @@ ClockGetTZData( } out = &dataPtr->SystemSetupTZData; } - else + else if (timezoneObj == dataPtr->GMTSetupTimeZone) { if (dataPtr->GMTSetupTZData != NULL) { return dataPtr->GMTSetupTZData; @@ -1033,7 +1033,7 @@ ClockGetSystemTimeZone( Tcl_Obj **literals; /* if known (cached and same epoch) - return now */ - if (dataPtr->SystemTimeZone != NULL + if (dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == TzsetGetEpoch()) { return dataPtr->SystemTimeZone; } @@ -1121,7 +1121,7 @@ ClockSetupTimeZone( *---------------------------------------------------------------------- */ -Tcl_Obj * +Tcl_Obj * ClockFormatNumericTimeZone(int z) { char sign = '+'; int h, m; @@ -1298,7 +1298,7 @@ ClockGetdatefieldsObjCmd( /* Extract fields */ - if (ClockGetDateFields(clientData, interp, &fields, objv[2], + if (ClockGetDateFields(clientData, interp, &fields, objv[2], changeover) != TCL_OK) { return TCL_ERROR; } @@ -1344,8 +1344,8 @@ ClockGetdatefieldsObjCmd( * * ClockGetDateFields -- * - * Converts given UTC time (seconds in a TclDateFields structure) - * to local time and determines the values that clock routines will + * Converts given UTC time (seconds in a TclDateFields structure) + * to local time and determines the values that clock routines will * use in scanning or formatting a date. * * Results: @@ -1704,7 +1704,7 @@ ConvertLocalToUTC( return TCL_ERROR; }; } else { - if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv, + if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv, dataPtr->Local2UTC.rangesVal) != TCL_OK) { return TCL_ERROR; }; @@ -1806,7 +1806,7 @@ ConvertLocalToUTCUsingTable( Tcl_WideInt backCompVal; /* check DST-hole interval contains UTC time */ TclGetWideIntFromObj(NULL, cellv[0], &backCompVal); - if ( fields->seconds >= backCompVal - fields->tzOffset + if ( fields->seconds >= backCompVal - fields->tzOffset && fields->seconds <= backCompVal + fields->tzOffset ) { row = LookupLastTransition(interp, fields->seconds, rowc, rowv); @@ -1817,7 +1817,7 @@ ConvertLocalToUTCUsingTable( } if (fields->localSeconds != fields->seconds + corrOffset) { Tcl_Panic("wrong local time %ld by LocalToUTC conversion," - " local time seems to be in between DST-hole", + " local time seems to be in between DST-hole", fields->localSeconds); /* correcting offset * / fields->tzOffset -= corrOffset; @@ -1943,8 +1943,8 @@ ConvertUTCToLocal( Tcl_Obj **rowv; /* Pointers to the rows */ /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ - if (timezoneObj == dataPtr->GMTSetupTimeZone - && dataPtr->GMTSetupTimeZone != NULL + if (timezoneObj == dataPtr->GMTSetupTimeZone + && dataPtr->GMTSetupTimeZone != NULL && dataPtr->GMTSetupTZData != NULL ) { fields->localSeconds = fields->seconds; @@ -2001,7 +2001,7 @@ ConvertUTCToLocal( return TCL_ERROR; } } else { - if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, + if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, dataPtr->UTC2Local.rangesVal) != TCL_OK) { return TCL_ERROR; } @@ -2993,7 +2993,7 @@ static int ClockParseFmtScnArgs( register ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ - TclDateFields *date, /* Extracted date-time corresponding base + TclDateFields *date, /* Extracted date-time corresponding base * (by scan or add) resp. clockval (by format) */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ @@ -3034,14 +3034,14 @@ ClockParseFmtScnArgs( } } /* get option */ - if (Tcl_GetIndexFromObj(interp, objv[i], options, + if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &optionIndex) != TCL_OK) { goto badOption; } /* if already specified */ if (saw & (1 << optionIndex)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad option \"%s\": doubly present", + "bad option \"%s\": doubly present", TclGetString(objv[i])) ); goto badOption; @@ -3080,7 +3080,7 @@ ClockParseFmtScnArgs( if ((saw & (1 << CLC_ARGS_GMT)) && (saw & (1 << CLC_ARGS_TIMEZONE))) { - Tcl_SetResult(interp, (char*)"cannot use -gmt and -timezone in same call", TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot use -gmt and -timezone in same call", -1)); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } @@ -3091,7 +3091,7 @@ ClockParseFmtScnArgs( /* If time zone not specified use system time zone */ if ( opts->timezoneObj == NULL - || TclGetString(opts->timezoneObj) == NULL + || TclGetString(opts->timezoneObj) == NULL || opts->timezoneObj->length == 0 ) { opts->timezoneObj = ClockGetSystemTimeZone(opts->clientData, interp); @@ -3178,7 +3178,7 @@ baseNow: return TCL_OK; -badOptionMsg: +badOptionMsg: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": unexpected for command \"%s\"", @@ -3189,7 +3189,7 @@ badOption: Tcl_SetErrorCode(interp, "CLOCK", "badOption", i < objc ? Tcl_GetString(objv[i]) : NULL, NULL); - + return TCL_ERROR; } @@ -3201,7 +3201,7 @@ badOption: * * Formats a count of seconds since the Posix Epoch as a time of day. * - * The 'clock format' command formats times of day for output. Refer + * The 'clock format' command formats times of day for output. Refer * to the user documentation to see what it does. * * Results: @@ -3313,7 +3313,7 @@ ClockScanObjCmd( } ClockInitDateInfo(&yy); - + /* * Extract values for the keywords. */ @@ -3334,13 +3334,13 @@ ClockScanObjCmd( /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { - Tcl_SetResult(interp, - (char*)"legacy [clock scan] does not support -locale", TCL_STATIC); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("legacy [clock scan] does not support -locale", -1)); Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } ret = ClockFreeScan(&yy, objv[1], &opts); - } + } else { /* Use compiled version of Scan - */ @@ -3420,14 +3420,14 @@ ClockScanCommit( } if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY|CLF_LOCALSEC)) { - if (ConvertLocalToUTC(clientData, opts->interp, &yydate, opts->timezoneObj, + if (ConvertLocalToUTC(clientData, opts->interp, &yydate, opts->timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { return TCL_ERROR; } } /* Increment UTC seconds with relative time */ - + yydate.seconds += yyRelSeconds; return TCL_OK; @@ -3452,8 +3452,8 @@ int ClockFreeScan( register DateInfo *info, /* Date fields used for parsing & converting - * simultaneously a yy-parse structure of the - * TclClockFreeScan */ + * simultaneously a yy-parse structure of the + * TclClockFreeScan */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { @@ -3466,15 +3466,15 @@ ClockFreeScan( * Parse the date. The parser will fill a structure "info" with date, * time, time zone, relative month/day/seconds, relative weekday, ordinal * month. - * Notice that many yy-defines point to values in the "info" or "date" - * structure, e. g. yySeconds -> info->date.secondOfDay or + * Notice that many yy-defines point to values in the "info" or "date" + * structure, e. g. yySeconds -> info->date.secondOfDay or * yySeconds -> info->date.month (same as yydate.month) */ yyInput = Tcl_GetString(strObj); if (TclClockFreeScan(interp, info) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); - Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", + Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", Tcl_GetString(strObj), TclGetString(Tcl_GetObjResult(interp))); Tcl_SetObjResult(interp, msg); goto done; @@ -3501,7 +3501,7 @@ ClockFreeScan( } /* - * If the caller supplied a time zone in the string, make it into a time + * If the caller supplied a time zone in the string, make it into a time * zone indicator of +-hhmm and setup this time zone. */ @@ -3524,8 +3524,8 @@ ClockFreeScan( info->flags |= CLF_ASSEMBLE_SECONDS; } - - /* + + /* * Assemble date, time, zone into seconds-from-epoch */ @@ -3538,8 +3538,8 @@ ClockFreeScan( yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); info->flags |= CLF_ASSEMBLE_SECONDS; - } - else + } + else if ( (yyHaveDay && !yyHaveDate) || yyHaveOrdinalMonth || ( yyHaveRel @@ -3548,7 +3548,7 @@ ClockFreeScan( ) { yySeconds = 0; info->flags |= CLF_ASSEMBLE_SECONDS; - } + } else { yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } @@ -3588,13 +3588,13 @@ ClockCalcRelTime( { /* * Because some calculations require in-between conversion of the - * julian day, we can repeat this processing multiple times + * julian day, we can repeat this processing multiple times */ repeat_rel: if (yyHaveRel) { - /* + /* * Relative conversion normally possible in UTC time only, because * of possible wrong local time increment if ignores in-between DST-hole. * (see test-cases clock-34.53, clock-34.54). @@ -3641,7 +3641,7 @@ repeat_rel: info->flags &= ~CLF_ASSEMBLE_JULIANDAY; } yydate.julianDay += yyRelDay; - + /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; @@ -3652,12 +3652,12 @@ repeat_rel: * leave rest of the increment in yyRelSeconds to add it hereafter in UTC seconds */ if (yyRelSeconds) { int newSecs = yySeconds + yyRelSeconds; - + /* if seconds increment outside of current date, increment day */ if (newSecs / SECONDS_PER_DAY != yySeconds / SECONDS_PER_DAY) { - + yyRelDay += newSecs / SECONDS_PER_DAY; - yySeconds = 0; + yySeconds = 0; yyRelSeconds = newSecs % SECONDS_PER_DAY; goto repeat_rel; @@ -3738,7 +3738,7 @@ repeat_rel: * * Get offset in days for the number of week days corresponding the * given day of week (skipping Saturdays and Sundays). - * + * * * Results: * Returns a day increment adjusted the given weekdays @@ -3819,7 +3819,7 @@ ClockWeekdaysOffs( * Used to determine the Gregorian change date. * * Results: - * Returns a standard Tcl result with the given time adjusted + * Returns a standard Tcl result with the given time adjusted * by the given offset(s) in order. * * Notes: @@ -3870,7 +3870,7 @@ ClockAddObjCmd( } ClockInitDateInfo(&yy); - + /* * Extract values for the keywords. */ @@ -3883,7 +3883,7 @@ ClockAddObjCmd( } /* time together as seconds of the day */ - yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; /* seconds are in localSeconds (relative base date), so reset time here */ yyHour = 0; yyMinutes = 0; yyMeridian = MER24; @@ -3913,12 +3913,12 @@ ClockAddObjCmd( continue; } - /* if in-between conversion needed (already have relative date/time), - * correct date info, because the date may be changed, + /* if in-between conversion needed (already have relative date/time), + * correct date info, because the date may be changed, * so refresh it now */ if ( yyHaveRel - && ( unitIndex == CLC_ADD_WEEKDAYS + && ( unitIndex == CLC_ADD_WEEKDAYS /* some months can be shorter as another */ || yyRelMonth || yyRelDay /* day changed */ @@ -4050,13 +4050,13 @@ TzsetGetEpoch(void) static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by * clockMutex. */ static long tzLastRefresh = 0; /* Used for latency before next refresh */ - static unsigned long tzWasEpoch = 0; /* Epoch, signals that TZ changed */ - static unsigned long tzEnvEpoch = 0; /* Last env epoch, for faster signaling, + static size_t tzWasEpoch = 0; /* Epoch, signals that TZ changed */ + static size_t tzEnvEpoch = 0; /* Last env epoch, for faster signaling, that TZ changed via TCL */ - + const char *tzIsNow; /* Current value of TZ */ - - /* + + /* * Prevent performance regression on some platforms by resolving of system time zone: * small latency for check whether environment was changed (once per second) * no latency if environment was chaned with tcl-env (compare both epoch values) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 0ec8817..5de05d0 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -50,7 +50,7 @@ static void ClockFrmScnFinalize(ClientData clientData); * pre-validated within parsing routines) * * Results: - * Returns a standard Tcl result. + * Returns a standard Tcl result. * TCL_OK - by successful conversion, TCL_ERROR by (wide) int overflow * *---------------------------------------------------------------------- @@ -59,7 +59,7 @@ static void ClockFrmScnFinalize(ClientData clientData); static inline int _str2int( int *out, - register + register const char *p, const char *e, int sign) @@ -84,12 +84,12 @@ _str2int( } *out = val; return TCL_OK; -} +} static inline int _str2wideInt( Tcl_WideInt *out, - register + register const char *p, const char *e, int sign) @@ -289,13 +289,13 @@ _witoaw( /* * Global GC as LIFO for released scan/format object storages. - * + * * Used to holds last released CLOCK_FMT_SCN_STORAGE_GC_SIZE formats * (after last reference from Tcl-object will be removed). This is helpful * to avoid continuous (re)creation and compiling by some dynamically resp. * variable format objects, that could be often reused. - * - * As long as format storage is used resp. belongs to GC, it takes place in + * + * As long as format storage is used resp. belongs to GC, it takes place in * FmtScnHashTable also. */ @@ -326,7 +326,7 @@ static struct { */ static inline void -ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) +ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) { /* add new entry */ TclSpliceIn(entry, ClockFmtScnStorage_GC.stackPtr); @@ -382,7 +382,7 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) * Global format storage hash table of type ClockFmtScnStorageHashKeyType * (contains list of scan/format object storages, shared across all threads). * - * Used for fast searching by format string. + * Used for fast searching by format string. */ static Tcl_HashTable FmtScnHashTable; static int initialized = 0; @@ -422,7 +422,7 @@ ClockFmtScnStorageAllocProc( const char *string = (const char *) keyPtr; Tcl_HashEntry *hPtr; - unsigned int size, + unsigned int size, allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry); allocsize += (size = strlen(string) + 1); @@ -455,7 +455,7 @@ ClockFmtScnStorageAllocProc( *---------------------------------------------------------------------- */ -static void +static void ClockFmtScnStorageFreeProc( Tcl_HashEntry *hPtr) { @@ -488,10 +488,10 @@ ClockFmtScnStorageFreeProc( *---------------------------------------------------------------------- */ -static void +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); - /* + /* * This will delete a hash entry and call "ckfree" for storage self, if * some additionally handling required, freeEntryProc can be used instead */ @@ -499,7 +499,7 @@ ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { } -/* +/* * Derivation of tclStringHashKeyType with another allocEntryProc */ @@ -567,10 +567,10 @@ ClockFmtObj_FreeInternalRep(objPtr) #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 /* don't remove it right now (may be reusable), just add to GC */ ClockFmtScnStorageGC_In(fss); - #else + #else /* remove storage (format representation) */ ClockFmtScnStorageDelete(fss); - #endif + #endif } Tcl_MutexUnlock(&ClockFmtMutex); } @@ -630,7 +630,7 @@ ClockFmtObj_UpdateString(objPtr) * Retrieves format key object used to search localized format. * * This is normally stored in second pointer of internal representation. - * If format object is not localizable, it is equal the given format + * If format object is not localizable, it is equal the given format * pointer (special case to fast fallback by not-localizable formats). * * Results: @@ -655,7 +655,7 @@ ClockFrmObjGetLocFmtKey( return NULL; } } - + keyObj = ObjLocFmtKey(objPtr); if (keyObj) { return keyObj; @@ -692,7 +692,7 @@ ClockFrmObjGetLocFmtKey( static ClockFmtScnStorage * FindOrCreateFmtScnStorage( - Tcl_Interp *interp, + Tcl_Interp *interp, Tcl_Obj *objPtr) { const char *strFmt = TclGetString(objPtr); @@ -720,7 +720,7 @@ FindOrCreateFmtScnStorage( /* get or create entry (and alocate storage) */ hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); if (hPtr != NULL) { - + fss = FmtScn4HashEntry(hPtr); #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 @@ -772,7 +772,7 @@ Tcl_GetClockFrmScnFromObj( Tcl_Obj *objPtr) { ClockFmtScnStorage *fss; - + if (objPtr->typePtr != &ClockFmtObjType) { if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { return NULL; @@ -822,7 +822,7 @@ ClockLocalizeFormat( return opts->formatObj; } - /* prevents loss of key object if the format object (where key stored) + /* prevents loss of key object if the format object (where key stored) * becomes changed (loses its internal representation during evals) */ Tcl_IncrRefCount(keyObj); @@ -833,7 +833,7 @@ ClockLocalizeFormat( } /* try to find in cache within locale mc-catalog */ - if (Tcl_DictObjGet(NULL, opts->mcDictObj, + if (Tcl_DictObjGet(NULL, opts->mcDictObj, keyObj, &valObj) != TCL_OK) { goto done; } @@ -947,7 +947,7 @@ FindTokenBegin( static void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, - DateInfo *info, ClockScanToken *tok, + DateInfo *info, ClockScanToken *tok, int *minLenPtr, int *maxLenPtr) { register int minLen = tok->map->minSize; @@ -973,7 +973,7 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, }; if (minLen < tok->map->minSize) { minLen = tok->map->minSize; - } + } if (minLen > maxLen) { maxLen = minLen; } @@ -1032,7 +1032,7 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, * * ObjListSearch -- * - * Find largest part of the input string from start regarding min and + * Find largest part of the input string from start regarding min and * max lengths in the given list (utf-8, case sensitive). * * Results: @@ -1044,9 +1044,9 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, *---------------------------------------------------------------------- */ -static inline int -ObjListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int *val, +static inline int +ObjListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int *val, Tcl_Obj **lstv, int lstc, int minLen, int maxLen) { @@ -1091,9 +1091,9 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, #if 0 /* currently unused */ -static int -LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int mcKey, int *val, +static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int mcKey, int *val, int minLen, int maxLen) { Tcl_Obj **lstv; @@ -1139,7 +1139,7 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, static TclStrIdxTree * ClockMCGetListIdxTree( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey) { TclStrIdxTree * idxTree; @@ -1166,7 +1166,7 @@ ClockMCGetListIdxTree( goto done; } - if (TclListObjGetElements(opts->interp, valObj, + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { goto done; }; @@ -1196,8 +1196,8 @@ done: * Retrieves localized string indexed tree in the locale catalog for * multiple lists by literal indices mcKeys (and builds it on demand). * - * Searches localized index in locale catalog for mcKey, and if not - * yet exists, creates string indexed tree and stores it in the + * Searches localized index in locale catalog for mcKey, and if not + * yet exists, creates string indexed tree and stores it in the * locale catalog. * * Results: @@ -1211,8 +1211,8 @@ done: static TclStrIdxTree * ClockMCGetMultiListIdxTree( - ClockFmtScnCmdArgs *opts, - int mcKey, + ClockFmtScnCmdArgs *opts, + int mcKey, int *mcKeys) { TclStrIdxTree * idxTree; @@ -1241,7 +1241,7 @@ ClockMCGetMultiListIdxTree( goto done; } - if (TclListObjGetElements(opts->interp, valObj, + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { goto done; }; @@ -1275,7 +1275,7 @@ done: * * Results: * TCL_OK - match found and the index stored in *val, - * TCL_RETURN - not matched or ambigous, + * TCL_RETURN - not matched or ambigous, * TCL_ERROR - in error case. * * Side effects: @@ -1285,15 +1285,15 @@ done: */ static inline int -ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, TclStrIdxTree *idxTree, int *val, +ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, TclStrIdxTree *idxTree, int *val, int minLen, int maxLen) { const char *f; TclStrIdx *foundItem; - f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, + f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, yyInput, yyInput + maxLen); - + if (f <= yyInput || (f - yyInput) < minLen) { /* not found */ return TCL_RETURN; @@ -1313,15 +1313,15 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, #if 0 /* currently unused */ -static int -StaticListSearch(ClockFmtScnCmdArgs *opts, +static int +StaticListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, const char **lst, int *val) { int len; const char **s = lst; while (*s != NULL) { len = strlen(*s); - if ( len <= info->dateEnd - yyInput + if ( len <= info->dateEnd - yyInput && strncasecmp(yyInput, *s, len) == 0 ) { *val = (s - lst); @@ -1339,7 +1339,7 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, static inline const char * FindWordEnd( - ClockScanToken *tok, + ClockScanToken *tok, register const char * p, const char * end) { register const char *x = tok->tokWord.start; @@ -1358,7 +1358,7 @@ FindWordEnd( return pfnd; } -static int +static int ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { @@ -1371,7 +1371,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, "July", "August", "September", "October", "November", "December", /* abbr */ - "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL }; @@ -1408,7 +1408,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, } -static int +static int ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { @@ -1425,7 +1425,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if ( curTok != 'a' && curTok != 'A' && ((minLen <= 1 && maxLen >= 1) || PTR2INT(tok->map->data)) ) { - + val = -1; if (PTR2INT(tok->map->data) == 0) { @@ -1450,8 +1450,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, val = 7; } if (val > 7) { - Tcl_SetResult(opts->interp, (char*)"day of week is greater than 7", - TCL_STATIC); + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj("day of week is greater than 7", -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); return TCL_ERROR; } @@ -1484,8 +1483,8 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, } -static int -ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int ret, val; @@ -1504,7 +1503,7 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, ret = ObjListSearch(opts, info, &val, amPmObj, 2, minLen, maxLen); if (ret != TCL_OK) { - return ret; + return ret; } if (val == 0) { @@ -1516,8 +1515,8 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { ClockClientData *dataPtr = opts->clientData; @@ -1542,7 +1541,7 @@ ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, ret = ObjListSearch(opts, info, &val, eraObj, 6, minLen, maxLen); if (ret != TCL_OK) { - return ret; + return ret; } if (val & 1) { @@ -1554,8 +1553,8 @@ ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int ret, val; @@ -1583,8 +1582,8 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int minLen, maxLen; @@ -1598,7 +1597,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, if (*p == '+' || *p == '-') { /* max chars in numeric zone = "+00:00:00" */ #define MAX_ZONE_LEN 9 - char buf[MAX_ZONE_LEN + 1]; + char buf[MAX_ZONE_LEN + 1]; char *bp = buf; *bp++ = *p++; len++; if (maxLen > MAX_ZONE_LEN) @@ -1621,7 +1620,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, return TCL_RETURN; } #undef MAX_ZONE_LEN - + /* timezone */ tzObjStor = Tcl_NewStringObj(buf, bp-buf); } else { @@ -1629,7 +1628,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, if (maxLen > 4) maxLen = 4; while (len < maxLen) { - if ( (*p & 0x80) + if ( (*p & 0x80) || (!isalpha(UCHAR(*p)) && !isdigit(UCHAR(*p))) ) { /* INTL: ISO only. */ break; @@ -1650,7 +1649,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, /* try to apply new time zone */ Tcl_IncrRefCount(tzObjStor); - opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, tzObjStor); Tcl_DecrRefCount(tzObjStor); @@ -1663,8 +1662,8 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int minLen, maxLen; @@ -1741,7 +1740,7 @@ ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static const char *ScnSTokenMapIndex = +static const char *ScnSTokenMapIndex = "dmbyYHMSpJjCgGVazUsntQ"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ @@ -1814,7 +1813,7 @@ static const char *ScnSTokenMapAliasIndex[2] = { "dmbbHHHpaaazU" }; -static const char *ScnETokenMapIndex = +static const char *ScnETokenMapIndex = "Eys"; static ClockScanTokenMap ScnETokenMap[] = { /* %EE */ @@ -1832,7 +1831,7 @@ static const char *ScnETokenMapAliasIndex[2] = { "" }; -static const char *ScnOTokenMapIndex = +static const char *ScnOTokenMapIndex = "dmyHMSu"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ @@ -1862,7 +1861,7 @@ static const char *ScnOTokenMapAliasIndex[2] = { "dHHHu" }; -static const char *ScnSpecTokenMapIndex = +static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { {CTOKT_SPACE, 0, 0, 1, 1, 0, @@ -1870,7 +1869,7 @@ static ClockScanTokenMap ScnSpecTokenMap[] = { }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 0, 1, 1, 0, + CTOKT_WORD, 0, 0, 1, 1, 0, NULL }; @@ -1937,7 +1936,7 @@ ClockGetOrParseScanFormat( /* estimate token count by % char and format length */ fss->scnTokC = EstimateTokenCount(p, e); - + fss->scnSpaceCount = 0; Tcl_MutexLock(&ClockFmtMutex); @@ -1959,7 +1958,7 @@ ClockGetOrParseScanFormat( /* try to find modifier: */ switch (*p) { case '%': - /* begin new word token - don't join with previous word token, + /* begin new word token - don't join with previous word token, * because current mapping should be "...%%..." -> "...%..." */ tok->map = &ScnWordTokenMap; tok->tokWord.start = p; @@ -1969,7 +1968,7 @@ ClockGetOrParseScanFormat( continue; break; case 'E': - scnMap = ScnETokenMap, + scnMap = ScnETokenMap, mapIndex = ScnETokenMapIndex, aliasIndex = ScnETokenMapAliasIndex; p++; @@ -2018,7 +2017,7 @@ ClockGetOrParseScanFormat( } /* increase space count used in format */ - if ( tok->map->type == CTOKT_CHAR + if ( tok->map->type == CTOKT_CHAR && isspace(UCHAR(*((char *)tok->map->data))) ) { fss->scnSpaceCount++; @@ -2161,13 +2160,13 @@ ClockScan( } info->dateStart = p = yyInput; info->dateEnd = end; - + /* parse string */ for (; tok->map != NULL; tok++) { map = tok->map; /* bypass spaces at begin of input before parsing each token */ - if ( !(opts->flags & CLF_STRICT) - && ( map->type != CTOKT_SPACE + if ( !(opts->flags & CLF_STRICT) + && ( map->type != CTOKT_SPACE && map->type != CTOKT_WORD && map->type != CTOKT_CHAR ) ) { @@ -2206,13 +2205,13 @@ ClockScan( if (map->offs) { p = yyInput; x = p + size; if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { - if (_str2int((int *)(((char *)info) + map->offs), + if (_str2int((int *)(((char *)info) + map->offs), p, x, sign) != TCL_OK) { goto overflow; } p = x; } else { - if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), p, x, sign) != TCL_OK) { goto overflow; } @@ -2297,8 +2296,8 @@ ClockScan( tok++; } - /* - * Invalidate result + /* + * Invalidate result */ /* seconds token (%s) take precedence over all other tokens */ @@ -2332,17 +2331,17 @@ ClockScan( } /* YearWeekDay below YearMonthDay */ - if ( (flags & CLF_ISO8601) + if ( (flags & CLF_ISO8601) && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) - ) + ) ) { /* yy precedence below yyyy */ if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { /* normally precedence of ISO is higher, but no century - so put it down */ flags &= ~CLF_ISO8601; - } - else + } + else /* yymmdd or yyddd over naked weekday */ if (!(flags & CLF_ISO8601YEAR)) { flags &= ~CLF_ISO8601; @@ -2400,15 +2399,15 @@ ClockScan( overflow: - Tcl_SetResult(opts->interp, (char*)"requested date too large to represent", - TCL_STATIC); + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj("requested date too large to represent", + -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); goto done; not_match: - Tcl_SetResult(opts->interp, (char*)"input string does not match supplied format", - TCL_STATIC); + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj("input string does not match supplied format", + -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); done: @@ -2423,7 +2422,7 @@ FrmResultAllocate( { int needed = dateFmt->output + len - dateFmt->resEnd; if (needed >= 0) { /* >= 0 - regards NTS zero */ - int newsize = dateFmt->resEnd - dateFmt->resMem + int newsize = dateFmt->resEnd - dateFmt->resMem + needed + MIN_FMT_RESULT_BLOCK_ALLOC; char *newRes = ckrealloc(dateFmt->resMem, newsize); if (newRes == NULL) { @@ -2499,9 +2498,9 @@ ClockFmtToken_StarDate_Proc( if (FrmResultAllocate(dateFmt, 30) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, "Stardate ", 9); dateFmt->output += 9; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, dateFmt->date.year - RODDENBERRY, '0', 2); - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, fractYear, '0', 3); *dateFmt->output++ = '.'; /* be sure positive after decimal point (note: clock-value can be negative) */ @@ -2556,7 +2555,7 @@ ClockFmtToken_TimeZone_Proc( const char *s; int len; /* convert seconds to local seconds to obtain tzName object */ if (ConvertUTCToLocal(opts->clientData, opts->interp, - &dateFmt->date, opts->timezoneObj, + &dateFmt->date, opts->timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { return TCL_ERROR; }; @@ -2616,7 +2615,7 @@ ClockFmtToken_LocaleERAYear_Proc( return TCL_ERROR; } if (rowc != 0) { - dateFmt->localeEra = LookupLastTransition(opts->interp, + dateFmt->localeEra = LookupLastTransition(opts->interp, dateFmt->date.localSeconds, rowc, rowv, NULL); } if (dateFmt->localeEra == NULL) { @@ -2629,11 +2628,11 @@ ClockFmtToken_LocaleERAYear_Proc( if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; if (*tok->tokWord.start == 'C') { /* %EC */ *val = dateFmt->date.year / 100; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, *val, '0', 2); } else { /* %Ey */ *val = dateFmt->date.year % 100; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, *val, '0', 2); } } else { @@ -2667,7 +2666,7 @@ ClockFmtToken_LocaleERAYear_Proc( } else { /* year as integer */ if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, *val, '0', 2); return TCL_OK; } @@ -2682,7 +2681,7 @@ ClockFmtToken_LocaleERAYear_Proc( } -static const char *FmtSTokenMapIndex = +static const char *FmtSTokenMapIndex = "demNbByYCHMSIklpaAuwUVzgGjJsntQ"; static ClockFormatTokenMap FmtSTokenMap[] = { /* %d */ @@ -2712,15 +2711,15 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %S */ {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %I */ - {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %k */ {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %l */ - {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %p %P */ - {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_AMPM_Proc, NULL}, /* %a */ {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), @@ -2733,12 +2732,12 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %w */ {CFMTT_INT, " ", 1, 0, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL}, /* %U %W */ - {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), ClockFmtToken_WeekOfYear_Proc, NULL}, /* %V */ {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, /* %z %Z */ - {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_TimeZone_Proc, NULL}, /* %g */ {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, @@ -2755,7 +2754,7 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %t */ {CTOKT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, /* %Q */ - {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_StarDate_Proc, NULL}, }; static const char *FmtSTokenMapAliasIndex[2] = { @@ -2763,11 +2762,11 @@ static const char *FmtSTokenMapAliasIndex[2] = { "bpUz" }; -static const char *FmtETokenMapIndex = +static const char *FmtETokenMapIndex = "Eys"; static ClockFormatTokenMap FmtETokenMap[] = { /* %EE */ - {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), ClockFmtToken_LocaleERA_Proc, NULL}, /* %Ey %EC */ {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), @@ -2780,7 +2779,7 @@ static const char *FmtETokenMapAliasIndex[2] = { "y" }; -static const char *FmtOTokenMapIndex = +static const char *FmtOTokenMapIndex = "dmyHIMSuw"; static ClockFormatTokenMap FmtOTokenMap[] = { /* %Od %Oe */ @@ -2793,22 +2792,22 @@ static ClockFormatTokenMap FmtOTokenMap[] = { {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.year), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OH %Ok */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OI %Ol */ - {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OM */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OS */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ou */ {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ow */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *FmtOTokenMapAliasIndex[2] = { @@ -2866,7 +2865,7 @@ ClockGetOrParseFmtFormat( /* try to find modifier: */ switch (*p) { case '%': - /* begin new word token - don't join with previous word token, + /* begin new word token - don't join with previous word token, * because current mapping should be "...%%..." -> "...%..." */ tok->map = &FmtWordTokenMap; tok->tokWord.start = p; @@ -2876,7 +2875,7 @@ ClockGetOrParseFmtFormat( continue; break; case 'E': - fmtMap = FmtETokenMap, + fmtMap = FmtETokenMap, mapIndex = FmtETokenMapIndex, aliasIndex = FmtETokenMapAliasIndex; p++; @@ -2977,7 +2976,7 @@ ClockFormat( if (dateFmt->date.secondOfDay < 0) { dateFmt->date.secondOfDay += SECONDS_PER_DAY; } - + /* result container object */ dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); if (dateFmt->resMem == NULL) { diff --git a/generic/tclDate.c b/generic/tclDate.c index 64cb804..934fe5f 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -1,20 +1,20 @@ /* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -27,7 +27,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -2685,7 +2685,7 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * + * * ClockInitDateInfo(info) should be executed to pre-init info; */ diff --git a/generic/tclDate.h b/generic/tclDate.h index abc231b..570a8e4 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -109,7 +109,7 @@ typedef enum ClockMsgCtLiteral { MCLIT__NIL, /* placeholder */ MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, - MCLIT_AM, MCLIT_PM, + MCLIT_AM, MCLIT_PM, MCLIT_LOCALE_ERAS, MCLIT_BCE, MCLIT_CE, MCLIT_BCE2, MCLIT_CE2, @@ -486,16 +486,16 @@ MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * ClockMCGetIdx(ClockFmtScnCmdArgs *opts, int mcKey); -MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, +MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, Tcl_Obj *valObj); /* tclClockFmt.c module declarations */ -MODULE_SCOPE Tcl_Obj* +MODULE_SCOPE Tcl_Obj* ClockFrmObjGetLocFmtKey(Tcl_Interp *interp, Tcl_Obj *objPtr); -MODULE_SCOPE ClockFmtScnStorage * +MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); MODULE_SCOPE Tcl_Obj * @@ -504,7 +504,7 @@ MODULE_SCOPE Tcl_Obj * MODULE_SCOPE int ClockScan(register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); -MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, +MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, ClockFmtScnCmdArgs *opts); MODULE_SCOPE void ClockFrmScnClearCaches(void); diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 2480685..5b8deb6 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -328,7 +328,7 @@ TclNamespaceEnsembleCmd( } continue; case CRT_COMPILE: - if (Tcl_GetBooleanFromObj(interp, objv[1], + if (Tcl_GetBooleanFromObj(interp, objv[1], &ensCompFlag) != TCL_OK) { return TCL_ERROR; }; @@ -358,7 +358,7 @@ TclNamespaceEnsembleCmd( Tcl_SetEnsembleMappingDict(interp, token, mapObj); Tcl_SetEnsembleUnknownHandler(interp, token, unknownObj); Tcl_SetEnsembleParameterList(interp, token, paramObj); - /* + /* * Ensemble should be compiled if it has map (performance purposes) */ if (ensCompFlag > 0 && mapObj != NULL) { diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 0041a40..d05cc61 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -19,7 +19,7 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ /* MODULE_SCOPE */ -unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment +size_t TclEnvEpoch = 0; /* Epoch of the tcl environment * (if changed with tcl-env). */ static struct { diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 6d6a0d0..b83644b 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -896,7 +896,7 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * + * * ClockInitDateInfo(info) should be executed to pre-init info; */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 5bd4324..8edc518 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4875,7 +4875,7 @@ typedef struct NRE_callback { * Other externals. */ -MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment +MODULE_SCOPE size_t TclEnvEpoch; /* Epoch of the tcl environment * (if changed with tcl-env). */ #endif /* _TCLINT */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 0045ea5..557d575 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -1,7 +1,7 @@ /* * tclStrIdxTree.c -- * - * Contains the routines for managing string index tries in Tcl. + * Contains the routines for managing string index tries in Tcl. * * This code is back-ported from the tclSE engine, by Serg G. Brester. * @@ -12,11 +12,11 @@ * * ----------------------------------------------------------------------- * - * String index tries are prepaired structures used for fast greedy search of the string + * String index tries are prepaired structures used for fast greedy search of the string * (index) by unique string prefix as key. * * Index tree build for two lists together can be explained in the following datagram - * + * * Lists: * * {Januar Februar Maerz April Mai Juni Juli August September Oktober November Dezember} @@ -42,9 +42,9 @@ * i 5 * zb 12 * rz 3 * * ... - * + * * Thereby value 0 shows pure group items (corresponding ambigous matches). - * But the group may have a value if it contains only same values + * But the group may have a value if it contains only same values * (see for example group "f" above). * * StrIdxTree's are very fast, so: @@ -109,7 +109,7 @@ TclStrIdxTreeSearch( s = f; /* if match item, go deeper as long as possible */ if (offs >= item->length && item->childTree.firstPtr) { - /* save previuosly found item (if not ambigous) for + /* save previuosly found item (if not ambigous) for * possible fallback (few greedy match) */ if (item->value != NULL) { prevf = f; @@ -145,7 +145,7 @@ done: return start; } -MODULE_SCOPE void +MODULE_SCOPE void TclStrIdxTreeFree( TclStrIdx *tree) { @@ -157,13 +157,13 @@ TclStrIdxTreeFree( } t = tree, tree = tree->nextPtr; ckfree(t); - } + } } /* * Several bidirectional list primitives */ -inline void +inline void TclStrIdxTreeInsertBranch( TclStrIdxTree *parent, register TclStrIdx *item, @@ -282,7 +282,7 @@ TclStrIdxTreeBuildFromList( foundItem->length = lwrv[i]->length; continue; } - /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) + /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) * but don't split by fulfilled child of found item ( ii->iii->iiii ) */ if (foundItem->length != (f - s)) { /* first split found item (insert one between parent and found + new one) */ @@ -351,7 +351,7 @@ Tcl_ObjType StrIdxTreeObjType = { NULL /* setFromAnyProc */ }; -MODULE_SCOPE Tcl_Obj* +MODULE_SCOPE Tcl_Obj* TclStrIdxTreeNewObj() { Tcl_Obj *objPtr = Tcl_NewObj(); @@ -372,7 +372,7 @@ StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; } /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ - Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), + Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), srcPtr); copyPtr->internalRep.twoPtrValue.ptr2 = NULL; copyPtr->typePtr = &StrIdxTreeObjType; @@ -428,7 +428,7 @@ TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { #if 0 /* currently unused, debug resp. test purposes only */ -void +void TclStrIdxTreePrint( Tcl_Interp *interp, TclStrIdx *tree, @@ -439,7 +439,7 @@ TclStrIdxTreePrint( Tcl_InitObjRef(obj[0], Tcl_NewStringObj("::puts", -1)); while (tree != NULL) { s = TclGetString(tree->key) + offs; - Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", + Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", offs, "", tree->length - offs, s, tree->value)); Tcl_PutsObjCmd(NULL, interp, 2, obj); Tcl_UnsetObjRef(obj[1]); @@ -469,10 +469,10 @@ TclStrIdxTreeTestObjCmd( int optionIndex; if (objc < 2) { - Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); + Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], options, + if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, &optionIndex) != TCL_OK) { Tcl_SetErrorCode(interp, "CLOCK", "badOption", Tcl_GetString(objv[1]), NULL); @@ -481,7 +481,7 @@ TclStrIdxTreeTestObjCmd( switch (optionIndex) { case O_FINDEQUAL: if (objc < 4) { - Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); + Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } cs = TclGetString(objv[2]); @@ -499,7 +499,7 @@ TclStrIdxTreeTestObjCmd( TclStrIdxTree idxTree = {NULL, NULL}; i = 1; while (++i < objc) { - if (TclListObjGetElements(interp, objv[i], + if (TclListObjGetElements(interp, objv[i], &lstc, &lstv) != TCL_OK) { return TCL_ERROR; }; diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index 9f26907..6ed5170 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -1,7 +1,7 @@ /* * tclStrIdxTree.h -- * - * Declarations of string index tries and other primitives currently + * Declarations of string index tries and other primitives currently * back-ported from tclSE. * * Copyright (c) 2016 Serg G. Brester (aka sebres) @@ -38,7 +38,7 @@ typedef struct TclStrIdx { * * TclUtfFindEqual, TclUtfFindEqualNC -- * - * Find largest part of string cs in string cin (case sensitive and not). + * Find largest part of string cs in string cin (case sensitive and not). * * Results: * Return position of UTF character in cs after last equal character. @@ -148,13 +148,13 @@ if (1) { \ MODULE_SCOPE const char* TclStrIdxTreeSearch(TclStrIdxTree **foundParent, - TclStrIdx **foundItem, TclStrIdxTree *tree, + TclStrIdx **foundItem, TclStrIdxTree *tree, const char *start, const char *end); MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, int lstc, Tcl_Obj **lstv, ClientData *values); -MODULE_SCOPE Tcl_Obj* +MODULE_SCOPE Tcl_Obj* TclStrIdxTreeNewObj(); MODULE_SCOPE TclStrIdxTree* diff --git a/library/clock.tcl b/library/clock.tcl index 1f3c669..471deff 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -519,7 +519,7 @@ proc ::tcl::clock::Initialize {} { # Return the merged translation catalog for the ::tcl::clock namespace # Searching of catalog is similar to "msgcat::mc". # -# Contrary to "msgcat::mc" may additionally load a package catalog +# Contrary to "msgcat::mc" may additionally load a package catalog # on demand. # # Arguments: @@ -826,7 +826,7 @@ proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } { proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { variable LocaleFormats - + if { $fmtkey eq {} } { set fmtkey FMT_$format } if { [catch { set locfmt [dict get $LocaleFormats $locale $fmtkey] @@ -836,10 +836,10 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { if { [catch { set mlst [dict get $LocaleFormats $locale MLST] }] } { - + # message catalog dictionary: set mcd [mcget $locale] - + # Handle locale-dependent format groups by mapping them out of the format # string. Note that the order of the [string map] operations is # significant because later formats can refer to later ones; for example @@ -864,7 +864,7 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { dict set LocaleFormats $locale MLST $mlst } - # translate copy of format (don't use format object here, because otherwise + # translate copy of format (don't use format object here, because otherwise # it can lose its internal representation (string map - convert to unicode) set locfmt [string map $mlst [string range " $format" 1 end]] @@ -872,10 +872,10 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { dict set LocaleFormats $locale $fmtkey $locfmt } - # Save original format as long as possible, because of internal + # Save original format as long as possible, because of internal # representation (performance). # Note that in this case such format will be never localized (also - # using another locales). To prevent this return a duplicate (but + # using another locales). To prevent this return a duplicate (but # it may be slower). if {$locfmt eq $format} { set locfmt $format @@ -934,7 +934,7 @@ proc ::tcl::clock::GetSystemTimeZone {} { if { [dict exists $TimeZoneBad $timezone] } { set timezone :localtime } - + # tell backend - current system timezone: configure -system-tz $timezone diff --git a/library/init.tcl b/library/init.tcl index de69730..e500e3d 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -157,7 +157,7 @@ if {[interp issafe]} { package unknown {::tcl::tm::UnknownHandler ::tclPkgUnknown} } else { # Default known auto_index (avoid loading auto index implicit after interp create): - + array set ::auto_index { ::tcl::tm::UnknownHandler {source [info library]/tm.tcl} ::tclPkgUnknown {source [info library]/package.tcl} @@ -431,7 +431,7 @@ proc auto_load {cmd {namespace {}}} { # workaround non canonical auto_index entries that might be around # from older auto_mkindex versions if {$cmd ni $nameList} {lappend nameList $cmd} - + # try to load (and create sub-cmd handler "_sub_load_cmd" for further usage): foreach name $nameList [set _sub_load_cmd { # via auto_index: @@ -461,7 +461,7 @@ proc auto_load {cmd {namespace {}}} { } } }] - + # load auto_index if possible: if {![info exists auto_path]} { return 0 diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 375e366..2a30386 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -248,7 +248,7 @@ TclpWideClicksToNanoseconds( * * TclpWideClickInMicrosec -- * - * This procedure return scale to convert click values from the + * This procedure return scale to convert click values from the * TclpGetWideClicks native resolution to microsecond resolution * and back. * diff --git a/win/tclWinTime.c b/win/tclWinTime.c index e1aff48..db05cad 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -252,7 +252,7 @@ TclpGetWideClicks(void) /* * The frequency of the performance counter is fixed at system boot and - * is consistent across all processors. Therefore, the frequency need + * is consistent across all processors. Therefore, the frequency need * only be queried upon application initialization. */ if (QueryPerformanceFrequency(&perfCounterFreq)) { @@ -263,7 +263,7 @@ TclpGetWideClicks(void) wideClick.perfCounter = 0; wideClick.microsecsScale = 1; } - + wideClick.initialized = 1; } if (wideClick.perfCounter) { @@ -284,7 +284,7 @@ TclpGetWideClicks(void) * * TclpWideClickInMicrosec -- * - * This procedure return scale to convert wide click values from the + * This procedure return scale to convert wide click values from the * TclpGetWideClicks native resolution to microsecond resolution * and back. * @@ -323,7 +323,7 @@ TclpWideClickInMicrosec(void) *---------------------------------------------------------------------- */ -Tcl_WideInt +Tcl_WideInt TclpGetMicroseconds(void) { Tcl_WideInt usecSincePosixEpoch; -- cgit v0.12 From fcd399d49aee6b08b44aa50882a78c8d104c5e59 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 12:05:45 +0000 Subject: Fix [67aa9a207037ae67f9014b544c3db34fa732f2dc|67aa9a2070]: Security: Invalid UTF-8 can inject unexpected characters --- generic/tclUtf.c | 12 +++++++++--- tests/encoding.test | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 68119a4..fe47f0b 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -298,7 +298,9 @@ Tcl_UtfToUniChar( */ *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (src[1] & 0x3F)); - return 2; + if ((*chPtr == 0) || (*chPtr > 0x7f)) { + return 2; + } } /* @@ -313,7 +315,9 @@ Tcl_UtfToUniChar( *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12) | ((src[1] & 0x3F) << 6) | (src[2] & 0x3F)); - return 3; + if (*chPtr > 0x7ff) { + return 3; + } } /* @@ -330,7 +334,9 @@ Tcl_UtfToUniChar( *chPtr = (Tcl_UniChar) (((byte & 0x0E) << 18) | ((src[1] & 0x3F) << 12) | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); - return 4; + if ((*chPtr <= 0x10ffff) && (*chPtr > 0xffff)) { + return 4; + } } /* diff --git a/tests/encoding.test b/tests/encoding.test index 0374e2d..1d8bae5 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -448,6 +448,31 @@ test encoding-24.3 {EscapeFreeProc on open channels} {stdio} { list $count [viewable $line] } [list 3 "\u4e4e\u4e5e\u4e5f (\\u4e4e\\u4e5e\\u4e5f)"] +test encoding-24.4 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x80"] +} 1 +test encoding-24.5 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x81"] +} 2 +test encoding-24.6 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc1\xbf"] +} 2 +test encoding-24.7 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc2\x80"] +} 1 +test encoding-24.8 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x80\x80"] +} 3 +test encoding-24.9 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x9f\xbf"] +} 3 +test encoding-24.10 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\xa0\x80"] +} 1 +test encoding-24.10 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xef\xbf\xbf"] +} 1 + file delete [file join [temporaryDirectory] iso2022.txt] # -- cgit v0.12 From 3f0e8d6265db0d5853ab55de2ead9a045c678b6e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 13:03:54 +0000 Subject: Fix [83a3d869722fab9caaae3b6728215fb2507a6f0d|83a3d86972]: tclEpollNotfy.c fails to compile on Linux 2.6.<22 due to unconditionally including Also re-generate regc_locale.c with Unicode 10 tables: previous generation went horribly wrong somehow... --- generic/regc_locale.c | 5889 ++----------------------------------------------- unix/tclEpollNotfy.c | 2 + 2 files changed, 158 insertions(+), 5733 deletions(-) diff --git a/generic/regc_locale.c b/generic/regc_locale.c index f0e8439..d781212 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -193,1053 +193,55 @@ static const crange alphaRangeTable[] = { {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, - {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, + {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, + {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd00, 0xdd3e}, + {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, {0xde00, 0xde3e}, + {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, + {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} #if TCL_UTF_MAX > 4 - ,{0x10041, 0x1005a}, {0x10061, 0x1007a}, {0x100c0, 0x100d6}, {0x100d8, 0x100f6}, - {0x100f8, 0x102c1}, {0x102c6, 0x102d1}, {0x102e0, 0x102e4}, {0x10370, 0x10374}, - {0x1037a, 0x1037d}, {0x10388, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x103f5}, - {0x103f7, 0x10481}, {0x1048a, 0x1052f}, {0x10531, 0x10556}, {0x10561, 0x10587}, - {0x105d0, 0x105ea}, {0x105f0, 0x105f2}, {0x10620, 0x1064a}, {0x10671, 0x106d3}, - {0x106fa, 0x106fc}, {0x10712, 0x1072f}, {0x1074d, 0x107a5}, {0x107ca, 0x107ea}, - {0x10800, 0x10815}, {0x10840, 0x10858}, {0x10860, 0x1086a}, {0x108a0, 0x108b4}, - {0x108b6, 0x108bd}, {0x10904, 0x10939}, {0x10958, 0x10961}, {0x10971, 0x10980}, - {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, - {0x109df, 0x109e1}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, - {0x10a59, 0x10a5c}, {0x10a72, 0x10a74}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, - {0x10a93, 0x10aa8}, {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10b05, 0x10b0c}, - {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, {0x10b35, 0x10b39}, {0x10b5f, 0x10b61}, - {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, {0x10ba8, 0x10baa}, - {0x10bae, 0x10bb9}, {0x10c05, 0x10c0c}, {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, - {0x10c2a, 0x10c39}, {0x10c58, 0x10c5a}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, - {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10d05, 0x10d0c}, - {0x10d0e, 0x10d10}, {0x10d12, 0x10d3a}, {0x10d54, 0x10d56}, {0x10d5f, 0x10d61}, - {0x10d7a, 0x10d7f}, {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, - {0x10dc0, 0x10dc6}, {0x10e01, 0x10e30}, {0x10e40, 0x10e46}, {0x10e94, 0x10e97}, - {0x10e99, 0x10e9f}, {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb0}, {0x10ec0, 0x10ec4}, - {0x10edc, 0x10edf}, {0x10f40, 0x10f47}, {0x10f49, 0x10f6c}, {0x10f88, 0x10f8c}, - {0x11000, 0x1102a}, {0x11050, 0x11055}, {0x1105a, 0x1105d}, {0x1106e, 0x11070}, - {0x11075, 0x11081}, {0x110a0, 0x110c5}, {0x110d0, 0x110fa}, {0x110fc, 0x11248}, - {0x1124a, 0x1124d}, {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, - {0x1128a, 0x1128d}, {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, - {0x112c2, 0x112c5}, {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, - {0x11318, 0x1135a}, {0x11380, 0x1138f}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, - {0x11401, 0x1166c}, {0x1166f, 0x1167f}, {0x11681, 0x1169a}, {0x116a0, 0x116ea}, - {0x116f1, 0x116f8}, {0x11700, 0x1170c}, {0x1170e, 0x11711}, {0x11720, 0x11731}, - {0x11740, 0x11751}, {0x11760, 0x1176c}, {0x1176e, 0x11770}, {0x11780, 0x117b3}, - {0x11820, 0x11877}, {0x11880, 0x11884}, {0x11887, 0x118a8}, {0x118b0, 0x118f5}, - {0x11900, 0x1191e}, {0x11950, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, - {0x119b0, 0x119c9}, {0x11a00, 0x11a16}, {0x11a20, 0x11a54}, {0x11b05, 0x11b33}, - {0x11b45, 0x11b4b}, {0x11b83, 0x11ba0}, {0x11bba, 0x11be5}, {0x11c00, 0x11c23}, - {0x11c4d, 0x11c4f}, {0x11c5a, 0x11c7d}, {0x11c80, 0x11c88}, {0x11ce9, 0x11cec}, - {0x11cee, 0x11cf1}, {0x11d00, 0x11dbf}, {0x11e00, 0x11f15}, {0x11f18, 0x11f1d}, - {0x11f20, 0x11f45}, {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, - {0x11f80, 0x11fb4}, {0x11fb6, 0x11fbc}, {0x11fc2, 0x11fc4}, {0x11fc6, 0x11fcc}, - {0x11fd0, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fe0, 0x11fec}, {0x11ff2, 0x11ff4}, - {0x11ff6, 0x11ffc}, {0x12090, 0x1209c}, {0x1210a, 0x12113}, {0x12119, 0x1211d}, - {0x1212a, 0x1212d}, {0x1212f, 0x12139}, {0x1213c, 0x1213f}, {0x12145, 0x12149}, - {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12ce4}, {0x12ceb, 0x12cee}, - {0x12d00, 0x12d25}, {0x12d30, 0x12d67}, {0x12d80, 0x12d96}, {0x12da0, 0x12da6}, - {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, - {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x13031, 0x13035}, - {0x13041, 0x13096}, {0x1309d, 0x1309f}, {0x130a1, 0x130fa}, {0x130fc, 0x130ff}, - {0x13105, 0x1312e}, {0x13131, 0x1318e}, {0x131a0, 0x131ba}, {0x131f0, 0x131ff}, - {0x13400, 0x14db5}, {0x14e00, 0x19fea}, {0x1a000, 0x1a48c}, {0x1a4d0, 0x1a4fd}, - {0x1a500, 0x1a60c}, {0x1a610, 0x1a61f}, {0x1a640, 0x1a66e}, {0x1a67f, 0x1a69d}, - {0x1a6a0, 0x1a6e5}, {0x1a717, 0x1a71f}, {0x1a722, 0x1a788}, {0x1a78b, 0x1a7ae}, - {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a801}, {0x1a803, 0x1a805}, {0x1a807, 0x1a80a}, - {0x1a80c, 0x1a822}, {0x1a840, 0x1a873}, {0x1a882, 0x1a8b3}, {0x1a8f2, 0x1a8f7}, - {0x1a90a, 0x1a925}, {0x1a930, 0x1a946}, {0x1a960, 0x1a97c}, {0x1a984, 0x1a9b2}, - {0x1a9e0, 0x1a9e4}, {0x1a9e6, 0x1a9ef}, {0x1a9fa, 0x1a9fe}, {0x1aa00, 0x1aa28}, - {0x1aa40, 0x1aa42}, {0x1aa44, 0x1aa4b}, {0x1aa60, 0x1aa76}, {0x1aa7e, 0x1aaaf}, - {0x1aab9, 0x1aabd}, {0x1aadb, 0x1aadd}, {0x1aae0, 0x1aaea}, {0x1aaf2, 0x1aaf4}, - {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, {0x1ab20, 0x1ab26}, - {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab5a}, {0x1ab5c, 0x1ab65}, {0x1ab70, 0x1abe2}, - {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, {0x1f900, 0x1fa6d}, - {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, {0x1fb1f, 0x1fb28}, - {0x1fb2a, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbb1}, {0x1fbd3, 0x1fd3d}, - {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfb}, {0x1fe70, 0x1fe74}, - {0x1fe76, 0x1fefc}, {0x1ff21, 0x1ff3a}, {0x1ff41, 0x1ff5a}, {0x1ff66, 0x1ffbe}, - {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, - {0x20041, 0x2005a}, {0x20061, 0x2007a}, {0x200c0, 0x200d6}, {0x200d8, 0x200f6}, - {0x200f8, 0x202c1}, {0x202c6, 0x202d1}, {0x202e0, 0x202e4}, {0x20370, 0x20374}, - {0x2037a, 0x2037d}, {0x20388, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x203f5}, - {0x203f7, 0x20481}, {0x2048a, 0x2052f}, {0x20531, 0x20556}, {0x20561, 0x20587}, - {0x205d0, 0x205ea}, {0x205f0, 0x205f2}, {0x20620, 0x2064a}, {0x20671, 0x206d3}, - {0x206fa, 0x206fc}, {0x20712, 0x2072f}, {0x2074d, 0x207a5}, {0x207ca, 0x207ea}, - {0x20800, 0x20815}, {0x20840, 0x20858}, {0x20860, 0x2086a}, {0x208a0, 0x208b4}, - {0x208b6, 0x208bd}, {0x20904, 0x20939}, {0x20958, 0x20961}, {0x20971, 0x20980}, - {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, - {0x209df, 0x209e1}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, - {0x20a59, 0x20a5c}, {0x20a72, 0x20a74}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, - {0x20a93, 0x20aa8}, {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20b05, 0x20b0c}, - {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, {0x20b35, 0x20b39}, {0x20b5f, 0x20b61}, - {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, {0x20ba8, 0x20baa}, - {0x20bae, 0x20bb9}, {0x20c05, 0x20c0c}, {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, - {0x20c2a, 0x20c39}, {0x20c58, 0x20c5a}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, - {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20d05, 0x20d0c}, - {0x20d0e, 0x20d10}, {0x20d12, 0x20d3a}, {0x20d54, 0x20d56}, {0x20d5f, 0x20d61}, - {0x20d7a, 0x20d7f}, {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, - {0x20dc0, 0x20dc6}, {0x20e01, 0x20e30}, {0x20e40, 0x20e46}, {0x20e94, 0x20e97}, - {0x20e99, 0x20e9f}, {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb0}, {0x20ec0, 0x20ec4}, - {0x20edc, 0x20edf}, {0x20f40, 0x20f47}, {0x20f49, 0x20f6c}, {0x20f88, 0x20f8c}, - {0x21000, 0x2102a}, {0x21050, 0x21055}, {0x2105a, 0x2105d}, {0x2106e, 0x21070}, - {0x21075, 0x21081}, {0x210a0, 0x210c5}, {0x210d0, 0x210fa}, {0x210fc, 0x21248}, - {0x2124a, 0x2124d}, {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, - {0x2128a, 0x2128d}, {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, - {0x212c2, 0x212c5}, {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, - {0x21318, 0x2135a}, {0x21380, 0x2138f}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, - {0x21401, 0x2166c}, {0x2166f, 0x2167f}, {0x21681, 0x2169a}, {0x216a0, 0x216ea}, - {0x216f1, 0x216f8}, {0x21700, 0x2170c}, {0x2170e, 0x21711}, {0x21720, 0x21731}, - {0x21740, 0x21751}, {0x21760, 0x2176c}, {0x2176e, 0x21770}, {0x21780, 0x217b3}, - {0x21820, 0x21877}, {0x21880, 0x21884}, {0x21887, 0x218a8}, {0x218b0, 0x218f5}, - {0x21900, 0x2191e}, {0x21950, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, - {0x219b0, 0x219c9}, {0x21a00, 0x21a16}, {0x21a20, 0x21a54}, {0x21b05, 0x21b33}, - {0x21b45, 0x21b4b}, {0x21b83, 0x21ba0}, {0x21bba, 0x21be5}, {0x21c00, 0x21c23}, - {0x21c4d, 0x21c4f}, {0x21c5a, 0x21c7d}, {0x21c80, 0x21c88}, {0x21ce9, 0x21cec}, - {0x21cee, 0x21cf1}, {0x21d00, 0x21dbf}, {0x21e00, 0x21f15}, {0x21f18, 0x21f1d}, - {0x21f20, 0x21f45}, {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, - {0x21f80, 0x21fb4}, {0x21fb6, 0x21fbc}, {0x21fc2, 0x21fc4}, {0x21fc6, 0x21fcc}, - {0x21fd0, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fe0, 0x21fec}, {0x21ff2, 0x21ff4}, - {0x21ff6, 0x21ffc}, {0x22090, 0x2209c}, {0x2210a, 0x22113}, {0x22119, 0x2211d}, - {0x2212a, 0x2212d}, {0x2212f, 0x22139}, {0x2213c, 0x2213f}, {0x22145, 0x22149}, - {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22ce4}, {0x22ceb, 0x22cee}, - {0x22d00, 0x22d25}, {0x22d30, 0x22d67}, {0x22d80, 0x22d96}, {0x22da0, 0x22da6}, - {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, - {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x23031, 0x23035}, - {0x23041, 0x23096}, {0x2309d, 0x2309f}, {0x230a1, 0x230fa}, {0x230fc, 0x230ff}, - {0x23105, 0x2312e}, {0x23131, 0x2318e}, {0x231a0, 0x231ba}, {0x231f0, 0x231ff}, - {0x23400, 0x24db5}, {0x24e00, 0x29fea}, {0x2a000, 0x2a48c}, {0x2a4d0, 0x2a4fd}, - {0x2a500, 0x2a60c}, {0x2a610, 0x2a61f}, {0x2a640, 0x2a66e}, {0x2a67f, 0x2a69d}, - {0x2a6a0, 0x2a6e5}, {0x2a717, 0x2a71f}, {0x2a722, 0x2a788}, {0x2a78b, 0x2a7ae}, - {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a801}, {0x2a803, 0x2a805}, {0x2a807, 0x2a80a}, - {0x2a80c, 0x2a822}, {0x2a840, 0x2a873}, {0x2a882, 0x2a8b3}, {0x2a8f2, 0x2a8f7}, - {0x2a90a, 0x2a925}, {0x2a930, 0x2a946}, {0x2a960, 0x2a97c}, {0x2a984, 0x2a9b2}, - {0x2a9e0, 0x2a9e4}, {0x2a9e6, 0x2a9ef}, {0x2a9fa, 0x2a9fe}, {0x2aa00, 0x2aa28}, - {0x2aa40, 0x2aa42}, {0x2aa44, 0x2aa4b}, {0x2aa60, 0x2aa76}, {0x2aa7e, 0x2aaaf}, - {0x2aab9, 0x2aabd}, {0x2aadb, 0x2aadd}, {0x2aae0, 0x2aaea}, {0x2aaf2, 0x2aaf4}, - {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, {0x2ab20, 0x2ab26}, - {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab5a}, {0x2ab5c, 0x2ab65}, {0x2ab70, 0x2abe2}, - {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, {0x2f900, 0x2fa6d}, - {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2fb1f, 0x2fb28}, - {0x2fb2a, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbb1}, {0x2fbd3, 0x2fd3d}, - {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfb}, {0x2fe70, 0x2fe74}, - {0x2fe76, 0x2fefc}, {0x2ff21, 0x2ff3a}, {0x2ff41, 0x2ff5a}, {0x2ff66, 0x2ffbe}, - {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, - {0x30041, 0x3005a}, {0x30061, 0x3007a}, {0x300c0, 0x300d6}, {0x300d8, 0x300f6}, - {0x300f8, 0x302c1}, {0x302c6, 0x302d1}, {0x302e0, 0x302e4}, {0x30370, 0x30374}, - {0x3037a, 0x3037d}, {0x30388, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x303f5}, - {0x303f7, 0x30481}, {0x3048a, 0x3052f}, {0x30531, 0x30556}, {0x30561, 0x30587}, - {0x305d0, 0x305ea}, {0x305f0, 0x305f2}, {0x30620, 0x3064a}, {0x30671, 0x306d3}, - {0x306fa, 0x306fc}, {0x30712, 0x3072f}, {0x3074d, 0x307a5}, {0x307ca, 0x307ea}, - {0x30800, 0x30815}, {0x30840, 0x30858}, {0x30860, 0x3086a}, {0x308a0, 0x308b4}, - {0x308b6, 0x308bd}, {0x30904, 0x30939}, {0x30958, 0x30961}, {0x30971, 0x30980}, - {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, - {0x309df, 0x309e1}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, - {0x30a59, 0x30a5c}, {0x30a72, 0x30a74}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, - {0x30a93, 0x30aa8}, {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30b05, 0x30b0c}, - {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, {0x30b35, 0x30b39}, {0x30b5f, 0x30b61}, - {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, {0x30ba8, 0x30baa}, - {0x30bae, 0x30bb9}, {0x30c05, 0x30c0c}, {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, - {0x30c2a, 0x30c39}, {0x30c58, 0x30c5a}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, - {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30d05, 0x30d0c}, - {0x30d0e, 0x30d10}, {0x30d12, 0x30d3a}, {0x30d54, 0x30d56}, {0x30d5f, 0x30d61}, - {0x30d7a, 0x30d7f}, {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, - {0x30dc0, 0x30dc6}, {0x30e01, 0x30e30}, {0x30e40, 0x30e46}, {0x30e94, 0x30e97}, - {0x30e99, 0x30e9f}, {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb0}, {0x30ec0, 0x30ec4}, - {0x30edc, 0x30edf}, {0x30f40, 0x30f47}, {0x30f49, 0x30f6c}, {0x30f88, 0x30f8c}, - {0x31000, 0x3102a}, {0x31050, 0x31055}, {0x3105a, 0x3105d}, {0x3106e, 0x31070}, - {0x31075, 0x31081}, {0x310a0, 0x310c5}, {0x310d0, 0x310fa}, {0x310fc, 0x31248}, - {0x3124a, 0x3124d}, {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, - {0x3128a, 0x3128d}, {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, - {0x312c2, 0x312c5}, {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, - {0x31318, 0x3135a}, {0x31380, 0x3138f}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, - {0x31401, 0x3166c}, {0x3166f, 0x3167f}, {0x31681, 0x3169a}, {0x316a0, 0x316ea}, - {0x316f1, 0x316f8}, {0x31700, 0x3170c}, {0x3170e, 0x31711}, {0x31720, 0x31731}, - {0x31740, 0x31751}, {0x31760, 0x3176c}, {0x3176e, 0x31770}, {0x31780, 0x317b3}, - {0x31820, 0x31877}, {0x31880, 0x31884}, {0x31887, 0x318a8}, {0x318b0, 0x318f5}, - {0x31900, 0x3191e}, {0x31950, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, - {0x319b0, 0x319c9}, {0x31a00, 0x31a16}, {0x31a20, 0x31a54}, {0x31b05, 0x31b33}, - {0x31b45, 0x31b4b}, {0x31b83, 0x31ba0}, {0x31bba, 0x31be5}, {0x31c00, 0x31c23}, - {0x31c4d, 0x31c4f}, {0x31c5a, 0x31c7d}, {0x31c80, 0x31c88}, {0x31ce9, 0x31cec}, - {0x31cee, 0x31cf1}, {0x31d00, 0x31dbf}, {0x31e00, 0x31f15}, {0x31f18, 0x31f1d}, - {0x31f20, 0x31f45}, {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, - {0x31f80, 0x31fb4}, {0x31fb6, 0x31fbc}, {0x31fc2, 0x31fc4}, {0x31fc6, 0x31fcc}, - {0x31fd0, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fe0, 0x31fec}, {0x31ff2, 0x31ff4}, - {0x31ff6, 0x31ffc}, {0x32090, 0x3209c}, {0x3210a, 0x32113}, {0x32119, 0x3211d}, - {0x3212a, 0x3212d}, {0x3212f, 0x32139}, {0x3213c, 0x3213f}, {0x32145, 0x32149}, - {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32ce4}, {0x32ceb, 0x32cee}, - {0x32d00, 0x32d25}, {0x32d30, 0x32d67}, {0x32d80, 0x32d96}, {0x32da0, 0x32da6}, - {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, - {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x33031, 0x33035}, - {0x33041, 0x33096}, {0x3309d, 0x3309f}, {0x330a1, 0x330fa}, {0x330fc, 0x330ff}, - {0x33105, 0x3312e}, {0x33131, 0x3318e}, {0x331a0, 0x331ba}, {0x331f0, 0x331ff}, - {0x33400, 0x34db5}, {0x34e00, 0x39fea}, {0x3a000, 0x3a48c}, {0x3a4d0, 0x3a4fd}, - {0x3a500, 0x3a60c}, {0x3a610, 0x3a61f}, {0x3a640, 0x3a66e}, {0x3a67f, 0x3a69d}, - {0x3a6a0, 0x3a6e5}, {0x3a717, 0x3a71f}, {0x3a722, 0x3a788}, {0x3a78b, 0x3a7ae}, - {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a801}, {0x3a803, 0x3a805}, {0x3a807, 0x3a80a}, - {0x3a80c, 0x3a822}, {0x3a840, 0x3a873}, {0x3a882, 0x3a8b3}, {0x3a8f2, 0x3a8f7}, - {0x3a90a, 0x3a925}, {0x3a930, 0x3a946}, {0x3a960, 0x3a97c}, {0x3a984, 0x3a9b2}, - {0x3a9e0, 0x3a9e4}, {0x3a9e6, 0x3a9ef}, {0x3a9fa, 0x3a9fe}, {0x3aa00, 0x3aa28}, - {0x3aa40, 0x3aa42}, {0x3aa44, 0x3aa4b}, {0x3aa60, 0x3aa76}, {0x3aa7e, 0x3aaaf}, - {0x3aab9, 0x3aabd}, {0x3aadb, 0x3aadd}, {0x3aae0, 0x3aaea}, {0x3aaf2, 0x3aaf4}, - {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, {0x3ab20, 0x3ab26}, - {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab5a}, {0x3ab5c, 0x3ab65}, {0x3ab70, 0x3abe2}, - {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, {0x3f900, 0x3fa6d}, - {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, {0x3fb1f, 0x3fb28}, - {0x3fb2a, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbb1}, {0x3fbd3, 0x3fd3d}, - {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfb}, {0x3fe70, 0x3fe74}, - {0x3fe76, 0x3fefc}, {0x3ff21, 0x3ff3a}, {0x3ff41, 0x3ff5a}, {0x3ff66, 0x3ffbe}, - {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, - {0x40041, 0x4005a}, {0x40061, 0x4007a}, {0x400c0, 0x400d6}, {0x400d8, 0x400f6}, - {0x400f8, 0x402c1}, {0x402c6, 0x402d1}, {0x402e0, 0x402e4}, {0x40370, 0x40374}, - {0x4037a, 0x4037d}, {0x40388, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x403f5}, - {0x403f7, 0x40481}, {0x4048a, 0x4052f}, {0x40531, 0x40556}, {0x40561, 0x40587}, - {0x405d0, 0x405ea}, {0x405f0, 0x405f2}, {0x40620, 0x4064a}, {0x40671, 0x406d3}, - {0x406fa, 0x406fc}, {0x40712, 0x4072f}, {0x4074d, 0x407a5}, {0x407ca, 0x407ea}, - {0x40800, 0x40815}, {0x40840, 0x40858}, {0x40860, 0x4086a}, {0x408a0, 0x408b4}, - {0x408b6, 0x408bd}, {0x40904, 0x40939}, {0x40958, 0x40961}, {0x40971, 0x40980}, - {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, - {0x409df, 0x409e1}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, - {0x40a59, 0x40a5c}, {0x40a72, 0x40a74}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, - {0x40a93, 0x40aa8}, {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40b05, 0x40b0c}, - {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, {0x40b35, 0x40b39}, {0x40b5f, 0x40b61}, - {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, {0x40ba8, 0x40baa}, - {0x40bae, 0x40bb9}, {0x40c05, 0x40c0c}, {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, - {0x40c2a, 0x40c39}, {0x40c58, 0x40c5a}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, - {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40d05, 0x40d0c}, - {0x40d0e, 0x40d10}, {0x40d12, 0x40d3a}, {0x40d54, 0x40d56}, {0x40d5f, 0x40d61}, - {0x40d7a, 0x40d7f}, {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, - {0x40dc0, 0x40dc6}, {0x40e01, 0x40e30}, {0x40e40, 0x40e46}, {0x40e94, 0x40e97}, - {0x40e99, 0x40e9f}, {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb0}, {0x40ec0, 0x40ec4}, - {0x40edc, 0x40edf}, {0x40f40, 0x40f47}, {0x40f49, 0x40f6c}, {0x40f88, 0x40f8c}, - {0x41000, 0x4102a}, {0x41050, 0x41055}, {0x4105a, 0x4105d}, {0x4106e, 0x41070}, - {0x41075, 0x41081}, {0x410a0, 0x410c5}, {0x410d0, 0x410fa}, {0x410fc, 0x41248}, - {0x4124a, 0x4124d}, {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, - {0x4128a, 0x4128d}, {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, - {0x412c2, 0x412c5}, {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, - {0x41318, 0x4135a}, {0x41380, 0x4138f}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, - {0x41401, 0x4166c}, {0x4166f, 0x4167f}, {0x41681, 0x4169a}, {0x416a0, 0x416ea}, - {0x416f1, 0x416f8}, {0x41700, 0x4170c}, {0x4170e, 0x41711}, {0x41720, 0x41731}, - {0x41740, 0x41751}, {0x41760, 0x4176c}, {0x4176e, 0x41770}, {0x41780, 0x417b3}, - {0x41820, 0x41877}, {0x41880, 0x41884}, {0x41887, 0x418a8}, {0x418b0, 0x418f5}, - {0x41900, 0x4191e}, {0x41950, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, - {0x419b0, 0x419c9}, {0x41a00, 0x41a16}, {0x41a20, 0x41a54}, {0x41b05, 0x41b33}, - {0x41b45, 0x41b4b}, {0x41b83, 0x41ba0}, {0x41bba, 0x41be5}, {0x41c00, 0x41c23}, - {0x41c4d, 0x41c4f}, {0x41c5a, 0x41c7d}, {0x41c80, 0x41c88}, {0x41ce9, 0x41cec}, - {0x41cee, 0x41cf1}, {0x41d00, 0x41dbf}, {0x41e00, 0x41f15}, {0x41f18, 0x41f1d}, - {0x41f20, 0x41f45}, {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, - {0x41f80, 0x41fb4}, {0x41fb6, 0x41fbc}, {0x41fc2, 0x41fc4}, {0x41fc6, 0x41fcc}, - {0x41fd0, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fe0, 0x41fec}, {0x41ff2, 0x41ff4}, - {0x41ff6, 0x41ffc}, {0x42090, 0x4209c}, {0x4210a, 0x42113}, {0x42119, 0x4211d}, - {0x4212a, 0x4212d}, {0x4212f, 0x42139}, {0x4213c, 0x4213f}, {0x42145, 0x42149}, - {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42ce4}, {0x42ceb, 0x42cee}, - {0x42d00, 0x42d25}, {0x42d30, 0x42d67}, {0x42d80, 0x42d96}, {0x42da0, 0x42da6}, - {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, - {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x43031, 0x43035}, - {0x43041, 0x43096}, {0x4309d, 0x4309f}, {0x430a1, 0x430fa}, {0x430fc, 0x430ff}, - {0x43105, 0x4312e}, {0x43131, 0x4318e}, {0x431a0, 0x431ba}, {0x431f0, 0x431ff}, - {0x43400, 0x44db5}, {0x44e00, 0x49fea}, {0x4a000, 0x4a48c}, {0x4a4d0, 0x4a4fd}, - {0x4a500, 0x4a60c}, {0x4a610, 0x4a61f}, {0x4a640, 0x4a66e}, {0x4a67f, 0x4a69d}, - {0x4a6a0, 0x4a6e5}, {0x4a717, 0x4a71f}, {0x4a722, 0x4a788}, {0x4a78b, 0x4a7ae}, - {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a801}, {0x4a803, 0x4a805}, {0x4a807, 0x4a80a}, - {0x4a80c, 0x4a822}, {0x4a840, 0x4a873}, {0x4a882, 0x4a8b3}, {0x4a8f2, 0x4a8f7}, - {0x4a90a, 0x4a925}, {0x4a930, 0x4a946}, {0x4a960, 0x4a97c}, {0x4a984, 0x4a9b2}, - {0x4a9e0, 0x4a9e4}, {0x4a9e6, 0x4a9ef}, {0x4a9fa, 0x4a9fe}, {0x4aa00, 0x4aa28}, - {0x4aa40, 0x4aa42}, {0x4aa44, 0x4aa4b}, {0x4aa60, 0x4aa76}, {0x4aa7e, 0x4aaaf}, - {0x4aab9, 0x4aabd}, {0x4aadb, 0x4aadd}, {0x4aae0, 0x4aaea}, {0x4aaf2, 0x4aaf4}, - {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, {0x4ab20, 0x4ab26}, - {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab5a}, {0x4ab5c, 0x4ab65}, {0x4ab70, 0x4abe2}, - {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, {0x4f900, 0x4fa6d}, - {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4fb1f, 0x4fb28}, - {0x4fb2a, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbb1}, {0x4fbd3, 0x4fd3d}, - {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfb}, {0x4fe70, 0x4fe74}, - {0x4fe76, 0x4fefc}, {0x4ff21, 0x4ff3a}, {0x4ff41, 0x4ff5a}, {0x4ff66, 0x4ffbe}, - {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, - {0x50041, 0x5005a}, {0x50061, 0x5007a}, {0x500c0, 0x500d6}, {0x500d8, 0x500f6}, - {0x500f8, 0x502c1}, {0x502c6, 0x502d1}, {0x502e0, 0x502e4}, {0x50370, 0x50374}, - {0x5037a, 0x5037d}, {0x50388, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x503f5}, - {0x503f7, 0x50481}, {0x5048a, 0x5052f}, {0x50531, 0x50556}, {0x50561, 0x50587}, - {0x505d0, 0x505ea}, {0x505f0, 0x505f2}, {0x50620, 0x5064a}, {0x50671, 0x506d3}, - {0x506fa, 0x506fc}, {0x50712, 0x5072f}, {0x5074d, 0x507a5}, {0x507ca, 0x507ea}, - {0x50800, 0x50815}, {0x50840, 0x50858}, {0x50860, 0x5086a}, {0x508a0, 0x508b4}, - {0x508b6, 0x508bd}, {0x50904, 0x50939}, {0x50958, 0x50961}, {0x50971, 0x50980}, - {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, - {0x509df, 0x509e1}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, - {0x50a59, 0x50a5c}, {0x50a72, 0x50a74}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, - {0x50a93, 0x50aa8}, {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50b05, 0x50b0c}, - {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, {0x50b35, 0x50b39}, {0x50b5f, 0x50b61}, - {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, {0x50ba8, 0x50baa}, - {0x50bae, 0x50bb9}, {0x50c05, 0x50c0c}, {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, - {0x50c2a, 0x50c39}, {0x50c58, 0x50c5a}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, - {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50d05, 0x50d0c}, - {0x50d0e, 0x50d10}, {0x50d12, 0x50d3a}, {0x50d54, 0x50d56}, {0x50d5f, 0x50d61}, - {0x50d7a, 0x50d7f}, {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, - {0x50dc0, 0x50dc6}, {0x50e01, 0x50e30}, {0x50e40, 0x50e46}, {0x50e94, 0x50e97}, - {0x50e99, 0x50e9f}, {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb0}, {0x50ec0, 0x50ec4}, - {0x50edc, 0x50edf}, {0x50f40, 0x50f47}, {0x50f49, 0x50f6c}, {0x50f88, 0x50f8c}, - {0x51000, 0x5102a}, {0x51050, 0x51055}, {0x5105a, 0x5105d}, {0x5106e, 0x51070}, - {0x51075, 0x51081}, {0x510a0, 0x510c5}, {0x510d0, 0x510fa}, {0x510fc, 0x51248}, - {0x5124a, 0x5124d}, {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, - {0x5128a, 0x5128d}, {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, - {0x512c2, 0x512c5}, {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, - {0x51318, 0x5135a}, {0x51380, 0x5138f}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, - {0x51401, 0x5166c}, {0x5166f, 0x5167f}, {0x51681, 0x5169a}, {0x516a0, 0x516ea}, - {0x516f1, 0x516f8}, {0x51700, 0x5170c}, {0x5170e, 0x51711}, {0x51720, 0x51731}, - {0x51740, 0x51751}, {0x51760, 0x5176c}, {0x5176e, 0x51770}, {0x51780, 0x517b3}, - {0x51820, 0x51877}, {0x51880, 0x51884}, {0x51887, 0x518a8}, {0x518b0, 0x518f5}, - {0x51900, 0x5191e}, {0x51950, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, - {0x519b0, 0x519c9}, {0x51a00, 0x51a16}, {0x51a20, 0x51a54}, {0x51b05, 0x51b33}, - {0x51b45, 0x51b4b}, {0x51b83, 0x51ba0}, {0x51bba, 0x51be5}, {0x51c00, 0x51c23}, - {0x51c4d, 0x51c4f}, {0x51c5a, 0x51c7d}, {0x51c80, 0x51c88}, {0x51ce9, 0x51cec}, - {0x51cee, 0x51cf1}, {0x51d00, 0x51dbf}, {0x51e00, 0x51f15}, {0x51f18, 0x51f1d}, - {0x51f20, 0x51f45}, {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, - {0x51f80, 0x51fb4}, {0x51fb6, 0x51fbc}, {0x51fc2, 0x51fc4}, {0x51fc6, 0x51fcc}, - {0x51fd0, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fe0, 0x51fec}, {0x51ff2, 0x51ff4}, - {0x51ff6, 0x51ffc}, {0x52090, 0x5209c}, {0x5210a, 0x52113}, {0x52119, 0x5211d}, - {0x5212a, 0x5212d}, {0x5212f, 0x52139}, {0x5213c, 0x5213f}, {0x52145, 0x52149}, - {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52ce4}, {0x52ceb, 0x52cee}, - {0x52d00, 0x52d25}, {0x52d30, 0x52d67}, {0x52d80, 0x52d96}, {0x52da0, 0x52da6}, - {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, - {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x53031, 0x53035}, - {0x53041, 0x53096}, {0x5309d, 0x5309f}, {0x530a1, 0x530fa}, {0x530fc, 0x530ff}, - {0x53105, 0x5312e}, {0x53131, 0x5318e}, {0x531a0, 0x531ba}, {0x531f0, 0x531ff}, - {0x53400, 0x54db5}, {0x54e00, 0x59fea}, {0x5a000, 0x5a48c}, {0x5a4d0, 0x5a4fd}, - {0x5a500, 0x5a60c}, {0x5a610, 0x5a61f}, {0x5a640, 0x5a66e}, {0x5a67f, 0x5a69d}, - {0x5a6a0, 0x5a6e5}, {0x5a717, 0x5a71f}, {0x5a722, 0x5a788}, {0x5a78b, 0x5a7ae}, - {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a801}, {0x5a803, 0x5a805}, {0x5a807, 0x5a80a}, - {0x5a80c, 0x5a822}, {0x5a840, 0x5a873}, {0x5a882, 0x5a8b3}, {0x5a8f2, 0x5a8f7}, - {0x5a90a, 0x5a925}, {0x5a930, 0x5a946}, {0x5a960, 0x5a97c}, {0x5a984, 0x5a9b2}, - {0x5a9e0, 0x5a9e4}, {0x5a9e6, 0x5a9ef}, {0x5a9fa, 0x5a9fe}, {0x5aa00, 0x5aa28}, - {0x5aa40, 0x5aa42}, {0x5aa44, 0x5aa4b}, {0x5aa60, 0x5aa76}, {0x5aa7e, 0x5aaaf}, - {0x5aab9, 0x5aabd}, {0x5aadb, 0x5aadd}, {0x5aae0, 0x5aaea}, {0x5aaf2, 0x5aaf4}, - {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, {0x5ab20, 0x5ab26}, - {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab5a}, {0x5ab5c, 0x5ab65}, {0x5ab70, 0x5abe2}, - {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, {0x5f900, 0x5fa6d}, - {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, {0x5fb1f, 0x5fb28}, - {0x5fb2a, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbb1}, {0x5fbd3, 0x5fd3d}, - {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfb}, {0x5fe70, 0x5fe74}, - {0x5fe76, 0x5fefc}, {0x5ff21, 0x5ff3a}, {0x5ff41, 0x5ff5a}, {0x5ff66, 0x5ffbe}, - {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, - {0x60041, 0x6005a}, {0x60061, 0x6007a}, {0x600c0, 0x600d6}, {0x600d8, 0x600f6}, - {0x600f8, 0x602c1}, {0x602c6, 0x602d1}, {0x602e0, 0x602e4}, {0x60370, 0x60374}, - {0x6037a, 0x6037d}, {0x60388, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x603f5}, - {0x603f7, 0x60481}, {0x6048a, 0x6052f}, {0x60531, 0x60556}, {0x60561, 0x60587}, - {0x605d0, 0x605ea}, {0x605f0, 0x605f2}, {0x60620, 0x6064a}, {0x60671, 0x606d3}, - {0x606fa, 0x606fc}, {0x60712, 0x6072f}, {0x6074d, 0x607a5}, {0x607ca, 0x607ea}, - {0x60800, 0x60815}, {0x60840, 0x60858}, {0x60860, 0x6086a}, {0x608a0, 0x608b4}, - {0x608b6, 0x608bd}, {0x60904, 0x60939}, {0x60958, 0x60961}, {0x60971, 0x60980}, - {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, - {0x609df, 0x609e1}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, - {0x60a59, 0x60a5c}, {0x60a72, 0x60a74}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, - {0x60a93, 0x60aa8}, {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60b05, 0x60b0c}, - {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, {0x60b35, 0x60b39}, {0x60b5f, 0x60b61}, - {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, {0x60ba8, 0x60baa}, - {0x60bae, 0x60bb9}, {0x60c05, 0x60c0c}, {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, - {0x60c2a, 0x60c39}, {0x60c58, 0x60c5a}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, - {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60d05, 0x60d0c}, - {0x60d0e, 0x60d10}, {0x60d12, 0x60d3a}, {0x60d54, 0x60d56}, {0x60d5f, 0x60d61}, - {0x60d7a, 0x60d7f}, {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, - {0x60dc0, 0x60dc6}, {0x60e01, 0x60e30}, {0x60e40, 0x60e46}, {0x60e94, 0x60e97}, - {0x60e99, 0x60e9f}, {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb0}, {0x60ec0, 0x60ec4}, - {0x60edc, 0x60edf}, {0x60f40, 0x60f47}, {0x60f49, 0x60f6c}, {0x60f88, 0x60f8c}, - {0x61000, 0x6102a}, {0x61050, 0x61055}, {0x6105a, 0x6105d}, {0x6106e, 0x61070}, - {0x61075, 0x61081}, {0x610a0, 0x610c5}, {0x610d0, 0x610fa}, {0x610fc, 0x61248}, - {0x6124a, 0x6124d}, {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, - {0x6128a, 0x6128d}, {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, - {0x612c2, 0x612c5}, {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, - {0x61318, 0x6135a}, {0x61380, 0x6138f}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, - {0x61401, 0x6166c}, {0x6166f, 0x6167f}, {0x61681, 0x6169a}, {0x616a0, 0x616ea}, - {0x616f1, 0x616f8}, {0x61700, 0x6170c}, {0x6170e, 0x61711}, {0x61720, 0x61731}, - {0x61740, 0x61751}, {0x61760, 0x6176c}, {0x6176e, 0x61770}, {0x61780, 0x617b3}, - {0x61820, 0x61877}, {0x61880, 0x61884}, {0x61887, 0x618a8}, {0x618b0, 0x618f5}, - {0x61900, 0x6191e}, {0x61950, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, - {0x619b0, 0x619c9}, {0x61a00, 0x61a16}, {0x61a20, 0x61a54}, {0x61b05, 0x61b33}, - {0x61b45, 0x61b4b}, {0x61b83, 0x61ba0}, {0x61bba, 0x61be5}, {0x61c00, 0x61c23}, - {0x61c4d, 0x61c4f}, {0x61c5a, 0x61c7d}, {0x61c80, 0x61c88}, {0x61ce9, 0x61cec}, - {0x61cee, 0x61cf1}, {0x61d00, 0x61dbf}, {0x61e00, 0x61f15}, {0x61f18, 0x61f1d}, - {0x61f20, 0x61f45}, {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, - {0x61f80, 0x61fb4}, {0x61fb6, 0x61fbc}, {0x61fc2, 0x61fc4}, {0x61fc6, 0x61fcc}, - {0x61fd0, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fe0, 0x61fec}, {0x61ff2, 0x61ff4}, - {0x61ff6, 0x61ffc}, {0x62090, 0x6209c}, {0x6210a, 0x62113}, {0x62119, 0x6211d}, - {0x6212a, 0x6212d}, {0x6212f, 0x62139}, {0x6213c, 0x6213f}, {0x62145, 0x62149}, - {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62ce4}, {0x62ceb, 0x62cee}, - {0x62d00, 0x62d25}, {0x62d30, 0x62d67}, {0x62d80, 0x62d96}, {0x62da0, 0x62da6}, - {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, - {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x63031, 0x63035}, - {0x63041, 0x63096}, {0x6309d, 0x6309f}, {0x630a1, 0x630fa}, {0x630fc, 0x630ff}, - {0x63105, 0x6312e}, {0x63131, 0x6318e}, {0x631a0, 0x631ba}, {0x631f0, 0x631ff}, - {0x63400, 0x64db5}, {0x64e00, 0x69fea}, {0x6a000, 0x6a48c}, {0x6a4d0, 0x6a4fd}, - {0x6a500, 0x6a60c}, {0x6a610, 0x6a61f}, {0x6a640, 0x6a66e}, {0x6a67f, 0x6a69d}, - {0x6a6a0, 0x6a6e5}, {0x6a717, 0x6a71f}, {0x6a722, 0x6a788}, {0x6a78b, 0x6a7ae}, - {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a801}, {0x6a803, 0x6a805}, {0x6a807, 0x6a80a}, - {0x6a80c, 0x6a822}, {0x6a840, 0x6a873}, {0x6a882, 0x6a8b3}, {0x6a8f2, 0x6a8f7}, - {0x6a90a, 0x6a925}, {0x6a930, 0x6a946}, {0x6a960, 0x6a97c}, {0x6a984, 0x6a9b2}, - {0x6a9e0, 0x6a9e4}, {0x6a9e6, 0x6a9ef}, {0x6a9fa, 0x6a9fe}, {0x6aa00, 0x6aa28}, - {0x6aa40, 0x6aa42}, {0x6aa44, 0x6aa4b}, {0x6aa60, 0x6aa76}, {0x6aa7e, 0x6aaaf}, - {0x6aab9, 0x6aabd}, {0x6aadb, 0x6aadd}, {0x6aae0, 0x6aaea}, {0x6aaf2, 0x6aaf4}, - {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, {0x6ab20, 0x6ab26}, - {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab5a}, {0x6ab5c, 0x6ab65}, {0x6ab70, 0x6abe2}, - {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, {0x6f900, 0x6fa6d}, - {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6fb1f, 0x6fb28}, - {0x6fb2a, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbb1}, {0x6fbd3, 0x6fd3d}, - {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfb}, {0x6fe70, 0x6fe74}, - {0x6fe76, 0x6fefc}, {0x6ff21, 0x6ff3a}, {0x6ff41, 0x6ff5a}, {0x6ff66, 0x6ffbe}, - {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, - {0x70041, 0x7005a}, {0x70061, 0x7007a}, {0x700c0, 0x700d6}, {0x700d8, 0x700f6}, - {0x700f8, 0x702c1}, {0x702c6, 0x702d1}, {0x702e0, 0x702e4}, {0x70370, 0x70374}, - {0x7037a, 0x7037d}, {0x70388, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x703f5}, - {0x703f7, 0x70481}, {0x7048a, 0x7052f}, {0x70531, 0x70556}, {0x70561, 0x70587}, - {0x705d0, 0x705ea}, {0x705f0, 0x705f2}, {0x70620, 0x7064a}, {0x70671, 0x706d3}, - {0x706fa, 0x706fc}, {0x70712, 0x7072f}, {0x7074d, 0x707a5}, {0x707ca, 0x707ea}, - {0x70800, 0x70815}, {0x70840, 0x70858}, {0x70860, 0x7086a}, {0x708a0, 0x708b4}, - {0x708b6, 0x708bd}, {0x70904, 0x70939}, {0x70958, 0x70961}, {0x70971, 0x70980}, - {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, - {0x709df, 0x709e1}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, - {0x70a59, 0x70a5c}, {0x70a72, 0x70a74}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, - {0x70a93, 0x70aa8}, {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70b05, 0x70b0c}, - {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, {0x70b35, 0x70b39}, {0x70b5f, 0x70b61}, - {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, {0x70ba8, 0x70baa}, - {0x70bae, 0x70bb9}, {0x70c05, 0x70c0c}, {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, - {0x70c2a, 0x70c39}, {0x70c58, 0x70c5a}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, - {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70d05, 0x70d0c}, - {0x70d0e, 0x70d10}, {0x70d12, 0x70d3a}, {0x70d54, 0x70d56}, {0x70d5f, 0x70d61}, - {0x70d7a, 0x70d7f}, {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, - {0x70dc0, 0x70dc6}, {0x70e01, 0x70e30}, {0x70e40, 0x70e46}, {0x70e94, 0x70e97}, - {0x70e99, 0x70e9f}, {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb0}, {0x70ec0, 0x70ec4}, - {0x70edc, 0x70edf}, {0x70f40, 0x70f47}, {0x70f49, 0x70f6c}, {0x70f88, 0x70f8c}, - {0x71000, 0x7102a}, {0x71050, 0x71055}, {0x7105a, 0x7105d}, {0x7106e, 0x71070}, - {0x71075, 0x71081}, {0x710a0, 0x710c5}, {0x710d0, 0x710fa}, {0x710fc, 0x71248}, - {0x7124a, 0x7124d}, {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, - {0x7128a, 0x7128d}, {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, - {0x712c2, 0x712c5}, {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, - {0x71318, 0x7135a}, {0x71380, 0x7138f}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, - {0x71401, 0x7166c}, {0x7166f, 0x7167f}, {0x71681, 0x7169a}, {0x716a0, 0x716ea}, - {0x716f1, 0x716f8}, {0x71700, 0x7170c}, {0x7170e, 0x71711}, {0x71720, 0x71731}, - {0x71740, 0x71751}, {0x71760, 0x7176c}, {0x7176e, 0x71770}, {0x71780, 0x717b3}, - {0x71820, 0x71877}, {0x71880, 0x71884}, {0x71887, 0x718a8}, {0x718b0, 0x718f5}, - {0x71900, 0x7191e}, {0x71950, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, - {0x719b0, 0x719c9}, {0x71a00, 0x71a16}, {0x71a20, 0x71a54}, {0x71b05, 0x71b33}, - {0x71b45, 0x71b4b}, {0x71b83, 0x71ba0}, {0x71bba, 0x71be5}, {0x71c00, 0x71c23}, - {0x71c4d, 0x71c4f}, {0x71c5a, 0x71c7d}, {0x71c80, 0x71c88}, {0x71ce9, 0x71cec}, - {0x71cee, 0x71cf1}, {0x71d00, 0x71dbf}, {0x71e00, 0x71f15}, {0x71f18, 0x71f1d}, - {0x71f20, 0x71f45}, {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, - {0x71f80, 0x71fb4}, {0x71fb6, 0x71fbc}, {0x71fc2, 0x71fc4}, {0x71fc6, 0x71fcc}, - {0x71fd0, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fe0, 0x71fec}, {0x71ff2, 0x71ff4}, - {0x71ff6, 0x71ffc}, {0x72090, 0x7209c}, {0x7210a, 0x72113}, {0x72119, 0x7211d}, - {0x7212a, 0x7212d}, {0x7212f, 0x72139}, {0x7213c, 0x7213f}, {0x72145, 0x72149}, - {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72ce4}, {0x72ceb, 0x72cee}, - {0x72d00, 0x72d25}, {0x72d30, 0x72d67}, {0x72d80, 0x72d96}, {0x72da0, 0x72da6}, - {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, - {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x73031, 0x73035}, - {0x73041, 0x73096}, {0x7309d, 0x7309f}, {0x730a1, 0x730fa}, {0x730fc, 0x730ff}, - {0x73105, 0x7312e}, {0x73131, 0x7318e}, {0x731a0, 0x731ba}, {0x731f0, 0x731ff}, - {0x73400, 0x74db5}, {0x74e00, 0x79fea}, {0x7a000, 0x7a48c}, {0x7a4d0, 0x7a4fd}, - {0x7a500, 0x7a60c}, {0x7a610, 0x7a61f}, {0x7a640, 0x7a66e}, {0x7a67f, 0x7a69d}, - {0x7a6a0, 0x7a6e5}, {0x7a717, 0x7a71f}, {0x7a722, 0x7a788}, {0x7a78b, 0x7a7ae}, - {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a801}, {0x7a803, 0x7a805}, {0x7a807, 0x7a80a}, - {0x7a80c, 0x7a822}, {0x7a840, 0x7a873}, {0x7a882, 0x7a8b3}, {0x7a8f2, 0x7a8f7}, - {0x7a90a, 0x7a925}, {0x7a930, 0x7a946}, {0x7a960, 0x7a97c}, {0x7a984, 0x7a9b2}, - {0x7a9e0, 0x7a9e4}, {0x7a9e6, 0x7a9ef}, {0x7a9fa, 0x7a9fe}, {0x7aa00, 0x7aa28}, - {0x7aa40, 0x7aa42}, {0x7aa44, 0x7aa4b}, {0x7aa60, 0x7aa76}, {0x7aa7e, 0x7aaaf}, - {0x7aab9, 0x7aabd}, {0x7aadb, 0x7aadd}, {0x7aae0, 0x7aaea}, {0x7aaf2, 0x7aaf4}, - {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, {0x7ab20, 0x7ab26}, - {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab5a}, {0x7ab5c, 0x7ab65}, {0x7ab70, 0x7abe2}, - {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, {0x7f900, 0x7fa6d}, - {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, {0x7fb1f, 0x7fb28}, - {0x7fb2a, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbb1}, {0x7fbd3, 0x7fd3d}, - {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfb}, {0x7fe70, 0x7fe74}, - {0x7fe76, 0x7fefc}, {0x7ff21, 0x7ff3a}, {0x7ff41, 0x7ff5a}, {0x7ff66, 0x7ffbe}, - {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, - {0x80041, 0x8005a}, {0x80061, 0x8007a}, {0x800c0, 0x800d6}, {0x800d8, 0x800f6}, - {0x800f8, 0x802c1}, {0x802c6, 0x802d1}, {0x802e0, 0x802e4}, {0x80370, 0x80374}, - {0x8037a, 0x8037d}, {0x80388, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x803f5}, - {0x803f7, 0x80481}, {0x8048a, 0x8052f}, {0x80531, 0x80556}, {0x80561, 0x80587}, - {0x805d0, 0x805ea}, {0x805f0, 0x805f2}, {0x80620, 0x8064a}, {0x80671, 0x806d3}, - {0x806fa, 0x806fc}, {0x80712, 0x8072f}, {0x8074d, 0x807a5}, {0x807ca, 0x807ea}, - {0x80800, 0x80815}, {0x80840, 0x80858}, {0x80860, 0x8086a}, {0x808a0, 0x808b4}, - {0x808b6, 0x808bd}, {0x80904, 0x80939}, {0x80958, 0x80961}, {0x80971, 0x80980}, - {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, - {0x809df, 0x809e1}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, - {0x80a59, 0x80a5c}, {0x80a72, 0x80a74}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, - {0x80a93, 0x80aa8}, {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80b05, 0x80b0c}, - {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, {0x80b35, 0x80b39}, {0x80b5f, 0x80b61}, - {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, {0x80ba8, 0x80baa}, - {0x80bae, 0x80bb9}, {0x80c05, 0x80c0c}, {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, - {0x80c2a, 0x80c39}, {0x80c58, 0x80c5a}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, - {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80d05, 0x80d0c}, - {0x80d0e, 0x80d10}, {0x80d12, 0x80d3a}, {0x80d54, 0x80d56}, {0x80d5f, 0x80d61}, - {0x80d7a, 0x80d7f}, {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, - {0x80dc0, 0x80dc6}, {0x80e01, 0x80e30}, {0x80e40, 0x80e46}, {0x80e94, 0x80e97}, - {0x80e99, 0x80e9f}, {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb0}, {0x80ec0, 0x80ec4}, - {0x80edc, 0x80edf}, {0x80f40, 0x80f47}, {0x80f49, 0x80f6c}, {0x80f88, 0x80f8c}, - {0x81000, 0x8102a}, {0x81050, 0x81055}, {0x8105a, 0x8105d}, {0x8106e, 0x81070}, - {0x81075, 0x81081}, {0x810a0, 0x810c5}, {0x810d0, 0x810fa}, {0x810fc, 0x81248}, - {0x8124a, 0x8124d}, {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, - {0x8128a, 0x8128d}, {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, - {0x812c2, 0x812c5}, {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, - {0x81318, 0x8135a}, {0x81380, 0x8138f}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, - {0x81401, 0x8166c}, {0x8166f, 0x8167f}, {0x81681, 0x8169a}, {0x816a0, 0x816ea}, - {0x816f1, 0x816f8}, {0x81700, 0x8170c}, {0x8170e, 0x81711}, {0x81720, 0x81731}, - {0x81740, 0x81751}, {0x81760, 0x8176c}, {0x8176e, 0x81770}, {0x81780, 0x817b3}, - {0x81820, 0x81877}, {0x81880, 0x81884}, {0x81887, 0x818a8}, {0x818b0, 0x818f5}, - {0x81900, 0x8191e}, {0x81950, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, - {0x819b0, 0x819c9}, {0x81a00, 0x81a16}, {0x81a20, 0x81a54}, {0x81b05, 0x81b33}, - {0x81b45, 0x81b4b}, {0x81b83, 0x81ba0}, {0x81bba, 0x81be5}, {0x81c00, 0x81c23}, - {0x81c4d, 0x81c4f}, {0x81c5a, 0x81c7d}, {0x81c80, 0x81c88}, {0x81ce9, 0x81cec}, - {0x81cee, 0x81cf1}, {0x81d00, 0x81dbf}, {0x81e00, 0x81f15}, {0x81f18, 0x81f1d}, - {0x81f20, 0x81f45}, {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, - {0x81f80, 0x81fb4}, {0x81fb6, 0x81fbc}, {0x81fc2, 0x81fc4}, {0x81fc6, 0x81fcc}, - {0x81fd0, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fe0, 0x81fec}, {0x81ff2, 0x81ff4}, - {0x81ff6, 0x81ffc}, {0x82090, 0x8209c}, {0x8210a, 0x82113}, {0x82119, 0x8211d}, - {0x8212a, 0x8212d}, {0x8212f, 0x82139}, {0x8213c, 0x8213f}, {0x82145, 0x82149}, - {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82ce4}, {0x82ceb, 0x82cee}, - {0x82d00, 0x82d25}, {0x82d30, 0x82d67}, {0x82d80, 0x82d96}, {0x82da0, 0x82da6}, - {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, - {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x83031, 0x83035}, - {0x83041, 0x83096}, {0x8309d, 0x8309f}, {0x830a1, 0x830fa}, {0x830fc, 0x830ff}, - {0x83105, 0x8312e}, {0x83131, 0x8318e}, {0x831a0, 0x831ba}, {0x831f0, 0x831ff}, - {0x83400, 0x84db5}, {0x84e00, 0x89fea}, {0x8a000, 0x8a48c}, {0x8a4d0, 0x8a4fd}, - {0x8a500, 0x8a60c}, {0x8a610, 0x8a61f}, {0x8a640, 0x8a66e}, {0x8a67f, 0x8a69d}, - {0x8a6a0, 0x8a6e5}, {0x8a717, 0x8a71f}, {0x8a722, 0x8a788}, {0x8a78b, 0x8a7ae}, - {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a801}, {0x8a803, 0x8a805}, {0x8a807, 0x8a80a}, - {0x8a80c, 0x8a822}, {0x8a840, 0x8a873}, {0x8a882, 0x8a8b3}, {0x8a8f2, 0x8a8f7}, - {0x8a90a, 0x8a925}, {0x8a930, 0x8a946}, {0x8a960, 0x8a97c}, {0x8a984, 0x8a9b2}, - {0x8a9e0, 0x8a9e4}, {0x8a9e6, 0x8a9ef}, {0x8a9fa, 0x8a9fe}, {0x8aa00, 0x8aa28}, - {0x8aa40, 0x8aa42}, {0x8aa44, 0x8aa4b}, {0x8aa60, 0x8aa76}, {0x8aa7e, 0x8aaaf}, - {0x8aab9, 0x8aabd}, {0x8aadb, 0x8aadd}, {0x8aae0, 0x8aaea}, {0x8aaf2, 0x8aaf4}, - {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, {0x8ab20, 0x8ab26}, - {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab5a}, {0x8ab5c, 0x8ab65}, {0x8ab70, 0x8abe2}, - {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, {0x8f900, 0x8fa6d}, - {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8fb1f, 0x8fb28}, - {0x8fb2a, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbb1}, {0x8fbd3, 0x8fd3d}, - {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfb}, {0x8fe70, 0x8fe74}, - {0x8fe76, 0x8fefc}, {0x8ff21, 0x8ff3a}, {0x8ff41, 0x8ff5a}, {0x8ff66, 0x8ffbe}, - {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, - {0x90041, 0x9005a}, {0x90061, 0x9007a}, {0x900c0, 0x900d6}, {0x900d8, 0x900f6}, - {0x900f8, 0x902c1}, {0x902c6, 0x902d1}, {0x902e0, 0x902e4}, {0x90370, 0x90374}, - {0x9037a, 0x9037d}, {0x90388, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x903f5}, - {0x903f7, 0x90481}, {0x9048a, 0x9052f}, {0x90531, 0x90556}, {0x90561, 0x90587}, - {0x905d0, 0x905ea}, {0x905f0, 0x905f2}, {0x90620, 0x9064a}, {0x90671, 0x906d3}, - {0x906fa, 0x906fc}, {0x90712, 0x9072f}, {0x9074d, 0x907a5}, {0x907ca, 0x907ea}, - {0x90800, 0x90815}, {0x90840, 0x90858}, {0x90860, 0x9086a}, {0x908a0, 0x908b4}, - {0x908b6, 0x908bd}, {0x90904, 0x90939}, {0x90958, 0x90961}, {0x90971, 0x90980}, - {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, - {0x909df, 0x909e1}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, - {0x90a59, 0x90a5c}, {0x90a72, 0x90a74}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, - {0x90a93, 0x90aa8}, {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90b05, 0x90b0c}, - {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, {0x90b35, 0x90b39}, {0x90b5f, 0x90b61}, - {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, {0x90ba8, 0x90baa}, - {0x90bae, 0x90bb9}, {0x90c05, 0x90c0c}, {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, - {0x90c2a, 0x90c39}, {0x90c58, 0x90c5a}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, - {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90d05, 0x90d0c}, - {0x90d0e, 0x90d10}, {0x90d12, 0x90d3a}, {0x90d54, 0x90d56}, {0x90d5f, 0x90d61}, - {0x90d7a, 0x90d7f}, {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, - {0x90dc0, 0x90dc6}, {0x90e01, 0x90e30}, {0x90e40, 0x90e46}, {0x90e94, 0x90e97}, - {0x90e99, 0x90e9f}, {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb0}, {0x90ec0, 0x90ec4}, - {0x90edc, 0x90edf}, {0x90f40, 0x90f47}, {0x90f49, 0x90f6c}, {0x90f88, 0x90f8c}, - {0x91000, 0x9102a}, {0x91050, 0x91055}, {0x9105a, 0x9105d}, {0x9106e, 0x91070}, - {0x91075, 0x91081}, {0x910a0, 0x910c5}, {0x910d0, 0x910fa}, {0x910fc, 0x91248}, - {0x9124a, 0x9124d}, {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, - {0x9128a, 0x9128d}, {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, - {0x912c2, 0x912c5}, {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, - {0x91318, 0x9135a}, {0x91380, 0x9138f}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, - {0x91401, 0x9166c}, {0x9166f, 0x9167f}, {0x91681, 0x9169a}, {0x916a0, 0x916ea}, - {0x916f1, 0x916f8}, {0x91700, 0x9170c}, {0x9170e, 0x91711}, {0x91720, 0x91731}, - {0x91740, 0x91751}, {0x91760, 0x9176c}, {0x9176e, 0x91770}, {0x91780, 0x917b3}, - {0x91820, 0x91877}, {0x91880, 0x91884}, {0x91887, 0x918a8}, {0x918b0, 0x918f5}, - {0x91900, 0x9191e}, {0x91950, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, - {0x919b0, 0x919c9}, {0x91a00, 0x91a16}, {0x91a20, 0x91a54}, {0x91b05, 0x91b33}, - {0x91b45, 0x91b4b}, {0x91b83, 0x91ba0}, {0x91bba, 0x91be5}, {0x91c00, 0x91c23}, - {0x91c4d, 0x91c4f}, {0x91c5a, 0x91c7d}, {0x91c80, 0x91c88}, {0x91ce9, 0x91cec}, - {0x91cee, 0x91cf1}, {0x91d00, 0x91dbf}, {0x91e00, 0x91f15}, {0x91f18, 0x91f1d}, - {0x91f20, 0x91f45}, {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, - {0x91f80, 0x91fb4}, {0x91fb6, 0x91fbc}, {0x91fc2, 0x91fc4}, {0x91fc6, 0x91fcc}, - {0x91fd0, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fe0, 0x91fec}, {0x91ff2, 0x91ff4}, - {0x91ff6, 0x91ffc}, {0x92090, 0x9209c}, {0x9210a, 0x92113}, {0x92119, 0x9211d}, - {0x9212a, 0x9212d}, {0x9212f, 0x92139}, {0x9213c, 0x9213f}, {0x92145, 0x92149}, - {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92ce4}, {0x92ceb, 0x92cee}, - {0x92d00, 0x92d25}, {0x92d30, 0x92d67}, {0x92d80, 0x92d96}, {0x92da0, 0x92da6}, - {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, - {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x93031, 0x93035}, - {0x93041, 0x93096}, {0x9309d, 0x9309f}, {0x930a1, 0x930fa}, {0x930fc, 0x930ff}, - {0x93105, 0x9312e}, {0x93131, 0x9318e}, {0x931a0, 0x931ba}, {0x931f0, 0x931ff}, - {0x93400, 0x94db5}, {0x94e00, 0x99fea}, {0x9a000, 0x9a48c}, {0x9a4d0, 0x9a4fd}, - {0x9a500, 0x9a60c}, {0x9a610, 0x9a61f}, {0x9a640, 0x9a66e}, {0x9a67f, 0x9a69d}, - {0x9a6a0, 0x9a6e5}, {0x9a717, 0x9a71f}, {0x9a722, 0x9a788}, {0x9a78b, 0x9a7ae}, - {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a801}, {0x9a803, 0x9a805}, {0x9a807, 0x9a80a}, - {0x9a80c, 0x9a822}, {0x9a840, 0x9a873}, {0x9a882, 0x9a8b3}, {0x9a8f2, 0x9a8f7}, - {0x9a90a, 0x9a925}, {0x9a930, 0x9a946}, {0x9a960, 0x9a97c}, {0x9a984, 0x9a9b2}, - {0x9a9e0, 0x9a9e4}, {0x9a9e6, 0x9a9ef}, {0x9a9fa, 0x9a9fe}, {0x9aa00, 0x9aa28}, - {0x9aa40, 0x9aa42}, {0x9aa44, 0x9aa4b}, {0x9aa60, 0x9aa76}, {0x9aa7e, 0x9aaaf}, - {0x9aab9, 0x9aabd}, {0x9aadb, 0x9aadd}, {0x9aae0, 0x9aaea}, {0x9aaf2, 0x9aaf4}, - {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, {0x9ab20, 0x9ab26}, - {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab5a}, {0x9ab5c, 0x9ab65}, {0x9ab70, 0x9abe2}, - {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, {0x9f900, 0x9fa6d}, - {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, {0x9fb1f, 0x9fb28}, - {0x9fb2a, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbb1}, {0x9fbd3, 0x9fd3d}, - {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfb}, {0x9fe70, 0x9fe74}, - {0x9fe76, 0x9fefc}, {0x9ff21, 0x9ff3a}, {0x9ff41, 0x9ff5a}, {0x9ff66, 0x9ffbe}, - {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, - {0xa0041, 0xa005a}, {0xa0061, 0xa007a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00f6}, - {0xa00f8, 0xa02c1}, {0xa02c6, 0xa02d1}, {0xa02e0, 0xa02e4}, {0xa0370, 0xa0374}, - {0xa037a, 0xa037d}, {0xa0388, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa03f5}, - {0xa03f7, 0xa0481}, {0xa048a, 0xa052f}, {0xa0531, 0xa0556}, {0xa0561, 0xa0587}, - {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f2}, {0xa0620, 0xa064a}, {0xa0671, 0xa06d3}, - {0xa06fa, 0xa06fc}, {0xa0712, 0xa072f}, {0xa074d, 0xa07a5}, {0xa07ca, 0xa07ea}, - {0xa0800, 0xa0815}, {0xa0840, 0xa0858}, {0xa0860, 0xa086a}, {0xa08a0, 0xa08b4}, - {0xa08b6, 0xa08bd}, {0xa0904, 0xa0939}, {0xa0958, 0xa0961}, {0xa0971, 0xa0980}, - {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, - {0xa09df, 0xa09e1}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, - {0xa0a59, 0xa0a5c}, {0xa0a72, 0xa0a74}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, - {0xa0a93, 0xa0aa8}, {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0b05, 0xa0b0c}, - {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, {0xa0b35, 0xa0b39}, {0xa0b5f, 0xa0b61}, - {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, {0xa0ba8, 0xa0baa}, - {0xa0bae, 0xa0bb9}, {0xa0c05, 0xa0c0c}, {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, - {0xa0c2a, 0xa0c39}, {0xa0c58, 0xa0c5a}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, - {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0d05, 0xa0d0c}, - {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d3a}, {0xa0d54, 0xa0d56}, {0xa0d5f, 0xa0d61}, - {0xa0d7a, 0xa0d7f}, {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, - {0xa0dc0, 0xa0dc6}, {0xa0e01, 0xa0e30}, {0xa0e40, 0xa0e46}, {0xa0e94, 0xa0e97}, - {0xa0e99, 0xa0e9f}, {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb0}, {0xa0ec0, 0xa0ec4}, - {0xa0edc, 0xa0edf}, {0xa0f40, 0xa0f47}, {0xa0f49, 0xa0f6c}, {0xa0f88, 0xa0f8c}, - {0xa1000, 0xa102a}, {0xa1050, 0xa1055}, {0xa105a, 0xa105d}, {0xa106e, 0xa1070}, - {0xa1075, 0xa1081}, {0xa10a0, 0xa10c5}, {0xa10d0, 0xa10fa}, {0xa10fc, 0xa1248}, - {0xa124a, 0xa124d}, {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, - {0xa128a, 0xa128d}, {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, - {0xa12c2, 0xa12c5}, {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, - {0xa1318, 0xa135a}, {0xa1380, 0xa138f}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, - {0xa1401, 0xa166c}, {0xa166f, 0xa167f}, {0xa1681, 0xa169a}, {0xa16a0, 0xa16ea}, - {0xa16f1, 0xa16f8}, {0xa1700, 0xa170c}, {0xa170e, 0xa1711}, {0xa1720, 0xa1731}, - {0xa1740, 0xa1751}, {0xa1760, 0xa176c}, {0xa176e, 0xa1770}, {0xa1780, 0xa17b3}, - {0xa1820, 0xa1877}, {0xa1880, 0xa1884}, {0xa1887, 0xa18a8}, {0xa18b0, 0xa18f5}, - {0xa1900, 0xa191e}, {0xa1950, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, - {0xa19b0, 0xa19c9}, {0xa1a00, 0xa1a16}, {0xa1a20, 0xa1a54}, {0xa1b05, 0xa1b33}, - {0xa1b45, 0xa1b4b}, {0xa1b83, 0xa1ba0}, {0xa1bba, 0xa1be5}, {0xa1c00, 0xa1c23}, - {0xa1c4d, 0xa1c4f}, {0xa1c5a, 0xa1c7d}, {0xa1c80, 0xa1c88}, {0xa1ce9, 0xa1cec}, - {0xa1cee, 0xa1cf1}, {0xa1d00, 0xa1dbf}, {0xa1e00, 0xa1f15}, {0xa1f18, 0xa1f1d}, - {0xa1f20, 0xa1f45}, {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, - {0xa1f80, 0xa1fb4}, {0xa1fb6, 0xa1fbc}, {0xa1fc2, 0xa1fc4}, {0xa1fc6, 0xa1fcc}, - {0xa1fd0, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fe0, 0xa1fec}, {0xa1ff2, 0xa1ff4}, - {0xa1ff6, 0xa1ffc}, {0xa2090, 0xa209c}, {0xa210a, 0xa2113}, {0xa2119, 0xa211d}, - {0xa212a, 0xa212d}, {0xa212f, 0xa2139}, {0xa213c, 0xa213f}, {0xa2145, 0xa2149}, - {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2ce4}, {0xa2ceb, 0xa2cee}, - {0xa2d00, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d80, 0xa2d96}, {0xa2da0, 0xa2da6}, - {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, - {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa3031, 0xa3035}, - {0xa3041, 0xa3096}, {0xa309d, 0xa309f}, {0xa30a1, 0xa30fa}, {0xa30fc, 0xa30ff}, - {0xa3105, 0xa312e}, {0xa3131, 0xa318e}, {0xa31a0, 0xa31ba}, {0xa31f0, 0xa31ff}, - {0xa3400, 0xa4db5}, {0xa4e00, 0xa9fea}, {0xaa000, 0xaa48c}, {0xaa4d0, 0xaa4fd}, - {0xaa500, 0xaa60c}, {0xaa610, 0xaa61f}, {0xaa640, 0xaa66e}, {0xaa67f, 0xaa69d}, - {0xaa6a0, 0xaa6e5}, {0xaa717, 0xaa71f}, {0xaa722, 0xaa788}, {0xaa78b, 0xaa7ae}, - {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa801}, {0xaa803, 0xaa805}, {0xaa807, 0xaa80a}, - {0xaa80c, 0xaa822}, {0xaa840, 0xaa873}, {0xaa882, 0xaa8b3}, {0xaa8f2, 0xaa8f7}, - {0xaa90a, 0xaa925}, {0xaa930, 0xaa946}, {0xaa960, 0xaa97c}, {0xaa984, 0xaa9b2}, - {0xaa9e0, 0xaa9e4}, {0xaa9e6, 0xaa9ef}, {0xaa9fa, 0xaa9fe}, {0xaaa00, 0xaaa28}, - {0xaaa40, 0xaaa42}, {0xaaa44, 0xaaa4b}, {0xaaa60, 0xaaa76}, {0xaaa7e, 0xaaaaf}, - {0xaaab9, 0xaaabd}, {0xaaadb, 0xaaadd}, {0xaaae0, 0xaaaea}, {0xaaaf2, 0xaaaf4}, - {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, {0xaab20, 0xaab26}, - {0xaab28, 0xaab2e}, {0xaab30, 0xaab5a}, {0xaab5c, 0xaab65}, {0xaab70, 0xaabe2}, - {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, {0xaf900, 0xafa6d}, - {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xafb1f, 0xafb28}, - {0xafb2a, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbb1}, {0xafbd3, 0xafd3d}, - {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfb}, {0xafe70, 0xafe74}, - {0xafe76, 0xafefc}, {0xaff21, 0xaff3a}, {0xaff41, 0xaff5a}, {0xaff66, 0xaffbe}, - {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, - {0xb0041, 0xb005a}, {0xb0061, 0xb007a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00f6}, - {0xb00f8, 0xb02c1}, {0xb02c6, 0xb02d1}, {0xb02e0, 0xb02e4}, {0xb0370, 0xb0374}, - {0xb037a, 0xb037d}, {0xb0388, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb03f5}, - {0xb03f7, 0xb0481}, {0xb048a, 0xb052f}, {0xb0531, 0xb0556}, {0xb0561, 0xb0587}, - {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f2}, {0xb0620, 0xb064a}, {0xb0671, 0xb06d3}, - {0xb06fa, 0xb06fc}, {0xb0712, 0xb072f}, {0xb074d, 0xb07a5}, {0xb07ca, 0xb07ea}, - {0xb0800, 0xb0815}, {0xb0840, 0xb0858}, {0xb0860, 0xb086a}, {0xb08a0, 0xb08b4}, - {0xb08b6, 0xb08bd}, {0xb0904, 0xb0939}, {0xb0958, 0xb0961}, {0xb0971, 0xb0980}, - {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, - {0xb09df, 0xb09e1}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, - {0xb0a59, 0xb0a5c}, {0xb0a72, 0xb0a74}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, - {0xb0a93, 0xb0aa8}, {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0b05, 0xb0b0c}, - {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, {0xb0b35, 0xb0b39}, {0xb0b5f, 0xb0b61}, - {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, {0xb0ba8, 0xb0baa}, - {0xb0bae, 0xb0bb9}, {0xb0c05, 0xb0c0c}, {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, - {0xb0c2a, 0xb0c39}, {0xb0c58, 0xb0c5a}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, - {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0d05, 0xb0d0c}, - {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d3a}, {0xb0d54, 0xb0d56}, {0xb0d5f, 0xb0d61}, - {0xb0d7a, 0xb0d7f}, {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, - {0xb0dc0, 0xb0dc6}, {0xb0e01, 0xb0e30}, {0xb0e40, 0xb0e46}, {0xb0e94, 0xb0e97}, - {0xb0e99, 0xb0e9f}, {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb0}, {0xb0ec0, 0xb0ec4}, - {0xb0edc, 0xb0edf}, {0xb0f40, 0xb0f47}, {0xb0f49, 0xb0f6c}, {0xb0f88, 0xb0f8c}, - {0xb1000, 0xb102a}, {0xb1050, 0xb1055}, {0xb105a, 0xb105d}, {0xb106e, 0xb1070}, - {0xb1075, 0xb1081}, {0xb10a0, 0xb10c5}, {0xb10d0, 0xb10fa}, {0xb10fc, 0xb1248}, - {0xb124a, 0xb124d}, {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, - {0xb128a, 0xb128d}, {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, - {0xb12c2, 0xb12c5}, {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, - {0xb1318, 0xb135a}, {0xb1380, 0xb138f}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, - {0xb1401, 0xb166c}, {0xb166f, 0xb167f}, {0xb1681, 0xb169a}, {0xb16a0, 0xb16ea}, - {0xb16f1, 0xb16f8}, {0xb1700, 0xb170c}, {0xb170e, 0xb1711}, {0xb1720, 0xb1731}, - {0xb1740, 0xb1751}, {0xb1760, 0xb176c}, {0xb176e, 0xb1770}, {0xb1780, 0xb17b3}, - {0xb1820, 0xb1877}, {0xb1880, 0xb1884}, {0xb1887, 0xb18a8}, {0xb18b0, 0xb18f5}, - {0xb1900, 0xb191e}, {0xb1950, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, - {0xb19b0, 0xb19c9}, {0xb1a00, 0xb1a16}, {0xb1a20, 0xb1a54}, {0xb1b05, 0xb1b33}, - {0xb1b45, 0xb1b4b}, {0xb1b83, 0xb1ba0}, {0xb1bba, 0xb1be5}, {0xb1c00, 0xb1c23}, - {0xb1c4d, 0xb1c4f}, {0xb1c5a, 0xb1c7d}, {0xb1c80, 0xb1c88}, {0xb1ce9, 0xb1cec}, - {0xb1cee, 0xb1cf1}, {0xb1d00, 0xb1dbf}, {0xb1e00, 0xb1f15}, {0xb1f18, 0xb1f1d}, - {0xb1f20, 0xb1f45}, {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, - {0xb1f80, 0xb1fb4}, {0xb1fb6, 0xb1fbc}, {0xb1fc2, 0xb1fc4}, {0xb1fc6, 0xb1fcc}, - {0xb1fd0, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fe0, 0xb1fec}, {0xb1ff2, 0xb1ff4}, - {0xb1ff6, 0xb1ffc}, {0xb2090, 0xb209c}, {0xb210a, 0xb2113}, {0xb2119, 0xb211d}, - {0xb212a, 0xb212d}, {0xb212f, 0xb2139}, {0xb213c, 0xb213f}, {0xb2145, 0xb2149}, - {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2ce4}, {0xb2ceb, 0xb2cee}, - {0xb2d00, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d80, 0xb2d96}, {0xb2da0, 0xb2da6}, - {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, - {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb3031, 0xb3035}, - {0xb3041, 0xb3096}, {0xb309d, 0xb309f}, {0xb30a1, 0xb30fa}, {0xb30fc, 0xb30ff}, - {0xb3105, 0xb312e}, {0xb3131, 0xb318e}, {0xb31a0, 0xb31ba}, {0xb31f0, 0xb31ff}, - {0xb3400, 0xb4db5}, {0xb4e00, 0xb9fea}, {0xba000, 0xba48c}, {0xba4d0, 0xba4fd}, - {0xba500, 0xba60c}, {0xba610, 0xba61f}, {0xba640, 0xba66e}, {0xba67f, 0xba69d}, - {0xba6a0, 0xba6e5}, {0xba717, 0xba71f}, {0xba722, 0xba788}, {0xba78b, 0xba7ae}, - {0xba7b0, 0xba7b7}, {0xba7f7, 0xba801}, {0xba803, 0xba805}, {0xba807, 0xba80a}, - {0xba80c, 0xba822}, {0xba840, 0xba873}, {0xba882, 0xba8b3}, {0xba8f2, 0xba8f7}, - {0xba90a, 0xba925}, {0xba930, 0xba946}, {0xba960, 0xba97c}, {0xba984, 0xba9b2}, - {0xba9e0, 0xba9e4}, {0xba9e6, 0xba9ef}, {0xba9fa, 0xba9fe}, {0xbaa00, 0xbaa28}, - {0xbaa40, 0xbaa42}, {0xbaa44, 0xbaa4b}, {0xbaa60, 0xbaa76}, {0xbaa7e, 0xbaaaf}, - {0xbaab9, 0xbaabd}, {0xbaadb, 0xbaadd}, {0xbaae0, 0xbaaea}, {0xbaaf2, 0xbaaf4}, - {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, {0xbab20, 0xbab26}, - {0xbab28, 0xbab2e}, {0xbab30, 0xbab5a}, {0xbab5c, 0xbab65}, {0xbab70, 0xbabe2}, - {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, {0xbf900, 0xbfa6d}, - {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, {0xbfb1f, 0xbfb28}, - {0xbfb2a, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbb1}, {0xbfbd3, 0xbfd3d}, - {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfb}, {0xbfe70, 0xbfe74}, - {0xbfe76, 0xbfefc}, {0xbff21, 0xbff3a}, {0xbff41, 0xbff5a}, {0xbff66, 0xbffbe}, - {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, - {0xc0041, 0xc005a}, {0xc0061, 0xc007a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00f6}, - {0xc00f8, 0xc02c1}, {0xc02c6, 0xc02d1}, {0xc02e0, 0xc02e4}, {0xc0370, 0xc0374}, - {0xc037a, 0xc037d}, {0xc0388, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc03f5}, - {0xc03f7, 0xc0481}, {0xc048a, 0xc052f}, {0xc0531, 0xc0556}, {0xc0561, 0xc0587}, - {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f2}, {0xc0620, 0xc064a}, {0xc0671, 0xc06d3}, - {0xc06fa, 0xc06fc}, {0xc0712, 0xc072f}, {0xc074d, 0xc07a5}, {0xc07ca, 0xc07ea}, - {0xc0800, 0xc0815}, {0xc0840, 0xc0858}, {0xc0860, 0xc086a}, {0xc08a0, 0xc08b4}, - {0xc08b6, 0xc08bd}, {0xc0904, 0xc0939}, {0xc0958, 0xc0961}, {0xc0971, 0xc0980}, - {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, - {0xc09df, 0xc09e1}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, - {0xc0a59, 0xc0a5c}, {0xc0a72, 0xc0a74}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, - {0xc0a93, 0xc0aa8}, {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0b05, 0xc0b0c}, - {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, {0xc0b35, 0xc0b39}, {0xc0b5f, 0xc0b61}, - {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, {0xc0ba8, 0xc0baa}, - {0xc0bae, 0xc0bb9}, {0xc0c05, 0xc0c0c}, {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, - {0xc0c2a, 0xc0c39}, {0xc0c58, 0xc0c5a}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, - {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0d05, 0xc0d0c}, - {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d3a}, {0xc0d54, 0xc0d56}, {0xc0d5f, 0xc0d61}, - {0xc0d7a, 0xc0d7f}, {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, - {0xc0dc0, 0xc0dc6}, {0xc0e01, 0xc0e30}, {0xc0e40, 0xc0e46}, {0xc0e94, 0xc0e97}, - {0xc0e99, 0xc0e9f}, {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb0}, {0xc0ec0, 0xc0ec4}, - {0xc0edc, 0xc0edf}, {0xc0f40, 0xc0f47}, {0xc0f49, 0xc0f6c}, {0xc0f88, 0xc0f8c}, - {0xc1000, 0xc102a}, {0xc1050, 0xc1055}, {0xc105a, 0xc105d}, {0xc106e, 0xc1070}, - {0xc1075, 0xc1081}, {0xc10a0, 0xc10c5}, {0xc10d0, 0xc10fa}, {0xc10fc, 0xc1248}, - {0xc124a, 0xc124d}, {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, - {0xc128a, 0xc128d}, {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, - {0xc12c2, 0xc12c5}, {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, - {0xc1318, 0xc135a}, {0xc1380, 0xc138f}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, - {0xc1401, 0xc166c}, {0xc166f, 0xc167f}, {0xc1681, 0xc169a}, {0xc16a0, 0xc16ea}, - {0xc16f1, 0xc16f8}, {0xc1700, 0xc170c}, {0xc170e, 0xc1711}, {0xc1720, 0xc1731}, - {0xc1740, 0xc1751}, {0xc1760, 0xc176c}, {0xc176e, 0xc1770}, {0xc1780, 0xc17b3}, - {0xc1820, 0xc1877}, {0xc1880, 0xc1884}, {0xc1887, 0xc18a8}, {0xc18b0, 0xc18f5}, - {0xc1900, 0xc191e}, {0xc1950, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, - {0xc19b0, 0xc19c9}, {0xc1a00, 0xc1a16}, {0xc1a20, 0xc1a54}, {0xc1b05, 0xc1b33}, - {0xc1b45, 0xc1b4b}, {0xc1b83, 0xc1ba0}, {0xc1bba, 0xc1be5}, {0xc1c00, 0xc1c23}, - {0xc1c4d, 0xc1c4f}, {0xc1c5a, 0xc1c7d}, {0xc1c80, 0xc1c88}, {0xc1ce9, 0xc1cec}, - {0xc1cee, 0xc1cf1}, {0xc1d00, 0xc1dbf}, {0xc1e00, 0xc1f15}, {0xc1f18, 0xc1f1d}, - {0xc1f20, 0xc1f45}, {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, - {0xc1f80, 0xc1fb4}, {0xc1fb6, 0xc1fbc}, {0xc1fc2, 0xc1fc4}, {0xc1fc6, 0xc1fcc}, - {0xc1fd0, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fe0, 0xc1fec}, {0xc1ff2, 0xc1ff4}, - {0xc1ff6, 0xc1ffc}, {0xc2090, 0xc209c}, {0xc210a, 0xc2113}, {0xc2119, 0xc211d}, - {0xc212a, 0xc212d}, {0xc212f, 0xc2139}, {0xc213c, 0xc213f}, {0xc2145, 0xc2149}, - {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2ce4}, {0xc2ceb, 0xc2cee}, - {0xc2d00, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d80, 0xc2d96}, {0xc2da0, 0xc2da6}, - {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, - {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc3031, 0xc3035}, - {0xc3041, 0xc3096}, {0xc309d, 0xc309f}, {0xc30a1, 0xc30fa}, {0xc30fc, 0xc30ff}, - {0xc3105, 0xc312e}, {0xc3131, 0xc318e}, {0xc31a0, 0xc31ba}, {0xc31f0, 0xc31ff}, - {0xc3400, 0xc4db5}, {0xc4e00, 0xc9fea}, {0xca000, 0xca48c}, {0xca4d0, 0xca4fd}, - {0xca500, 0xca60c}, {0xca610, 0xca61f}, {0xca640, 0xca66e}, {0xca67f, 0xca69d}, - {0xca6a0, 0xca6e5}, {0xca717, 0xca71f}, {0xca722, 0xca788}, {0xca78b, 0xca7ae}, - {0xca7b0, 0xca7b7}, {0xca7f7, 0xca801}, {0xca803, 0xca805}, {0xca807, 0xca80a}, - {0xca80c, 0xca822}, {0xca840, 0xca873}, {0xca882, 0xca8b3}, {0xca8f2, 0xca8f7}, - {0xca90a, 0xca925}, {0xca930, 0xca946}, {0xca960, 0xca97c}, {0xca984, 0xca9b2}, - {0xca9e0, 0xca9e4}, {0xca9e6, 0xca9ef}, {0xca9fa, 0xca9fe}, {0xcaa00, 0xcaa28}, - {0xcaa40, 0xcaa42}, {0xcaa44, 0xcaa4b}, {0xcaa60, 0xcaa76}, {0xcaa7e, 0xcaaaf}, - {0xcaab9, 0xcaabd}, {0xcaadb, 0xcaadd}, {0xcaae0, 0xcaaea}, {0xcaaf2, 0xcaaf4}, - {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, {0xcab20, 0xcab26}, - {0xcab28, 0xcab2e}, {0xcab30, 0xcab5a}, {0xcab5c, 0xcab65}, {0xcab70, 0xcabe2}, - {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, {0xcf900, 0xcfa6d}, - {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcfb1f, 0xcfb28}, - {0xcfb2a, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbb1}, {0xcfbd3, 0xcfd3d}, - {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfb}, {0xcfe70, 0xcfe74}, - {0xcfe76, 0xcfefc}, {0xcff21, 0xcff3a}, {0xcff41, 0xcff5a}, {0xcff66, 0xcffbe}, - {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, - {0xd0041, 0xd005a}, {0xd0061, 0xd007a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00f6}, - {0xd00f8, 0xd02c1}, {0xd02c6, 0xd02d1}, {0xd02e0, 0xd02e4}, {0xd0370, 0xd0374}, - {0xd037a, 0xd037d}, {0xd0388, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd03f5}, - {0xd03f7, 0xd0481}, {0xd048a, 0xd052f}, {0xd0531, 0xd0556}, {0xd0561, 0xd0587}, - {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f2}, {0xd0620, 0xd064a}, {0xd0671, 0xd06d3}, - {0xd06fa, 0xd06fc}, {0xd0712, 0xd072f}, {0xd074d, 0xd07a5}, {0xd07ca, 0xd07ea}, - {0xd0800, 0xd0815}, {0xd0840, 0xd0858}, {0xd0860, 0xd086a}, {0xd08a0, 0xd08b4}, - {0xd08b6, 0xd08bd}, {0xd0904, 0xd0939}, {0xd0958, 0xd0961}, {0xd0971, 0xd0980}, - {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, - {0xd09df, 0xd09e1}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, - {0xd0a59, 0xd0a5c}, {0xd0a72, 0xd0a74}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, - {0xd0a93, 0xd0aa8}, {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0b05, 0xd0b0c}, - {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, {0xd0b35, 0xd0b39}, {0xd0b5f, 0xd0b61}, - {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, {0xd0ba8, 0xd0baa}, - {0xd0bae, 0xd0bb9}, {0xd0c05, 0xd0c0c}, {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, - {0xd0c2a, 0xd0c39}, {0xd0c58, 0xd0c5a}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, - {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0d05, 0xd0d0c}, - {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d3a}, {0xd0d54, 0xd0d56}, {0xd0d5f, 0xd0d61}, - {0xd0d7a, 0xd0d7f}, {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, - {0xd0dc0, 0xd0dc6}, {0xd0e01, 0xd0e30}, {0xd0e40, 0xd0e46}, {0xd0e94, 0xd0e97}, - {0xd0e99, 0xd0e9f}, {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb0}, {0xd0ec0, 0xd0ec4}, - {0xd0edc, 0xd0edf}, {0xd0f40, 0xd0f47}, {0xd0f49, 0xd0f6c}, {0xd0f88, 0xd0f8c}, - {0xd1000, 0xd102a}, {0xd1050, 0xd1055}, {0xd105a, 0xd105d}, {0xd106e, 0xd1070}, - {0xd1075, 0xd1081}, {0xd10a0, 0xd10c5}, {0xd10d0, 0xd10fa}, {0xd10fc, 0xd1248}, - {0xd124a, 0xd124d}, {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, - {0xd128a, 0xd128d}, {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, - {0xd12c2, 0xd12c5}, {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, - {0xd1318, 0xd135a}, {0xd1380, 0xd138f}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, - {0xd1401, 0xd166c}, {0xd166f, 0xd167f}, {0xd1681, 0xd169a}, {0xd16a0, 0xd16ea}, - {0xd16f1, 0xd16f8}, {0xd1700, 0xd170c}, {0xd170e, 0xd1711}, {0xd1720, 0xd1731}, - {0xd1740, 0xd1751}, {0xd1760, 0xd176c}, {0xd176e, 0xd1770}, {0xd1780, 0xd17b3}, - {0xd1820, 0xd1877}, {0xd1880, 0xd1884}, {0xd1887, 0xd18a8}, {0xd18b0, 0xd18f5}, - {0xd1900, 0xd191e}, {0xd1950, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, - {0xd19b0, 0xd19c9}, {0xd1a00, 0xd1a16}, {0xd1a20, 0xd1a54}, {0xd1b05, 0xd1b33}, - {0xd1b45, 0xd1b4b}, {0xd1b83, 0xd1ba0}, {0xd1bba, 0xd1be5}, {0xd1c00, 0xd1c23}, - {0xd1c4d, 0xd1c4f}, {0xd1c5a, 0xd1c7d}, {0xd1c80, 0xd1c88}, {0xd1ce9, 0xd1cec}, - {0xd1cee, 0xd1cf1}, {0xd1d00, 0xd1dbf}, {0xd1e00, 0xd1f15}, {0xd1f18, 0xd1f1d}, - {0xd1f20, 0xd1f45}, {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, - {0xd1f80, 0xd1fb4}, {0xd1fb6, 0xd1fbc}, {0xd1fc2, 0xd1fc4}, {0xd1fc6, 0xd1fcc}, - {0xd1fd0, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fe0, 0xd1fec}, {0xd1ff2, 0xd1ff4}, - {0xd1ff6, 0xd1ffc}, {0xd2090, 0xd209c}, {0xd210a, 0xd2113}, {0xd2119, 0xd211d}, - {0xd212a, 0xd212d}, {0xd212f, 0xd2139}, {0xd213c, 0xd213f}, {0xd2145, 0xd2149}, - {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2ce4}, {0xd2ceb, 0xd2cee}, - {0xd2d00, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d80, 0xd2d96}, {0xd2da0, 0xd2da6}, - {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, - {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd3031, 0xd3035}, - {0xd3041, 0xd3096}, {0xd309d, 0xd309f}, {0xd30a1, 0xd30fa}, {0xd30fc, 0xd30ff}, - {0xd3105, 0xd312e}, {0xd3131, 0xd318e}, {0xd31a0, 0xd31ba}, {0xd31f0, 0xd31ff}, - {0xd3400, 0xd4db5}, {0xd4e00, 0xd9fea}, {0xda000, 0xda48c}, {0xda4d0, 0xda4fd}, - {0xda500, 0xda60c}, {0xda610, 0xda61f}, {0xda640, 0xda66e}, {0xda67f, 0xda69d}, - {0xda6a0, 0xda6e5}, {0xda717, 0xda71f}, {0xda722, 0xda788}, {0xda78b, 0xda7ae}, - {0xda7b0, 0xda7b7}, {0xda7f7, 0xda801}, {0xda803, 0xda805}, {0xda807, 0xda80a}, - {0xda80c, 0xda822}, {0xda840, 0xda873}, {0xda882, 0xda8b3}, {0xda8f2, 0xda8f7}, - {0xda90a, 0xda925}, {0xda930, 0xda946}, {0xda960, 0xda97c}, {0xda984, 0xda9b2}, - {0xda9e0, 0xda9e4}, {0xda9e6, 0xda9ef}, {0xda9fa, 0xda9fe}, {0xdaa00, 0xdaa28}, - {0xdaa40, 0xdaa42}, {0xdaa44, 0xdaa4b}, {0xdaa60, 0xdaa76}, {0xdaa7e, 0xdaaaf}, - {0xdaab9, 0xdaabd}, {0xdaadb, 0xdaadd}, {0xdaae0, 0xdaaea}, {0xdaaf2, 0xdaaf4}, - {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, {0xdab20, 0xdab26}, - {0xdab28, 0xdab2e}, {0xdab30, 0xdab5a}, {0xdab5c, 0xdab65}, {0xdab70, 0xdabe2}, - {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, {0xdf900, 0xdfa6d}, - {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, {0xdfb1f, 0xdfb28}, - {0xdfb2a, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbb1}, {0xdfbd3, 0xdfd3d}, - {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfb}, {0xdfe70, 0xdfe74}, - {0xdfe76, 0xdfefc}, {0xdff21, 0xdff3a}, {0xdff41, 0xdff5a}, {0xdff66, 0xdffbe}, - {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, - {0xe0041, 0xe005a}, {0xe0061, 0xe007a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00f6}, - {0xe00f8, 0xe02c1}, {0xe02c6, 0xe02d1}, {0xe02e0, 0xe02e4}, {0xe0370, 0xe0374}, - {0xe037a, 0xe037d}, {0xe0388, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe03f5}, - {0xe03f7, 0xe0481}, {0xe048a, 0xe052f}, {0xe0531, 0xe0556}, {0xe0561, 0xe0587}, - {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f2}, {0xe0620, 0xe064a}, {0xe0671, 0xe06d3}, - {0xe06fa, 0xe06fc}, {0xe0712, 0xe072f}, {0xe074d, 0xe07a5}, {0xe07ca, 0xe07ea}, - {0xe0800, 0xe0815}, {0xe0840, 0xe0858}, {0xe0860, 0xe086a}, {0xe08a0, 0xe08b4}, - {0xe08b6, 0xe08bd}, {0xe0904, 0xe0939}, {0xe0958, 0xe0961}, {0xe0971, 0xe0980}, - {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, - {0xe09df, 0xe09e1}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, - {0xe0a59, 0xe0a5c}, {0xe0a72, 0xe0a74}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, - {0xe0a93, 0xe0aa8}, {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0b05, 0xe0b0c}, - {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, {0xe0b35, 0xe0b39}, {0xe0b5f, 0xe0b61}, - {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, {0xe0ba8, 0xe0baa}, - {0xe0bae, 0xe0bb9}, {0xe0c05, 0xe0c0c}, {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, - {0xe0c2a, 0xe0c39}, {0xe0c58, 0xe0c5a}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, - {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0d05, 0xe0d0c}, - {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d3a}, {0xe0d54, 0xe0d56}, {0xe0d5f, 0xe0d61}, - {0xe0d7a, 0xe0d7f}, {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, - {0xe0dc0, 0xe0dc6}, {0xe0e01, 0xe0e30}, {0xe0e40, 0xe0e46}, {0xe0e94, 0xe0e97}, - {0xe0e99, 0xe0e9f}, {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb0}, {0xe0ec0, 0xe0ec4}, - {0xe0edc, 0xe0edf}, {0xe0f40, 0xe0f47}, {0xe0f49, 0xe0f6c}, {0xe0f88, 0xe0f8c}, - {0xe1000, 0xe102a}, {0xe1050, 0xe1055}, {0xe105a, 0xe105d}, {0xe106e, 0xe1070}, - {0xe1075, 0xe1081}, {0xe10a0, 0xe10c5}, {0xe10d0, 0xe10fa}, {0xe10fc, 0xe1248}, - {0xe124a, 0xe124d}, {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, - {0xe128a, 0xe128d}, {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, - {0xe12c2, 0xe12c5}, {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, - {0xe1318, 0xe135a}, {0xe1380, 0xe138f}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, - {0xe1401, 0xe166c}, {0xe166f, 0xe167f}, {0xe1681, 0xe169a}, {0xe16a0, 0xe16ea}, - {0xe16f1, 0xe16f8}, {0xe1700, 0xe170c}, {0xe170e, 0xe1711}, {0xe1720, 0xe1731}, - {0xe1740, 0xe1751}, {0xe1760, 0xe176c}, {0xe176e, 0xe1770}, {0xe1780, 0xe17b3}, - {0xe1820, 0xe1877}, {0xe1880, 0xe1884}, {0xe1887, 0xe18a8}, {0xe18b0, 0xe18f5}, - {0xe1900, 0xe191e}, {0xe1950, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, - {0xe19b0, 0xe19c9}, {0xe1a00, 0xe1a16}, {0xe1a20, 0xe1a54}, {0xe1b05, 0xe1b33}, - {0xe1b45, 0xe1b4b}, {0xe1b83, 0xe1ba0}, {0xe1bba, 0xe1be5}, {0xe1c00, 0xe1c23}, - {0xe1c4d, 0xe1c4f}, {0xe1c5a, 0xe1c7d}, {0xe1c80, 0xe1c88}, {0xe1ce9, 0xe1cec}, - {0xe1cee, 0xe1cf1}, {0xe1d00, 0xe1dbf}, {0xe1e00, 0xe1f15}, {0xe1f18, 0xe1f1d}, - {0xe1f20, 0xe1f45}, {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, - {0xe1f80, 0xe1fb4}, {0xe1fb6, 0xe1fbc}, {0xe1fc2, 0xe1fc4}, {0xe1fc6, 0xe1fcc}, - {0xe1fd0, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fe0, 0xe1fec}, {0xe1ff2, 0xe1ff4}, - {0xe1ff6, 0xe1ffc}, {0xe2090, 0xe209c}, {0xe210a, 0xe2113}, {0xe2119, 0xe211d}, - {0xe212a, 0xe212d}, {0xe212f, 0xe2139}, {0xe213c, 0xe213f}, {0xe2145, 0xe2149}, - {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2ce4}, {0xe2ceb, 0xe2cee}, - {0xe2d00, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d80, 0xe2d96}, {0xe2da0, 0xe2da6}, - {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, - {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe3031, 0xe3035}, - {0xe3041, 0xe3096}, {0xe309d, 0xe309f}, {0xe30a1, 0xe30fa}, {0xe30fc, 0xe30ff}, - {0xe3105, 0xe312e}, {0xe3131, 0xe318e}, {0xe31a0, 0xe31ba}, {0xe31f0, 0xe31ff}, - {0xe3400, 0xe4db5}, {0xe4e00, 0xe9fea}, {0xea000, 0xea48c}, {0xea4d0, 0xea4fd}, - {0xea500, 0xea60c}, {0xea610, 0xea61f}, {0xea640, 0xea66e}, {0xea67f, 0xea69d}, - {0xea6a0, 0xea6e5}, {0xea717, 0xea71f}, {0xea722, 0xea788}, {0xea78b, 0xea7ae}, - {0xea7b0, 0xea7b7}, {0xea7f7, 0xea801}, {0xea803, 0xea805}, {0xea807, 0xea80a}, - {0xea80c, 0xea822}, {0xea840, 0xea873}, {0xea882, 0xea8b3}, {0xea8f2, 0xea8f7}, - {0xea90a, 0xea925}, {0xea930, 0xea946}, {0xea960, 0xea97c}, {0xea984, 0xea9b2}, - {0xea9e0, 0xea9e4}, {0xea9e6, 0xea9ef}, {0xea9fa, 0xea9fe}, {0xeaa00, 0xeaa28}, - {0xeaa40, 0xeaa42}, {0xeaa44, 0xeaa4b}, {0xeaa60, 0xeaa76}, {0xeaa7e, 0xeaaaf}, - {0xeaab9, 0xeaabd}, {0xeaadb, 0xeaadd}, {0xeaae0, 0xeaaea}, {0xeaaf2, 0xeaaf4}, - {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, {0xeab20, 0xeab26}, - {0xeab28, 0xeab2e}, {0xeab30, 0xeab5a}, {0xeab5c, 0xeab65}, {0xeab70, 0xeabe2}, - {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, {0xef900, 0xefa6d}, - {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xefb1f, 0xefb28}, - {0xefb2a, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbb1}, {0xefbd3, 0xefd3d}, - {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfb}, {0xefe70, 0xefe74}, - {0xefe76, 0xefefc}, {0xeff21, 0xeff3a}, {0xeff41, 0xeff5a}, {0xeff66, 0xeffbe}, - {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, - {0xf0041, 0xf005a}, {0xf0061, 0xf007a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00f6}, - {0xf00f8, 0xf02c1}, {0xf02c6, 0xf02d1}, {0xf02e0, 0xf02e4}, {0xf0370, 0xf0374}, - {0xf037a, 0xf037d}, {0xf0388, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf03f5}, - {0xf03f7, 0xf0481}, {0xf048a, 0xf052f}, {0xf0531, 0xf0556}, {0xf0561, 0xf0587}, - {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f2}, {0xf0620, 0xf064a}, {0xf0671, 0xf06d3}, - {0xf06fa, 0xf06fc}, {0xf0712, 0xf072f}, {0xf074d, 0xf07a5}, {0xf07ca, 0xf07ea}, - {0xf0800, 0xf0815}, {0xf0840, 0xf0858}, {0xf0860, 0xf086a}, {0xf08a0, 0xf08b4}, - {0xf08b6, 0xf08bd}, {0xf0904, 0xf0939}, {0xf0958, 0xf0961}, {0xf0971, 0xf0980}, - {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, - {0xf09df, 0xf09e1}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, - {0xf0a59, 0xf0a5c}, {0xf0a72, 0xf0a74}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, - {0xf0a93, 0xf0aa8}, {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0b05, 0xf0b0c}, - {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, {0xf0b35, 0xf0b39}, {0xf0b5f, 0xf0b61}, - {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, {0xf0ba8, 0xf0baa}, - {0xf0bae, 0xf0bb9}, {0xf0c05, 0xf0c0c}, {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, - {0xf0c2a, 0xf0c39}, {0xf0c58, 0xf0c5a}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, - {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0d05, 0xf0d0c}, - {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d3a}, {0xf0d54, 0xf0d56}, {0xf0d5f, 0xf0d61}, - {0xf0d7a, 0xf0d7f}, {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, - {0xf0dc0, 0xf0dc6}, {0xf0e01, 0xf0e30}, {0xf0e40, 0xf0e46}, {0xf0e94, 0xf0e97}, - {0xf0e99, 0xf0e9f}, {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb0}, {0xf0ec0, 0xf0ec4}, - {0xf0edc, 0xf0edf}, {0xf0f40, 0xf0f47}, {0xf0f49, 0xf0f6c}, {0xf0f88, 0xf0f8c}, - {0xf1000, 0xf102a}, {0xf1050, 0xf1055}, {0xf105a, 0xf105d}, {0xf106e, 0xf1070}, - {0xf1075, 0xf1081}, {0xf10a0, 0xf10c5}, {0xf10d0, 0xf10fa}, {0xf10fc, 0xf1248}, - {0xf124a, 0xf124d}, {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, - {0xf128a, 0xf128d}, {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, - {0xf12c2, 0xf12c5}, {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, - {0xf1318, 0xf135a}, {0xf1380, 0xf138f}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, - {0xf1401, 0xf166c}, {0xf166f, 0xf167f}, {0xf1681, 0xf169a}, {0xf16a0, 0xf16ea}, - {0xf16f1, 0xf16f8}, {0xf1700, 0xf170c}, {0xf170e, 0xf1711}, {0xf1720, 0xf1731}, - {0xf1740, 0xf1751}, {0xf1760, 0xf176c}, {0xf176e, 0xf1770}, {0xf1780, 0xf17b3}, - {0xf1820, 0xf1877}, {0xf1880, 0xf1884}, {0xf1887, 0xf18a8}, {0xf18b0, 0xf18f5}, - {0xf1900, 0xf191e}, {0xf1950, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, - {0xf19b0, 0xf19c9}, {0xf1a00, 0xf1a16}, {0xf1a20, 0xf1a54}, {0xf1b05, 0xf1b33}, - {0xf1b45, 0xf1b4b}, {0xf1b83, 0xf1ba0}, {0xf1bba, 0xf1be5}, {0xf1c00, 0xf1c23}, - {0xf1c4d, 0xf1c4f}, {0xf1c5a, 0xf1c7d}, {0xf1c80, 0xf1c88}, {0xf1ce9, 0xf1cec}, - {0xf1cee, 0xf1cf1}, {0xf1d00, 0xf1dbf}, {0xf1e00, 0xf1f15}, {0xf1f18, 0xf1f1d}, - {0xf1f20, 0xf1f45}, {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, - {0xf1f80, 0xf1fb4}, {0xf1fb6, 0xf1fbc}, {0xf1fc2, 0xf1fc4}, {0xf1fc6, 0xf1fcc}, - {0xf1fd0, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fe0, 0xf1fec}, {0xf1ff2, 0xf1ff4}, - {0xf1ff6, 0xf1ffc}, {0xf2090, 0xf209c}, {0xf210a, 0xf2113}, {0xf2119, 0xf211d}, - {0xf212a, 0xf212d}, {0xf212f, 0xf2139}, {0xf213c, 0xf213f}, {0xf2145, 0xf2149}, - {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2ce4}, {0xf2ceb, 0xf2cee}, - {0xf2d00, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d80, 0xf2d96}, {0xf2da0, 0xf2da6}, - {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, - {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf3031, 0xf3035}, - {0xf3041, 0xf3096}, {0xf309d, 0xf309f}, {0xf30a1, 0xf30fa}, {0xf30fc, 0xf30ff}, - {0xf3105, 0xf312e}, {0xf3131, 0xf318e}, {0xf31a0, 0xf31ba}, {0xf31f0, 0xf31ff}, - {0xf3400, 0xf4db5}, {0xf4e00, 0xf9fea}, {0xfa000, 0xfa48c}, {0xfa4d0, 0xfa4fd}, - {0xfa500, 0xfa60c}, {0xfa610, 0xfa61f}, {0xfa640, 0xfa66e}, {0xfa67f, 0xfa69d}, - {0xfa6a0, 0xfa6e5}, {0xfa717, 0xfa71f}, {0xfa722, 0xfa788}, {0xfa78b, 0xfa7ae}, - {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa801}, {0xfa803, 0xfa805}, {0xfa807, 0xfa80a}, - {0xfa80c, 0xfa822}, {0xfa840, 0xfa873}, {0xfa882, 0xfa8b3}, {0xfa8f2, 0xfa8f7}, - {0xfa90a, 0xfa925}, {0xfa930, 0xfa946}, {0xfa960, 0xfa97c}, {0xfa984, 0xfa9b2}, - {0xfa9e0, 0xfa9e4}, {0xfa9e6, 0xfa9ef}, {0xfa9fa, 0xfa9fe}, {0xfaa00, 0xfaa28}, - {0xfaa40, 0xfaa42}, {0xfaa44, 0xfaa4b}, {0xfaa60, 0xfaa76}, {0xfaa7e, 0xfaaaf}, - {0xfaab9, 0xfaabd}, {0xfaadb, 0xfaadd}, {0xfaae0, 0xfaaea}, {0xfaaf2, 0xfaaf4}, - {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, {0xfab20, 0xfab26}, - {0xfab28, 0xfab2e}, {0xfab30, 0xfab5a}, {0xfab5c, 0xfab65}, {0xfab70, 0xfabe2}, - {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, {0xff900, 0xffa6d}, - {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, {0xffb1f, 0xffb28}, - {0xffb2a, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbb1}, {0xffbd3, 0xffd3d}, - {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfb}, {0xffe70, 0xffe74}, - {0xffe76, 0xffefc}, {0xfff21, 0xfff3a}, {0xfff41, 0xfff5a}, {0xfff66, 0xfffbe}, - {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, - {0x100041, 0x10005a}, {0x100061, 0x10007a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000f6}, - {0x1000f8, 0x1002c1}, {0x1002c6, 0x1002d1}, {0x1002e0, 0x1002e4}, {0x100370, 0x100374}, - {0x10037a, 0x10037d}, {0x100388, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x1003f5}, - {0x1003f7, 0x100481}, {0x10048a, 0x10052f}, {0x100531, 0x100556}, {0x100561, 0x100587}, - {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f2}, {0x100620, 0x10064a}, {0x100671, 0x1006d3}, - {0x1006fa, 0x1006fc}, {0x100712, 0x10072f}, {0x10074d, 0x1007a5}, {0x1007ca, 0x1007ea}, - {0x100800, 0x100815}, {0x100840, 0x100858}, {0x100860, 0x10086a}, {0x1008a0, 0x1008b4}, - {0x1008b6, 0x1008bd}, {0x100904, 0x100939}, {0x100958, 0x100961}, {0x100971, 0x100980}, - {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, - {0x1009df, 0x1009e1}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, - {0x100a59, 0x100a5c}, {0x100a72, 0x100a74}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, - {0x100a93, 0x100aa8}, {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100b05, 0x100b0c}, - {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, {0x100b35, 0x100b39}, {0x100b5f, 0x100b61}, - {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, {0x100ba8, 0x100baa}, - {0x100bae, 0x100bb9}, {0x100c05, 0x100c0c}, {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, - {0x100c2a, 0x100c39}, {0x100c58, 0x100c5a}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, - {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100d05, 0x100d0c}, - {0x100d0e, 0x100d10}, {0x100d12, 0x100d3a}, {0x100d54, 0x100d56}, {0x100d5f, 0x100d61}, - {0x100d7a, 0x100d7f}, {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, - {0x100dc0, 0x100dc6}, {0x100e01, 0x100e30}, {0x100e40, 0x100e46}, {0x100e94, 0x100e97}, - {0x100e99, 0x100e9f}, {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb0}, {0x100ec0, 0x100ec4}, - {0x100edc, 0x100edf}, {0x100f40, 0x100f47}, {0x100f49, 0x100f6c}, {0x100f88, 0x100f8c}, - {0x101000, 0x10102a}, {0x101050, 0x101055}, {0x10105a, 0x10105d}, {0x10106e, 0x101070}, - {0x101075, 0x101081}, {0x1010a0, 0x1010c5}, {0x1010d0, 0x1010fa}, {0x1010fc, 0x101248}, - {0x10124a, 0x10124d}, {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, - {0x10128a, 0x10128d}, {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, - {0x1012c2, 0x1012c5}, {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, - {0x101318, 0x10135a}, {0x101380, 0x10138f}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, - {0x101401, 0x10166c}, {0x10166f, 0x10167f}, {0x101681, 0x10169a}, {0x1016a0, 0x1016ea}, - {0x1016f1, 0x1016f8}, {0x101700, 0x10170c}, {0x10170e, 0x101711}, {0x101720, 0x101731}, - {0x101740, 0x101751}, {0x101760, 0x10176c}, {0x10176e, 0x101770}, {0x101780, 0x1017b3}, - {0x101820, 0x101877}, {0x101880, 0x101884}, {0x101887, 0x1018a8}, {0x1018b0, 0x1018f5}, - {0x101900, 0x10191e}, {0x101950, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, - {0x1019b0, 0x1019c9}, {0x101a00, 0x101a16}, {0x101a20, 0x101a54}, {0x101b05, 0x101b33}, - {0x101b45, 0x101b4b}, {0x101b83, 0x101ba0}, {0x101bba, 0x101be5}, {0x101c00, 0x101c23}, - {0x101c4d, 0x101c4f}, {0x101c5a, 0x101c7d}, {0x101c80, 0x101c88}, {0x101ce9, 0x101cec}, - {0x101cee, 0x101cf1}, {0x101d00, 0x101dbf}, {0x101e00, 0x101f15}, {0x101f18, 0x101f1d}, - {0x101f20, 0x101f45}, {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, - {0x101f80, 0x101fb4}, {0x101fb6, 0x101fbc}, {0x101fc2, 0x101fc4}, {0x101fc6, 0x101fcc}, - {0x101fd0, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fe0, 0x101fec}, {0x101ff2, 0x101ff4}, - {0x101ff6, 0x101ffc}, {0x102090, 0x10209c}, {0x10210a, 0x102113}, {0x102119, 0x10211d}, - {0x10212a, 0x10212d}, {0x10212f, 0x102139}, {0x10213c, 0x10213f}, {0x102145, 0x102149}, - {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102ce4}, {0x102ceb, 0x102cee}, - {0x102d00, 0x102d25}, {0x102d30, 0x102d67}, {0x102d80, 0x102d96}, {0x102da0, 0x102da6}, - {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, - {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x103031, 0x103035}, - {0x103041, 0x103096}, {0x10309d, 0x10309f}, {0x1030a1, 0x1030fa}, {0x1030fc, 0x1030ff}, - {0x103105, 0x10312e}, {0x103131, 0x10318e}, {0x1031a0, 0x1031ba}, {0x1031f0, 0x1031ff}, - {0x103400, 0x104db5}, {0x104e00, 0x109fea}, {0x10a000, 0x10a48c}, {0x10a4d0, 0x10a4fd}, - {0x10a500, 0x10a60c}, {0x10a610, 0x10a61f}, {0x10a640, 0x10a66e}, {0x10a67f, 0x10a69d}, - {0x10a6a0, 0x10a6e5}, {0x10a717, 0x10a71f}, {0x10a722, 0x10a788}, {0x10a78b, 0x10a7ae}, - {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a801}, {0x10a803, 0x10a805}, {0x10a807, 0x10a80a}, - {0x10a80c, 0x10a822}, {0x10a840, 0x10a873}, {0x10a882, 0x10a8b3}, {0x10a8f2, 0x10a8f7}, - {0x10a90a, 0x10a925}, {0x10a930, 0x10a946}, {0x10a960, 0x10a97c}, {0x10a984, 0x10a9b2}, - {0x10a9e0, 0x10a9e4}, {0x10a9e6, 0x10a9ef}, {0x10a9fa, 0x10a9fe}, {0x10aa00, 0x10aa28}, - {0x10aa40, 0x10aa42}, {0x10aa44, 0x10aa4b}, {0x10aa60, 0x10aa76}, {0x10aa7e, 0x10aaaf}, - {0x10aab9, 0x10aabd}, {0x10aadb, 0x10aadd}, {0x10aae0, 0x10aaea}, {0x10aaf2, 0x10aaf4}, - {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, {0x10ab20, 0x10ab26}, - {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab5a}, {0x10ab5c, 0x10ab65}, {0x10ab70, 0x10abe2}, - {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, {0x10f900, 0x10fa6d}, - {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10fb1f, 0x10fb28}, - {0x10fb2a, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbb1}, {0x10fbd3, 0x10fd3d}, - {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfb}, {0x10fe70, 0x10fe74}, - {0x10fe76, 0x10fefc}, {0x10ff21, 0x10ff3a}, {0x10ff41, 0x10ff5a}, {0x10ff66, 0x10ffbe}, - {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc} + ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, + {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0}, + {0x10300, 0x1031f}, {0x1032d, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, + {0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d}, + {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, + {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805}, + {0x1080a, 0x10835}, {0x1083f, 0x10855}, {0x10860, 0x10876}, {0x10880, 0x1089e}, + {0x108e0, 0x108f2}, {0x10900, 0x10915}, {0x10920, 0x10939}, {0x10980, 0x109b7}, + {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a60, 0x10a7c}, + {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4}, {0x10b00, 0x10b35}, + {0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91}, {0x10c00, 0x10c48}, + {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x11003, 0x11037}, {0x11083, 0x110af}, + {0x110d0, 0x110e8}, {0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, + {0x111c1, 0x111c4}, {0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286}, + {0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de}, + {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, + {0x1135d, 0x11361}, {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af}, + {0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa}, + {0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11a0b, 0x11a32}, {0x11a5c, 0x11a83}, + {0x11a86, 0x11a89}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c2e}, + {0x11c72, 0x11c8f}, {0x11d00, 0x11d06}, {0x11d0b, 0x11d30}, {0x12000, 0x12399}, + {0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, + {0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, + {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f}, + {0x17000, 0x187ec}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb}, + {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, + {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, + {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, + {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, + {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da}, + {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, {0x1d736, 0x1d74e}, + {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, + {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, {0x1ee00, 0x1ee03}, + {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, + {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, + {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, + {0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, + {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d} #endif }; @@ -1265,294 +267,14 @@ static const chr alphaCharTable[] = { 0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 #if TCL_UTF_MAX > 4 - ,0x100aa, 0x100b5, 0x100ba, 0x102ec, 0x102ee, 0x10376, 0x10377, 0x1037f, 0x10386, - 0x1038c, 0x10559, 0x1066e, 0x1066f, 0x106d5, 0x106e5, 0x106e6, 0x106ee, 0x106ef, - 0x106ff, 0x10710, 0x107b1, 0x107f4, 0x107f5, 0x107fa, 0x1081a, 0x10824, 0x10828, - 0x1093d, 0x10950, 0x1098f, 0x10990, 0x109b2, 0x109bd, 0x109ce, 0x109dc, 0x109dd, - 0x109f0, 0x109f1, 0x109fc, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, - 0x10a38, 0x10a39, 0x10a5e, 0x10ab2, 0x10ab3, 0x10abd, 0x10ad0, 0x10ae0, 0x10ae1, - 0x10af9, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b3d, 0x10b5c, 0x10b5d, 0x10b71, - 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, 0x10ba3, 0x10ba4, 0x10bd0, - 0x10c3d, 0x10c60, 0x10c61, 0x10c80, 0x10cbd, 0x10cde, 0x10ce0, 0x10ce1, 0x10cf1, - 0x10cf2, 0x10d3d, 0x10d4e, 0x10dbd, 0x10e32, 0x10e33, 0x10e81, 0x10e82, 0x10e84, - 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, 0x10eb2, - 0x10eb3, 0x10ebd, 0x10ec6, 0x10f00, 0x1103f, 0x11061, 0x11065, 0x11066, 0x1108e, - 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x117d7, 0x117dc, 0x118aa, 0x11aa7, 0x11bae, - 0x11baf, 0x11cf5, 0x11cf6, 0x11f59, 0x11f5b, 0x11f5d, 0x11fbe, 0x12071, 0x1207f, - 0x12102, 0x12107, 0x12115, 0x12124, 0x12126, 0x12128, 0x1214e, 0x12183, 0x12184, - 0x12cf2, 0x12cf3, 0x12d27, 0x12d2d, 0x12d6f, 0x12e2f, 0x13005, 0x13006, 0x1303b, - 0x1303c, 0x1a62a, 0x1a62b, 0x1a8fb, 0x1a8fd, 0x1a9cf, 0x1aa7a, 0x1aab1, 0x1aab5, - 0x1aab6, 0x1aac0, 0x1aac2, 0x1fb1d, 0x1fb3e, 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, - 0x200aa, 0x200b5, 0x200ba, 0x202ec, 0x202ee, 0x20376, 0x20377, 0x2037f, 0x20386, - 0x2038c, 0x20559, 0x2066e, 0x2066f, 0x206d5, 0x206e5, 0x206e6, 0x206ee, 0x206ef, - 0x206ff, 0x20710, 0x207b1, 0x207f4, 0x207f5, 0x207fa, 0x2081a, 0x20824, 0x20828, - 0x2093d, 0x20950, 0x2098f, 0x20990, 0x209b2, 0x209bd, 0x209ce, 0x209dc, 0x209dd, - 0x209f0, 0x209f1, 0x209fc, 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, - 0x20a38, 0x20a39, 0x20a5e, 0x20ab2, 0x20ab3, 0x20abd, 0x20ad0, 0x20ae0, 0x20ae1, - 0x20af9, 0x20b0f, 0x20b10, 0x20b32, 0x20b33, 0x20b3d, 0x20b5c, 0x20b5d, 0x20b71, - 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, - 0x20c3d, 0x20c60, 0x20c61, 0x20c80, 0x20cbd, 0x20cde, 0x20ce0, 0x20ce1, 0x20cf1, - 0x20cf2, 0x20d3d, 0x20d4e, 0x20dbd, 0x20e32, 0x20e33, 0x20e81, 0x20e82, 0x20e84, - 0x20e87, 0x20e88, 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20eb2, - 0x20eb3, 0x20ebd, 0x20ec6, 0x20f00, 0x2103f, 0x21061, 0x21065, 0x21066, 0x2108e, - 0x210c7, 0x210cd, 0x21258, 0x212c0, 0x217d7, 0x217dc, 0x218aa, 0x21aa7, 0x21bae, - 0x21baf, 0x21cf5, 0x21cf6, 0x21f59, 0x21f5b, 0x21f5d, 0x21fbe, 0x22071, 0x2207f, - 0x22102, 0x22107, 0x22115, 0x22124, 0x22126, 0x22128, 0x2214e, 0x22183, 0x22184, - 0x22cf2, 0x22cf3, 0x22d27, 0x22d2d, 0x22d6f, 0x22e2f, 0x23005, 0x23006, 0x2303b, - 0x2303c, 0x2a62a, 0x2a62b, 0x2a8fb, 0x2a8fd, 0x2a9cf, 0x2aa7a, 0x2aab1, 0x2aab5, - 0x2aab6, 0x2aac0, 0x2aac2, 0x2fb1d, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, 0x2fb44, - 0x300aa, 0x300b5, 0x300ba, 0x302ec, 0x302ee, 0x30376, 0x30377, 0x3037f, 0x30386, - 0x3038c, 0x30559, 0x3066e, 0x3066f, 0x306d5, 0x306e5, 0x306e6, 0x306ee, 0x306ef, - 0x306ff, 0x30710, 0x307b1, 0x307f4, 0x307f5, 0x307fa, 0x3081a, 0x30824, 0x30828, - 0x3093d, 0x30950, 0x3098f, 0x30990, 0x309b2, 0x309bd, 0x309ce, 0x309dc, 0x309dd, - 0x309f0, 0x309f1, 0x309fc, 0x30a0f, 0x30a10, 0x30a32, 0x30a33, 0x30a35, 0x30a36, - 0x30a38, 0x30a39, 0x30a5e, 0x30ab2, 0x30ab3, 0x30abd, 0x30ad0, 0x30ae0, 0x30ae1, - 0x30af9, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b3d, 0x30b5c, 0x30b5d, 0x30b71, - 0x30b83, 0x30b99, 0x30b9a, 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, - 0x30c3d, 0x30c60, 0x30c61, 0x30c80, 0x30cbd, 0x30cde, 0x30ce0, 0x30ce1, 0x30cf1, - 0x30cf2, 0x30d3d, 0x30d4e, 0x30dbd, 0x30e32, 0x30e33, 0x30e81, 0x30e82, 0x30e84, - 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, 0x30ea7, 0x30eaa, 0x30eab, 0x30eb2, - 0x30eb3, 0x30ebd, 0x30ec6, 0x30f00, 0x3103f, 0x31061, 0x31065, 0x31066, 0x3108e, - 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x317d7, 0x317dc, 0x318aa, 0x31aa7, 0x31bae, - 0x31baf, 0x31cf5, 0x31cf6, 0x31f59, 0x31f5b, 0x31f5d, 0x31fbe, 0x32071, 0x3207f, - 0x32102, 0x32107, 0x32115, 0x32124, 0x32126, 0x32128, 0x3214e, 0x32183, 0x32184, - 0x32cf2, 0x32cf3, 0x32d27, 0x32d2d, 0x32d6f, 0x32e2f, 0x33005, 0x33006, 0x3303b, - 0x3303c, 0x3a62a, 0x3a62b, 0x3a8fb, 0x3a8fd, 0x3a9cf, 0x3aa7a, 0x3aab1, 0x3aab5, - 0x3aab6, 0x3aac0, 0x3aac2, 0x3fb1d, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, - 0x400aa, 0x400b5, 0x400ba, 0x402ec, 0x402ee, 0x40376, 0x40377, 0x4037f, 0x40386, - 0x4038c, 0x40559, 0x4066e, 0x4066f, 0x406d5, 0x406e5, 0x406e6, 0x406ee, 0x406ef, - 0x406ff, 0x40710, 0x407b1, 0x407f4, 0x407f5, 0x407fa, 0x4081a, 0x40824, 0x40828, - 0x4093d, 0x40950, 0x4098f, 0x40990, 0x409b2, 0x409bd, 0x409ce, 0x409dc, 0x409dd, - 0x409f0, 0x409f1, 0x409fc, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, - 0x40a38, 0x40a39, 0x40a5e, 0x40ab2, 0x40ab3, 0x40abd, 0x40ad0, 0x40ae0, 0x40ae1, - 0x40af9, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b3d, 0x40b5c, 0x40b5d, 0x40b71, - 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, 0x40ba3, 0x40ba4, 0x40bd0, - 0x40c3d, 0x40c60, 0x40c61, 0x40c80, 0x40cbd, 0x40cde, 0x40ce0, 0x40ce1, 0x40cf1, - 0x40cf2, 0x40d3d, 0x40d4e, 0x40dbd, 0x40e32, 0x40e33, 0x40e81, 0x40e82, 0x40e84, - 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, 0x40eb2, - 0x40eb3, 0x40ebd, 0x40ec6, 0x40f00, 0x4103f, 0x41061, 0x41065, 0x41066, 0x4108e, - 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x417d7, 0x417dc, 0x418aa, 0x41aa7, 0x41bae, - 0x41baf, 0x41cf5, 0x41cf6, 0x41f59, 0x41f5b, 0x41f5d, 0x41fbe, 0x42071, 0x4207f, - 0x42102, 0x42107, 0x42115, 0x42124, 0x42126, 0x42128, 0x4214e, 0x42183, 0x42184, - 0x42cf2, 0x42cf3, 0x42d27, 0x42d2d, 0x42d6f, 0x42e2f, 0x43005, 0x43006, 0x4303b, - 0x4303c, 0x4a62a, 0x4a62b, 0x4a8fb, 0x4a8fd, 0x4a9cf, 0x4aa7a, 0x4aab1, 0x4aab5, - 0x4aab6, 0x4aac0, 0x4aac2, 0x4fb1d, 0x4fb3e, 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, - 0x500aa, 0x500b5, 0x500ba, 0x502ec, 0x502ee, 0x50376, 0x50377, 0x5037f, 0x50386, - 0x5038c, 0x50559, 0x5066e, 0x5066f, 0x506d5, 0x506e5, 0x506e6, 0x506ee, 0x506ef, - 0x506ff, 0x50710, 0x507b1, 0x507f4, 0x507f5, 0x507fa, 0x5081a, 0x50824, 0x50828, - 0x5093d, 0x50950, 0x5098f, 0x50990, 0x509b2, 0x509bd, 0x509ce, 0x509dc, 0x509dd, - 0x509f0, 0x509f1, 0x509fc, 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, - 0x50a38, 0x50a39, 0x50a5e, 0x50ab2, 0x50ab3, 0x50abd, 0x50ad0, 0x50ae0, 0x50ae1, - 0x50af9, 0x50b0f, 0x50b10, 0x50b32, 0x50b33, 0x50b3d, 0x50b5c, 0x50b5d, 0x50b71, - 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, - 0x50c3d, 0x50c60, 0x50c61, 0x50c80, 0x50cbd, 0x50cde, 0x50ce0, 0x50ce1, 0x50cf1, - 0x50cf2, 0x50d3d, 0x50d4e, 0x50dbd, 0x50e32, 0x50e33, 0x50e81, 0x50e82, 0x50e84, - 0x50e87, 0x50e88, 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50eb2, - 0x50eb3, 0x50ebd, 0x50ec6, 0x50f00, 0x5103f, 0x51061, 0x51065, 0x51066, 0x5108e, - 0x510c7, 0x510cd, 0x51258, 0x512c0, 0x517d7, 0x517dc, 0x518aa, 0x51aa7, 0x51bae, - 0x51baf, 0x51cf5, 0x51cf6, 0x51f59, 0x51f5b, 0x51f5d, 0x51fbe, 0x52071, 0x5207f, - 0x52102, 0x52107, 0x52115, 0x52124, 0x52126, 0x52128, 0x5214e, 0x52183, 0x52184, - 0x52cf2, 0x52cf3, 0x52d27, 0x52d2d, 0x52d6f, 0x52e2f, 0x53005, 0x53006, 0x5303b, - 0x5303c, 0x5a62a, 0x5a62b, 0x5a8fb, 0x5a8fd, 0x5a9cf, 0x5aa7a, 0x5aab1, 0x5aab5, - 0x5aab6, 0x5aac0, 0x5aac2, 0x5fb1d, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, 0x5fb44, - 0x600aa, 0x600b5, 0x600ba, 0x602ec, 0x602ee, 0x60376, 0x60377, 0x6037f, 0x60386, - 0x6038c, 0x60559, 0x6066e, 0x6066f, 0x606d5, 0x606e5, 0x606e6, 0x606ee, 0x606ef, - 0x606ff, 0x60710, 0x607b1, 0x607f4, 0x607f5, 0x607fa, 0x6081a, 0x60824, 0x60828, - 0x6093d, 0x60950, 0x6098f, 0x60990, 0x609b2, 0x609bd, 0x609ce, 0x609dc, 0x609dd, - 0x609f0, 0x609f1, 0x609fc, 0x60a0f, 0x60a10, 0x60a32, 0x60a33, 0x60a35, 0x60a36, - 0x60a38, 0x60a39, 0x60a5e, 0x60ab2, 0x60ab3, 0x60abd, 0x60ad0, 0x60ae0, 0x60ae1, - 0x60af9, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b3d, 0x60b5c, 0x60b5d, 0x60b71, - 0x60b83, 0x60b99, 0x60b9a, 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, - 0x60c3d, 0x60c60, 0x60c61, 0x60c80, 0x60cbd, 0x60cde, 0x60ce0, 0x60ce1, 0x60cf1, - 0x60cf2, 0x60d3d, 0x60d4e, 0x60dbd, 0x60e32, 0x60e33, 0x60e81, 0x60e82, 0x60e84, - 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, 0x60ea7, 0x60eaa, 0x60eab, 0x60eb2, - 0x60eb3, 0x60ebd, 0x60ec6, 0x60f00, 0x6103f, 0x61061, 0x61065, 0x61066, 0x6108e, - 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x617d7, 0x617dc, 0x618aa, 0x61aa7, 0x61bae, - 0x61baf, 0x61cf5, 0x61cf6, 0x61f59, 0x61f5b, 0x61f5d, 0x61fbe, 0x62071, 0x6207f, - 0x62102, 0x62107, 0x62115, 0x62124, 0x62126, 0x62128, 0x6214e, 0x62183, 0x62184, - 0x62cf2, 0x62cf3, 0x62d27, 0x62d2d, 0x62d6f, 0x62e2f, 0x63005, 0x63006, 0x6303b, - 0x6303c, 0x6a62a, 0x6a62b, 0x6a8fb, 0x6a8fd, 0x6a9cf, 0x6aa7a, 0x6aab1, 0x6aab5, - 0x6aab6, 0x6aac0, 0x6aac2, 0x6fb1d, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, - 0x700aa, 0x700b5, 0x700ba, 0x702ec, 0x702ee, 0x70376, 0x70377, 0x7037f, 0x70386, - 0x7038c, 0x70559, 0x7066e, 0x7066f, 0x706d5, 0x706e5, 0x706e6, 0x706ee, 0x706ef, - 0x706ff, 0x70710, 0x707b1, 0x707f4, 0x707f5, 0x707fa, 0x7081a, 0x70824, 0x70828, - 0x7093d, 0x70950, 0x7098f, 0x70990, 0x709b2, 0x709bd, 0x709ce, 0x709dc, 0x709dd, - 0x709f0, 0x709f1, 0x709fc, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, - 0x70a38, 0x70a39, 0x70a5e, 0x70ab2, 0x70ab3, 0x70abd, 0x70ad0, 0x70ae0, 0x70ae1, - 0x70af9, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b3d, 0x70b5c, 0x70b5d, 0x70b71, - 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, 0x70ba3, 0x70ba4, 0x70bd0, - 0x70c3d, 0x70c60, 0x70c61, 0x70c80, 0x70cbd, 0x70cde, 0x70ce0, 0x70ce1, 0x70cf1, - 0x70cf2, 0x70d3d, 0x70d4e, 0x70dbd, 0x70e32, 0x70e33, 0x70e81, 0x70e82, 0x70e84, - 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, 0x70eb2, - 0x70eb3, 0x70ebd, 0x70ec6, 0x70f00, 0x7103f, 0x71061, 0x71065, 0x71066, 0x7108e, - 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x717d7, 0x717dc, 0x718aa, 0x71aa7, 0x71bae, - 0x71baf, 0x71cf5, 0x71cf6, 0x71f59, 0x71f5b, 0x71f5d, 0x71fbe, 0x72071, 0x7207f, - 0x72102, 0x72107, 0x72115, 0x72124, 0x72126, 0x72128, 0x7214e, 0x72183, 0x72184, - 0x72cf2, 0x72cf3, 0x72d27, 0x72d2d, 0x72d6f, 0x72e2f, 0x73005, 0x73006, 0x7303b, - 0x7303c, 0x7a62a, 0x7a62b, 0x7a8fb, 0x7a8fd, 0x7a9cf, 0x7aa7a, 0x7aab1, 0x7aab5, - 0x7aab6, 0x7aac0, 0x7aac2, 0x7fb1d, 0x7fb3e, 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, - 0x800aa, 0x800b5, 0x800ba, 0x802ec, 0x802ee, 0x80376, 0x80377, 0x8037f, 0x80386, - 0x8038c, 0x80559, 0x8066e, 0x8066f, 0x806d5, 0x806e5, 0x806e6, 0x806ee, 0x806ef, - 0x806ff, 0x80710, 0x807b1, 0x807f4, 0x807f5, 0x807fa, 0x8081a, 0x80824, 0x80828, - 0x8093d, 0x80950, 0x8098f, 0x80990, 0x809b2, 0x809bd, 0x809ce, 0x809dc, 0x809dd, - 0x809f0, 0x809f1, 0x809fc, 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, - 0x80a38, 0x80a39, 0x80a5e, 0x80ab2, 0x80ab3, 0x80abd, 0x80ad0, 0x80ae0, 0x80ae1, - 0x80af9, 0x80b0f, 0x80b10, 0x80b32, 0x80b33, 0x80b3d, 0x80b5c, 0x80b5d, 0x80b71, - 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, - 0x80c3d, 0x80c60, 0x80c61, 0x80c80, 0x80cbd, 0x80cde, 0x80ce0, 0x80ce1, 0x80cf1, - 0x80cf2, 0x80d3d, 0x80d4e, 0x80dbd, 0x80e32, 0x80e33, 0x80e81, 0x80e82, 0x80e84, - 0x80e87, 0x80e88, 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80eb2, - 0x80eb3, 0x80ebd, 0x80ec6, 0x80f00, 0x8103f, 0x81061, 0x81065, 0x81066, 0x8108e, - 0x810c7, 0x810cd, 0x81258, 0x812c0, 0x817d7, 0x817dc, 0x818aa, 0x81aa7, 0x81bae, - 0x81baf, 0x81cf5, 0x81cf6, 0x81f59, 0x81f5b, 0x81f5d, 0x81fbe, 0x82071, 0x8207f, - 0x82102, 0x82107, 0x82115, 0x82124, 0x82126, 0x82128, 0x8214e, 0x82183, 0x82184, - 0x82cf2, 0x82cf3, 0x82d27, 0x82d2d, 0x82d6f, 0x82e2f, 0x83005, 0x83006, 0x8303b, - 0x8303c, 0x8a62a, 0x8a62b, 0x8a8fb, 0x8a8fd, 0x8a9cf, 0x8aa7a, 0x8aab1, 0x8aab5, - 0x8aab6, 0x8aac0, 0x8aac2, 0x8fb1d, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, 0x8fb44, - 0x900aa, 0x900b5, 0x900ba, 0x902ec, 0x902ee, 0x90376, 0x90377, 0x9037f, 0x90386, - 0x9038c, 0x90559, 0x9066e, 0x9066f, 0x906d5, 0x906e5, 0x906e6, 0x906ee, 0x906ef, - 0x906ff, 0x90710, 0x907b1, 0x907f4, 0x907f5, 0x907fa, 0x9081a, 0x90824, 0x90828, - 0x9093d, 0x90950, 0x9098f, 0x90990, 0x909b2, 0x909bd, 0x909ce, 0x909dc, 0x909dd, - 0x909f0, 0x909f1, 0x909fc, 0x90a0f, 0x90a10, 0x90a32, 0x90a33, 0x90a35, 0x90a36, - 0x90a38, 0x90a39, 0x90a5e, 0x90ab2, 0x90ab3, 0x90abd, 0x90ad0, 0x90ae0, 0x90ae1, - 0x90af9, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b3d, 0x90b5c, 0x90b5d, 0x90b71, - 0x90b83, 0x90b99, 0x90b9a, 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, - 0x90c3d, 0x90c60, 0x90c61, 0x90c80, 0x90cbd, 0x90cde, 0x90ce0, 0x90ce1, 0x90cf1, - 0x90cf2, 0x90d3d, 0x90d4e, 0x90dbd, 0x90e32, 0x90e33, 0x90e81, 0x90e82, 0x90e84, - 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, 0x90ea7, 0x90eaa, 0x90eab, 0x90eb2, - 0x90eb3, 0x90ebd, 0x90ec6, 0x90f00, 0x9103f, 0x91061, 0x91065, 0x91066, 0x9108e, - 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x917d7, 0x917dc, 0x918aa, 0x91aa7, 0x91bae, - 0x91baf, 0x91cf5, 0x91cf6, 0x91f59, 0x91f5b, 0x91f5d, 0x91fbe, 0x92071, 0x9207f, - 0x92102, 0x92107, 0x92115, 0x92124, 0x92126, 0x92128, 0x9214e, 0x92183, 0x92184, - 0x92cf2, 0x92cf3, 0x92d27, 0x92d2d, 0x92d6f, 0x92e2f, 0x93005, 0x93006, 0x9303b, - 0x9303c, 0x9a62a, 0x9a62b, 0x9a8fb, 0x9a8fd, 0x9a9cf, 0x9aa7a, 0x9aab1, 0x9aab5, - 0x9aab6, 0x9aac0, 0x9aac2, 0x9fb1d, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, - 0xa00aa, 0xa00b5, 0xa00ba, 0xa02ec, 0xa02ee, 0xa0376, 0xa0377, 0xa037f, 0xa0386, - 0xa038c, 0xa0559, 0xa066e, 0xa066f, 0xa06d5, 0xa06e5, 0xa06e6, 0xa06ee, 0xa06ef, - 0xa06ff, 0xa0710, 0xa07b1, 0xa07f4, 0xa07f5, 0xa07fa, 0xa081a, 0xa0824, 0xa0828, - 0xa093d, 0xa0950, 0xa098f, 0xa0990, 0xa09b2, 0xa09bd, 0xa09ce, 0xa09dc, 0xa09dd, - 0xa09f0, 0xa09f1, 0xa09fc, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, - 0xa0a38, 0xa0a39, 0xa0a5e, 0xa0ab2, 0xa0ab3, 0xa0abd, 0xa0ad0, 0xa0ae0, 0xa0ae1, - 0xa0af9, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b3d, 0xa0b5c, 0xa0b5d, 0xa0b71, - 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, 0xa0ba3, 0xa0ba4, 0xa0bd0, - 0xa0c3d, 0xa0c60, 0xa0c61, 0xa0c80, 0xa0cbd, 0xa0cde, 0xa0ce0, 0xa0ce1, 0xa0cf1, - 0xa0cf2, 0xa0d3d, 0xa0d4e, 0xa0dbd, 0xa0e32, 0xa0e33, 0xa0e81, 0xa0e82, 0xa0e84, - 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, 0xa0eb2, - 0xa0eb3, 0xa0ebd, 0xa0ec6, 0xa0f00, 0xa103f, 0xa1061, 0xa1065, 0xa1066, 0xa108e, - 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa17d7, 0xa17dc, 0xa18aa, 0xa1aa7, 0xa1bae, - 0xa1baf, 0xa1cf5, 0xa1cf6, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1fbe, 0xa2071, 0xa207f, - 0xa2102, 0xa2107, 0xa2115, 0xa2124, 0xa2126, 0xa2128, 0xa214e, 0xa2183, 0xa2184, - 0xa2cf2, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2e2f, 0xa3005, 0xa3006, 0xa303b, - 0xa303c, 0xaa62a, 0xaa62b, 0xaa8fb, 0xaa8fd, 0xaa9cf, 0xaaa7a, 0xaaab1, 0xaaab5, - 0xaaab6, 0xaaac0, 0xaaac2, 0xafb1d, 0xafb3e, 0xafb40, 0xafb41, 0xafb43, 0xafb44, - 0xb00aa, 0xb00b5, 0xb00ba, 0xb02ec, 0xb02ee, 0xb0376, 0xb0377, 0xb037f, 0xb0386, - 0xb038c, 0xb0559, 0xb066e, 0xb066f, 0xb06d5, 0xb06e5, 0xb06e6, 0xb06ee, 0xb06ef, - 0xb06ff, 0xb0710, 0xb07b1, 0xb07f4, 0xb07f5, 0xb07fa, 0xb081a, 0xb0824, 0xb0828, - 0xb093d, 0xb0950, 0xb098f, 0xb0990, 0xb09b2, 0xb09bd, 0xb09ce, 0xb09dc, 0xb09dd, - 0xb09f0, 0xb09f1, 0xb09fc, 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, - 0xb0a38, 0xb0a39, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0abd, 0xb0ad0, 0xb0ae0, 0xb0ae1, - 0xb0af9, 0xb0b0f, 0xb0b10, 0xb0b32, 0xb0b33, 0xb0b3d, 0xb0b5c, 0xb0b5d, 0xb0b71, - 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, - 0xb0c3d, 0xb0c60, 0xb0c61, 0xb0c80, 0xb0cbd, 0xb0cde, 0xb0ce0, 0xb0ce1, 0xb0cf1, - 0xb0cf2, 0xb0d3d, 0xb0d4e, 0xb0dbd, 0xb0e32, 0xb0e33, 0xb0e81, 0xb0e82, 0xb0e84, - 0xb0e87, 0xb0e88, 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0eb2, - 0xb0eb3, 0xb0ebd, 0xb0ec6, 0xb0f00, 0xb103f, 0xb1061, 0xb1065, 0xb1066, 0xb108e, - 0xb10c7, 0xb10cd, 0xb1258, 0xb12c0, 0xb17d7, 0xb17dc, 0xb18aa, 0xb1aa7, 0xb1bae, - 0xb1baf, 0xb1cf5, 0xb1cf6, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1fbe, 0xb2071, 0xb207f, - 0xb2102, 0xb2107, 0xb2115, 0xb2124, 0xb2126, 0xb2128, 0xb214e, 0xb2183, 0xb2184, - 0xb2cf2, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2e2f, 0xb3005, 0xb3006, 0xb303b, - 0xb303c, 0xba62a, 0xba62b, 0xba8fb, 0xba8fd, 0xba9cf, 0xbaa7a, 0xbaab1, 0xbaab5, - 0xbaab6, 0xbaac0, 0xbaac2, 0xbfb1d, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, 0xbfb44, - 0xc00aa, 0xc00b5, 0xc00ba, 0xc02ec, 0xc02ee, 0xc0376, 0xc0377, 0xc037f, 0xc0386, - 0xc038c, 0xc0559, 0xc066e, 0xc066f, 0xc06d5, 0xc06e5, 0xc06e6, 0xc06ee, 0xc06ef, - 0xc06ff, 0xc0710, 0xc07b1, 0xc07f4, 0xc07f5, 0xc07fa, 0xc081a, 0xc0824, 0xc0828, - 0xc093d, 0xc0950, 0xc098f, 0xc0990, 0xc09b2, 0xc09bd, 0xc09ce, 0xc09dc, 0xc09dd, - 0xc09f0, 0xc09f1, 0xc09fc, 0xc0a0f, 0xc0a10, 0xc0a32, 0xc0a33, 0xc0a35, 0xc0a36, - 0xc0a38, 0xc0a39, 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0abd, 0xc0ad0, 0xc0ae0, 0xc0ae1, - 0xc0af9, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b3d, 0xc0b5c, 0xc0b5d, 0xc0b71, - 0xc0b83, 0xc0b99, 0xc0b9a, 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, - 0xc0c3d, 0xc0c60, 0xc0c61, 0xc0c80, 0xc0cbd, 0xc0cde, 0xc0ce0, 0xc0ce1, 0xc0cf1, - 0xc0cf2, 0xc0d3d, 0xc0d4e, 0xc0dbd, 0xc0e32, 0xc0e33, 0xc0e81, 0xc0e82, 0xc0e84, - 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0eb2, - 0xc0eb3, 0xc0ebd, 0xc0ec6, 0xc0f00, 0xc103f, 0xc1061, 0xc1065, 0xc1066, 0xc108e, - 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc17d7, 0xc17dc, 0xc18aa, 0xc1aa7, 0xc1bae, - 0xc1baf, 0xc1cf5, 0xc1cf6, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1fbe, 0xc2071, 0xc207f, - 0xc2102, 0xc2107, 0xc2115, 0xc2124, 0xc2126, 0xc2128, 0xc214e, 0xc2183, 0xc2184, - 0xc2cf2, 0xc2cf3, 0xc2d27, 0xc2d2d, 0xc2d6f, 0xc2e2f, 0xc3005, 0xc3006, 0xc303b, - 0xc303c, 0xca62a, 0xca62b, 0xca8fb, 0xca8fd, 0xca9cf, 0xcaa7a, 0xcaab1, 0xcaab5, - 0xcaab6, 0xcaac0, 0xcaac2, 0xcfb1d, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, - 0xd00aa, 0xd00b5, 0xd00ba, 0xd02ec, 0xd02ee, 0xd0376, 0xd0377, 0xd037f, 0xd0386, - 0xd038c, 0xd0559, 0xd066e, 0xd066f, 0xd06d5, 0xd06e5, 0xd06e6, 0xd06ee, 0xd06ef, - 0xd06ff, 0xd0710, 0xd07b1, 0xd07f4, 0xd07f5, 0xd07fa, 0xd081a, 0xd0824, 0xd0828, - 0xd093d, 0xd0950, 0xd098f, 0xd0990, 0xd09b2, 0xd09bd, 0xd09ce, 0xd09dc, 0xd09dd, - 0xd09f0, 0xd09f1, 0xd09fc, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, - 0xd0a38, 0xd0a39, 0xd0a5e, 0xd0ab2, 0xd0ab3, 0xd0abd, 0xd0ad0, 0xd0ae0, 0xd0ae1, - 0xd0af9, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b3d, 0xd0b5c, 0xd0b5d, 0xd0b71, - 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, 0xd0ba3, 0xd0ba4, 0xd0bd0, - 0xd0c3d, 0xd0c60, 0xd0c61, 0xd0c80, 0xd0cbd, 0xd0cde, 0xd0ce0, 0xd0ce1, 0xd0cf1, - 0xd0cf2, 0xd0d3d, 0xd0d4e, 0xd0dbd, 0xd0e32, 0xd0e33, 0xd0e81, 0xd0e82, 0xd0e84, - 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, 0xd0eb2, - 0xd0eb3, 0xd0ebd, 0xd0ec6, 0xd0f00, 0xd103f, 0xd1061, 0xd1065, 0xd1066, 0xd108e, - 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd17d7, 0xd17dc, 0xd18aa, 0xd1aa7, 0xd1bae, - 0xd1baf, 0xd1cf5, 0xd1cf6, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1fbe, 0xd2071, 0xd207f, - 0xd2102, 0xd2107, 0xd2115, 0xd2124, 0xd2126, 0xd2128, 0xd214e, 0xd2183, 0xd2184, - 0xd2cf2, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2e2f, 0xd3005, 0xd3006, 0xd303b, - 0xd303c, 0xda62a, 0xda62b, 0xda8fb, 0xda8fd, 0xda9cf, 0xdaa7a, 0xdaab1, 0xdaab5, - 0xdaab6, 0xdaac0, 0xdaac2, 0xdfb1d, 0xdfb3e, 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, - 0xe00aa, 0xe00b5, 0xe00ba, 0xe02ec, 0xe02ee, 0xe0376, 0xe0377, 0xe037f, 0xe0386, - 0xe038c, 0xe0559, 0xe066e, 0xe066f, 0xe06d5, 0xe06e5, 0xe06e6, 0xe06ee, 0xe06ef, - 0xe06ff, 0xe0710, 0xe07b1, 0xe07f4, 0xe07f5, 0xe07fa, 0xe081a, 0xe0824, 0xe0828, - 0xe093d, 0xe0950, 0xe098f, 0xe0990, 0xe09b2, 0xe09bd, 0xe09ce, 0xe09dc, 0xe09dd, - 0xe09f0, 0xe09f1, 0xe09fc, 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, - 0xe0a38, 0xe0a39, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0abd, 0xe0ad0, 0xe0ae0, 0xe0ae1, - 0xe0af9, 0xe0b0f, 0xe0b10, 0xe0b32, 0xe0b33, 0xe0b3d, 0xe0b5c, 0xe0b5d, 0xe0b71, - 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, - 0xe0c3d, 0xe0c60, 0xe0c61, 0xe0c80, 0xe0cbd, 0xe0cde, 0xe0ce0, 0xe0ce1, 0xe0cf1, - 0xe0cf2, 0xe0d3d, 0xe0d4e, 0xe0dbd, 0xe0e32, 0xe0e33, 0xe0e81, 0xe0e82, 0xe0e84, - 0xe0e87, 0xe0e88, 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0eb2, - 0xe0eb3, 0xe0ebd, 0xe0ec6, 0xe0f00, 0xe103f, 0xe1061, 0xe1065, 0xe1066, 0xe108e, - 0xe10c7, 0xe10cd, 0xe1258, 0xe12c0, 0xe17d7, 0xe17dc, 0xe18aa, 0xe1aa7, 0xe1bae, - 0xe1baf, 0xe1cf5, 0xe1cf6, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1fbe, 0xe2071, 0xe207f, - 0xe2102, 0xe2107, 0xe2115, 0xe2124, 0xe2126, 0xe2128, 0xe214e, 0xe2183, 0xe2184, - 0xe2cf2, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2e2f, 0xe3005, 0xe3006, 0xe303b, - 0xe303c, 0xea62a, 0xea62b, 0xea8fb, 0xea8fd, 0xea9cf, 0xeaa7a, 0xeaab1, 0xeaab5, - 0xeaab6, 0xeaac0, 0xeaac2, 0xefb1d, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, 0xefb44, - 0xf00aa, 0xf00b5, 0xf00ba, 0xf02ec, 0xf02ee, 0xf0376, 0xf0377, 0xf037f, 0xf0386, - 0xf038c, 0xf0559, 0xf066e, 0xf066f, 0xf06d5, 0xf06e5, 0xf06e6, 0xf06ee, 0xf06ef, - 0xf06ff, 0xf0710, 0xf07b1, 0xf07f4, 0xf07f5, 0xf07fa, 0xf081a, 0xf0824, 0xf0828, - 0xf093d, 0xf0950, 0xf098f, 0xf0990, 0xf09b2, 0xf09bd, 0xf09ce, 0xf09dc, 0xf09dd, - 0xf09f0, 0xf09f1, 0xf09fc, 0xf0a0f, 0xf0a10, 0xf0a32, 0xf0a33, 0xf0a35, 0xf0a36, - 0xf0a38, 0xf0a39, 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0abd, 0xf0ad0, 0xf0ae0, 0xf0ae1, - 0xf0af9, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b3d, 0xf0b5c, 0xf0b5d, 0xf0b71, - 0xf0b83, 0xf0b99, 0xf0b9a, 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, - 0xf0c3d, 0xf0c60, 0xf0c61, 0xf0c80, 0xf0cbd, 0xf0cde, 0xf0ce0, 0xf0ce1, 0xf0cf1, - 0xf0cf2, 0xf0d3d, 0xf0d4e, 0xf0dbd, 0xf0e32, 0xf0e33, 0xf0e81, 0xf0e82, 0xf0e84, - 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0eb2, - 0xf0eb3, 0xf0ebd, 0xf0ec6, 0xf0f00, 0xf103f, 0xf1061, 0xf1065, 0xf1066, 0xf108e, - 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf17d7, 0xf17dc, 0xf18aa, 0xf1aa7, 0xf1bae, - 0xf1baf, 0xf1cf5, 0xf1cf6, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1fbe, 0xf2071, 0xf207f, - 0xf2102, 0xf2107, 0xf2115, 0xf2124, 0xf2126, 0xf2128, 0xf214e, 0xf2183, 0xf2184, - 0xf2cf2, 0xf2cf3, 0xf2d27, 0xf2d2d, 0xf2d6f, 0xf2e2f, 0xf3005, 0xf3006, 0xf303b, - 0xf303c, 0xfa62a, 0xfa62b, 0xfa8fb, 0xfa8fd, 0xfa9cf, 0xfaa7a, 0xfaab1, 0xfaab5, - 0xfaab6, 0xfaac0, 0xfaac2, 0xffb1d, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, - 0x1000aa, 0x1000b5, 0x1000ba, 0x1002ec, 0x1002ee, 0x100376, 0x100377, 0x10037f, 0x100386, - 0x10038c, 0x100559, 0x10066e, 0x10066f, 0x1006d5, 0x1006e5, 0x1006e6, 0x1006ee, 0x1006ef, - 0x1006ff, 0x100710, 0x1007b1, 0x1007f4, 0x1007f5, 0x1007fa, 0x10081a, 0x100824, 0x100828, - 0x10093d, 0x100950, 0x10098f, 0x100990, 0x1009b2, 0x1009bd, 0x1009ce, 0x1009dc, 0x1009dd, - 0x1009f0, 0x1009f1, 0x1009fc, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, - 0x100a38, 0x100a39, 0x100a5e, 0x100ab2, 0x100ab3, 0x100abd, 0x100ad0, 0x100ae0, 0x100ae1, - 0x100af9, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b3d, 0x100b5c, 0x100b5d, 0x100b71, - 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, 0x100ba3, 0x100ba4, 0x100bd0, - 0x100c3d, 0x100c60, 0x100c61, 0x100c80, 0x100cbd, 0x100cde, 0x100ce0, 0x100ce1, 0x100cf1, - 0x100cf2, 0x100d3d, 0x100d4e, 0x100dbd, 0x100e32, 0x100e33, 0x100e81, 0x100e82, 0x100e84, - 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, 0x100eb2, - 0x100eb3, 0x100ebd, 0x100ec6, 0x100f00, 0x10103f, 0x101061, 0x101065, 0x101066, 0x10108e, - 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x1017d7, 0x1017dc, 0x1018aa, 0x101aa7, 0x101bae, - 0x101baf, 0x101cf5, 0x101cf6, 0x101f59, 0x101f5b, 0x101f5d, 0x101fbe, 0x102071, 0x10207f, - 0x102102, 0x102107, 0x102115, 0x102124, 0x102126, 0x102128, 0x10214e, 0x102183, 0x102184, - 0x102cf2, 0x102cf3, 0x102d27, 0x102d2d, 0x102d6f, 0x102e2f, 0x103005, 0x103006, 0x10303b, - 0x10303c, 0x10a62a, 0x10a62b, 0x10a8fb, 0x10a8fd, 0x10a9cf, 0x10aa7a, 0x10aab1, 0x10aab5, - 0x10aab6, 0x10aac0, 0x10aac2, 0x10fb1d, 0x10fb3e, 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44 + ,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be, + 0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332, + 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x11a00, + 0x11a3a, 0x11a50, 0x11c40, 0x11d08, 0x11d09, 0x11d46, 0x16f50, 0x16fe0, 0x16fe1, + 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, + 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, + 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, + 0x1ee64, 0x1ee7e #endif }; @@ -1567,42 +289,8 @@ static const crange controlRangeTable[] = { {0x202a, 0x202e}, {0x2060, 0x2064}, {0x2066, 0x206f}, {0xe000, 0xf8ff}, {0xfff9, 0xfffb} #if TCL_UTF_MAX > 4 - ,{0x10000, 0x1001f}, {0x1007f, 0x1009f}, {0x10600, 0x10605}, {0x1200b, 0x1200f}, - {0x1202a, 0x1202e}, {0x12060, 0x12064}, {0x12066, 0x1206f}, {0x1e000, 0x1f8ff}, - {0x1fff9, 0x1fffb}, {0x20000, 0x2001f}, {0x2007f, 0x2009f}, {0x20600, 0x20605}, - {0x2200b, 0x2200f}, {0x2202a, 0x2202e}, {0x22060, 0x22064}, {0x22066, 0x2206f}, - {0x2e000, 0x2f8ff}, {0x2fff9, 0x2fffb}, {0x30000, 0x3001f}, {0x3007f, 0x3009f}, - {0x30600, 0x30605}, {0x3200b, 0x3200f}, {0x3202a, 0x3202e}, {0x32060, 0x32064}, - {0x32066, 0x3206f}, {0x3e000, 0x3f8ff}, {0x3fff9, 0x3fffb}, {0x40000, 0x4001f}, - {0x4007f, 0x4009f}, {0x40600, 0x40605}, {0x4200b, 0x4200f}, {0x4202a, 0x4202e}, - {0x42060, 0x42064}, {0x42066, 0x4206f}, {0x4e000, 0x4f8ff}, {0x4fff9, 0x4fffb}, - {0x50000, 0x5001f}, {0x5007f, 0x5009f}, {0x50600, 0x50605}, {0x5200b, 0x5200f}, - {0x5202a, 0x5202e}, {0x52060, 0x52064}, {0x52066, 0x5206f}, {0x5e000, 0x5f8ff}, - {0x5fff9, 0x5fffb}, {0x60000, 0x6001f}, {0x6007f, 0x6009f}, {0x60600, 0x60605}, - {0x6200b, 0x6200f}, {0x6202a, 0x6202e}, {0x62060, 0x62064}, {0x62066, 0x6206f}, - {0x6e000, 0x6f8ff}, {0x6fff9, 0x6fffb}, {0x70000, 0x7001f}, {0x7007f, 0x7009f}, - {0x70600, 0x70605}, {0x7200b, 0x7200f}, {0x7202a, 0x7202e}, {0x72060, 0x72064}, - {0x72066, 0x7206f}, {0x7e000, 0x7f8ff}, {0x7fff9, 0x7fffb}, {0x80000, 0x8001f}, - {0x8007f, 0x8009f}, {0x80600, 0x80605}, {0x8200b, 0x8200f}, {0x8202a, 0x8202e}, - {0x82060, 0x82064}, {0x82066, 0x8206f}, {0x8e000, 0x8f8ff}, {0x8fff9, 0x8fffb}, - {0x90000, 0x9001f}, {0x9007f, 0x9009f}, {0x90600, 0x90605}, {0x9200b, 0x9200f}, - {0x9202a, 0x9202e}, {0x92060, 0x92064}, {0x92066, 0x9206f}, {0x9e000, 0x9f8ff}, - {0x9fff9, 0x9fffb}, {0xa0000, 0xa001f}, {0xa007f, 0xa009f}, {0xa0600, 0xa0605}, - {0xa200b, 0xa200f}, {0xa202a, 0xa202e}, {0xa2060, 0xa2064}, {0xa2066, 0xa206f}, - {0xae000, 0xaf8ff}, {0xafff9, 0xafffb}, {0xb0000, 0xb001f}, {0xb007f, 0xb009f}, - {0xb0600, 0xb0605}, {0xb200b, 0xb200f}, {0xb202a, 0xb202e}, {0xb2060, 0xb2064}, - {0xb2066, 0xb206f}, {0xbe000, 0xbf8ff}, {0xbfff9, 0xbfffb}, {0xc0000, 0xc001f}, - {0xc007f, 0xc009f}, {0xc0600, 0xc0605}, {0xc200b, 0xc200f}, {0xc202a, 0xc202e}, - {0xc2060, 0xc2064}, {0xc2066, 0xc206f}, {0xce000, 0xcf8ff}, {0xcfff9, 0xcfffb}, - {0xd0000, 0xd001f}, {0xd007f, 0xd009f}, {0xd0600, 0xd0605}, {0xd200b, 0xd200f}, - {0xd202a, 0xd202e}, {0xd2060, 0xd2064}, {0xd2066, 0xd206f}, {0xde000, 0xdf8ff}, - {0xdfff9, 0xdfffb}, {0xe0000, 0xe001f}, {0xe007f, 0xe009f}, {0xe0600, 0xe0605}, - {0xe200b, 0xe200f}, {0xe202a, 0xe202e}, {0xe2060, 0xe2064}, {0xe2066, 0xe206f}, - {0xee000, 0xef8ff}, {0xefff9, 0xefffb}, {0xf0000, 0xf001f}, {0xf007f, 0xf009f}, - {0xf0600, 0xf0605}, {0xf200b, 0xf200f}, {0xf202a, 0xf202e}, {0xf2060, 0xf2064}, - {0xf2066, 0xf206f}, {0xfe000, 0xff8ff}, {0xffff9, 0xffffb}, {0x100000, 0x10001f}, - {0x10007f, 0x10009f}, {0x100600, 0x100605}, {0x10200b, 0x10200f}, {0x10202a, 0x10202e}, - {0x102060, 0x102064}, {0x102066, 0x10206f}, {0x10e000, 0x10f8ff}, {0x10fff9, 0x10fffb} + ,{0x1bca0, 0x1bca3}, {0x1d173, 0x1d17a}, {0xe0020, 0xe007f}, {0xf0000, 0xffffd}, + {0x100000, 0x10fffd} #endif }; @@ -1611,19 +299,7 @@ static const crange controlRangeTable[] = { static const chr controlCharTable[] = { 0xad, 0x61c, 0x6dd, 0x70f, 0x8e2, 0x180e, 0xfeff #if TCL_UTF_MAX > 4 - ,0x100ad, 0x1061c, 0x106dd, 0x1070f, 0x108e2, 0x1180e, 0x1feff, 0x200ad, 0x2061c, - 0x206dd, 0x2070f, 0x208e2, 0x2180e, 0x2feff, 0x300ad, 0x3061c, 0x306dd, 0x3070f, - 0x308e2, 0x3180e, 0x3feff, 0x400ad, 0x4061c, 0x406dd, 0x4070f, 0x408e2, 0x4180e, - 0x4feff, 0x500ad, 0x5061c, 0x506dd, 0x5070f, 0x508e2, 0x5180e, 0x5feff, 0x600ad, - 0x6061c, 0x606dd, 0x6070f, 0x608e2, 0x6180e, 0x6feff, 0x700ad, 0x7061c, 0x706dd, - 0x7070f, 0x708e2, 0x7180e, 0x7feff, 0x800ad, 0x8061c, 0x806dd, 0x8070f, 0x808e2, - 0x8180e, 0x8feff, 0x900ad, 0x9061c, 0x906dd, 0x9070f, 0x908e2, 0x9180e, 0x9feff, - 0xa00ad, 0xa061c, 0xa06dd, 0xa070f, 0xa08e2, 0xa180e, 0xafeff, 0xb00ad, 0xb061c, - 0xb06dd, 0xb070f, 0xb08e2, 0xb180e, 0xbfeff, 0xc00ad, 0xc061c, 0xc06dd, 0xc070f, - 0xc08e2, 0xc180e, 0xcfeff, 0xd00ad, 0xd061c, 0xd06dd, 0xd070f, 0xd08e2, 0xd180e, - 0xdfeff, 0xe00ad, 0xe061c, 0xe06dd, 0xe070f, 0xe08e2, 0xe180e, 0xefeff, 0xf00ad, - 0xf061c, 0xf06dd, 0xf070f, 0xf08e2, 0xf180e, 0xffeff, 0x1000ad, 0x10061c, 0x1006dd, - 0x10070f, 0x1008e2, 0x10180e, 0x10feff + ,0x110bd, 0xe0001 #endif }; @@ -1645,154 +321,11 @@ static const crange digitRangeTable[] = { {0xa9d0, 0xa9d9}, {0xa9f0, 0xa9f9}, {0xaa50, 0xaa59}, {0xabf0, 0xabf9}, {0xff10, 0xff19} #if TCL_UTF_MAX > 4 - ,{0x10030, 0x10039}, {0x10660, 0x10669}, {0x106f0, 0x106f9}, {0x107c0, 0x107c9}, - {0x10966, 0x1096f}, {0x109e6, 0x109ef}, {0x10a66, 0x10a6f}, {0x10ae6, 0x10aef}, - {0x10b66, 0x10b6f}, {0x10be6, 0x10bef}, {0x10c66, 0x10c6f}, {0x10ce6, 0x10cef}, - {0x10d66, 0x10d6f}, {0x10de6, 0x10def}, {0x10e50, 0x10e59}, {0x10ed0, 0x10ed9}, - {0x10f20, 0x10f29}, {0x11040, 0x11049}, {0x11090, 0x11099}, {0x117e0, 0x117e9}, - {0x11810, 0x11819}, {0x11946, 0x1194f}, {0x119d0, 0x119d9}, {0x11a80, 0x11a89}, - {0x11a90, 0x11a99}, {0x11b50, 0x11b59}, {0x11bb0, 0x11bb9}, {0x11c40, 0x11c49}, - {0x11c50, 0x11c59}, {0x1a620, 0x1a629}, {0x1a8d0, 0x1a8d9}, {0x1a900, 0x1a909}, - {0x1a9d0, 0x1a9d9}, {0x1a9f0, 0x1a9f9}, {0x1aa50, 0x1aa59}, {0x1abf0, 0x1abf9}, - {0x1ff10, 0x1ff19}, {0x20030, 0x20039}, {0x20660, 0x20669}, {0x206f0, 0x206f9}, - {0x207c0, 0x207c9}, {0x20966, 0x2096f}, {0x209e6, 0x209ef}, {0x20a66, 0x20a6f}, - {0x20ae6, 0x20aef}, {0x20b66, 0x20b6f}, {0x20be6, 0x20bef}, {0x20c66, 0x20c6f}, - {0x20ce6, 0x20cef}, {0x20d66, 0x20d6f}, {0x20de6, 0x20def}, {0x20e50, 0x20e59}, - {0x20ed0, 0x20ed9}, {0x20f20, 0x20f29}, {0x21040, 0x21049}, {0x21090, 0x21099}, - {0x217e0, 0x217e9}, {0x21810, 0x21819}, {0x21946, 0x2194f}, {0x219d0, 0x219d9}, - {0x21a80, 0x21a89}, {0x21a90, 0x21a99}, {0x21b50, 0x21b59}, {0x21bb0, 0x21bb9}, - {0x21c40, 0x21c49}, {0x21c50, 0x21c59}, {0x2a620, 0x2a629}, {0x2a8d0, 0x2a8d9}, - {0x2a900, 0x2a909}, {0x2a9d0, 0x2a9d9}, {0x2a9f0, 0x2a9f9}, {0x2aa50, 0x2aa59}, - {0x2abf0, 0x2abf9}, {0x2ff10, 0x2ff19}, {0x30030, 0x30039}, {0x30660, 0x30669}, - {0x306f0, 0x306f9}, {0x307c0, 0x307c9}, {0x30966, 0x3096f}, {0x309e6, 0x309ef}, - {0x30a66, 0x30a6f}, {0x30ae6, 0x30aef}, {0x30b66, 0x30b6f}, {0x30be6, 0x30bef}, - {0x30c66, 0x30c6f}, {0x30ce6, 0x30cef}, {0x30d66, 0x30d6f}, {0x30de6, 0x30def}, - {0x30e50, 0x30e59}, {0x30ed0, 0x30ed9}, {0x30f20, 0x30f29}, {0x31040, 0x31049}, - {0x31090, 0x31099}, {0x317e0, 0x317e9}, {0x31810, 0x31819}, {0x31946, 0x3194f}, - {0x319d0, 0x319d9}, {0x31a80, 0x31a89}, {0x31a90, 0x31a99}, {0x31b50, 0x31b59}, - {0x31bb0, 0x31bb9}, {0x31c40, 0x31c49}, {0x31c50, 0x31c59}, {0x3a620, 0x3a629}, - {0x3a8d0, 0x3a8d9}, {0x3a900, 0x3a909}, {0x3a9d0, 0x3a9d9}, {0x3a9f0, 0x3a9f9}, - {0x3aa50, 0x3aa59}, {0x3abf0, 0x3abf9}, {0x3ff10, 0x3ff19}, {0x40030, 0x40039}, - {0x40660, 0x40669}, {0x406f0, 0x406f9}, {0x407c0, 0x407c9}, {0x40966, 0x4096f}, - {0x409e6, 0x409ef}, {0x40a66, 0x40a6f}, {0x40ae6, 0x40aef}, {0x40b66, 0x40b6f}, - {0x40be6, 0x40bef}, {0x40c66, 0x40c6f}, {0x40ce6, 0x40cef}, {0x40d66, 0x40d6f}, - {0x40de6, 0x40def}, {0x40e50, 0x40e59}, {0x40ed0, 0x40ed9}, {0x40f20, 0x40f29}, - {0x41040, 0x41049}, {0x41090, 0x41099}, {0x417e0, 0x417e9}, {0x41810, 0x41819}, - {0x41946, 0x4194f}, {0x419d0, 0x419d9}, {0x41a80, 0x41a89}, {0x41a90, 0x41a99}, - {0x41b50, 0x41b59}, {0x41bb0, 0x41bb9}, {0x41c40, 0x41c49}, {0x41c50, 0x41c59}, - {0x4a620, 0x4a629}, {0x4a8d0, 0x4a8d9}, {0x4a900, 0x4a909}, {0x4a9d0, 0x4a9d9}, - {0x4a9f0, 0x4a9f9}, {0x4aa50, 0x4aa59}, {0x4abf0, 0x4abf9}, {0x4ff10, 0x4ff19}, - {0x50030, 0x50039}, {0x50660, 0x50669}, {0x506f0, 0x506f9}, {0x507c0, 0x507c9}, - {0x50966, 0x5096f}, {0x509e6, 0x509ef}, {0x50a66, 0x50a6f}, {0x50ae6, 0x50aef}, - {0x50b66, 0x50b6f}, {0x50be6, 0x50bef}, {0x50c66, 0x50c6f}, {0x50ce6, 0x50cef}, - {0x50d66, 0x50d6f}, {0x50de6, 0x50def}, {0x50e50, 0x50e59}, {0x50ed0, 0x50ed9}, - {0x50f20, 0x50f29}, {0x51040, 0x51049}, {0x51090, 0x51099}, {0x517e0, 0x517e9}, - {0x51810, 0x51819}, {0x51946, 0x5194f}, {0x519d0, 0x519d9}, {0x51a80, 0x51a89}, - {0x51a90, 0x51a99}, {0x51b50, 0x51b59}, {0x51bb0, 0x51bb9}, {0x51c40, 0x51c49}, - {0x51c50, 0x51c59}, {0x5a620, 0x5a629}, {0x5a8d0, 0x5a8d9}, {0x5a900, 0x5a909}, - {0x5a9d0, 0x5a9d9}, {0x5a9f0, 0x5a9f9}, {0x5aa50, 0x5aa59}, {0x5abf0, 0x5abf9}, - {0x5ff10, 0x5ff19}, {0x60030, 0x60039}, {0x60660, 0x60669}, {0x606f0, 0x606f9}, - {0x607c0, 0x607c9}, {0x60966, 0x6096f}, {0x609e6, 0x609ef}, {0x60a66, 0x60a6f}, - {0x60ae6, 0x60aef}, {0x60b66, 0x60b6f}, {0x60be6, 0x60bef}, {0x60c66, 0x60c6f}, - {0x60ce6, 0x60cef}, {0x60d66, 0x60d6f}, {0x60de6, 0x60def}, {0x60e50, 0x60e59}, - {0x60ed0, 0x60ed9}, {0x60f20, 0x60f29}, {0x61040, 0x61049}, {0x61090, 0x61099}, - {0x617e0, 0x617e9}, {0x61810, 0x61819}, {0x61946, 0x6194f}, {0x619d0, 0x619d9}, - {0x61a80, 0x61a89}, {0x61a90, 0x61a99}, {0x61b50, 0x61b59}, {0x61bb0, 0x61bb9}, - {0x61c40, 0x61c49}, {0x61c50, 0x61c59}, {0x6a620, 0x6a629}, {0x6a8d0, 0x6a8d9}, - {0x6a900, 0x6a909}, {0x6a9d0, 0x6a9d9}, {0x6a9f0, 0x6a9f9}, {0x6aa50, 0x6aa59}, - {0x6abf0, 0x6abf9}, {0x6ff10, 0x6ff19}, {0x70030, 0x70039}, {0x70660, 0x70669}, - {0x706f0, 0x706f9}, {0x707c0, 0x707c9}, {0x70966, 0x7096f}, {0x709e6, 0x709ef}, - {0x70a66, 0x70a6f}, {0x70ae6, 0x70aef}, {0x70b66, 0x70b6f}, {0x70be6, 0x70bef}, - {0x70c66, 0x70c6f}, {0x70ce6, 0x70cef}, {0x70d66, 0x70d6f}, {0x70de6, 0x70def}, - {0x70e50, 0x70e59}, {0x70ed0, 0x70ed9}, {0x70f20, 0x70f29}, {0x71040, 0x71049}, - {0x71090, 0x71099}, {0x717e0, 0x717e9}, {0x71810, 0x71819}, {0x71946, 0x7194f}, - {0x719d0, 0x719d9}, {0x71a80, 0x71a89}, {0x71a90, 0x71a99}, {0x71b50, 0x71b59}, - {0x71bb0, 0x71bb9}, {0x71c40, 0x71c49}, {0x71c50, 0x71c59}, {0x7a620, 0x7a629}, - {0x7a8d0, 0x7a8d9}, {0x7a900, 0x7a909}, {0x7a9d0, 0x7a9d9}, {0x7a9f0, 0x7a9f9}, - {0x7aa50, 0x7aa59}, {0x7abf0, 0x7abf9}, {0x7ff10, 0x7ff19}, {0x80030, 0x80039}, - {0x80660, 0x80669}, {0x806f0, 0x806f9}, {0x807c0, 0x807c9}, {0x80966, 0x8096f}, - {0x809e6, 0x809ef}, {0x80a66, 0x80a6f}, {0x80ae6, 0x80aef}, {0x80b66, 0x80b6f}, - {0x80be6, 0x80bef}, {0x80c66, 0x80c6f}, {0x80ce6, 0x80cef}, {0x80d66, 0x80d6f}, - {0x80de6, 0x80def}, {0x80e50, 0x80e59}, {0x80ed0, 0x80ed9}, {0x80f20, 0x80f29}, - {0x81040, 0x81049}, {0x81090, 0x81099}, {0x817e0, 0x817e9}, {0x81810, 0x81819}, - {0x81946, 0x8194f}, {0x819d0, 0x819d9}, {0x81a80, 0x81a89}, {0x81a90, 0x81a99}, - {0x81b50, 0x81b59}, {0x81bb0, 0x81bb9}, {0x81c40, 0x81c49}, {0x81c50, 0x81c59}, - {0x8a620, 0x8a629}, {0x8a8d0, 0x8a8d9}, {0x8a900, 0x8a909}, {0x8a9d0, 0x8a9d9}, - {0x8a9f0, 0x8a9f9}, {0x8aa50, 0x8aa59}, {0x8abf0, 0x8abf9}, {0x8ff10, 0x8ff19}, - {0x90030, 0x90039}, {0x90660, 0x90669}, {0x906f0, 0x906f9}, {0x907c0, 0x907c9}, - {0x90966, 0x9096f}, {0x909e6, 0x909ef}, {0x90a66, 0x90a6f}, {0x90ae6, 0x90aef}, - {0x90b66, 0x90b6f}, {0x90be6, 0x90bef}, {0x90c66, 0x90c6f}, {0x90ce6, 0x90cef}, - {0x90d66, 0x90d6f}, {0x90de6, 0x90def}, {0x90e50, 0x90e59}, {0x90ed0, 0x90ed9}, - {0x90f20, 0x90f29}, {0x91040, 0x91049}, {0x91090, 0x91099}, {0x917e0, 0x917e9}, - {0x91810, 0x91819}, {0x91946, 0x9194f}, {0x919d0, 0x919d9}, {0x91a80, 0x91a89}, - {0x91a90, 0x91a99}, {0x91b50, 0x91b59}, {0x91bb0, 0x91bb9}, {0x91c40, 0x91c49}, - {0x91c50, 0x91c59}, {0x9a620, 0x9a629}, {0x9a8d0, 0x9a8d9}, {0x9a900, 0x9a909}, - {0x9a9d0, 0x9a9d9}, {0x9a9f0, 0x9a9f9}, {0x9aa50, 0x9aa59}, {0x9abf0, 0x9abf9}, - {0x9ff10, 0x9ff19}, {0xa0030, 0xa0039}, {0xa0660, 0xa0669}, {0xa06f0, 0xa06f9}, - {0xa07c0, 0xa07c9}, {0xa0966, 0xa096f}, {0xa09e6, 0xa09ef}, {0xa0a66, 0xa0a6f}, - {0xa0ae6, 0xa0aef}, {0xa0b66, 0xa0b6f}, {0xa0be6, 0xa0bef}, {0xa0c66, 0xa0c6f}, - {0xa0ce6, 0xa0cef}, {0xa0d66, 0xa0d6f}, {0xa0de6, 0xa0def}, {0xa0e50, 0xa0e59}, - {0xa0ed0, 0xa0ed9}, {0xa0f20, 0xa0f29}, {0xa1040, 0xa1049}, {0xa1090, 0xa1099}, - {0xa17e0, 0xa17e9}, {0xa1810, 0xa1819}, {0xa1946, 0xa194f}, {0xa19d0, 0xa19d9}, - {0xa1a80, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1b50, 0xa1b59}, {0xa1bb0, 0xa1bb9}, - {0xa1c40, 0xa1c49}, {0xa1c50, 0xa1c59}, {0xaa620, 0xaa629}, {0xaa8d0, 0xaa8d9}, - {0xaa900, 0xaa909}, {0xaa9d0, 0xaa9d9}, {0xaa9f0, 0xaa9f9}, {0xaaa50, 0xaaa59}, - {0xaabf0, 0xaabf9}, {0xaff10, 0xaff19}, {0xb0030, 0xb0039}, {0xb0660, 0xb0669}, - {0xb06f0, 0xb06f9}, {0xb07c0, 0xb07c9}, {0xb0966, 0xb096f}, {0xb09e6, 0xb09ef}, - {0xb0a66, 0xb0a6f}, {0xb0ae6, 0xb0aef}, {0xb0b66, 0xb0b6f}, {0xb0be6, 0xb0bef}, - {0xb0c66, 0xb0c6f}, {0xb0ce6, 0xb0cef}, {0xb0d66, 0xb0d6f}, {0xb0de6, 0xb0def}, - {0xb0e50, 0xb0e59}, {0xb0ed0, 0xb0ed9}, {0xb0f20, 0xb0f29}, {0xb1040, 0xb1049}, - {0xb1090, 0xb1099}, {0xb17e0, 0xb17e9}, {0xb1810, 0xb1819}, {0xb1946, 0xb194f}, - {0xb19d0, 0xb19d9}, {0xb1a80, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1b50, 0xb1b59}, - {0xb1bb0, 0xb1bb9}, {0xb1c40, 0xb1c49}, {0xb1c50, 0xb1c59}, {0xba620, 0xba629}, - {0xba8d0, 0xba8d9}, {0xba900, 0xba909}, {0xba9d0, 0xba9d9}, {0xba9f0, 0xba9f9}, - {0xbaa50, 0xbaa59}, {0xbabf0, 0xbabf9}, {0xbff10, 0xbff19}, {0xc0030, 0xc0039}, - {0xc0660, 0xc0669}, {0xc06f0, 0xc06f9}, {0xc07c0, 0xc07c9}, {0xc0966, 0xc096f}, - {0xc09e6, 0xc09ef}, {0xc0a66, 0xc0a6f}, {0xc0ae6, 0xc0aef}, {0xc0b66, 0xc0b6f}, - {0xc0be6, 0xc0bef}, {0xc0c66, 0xc0c6f}, {0xc0ce6, 0xc0cef}, {0xc0d66, 0xc0d6f}, - {0xc0de6, 0xc0def}, {0xc0e50, 0xc0e59}, {0xc0ed0, 0xc0ed9}, {0xc0f20, 0xc0f29}, - {0xc1040, 0xc1049}, {0xc1090, 0xc1099}, {0xc17e0, 0xc17e9}, {0xc1810, 0xc1819}, - {0xc1946, 0xc194f}, {0xc19d0, 0xc19d9}, {0xc1a80, 0xc1a89}, {0xc1a90, 0xc1a99}, - {0xc1b50, 0xc1b59}, {0xc1bb0, 0xc1bb9}, {0xc1c40, 0xc1c49}, {0xc1c50, 0xc1c59}, - {0xca620, 0xca629}, {0xca8d0, 0xca8d9}, {0xca900, 0xca909}, {0xca9d0, 0xca9d9}, - {0xca9f0, 0xca9f9}, {0xcaa50, 0xcaa59}, {0xcabf0, 0xcabf9}, {0xcff10, 0xcff19}, - {0xd0030, 0xd0039}, {0xd0660, 0xd0669}, {0xd06f0, 0xd06f9}, {0xd07c0, 0xd07c9}, - {0xd0966, 0xd096f}, {0xd09e6, 0xd09ef}, {0xd0a66, 0xd0a6f}, {0xd0ae6, 0xd0aef}, - {0xd0b66, 0xd0b6f}, {0xd0be6, 0xd0bef}, {0xd0c66, 0xd0c6f}, {0xd0ce6, 0xd0cef}, - {0xd0d66, 0xd0d6f}, {0xd0de6, 0xd0def}, {0xd0e50, 0xd0e59}, {0xd0ed0, 0xd0ed9}, - {0xd0f20, 0xd0f29}, {0xd1040, 0xd1049}, {0xd1090, 0xd1099}, {0xd17e0, 0xd17e9}, - {0xd1810, 0xd1819}, {0xd1946, 0xd194f}, {0xd19d0, 0xd19d9}, {0xd1a80, 0xd1a89}, - {0xd1a90, 0xd1a99}, {0xd1b50, 0xd1b59}, {0xd1bb0, 0xd1bb9}, {0xd1c40, 0xd1c49}, - {0xd1c50, 0xd1c59}, {0xda620, 0xda629}, {0xda8d0, 0xda8d9}, {0xda900, 0xda909}, - {0xda9d0, 0xda9d9}, {0xda9f0, 0xda9f9}, {0xdaa50, 0xdaa59}, {0xdabf0, 0xdabf9}, - {0xdff10, 0xdff19}, {0xe0030, 0xe0039}, {0xe0660, 0xe0669}, {0xe06f0, 0xe06f9}, - {0xe07c0, 0xe07c9}, {0xe0966, 0xe096f}, {0xe09e6, 0xe09ef}, {0xe0a66, 0xe0a6f}, - {0xe0ae6, 0xe0aef}, {0xe0b66, 0xe0b6f}, {0xe0be6, 0xe0bef}, {0xe0c66, 0xe0c6f}, - {0xe0ce6, 0xe0cef}, {0xe0d66, 0xe0d6f}, {0xe0de6, 0xe0def}, {0xe0e50, 0xe0e59}, - {0xe0ed0, 0xe0ed9}, {0xe0f20, 0xe0f29}, {0xe1040, 0xe1049}, {0xe1090, 0xe1099}, - {0xe17e0, 0xe17e9}, {0xe1810, 0xe1819}, {0xe1946, 0xe194f}, {0xe19d0, 0xe19d9}, - {0xe1a80, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1b50, 0xe1b59}, {0xe1bb0, 0xe1bb9}, - {0xe1c40, 0xe1c49}, {0xe1c50, 0xe1c59}, {0xea620, 0xea629}, {0xea8d0, 0xea8d9}, - {0xea900, 0xea909}, {0xea9d0, 0xea9d9}, {0xea9f0, 0xea9f9}, {0xeaa50, 0xeaa59}, - {0xeabf0, 0xeabf9}, {0xeff10, 0xeff19}, {0xf0030, 0xf0039}, {0xf0660, 0xf0669}, - {0xf06f0, 0xf06f9}, {0xf07c0, 0xf07c9}, {0xf0966, 0xf096f}, {0xf09e6, 0xf09ef}, - {0xf0a66, 0xf0a6f}, {0xf0ae6, 0xf0aef}, {0xf0b66, 0xf0b6f}, {0xf0be6, 0xf0bef}, - {0xf0c66, 0xf0c6f}, {0xf0ce6, 0xf0cef}, {0xf0d66, 0xf0d6f}, {0xf0de6, 0xf0def}, - {0xf0e50, 0xf0e59}, {0xf0ed0, 0xf0ed9}, {0xf0f20, 0xf0f29}, {0xf1040, 0xf1049}, - {0xf1090, 0xf1099}, {0xf17e0, 0xf17e9}, {0xf1810, 0xf1819}, {0xf1946, 0xf194f}, - {0xf19d0, 0xf19d9}, {0xf1a80, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1b50, 0xf1b59}, - {0xf1bb0, 0xf1bb9}, {0xf1c40, 0xf1c49}, {0xf1c50, 0xf1c59}, {0xfa620, 0xfa629}, - {0xfa8d0, 0xfa8d9}, {0xfa900, 0xfa909}, {0xfa9d0, 0xfa9d9}, {0xfa9f0, 0xfa9f9}, - {0xfaa50, 0xfaa59}, {0xfabf0, 0xfabf9}, {0xfff10, 0xfff19}, {0x100030, 0x100039}, - {0x100660, 0x100669}, {0x1006f0, 0x1006f9}, {0x1007c0, 0x1007c9}, {0x100966, 0x10096f}, - {0x1009e6, 0x1009ef}, {0x100a66, 0x100a6f}, {0x100ae6, 0x100aef}, {0x100b66, 0x100b6f}, - {0x100be6, 0x100bef}, {0x100c66, 0x100c6f}, {0x100ce6, 0x100cef}, {0x100d66, 0x100d6f}, - {0x100de6, 0x100def}, {0x100e50, 0x100e59}, {0x100ed0, 0x100ed9}, {0x100f20, 0x100f29}, - {0x101040, 0x101049}, {0x101090, 0x101099}, {0x1017e0, 0x1017e9}, {0x101810, 0x101819}, - {0x101946, 0x10194f}, {0x1019d0, 0x1019d9}, {0x101a80, 0x101a89}, {0x101a90, 0x101a99}, - {0x101b50, 0x101b59}, {0x101bb0, 0x101bb9}, {0x101c40, 0x101c49}, {0x101c50, 0x101c59}, - {0x10a620, 0x10a629}, {0x10a8d0, 0x10a8d9}, {0x10a900, 0x10a909}, {0x10a9d0, 0x10a9d9}, - {0x10a9f0, 0x10a9f9}, {0x10aa50, 0x10aa59}, {0x10abf0, 0x10abf9}, {0x10ff10, 0x10ff19} + ,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f}, + {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459}, {0x114d0, 0x114d9}, + {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9}, + {0x11c50, 0x11c59}, {0x11d50, 0x11d59}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59}, + {0x1d7ce, 0x1d7ff}, {0x1e950, 0x1e959} #endif }; @@ -1822,218 +355,12 @@ static const crange punctRangeTable[] = { {0xff01, 0xff03}, {0xff05, 0xff0a}, {0xff0c, 0xff0f}, {0xff3b, 0xff3d}, {0xff5f, 0xff65} #if TCL_UTF_MAX > 4 - ,{0x10021, 0x10023}, {0x10025, 0x1002a}, {0x1002c, 0x1002f}, {0x1005b, 0x1005d}, - {0x1055a, 0x1055f}, {0x1066a, 0x1066d}, {0x10700, 0x1070d}, {0x107f7, 0x107f9}, - {0x10830, 0x1083e}, {0x10f04, 0x10f12}, {0x10f3a, 0x10f3d}, {0x10fd0, 0x10fd4}, - {0x1104a, 0x1104f}, {0x11360, 0x11368}, {0x116eb, 0x116ed}, {0x117d4, 0x117d6}, - {0x117d8, 0x117da}, {0x11800, 0x1180a}, {0x11aa0, 0x11aa6}, {0x11aa8, 0x11aad}, - {0x11b5a, 0x11b60}, {0x11bfc, 0x11bff}, {0x11c3b, 0x11c3f}, {0x11cc0, 0x11cc7}, - {0x12010, 0x12027}, {0x12030, 0x12043}, {0x12045, 0x12051}, {0x12053, 0x1205e}, - {0x12308, 0x1230b}, {0x12768, 0x12775}, {0x127e6, 0x127ef}, {0x12983, 0x12998}, - {0x129d8, 0x129db}, {0x12cf9, 0x12cfc}, {0x12e00, 0x12e2e}, {0x12e30, 0x12e49}, - {0x13001, 0x13003}, {0x13008, 0x13011}, {0x13014, 0x1301f}, {0x1a60d, 0x1a60f}, - {0x1a6f2, 0x1a6f7}, {0x1a874, 0x1a877}, {0x1a8f8, 0x1a8fa}, {0x1a9c1, 0x1a9cd}, - {0x1aa5c, 0x1aa5f}, {0x1fe10, 0x1fe19}, {0x1fe30, 0x1fe52}, {0x1fe54, 0x1fe61}, - {0x1ff01, 0x1ff03}, {0x1ff05, 0x1ff0a}, {0x1ff0c, 0x1ff0f}, {0x1ff3b, 0x1ff3d}, - {0x1ff5f, 0x1ff65}, {0x20021, 0x20023}, {0x20025, 0x2002a}, {0x2002c, 0x2002f}, - {0x2005b, 0x2005d}, {0x2055a, 0x2055f}, {0x2066a, 0x2066d}, {0x20700, 0x2070d}, - {0x207f7, 0x207f9}, {0x20830, 0x2083e}, {0x20f04, 0x20f12}, {0x20f3a, 0x20f3d}, - {0x20fd0, 0x20fd4}, {0x2104a, 0x2104f}, {0x21360, 0x21368}, {0x216eb, 0x216ed}, - {0x217d4, 0x217d6}, {0x217d8, 0x217da}, {0x21800, 0x2180a}, {0x21aa0, 0x21aa6}, - {0x21aa8, 0x21aad}, {0x21b5a, 0x21b60}, {0x21bfc, 0x21bff}, {0x21c3b, 0x21c3f}, - {0x21cc0, 0x21cc7}, {0x22010, 0x22027}, {0x22030, 0x22043}, {0x22045, 0x22051}, - {0x22053, 0x2205e}, {0x22308, 0x2230b}, {0x22768, 0x22775}, {0x227e6, 0x227ef}, - {0x22983, 0x22998}, {0x229d8, 0x229db}, {0x22cf9, 0x22cfc}, {0x22e00, 0x22e2e}, - {0x22e30, 0x22e49}, {0x23001, 0x23003}, {0x23008, 0x23011}, {0x23014, 0x2301f}, - {0x2a60d, 0x2a60f}, {0x2a6f2, 0x2a6f7}, {0x2a874, 0x2a877}, {0x2a8f8, 0x2a8fa}, - {0x2a9c1, 0x2a9cd}, {0x2aa5c, 0x2aa5f}, {0x2fe10, 0x2fe19}, {0x2fe30, 0x2fe52}, - {0x2fe54, 0x2fe61}, {0x2ff01, 0x2ff03}, {0x2ff05, 0x2ff0a}, {0x2ff0c, 0x2ff0f}, - {0x2ff3b, 0x2ff3d}, {0x2ff5f, 0x2ff65}, {0x30021, 0x30023}, {0x30025, 0x3002a}, - {0x3002c, 0x3002f}, {0x3005b, 0x3005d}, {0x3055a, 0x3055f}, {0x3066a, 0x3066d}, - {0x30700, 0x3070d}, {0x307f7, 0x307f9}, {0x30830, 0x3083e}, {0x30f04, 0x30f12}, - {0x30f3a, 0x30f3d}, {0x30fd0, 0x30fd4}, {0x3104a, 0x3104f}, {0x31360, 0x31368}, - {0x316eb, 0x316ed}, {0x317d4, 0x317d6}, {0x317d8, 0x317da}, {0x31800, 0x3180a}, - {0x31aa0, 0x31aa6}, {0x31aa8, 0x31aad}, {0x31b5a, 0x31b60}, {0x31bfc, 0x31bff}, - {0x31c3b, 0x31c3f}, {0x31cc0, 0x31cc7}, {0x32010, 0x32027}, {0x32030, 0x32043}, - {0x32045, 0x32051}, {0x32053, 0x3205e}, {0x32308, 0x3230b}, {0x32768, 0x32775}, - {0x327e6, 0x327ef}, {0x32983, 0x32998}, {0x329d8, 0x329db}, {0x32cf9, 0x32cfc}, - {0x32e00, 0x32e2e}, {0x32e30, 0x32e49}, {0x33001, 0x33003}, {0x33008, 0x33011}, - {0x33014, 0x3301f}, {0x3a60d, 0x3a60f}, {0x3a6f2, 0x3a6f7}, {0x3a874, 0x3a877}, - {0x3a8f8, 0x3a8fa}, {0x3a9c1, 0x3a9cd}, {0x3aa5c, 0x3aa5f}, {0x3fe10, 0x3fe19}, - {0x3fe30, 0x3fe52}, {0x3fe54, 0x3fe61}, {0x3ff01, 0x3ff03}, {0x3ff05, 0x3ff0a}, - {0x3ff0c, 0x3ff0f}, {0x3ff3b, 0x3ff3d}, {0x3ff5f, 0x3ff65}, {0x40021, 0x40023}, - {0x40025, 0x4002a}, {0x4002c, 0x4002f}, {0x4005b, 0x4005d}, {0x4055a, 0x4055f}, - {0x4066a, 0x4066d}, {0x40700, 0x4070d}, {0x407f7, 0x407f9}, {0x40830, 0x4083e}, - {0x40f04, 0x40f12}, {0x40f3a, 0x40f3d}, {0x40fd0, 0x40fd4}, {0x4104a, 0x4104f}, - {0x41360, 0x41368}, {0x416eb, 0x416ed}, {0x417d4, 0x417d6}, {0x417d8, 0x417da}, - {0x41800, 0x4180a}, {0x41aa0, 0x41aa6}, {0x41aa8, 0x41aad}, {0x41b5a, 0x41b60}, - {0x41bfc, 0x41bff}, {0x41c3b, 0x41c3f}, {0x41cc0, 0x41cc7}, {0x42010, 0x42027}, - {0x42030, 0x42043}, {0x42045, 0x42051}, {0x42053, 0x4205e}, {0x42308, 0x4230b}, - {0x42768, 0x42775}, {0x427e6, 0x427ef}, {0x42983, 0x42998}, {0x429d8, 0x429db}, - {0x42cf9, 0x42cfc}, {0x42e00, 0x42e2e}, {0x42e30, 0x42e49}, {0x43001, 0x43003}, - {0x43008, 0x43011}, {0x43014, 0x4301f}, {0x4a60d, 0x4a60f}, {0x4a6f2, 0x4a6f7}, - {0x4a874, 0x4a877}, {0x4a8f8, 0x4a8fa}, {0x4a9c1, 0x4a9cd}, {0x4aa5c, 0x4aa5f}, - {0x4fe10, 0x4fe19}, {0x4fe30, 0x4fe52}, {0x4fe54, 0x4fe61}, {0x4ff01, 0x4ff03}, - {0x4ff05, 0x4ff0a}, {0x4ff0c, 0x4ff0f}, {0x4ff3b, 0x4ff3d}, {0x4ff5f, 0x4ff65}, - {0x50021, 0x50023}, {0x50025, 0x5002a}, {0x5002c, 0x5002f}, {0x5005b, 0x5005d}, - {0x5055a, 0x5055f}, {0x5066a, 0x5066d}, {0x50700, 0x5070d}, {0x507f7, 0x507f9}, - {0x50830, 0x5083e}, {0x50f04, 0x50f12}, {0x50f3a, 0x50f3d}, {0x50fd0, 0x50fd4}, - {0x5104a, 0x5104f}, {0x51360, 0x51368}, {0x516eb, 0x516ed}, {0x517d4, 0x517d6}, - {0x517d8, 0x517da}, {0x51800, 0x5180a}, {0x51aa0, 0x51aa6}, {0x51aa8, 0x51aad}, - {0x51b5a, 0x51b60}, {0x51bfc, 0x51bff}, {0x51c3b, 0x51c3f}, {0x51cc0, 0x51cc7}, - {0x52010, 0x52027}, {0x52030, 0x52043}, {0x52045, 0x52051}, {0x52053, 0x5205e}, - {0x52308, 0x5230b}, {0x52768, 0x52775}, {0x527e6, 0x527ef}, {0x52983, 0x52998}, - {0x529d8, 0x529db}, {0x52cf9, 0x52cfc}, {0x52e00, 0x52e2e}, {0x52e30, 0x52e49}, - {0x53001, 0x53003}, {0x53008, 0x53011}, {0x53014, 0x5301f}, {0x5a60d, 0x5a60f}, - {0x5a6f2, 0x5a6f7}, {0x5a874, 0x5a877}, {0x5a8f8, 0x5a8fa}, {0x5a9c1, 0x5a9cd}, - {0x5aa5c, 0x5aa5f}, {0x5fe10, 0x5fe19}, {0x5fe30, 0x5fe52}, {0x5fe54, 0x5fe61}, - {0x5ff01, 0x5ff03}, {0x5ff05, 0x5ff0a}, {0x5ff0c, 0x5ff0f}, {0x5ff3b, 0x5ff3d}, - {0x5ff5f, 0x5ff65}, {0x60021, 0x60023}, {0x60025, 0x6002a}, {0x6002c, 0x6002f}, - {0x6005b, 0x6005d}, {0x6055a, 0x6055f}, {0x6066a, 0x6066d}, {0x60700, 0x6070d}, - {0x607f7, 0x607f9}, {0x60830, 0x6083e}, {0x60f04, 0x60f12}, {0x60f3a, 0x60f3d}, - {0x60fd0, 0x60fd4}, {0x6104a, 0x6104f}, {0x61360, 0x61368}, {0x616eb, 0x616ed}, - {0x617d4, 0x617d6}, {0x617d8, 0x617da}, {0x61800, 0x6180a}, {0x61aa0, 0x61aa6}, - {0x61aa8, 0x61aad}, {0x61b5a, 0x61b60}, {0x61bfc, 0x61bff}, {0x61c3b, 0x61c3f}, - {0x61cc0, 0x61cc7}, {0x62010, 0x62027}, {0x62030, 0x62043}, {0x62045, 0x62051}, - {0x62053, 0x6205e}, {0x62308, 0x6230b}, {0x62768, 0x62775}, {0x627e6, 0x627ef}, - {0x62983, 0x62998}, {0x629d8, 0x629db}, {0x62cf9, 0x62cfc}, {0x62e00, 0x62e2e}, - {0x62e30, 0x62e49}, {0x63001, 0x63003}, {0x63008, 0x63011}, {0x63014, 0x6301f}, - {0x6a60d, 0x6a60f}, {0x6a6f2, 0x6a6f7}, {0x6a874, 0x6a877}, {0x6a8f8, 0x6a8fa}, - {0x6a9c1, 0x6a9cd}, {0x6aa5c, 0x6aa5f}, {0x6fe10, 0x6fe19}, {0x6fe30, 0x6fe52}, - {0x6fe54, 0x6fe61}, {0x6ff01, 0x6ff03}, {0x6ff05, 0x6ff0a}, {0x6ff0c, 0x6ff0f}, - {0x6ff3b, 0x6ff3d}, {0x6ff5f, 0x6ff65}, {0x70021, 0x70023}, {0x70025, 0x7002a}, - {0x7002c, 0x7002f}, {0x7005b, 0x7005d}, {0x7055a, 0x7055f}, {0x7066a, 0x7066d}, - {0x70700, 0x7070d}, {0x707f7, 0x707f9}, {0x70830, 0x7083e}, {0x70f04, 0x70f12}, - {0x70f3a, 0x70f3d}, {0x70fd0, 0x70fd4}, {0x7104a, 0x7104f}, {0x71360, 0x71368}, - {0x716eb, 0x716ed}, {0x717d4, 0x717d6}, {0x717d8, 0x717da}, {0x71800, 0x7180a}, - {0x71aa0, 0x71aa6}, {0x71aa8, 0x71aad}, {0x71b5a, 0x71b60}, {0x71bfc, 0x71bff}, - {0x71c3b, 0x71c3f}, {0x71cc0, 0x71cc7}, {0x72010, 0x72027}, {0x72030, 0x72043}, - {0x72045, 0x72051}, {0x72053, 0x7205e}, {0x72308, 0x7230b}, {0x72768, 0x72775}, - {0x727e6, 0x727ef}, {0x72983, 0x72998}, {0x729d8, 0x729db}, {0x72cf9, 0x72cfc}, - {0x72e00, 0x72e2e}, {0x72e30, 0x72e49}, {0x73001, 0x73003}, {0x73008, 0x73011}, - {0x73014, 0x7301f}, {0x7a60d, 0x7a60f}, {0x7a6f2, 0x7a6f7}, {0x7a874, 0x7a877}, - {0x7a8f8, 0x7a8fa}, {0x7a9c1, 0x7a9cd}, {0x7aa5c, 0x7aa5f}, {0x7fe10, 0x7fe19}, - {0x7fe30, 0x7fe52}, {0x7fe54, 0x7fe61}, {0x7ff01, 0x7ff03}, {0x7ff05, 0x7ff0a}, - {0x7ff0c, 0x7ff0f}, {0x7ff3b, 0x7ff3d}, {0x7ff5f, 0x7ff65}, {0x80021, 0x80023}, - {0x80025, 0x8002a}, {0x8002c, 0x8002f}, {0x8005b, 0x8005d}, {0x8055a, 0x8055f}, - {0x8066a, 0x8066d}, {0x80700, 0x8070d}, {0x807f7, 0x807f9}, {0x80830, 0x8083e}, - {0x80f04, 0x80f12}, {0x80f3a, 0x80f3d}, {0x80fd0, 0x80fd4}, {0x8104a, 0x8104f}, - {0x81360, 0x81368}, {0x816eb, 0x816ed}, {0x817d4, 0x817d6}, {0x817d8, 0x817da}, - {0x81800, 0x8180a}, {0x81aa0, 0x81aa6}, {0x81aa8, 0x81aad}, {0x81b5a, 0x81b60}, - {0x81bfc, 0x81bff}, {0x81c3b, 0x81c3f}, {0x81cc0, 0x81cc7}, {0x82010, 0x82027}, - {0x82030, 0x82043}, {0x82045, 0x82051}, {0x82053, 0x8205e}, {0x82308, 0x8230b}, - {0x82768, 0x82775}, {0x827e6, 0x827ef}, {0x82983, 0x82998}, {0x829d8, 0x829db}, - {0x82cf9, 0x82cfc}, {0x82e00, 0x82e2e}, {0x82e30, 0x82e49}, {0x83001, 0x83003}, - {0x83008, 0x83011}, {0x83014, 0x8301f}, {0x8a60d, 0x8a60f}, {0x8a6f2, 0x8a6f7}, - {0x8a874, 0x8a877}, {0x8a8f8, 0x8a8fa}, {0x8a9c1, 0x8a9cd}, {0x8aa5c, 0x8aa5f}, - {0x8fe10, 0x8fe19}, {0x8fe30, 0x8fe52}, {0x8fe54, 0x8fe61}, {0x8ff01, 0x8ff03}, - {0x8ff05, 0x8ff0a}, {0x8ff0c, 0x8ff0f}, {0x8ff3b, 0x8ff3d}, {0x8ff5f, 0x8ff65}, - {0x90021, 0x90023}, {0x90025, 0x9002a}, {0x9002c, 0x9002f}, {0x9005b, 0x9005d}, - {0x9055a, 0x9055f}, {0x9066a, 0x9066d}, {0x90700, 0x9070d}, {0x907f7, 0x907f9}, - {0x90830, 0x9083e}, {0x90f04, 0x90f12}, {0x90f3a, 0x90f3d}, {0x90fd0, 0x90fd4}, - {0x9104a, 0x9104f}, {0x91360, 0x91368}, {0x916eb, 0x916ed}, {0x917d4, 0x917d6}, - {0x917d8, 0x917da}, {0x91800, 0x9180a}, {0x91aa0, 0x91aa6}, {0x91aa8, 0x91aad}, - {0x91b5a, 0x91b60}, {0x91bfc, 0x91bff}, {0x91c3b, 0x91c3f}, {0x91cc0, 0x91cc7}, - {0x92010, 0x92027}, {0x92030, 0x92043}, {0x92045, 0x92051}, {0x92053, 0x9205e}, - {0x92308, 0x9230b}, {0x92768, 0x92775}, {0x927e6, 0x927ef}, {0x92983, 0x92998}, - {0x929d8, 0x929db}, {0x92cf9, 0x92cfc}, {0x92e00, 0x92e2e}, {0x92e30, 0x92e49}, - {0x93001, 0x93003}, {0x93008, 0x93011}, {0x93014, 0x9301f}, {0x9a60d, 0x9a60f}, - {0x9a6f2, 0x9a6f7}, {0x9a874, 0x9a877}, {0x9a8f8, 0x9a8fa}, {0x9a9c1, 0x9a9cd}, - {0x9aa5c, 0x9aa5f}, {0x9fe10, 0x9fe19}, {0x9fe30, 0x9fe52}, {0x9fe54, 0x9fe61}, - {0x9ff01, 0x9ff03}, {0x9ff05, 0x9ff0a}, {0x9ff0c, 0x9ff0f}, {0x9ff3b, 0x9ff3d}, - {0x9ff5f, 0x9ff65}, {0xa0021, 0xa0023}, {0xa0025, 0xa002a}, {0xa002c, 0xa002f}, - {0xa005b, 0xa005d}, {0xa055a, 0xa055f}, {0xa066a, 0xa066d}, {0xa0700, 0xa070d}, - {0xa07f7, 0xa07f9}, {0xa0830, 0xa083e}, {0xa0f04, 0xa0f12}, {0xa0f3a, 0xa0f3d}, - {0xa0fd0, 0xa0fd4}, {0xa104a, 0xa104f}, {0xa1360, 0xa1368}, {0xa16eb, 0xa16ed}, - {0xa17d4, 0xa17d6}, {0xa17d8, 0xa17da}, {0xa1800, 0xa180a}, {0xa1aa0, 0xa1aa6}, - {0xa1aa8, 0xa1aad}, {0xa1b5a, 0xa1b60}, {0xa1bfc, 0xa1bff}, {0xa1c3b, 0xa1c3f}, - {0xa1cc0, 0xa1cc7}, {0xa2010, 0xa2027}, {0xa2030, 0xa2043}, {0xa2045, 0xa2051}, - {0xa2053, 0xa205e}, {0xa2308, 0xa230b}, {0xa2768, 0xa2775}, {0xa27e6, 0xa27ef}, - {0xa2983, 0xa2998}, {0xa29d8, 0xa29db}, {0xa2cf9, 0xa2cfc}, {0xa2e00, 0xa2e2e}, - {0xa2e30, 0xa2e49}, {0xa3001, 0xa3003}, {0xa3008, 0xa3011}, {0xa3014, 0xa301f}, - {0xaa60d, 0xaa60f}, {0xaa6f2, 0xaa6f7}, {0xaa874, 0xaa877}, {0xaa8f8, 0xaa8fa}, - {0xaa9c1, 0xaa9cd}, {0xaaa5c, 0xaaa5f}, {0xafe10, 0xafe19}, {0xafe30, 0xafe52}, - {0xafe54, 0xafe61}, {0xaff01, 0xaff03}, {0xaff05, 0xaff0a}, {0xaff0c, 0xaff0f}, - {0xaff3b, 0xaff3d}, {0xaff5f, 0xaff65}, {0xb0021, 0xb0023}, {0xb0025, 0xb002a}, - {0xb002c, 0xb002f}, {0xb005b, 0xb005d}, {0xb055a, 0xb055f}, {0xb066a, 0xb066d}, - {0xb0700, 0xb070d}, {0xb07f7, 0xb07f9}, {0xb0830, 0xb083e}, {0xb0f04, 0xb0f12}, - {0xb0f3a, 0xb0f3d}, {0xb0fd0, 0xb0fd4}, {0xb104a, 0xb104f}, {0xb1360, 0xb1368}, - {0xb16eb, 0xb16ed}, {0xb17d4, 0xb17d6}, {0xb17d8, 0xb17da}, {0xb1800, 0xb180a}, - {0xb1aa0, 0xb1aa6}, {0xb1aa8, 0xb1aad}, {0xb1b5a, 0xb1b60}, {0xb1bfc, 0xb1bff}, - {0xb1c3b, 0xb1c3f}, {0xb1cc0, 0xb1cc7}, {0xb2010, 0xb2027}, {0xb2030, 0xb2043}, - {0xb2045, 0xb2051}, {0xb2053, 0xb205e}, {0xb2308, 0xb230b}, {0xb2768, 0xb2775}, - {0xb27e6, 0xb27ef}, {0xb2983, 0xb2998}, {0xb29d8, 0xb29db}, {0xb2cf9, 0xb2cfc}, - {0xb2e00, 0xb2e2e}, {0xb2e30, 0xb2e49}, {0xb3001, 0xb3003}, {0xb3008, 0xb3011}, - {0xb3014, 0xb301f}, {0xba60d, 0xba60f}, {0xba6f2, 0xba6f7}, {0xba874, 0xba877}, - {0xba8f8, 0xba8fa}, {0xba9c1, 0xba9cd}, {0xbaa5c, 0xbaa5f}, {0xbfe10, 0xbfe19}, - {0xbfe30, 0xbfe52}, {0xbfe54, 0xbfe61}, {0xbff01, 0xbff03}, {0xbff05, 0xbff0a}, - {0xbff0c, 0xbff0f}, {0xbff3b, 0xbff3d}, {0xbff5f, 0xbff65}, {0xc0021, 0xc0023}, - {0xc0025, 0xc002a}, {0xc002c, 0xc002f}, {0xc005b, 0xc005d}, {0xc055a, 0xc055f}, - {0xc066a, 0xc066d}, {0xc0700, 0xc070d}, {0xc07f7, 0xc07f9}, {0xc0830, 0xc083e}, - {0xc0f04, 0xc0f12}, {0xc0f3a, 0xc0f3d}, {0xc0fd0, 0xc0fd4}, {0xc104a, 0xc104f}, - {0xc1360, 0xc1368}, {0xc16eb, 0xc16ed}, {0xc17d4, 0xc17d6}, {0xc17d8, 0xc17da}, - {0xc1800, 0xc180a}, {0xc1aa0, 0xc1aa6}, {0xc1aa8, 0xc1aad}, {0xc1b5a, 0xc1b60}, - {0xc1bfc, 0xc1bff}, {0xc1c3b, 0xc1c3f}, {0xc1cc0, 0xc1cc7}, {0xc2010, 0xc2027}, - {0xc2030, 0xc2043}, {0xc2045, 0xc2051}, {0xc2053, 0xc205e}, {0xc2308, 0xc230b}, - {0xc2768, 0xc2775}, {0xc27e6, 0xc27ef}, {0xc2983, 0xc2998}, {0xc29d8, 0xc29db}, - {0xc2cf9, 0xc2cfc}, {0xc2e00, 0xc2e2e}, {0xc2e30, 0xc2e49}, {0xc3001, 0xc3003}, - {0xc3008, 0xc3011}, {0xc3014, 0xc301f}, {0xca60d, 0xca60f}, {0xca6f2, 0xca6f7}, - {0xca874, 0xca877}, {0xca8f8, 0xca8fa}, {0xca9c1, 0xca9cd}, {0xcaa5c, 0xcaa5f}, - {0xcfe10, 0xcfe19}, {0xcfe30, 0xcfe52}, {0xcfe54, 0xcfe61}, {0xcff01, 0xcff03}, - {0xcff05, 0xcff0a}, {0xcff0c, 0xcff0f}, {0xcff3b, 0xcff3d}, {0xcff5f, 0xcff65}, - {0xd0021, 0xd0023}, {0xd0025, 0xd002a}, {0xd002c, 0xd002f}, {0xd005b, 0xd005d}, - {0xd055a, 0xd055f}, {0xd066a, 0xd066d}, {0xd0700, 0xd070d}, {0xd07f7, 0xd07f9}, - {0xd0830, 0xd083e}, {0xd0f04, 0xd0f12}, {0xd0f3a, 0xd0f3d}, {0xd0fd0, 0xd0fd4}, - {0xd104a, 0xd104f}, {0xd1360, 0xd1368}, {0xd16eb, 0xd16ed}, {0xd17d4, 0xd17d6}, - {0xd17d8, 0xd17da}, {0xd1800, 0xd180a}, {0xd1aa0, 0xd1aa6}, {0xd1aa8, 0xd1aad}, - {0xd1b5a, 0xd1b60}, {0xd1bfc, 0xd1bff}, {0xd1c3b, 0xd1c3f}, {0xd1cc0, 0xd1cc7}, - {0xd2010, 0xd2027}, {0xd2030, 0xd2043}, {0xd2045, 0xd2051}, {0xd2053, 0xd205e}, - {0xd2308, 0xd230b}, {0xd2768, 0xd2775}, {0xd27e6, 0xd27ef}, {0xd2983, 0xd2998}, - {0xd29d8, 0xd29db}, {0xd2cf9, 0xd2cfc}, {0xd2e00, 0xd2e2e}, {0xd2e30, 0xd2e49}, - {0xd3001, 0xd3003}, {0xd3008, 0xd3011}, {0xd3014, 0xd301f}, {0xda60d, 0xda60f}, - {0xda6f2, 0xda6f7}, {0xda874, 0xda877}, {0xda8f8, 0xda8fa}, {0xda9c1, 0xda9cd}, - {0xdaa5c, 0xdaa5f}, {0xdfe10, 0xdfe19}, {0xdfe30, 0xdfe52}, {0xdfe54, 0xdfe61}, - {0xdff01, 0xdff03}, {0xdff05, 0xdff0a}, {0xdff0c, 0xdff0f}, {0xdff3b, 0xdff3d}, - {0xdff5f, 0xdff65}, {0xe0021, 0xe0023}, {0xe0025, 0xe002a}, {0xe002c, 0xe002f}, - {0xe005b, 0xe005d}, {0xe055a, 0xe055f}, {0xe066a, 0xe066d}, {0xe0700, 0xe070d}, - {0xe07f7, 0xe07f9}, {0xe0830, 0xe083e}, {0xe0f04, 0xe0f12}, {0xe0f3a, 0xe0f3d}, - {0xe0fd0, 0xe0fd4}, {0xe104a, 0xe104f}, {0xe1360, 0xe1368}, {0xe16eb, 0xe16ed}, - {0xe17d4, 0xe17d6}, {0xe17d8, 0xe17da}, {0xe1800, 0xe180a}, {0xe1aa0, 0xe1aa6}, - {0xe1aa8, 0xe1aad}, {0xe1b5a, 0xe1b60}, {0xe1bfc, 0xe1bff}, {0xe1c3b, 0xe1c3f}, - {0xe1cc0, 0xe1cc7}, {0xe2010, 0xe2027}, {0xe2030, 0xe2043}, {0xe2045, 0xe2051}, - {0xe2053, 0xe205e}, {0xe2308, 0xe230b}, {0xe2768, 0xe2775}, {0xe27e6, 0xe27ef}, - {0xe2983, 0xe2998}, {0xe29d8, 0xe29db}, {0xe2cf9, 0xe2cfc}, {0xe2e00, 0xe2e2e}, - {0xe2e30, 0xe2e49}, {0xe3001, 0xe3003}, {0xe3008, 0xe3011}, {0xe3014, 0xe301f}, - {0xea60d, 0xea60f}, {0xea6f2, 0xea6f7}, {0xea874, 0xea877}, {0xea8f8, 0xea8fa}, - {0xea9c1, 0xea9cd}, {0xeaa5c, 0xeaa5f}, {0xefe10, 0xefe19}, {0xefe30, 0xefe52}, - {0xefe54, 0xefe61}, {0xeff01, 0xeff03}, {0xeff05, 0xeff0a}, {0xeff0c, 0xeff0f}, - {0xeff3b, 0xeff3d}, {0xeff5f, 0xeff65}, {0xf0021, 0xf0023}, {0xf0025, 0xf002a}, - {0xf002c, 0xf002f}, {0xf005b, 0xf005d}, {0xf055a, 0xf055f}, {0xf066a, 0xf066d}, - {0xf0700, 0xf070d}, {0xf07f7, 0xf07f9}, {0xf0830, 0xf083e}, {0xf0f04, 0xf0f12}, - {0xf0f3a, 0xf0f3d}, {0xf0fd0, 0xf0fd4}, {0xf104a, 0xf104f}, {0xf1360, 0xf1368}, - {0xf16eb, 0xf16ed}, {0xf17d4, 0xf17d6}, {0xf17d8, 0xf17da}, {0xf1800, 0xf180a}, - {0xf1aa0, 0xf1aa6}, {0xf1aa8, 0xf1aad}, {0xf1b5a, 0xf1b60}, {0xf1bfc, 0xf1bff}, - {0xf1c3b, 0xf1c3f}, {0xf1cc0, 0xf1cc7}, {0xf2010, 0xf2027}, {0xf2030, 0xf2043}, - {0xf2045, 0xf2051}, {0xf2053, 0xf205e}, {0xf2308, 0xf230b}, {0xf2768, 0xf2775}, - {0xf27e6, 0xf27ef}, {0xf2983, 0xf2998}, {0xf29d8, 0xf29db}, {0xf2cf9, 0xf2cfc}, - {0xf2e00, 0xf2e2e}, {0xf2e30, 0xf2e49}, {0xf3001, 0xf3003}, {0xf3008, 0xf3011}, - {0xf3014, 0xf301f}, {0xfa60d, 0xfa60f}, {0xfa6f2, 0xfa6f7}, {0xfa874, 0xfa877}, - {0xfa8f8, 0xfa8fa}, {0xfa9c1, 0xfa9cd}, {0xfaa5c, 0xfaa5f}, {0xffe10, 0xffe19}, - {0xffe30, 0xffe52}, {0xffe54, 0xffe61}, {0xfff01, 0xfff03}, {0xfff05, 0xfff0a}, - {0xfff0c, 0xfff0f}, {0xfff3b, 0xfff3d}, {0xfff5f, 0xfff65}, {0x100021, 0x100023}, - {0x100025, 0x10002a}, {0x10002c, 0x10002f}, {0x10005b, 0x10005d}, {0x10055a, 0x10055f}, - {0x10066a, 0x10066d}, {0x100700, 0x10070d}, {0x1007f7, 0x1007f9}, {0x100830, 0x10083e}, - {0x100f04, 0x100f12}, {0x100f3a, 0x100f3d}, {0x100fd0, 0x100fd4}, {0x10104a, 0x10104f}, - {0x101360, 0x101368}, {0x1016eb, 0x1016ed}, {0x1017d4, 0x1017d6}, {0x1017d8, 0x1017da}, - {0x101800, 0x10180a}, {0x101aa0, 0x101aa6}, {0x101aa8, 0x101aad}, {0x101b5a, 0x101b60}, - {0x101bfc, 0x101bff}, {0x101c3b, 0x101c3f}, {0x101cc0, 0x101cc7}, {0x102010, 0x102027}, - {0x102030, 0x102043}, {0x102045, 0x102051}, {0x102053, 0x10205e}, {0x102308, 0x10230b}, - {0x102768, 0x102775}, {0x1027e6, 0x1027ef}, {0x102983, 0x102998}, {0x1029d8, 0x1029db}, - {0x102cf9, 0x102cfc}, {0x102e00, 0x102e2e}, {0x102e30, 0x102e49}, {0x103001, 0x103003}, - {0x103008, 0x103011}, {0x103014, 0x10301f}, {0x10a60d, 0x10a60f}, {0x10a6f2, 0x10a6f7}, - {0x10a874, 0x10a877}, {0x10a8f8, 0x10a8fa}, {0x10a9c1, 0x10a9cd}, {0x10aa5c, 0x10aa5f}, - {0x10fe10, 0x10fe19}, {0x10fe30, 0x10fe52}, {0x10fe54, 0x10fe61}, {0x10ff01, 0x10ff03}, - {0x10ff05, 0x10ff0a}, {0x10ff0c, 0x10ff0f}, {0x10ff3b, 0x10ff3d}, {0x10ff5f, 0x10ff65} + ,{0x10100, 0x10102}, {0x10a50, 0x10a58}, {0x10af0, 0x10af6}, {0x10b39, 0x10b3f}, + {0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143}, + {0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x1144b, 0x1144f}, + {0x115c1, 0x115d7}, {0x11641, 0x11643}, {0x11660, 0x1166c}, {0x1173c, 0x1173e}, + {0x11a3f, 0x11a46}, {0x11a9a, 0x11a9c}, {0x11a9e, 0x11aa2}, {0x11c41, 0x11c45}, + {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x1da87, 0x1da8b} #endif }; @@ -2053,198 +380,9 @@ static const chr punctCharTable[] = { 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a, 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d #if TCL_UTF_MAX > 4 - ,0x1003a, 0x1003b, 0x1003f, 0x10040, 0x1005f, 0x1007b, 0x1007d, 0x100a1, 0x100a7, - 0x100ab, 0x100b6, 0x100b7, 0x100bb, 0x100bf, 0x1037e, 0x10387, 0x10589, 0x1058a, - 0x105be, 0x105c0, 0x105c3, 0x105c6, 0x105f3, 0x105f4, 0x10609, 0x1060a, 0x1060c, - 0x1060d, 0x1061b, 0x1061e, 0x1061f, 0x106d4, 0x1085e, 0x10964, 0x10965, 0x10970, - 0x109fd, 0x10af0, 0x10df4, 0x10e4f, 0x10e5a, 0x10e5b, 0x10f14, 0x10f85, 0x10fd9, - 0x10fda, 0x110fb, 0x11400, 0x1166d, 0x1166e, 0x1169b, 0x1169c, 0x11735, 0x11736, - 0x11944, 0x11945, 0x11a1e, 0x11a1f, 0x11c7e, 0x11c7f, 0x11cd3, 0x1207d, 0x1207e, - 0x1208d, 0x1208e, 0x12329, 0x1232a, 0x127c5, 0x127c6, 0x129fc, 0x129fd, 0x12cfe, - 0x12cff, 0x12d70, 0x13030, 0x1303d, 0x130a0, 0x130fb, 0x1a4fe, 0x1a4ff, 0x1a673, - 0x1a67e, 0x1a8ce, 0x1a8cf, 0x1a8fc, 0x1a92e, 0x1a92f, 0x1a95f, 0x1a9de, 0x1a9df, - 0x1aade, 0x1aadf, 0x1aaf0, 0x1aaf1, 0x1abeb, 0x1fd3e, 0x1fd3f, 0x1fe63, 0x1fe68, - 0x1fe6a, 0x1fe6b, 0x1ff1a, 0x1ff1b, 0x1ff1f, 0x1ff20, 0x1ff3f, 0x1ff5b, 0x1ff5d, - 0x2003a, 0x2003b, 0x2003f, 0x20040, 0x2005f, 0x2007b, 0x2007d, 0x200a1, 0x200a7, - 0x200ab, 0x200b6, 0x200b7, 0x200bb, 0x200bf, 0x2037e, 0x20387, 0x20589, 0x2058a, - 0x205be, 0x205c0, 0x205c3, 0x205c6, 0x205f3, 0x205f4, 0x20609, 0x2060a, 0x2060c, - 0x2060d, 0x2061b, 0x2061e, 0x2061f, 0x206d4, 0x2085e, 0x20964, 0x20965, 0x20970, - 0x209fd, 0x20af0, 0x20df4, 0x20e4f, 0x20e5a, 0x20e5b, 0x20f14, 0x20f85, 0x20fd9, - 0x20fda, 0x210fb, 0x21400, 0x2166d, 0x2166e, 0x2169b, 0x2169c, 0x21735, 0x21736, - 0x21944, 0x21945, 0x21a1e, 0x21a1f, 0x21c7e, 0x21c7f, 0x21cd3, 0x2207d, 0x2207e, - 0x2208d, 0x2208e, 0x22329, 0x2232a, 0x227c5, 0x227c6, 0x229fc, 0x229fd, 0x22cfe, - 0x22cff, 0x22d70, 0x23030, 0x2303d, 0x230a0, 0x230fb, 0x2a4fe, 0x2a4ff, 0x2a673, - 0x2a67e, 0x2a8ce, 0x2a8cf, 0x2a8fc, 0x2a92e, 0x2a92f, 0x2a95f, 0x2a9de, 0x2a9df, - 0x2aade, 0x2aadf, 0x2aaf0, 0x2aaf1, 0x2abeb, 0x2fd3e, 0x2fd3f, 0x2fe63, 0x2fe68, - 0x2fe6a, 0x2fe6b, 0x2ff1a, 0x2ff1b, 0x2ff1f, 0x2ff20, 0x2ff3f, 0x2ff5b, 0x2ff5d, - 0x3003a, 0x3003b, 0x3003f, 0x30040, 0x3005f, 0x3007b, 0x3007d, 0x300a1, 0x300a7, - 0x300ab, 0x300b6, 0x300b7, 0x300bb, 0x300bf, 0x3037e, 0x30387, 0x30589, 0x3058a, - 0x305be, 0x305c0, 0x305c3, 0x305c6, 0x305f3, 0x305f4, 0x30609, 0x3060a, 0x3060c, - 0x3060d, 0x3061b, 0x3061e, 0x3061f, 0x306d4, 0x3085e, 0x30964, 0x30965, 0x30970, - 0x309fd, 0x30af0, 0x30df4, 0x30e4f, 0x30e5a, 0x30e5b, 0x30f14, 0x30f85, 0x30fd9, - 0x30fda, 0x310fb, 0x31400, 0x3166d, 0x3166e, 0x3169b, 0x3169c, 0x31735, 0x31736, - 0x31944, 0x31945, 0x31a1e, 0x31a1f, 0x31c7e, 0x31c7f, 0x31cd3, 0x3207d, 0x3207e, - 0x3208d, 0x3208e, 0x32329, 0x3232a, 0x327c5, 0x327c6, 0x329fc, 0x329fd, 0x32cfe, - 0x32cff, 0x32d70, 0x33030, 0x3303d, 0x330a0, 0x330fb, 0x3a4fe, 0x3a4ff, 0x3a673, - 0x3a67e, 0x3a8ce, 0x3a8cf, 0x3a8fc, 0x3a92e, 0x3a92f, 0x3a95f, 0x3a9de, 0x3a9df, - 0x3aade, 0x3aadf, 0x3aaf0, 0x3aaf1, 0x3abeb, 0x3fd3e, 0x3fd3f, 0x3fe63, 0x3fe68, - 0x3fe6a, 0x3fe6b, 0x3ff1a, 0x3ff1b, 0x3ff1f, 0x3ff20, 0x3ff3f, 0x3ff5b, 0x3ff5d, - 0x4003a, 0x4003b, 0x4003f, 0x40040, 0x4005f, 0x4007b, 0x4007d, 0x400a1, 0x400a7, - 0x400ab, 0x400b6, 0x400b7, 0x400bb, 0x400bf, 0x4037e, 0x40387, 0x40589, 0x4058a, - 0x405be, 0x405c0, 0x405c3, 0x405c6, 0x405f3, 0x405f4, 0x40609, 0x4060a, 0x4060c, - 0x4060d, 0x4061b, 0x4061e, 0x4061f, 0x406d4, 0x4085e, 0x40964, 0x40965, 0x40970, - 0x409fd, 0x40af0, 0x40df4, 0x40e4f, 0x40e5a, 0x40e5b, 0x40f14, 0x40f85, 0x40fd9, - 0x40fda, 0x410fb, 0x41400, 0x4166d, 0x4166e, 0x4169b, 0x4169c, 0x41735, 0x41736, - 0x41944, 0x41945, 0x41a1e, 0x41a1f, 0x41c7e, 0x41c7f, 0x41cd3, 0x4207d, 0x4207e, - 0x4208d, 0x4208e, 0x42329, 0x4232a, 0x427c5, 0x427c6, 0x429fc, 0x429fd, 0x42cfe, - 0x42cff, 0x42d70, 0x43030, 0x4303d, 0x430a0, 0x430fb, 0x4a4fe, 0x4a4ff, 0x4a673, - 0x4a67e, 0x4a8ce, 0x4a8cf, 0x4a8fc, 0x4a92e, 0x4a92f, 0x4a95f, 0x4a9de, 0x4a9df, - 0x4aade, 0x4aadf, 0x4aaf0, 0x4aaf1, 0x4abeb, 0x4fd3e, 0x4fd3f, 0x4fe63, 0x4fe68, - 0x4fe6a, 0x4fe6b, 0x4ff1a, 0x4ff1b, 0x4ff1f, 0x4ff20, 0x4ff3f, 0x4ff5b, 0x4ff5d, - 0x5003a, 0x5003b, 0x5003f, 0x50040, 0x5005f, 0x5007b, 0x5007d, 0x500a1, 0x500a7, - 0x500ab, 0x500b6, 0x500b7, 0x500bb, 0x500bf, 0x5037e, 0x50387, 0x50589, 0x5058a, - 0x505be, 0x505c0, 0x505c3, 0x505c6, 0x505f3, 0x505f4, 0x50609, 0x5060a, 0x5060c, - 0x5060d, 0x5061b, 0x5061e, 0x5061f, 0x506d4, 0x5085e, 0x50964, 0x50965, 0x50970, - 0x509fd, 0x50af0, 0x50df4, 0x50e4f, 0x50e5a, 0x50e5b, 0x50f14, 0x50f85, 0x50fd9, - 0x50fda, 0x510fb, 0x51400, 0x5166d, 0x5166e, 0x5169b, 0x5169c, 0x51735, 0x51736, - 0x51944, 0x51945, 0x51a1e, 0x51a1f, 0x51c7e, 0x51c7f, 0x51cd3, 0x5207d, 0x5207e, - 0x5208d, 0x5208e, 0x52329, 0x5232a, 0x527c5, 0x527c6, 0x529fc, 0x529fd, 0x52cfe, - 0x52cff, 0x52d70, 0x53030, 0x5303d, 0x530a0, 0x530fb, 0x5a4fe, 0x5a4ff, 0x5a673, - 0x5a67e, 0x5a8ce, 0x5a8cf, 0x5a8fc, 0x5a92e, 0x5a92f, 0x5a95f, 0x5a9de, 0x5a9df, - 0x5aade, 0x5aadf, 0x5aaf0, 0x5aaf1, 0x5abeb, 0x5fd3e, 0x5fd3f, 0x5fe63, 0x5fe68, - 0x5fe6a, 0x5fe6b, 0x5ff1a, 0x5ff1b, 0x5ff1f, 0x5ff20, 0x5ff3f, 0x5ff5b, 0x5ff5d, - 0x6003a, 0x6003b, 0x6003f, 0x60040, 0x6005f, 0x6007b, 0x6007d, 0x600a1, 0x600a7, - 0x600ab, 0x600b6, 0x600b7, 0x600bb, 0x600bf, 0x6037e, 0x60387, 0x60589, 0x6058a, - 0x605be, 0x605c0, 0x605c3, 0x605c6, 0x605f3, 0x605f4, 0x60609, 0x6060a, 0x6060c, - 0x6060d, 0x6061b, 0x6061e, 0x6061f, 0x606d4, 0x6085e, 0x60964, 0x60965, 0x60970, - 0x609fd, 0x60af0, 0x60df4, 0x60e4f, 0x60e5a, 0x60e5b, 0x60f14, 0x60f85, 0x60fd9, - 0x60fda, 0x610fb, 0x61400, 0x6166d, 0x6166e, 0x6169b, 0x6169c, 0x61735, 0x61736, - 0x61944, 0x61945, 0x61a1e, 0x61a1f, 0x61c7e, 0x61c7f, 0x61cd3, 0x6207d, 0x6207e, - 0x6208d, 0x6208e, 0x62329, 0x6232a, 0x627c5, 0x627c6, 0x629fc, 0x629fd, 0x62cfe, - 0x62cff, 0x62d70, 0x63030, 0x6303d, 0x630a0, 0x630fb, 0x6a4fe, 0x6a4ff, 0x6a673, - 0x6a67e, 0x6a8ce, 0x6a8cf, 0x6a8fc, 0x6a92e, 0x6a92f, 0x6a95f, 0x6a9de, 0x6a9df, - 0x6aade, 0x6aadf, 0x6aaf0, 0x6aaf1, 0x6abeb, 0x6fd3e, 0x6fd3f, 0x6fe63, 0x6fe68, - 0x6fe6a, 0x6fe6b, 0x6ff1a, 0x6ff1b, 0x6ff1f, 0x6ff20, 0x6ff3f, 0x6ff5b, 0x6ff5d, - 0x7003a, 0x7003b, 0x7003f, 0x70040, 0x7005f, 0x7007b, 0x7007d, 0x700a1, 0x700a7, - 0x700ab, 0x700b6, 0x700b7, 0x700bb, 0x700bf, 0x7037e, 0x70387, 0x70589, 0x7058a, - 0x705be, 0x705c0, 0x705c3, 0x705c6, 0x705f3, 0x705f4, 0x70609, 0x7060a, 0x7060c, - 0x7060d, 0x7061b, 0x7061e, 0x7061f, 0x706d4, 0x7085e, 0x70964, 0x70965, 0x70970, - 0x709fd, 0x70af0, 0x70df4, 0x70e4f, 0x70e5a, 0x70e5b, 0x70f14, 0x70f85, 0x70fd9, - 0x70fda, 0x710fb, 0x71400, 0x7166d, 0x7166e, 0x7169b, 0x7169c, 0x71735, 0x71736, - 0x71944, 0x71945, 0x71a1e, 0x71a1f, 0x71c7e, 0x71c7f, 0x71cd3, 0x7207d, 0x7207e, - 0x7208d, 0x7208e, 0x72329, 0x7232a, 0x727c5, 0x727c6, 0x729fc, 0x729fd, 0x72cfe, - 0x72cff, 0x72d70, 0x73030, 0x7303d, 0x730a0, 0x730fb, 0x7a4fe, 0x7a4ff, 0x7a673, - 0x7a67e, 0x7a8ce, 0x7a8cf, 0x7a8fc, 0x7a92e, 0x7a92f, 0x7a95f, 0x7a9de, 0x7a9df, - 0x7aade, 0x7aadf, 0x7aaf0, 0x7aaf1, 0x7abeb, 0x7fd3e, 0x7fd3f, 0x7fe63, 0x7fe68, - 0x7fe6a, 0x7fe6b, 0x7ff1a, 0x7ff1b, 0x7ff1f, 0x7ff20, 0x7ff3f, 0x7ff5b, 0x7ff5d, - 0x8003a, 0x8003b, 0x8003f, 0x80040, 0x8005f, 0x8007b, 0x8007d, 0x800a1, 0x800a7, - 0x800ab, 0x800b6, 0x800b7, 0x800bb, 0x800bf, 0x8037e, 0x80387, 0x80589, 0x8058a, - 0x805be, 0x805c0, 0x805c3, 0x805c6, 0x805f3, 0x805f4, 0x80609, 0x8060a, 0x8060c, - 0x8060d, 0x8061b, 0x8061e, 0x8061f, 0x806d4, 0x8085e, 0x80964, 0x80965, 0x80970, - 0x809fd, 0x80af0, 0x80df4, 0x80e4f, 0x80e5a, 0x80e5b, 0x80f14, 0x80f85, 0x80fd9, - 0x80fda, 0x810fb, 0x81400, 0x8166d, 0x8166e, 0x8169b, 0x8169c, 0x81735, 0x81736, - 0x81944, 0x81945, 0x81a1e, 0x81a1f, 0x81c7e, 0x81c7f, 0x81cd3, 0x8207d, 0x8207e, - 0x8208d, 0x8208e, 0x82329, 0x8232a, 0x827c5, 0x827c6, 0x829fc, 0x829fd, 0x82cfe, - 0x82cff, 0x82d70, 0x83030, 0x8303d, 0x830a0, 0x830fb, 0x8a4fe, 0x8a4ff, 0x8a673, - 0x8a67e, 0x8a8ce, 0x8a8cf, 0x8a8fc, 0x8a92e, 0x8a92f, 0x8a95f, 0x8a9de, 0x8a9df, - 0x8aade, 0x8aadf, 0x8aaf0, 0x8aaf1, 0x8abeb, 0x8fd3e, 0x8fd3f, 0x8fe63, 0x8fe68, - 0x8fe6a, 0x8fe6b, 0x8ff1a, 0x8ff1b, 0x8ff1f, 0x8ff20, 0x8ff3f, 0x8ff5b, 0x8ff5d, - 0x9003a, 0x9003b, 0x9003f, 0x90040, 0x9005f, 0x9007b, 0x9007d, 0x900a1, 0x900a7, - 0x900ab, 0x900b6, 0x900b7, 0x900bb, 0x900bf, 0x9037e, 0x90387, 0x90589, 0x9058a, - 0x905be, 0x905c0, 0x905c3, 0x905c6, 0x905f3, 0x905f4, 0x90609, 0x9060a, 0x9060c, - 0x9060d, 0x9061b, 0x9061e, 0x9061f, 0x906d4, 0x9085e, 0x90964, 0x90965, 0x90970, - 0x909fd, 0x90af0, 0x90df4, 0x90e4f, 0x90e5a, 0x90e5b, 0x90f14, 0x90f85, 0x90fd9, - 0x90fda, 0x910fb, 0x91400, 0x9166d, 0x9166e, 0x9169b, 0x9169c, 0x91735, 0x91736, - 0x91944, 0x91945, 0x91a1e, 0x91a1f, 0x91c7e, 0x91c7f, 0x91cd3, 0x9207d, 0x9207e, - 0x9208d, 0x9208e, 0x92329, 0x9232a, 0x927c5, 0x927c6, 0x929fc, 0x929fd, 0x92cfe, - 0x92cff, 0x92d70, 0x93030, 0x9303d, 0x930a0, 0x930fb, 0x9a4fe, 0x9a4ff, 0x9a673, - 0x9a67e, 0x9a8ce, 0x9a8cf, 0x9a8fc, 0x9a92e, 0x9a92f, 0x9a95f, 0x9a9de, 0x9a9df, - 0x9aade, 0x9aadf, 0x9aaf0, 0x9aaf1, 0x9abeb, 0x9fd3e, 0x9fd3f, 0x9fe63, 0x9fe68, - 0x9fe6a, 0x9fe6b, 0x9ff1a, 0x9ff1b, 0x9ff1f, 0x9ff20, 0x9ff3f, 0x9ff5b, 0x9ff5d, - 0xa003a, 0xa003b, 0xa003f, 0xa0040, 0xa005f, 0xa007b, 0xa007d, 0xa00a1, 0xa00a7, - 0xa00ab, 0xa00b6, 0xa00b7, 0xa00bb, 0xa00bf, 0xa037e, 0xa0387, 0xa0589, 0xa058a, - 0xa05be, 0xa05c0, 0xa05c3, 0xa05c6, 0xa05f3, 0xa05f4, 0xa0609, 0xa060a, 0xa060c, - 0xa060d, 0xa061b, 0xa061e, 0xa061f, 0xa06d4, 0xa085e, 0xa0964, 0xa0965, 0xa0970, - 0xa09fd, 0xa0af0, 0xa0df4, 0xa0e4f, 0xa0e5a, 0xa0e5b, 0xa0f14, 0xa0f85, 0xa0fd9, - 0xa0fda, 0xa10fb, 0xa1400, 0xa166d, 0xa166e, 0xa169b, 0xa169c, 0xa1735, 0xa1736, - 0xa1944, 0xa1945, 0xa1a1e, 0xa1a1f, 0xa1c7e, 0xa1c7f, 0xa1cd3, 0xa207d, 0xa207e, - 0xa208d, 0xa208e, 0xa2329, 0xa232a, 0xa27c5, 0xa27c6, 0xa29fc, 0xa29fd, 0xa2cfe, - 0xa2cff, 0xa2d70, 0xa3030, 0xa303d, 0xa30a0, 0xa30fb, 0xaa4fe, 0xaa4ff, 0xaa673, - 0xaa67e, 0xaa8ce, 0xaa8cf, 0xaa8fc, 0xaa92e, 0xaa92f, 0xaa95f, 0xaa9de, 0xaa9df, - 0xaaade, 0xaaadf, 0xaaaf0, 0xaaaf1, 0xaabeb, 0xafd3e, 0xafd3f, 0xafe63, 0xafe68, - 0xafe6a, 0xafe6b, 0xaff1a, 0xaff1b, 0xaff1f, 0xaff20, 0xaff3f, 0xaff5b, 0xaff5d, - 0xb003a, 0xb003b, 0xb003f, 0xb0040, 0xb005f, 0xb007b, 0xb007d, 0xb00a1, 0xb00a7, - 0xb00ab, 0xb00b6, 0xb00b7, 0xb00bb, 0xb00bf, 0xb037e, 0xb0387, 0xb0589, 0xb058a, - 0xb05be, 0xb05c0, 0xb05c3, 0xb05c6, 0xb05f3, 0xb05f4, 0xb0609, 0xb060a, 0xb060c, - 0xb060d, 0xb061b, 0xb061e, 0xb061f, 0xb06d4, 0xb085e, 0xb0964, 0xb0965, 0xb0970, - 0xb09fd, 0xb0af0, 0xb0df4, 0xb0e4f, 0xb0e5a, 0xb0e5b, 0xb0f14, 0xb0f85, 0xb0fd9, - 0xb0fda, 0xb10fb, 0xb1400, 0xb166d, 0xb166e, 0xb169b, 0xb169c, 0xb1735, 0xb1736, - 0xb1944, 0xb1945, 0xb1a1e, 0xb1a1f, 0xb1c7e, 0xb1c7f, 0xb1cd3, 0xb207d, 0xb207e, - 0xb208d, 0xb208e, 0xb2329, 0xb232a, 0xb27c5, 0xb27c6, 0xb29fc, 0xb29fd, 0xb2cfe, - 0xb2cff, 0xb2d70, 0xb3030, 0xb303d, 0xb30a0, 0xb30fb, 0xba4fe, 0xba4ff, 0xba673, - 0xba67e, 0xba8ce, 0xba8cf, 0xba8fc, 0xba92e, 0xba92f, 0xba95f, 0xba9de, 0xba9df, - 0xbaade, 0xbaadf, 0xbaaf0, 0xbaaf1, 0xbabeb, 0xbfd3e, 0xbfd3f, 0xbfe63, 0xbfe68, - 0xbfe6a, 0xbfe6b, 0xbff1a, 0xbff1b, 0xbff1f, 0xbff20, 0xbff3f, 0xbff5b, 0xbff5d, - 0xc003a, 0xc003b, 0xc003f, 0xc0040, 0xc005f, 0xc007b, 0xc007d, 0xc00a1, 0xc00a7, - 0xc00ab, 0xc00b6, 0xc00b7, 0xc00bb, 0xc00bf, 0xc037e, 0xc0387, 0xc0589, 0xc058a, - 0xc05be, 0xc05c0, 0xc05c3, 0xc05c6, 0xc05f3, 0xc05f4, 0xc0609, 0xc060a, 0xc060c, - 0xc060d, 0xc061b, 0xc061e, 0xc061f, 0xc06d4, 0xc085e, 0xc0964, 0xc0965, 0xc0970, - 0xc09fd, 0xc0af0, 0xc0df4, 0xc0e4f, 0xc0e5a, 0xc0e5b, 0xc0f14, 0xc0f85, 0xc0fd9, - 0xc0fda, 0xc10fb, 0xc1400, 0xc166d, 0xc166e, 0xc169b, 0xc169c, 0xc1735, 0xc1736, - 0xc1944, 0xc1945, 0xc1a1e, 0xc1a1f, 0xc1c7e, 0xc1c7f, 0xc1cd3, 0xc207d, 0xc207e, - 0xc208d, 0xc208e, 0xc2329, 0xc232a, 0xc27c5, 0xc27c6, 0xc29fc, 0xc29fd, 0xc2cfe, - 0xc2cff, 0xc2d70, 0xc3030, 0xc303d, 0xc30a0, 0xc30fb, 0xca4fe, 0xca4ff, 0xca673, - 0xca67e, 0xca8ce, 0xca8cf, 0xca8fc, 0xca92e, 0xca92f, 0xca95f, 0xca9de, 0xca9df, - 0xcaade, 0xcaadf, 0xcaaf0, 0xcaaf1, 0xcabeb, 0xcfd3e, 0xcfd3f, 0xcfe63, 0xcfe68, - 0xcfe6a, 0xcfe6b, 0xcff1a, 0xcff1b, 0xcff1f, 0xcff20, 0xcff3f, 0xcff5b, 0xcff5d, - 0xd003a, 0xd003b, 0xd003f, 0xd0040, 0xd005f, 0xd007b, 0xd007d, 0xd00a1, 0xd00a7, - 0xd00ab, 0xd00b6, 0xd00b7, 0xd00bb, 0xd00bf, 0xd037e, 0xd0387, 0xd0589, 0xd058a, - 0xd05be, 0xd05c0, 0xd05c3, 0xd05c6, 0xd05f3, 0xd05f4, 0xd0609, 0xd060a, 0xd060c, - 0xd060d, 0xd061b, 0xd061e, 0xd061f, 0xd06d4, 0xd085e, 0xd0964, 0xd0965, 0xd0970, - 0xd09fd, 0xd0af0, 0xd0df4, 0xd0e4f, 0xd0e5a, 0xd0e5b, 0xd0f14, 0xd0f85, 0xd0fd9, - 0xd0fda, 0xd10fb, 0xd1400, 0xd166d, 0xd166e, 0xd169b, 0xd169c, 0xd1735, 0xd1736, - 0xd1944, 0xd1945, 0xd1a1e, 0xd1a1f, 0xd1c7e, 0xd1c7f, 0xd1cd3, 0xd207d, 0xd207e, - 0xd208d, 0xd208e, 0xd2329, 0xd232a, 0xd27c5, 0xd27c6, 0xd29fc, 0xd29fd, 0xd2cfe, - 0xd2cff, 0xd2d70, 0xd3030, 0xd303d, 0xd30a0, 0xd30fb, 0xda4fe, 0xda4ff, 0xda673, - 0xda67e, 0xda8ce, 0xda8cf, 0xda8fc, 0xda92e, 0xda92f, 0xda95f, 0xda9de, 0xda9df, - 0xdaade, 0xdaadf, 0xdaaf0, 0xdaaf1, 0xdabeb, 0xdfd3e, 0xdfd3f, 0xdfe63, 0xdfe68, - 0xdfe6a, 0xdfe6b, 0xdff1a, 0xdff1b, 0xdff1f, 0xdff20, 0xdff3f, 0xdff5b, 0xdff5d, - 0xe003a, 0xe003b, 0xe003f, 0xe0040, 0xe005f, 0xe007b, 0xe007d, 0xe00a1, 0xe00a7, - 0xe00ab, 0xe00b6, 0xe00b7, 0xe00bb, 0xe00bf, 0xe037e, 0xe0387, 0xe0589, 0xe058a, - 0xe05be, 0xe05c0, 0xe05c3, 0xe05c6, 0xe05f3, 0xe05f4, 0xe0609, 0xe060a, 0xe060c, - 0xe060d, 0xe061b, 0xe061e, 0xe061f, 0xe06d4, 0xe085e, 0xe0964, 0xe0965, 0xe0970, - 0xe09fd, 0xe0af0, 0xe0df4, 0xe0e4f, 0xe0e5a, 0xe0e5b, 0xe0f14, 0xe0f85, 0xe0fd9, - 0xe0fda, 0xe10fb, 0xe1400, 0xe166d, 0xe166e, 0xe169b, 0xe169c, 0xe1735, 0xe1736, - 0xe1944, 0xe1945, 0xe1a1e, 0xe1a1f, 0xe1c7e, 0xe1c7f, 0xe1cd3, 0xe207d, 0xe207e, - 0xe208d, 0xe208e, 0xe2329, 0xe232a, 0xe27c5, 0xe27c6, 0xe29fc, 0xe29fd, 0xe2cfe, - 0xe2cff, 0xe2d70, 0xe3030, 0xe303d, 0xe30a0, 0xe30fb, 0xea4fe, 0xea4ff, 0xea673, - 0xea67e, 0xea8ce, 0xea8cf, 0xea8fc, 0xea92e, 0xea92f, 0xea95f, 0xea9de, 0xea9df, - 0xeaade, 0xeaadf, 0xeaaf0, 0xeaaf1, 0xeabeb, 0xefd3e, 0xefd3f, 0xefe63, 0xefe68, - 0xefe6a, 0xefe6b, 0xeff1a, 0xeff1b, 0xeff1f, 0xeff20, 0xeff3f, 0xeff5b, 0xeff5d, - 0xf003a, 0xf003b, 0xf003f, 0xf0040, 0xf005f, 0xf007b, 0xf007d, 0xf00a1, 0xf00a7, - 0xf00ab, 0xf00b6, 0xf00b7, 0xf00bb, 0xf00bf, 0xf037e, 0xf0387, 0xf0589, 0xf058a, - 0xf05be, 0xf05c0, 0xf05c3, 0xf05c6, 0xf05f3, 0xf05f4, 0xf0609, 0xf060a, 0xf060c, - 0xf060d, 0xf061b, 0xf061e, 0xf061f, 0xf06d4, 0xf085e, 0xf0964, 0xf0965, 0xf0970, - 0xf09fd, 0xf0af0, 0xf0df4, 0xf0e4f, 0xf0e5a, 0xf0e5b, 0xf0f14, 0xf0f85, 0xf0fd9, - 0xf0fda, 0xf10fb, 0xf1400, 0xf166d, 0xf166e, 0xf169b, 0xf169c, 0xf1735, 0xf1736, - 0xf1944, 0xf1945, 0xf1a1e, 0xf1a1f, 0xf1c7e, 0xf1c7f, 0xf1cd3, 0xf207d, 0xf207e, - 0xf208d, 0xf208e, 0xf2329, 0xf232a, 0xf27c5, 0xf27c6, 0xf29fc, 0xf29fd, 0xf2cfe, - 0xf2cff, 0xf2d70, 0xf3030, 0xf303d, 0xf30a0, 0xf30fb, 0xfa4fe, 0xfa4ff, 0xfa673, - 0xfa67e, 0xfa8ce, 0xfa8cf, 0xfa8fc, 0xfa92e, 0xfa92f, 0xfa95f, 0xfa9de, 0xfa9df, - 0xfaade, 0xfaadf, 0xfaaf0, 0xfaaf1, 0xfabeb, 0xffd3e, 0xffd3f, 0xffe63, 0xffe68, - 0xffe6a, 0xffe6b, 0xfff1a, 0xfff1b, 0xfff1f, 0xfff20, 0xfff3f, 0xfff5b, 0xfff5d, - 0x10003a, 0x10003b, 0x10003f, 0x100040, 0x10005f, 0x10007b, 0x10007d, 0x1000a1, 0x1000a7, - 0x1000ab, 0x1000b6, 0x1000b7, 0x1000bb, 0x1000bf, 0x10037e, 0x100387, 0x100589, 0x10058a, - 0x1005be, 0x1005c0, 0x1005c3, 0x1005c6, 0x1005f3, 0x1005f4, 0x100609, 0x10060a, 0x10060c, - 0x10060d, 0x10061b, 0x10061e, 0x10061f, 0x1006d4, 0x10085e, 0x100964, 0x100965, 0x100970, - 0x1009fd, 0x100af0, 0x100df4, 0x100e4f, 0x100e5a, 0x100e5b, 0x100f14, 0x100f85, 0x100fd9, - 0x100fda, 0x1010fb, 0x101400, 0x10166d, 0x10166e, 0x10169b, 0x10169c, 0x101735, 0x101736, - 0x101944, 0x101945, 0x101a1e, 0x101a1f, 0x101c7e, 0x101c7f, 0x101cd3, 0x10207d, 0x10207e, - 0x10208d, 0x10208e, 0x102329, 0x10232a, 0x1027c5, 0x1027c6, 0x1029fc, 0x1029fd, 0x102cfe, - 0x102cff, 0x102d70, 0x103030, 0x10303d, 0x1030a0, 0x1030fb, 0x10a4fe, 0x10a4ff, 0x10a673, - 0x10a67e, 0x10a8ce, 0x10a8cf, 0x10a8fc, 0x10a92e, 0x10a92f, 0x10a95f, 0x10a9de, 0x10a9df, - 0x10aade, 0x10aadf, 0x10aaf0, 0x10aaf1, 0x10abeb, 0x10fd3e, 0x10fd3f, 0x10fe63, 0x10fe68, - 0x10fe6a, 0x10fe6b, 0x10ff1a, 0x10ff1b, 0x10ff1f, 0x10ff20, 0x10ff3f, 0x10ff5b, 0x10ff5d + ,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc, + 0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x11c70, + 0x11c71, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f, 0x1e95e, 0x1e95f #endif }; @@ -2256,16 +394,6 @@ static const chr punctCharTable[] = { static const crange spaceRangeTable[] = { {0x9, 0xd}, {0x2000, 0x200b} -#if TCL_UTF_MAX > 4 - ,{0x10009, 0x1000d}, {0x12000, 0x1200b}, {0x20009, 0x2000d}, {0x22000, 0x2200b}, - {0x30009, 0x3000d}, {0x32000, 0x3200b}, {0x40009, 0x4000d}, {0x42000, 0x4200b}, - {0x50009, 0x5000d}, {0x52000, 0x5200b}, {0x60009, 0x6000d}, {0x62000, 0x6200b}, - {0x70009, 0x7000d}, {0x72000, 0x7200b}, {0x80009, 0x8000d}, {0x82000, 0x8200b}, - {0x90009, 0x9000d}, {0x92000, 0x9200b}, {0xa0009, 0xa000d}, {0xa2000, 0xa200b}, - {0xb0009, 0xb000d}, {0xb2000, 0xb200b}, {0xc0009, 0xc000d}, {0xc2000, 0xc200b}, - {0xd0009, 0xd000d}, {0xd2000, 0xd200b}, {0xe0009, 0xe000d}, {0xe2000, 0xe200b}, - {0xf0009, 0xf000d}, {0xf2000, 0xf200b}, {0x100009, 0x10000d}, {0x102000, 0x10200b} -#endif }; #define NUM_SPACE_RANGE (sizeof(spaceRangeTable)/sizeof(crange)) @@ -2273,30 +401,6 @@ static const crange spaceRangeTable[] = { static const chr spaceCharTable[] = { 0x20, 0x85, 0xa0, 0x1680, 0x180e, 0x2028, 0x2029, 0x202f, 0x205f, 0x2060, 0x3000, 0xfeff -#if TCL_UTF_MAX > 4 - ,0x10020, 0x10085, 0x100a0, 0x11680, 0x1180e, 0x12028, 0x12029, 0x1202f, 0x1205f, - 0x12060, 0x13000, 0x1feff, 0x20020, 0x20085, 0x200a0, 0x21680, 0x2180e, 0x22028, - 0x22029, 0x2202f, 0x2205f, 0x22060, 0x23000, 0x2feff, 0x30020, 0x30085, 0x300a0, - 0x31680, 0x3180e, 0x32028, 0x32029, 0x3202f, 0x3205f, 0x32060, 0x33000, 0x3feff, - 0x40020, 0x40085, 0x400a0, 0x41680, 0x4180e, 0x42028, 0x42029, 0x4202f, 0x4205f, - 0x42060, 0x43000, 0x4feff, 0x50020, 0x50085, 0x500a0, 0x51680, 0x5180e, 0x52028, - 0x52029, 0x5202f, 0x5205f, 0x52060, 0x53000, 0x5feff, 0x60020, 0x60085, 0x600a0, - 0x61680, 0x6180e, 0x62028, 0x62029, 0x6202f, 0x6205f, 0x62060, 0x63000, 0x6feff, - 0x70020, 0x70085, 0x700a0, 0x71680, 0x7180e, 0x72028, 0x72029, 0x7202f, 0x7205f, - 0x72060, 0x73000, 0x7feff, 0x80020, 0x80085, 0x800a0, 0x81680, 0x8180e, 0x82028, - 0x82029, 0x8202f, 0x8205f, 0x82060, 0x83000, 0x8feff, 0x90020, 0x90085, 0x900a0, - 0x91680, 0x9180e, 0x92028, 0x92029, 0x9202f, 0x9205f, 0x92060, 0x93000, 0x9feff, - 0xa0020, 0xa0085, 0xa00a0, 0xa1680, 0xa180e, 0xa2028, 0xa2029, 0xa202f, 0xa205f, - 0xa2060, 0xa3000, 0xafeff, 0xb0020, 0xb0085, 0xb00a0, 0xb1680, 0xb180e, 0xb2028, - 0xb2029, 0xb202f, 0xb205f, 0xb2060, 0xb3000, 0xbfeff, 0xc0020, 0xc0085, 0xc00a0, - 0xc1680, 0xc180e, 0xc2028, 0xc2029, 0xc202f, 0xc205f, 0xc2060, 0xc3000, 0xcfeff, - 0xd0020, 0xd0085, 0xd00a0, 0xd1680, 0xd180e, 0xd2028, 0xd2029, 0xd202f, 0xd205f, - 0xd2060, 0xd3000, 0xdfeff, 0xe0020, 0xe0085, 0xe00a0, 0xe1680, 0xe180e, 0xe2028, - 0xe2029, 0xe202f, 0xe205f, 0xe2060, 0xe3000, 0xefeff, 0xf0020, 0xf0085, 0xf00a0, - 0xf1680, 0xf180e, 0xf2028, 0xf2029, 0xf202f, 0xf205f, 0xf2060, 0xf3000, 0xffeff, - 0x100020, 0x100085, 0x1000a0, 0x101680, 0x10180e, 0x102028, 0x102029, 0x10202f, 0x10205f, - 0x102060, 0x103000, 0x10feff -#endif }; #define NUM_SPACE_CHAR (sizeof(spaceCharTable)/sizeof(chr)) @@ -2320,206 +424,14 @@ static const crange lowerRangeTable[] = { {0xab30, 0xab5a}, {0xab60, 0xab65}, {0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xff41, 0xff5a} #if TCL_UTF_MAX > 4 - ,{0x10061, 0x1007a}, {0x100df, 0x100f6}, {0x100f8, 0x100ff}, {0x1017e, 0x10180}, - {0x10199, 0x1019b}, {0x101bd, 0x101bf}, {0x10233, 0x10239}, {0x1024f, 0x10293}, - {0x10295, 0x102af}, {0x1037b, 0x1037d}, {0x103ac, 0x103ce}, {0x103d5, 0x103d7}, - {0x103ef, 0x103f3}, {0x10430, 0x1045f}, {0x10561, 0x10587}, {0x113f8, 0x113fd}, - {0x11c80, 0x11c88}, {0x11d00, 0x11d2b}, {0x11d6b, 0x11d77}, {0x11d79, 0x11d9a}, - {0x11e95, 0x11e9d}, {0x11eff, 0x11f07}, {0x11f10, 0x11f15}, {0x11f20, 0x11f27}, - {0x11f30, 0x11f37}, {0x11f40, 0x11f45}, {0x11f50, 0x11f57}, {0x11f60, 0x11f67}, - {0x11f70, 0x11f7d}, {0x11f80, 0x11f87}, {0x11f90, 0x11f97}, {0x11fa0, 0x11fa7}, - {0x11fb0, 0x11fb4}, {0x11fc2, 0x11fc4}, {0x11fd0, 0x11fd3}, {0x11fe0, 0x11fe7}, - {0x11ff2, 0x11ff4}, {0x12146, 0x12149}, {0x12c30, 0x12c5e}, {0x12c76, 0x12c7b}, - {0x12d00, 0x12d25}, {0x1a72f, 0x1a731}, {0x1a771, 0x1a778}, {0x1a793, 0x1a795}, - {0x1ab30, 0x1ab5a}, {0x1ab60, 0x1ab65}, {0x1ab70, 0x1abbf}, {0x1fb00, 0x1fb06}, - {0x1fb13, 0x1fb17}, {0x1ff41, 0x1ff5a}, {0x20061, 0x2007a}, {0x200df, 0x200f6}, - {0x200f8, 0x200ff}, {0x2017e, 0x20180}, {0x20199, 0x2019b}, {0x201bd, 0x201bf}, - {0x20233, 0x20239}, {0x2024f, 0x20293}, {0x20295, 0x202af}, {0x2037b, 0x2037d}, - {0x203ac, 0x203ce}, {0x203d5, 0x203d7}, {0x203ef, 0x203f3}, {0x20430, 0x2045f}, - {0x20561, 0x20587}, {0x213f8, 0x213fd}, {0x21c80, 0x21c88}, {0x21d00, 0x21d2b}, - {0x21d6b, 0x21d77}, {0x21d79, 0x21d9a}, {0x21e95, 0x21e9d}, {0x21eff, 0x21f07}, - {0x21f10, 0x21f15}, {0x21f20, 0x21f27}, {0x21f30, 0x21f37}, {0x21f40, 0x21f45}, - {0x21f50, 0x21f57}, {0x21f60, 0x21f67}, {0x21f70, 0x21f7d}, {0x21f80, 0x21f87}, - {0x21f90, 0x21f97}, {0x21fa0, 0x21fa7}, {0x21fb0, 0x21fb4}, {0x21fc2, 0x21fc4}, - {0x21fd0, 0x21fd3}, {0x21fe0, 0x21fe7}, {0x21ff2, 0x21ff4}, {0x22146, 0x22149}, - {0x22c30, 0x22c5e}, {0x22c76, 0x22c7b}, {0x22d00, 0x22d25}, {0x2a72f, 0x2a731}, - {0x2a771, 0x2a778}, {0x2a793, 0x2a795}, {0x2ab30, 0x2ab5a}, {0x2ab60, 0x2ab65}, - {0x2ab70, 0x2abbf}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2ff41, 0x2ff5a}, - {0x30061, 0x3007a}, {0x300df, 0x300f6}, {0x300f8, 0x300ff}, {0x3017e, 0x30180}, - {0x30199, 0x3019b}, {0x301bd, 0x301bf}, {0x30233, 0x30239}, {0x3024f, 0x30293}, - {0x30295, 0x302af}, {0x3037b, 0x3037d}, {0x303ac, 0x303ce}, {0x303d5, 0x303d7}, - {0x303ef, 0x303f3}, {0x30430, 0x3045f}, {0x30561, 0x30587}, {0x313f8, 0x313fd}, - {0x31c80, 0x31c88}, {0x31d00, 0x31d2b}, {0x31d6b, 0x31d77}, {0x31d79, 0x31d9a}, - {0x31e95, 0x31e9d}, {0x31eff, 0x31f07}, {0x31f10, 0x31f15}, {0x31f20, 0x31f27}, - {0x31f30, 0x31f37}, {0x31f40, 0x31f45}, {0x31f50, 0x31f57}, {0x31f60, 0x31f67}, - {0x31f70, 0x31f7d}, {0x31f80, 0x31f87}, {0x31f90, 0x31f97}, {0x31fa0, 0x31fa7}, - {0x31fb0, 0x31fb4}, {0x31fc2, 0x31fc4}, {0x31fd0, 0x31fd3}, {0x31fe0, 0x31fe7}, - {0x31ff2, 0x31ff4}, {0x32146, 0x32149}, {0x32c30, 0x32c5e}, {0x32c76, 0x32c7b}, - {0x32d00, 0x32d25}, {0x3a72f, 0x3a731}, {0x3a771, 0x3a778}, {0x3a793, 0x3a795}, - {0x3ab30, 0x3ab5a}, {0x3ab60, 0x3ab65}, {0x3ab70, 0x3abbf}, {0x3fb00, 0x3fb06}, - {0x3fb13, 0x3fb17}, {0x3ff41, 0x3ff5a}, {0x40061, 0x4007a}, {0x400df, 0x400f6}, - {0x400f8, 0x400ff}, {0x4017e, 0x40180}, {0x40199, 0x4019b}, {0x401bd, 0x401bf}, - {0x40233, 0x40239}, {0x4024f, 0x40293}, {0x40295, 0x402af}, {0x4037b, 0x4037d}, - {0x403ac, 0x403ce}, {0x403d5, 0x403d7}, {0x403ef, 0x403f3}, {0x40430, 0x4045f}, - {0x40561, 0x40587}, {0x413f8, 0x413fd}, {0x41c80, 0x41c88}, {0x41d00, 0x41d2b}, - {0x41d6b, 0x41d77}, {0x41d79, 0x41d9a}, {0x41e95, 0x41e9d}, {0x41eff, 0x41f07}, - {0x41f10, 0x41f15}, {0x41f20, 0x41f27}, {0x41f30, 0x41f37}, {0x41f40, 0x41f45}, - {0x41f50, 0x41f57}, {0x41f60, 0x41f67}, {0x41f70, 0x41f7d}, {0x41f80, 0x41f87}, - {0x41f90, 0x41f97}, {0x41fa0, 0x41fa7}, {0x41fb0, 0x41fb4}, {0x41fc2, 0x41fc4}, - {0x41fd0, 0x41fd3}, {0x41fe0, 0x41fe7}, {0x41ff2, 0x41ff4}, {0x42146, 0x42149}, - {0x42c30, 0x42c5e}, {0x42c76, 0x42c7b}, {0x42d00, 0x42d25}, {0x4a72f, 0x4a731}, - {0x4a771, 0x4a778}, {0x4a793, 0x4a795}, {0x4ab30, 0x4ab5a}, {0x4ab60, 0x4ab65}, - {0x4ab70, 0x4abbf}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4ff41, 0x4ff5a}, - {0x50061, 0x5007a}, {0x500df, 0x500f6}, {0x500f8, 0x500ff}, {0x5017e, 0x50180}, - {0x50199, 0x5019b}, {0x501bd, 0x501bf}, {0x50233, 0x50239}, {0x5024f, 0x50293}, - {0x50295, 0x502af}, {0x5037b, 0x5037d}, {0x503ac, 0x503ce}, {0x503d5, 0x503d7}, - {0x503ef, 0x503f3}, {0x50430, 0x5045f}, {0x50561, 0x50587}, {0x513f8, 0x513fd}, - {0x51c80, 0x51c88}, {0x51d00, 0x51d2b}, {0x51d6b, 0x51d77}, {0x51d79, 0x51d9a}, - {0x51e95, 0x51e9d}, {0x51eff, 0x51f07}, {0x51f10, 0x51f15}, {0x51f20, 0x51f27}, - {0x51f30, 0x51f37}, {0x51f40, 0x51f45}, {0x51f50, 0x51f57}, {0x51f60, 0x51f67}, - {0x51f70, 0x51f7d}, {0x51f80, 0x51f87}, {0x51f90, 0x51f97}, {0x51fa0, 0x51fa7}, - {0x51fb0, 0x51fb4}, {0x51fc2, 0x51fc4}, {0x51fd0, 0x51fd3}, {0x51fe0, 0x51fe7}, - {0x51ff2, 0x51ff4}, {0x52146, 0x52149}, {0x52c30, 0x52c5e}, {0x52c76, 0x52c7b}, - {0x52d00, 0x52d25}, {0x5a72f, 0x5a731}, {0x5a771, 0x5a778}, {0x5a793, 0x5a795}, - {0x5ab30, 0x5ab5a}, {0x5ab60, 0x5ab65}, {0x5ab70, 0x5abbf}, {0x5fb00, 0x5fb06}, - {0x5fb13, 0x5fb17}, {0x5ff41, 0x5ff5a}, {0x60061, 0x6007a}, {0x600df, 0x600f6}, - {0x600f8, 0x600ff}, {0x6017e, 0x60180}, {0x60199, 0x6019b}, {0x601bd, 0x601bf}, - {0x60233, 0x60239}, {0x6024f, 0x60293}, {0x60295, 0x602af}, {0x6037b, 0x6037d}, - {0x603ac, 0x603ce}, {0x603d5, 0x603d7}, {0x603ef, 0x603f3}, {0x60430, 0x6045f}, - {0x60561, 0x60587}, {0x613f8, 0x613fd}, {0x61c80, 0x61c88}, {0x61d00, 0x61d2b}, - {0x61d6b, 0x61d77}, {0x61d79, 0x61d9a}, {0x61e95, 0x61e9d}, {0x61eff, 0x61f07}, - {0x61f10, 0x61f15}, {0x61f20, 0x61f27}, {0x61f30, 0x61f37}, {0x61f40, 0x61f45}, - {0x61f50, 0x61f57}, {0x61f60, 0x61f67}, {0x61f70, 0x61f7d}, {0x61f80, 0x61f87}, - {0x61f90, 0x61f97}, {0x61fa0, 0x61fa7}, {0x61fb0, 0x61fb4}, {0x61fc2, 0x61fc4}, - {0x61fd0, 0x61fd3}, {0x61fe0, 0x61fe7}, {0x61ff2, 0x61ff4}, {0x62146, 0x62149}, - {0x62c30, 0x62c5e}, {0x62c76, 0x62c7b}, {0x62d00, 0x62d25}, {0x6a72f, 0x6a731}, - {0x6a771, 0x6a778}, {0x6a793, 0x6a795}, {0x6ab30, 0x6ab5a}, {0x6ab60, 0x6ab65}, - {0x6ab70, 0x6abbf}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6ff41, 0x6ff5a}, - {0x70061, 0x7007a}, {0x700df, 0x700f6}, {0x700f8, 0x700ff}, {0x7017e, 0x70180}, - {0x70199, 0x7019b}, {0x701bd, 0x701bf}, {0x70233, 0x70239}, {0x7024f, 0x70293}, - {0x70295, 0x702af}, {0x7037b, 0x7037d}, {0x703ac, 0x703ce}, {0x703d5, 0x703d7}, - {0x703ef, 0x703f3}, {0x70430, 0x7045f}, {0x70561, 0x70587}, {0x713f8, 0x713fd}, - {0x71c80, 0x71c88}, {0x71d00, 0x71d2b}, {0x71d6b, 0x71d77}, {0x71d79, 0x71d9a}, - {0x71e95, 0x71e9d}, {0x71eff, 0x71f07}, {0x71f10, 0x71f15}, {0x71f20, 0x71f27}, - {0x71f30, 0x71f37}, {0x71f40, 0x71f45}, {0x71f50, 0x71f57}, {0x71f60, 0x71f67}, - {0x71f70, 0x71f7d}, {0x71f80, 0x71f87}, {0x71f90, 0x71f97}, {0x71fa0, 0x71fa7}, - {0x71fb0, 0x71fb4}, {0x71fc2, 0x71fc4}, {0x71fd0, 0x71fd3}, {0x71fe0, 0x71fe7}, - {0x71ff2, 0x71ff4}, {0x72146, 0x72149}, {0x72c30, 0x72c5e}, {0x72c76, 0x72c7b}, - {0x72d00, 0x72d25}, {0x7a72f, 0x7a731}, {0x7a771, 0x7a778}, {0x7a793, 0x7a795}, - {0x7ab30, 0x7ab5a}, {0x7ab60, 0x7ab65}, {0x7ab70, 0x7abbf}, {0x7fb00, 0x7fb06}, - {0x7fb13, 0x7fb17}, {0x7ff41, 0x7ff5a}, {0x80061, 0x8007a}, {0x800df, 0x800f6}, - {0x800f8, 0x800ff}, {0x8017e, 0x80180}, {0x80199, 0x8019b}, {0x801bd, 0x801bf}, - {0x80233, 0x80239}, {0x8024f, 0x80293}, {0x80295, 0x802af}, {0x8037b, 0x8037d}, - {0x803ac, 0x803ce}, {0x803d5, 0x803d7}, {0x803ef, 0x803f3}, {0x80430, 0x8045f}, - {0x80561, 0x80587}, {0x813f8, 0x813fd}, {0x81c80, 0x81c88}, {0x81d00, 0x81d2b}, - {0x81d6b, 0x81d77}, {0x81d79, 0x81d9a}, {0x81e95, 0x81e9d}, {0x81eff, 0x81f07}, - {0x81f10, 0x81f15}, {0x81f20, 0x81f27}, {0x81f30, 0x81f37}, {0x81f40, 0x81f45}, - {0x81f50, 0x81f57}, {0x81f60, 0x81f67}, {0x81f70, 0x81f7d}, {0x81f80, 0x81f87}, - {0x81f90, 0x81f97}, {0x81fa0, 0x81fa7}, {0x81fb0, 0x81fb4}, {0x81fc2, 0x81fc4}, - {0x81fd0, 0x81fd3}, {0x81fe0, 0x81fe7}, {0x81ff2, 0x81ff4}, {0x82146, 0x82149}, - {0x82c30, 0x82c5e}, {0x82c76, 0x82c7b}, {0x82d00, 0x82d25}, {0x8a72f, 0x8a731}, - {0x8a771, 0x8a778}, {0x8a793, 0x8a795}, {0x8ab30, 0x8ab5a}, {0x8ab60, 0x8ab65}, - {0x8ab70, 0x8abbf}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8ff41, 0x8ff5a}, - {0x90061, 0x9007a}, {0x900df, 0x900f6}, {0x900f8, 0x900ff}, {0x9017e, 0x90180}, - {0x90199, 0x9019b}, {0x901bd, 0x901bf}, {0x90233, 0x90239}, {0x9024f, 0x90293}, - {0x90295, 0x902af}, {0x9037b, 0x9037d}, {0x903ac, 0x903ce}, {0x903d5, 0x903d7}, - {0x903ef, 0x903f3}, {0x90430, 0x9045f}, {0x90561, 0x90587}, {0x913f8, 0x913fd}, - {0x91c80, 0x91c88}, {0x91d00, 0x91d2b}, {0x91d6b, 0x91d77}, {0x91d79, 0x91d9a}, - {0x91e95, 0x91e9d}, {0x91eff, 0x91f07}, {0x91f10, 0x91f15}, {0x91f20, 0x91f27}, - {0x91f30, 0x91f37}, {0x91f40, 0x91f45}, {0x91f50, 0x91f57}, {0x91f60, 0x91f67}, - {0x91f70, 0x91f7d}, {0x91f80, 0x91f87}, {0x91f90, 0x91f97}, {0x91fa0, 0x91fa7}, - {0x91fb0, 0x91fb4}, {0x91fc2, 0x91fc4}, {0x91fd0, 0x91fd3}, {0x91fe0, 0x91fe7}, - {0x91ff2, 0x91ff4}, {0x92146, 0x92149}, {0x92c30, 0x92c5e}, {0x92c76, 0x92c7b}, - {0x92d00, 0x92d25}, {0x9a72f, 0x9a731}, {0x9a771, 0x9a778}, {0x9a793, 0x9a795}, - {0x9ab30, 0x9ab5a}, {0x9ab60, 0x9ab65}, {0x9ab70, 0x9abbf}, {0x9fb00, 0x9fb06}, - {0x9fb13, 0x9fb17}, {0x9ff41, 0x9ff5a}, {0xa0061, 0xa007a}, {0xa00df, 0xa00f6}, - {0xa00f8, 0xa00ff}, {0xa017e, 0xa0180}, {0xa0199, 0xa019b}, {0xa01bd, 0xa01bf}, - {0xa0233, 0xa0239}, {0xa024f, 0xa0293}, {0xa0295, 0xa02af}, {0xa037b, 0xa037d}, - {0xa03ac, 0xa03ce}, {0xa03d5, 0xa03d7}, {0xa03ef, 0xa03f3}, {0xa0430, 0xa045f}, - {0xa0561, 0xa0587}, {0xa13f8, 0xa13fd}, {0xa1c80, 0xa1c88}, {0xa1d00, 0xa1d2b}, - {0xa1d6b, 0xa1d77}, {0xa1d79, 0xa1d9a}, {0xa1e95, 0xa1e9d}, {0xa1eff, 0xa1f07}, - {0xa1f10, 0xa1f15}, {0xa1f20, 0xa1f27}, {0xa1f30, 0xa1f37}, {0xa1f40, 0xa1f45}, - {0xa1f50, 0xa1f57}, {0xa1f60, 0xa1f67}, {0xa1f70, 0xa1f7d}, {0xa1f80, 0xa1f87}, - {0xa1f90, 0xa1f97}, {0xa1fa0, 0xa1fa7}, {0xa1fb0, 0xa1fb4}, {0xa1fc2, 0xa1fc4}, - {0xa1fd0, 0xa1fd3}, {0xa1fe0, 0xa1fe7}, {0xa1ff2, 0xa1ff4}, {0xa2146, 0xa2149}, - {0xa2c30, 0xa2c5e}, {0xa2c76, 0xa2c7b}, {0xa2d00, 0xa2d25}, {0xaa72f, 0xaa731}, - {0xaa771, 0xaa778}, {0xaa793, 0xaa795}, {0xaab30, 0xaab5a}, {0xaab60, 0xaab65}, - {0xaab70, 0xaabbf}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xaff41, 0xaff5a}, - {0xb0061, 0xb007a}, {0xb00df, 0xb00f6}, {0xb00f8, 0xb00ff}, {0xb017e, 0xb0180}, - {0xb0199, 0xb019b}, {0xb01bd, 0xb01bf}, {0xb0233, 0xb0239}, {0xb024f, 0xb0293}, - {0xb0295, 0xb02af}, {0xb037b, 0xb037d}, {0xb03ac, 0xb03ce}, {0xb03d5, 0xb03d7}, - {0xb03ef, 0xb03f3}, {0xb0430, 0xb045f}, {0xb0561, 0xb0587}, {0xb13f8, 0xb13fd}, - {0xb1c80, 0xb1c88}, {0xb1d00, 0xb1d2b}, {0xb1d6b, 0xb1d77}, {0xb1d79, 0xb1d9a}, - {0xb1e95, 0xb1e9d}, {0xb1eff, 0xb1f07}, {0xb1f10, 0xb1f15}, {0xb1f20, 0xb1f27}, - {0xb1f30, 0xb1f37}, {0xb1f40, 0xb1f45}, {0xb1f50, 0xb1f57}, {0xb1f60, 0xb1f67}, - {0xb1f70, 0xb1f7d}, {0xb1f80, 0xb1f87}, {0xb1f90, 0xb1f97}, {0xb1fa0, 0xb1fa7}, - {0xb1fb0, 0xb1fb4}, {0xb1fc2, 0xb1fc4}, {0xb1fd0, 0xb1fd3}, {0xb1fe0, 0xb1fe7}, - {0xb1ff2, 0xb1ff4}, {0xb2146, 0xb2149}, {0xb2c30, 0xb2c5e}, {0xb2c76, 0xb2c7b}, - {0xb2d00, 0xb2d25}, {0xba72f, 0xba731}, {0xba771, 0xba778}, {0xba793, 0xba795}, - {0xbab30, 0xbab5a}, {0xbab60, 0xbab65}, {0xbab70, 0xbabbf}, {0xbfb00, 0xbfb06}, - {0xbfb13, 0xbfb17}, {0xbff41, 0xbff5a}, {0xc0061, 0xc007a}, {0xc00df, 0xc00f6}, - {0xc00f8, 0xc00ff}, {0xc017e, 0xc0180}, {0xc0199, 0xc019b}, {0xc01bd, 0xc01bf}, - {0xc0233, 0xc0239}, {0xc024f, 0xc0293}, {0xc0295, 0xc02af}, {0xc037b, 0xc037d}, - {0xc03ac, 0xc03ce}, {0xc03d5, 0xc03d7}, {0xc03ef, 0xc03f3}, {0xc0430, 0xc045f}, - {0xc0561, 0xc0587}, {0xc13f8, 0xc13fd}, {0xc1c80, 0xc1c88}, {0xc1d00, 0xc1d2b}, - {0xc1d6b, 0xc1d77}, {0xc1d79, 0xc1d9a}, {0xc1e95, 0xc1e9d}, {0xc1eff, 0xc1f07}, - {0xc1f10, 0xc1f15}, {0xc1f20, 0xc1f27}, {0xc1f30, 0xc1f37}, {0xc1f40, 0xc1f45}, - {0xc1f50, 0xc1f57}, {0xc1f60, 0xc1f67}, {0xc1f70, 0xc1f7d}, {0xc1f80, 0xc1f87}, - {0xc1f90, 0xc1f97}, {0xc1fa0, 0xc1fa7}, {0xc1fb0, 0xc1fb4}, {0xc1fc2, 0xc1fc4}, - {0xc1fd0, 0xc1fd3}, {0xc1fe0, 0xc1fe7}, {0xc1ff2, 0xc1ff4}, {0xc2146, 0xc2149}, - {0xc2c30, 0xc2c5e}, {0xc2c76, 0xc2c7b}, {0xc2d00, 0xc2d25}, {0xca72f, 0xca731}, - {0xca771, 0xca778}, {0xca793, 0xca795}, {0xcab30, 0xcab5a}, {0xcab60, 0xcab65}, - {0xcab70, 0xcabbf}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcff41, 0xcff5a}, - {0xd0061, 0xd007a}, {0xd00df, 0xd00f6}, {0xd00f8, 0xd00ff}, {0xd017e, 0xd0180}, - {0xd0199, 0xd019b}, {0xd01bd, 0xd01bf}, {0xd0233, 0xd0239}, {0xd024f, 0xd0293}, - {0xd0295, 0xd02af}, {0xd037b, 0xd037d}, {0xd03ac, 0xd03ce}, {0xd03d5, 0xd03d7}, - {0xd03ef, 0xd03f3}, {0xd0430, 0xd045f}, {0xd0561, 0xd0587}, {0xd13f8, 0xd13fd}, - {0xd1c80, 0xd1c88}, {0xd1d00, 0xd1d2b}, {0xd1d6b, 0xd1d77}, {0xd1d79, 0xd1d9a}, - {0xd1e95, 0xd1e9d}, {0xd1eff, 0xd1f07}, {0xd1f10, 0xd1f15}, {0xd1f20, 0xd1f27}, - {0xd1f30, 0xd1f37}, {0xd1f40, 0xd1f45}, {0xd1f50, 0xd1f57}, {0xd1f60, 0xd1f67}, - {0xd1f70, 0xd1f7d}, {0xd1f80, 0xd1f87}, {0xd1f90, 0xd1f97}, {0xd1fa0, 0xd1fa7}, - {0xd1fb0, 0xd1fb4}, {0xd1fc2, 0xd1fc4}, {0xd1fd0, 0xd1fd3}, {0xd1fe0, 0xd1fe7}, - {0xd1ff2, 0xd1ff4}, {0xd2146, 0xd2149}, {0xd2c30, 0xd2c5e}, {0xd2c76, 0xd2c7b}, - {0xd2d00, 0xd2d25}, {0xda72f, 0xda731}, {0xda771, 0xda778}, {0xda793, 0xda795}, - {0xdab30, 0xdab5a}, {0xdab60, 0xdab65}, {0xdab70, 0xdabbf}, {0xdfb00, 0xdfb06}, - {0xdfb13, 0xdfb17}, {0xdff41, 0xdff5a}, {0xe0061, 0xe007a}, {0xe00df, 0xe00f6}, - {0xe00f8, 0xe00ff}, {0xe017e, 0xe0180}, {0xe0199, 0xe019b}, {0xe01bd, 0xe01bf}, - {0xe0233, 0xe0239}, {0xe024f, 0xe0293}, {0xe0295, 0xe02af}, {0xe037b, 0xe037d}, - {0xe03ac, 0xe03ce}, {0xe03d5, 0xe03d7}, {0xe03ef, 0xe03f3}, {0xe0430, 0xe045f}, - {0xe0561, 0xe0587}, {0xe13f8, 0xe13fd}, {0xe1c80, 0xe1c88}, {0xe1d00, 0xe1d2b}, - {0xe1d6b, 0xe1d77}, {0xe1d79, 0xe1d9a}, {0xe1e95, 0xe1e9d}, {0xe1eff, 0xe1f07}, - {0xe1f10, 0xe1f15}, {0xe1f20, 0xe1f27}, {0xe1f30, 0xe1f37}, {0xe1f40, 0xe1f45}, - {0xe1f50, 0xe1f57}, {0xe1f60, 0xe1f67}, {0xe1f70, 0xe1f7d}, {0xe1f80, 0xe1f87}, - {0xe1f90, 0xe1f97}, {0xe1fa0, 0xe1fa7}, {0xe1fb0, 0xe1fb4}, {0xe1fc2, 0xe1fc4}, - {0xe1fd0, 0xe1fd3}, {0xe1fe0, 0xe1fe7}, {0xe1ff2, 0xe1ff4}, {0xe2146, 0xe2149}, - {0xe2c30, 0xe2c5e}, {0xe2c76, 0xe2c7b}, {0xe2d00, 0xe2d25}, {0xea72f, 0xea731}, - {0xea771, 0xea778}, {0xea793, 0xea795}, {0xeab30, 0xeab5a}, {0xeab60, 0xeab65}, - {0xeab70, 0xeabbf}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xeff41, 0xeff5a}, - {0xf0061, 0xf007a}, {0xf00df, 0xf00f6}, {0xf00f8, 0xf00ff}, {0xf017e, 0xf0180}, - {0xf0199, 0xf019b}, {0xf01bd, 0xf01bf}, {0xf0233, 0xf0239}, {0xf024f, 0xf0293}, - {0xf0295, 0xf02af}, {0xf037b, 0xf037d}, {0xf03ac, 0xf03ce}, {0xf03d5, 0xf03d7}, - {0xf03ef, 0xf03f3}, {0xf0430, 0xf045f}, {0xf0561, 0xf0587}, {0xf13f8, 0xf13fd}, - {0xf1c80, 0xf1c88}, {0xf1d00, 0xf1d2b}, {0xf1d6b, 0xf1d77}, {0xf1d79, 0xf1d9a}, - {0xf1e95, 0xf1e9d}, {0xf1eff, 0xf1f07}, {0xf1f10, 0xf1f15}, {0xf1f20, 0xf1f27}, - {0xf1f30, 0xf1f37}, {0xf1f40, 0xf1f45}, {0xf1f50, 0xf1f57}, {0xf1f60, 0xf1f67}, - {0xf1f70, 0xf1f7d}, {0xf1f80, 0xf1f87}, {0xf1f90, 0xf1f97}, {0xf1fa0, 0xf1fa7}, - {0xf1fb0, 0xf1fb4}, {0xf1fc2, 0xf1fc4}, {0xf1fd0, 0xf1fd3}, {0xf1fe0, 0xf1fe7}, - {0xf1ff2, 0xf1ff4}, {0xf2146, 0xf2149}, {0xf2c30, 0xf2c5e}, {0xf2c76, 0xf2c7b}, - {0xf2d00, 0xf2d25}, {0xfa72f, 0xfa731}, {0xfa771, 0xfa778}, {0xfa793, 0xfa795}, - {0xfab30, 0xfab5a}, {0xfab60, 0xfab65}, {0xfab70, 0xfabbf}, {0xffb00, 0xffb06}, - {0xffb13, 0xffb17}, {0xfff41, 0xfff5a}, {0x100061, 0x10007a}, {0x1000df, 0x1000f6}, - {0x1000f8, 0x1000ff}, {0x10017e, 0x100180}, {0x100199, 0x10019b}, {0x1001bd, 0x1001bf}, - {0x100233, 0x100239}, {0x10024f, 0x100293}, {0x100295, 0x1002af}, {0x10037b, 0x10037d}, - {0x1003ac, 0x1003ce}, {0x1003d5, 0x1003d7}, {0x1003ef, 0x1003f3}, {0x100430, 0x10045f}, - {0x100561, 0x100587}, {0x1013f8, 0x1013fd}, {0x101c80, 0x101c88}, {0x101d00, 0x101d2b}, - {0x101d6b, 0x101d77}, {0x101d79, 0x101d9a}, {0x101e95, 0x101e9d}, {0x101eff, 0x101f07}, - {0x101f10, 0x101f15}, {0x101f20, 0x101f27}, {0x101f30, 0x101f37}, {0x101f40, 0x101f45}, - {0x101f50, 0x101f57}, {0x101f60, 0x101f67}, {0x101f70, 0x101f7d}, {0x101f80, 0x101f87}, - {0x101f90, 0x101f97}, {0x101fa0, 0x101fa7}, {0x101fb0, 0x101fb4}, {0x101fc2, 0x101fc4}, - {0x101fd0, 0x101fd3}, {0x101fe0, 0x101fe7}, {0x101ff2, 0x101ff4}, {0x102146, 0x102149}, - {0x102c30, 0x102c5e}, {0x102c76, 0x102c7b}, {0x102d00, 0x102d25}, {0x10a72f, 0x10a731}, - {0x10a771, 0x10a778}, {0x10a793, 0x10a795}, {0x10ab30, 0x10ab5a}, {0x10ab60, 0x10ab65}, - {0x10ab70, 0x10abbf}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10ff41, 0x10ff5a} + ,{0x10428, 0x1044f}, {0x104d8, 0x104fb}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df}, + {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, + {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, + {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, + {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, + {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, + {0x1d736, 0x1d74e}, {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, + {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x1e922, 0x1e943} #endif }; @@ -2591,1020 +503,7 @@ static const chr lowerCharTable[] = { 0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9, 0xa7b5, 0xa7b7, 0xa7fa #if TCL_UTF_MAX > 4 - ,0x100b5, 0x10101, 0x10103, 0x10105, 0x10107, 0x10109, 0x1010b, 0x1010d, 0x1010f, - 0x10111, 0x10113, 0x10115, 0x10117, 0x10119, 0x1011b, 0x1011d, 0x1011f, 0x10121, - 0x10123, 0x10125, 0x10127, 0x10129, 0x1012b, 0x1012d, 0x1012f, 0x10131, 0x10133, - 0x10135, 0x10137, 0x10138, 0x1013a, 0x1013c, 0x1013e, 0x10140, 0x10142, 0x10144, - 0x10146, 0x10148, 0x10149, 0x1014b, 0x1014d, 0x1014f, 0x10151, 0x10153, 0x10155, - 0x10157, 0x10159, 0x1015b, 0x1015d, 0x1015f, 0x10161, 0x10163, 0x10165, 0x10167, - 0x10169, 0x1016b, 0x1016d, 0x1016f, 0x10171, 0x10173, 0x10175, 0x10177, 0x1017a, - 0x1017c, 0x10183, 0x10185, 0x10188, 0x1018c, 0x1018d, 0x10192, 0x10195, 0x1019e, - 0x101a1, 0x101a3, 0x101a5, 0x101a8, 0x101aa, 0x101ab, 0x101ad, 0x101b0, 0x101b4, - 0x101b6, 0x101b9, 0x101ba, 0x101c6, 0x101c9, 0x101cc, 0x101ce, 0x101d0, 0x101d2, - 0x101d4, 0x101d6, 0x101d8, 0x101da, 0x101dc, 0x101dd, 0x101df, 0x101e1, 0x101e3, - 0x101e5, 0x101e7, 0x101e9, 0x101eb, 0x101ed, 0x101ef, 0x101f0, 0x101f3, 0x101f5, - 0x101f9, 0x101fb, 0x101fd, 0x101ff, 0x10201, 0x10203, 0x10205, 0x10207, 0x10209, - 0x1020b, 0x1020d, 0x1020f, 0x10211, 0x10213, 0x10215, 0x10217, 0x10219, 0x1021b, - 0x1021d, 0x1021f, 0x10221, 0x10223, 0x10225, 0x10227, 0x10229, 0x1022b, 0x1022d, - 0x1022f, 0x10231, 0x1023c, 0x1023f, 0x10240, 0x10242, 0x10247, 0x10249, 0x1024b, - 0x1024d, 0x10371, 0x10373, 0x10377, 0x10390, 0x103d0, 0x103d1, 0x103d9, 0x103db, - 0x103dd, 0x103df, 0x103e1, 0x103e3, 0x103e5, 0x103e7, 0x103e9, 0x103eb, 0x103ed, - 0x103f5, 0x103f8, 0x103fb, 0x103fc, 0x10461, 0x10463, 0x10465, 0x10467, 0x10469, - 0x1046b, 0x1046d, 0x1046f, 0x10471, 0x10473, 0x10475, 0x10477, 0x10479, 0x1047b, - 0x1047d, 0x1047f, 0x10481, 0x1048b, 0x1048d, 0x1048f, 0x10491, 0x10493, 0x10495, - 0x10497, 0x10499, 0x1049b, 0x1049d, 0x1049f, 0x104a1, 0x104a3, 0x104a5, 0x104a7, - 0x104a9, 0x104ab, 0x104ad, 0x104af, 0x104b1, 0x104b3, 0x104b5, 0x104b7, 0x104b9, - 0x104bb, 0x104bd, 0x104bf, 0x104c2, 0x104c4, 0x104c6, 0x104c8, 0x104ca, 0x104cc, - 0x104ce, 0x104cf, 0x104d1, 0x104d3, 0x104d5, 0x104d7, 0x104d9, 0x104db, 0x104dd, - 0x104df, 0x104e1, 0x104e3, 0x104e5, 0x104e7, 0x104e9, 0x104eb, 0x104ed, 0x104ef, - 0x104f1, 0x104f3, 0x104f5, 0x104f7, 0x104f9, 0x104fb, 0x104fd, 0x104ff, 0x10501, - 0x10503, 0x10505, 0x10507, 0x10509, 0x1050b, 0x1050d, 0x1050f, 0x10511, 0x10513, - 0x10515, 0x10517, 0x10519, 0x1051b, 0x1051d, 0x1051f, 0x10521, 0x10523, 0x10525, - 0x10527, 0x10529, 0x1052b, 0x1052d, 0x1052f, 0x11e01, 0x11e03, 0x11e05, 0x11e07, - 0x11e09, 0x11e0b, 0x11e0d, 0x11e0f, 0x11e11, 0x11e13, 0x11e15, 0x11e17, 0x11e19, - 0x11e1b, 0x11e1d, 0x11e1f, 0x11e21, 0x11e23, 0x11e25, 0x11e27, 0x11e29, 0x11e2b, - 0x11e2d, 0x11e2f, 0x11e31, 0x11e33, 0x11e35, 0x11e37, 0x11e39, 0x11e3b, 0x11e3d, - 0x11e3f, 0x11e41, 0x11e43, 0x11e45, 0x11e47, 0x11e49, 0x11e4b, 0x11e4d, 0x11e4f, - 0x11e51, 0x11e53, 0x11e55, 0x11e57, 0x11e59, 0x11e5b, 0x11e5d, 0x11e5f, 0x11e61, - 0x11e63, 0x11e65, 0x11e67, 0x11e69, 0x11e6b, 0x11e6d, 0x11e6f, 0x11e71, 0x11e73, - 0x11e75, 0x11e77, 0x11e79, 0x11e7b, 0x11e7d, 0x11e7f, 0x11e81, 0x11e83, 0x11e85, - 0x11e87, 0x11e89, 0x11e8b, 0x11e8d, 0x11e8f, 0x11e91, 0x11e93, 0x11e9f, 0x11ea1, - 0x11ea3, 0x11ea5, 0x11ea7, 0x11ea9, 0x11eab, 0x11ead, 0x11eaf, 0x11eb1, 0x11eb3, - 0x11eb5, 0x11eb7, 0x11eb9, 0x11ebb, 0x11ebd, 0x11ebf, 0x11ec1, 0x11ec3, 0x11ec5, - 0x11ec7, 0x11ec9, 0x11ecb, 0x11ecd, 0x11ecf, 0x11ed1, 0x11ed3, 0x11ed5, 0x11ed7, - 0x11ed9, 0x11edb, 0x11edd, 0x11edf, 0x11ee1, 0x11ee3, 0x11ee5, 0x11ee7, 0x11ee9, - 0x11eeb, 0x11eed, 0x11eef, 0x11ef1, 0x11ef3, 0x11ef5, 0x11ef7, 0x11ef9, 0x11efb, - 0x11efd, 0x11fb6, 0x11fb7, 0x11fbe, 0x11fc6, 0x11fc7, 0x11fd6, 0x11fd7, 0x11ff6, - 0x11ff7, 0x1210a, 0x1210e, 0x1210f, 0x12113, 0x1212f, 0x12134, 0x12139, 0x1213c, - 0x1213d, 0x1214e, 0x12184, 0x12c61, 0x12c65, 0x12c66, 0x12c68, 0x12c6a, 0x12c6c, - 0x12c71, 0x12c73, 0x12c74, 0x12c81, 0x12c83, 0x12c85, 0x12c87, 0x12c89, 0x12c8b, - 0x12c8d, 0x12c8f, 0x12c91, 0x12c93, 0x12c95, 0x12c97, 0x12c99, 0x12c9b, 0x12c9d, - 0x12c9f, 0x12ca1, 0x12ca3, 0x12ca5, 0x12ca7, 0x12ca9, 0x12cab, 0x12cad, 0x12caf, - 0x12cb1, 0x12cb3, 0x12cb5, 0x12cb7, 0x12cb9, 0x12cbb, 0x12cbd, 0x12cbf, 0x12cc1, - 0x12cc3, 0x12cc5, 0x12cc7, 0x12cc9, 0x12ccb, 0x12ccd, 0x12ccf, 0x12cd1, 0x12cd3, - 0x12cd5, 0x12cd7, 0x12cd9, 0x12cdb, 0x12cdd, 0x12cdf, 0x12ce1, 0x12ce3, 0x12ce4, - 0x12cec, 0x12cee, 0x12cf3, 0x12d27, 0x12d2d, 0x1a641, 0x1a643, 0x1a645, 0x1a647, - 0x1a649, 0x1a64b, 0x1a64d, 0x1a64f, 0x1a651, 0x1a653, 0x1a655, 0x1a657, 0x1a659, - 0x1a65b, 0x1a65d, 0x1a65f, 0x1a661, 0x1a663, 0x1a665, 0x1a667, 0x1a669, 0x1a66b, - 0x1a66d, 0x1a681, 0x1a683, 0x1a685, 0x1a687, 0x1a689, 0x1a68b, 0x1a68d, 0x1a68f, - 0x1a691, 0x1a693, 0x1a695, 0x1a697, 0x1a699, 0x1a69b, 0x1a723, 0x1a725, 0x1a727, - 0x1a729, 0x1a72b, 0x1a72d, 0x1a733, 0x1a735, 0x1a737, 0x1a739, 0x1a73b, 0x1a73d, - 0x1a73f, 0x1a741, 0x1a743, 0x1a745, 0x1a747, 0x1a749, 0x1a74b, 0x1a74d, 0x1a74f, - 0x1a751, 0x1a753, 0x1a755, 0x1a757, 0x1a759, 0x1a75b, 0x1a75d, 0x1a75f, 0x1a761, - 0x1a763, 0x1a765, 0x1a767, 0x1a769, 0x1a76b, 0x1a76d, 0x1a76f, 0x1a77a, 0x1a77c, - 0x1a77f, 0x1a781, 0x1a783, 0x1a785, 0x1a787, 0x1a78c, 0x1a78e, 0x1a791, 0x1a797, - 0x1a799, 0x1a79b, 0x1a79d, 0x1a79f, 0x1a7a1, 0x1a7a3, 0x1a7a5, 0x1a7a7, 0x1a7a9, - 0x1a7b5, 0x1a7b7, 0x1a7fa, 0x200b5, 0x20101, 0x20103, 0x20105, 0x20107, 0x20109, - 0x2010b, 0x2010d, 0x2010f, 0x20111, 0x20113, 0x20115, 0x20117, 0x20119, 0x2011b, - 0x2011d, 0x2011f, 0x20121, 0x20123, 0x20125, 0x20127, 0x20129, 0x2012b, 0x2012d, - 0x2012f, 0x20131, 0x20133, 0x20135, 0x20137, 0x20138, 0x2013a, 0x2013c, 0x2013e, - 0x20140, 0x20142, 0x20144, 0x20146, 0x20148, 0x20149, 0x2014b, 0x2014d, 0x2014f, - 0x20151, 0x20153, 0x20155, 0x20157, 0x20159, 0x2015b, 0x2015d, 0x2015f, 0x20161, - 0x20163, 0x20165, 0x20167, 0x20169, 0x2016b, 0x2016d, 0x2016f, 0x20171, 0x20173, - 0x20175, 0x20177, 0x2017a, 0x2017c, 0x20183, 0x20185, 0x20188, 0x2018c, 0x2018d, - 0x20192, 0x20195, 0x2019e, 0x201a1, 0x201a3, 0x201a5, 0x201a8, 0x201aa, 0x201ab, - 0x201ad, 0x201b0, 0x201b4, 0x201b6, 0x201b9, 0x201ba, 0x201c6, 0x201c9, 0x201cc, - 0x201ce, 0x201d0, 0x201d2, 0x201d4, 0x201d6, 0x201d8, 0x201da, 0x201dc, 0x201dd, - 0x201df, 0x201e1, 0x201e3, 0x201e5, 0x201e7, 0x201e9, 0x201eb, 0x201ed, 0x201ef, - 0x201f0, 0x201f3, 0x201f5, 0x201f9, 0x201fb, 0x201fd, 0x201ff, 0x20201, 0x20203, - 0x20205, 0x20207, 0x20209, 0x2020b, 0x2020d, 0x2020f, 0x20211, 0x20213, 0x20215, - 0x20217, 0x20219, 0x2021b, 0x2021d, 0x2021f, 0x20221, 0x20223, 0x20225, 0x20227, - 0x20229, 0x2022b, 0x2022d, 0x2022f, 0x20231, 0x2023c, 0x2023f, 0x20240, 0x20242, - 0x20247, 0x20249, 0x2024b, 0x2024d, 0x20371, 0x20373, 0x20377, 0x20390, 0x203d0, - 0x203d1, 0x203d9, 0x203db, 0x203dd, 0x203df, 0x203e1, 0x203e3, 0x203e5, 0x203e7, - 0x203e9, 0x203eb, 0x203ed, 0x203f5, 0x203f8, 0x203fb, 0x203fc, 0x20461, 0x20463, - 0x20465, 0x20467, 0x20469, 0x2046b, 0x2046d, 0x2046f, 0x20471, 0x20473, 0x20475, - 0x20477, 0x20479, 0x2047b, 0x2047d, 0x2047f, 0x20481, 0x2048b, 0x2048d, 0x2048f, - 0x20491, 0x20493, 0x20495, 0x20497, 0x20499, 0x2049b, 0x2049d, 0x2049f, 0x204a1, - 0x204a3, 0x204a5, 0x204a7, 0x204a9, 0x204ab, 0x204ad, 0x204af, 0x204b1, 0x204b3, - 0x204b5, 0x204b7, 0x204b9, 0x204bb, 0x204bd, 0x204bf, 0x204c2, 0x204c4, 0x204c6, - 0x204c8, 0x204ca, 0x204cc, 0x204ce, 0x204cf, 0x204d1, 0x204d3, 0x204d5, 0x204d7, - 0x204d9, 0x204db, 0x204dd, 0x204df, 0x204e1, 0x204e3, 0x204e5, 0x204e7, 0x204e9, - 0x204eb, 0x204ed, 0x204ef, 0x204f1, 0x204f3, 0x204f5, 0x204f7, 0x204f9, 0x204fb, - 0x204fd, 0x204ff, 0x20501, 0x20503, 0x20505, 0x20507, 0x20509, 0x2050b, 0x2050d, - 0x2050f, 0x20511, 0x20513, 0x20515, 0x20517, 0x20519, 0x2051b, 0x2051d, 0x2051f, - 0x20521, 0x20523, 0x20525, 0x20527, 0x20529, 0x2052b, 0x2052d, 0x2052f, 0x21e01, - 0x21e03, 0x21e05, 0x21e07, 0x21e09, 0x21e0b, 0x21e0d, 0x21e0f, 0x21e11, 0x21e13, - 0x21e15, 0x21e17, 0x21e19, 0x21e1b, 0x21e1d, 0x21e1f, 0x21e21, 0x21e23, 0x21e25, - 0x21e27, 0x21e29, 0x21e2b, 0x21e2d, 0x21e2f, 0x21e31, 0x21e33, 0x21e35, 0x21e37, - 0x21e39, 0x21e3b, 0x21e3d, 0x21e3f, 0x21e41, 0x21e43, 0x21e45, 0x21e47, 0x21e49, - 0x21e4b, 0x21e4d, 0x21e4f, 0x21e51, 0x21e53, 0x21e55, 0x21e57, 0x21e59, 0x21e5b, - 0x21e5d, 0x21e5f, 0x21e61, 0x21e63, 0x21e65, 0x21e67, 0x21e69, 0x21e6b, 0x21e6d, - 0x21e6f, 0x21e71, 0x21e73, 0x21e75, 0x21e77, 0x21e79, 0x21e7b, 0x21e7d, 0x21e7f, - 0x21e81, 0x21e83, 0x21e85, 0x21e87, 0x21e89, 0x21e8b, 0x21e8d, 0x21e8f, 0x21e91, - 0x21e93, 0x21e9f, 0x21ea1, 0x21ea3, 0x21ea5, 0x21ea7, 0x21ea9, 0x21eab, 0x21ead, - 0x21eaf, 0x21eb1, 0x21eb3, 0x21eb5, 0x21eb7, 0x21eb9, 0x21ebb, 0x21ebd, 0x21ebf, - 0x21ec1, 0x21ec3, 0x21ec5, 0x21ec7, 0x21ec9, 0x21ecb, 0x21ecd, 0x21ecf, 0x21ed1, - 0x21ed3, 0x21ed5, 0x21ed7, 0x21ed9, 0x21edb, 0x21edd, 0x21edf, 0x21ee1, 0x21ee3, - 0x21ee5, 0x21ee7, 0x21ee9, 0x21eeb, 0x21eed, 0x21eef, 0x21ef1, 0x21ef3, 0x21ef5, - 0x21ef7, 0x21ef9, 0x21efb, 0x21efd, 0x21fb6, 0x21fb7, 0x21fbe, 0x21fc6, 0x21fc7, - 0x21fd6, 0x21fd7, 0x21ff6, 0x21ff7, 0x2210a, 0x2210e, 0x2210f, 0x22113, 0x2212f, - 0x22134, 0x22139, 0x2213c, 0x2213d, 0x2214e, 0x22184, 0x22c61, 0x22c65, 0x22c66, - 0x22c68, 0x22c6a, 0x22c6c, 0x22c71, 0x22c73, 0x22c74, 0x22c81, 0x22c83, 0x22c85, - 0x22c87, 0x22c89, 0x22c8b, 0x22c8d, 0x22c8f, 0x22c91, 0x22c93, 0x22c95, 0x22c97, - 0x22c99, 0x22c9b, 0x22c9d, 0x22c9f, 0x22ca1, 0x22ca3, 0x22ca5, 0x22ca7, 0x22ca9, - 0x22cab, 0x22cad, 0x22caf, 0x22cb1, 0x22cb3, 0x22cb5, 0x22cb7, 0x22cb9, 0x22cbb, - 0x22cbd, 0x22cbf, 0x22cc1, 0x22cc3, 0x22cc5, 0x22cc7, 0x22cc9, 0x22ccb, 0x22ccd, - 0x22ccf, 0x22cd1, 0x22cd3, 0x22cd5, 0x22cd7, 0x22cd9, 0x22cdb, 0x22cdd, 0x22cdf, - 0x22ce1, 0x22ce3, 0x22ce4, 0x22cec, 0x22cee, 0x22cf3, 0x22d27, 0x22d2d, 0x2a641, - 0x2a643, 0x2a645, 0x2a647, 0x2a649, 0x2a64b, 0x2a64d, 0x2a64f, 0x2a651, 0x2a653, - 0x2a655, 0x2a657, 0x2a659, 0x2a65b, 0x2a65d, 0x2a65f, 0x2a661, 0x2a663, 0x2a665, - 0x2a667, 0x2a669, 0x2a66b, 0x2a66d, 0x2a681, 0x2a683, 0x2a685, 0x2a687, 0x2a689, - 0x2a68b, 0x2a68d, 0x2a68f, 0x2a691, 0x2a693, 0x2a695, 0x2a697, 0x2a699, 0x2a69b, - 0x2a723, 0x2a725, 0x2a727, 0x2a729, 0x2a72b, 0x2a72d, 0x2a733, 0x2a735, 0x2a737, - 0x2a739, 0x2a73b, 0x2a73d, 0x2a73f, 0x2a741, 0x2a743, 0x2a745, 0x2a747, 0x2a749, - 0x2a74b, 0x2a74d, 0x2a74f, 0x2a751, 0x2a753, 0x2a755, 0x2a757, 0x2a759, 0x2a75b, - 0x2a75d, 0x2a75f, 0x2a761, 0x2a763, 0x2a765, 0x2a767, 0x2a769, 0x2a76b, 0x2a76d, - 0x2a76f, 0x2a77a, 0x2a77c, 0x2a77f, 0x2a781, 0x2a783, 0x2a785, 0x2a787, 0x2a78c, - 0x2a78e, 0x2a791, 0x2a797, 0x2a799, 0x2a79b, 0x2a79d, 0x2a79f, 0x2a7a1, 0x2a7a3, - 0x2a7a5, 0x2a7a7, 0x2a7a9, 0x2a7b5, 0x2a7b7, 0x2a7fa, 0x300b5, 0x30101, 0x30103, - 0x30105, 0x30107, 0x30109, 0x3010b, 0x3010d, 0x3010f, 0x30111, 0x30113, 0x30115, - 0x30117, 0x30119, 0x3011b, 0x3011d, 0x3011f, 0x30121, 0x30123, 0x30125, 0x30127, - 0x30129, 0x3012b, 0x3012d, 0x3012f, 0x30131, 0x30133, 0x30135, 0x30137, 0x30138, - 0x3013a, 0x3013c, 0x3013e, 0x30140, 0x30142, 0x30144, 0x30146, 0x30148, 0x30149, - 0x3014b, 0x3014d, 0x3014f, 0x30151, 0x30153, 0x30155, 0x30157, 0x30159, 0x3015b, - 0x3015d, 0x3015f, 0x30161, 0x30163, 0x30165, 0x30167, 0x30169, 0x3016b, 0x3016d, - 0x3016f, 0x30171, 0x30173, 0x30175, 0x30177, 0x3017a, 0x3017c, 0x30183, 0x30185, - 0x30188, 0x3018c, 0x3018d, 0x30192, 0x30195, 0x3019e, 0x301a1, 0x301a3, 0x301a5, - 0x301a8, 0x301aa, 0x301ab, 0x301ad, 0x301b0, 0x301b4, 0x301b6, 0x301b9, 0x301ba, - 0x301c6, 0x301c9, 0x301cc, 0x301ce, 0x301d0, 0x301d2, 0x301d4, 0x301d6, 0x301d8, - 0x301da, 0x301dc, 0x301dd, 0x301df, 0x301e1, 0x301e3, 0x301e5, 0x301e7, 0x301e9, - 0x301eb, 0x301ed, 0x301ef, 0x301f0, 0x301f3, 0x301f5, 0x301f9, 0x301fb, 0x301fd, - 0x301ff, 0x30201, 0x30203, 0x30205, 0x30207, 0x30209, 0x3020b, 0x3020d, 0x3020f, - 0x30211, 0x30213, 0x30215, 0x30217, 0x30219, 0x3021b, 0x3021d, 0x3021f, 0x30221, - 0x30223, 0x30225, 0x30227, 0x30229, 0x3022b, 0x3022d, 0x3022f, 0x30231, 0x3023c, - 0x3023f, 0x30240, 0x30242, 0x30247, 0x30249, 0x3024b, 0x3024d, 0x30371, 0x30373, - 0x30377, 0x30390, 0x303d0, 0x303d1, 0x303d9, 0x303db, 0x303dd, 0x303df, 0x303e1, - 0x303e3, 0x303e5, 0x303e7, 0x303e9, 0x303eb, 0x303ed, 0x303f5, 0x303f8, 0x303fb, - 0x303fc, 0x30461, 0x30463, 0x30465, 0x30467, 0x30469, 0x3046b, 0x3046d, 0x3046f, - 0x30471, 0x30473, 0x30475, 0x30477, 0x30479, 0x3047b, 0x3047d, 0x3047f, 0x30481, - 0x3048b, 0x3048d, 0x3048f, 0x30491, 0x30493, 0x30495, 0x30497, 0x30499, 0x3049b, - 0x3049d, 0x3049f, 0x304a1, 0x304a3, 0x304a5, 0x304a7, 0x304a9, 0x304ab, 0x304ad, - 0x304af, 0x304b1, 0x304b3, 0x304b5, 0x304b7, 0x304b9, 0x304bb, 0x304bd, 0x304bf, - 0x304c2, 0x304c4, 0x304c6, 0x304c8, 0x304ca, 0x304cc, 0x304ce, 0x304cf, 0x304d1, - 0x304d3, 0x304d5, 0x304d7, 0x304d9, 0x304db, 0x304dd, 0x304df, 0x304e1, 0x304e3, - 0x304e5, 0x304e7, 0x304e9, 0x304eb, 0x304ed, 0x304ef, 0x304f1, 0x304f3, 0x304f5, - 0x304f7, 0x304f9, 0x304fb, 0x304fd, 0x304ff, 0x30501, 0x30503, 0x30505, 0x30507, - 0x30509, 0x3050b, 0x3050d, 0x3050f, 0x30511, 0x30513, 0x30515, 0x30517, 0x30519, - 0x3051b, 0x3051d, 0x3051f, 0x30521, 0x30523, 0x30525, 0x30527, 0x30529, 0x3052b, - 0x3052d, 0x3052f, 0x31e01, 0x31e03, 0x31e05, 0x31e07, 0x31e09, 0x31e0b, 0x31e0d, - 0x31e0f, 0x31e11, 0x31e13, 0x31e15, 0x31e17, 0x31e19, 0x31e1b, 0x31e1d, 0x31e1f, - 0x31e21, 0x31e23, 0x31e25, 0x31e27, 0x31e29, 0x31e2b, 0x31e2d, 0x31e2f, 0x31e31, - 0x31e33, 0x31e35, 0x31e37, 0x31e39, 0x31e3b, 0x31e3d, 0x31e3f, 0x31e41, 0x31e43, - 0x31e45, 0x31e47, 0x31e49, 0x31e4b, 0x31e4d, 0x31e4f, 0x31e51, 0x31e53, 0x31e55, - 0x31e57, 0x31e59, 0x31e5b, 0x31e5d, 0x31e5f, 0x31e61, 0x31e63, 0x31e65, 0x31e67, - 0x31e69, 0x31e6b, 0x31e6d, 0x31e6f, 0x31e71, 0x31e73, 0x31e75, 0x31e77, 0x31e79, - 0x31e7b, 0x31e7d, 0x31e7f, 0x31e81, 0x31e83, 0x31e85, 0x31e87, 0x31e89, 0x31e8b, - 0x31e8d, 0x31e8f, 0x31e91, 0x31e93, 0x31e9f, 0x31ea1, 0x31ea3, 0x31ea5, 0x31ea7, - 0x31ea9, 0x31eab, 0x31ead, 0x31eaf, 0x31eb1, 0x31eb3, 0x31eb5, 0x31eb7, 0x31eb9, - 0x31ebb, 0x31ebd, 0x31ebf, 0x31ec1, 0x31ec3, 0x31ec5, 0x31ec7, 0x31ec9, 0x31ecb, - 0x31ecd, 0x31ecf, 0x31ed1, 0x31ed3, 0x31ed5, 0x31ed7, 0x31ed9, 0x31edb, 0x31edd, - 0x31edf, 0x31ee1, 0x31ee3, 0x31ee5, 0x31ee7, 0x31ee9, 0x31eeb, 0x31eed, 0x31eef, - 0x31ef1, 0x31ef3, 0x31ef5, 0x31ef7, 0x31ef9, 0x31efb, 0x31efd, 0x31fb6, 0x31fb7, - 0x31fbe, 0x31fc6, 0x31fc7, 0x31fd6, 0x31fd7, 0x31ff6, 0x31ff7, 0x3210a, 0x3210e, - 0x3210f, 0x32113, 0x3212f, 0x32134, 0x32139, 0x3213c, 0x3213d, 0x3214e, 0x32184, - 0x32c61, 0x32c65, 0x32c66, 0x32c68, 0x32c6a, 0x32c6c, 0x32c71, 0x32c73, 0x32c74, - 0x32c81, 0x32c83, 0x32c85, 0x32c87, 0x32c89, 0x32c8b, 0x32c8d, 0x32c8f, 0x32c91, - 0x32c93, 0x32c95, 0x32c97, 0x32c99, 0x32c9b, 0x32c9d, 0x32c9f, 0x32ca1, 0x32ca3, - 0x32ca5, 0x32ca7, 0x32ca9, 0x32cab, 0x32cad, 0x32caf, 0x32cb1, 0x32cb3, 0x32cb5, - 0x32cb7, 0x32cb9, 0x32cbb, 0x32cbd, 0x32cbf, 0x32cc1, 0x32cc3, 0x32cc5, 0x32cc7, - 0x32cc9, 0x32ccb, 0x32ccd, 0x32ccf, 0x32cd1, 0x32cd3, 0x32cd5, 0x32cd7, 0x32cd9, - 0x32cdb, 0x32cdd, 0x32cdf, 0x32ce1, 0x32ce3, 0x32ce4, 0x32cec, 0x32cee, 0x32cf3, - 0x32d27, 0x32d2d, 0x3a641, 0x3a643, 0x3a645, 0x3a647, 0x3a649, 0x3a64b, 0x3a64d, - 0x3a64f, 0x3a651, 0x3a653, 0x3a655, 0x3a657, 0x3a659, 0x3a65b, 0x3a65d, 0x3a65f, - 0x3a661, 0x3a663, 0x3a665, 0x3a667, 0x3a669, 0x3a66b, 0x3a66d, 0x3a681, 0x3a683, - 0x3a685, 0x3a687, 0x3a689, 0x3a68b, 0x3a68d, 0x3a68f, 0x3a691, 0x3a693, 0x3a695, - 0x3a697, 0x3a699, 0x3a69b, 0x3a723, 0x3a725, 0x3a727, 0x3a729, 0x3a72b, 0x3a72d, - 0x3a733, 0x3a735, 0x3a737, 0x3a739, 0x3a73b, 0x3a73d, 0x3a73f, 0x3a741, 0x3a743, - 0x3a745, 0x3a747, 0x3a749, 0x3a74b, 0x3a74d, 0x3a74f, 0x3a751, 0x3a753, 0x3a755, - 0x3a757, 0x3a759, 0x3a75b, 0x3a75d, 0x3a75f, 0x3a761, 0x3a763, 0x3a765, 0x3a767, - 0x3a769, 0x3a76b, 0x3a76d, 0x3a76f, 0x3a77a, 0x3a77c, 0x3a77f, 0x3a781, 0x3a783, - 0x3a785, 0x3a787, 0x3a78c, 0x3a78e, 0x3a791, 0x3a797, 0x3a799, 0x3a79b, 0x3a79d, - 0x3a79f, 0x3a7a1, 0x3a7a3, 0x3a7a5, 0x3a7a7, 0x3a7a9, 0x3a7b5, 0x3a7b7, 0x3a7fa, - 0x400b5, 0x40101, 0x40103, 0x40105, 0x40107, 0x40109, 0x4010b, 0x4010d, 0x4010f, - 0x40111, 0x40113, 0x40115, 0x40117, 0x40119, 0x4011b, 0x4011d, 0x4011f, 0x40121, - 0x40123, 0x40125, 0x40127, 0x40129, 0x4012b, 0x4012d, 0x4012f, 0x40131, 0x40133, - 0x40135, 0x40137, 0x40138, 0x4013a, 0x4013c, 0x4013e, 0x40140, 0x40142, 0x40144, - 0x40146, 0x40148, 0x40149, 0x4014b, 0x4014d, 0x4014f, 0x40151, 0x40153, 0x40155, - 0x40157, 0x40159, 0x4015b, 0x4015d, 0x4015f, 0x40161, 0x40163, 0x40165, 0x40167, - 0x40169, 0x4016b, 0x4016d, 0x4016f, 0x40171, 0x40173, 0x40175, 0x40177, 0x4017a, - 0x4017c, 0x40183, 0x40185, 0x40188, 0x4018c, 0x4018d, 0x40192, 0x40195, 0x4019e, - 0x401a1, 0x401a3, 0x401a5, 0x401a8, 0x401aa, 0x401ab, 0x401ad, 0x401b0, 0x401b4, - 0x401b6, 0x401b9, 0x401ba, 0x401c6, 0x401c9, 0x401cc, 0x401ce, 0x401d0, 0x401d2, - 0x401d4, 0x401d6, 0x401d8, 0x401da, 0x401dc, 0x401dd, 0x401df, 0x401e1, 0x401e3, - 0x401e5, 0x401e7, 0x401e9, 0x401eb, 0x401ed, 0x401ef, 0x401f0, 0x401f3, 0x401f5, - 0x401f9, 0x401fb, 0x401fd, 0x401ff, 0x40201, 0x40203, 0x40205, 0x40207, 0x40209, - 0x4020b, 0x4020d, 0x4020f, 0x40211, 0x40213, 0x40215, 0x40217, 0x40219, 0x4021b, - 0x4021d, 0x4021f, 0x40221, 0x40223, 0x40225, 0x40227, 0x40229, 0x4022b, 0x4022d, - 0x4022f, 0x40231, 0x4023c, 0x4023f, 0x40240, 0x40242, 0x40247, 0x40249, 0x4024b, - 0x4024d, 0x40371, 0x40373, 0x40377, 0x40390, 0x403d0, 0x403d1, 0x403d9, 0x403db, - 0x403dd, 0x403df, 0x403e1, 0x403e3, 0x403e5, 0x403e7, 0x403e9, 0x403eb, 0x403ed, - 0x403f5, 0x403f8, 0x403fb, 0x403fc, 0x40461, 0x40463, 0x40465, 0x40467, 0x40469, - 0x4046b, 0x4046d, 0x4046f, 0x40471, 0x40473, 0x40475, 0x40477, 0x40479, 0x4047b, - 0x4047d, 0x4047f, 0x40481, 0x4048b, 0x4048d, 0x4048f, 0x40491, 0x40493, 0x40495, - 0x40497, 0x40499, 0x4049b, 0x4049d, 0x4049f, 0x404a1, 0x404a3, 0x404a5, 0x404a7, - 0x404a9, 0x404ab, 0x404ad, 0x404af, 0x404b1, 0x404b3, 0x404b5, 0x404b7, 0x404b9, - 0x404bb, 0x404bd, 0x404bf, 0x404c2, 0x404c4, 0x404c6, 0x404c8, 0x404ca, 0x404cc, - 0x404ce, 0x404cf, 0x404d1, 0x404d3, 0x404d5, 0x404d7, 0x404d9, 0x404db, 0x404dd, - 0x404df, 0x404e1, 0x404e3, 0x404e5, 0x404e7, 0x404e9, 0x404eb, 0x404ed, 0x404ef, - 0x404f1, 0x404f3, 0x404f5, 0x404f7, 0x404f9, 0x404fb, 0x404fd, 0x404ff, 0x40501, - 0x40503, 0x40505, 0x40507, 0x40509, 0x4050b, 0x4050d, 0x4050f, 0x40511, 0x40513, - 0x40515, 0x40517, 0x40519, 0x4051b, 0x4051d, 0x4051f, 0x40521, 0x40523, 0x40525, - 0x40527, 0x40529, 0x4052b, 0x4052d, 0x4052f, 0x41e01, 0x41e03, 0x41e05, 0x41e07, - 0x41e09, 0x41e0b, 0x41e0d, 0x41e0f, 0x41e11, 0x41e13, 0x41e15, 0x41e17, 0x41e19, - 0x41e1b, 0x41e1d, 0x41e1f, 0x41e21, 0x41e23, 0x41e25, 0x41e27, 0x41e29, 0x41e2b, - 0x41e2d, 0x41e2f, 0x41e31, 0x41e33, 0x41e35, 0x41e37, 0x41e39, 0x41e3b, 0x41e3d, - 0x41e3f, 0x41e41, 0x41e43, 0x41e45, 0x41e47, 0x41e49, 0x41e4b, 0x41e4d, 0x41e4f, - 0x41e51, 0x41e53, 0x41e55, 0x41e57, 0x41e59, 0x41e5b, 0x41e5d, 0x41e5f, 0x41e61, - 0x41e63, 0x41e65, 0x41e67, 0x41e69, 0x41e6b, 0x41e6d, 0x41e6f, 0x41e71, 0x41e73, - 0x41e75, 0x41e77, 0x41e79, 0x41e7b, 0x41e7d, 0x41e7f, 0x41e81, 0x41e83, 0x41e85, - 0x41e87, 0x41e89, 0x41e8b, 0x41e8d, 0x41e8f, 0x41e91, 0x41e93, 0x41e9f, 0x41ea1, - 0x41ea3, 0x41ea5, 0x41ea7, 0x41ea9, 0x41eab, 0x41ead, 0x41eaf, 0x41eb1, 0x41eb3, - 0x41eb5, 0x41eb7, 0x41eb9, 0x41ebb, 0x41ebd, 0x41ebf, 0x41ec1, 0x41ec3, 0x41ec5, - 0x41ec7, 0x41ec9, 0x41ecb, 0x41ecd, 0x41ecf, 0x41ed1, 0x41ed3, 0x41ed5, 0x41ed7, - 0x41ed9, 0x41edb, 0x41edd, 0x41edf, 0x41ee1, 0x41ee3, 0x41ee5, 0x41ee7, 0x41ee9, - 0x41eeb, 0x41eed, 0x41eef, 0x41ef1, 0x41ef3, 0x41ef5, 0x41ef7, 0x41ef9, 0x41efb, - 0x41efd, 0x41fb6, 0x41fb7, 0x41fbe, 0x41fc6, 0x41fc7, 0x41fd6, 0x41fd7, 0x41ff6, - 0x41ff7, 0x4210a, 0x4210e, 0x4210f, 0x42113, 0x4212f, 0x42134, 0x42139, 0x4213c, - 0x4213d, 0x4214e, 0x42184, 0x42c61, 0x42c65, 0x42c66, 0x42c68, 0x42c6a, 0x42c6c, - 0x42c71, 0x42c73, 0x42c74, 0x42c81, 0x42c83, 0x42c85, 0x42c87, 0x42c89, 0x42c8b, - 0x42c8d, 0x42c8f, 0x42c91, 0x42c93, 0x42c95, 0x42c97, 0x42c99, 0x42c9b, 0x42c9d, - 0x42c9f, 0x42ca1, 0x42ca3, 0x42ca5, 0x42ca7, 0x42ca9, 0x42cab, 0x42cad, 0x42caf, - 0x42cb1, 0x42cb3, 0x42cb5, 0x42cb7, 0x42cb9, 0x42cbb, 0x42cbd, 0x42cbf, 0x42cc1, - 0x42cc3, 0x42cc5, 0x42cc7, 0x42cc9, 0x42ccb, 0x42ccd, 0x42ccf, 0x42cd1, 0x42cd3, - 0x42cd5, 0x42cd7, 0x42cd9, 0x42cdb, 0x42cdd, 0x42cdf, 0x42ce1, 0x42ce3, 0x42ce4, - 0x42cec, 0x42cee, 0x42cf3, 0x42d27, 0x42d2d, 0x4a641, 0x4a643, 0x4a645, 0x4a647, - 0x4a649, 0x4a64b, 0x4a64d, 0x4a64f, 0x4a651, 0x4a653, 0x4a655, 0x4a657, 0x4a659, - 0x4a65b, 0x4a65d, 0x4a65f, 0x4a661, 0x4a663, 0x4a665, 0x4a667, 0x4a669, 0x4a66b, - 0x4a66d, 0x4a681, 0x4a683, 0x4a685, 0x4a687, 0x4a689, 0x4a68b, 0x4a68d, 0x4a68f, - 0x4a691, 0x4a693, 0x4a695, 0x4a697, 0x4a699, 0x4a69b, 0x4a723, 0x4a725, 0x4a727, - 0x4a729, 0x4a72b, 0x4a72d, 0x4a733, 0x4a735, 0x4a737, 0x4a739, 0x4a73b, 0x4a73d, - 0x4a73f, 0x4a741, 0x4a743, 0x4a745, 0x4a747, 0x4a749, 0x4a74b, 0x4a74d, 0x4a74f, - 0x4a751, 0x4a753, 0x4a755, 0x4a757, 0x4a759, 0x4a75b, 0x4a75d, 0x4a75f, 0x4a761, - 0x4a763, 0x4a765, 0x4a767, 0x4a769, 0x4a76b, 0x4a76d, 0x4a76f, 0x4a77a, 0x4a77c, - 0x4a77f, 0x4a781, 0x4a783, 0x4a785, 0x4a787, 0x4a78c, 0x4a78e, 0x4a791, 0x4a797, - 0x4a799, 0x4a79b, 0x4a79d, 0x4a79f, 0x4a7a1, 0x4a7a3, 0x4a7a5, 0x4a7a7, 0x4a7a9, - 0x4a7b5, 0x4a7b7, 0x4a7fa, 0x500b5, 0x50101, 0x50103, 0x50105, 0x50107, 0x50109, - 0x5010b, 0x5010d, 0x5010f, 0x50111, 0x50113, 0x50115, 0x50117, 0x50119, 0x5011b, - 0x5011d, 0x5011f, 0x50121, 0x50123, 0x50125, 0x50127, 0x50129, 0x5012b, 0x5012d, - 0x5012f, 0x50131, 0x50133, 0x50135, 0x50137, 0x50138, 0x5013a, 0x5013c, 0x5013e, - 0x50140, 0x50142, 0x50144, 0x50146, 0x50148, 0x50149, 0x5014b, 0x5014d, 0x5014f, - 0x50151, 0x50153, 0x50155, 0x50157, 0x50159, 0x5015b, 0x5015d, 0x5015f, 0x50161, - 0x50163, 0x50165, 0x50167, 0x50169, 0x5016b, 0x5016d, 0x5016f, 0x50171, 0x50173, - 0x50175, 0x50177, 0x5017a, 0x5017c, 0x50183, 0x50185, 0x50188, 0x5018c, 0x5018d, - 0x50192, 0x50195, 0x5019e, 0x501a1, 0x501a3, 0x501a5, 0x501a8, 0x501aa, 0x501ab, - 0x501ad, 0x501b0, 0x501b4, 0x501b6, 0x501b9, 0x501ba, 0x501c6, 0x501c9, 0x501cc, - 0x501ce, 0x501d0, 0x501d2, 0x501d4, 0x501d6, 0x501d8, 0x501da, 0x501dc, 0x501dd, - 0x501df, 0x501e1, 0x501e3, 0x501e5, 0x501e7, 0x501e9, 0x501eb, 0x501ed, 0x501ef, - 0x501f0, 0x501f3, 0x501f5, 0x501f9, 0x501fb, 0x501fd, 0x501ff, 0x50201, 0x50203, - 0x50205, 0x50207, 0x50209, 0x5020b, 0x5020d, 0x5020f, 0x50211, 0x50213, 0x50215, - 0x50217, 0x50219, 0x5021b, 0x5021d, 0x5021f, 0x50221, 0x50223, 0x50225, 0x50227, - 0x50229, 0x5022b, 0x5022d, 0x5022f, 0x50231, 0x5023c, 0x5023f, 0x50240, 0x50242, - 0x50247, 0x50249, 0x5024b, 0x5024d, 0x50371, 0x50373, 0x50377, 0x50390, 0x503d0, - 0x503d1, 0x503d9, 0x503db, 0x503dd, 0x503df, 0x503e1, 0x503e3, 0x503e5, 0x503e7, - 0x503e9, 0x503eb, 0x503ed, 0x503f5, 0x503f8, 0x503fb, 0x503fc, 0x50461, 0x50463, - 0x50465, 0x50467, 0x50469, 0x5046b, 0x5046d, 0x5046f, 0x50471, 0x50473, 0x50475, - 0x50477, 0x50479, 0x5047b, 0x5047d, 0x5047f, 0x50481, 0x5048b, 0x5048d, 0x5048f, - 0x50491, 0x50493, 0x50495, 0x50497, 0x50499, 0x5049b, 0x5049d, 0x5049f, 0x504a1, - 0x504a3, 0x504a5, 0x504a7, 0x504a9, 0x504ab, 0x504ad, 0x504af, 0x504b1, 0x504b3, - 0x504b5, 0x504b7, 0x504b9, 0x504bb, 0x504bd, 0x504bf, 0x504c2, 0x504c4, 0x504c6, - 0x504c8, 0x504ca, 0x504cc, 0x504ce, 0x504cf, 0x504d1, 0x504d3, 0x504d5, 0x504d7, - 0x504d9, 0x504db, 0x504dd, 0x504df, 0x504e1, 0x504e3, 0x504e5, 0x504e7, 0x504e9, - 0x504eb, 0x504ed, 0x504ef, 0x504f1, 0x504f3, 0x504f5, 0x504f7, 0x504f9, 0x504fb, - 0x504fd, 0x504ff, 0x50501, 0x50503, 0x50505, 0x50507, 0x50509, 0x5050b, 0x5050d, - 0x5050f, 0x50511, 0x50513, 0x50515, 0x50517, 0x50519, 0x5051b, 0x5051d, 0x5051f, - 0x50521, 0x50523, 0x50525, 0x50527, 0x50529, 0x5052b, 0x5052d, 0x5052f, 0x51e01, - 0x51e03, 0x51e05, 0x51e07, 0x51e09, 0x51e0b, 0x51e0d, 0x51e0f, 0x51e11, 0x51e13, - 0x51e15, 0x51e17, 0x51e19, 0x51e1b, 0x51e1d, 0x51e1f, 0x51e21, 0x51e23, 0x51e25, - 0x51e27, 0x51e29, 0x51e2b, 0x51e2d, 0x51e2f, 0x51e31, 0x51e33, 0x51e35, 0x51e37, - 0x51e39, 0x51e3b, 0x51e3d, 0x51e3f, 0x51e41, 0x51e43, 0x51e45, 0x51e47, 0x51e49, - 0x51e4b, 0x51e4d, 0x51e4f, 0x51e51, 0x51e53, 0x51e55, 0x51e57, 0x51e59, 0x51e5b, - 0x51e5d, 0x51e5f, 0x51e61, 0x51e63, 0x51e65, 0x51e67, 0x51e69, 0x51e6b, 0x51e6d, - 0x51e6f, 0x51e71, 0x51e73, 0x51e75, 0x51e77, 0x51e79, 0x51e7b, 0x51e7d, 0x51e7f, - 0x51e81, 0x51e83, 0x51e85, 0x51e87, 0x51e89, 0x51e8b, 0x51e8d, 0x51e8f, 0x51e91, - 0x51e93, 0x51e9f, 0x51ea1, 0x51ea3, 0x51ea5, 0x51ea7, 0x51ea9, 0x51eab, 0x51ead, - 0x51eaf, 0x51eb1, 0x51eb3, 0x51eb5, 0x51eb7, 0x51eb9, 0x51ebb, 0x51ebd, 0x51ebf, - 0x51ec1, 0x51ec3, 0x51ec5, 0x51ec7, 0x51ec9, 0x51ecb, 0x51ecd, 0x51ecf, 0x51ed1, - 0x51ed3, 0x51ed5, 0x51ed7, 0x51ed9, 0x51edb, 0x51edd, 0x51edf, 0x51ee1, 0x51ee3, - 0x51ee5, 0x51ee7, 0x51ee9, 0x51eeb, 0x51eed, 0x51eef, 0x51ef1, 0x51ef3, 0x51ef5, - 0x51ef7, 0x51ef9, 0x51efb, 0x51efd, 0x51fb6, 0x51fb7, 0x51fbe, 0x51fc6, 0x51fc7, - 0x51fd6, 0x51fd7, 0x51ff6, 0x51ff7, 0x5210a, 0x5210e, 0x5210f, 0x52113, 0x5212f, - 0x52134, 0x52139, 0x5213c, 0x5213d, 0x5214e, 0x52184, 0x52c61, 0x52c65, 0x52c66, - 0x52c68, 0x52c6a, 0x52c6c, 0x52c71, 0x52c73, 0x52c74, 0x52c81, 0x52c83, 0x52c85, - 0x52c87, 0x52c89, 0x52c8b, 0x52c8d, 0x52c8f, 0x52c91, 0x52c93, 0x52c95, 0x52c97, - 0x52c99, 0x52c9b, 0x52c9d, 0x52c9f, 0x52ca1, 0x52ca3, 0x52ca5, 0x52ca7, 0x52ca9, - 0x52cab, 0x52cad, 0x52caf, 0x52cb1, 0x52cb3, 0x52cb5, 0x52cb7, 0x52cb9, 0x52cbb, - 0x52cbd, 0x52cbf, 0x52cc1, 0x52cc3, 0x52cc5, 0x52cc7, 0x52cc9, 0x52ccb, 0x52ccd, - 0x52ccf, 0x52cd1, 0x52cd3, 0x52cd5, 0x52cd7, 0x52cd9, 0x52cdb, 0x52cdd, 0x52cdf, - 0x52ce1, 0x52ce3, 0x52ce4, 0x52cec, 0x52cee, 0x52cf3, 0x52d27, 0x52d2d, 0x5a641, - 0x5a643, 0x5a645, 0x5a647, 0x5a649, 0x5a64b, 0x5a64d, 0x5a64f, 0x5a651, 0x5a653, - 0x5a655, 0x5a657, 0x5a659, 0x5a65b, 0x5a65d, 0x5a65f, 0x5a661, 0x5a663, 0x5a665, - 0x5a667, 0x5a669, 0x5a66b, 0x5a66d, 0x5a681, 0x5a683, 0x5a685, 0x5a687, 0x5a689, - 0x5a68b, 0x5a68d, 0x5a68f, 0x5a691, 0x5a693, 0x5a695, 0x5a697, 0x5a699, 0x5a69b, - 0x5a723, 0x5a725, 0x5a727, 0x5a729, 0x5a72b, 0x5a72d, 0x5a733, 0x5a735, 0x5a737, - 0x5a739, 0x5a73b, 0x5a73d, 0x5a73f, 0x5a741, 0x5a743, 0x5a745, 0x5a747, 0x5a749, - 0x5a74b, 0x5a74d, 0x5a74f, 0x5a751, 0x5a753, 0x5a755, 0x5a757, 0x5a759, 0x5a75b, - 0x5a75d, 0x5a75f, 0x5a761, 0x5a763, 0x5a765, 0x5a767, 0x5a769, 0x5a76b, 0x5a76d, - 0x5a76f, 0x5a77a, 0x5a77c, 0x5a77f, 0x5a781, 0x5a783, 0x5a785, 0x5a787, 0x5a78c, - 0x5a78e, 0x5a791, 0x5a797, 0x5a799, 0x5a79b, 0x5a79d, 0x5a79f, 0x5a7a1, 0x5a7a3, - 0x5a7a5, 0x5a7a7, 0x5a7a9, 0x5a7b5, 0x5a7b7, 0x5a7fa, 0x600b5, 0x60101, 0x60103, - 0x60105, 0x60107, 0x60109, 0x6010b, 0x6010d, 0x6010f, 0x60111, 0x60113, 0x60115, - 0x60117, 0x60119, 0x6011b, 0x6011d, 0x6011f, 0x60121, 0x60123, 0x60125, 0x60127, - 0x60129, 0x6012b, 0x6012d, 0x6012f, 0x60131, 0x60133, 0x60135, 0x60137, 0x60138, - 0x6013a, 0x6013c, 0x6013e, 0x60140, 0x60142, 0x60144, 0x60146, 0x60148, 0x60149, - 0x6014b, 0x6014d, 0x6014f, 0x60151, 0x60153, 0x60155, 0x60157, 0x60159, 0x6015b, - 0x6015d, 0x6015f, 0x60161, 0x60163, 0x60165, 0x60167, 0x60169, 0x6016b, 0x6016d, - 0x6016f, 0x60171, 0x60173, 0x60175, 0x60177, 0x6017a, 0x6017c, 0x60183, 0x60185, - 0x60188, 0x6018c, 0x6018d, 0x60192, 0x60195, 0x6019e, 0x601a1, 0x601a3, 0x601a5, - 0x601a8, 0x601aa, 0x601ab, 0x601ad, 0x601b0, 0x601b4, 0x601b6, 0x601b9, 0x601ba, - 0x601c6, 0x601c9, 0x601cc, 0x601ce, 0x601d0, 0x601d2, 0x601d4, 0x601d6, 0x601d8, - 0x601da, 0x601dc, 0x601dd, 0x601df, 0x601e1, 0x601e3, 0x601e5, 0x601e7, 0x601e9, - 0x601eb, 0x601ed, 0x601ef, 0x601f0, 0x601f3, 0x601f5, 0x601f9, 0x601fb, 0x601fd, - 0x601ff, 0x60201, 0x60203, 0x60205, 0x60207, 0x60209, 0x6020b, 0x6020d, 0x6020f, - 0x60211, 0x60213, 0x60215, 0x60217, 0x60219, 0x6021b, 0x6021d, 0x6021f, 0x60221, - 0x60223, 0x60225, 0x60227, 0x60229, 0x6022b, 0x6022d, 0x6022f, 0x60231, 0x6023c, - 0x6023f, 0x60240, 0x60242, 0x60247, 0x60249, 0x6024b, 0x6024d, 0x60371, 0x60373, - 0x60377, 0x60390, 0x603d0, 0x603d1, 0x603d9, 0x603db, 0x603dd, 0x603df, 0x603e1, - 0x603e3, 0x603e5, 0x603e7, 0x603e9, 0x603eb, 0x603ed, 0x603f5, 0x603f8, 0x603fb, - 0x603fc, 0x60461, 0x60463, 0x60465, 0x60467, 0x60469, 0x6046b, 0x6046d, 0x6046f, - 0x60471, 0x60473, 0x60475, 0x60477, 0x60479, 0x6047b, 0x6047d, 0x6047f, 0x60481, - 0x6048b, 0x6048d, 0x6048f, 0x60491, 0x60493, 0x60495, 0x60497, 0x60499, 0x6049b, - 0x6049d, 0x6049f, 0x604a1, 0x604a3, 0x604a5, 0x604a7, 0x604a9, 0x604ab, 0x604ad, - 0x604af, 0x604b1, 0x604b3, 0x604b5, 0x604b7, 0x604b9, 0x604bb, 0x604bd, 0x604bf, - 0x604c2, 0x604c4, 0x604c6, 0x604c8, 0x604ca, 0x604cc, 0x604ce, 0x604cf, 0x604d1, - 0x604d3, 0x604d5, 0x604d7, 0x604d9, 0x604db, 0x604dd, 0x604df, 0x604e1, 0x604e3, - 0x604e5, 0x604e7, 0x604e9, 0x604eb, 0x604ed, 0x604ef, 0x604f1, 0x604f3, 0x604f5, - 0x604f7, 0x604f9, 0x604fb, 0x604fd, 0x604ff, 0x60501, 0x60503, 0x60505, 0x60507, - 0x60509, 0x6050b, 0x6050d, 0x6050f, 0x60511, 0x60513, 0x60515, 0x60517, 0x60519, - 0x6051b, 0x6051d, 0x6051f, 0x60521, 0x60523, 0x60525, 0x60527, 0x60529, 0x6052b, - 0x6052d, 0x6052f, 0x61e01, 0x61e03, 0x61e05, 0x61e07, 0x61e09, 0x61e0b, 0x61e0d, - 0x61e0f, 0x61e11, 0x61e13, 0x61e15, 0x61e17, 0x61e19, 0x61e1b, 0x61e1d, 0x61e1f, - 0x61e21, 0x61e23, 0x61e25, 0x61e27, 0x61e29, 0x61e2b, 0x61e2d, 0x61e2f, 0x61e31, - 0x61e33, 0x61e35, 0x61e37, 0x61e39, 0x61e3b, 0x61e3d, 0x61e3f, 0x61e41, 0x61e43, - 0x61e45, 0x61e47, 0x61e49, 0x61e4b, 0x61e4d, 0x61e4f, 0x61e51, 0x61e53, 0x61e55, - 0x61e57, 0x61e59, 0x61e5b, 0x61e5d, 0x61e5f, 0x61e61, 0x61e63, 0x61e65, 0x61e67, - 0x61e69, 0x61e6b, 0x61e6d, 0x61e6f, 0x61e71, 0x61e73, 0x61e75, 0x61e77, 0x61e79, - 0x61e7b, 0x61e7d, 0x61e7f, 0x61e81, 0x61e83, 0x61e85, 0x61e87, 0x61e89, 0x61e8b, - 0x61e8d, 0x61e8f, 0x61e91, 0x61e93, 0x61e9f, 0x61ea1, 0x61ea3, 0x61ea5, 0x61ea7, - 0x61ea9, 0x61eab, 0x61ead, 0x61eaf, 0x61eb1, 0x61eb3, 0x61eb5, 0x61eb7, 0x61eb9, - 0x61ebb, 0x61ebd, 0x61ebf, 0x61ec1, 0x61ec3, 0x61ec5, 0x61ec7, 0x61ec9, 0x61ecb, - 0x61ecd, 0x61ecf, 0x61ed1, 0x61ed3, 0x61ed5, 0x61ed7, 0x61ed9, 0x61edb, 0x61edd, - 0x61edf, 0x61ee1, 0x61ee3, 0x61ee5, 0x61ee7, 0x61ee9, 0x61eeb, 0x61eed, 0x61eef, - 0x61ef1, 0x61ef3, 0x61ef5, 0x61ef7, 0x61ef9, 0x61efb, 0x61efd, 0x61fb6, 0x61fb7, - 0x61fbe, 0x61fc6, 0x61fc7, 0x61fd6, 0x61fd7, 0x61ff6, 0x61ff7, 0x6210a, 0x6210e, - 0x6210f, 0x62113, 0x6212f, 0x62134, 0x62139, 0x6213c, 0x6213d, 0x6214e, 0x62184, - 0x62c61, 0x62c65, 0x62c66, 0x62c68, 0x62c6a, 0x62c6c, 0x62c71, 0x62c73, 0x62c74, - 0x62c81, 0x62c83, 0x62c85, 0x62c87, 0x62c89, 0x62c8b, 0x62c8d, 0x62c8f, 0x62c91, - 0x62c93, 0x62c95, 0x62c97, 0x62c99, 0x62c9b, 0x62c9d, 0x62c9f, 0x62ca1, 0x62ca3, - 0x62ca5, 0x62ca7, 0x62ca9, 0x62cab, 0x62cad, 0x62caf, 0x62cb1, 0x62cb3, 0x62cb5, - 0x62cb7, 0x62cb9, 0x62cbb, 0x62cbd, 0x62cbf, 0x62cc1, 0x62cc3, 0x62cc5, 0x62cc7, - 0x62cc9, 0x62ccb, 0x62ccd, 0x62ccf, 0x62cd1, 0x62cd3, 0x62cd5, 0x62cd7, 0x62cd9, - 0x62cdb, 0x62cdd, 0x62cdf, 0x62ce1, 0x62ce3, 0x62ce4, 0x62cec, 0x62cee, 0x62cf3, - 0x62d27, 0x62d2d, 0x6a641, 0x6a643, 0x6a645, 0x6a647, 0x6a649, 0x6a64b, 0x6a64d, - 0x6a64f, 0x6a651, 0x6a653, 0x6a655, 0x6a657, 0x6a659, 0x6a65b, 0x6a65d, 0x6a65f, - 0x6a661, 0x6a663, 0x6a665, 0x6a667, 0x6a669, 0x6a66b, 0x6a66d, 0x6a681, 0x6a683, - 0x6a685, 0x6a687, 0x6a689, 0x6a68b, 0x6a68d, 0x6a68f, 0x6a691, 0x6a693, 0x6a695, - 0x6a697, 0x6a699, 0x6a69b, 0x6a723, 0x6a725, 0x6a727, 0x6a729, 0x6a72b, 0x6a72d, - 0x6a733, 0x6a735, 0x6a737, 0x6a739, 0x6a73b, 0x6a73d, 0x6a73f, 0x6a741, 0x6a743, - 0x6a745, 0x6a747, 0x6a749, 0x6a74b, 0x6a74d, 0x6a74f, 0x6a751, 0x6a753, 0x6a755, - 0x6a757, 0x6a759, 0x6a75b, 0x6a75d, 0x6a75f, 0x6a761, 0x6a763, 0x6a765, 0x6a767, - 0x6a769, 0x6a76b, 0x6a76d, 0x6a76f, 0x6a77a, 0x6a77c, 0x6a77f, 0x6a781, 0x6a783, - 0x6a785, 0x6a787, 0x6a78c, 0x6a78e, 0x6a791, 0x6a797, 0x6a799, 0x6a79b, 0x6a79d, - 0x6a79f, 0x6a7a1, 0x6a7a3, 0x6a7a5, 0x6a7a7, 0x6a7a9, 0x6a7b5, 0x6a7b7, 0x6a7fa, - 0x700b5, 0x70101, 0x70103, 0x70105, 0x70107, 0x70109, 0x7010b, 0x7010d, 0x7010f, - 0x70111, 0x70113, 0x70115, 0x70117, 0x70119, 0x7011b, 0x7011d, 0x7011f, 0x70121, - 0x70123, 0x70125, 0x70127, 0x70129, 0x7012b, 0x7012d, 0x7012f, 0x70131, 0x70133, - 0x70135, 0x70137, 0x70138, 0x7013a, 0x7013c, 0x7013e, 0x70140, 0x70142, 0x70144, - 0x70146, 0x70148, 0x70149, 0x7014b, 0x7014d, 0x7014f, 0x70151, 0x70153, 0x70155, - 0x70157, 0x70159, 0x7015b, 0x7015d, 0x7015f, 0x70161, 0x70163, 0x70165, 0x70167, - 0x70169, 0x7016b, 0x7016d, 0x7016f, 0x70171, 0x70173, 0x70175, 0x70177, 0x7017a, - 0x7017c, 0x70183, 0x70185, 0x70188, 0x7018c, 0x7018d, 0x70192, 0x70195, 0x7019e, - 0x701a1, 0x701a3, 0x701a5, 0x701a8, 0x701aa, 0x701ab, 0x701ad, 0x701b0, 0x701b4, - 0x701b6, 0x701b9, 0x701ba, 0x701c6, 0x701c9, 0x701cc, 0x701ce, 0x701d0, 0x701d2, - 0x701d4, 0x701d6, 0x701d8, 0x701da, 0x701dc, 0x701dd, 0x701df, 0x701e1, 0x701e3, - 0x701e5, 0x701e7, 0x701e9, 0x701eb, 0x701ed, 0x701ef, 0x701f0, 0x701f3, 0x701f5, - 0x701f9, 0x701fb, 0x701fd, 0x701ff, 0x70201, 0x70203, 0x70205, 0x70207, 0x70209, - 0x7020b, 0x7020d, 0x7020f, 0x70211, 0x70213, 0x70215, 0x70217, 0x70219, 0x7021b, - 0x7021d, 0x7021f, 0x70221, 0x70223, 0x70225, 0x70227, 0x70229, 0x7022b, 0x7022d, - 0x7022f, 0x70231, 0x7023c, 0x7023f, 0x70240, 0x70242, 0x70247, 0x70249, 0x7024b, - 0x7024d, 0x70371, 0x70373, 0x70377, 0x70390, 0x703d0, 0x703d1, 0x703d9, 0x703db, - 0x703dd, 0x703df, 0x703e1, 0x703e3, 0x703e5, 0x703e7, 0x703e9, 0x703eb, 0x703ed, - 0x703f5, 0x703f8, 0x703fb, 0x703fc, 0x70461, 0x70463, 0x70465, 0x70467, 0x70469, - 0x7046b, 0x7046d, 0x7046f, 0x70471, 0x70473, 0x70475, 0x70477, 0x70479, 0x7047b, - 0x7047d, 0x7047f, 0x70481, 0x7048b, 0x7048d, 0x7048f, 0x70491, 0x70493, 0x70495, - 0x70497, 0x70499, 0x7049b, 0x7049d, 0x7049f, 0x704a1, 0x704a3, 0x704a5, 0x704a7, - 0x704a9, 0x704ab, 0x704ad, 0x704af, 0x704b1, 0x704b3, 0x704b5, 0x704b7, 0x704b9, - 0x704bb, 0x704bd, 0x704bf, 0x704c2, 0x704c4, 0x704c6, 0x704c8, 0x704ca, 0x704cc, - 0x704ce, 0x704cf, 0x704d1, 0x704d3, 0x704d5, 0x704d7, 0x704d9, 0x704db, 0x704dd, - 0x704df, 0x704e1, 0x704e3, 0x704e5, 0x704e7, 0x704e9, 0x704eb, 0x704ed, 0x704ef, - 0x704f1, 0x704f3, 0x704f5, 0x704f7, 0x704f9, 0x704fb, 0x704fd, 0x704ff, 0x70501, - 0x70503, 0x70505, 0x70507, 0x70509, 0x7050b, 0x7050d, 0x7050f, 0x70511, 0x70513, - 0x70515, 0x70517, 0x70519, 0x7051b, 0x7051d, 0x7051f, 0x70521, 0x70523, 0x70525, - 0x70527, 0x70529, 0x7052b, 0x7052d, 0x7052f, 0x71e01, 0x71e03, 0x71e05, 0x71e07, - 0x71e09, 0x71e0b, 0x71e0d, 0x71e0f, 0x71e11, 0x71e13, 0x71e15, 0x71e17, 0x71e19, - 0x71e1b, 0x71e1d, 0x71e1f, 0x71e21, 0x71e23, 0x71e25, 0x71e27, 0x71e29, 0x71e2b, - 0x71e2d, 0x71e2f, 0x71e31, 0x71e33, 0x71e35, 0x71e37, 0x71e39, 0x71e3b, 0x71e3d, - 0x71e3f, 0x71e41, 0x71e43, 0x71e45, 0x71e47, 0x71e49, 0x71e4b, 0x71e4d, 0x71e4f, - 0x71e51, 0x71e53, 0x71e55, 0x71e57, 0x71e59, 0x71e5b, 0x71e5d, 0x71e5f, 0x71e61, - 0x71e63, 0x71e65, 0x71e67, 0x71e69, 0x71e6b, 0x71e6d, 0x71e6f, 0x71e71, 0x71e73, - 0x71e75, 0x71e77, 0x71e79, 0x71e7b, 0x71e7d, 0x71e7f, 0x71e81, 0x71e83, 0x71e85, - 0x71e87, 0x71e89, 0x71e8b, 0x71e8d, 0x71e8f, 0x71e91, 0x71e93, 0x71e9f, 0x71ea1, - 0x71ea3, 0x71ea5, 0x71ea7, 0x71ea9, 0x71eab, 0x71ead, 0x71eaf, 0x71eb1, 0x71eb3, - 0x71eb5, 0x71eb7, 0x71eb9, 0x71ebb, 0x71ebd, 0x71ebf, 0x71ec1, 0x71ec3, 0x71ec5, - 0x71ec7, 0x71ec9, 0x71ecb, 0x71ecd, 0x71ecf, 0x71ed1, 0x71ed3, 0x71ed5, 0x71ed7, - 0x71ed9, 0x71edb, 0x71edd, 0x71edf, 0x71ee1, 0x71ee3, 0x71ee5, 0x71ee7, 0x71ee9, - 0x71eeb, 0x71eed, 0x71eef, 0x71ef1, 0x71ef3, 0x71ef5, 0x71ef7, 0x71ef9, 0x71efb, - 0x71efd, 0x71fb6, 0x71fb7, 0x71fbe, 0x71fc6, 0x71fc7, 0x71fd6, 0x71fd7, 0x71ff6, - 0x71ff7, 0x7210a, 0x7210e, 0x7210f, 0x72113, 0x7212f, 0x72134, 0x72139, 0x7213c, - 0x7213d, 0x7214e, 0x72184, 0x72c61, 0x72c65, 0x72c66, 0x72c68, 0x72c6a, 0x72c6c, - 0x72c71, 0x72c73, 0x72c74, 0x72c81, 0x72c83, 0x72c85, 0x72c87, 0x72c89, 0x72c8b, - 0x72c8d, 0x72c8f, 0x72c91, 0x72c93, 0x72c95, 0x72c97, 0x72c99, 0x72c9b, 0x72c9d, - 0x72c9f, 0x72ca1, 0x72ca3, 0x72ca5, 0x72ca7, 0x72ca9, 0x72cab, 0x72cad, 0x72caf, - 0x72cb1, 0x72cb3, 0x72cb5, 0x72cb7, 0x72cb9, 0x72cbb, 0x72cbd, 0x72cbf, 0x72cc1, - 0x72cc3, 0x72cc5, 0x72cc7, 0x72cc9, 0x72ccb, 0x72ccd, 0x72ccf, 0x72cd1, 0x72cd3, - 0x72cd5, 0x72cd7, 0x72cd9, 0x72cdb, 0x72cdd, 0x72cdf, 0x72ce1, 0x72ce3, 0x72ce4, - 0x72cec, 0x72cee, 0x72cf3, 0x72d27, 0x72d2d, 0x7a641, 0x7a643, 0x7a645, 0x7a647, - 0x7a649, 0x7a64b, 0x7a64d, 0x7a64f, 0x7a651, 0x7a653, 0x7a655, 0x7a657, 0x7a659, - 0x7a65b, 0x7a65d, 0x7a65f, 0x7a661, 0x7a663, 0x7a665, 0x7a667, 0x7a669, 0x7a66b, - 0x7a66d, 0x7a681, 0x7a683, 0x7a685, 0x7a687, 0x7a689, 0x7a68b, 0x7a68d, 0x7a68f, - 0x7a691, 0x7a693, 0x7a695, 0x7a697, 0x7a699, 0x7a69b, 0x7a723, 0x7a725, 0x7a727, - 0x7a729, 0x7a72b, 0x7a72d, 0x7a733, 0x7a735, 0x7a737, 0x7a739, 0x7a73b, 0x7a73d, - 0x7a73f, 0x7a741, 0x7a743, 0x7a745, 0x7a747, 0x7a749, 0x7a74b, 0x7a74d, 0x7a74f, - 0x7a751, 0x7a753, 0x7a755, 0x7a757, 0x7a759, 0x7a75b, 0x7a75d, 0x7a75f, 0x7a761, - 0x7a763, 0x7a765, 0x7a767, 0x7a769, 0x7a76b, 0x7a76d, 0x7a76f, 0x7a77a, 0x7a77c, - 0x7a77f, 0x7a781, 0x7a783, 0x7a785, 0x7a787, 0x7a78c, 0x7a78e, 0x7a791, 0x7a797, - 0x7a799, 0x7a79b, 0x7a79d, 0x7a79f, 0x7a7a1, 0x7a7a3, 0x7a7a5, 0x7a7a7, 0x7a7a9, - 0x7a7b5, 0x7a7b7, 0x7a7fa, 0x800b5, 0x80101, 0x80103, 0x80105, 0x80107, 0x80109, - 0x8010b, 0x8010d, 0x8010f, 0x80111, 0x80113, 0x80115, 0x80117, 0x80119, 0x8011b, - 0x8011d, 0x8011f, 0x80121, 0x80123, 0x80125, 0x80127, 0x80129, 0x8012b, 0x8012d, - 0x8012f, 0x80131, 0x80133, 0x80135, 0x80137, 0x80138, 0x8013a, 0x8013c, 0x8013e, - 0x80140, 0x80142, 0x80144, 0x80146, 0x80148, 0x80149, 0x8014b, 0x8014d, 0x8014f, - 0x80151, 0x80153, 0x80155, 0x80157, 0x80159, 0x8015b, 0x8015d, 0x8015f, 0x80161, - 0x80163, 0x80165, 0x80167, 0x80169, 0x8016b, 0x8016d, 0x8016f, 0x80171, 0x80173, - 0x80175, 0x80177, 0x8017a, 0x8017c, 0x80183, 0x80185, 0x80188, 0x8018c, 0x8018d, - 0x80192, 0x80195, 0x8019e, 0x801a1, 0x801a3, 0x801a5, 0x801a8, 0x801aa, 0x801ab, - 0x801ad, 0x801b0, 0x801b4, 0x801b6, 0x801b9, 0x801ba, 0x801c6, 0x801c9, 0x801cc, - 0x801ce, 0x801d0, 0x801d2, 0x801d4, 0x801d6, 0x801d8, 0x801da, 0x801dc, 0x801dd, - 0x801df, 0x801e1, 0x801e3, 0x801e5, 0x801e7, 0x801e9, 0x801eb, 0x801ed, 0x801ef, - 0x801f0, 0x801f3, 0x801f5, 0x801f9, 0x801fb, 0x801fd, 0x801ff, 0x80201, 0x80203, - 0x80205, 0x80207, 0x80209, 0x8020b, 0x8020d, 0x8020f, 0x80211, 0x80213, 0x80215, - 0x80217, 0x80219, 0x8021b, 0x8021d, 0x8021f, 0x80221, 0x80223, 0x80225, 0x80227, - 0x80229, 0x8022b, 0x8022d, 0x8022f, 0x80231, 0x8023c, 0x8023f, 0x80240, 0x80242, - 0x80247, 0x80249, 0x8024b, 0x8024d, 0x80371, 0x80373, 0x80377, 0x80390, 0x803d0, - 0x803d1, 0x803d9, 0x803db, 0x803dd, 0x803df, 0x803e1, 0x803e3, 0x803e5, 0x803e7, - 0x803e9, 0x803eb, 0x803ed, 0x803f5, 0x803f8, 0x803fb, 0x803fc, 0x80461, 0x80463, - 0x80465, 0x80467, 0x80469, 0x8046b, 0x8046d, 0x8046f, 0x80471, 0x80473, 0x80475, - 0x80477, 0x80479, 0x8047b, 0x8047d, 0x8047f, 0x80481, 0x8048b, 0x8048d, 0x8048f, - 0x80491, 0x80493, 0x80495, 0x80497, 0x80499, 0x8049b, 0x8049d, 0x8049f, 0x804a1, - 0x804a3, 0x804a5, 0x804a7, 0x804a9, 0x804ab, 0x804ad, 0x804af, 0x804b1, 0x804b3, - 0x804b5, 0x804b7, 0x804b9, 0x804bb, 0x804bd, 0x804bf, 0x804c2, 0x804c4, 0x804c6, - 0x804c8, 0x804ca, 0x804cc, 0x804ce, 0x804cf, 0x804d1, 0x804d3, 0x804d5, 0x804d7, - 0x804d9, 0x804db, 0x804dd, 0x804df, 0x804e1, 0x804e3, 0x804e5, 0x804e7, 0x804e9, - 0x804eb, 0x804ed, 0x804ef, 0x804f1, 0x804f3, 0x804f5, 0x804f7, 0x804f9, 0x804fb, - 0x804fd, 0x804ff, 0x80501, 0x80503, 0x80505, 0x80507, 0x80509, 0x8050b, 0x8050d, - 0x8050f, 0x80511, 0x80513, 0x80515, 0x80517, 0x80519, 0x8051b, 0x8051d, 0x8051f, - 0x80521, 0x80523, 0x80525, 0x80527, 0x80529, 0x8052b, 0x8052d, 0x8052f, 0x81e01, - 0x81e03, 0x81e05, 0x81e07, 0x81e09, 0x81e0b, 0x81e0d, 0x81e0f, 0x81e11, 0x81e13, - 0x81e15, 0x81e17, 0x81e19, 0x81e1b, 0x81e1d, 0x81e1f, 0x81e21, 0x81e23, 0x81e25, - 0x81e27, 0x81e29, 0x81e2b, 0x81e2d, 0x81e2f, 0x81e31, 0x81e33, 0x81e35, 0x81e37, - 0x81e39, 0x81e3b, 0x81e3d, 0x81e3f, 0x81e41, 0x81e43, 0x81e45, 0x81e47, 0x81e49, - 0x81e4b, 0x81e4d, 0x81e4f, 0x81e51, 0x81e53, 0x81e55, 0x81e57, 0x81e59, 0x81e5b, - 0x81e5d, 0x81e5f, 0x81e61, 0x81e63, 0x81e65, 0x81e67, 0x81e69, 0x81e6b, 0x81e6d, - 0x81e6f, 0x81e71, 0x81e73, 0x81e75, 0x81e77, 0x81e79, 0x81e7b, 0x81e7d, 0x81e7f, - 0x81e81, 0x81e83, 0x81e85, 0x81e87, 0x81e89, 0x81e8b, 0x81e8d, 0x81e8f, 0x81e91, - 0x81e93, 0x81e9f, 0x81ea1, 0x81ea3, 0x81ea5, 0x81ea7, 0x81ea9, 0x81eab, 0x81ead, - 0x81eaf, 0x81eb1, 0x81eb3, 0x81eb5, 0x81eb7, 0x81eb9, 0x81ebb, 0x81ebd, 0x81ebf, - 0x81ec1, 0x81ec3, 0x81ec5, 0x81ec7, 0x81ec9, 0x81ecb, 0x81ecd, 0x81ecf, 0x81ed1, - 0x81ed3, 0x81ed5, 0x81ed7, 0x81ed9, 0x81edb, 0x81edd, 0x81edf, 0x81ee1, 0x81ee3, - 0x81ee5, 0x81ee7, 0x81ee9, 0x81eeb, 0x81eed, 0x81eef, 0x81ef1, 0x81ef3, 0x81ef5, - 0x81ef7, 0x81ef9, 0x81efb, 0x81efd, 0x81fb6, 0x81fb7, 0x81fbe, 0x81fc6, 0x81fc7, - 0x81fd6, 0x81fd7, 0x81ff6, 0x81ff7, 0x8210a, 0x8210e, 0x8210f, 0x82113, 0x8212f, - 0x82134, 0x82139, 0x8213c, 0x8213d, 0x8214e, 0x82184, 0x82c61, 0x82c65, 0x82c66, - 0x82c68, 0x82c6a, 0x82c6c, 0x82c71, 0x82c73, 0x82c74, 0x82c81, 0x82c83, 0x82c85, - 0x82c87, 0x82c89, 0x82c8b, 0x82c8d, 0x82c8f, 0x82c91, 0x82c93, 0x82c95, 0x82c97, - 0x82c99, 0x82c9b, 0x82c9d, 0x82c9f, 0x82ca1, 0x82ca3, 0x82ca5, 0x82ca7, 0x82ca9, - 0x82cab, 0x82cad, 0x82caf, 0x82cb1, 0x82cb3, 0x82cb5, 0x82cb7, 0x82cb9, 0x82cbb, - 0x82cbd, 0x82cbf, 0x82cc1, 0x82cc3, 0x82cc5, 0x82cc7, 0x82cc9, 0x82ccb, 0x82ccd, - 0x82ccf, 0x82cd1, 0x82cd3, 0x82cd5, 0x82cd7, 0x82cd9, 0x82cdb, 0x82cdd, 0x82cdf, - 0x82ce1, 0x82ce3, 0x82ce4, 0x82cec, 0x82cee, 0x82cf3, 0x82d27, 0x82d2d, 0x8a641, - 0x8a643, 0x8a645, 0x8a647, 0x8a649, 0x8a64b, 0x8a64d, 0x8a64f, 0x8a651, 0x8a653, - 0x8a655, 0x8a657, 0x8a659, 0x8a65b, 0x8a65d, 0x8a65f, 0x8a661, 0x8a663, 0x8a665, - 0x8a667, 0x8a669, 0x8a66b, 0x8a66d, 0x8a681, 0x8a683, 0x8a685, 0x8a687, 0x8a689, - 0x8a68b, 0x8a68d, 0x8a68f, 0x8a691, 0x8a693, 0x8a695, 0x8a697, 0x8a699, 0x8a69b, - 0x8a723, 0x8a725, 0x8a727, 0x8a729, 0x8a72b, 0x8a72d, 0x8a733, 0x8a735, 0x8a737, - 0x8a739, 0x8a73b, 0x8a73d, 0x8a73f, 0x8a741, 0x8a743, 0x8a745, 0x8a747, 0x8a749, - 0x8a74b, 0x8a74d, 0x8a74f, 0x8a751, 0x8a753, 0x8a755, 0x8a757, 0x8a759, 0x8a75b, - 0x8a75d, 0x8a75f, 0x8a761, 0x8a763, 0x8a765, 0x8a767, 0x8a769, 0x8a76b, 0x8a76d, - 0x8a76f, 0x8a77a, 0x8a77c, 0x8a77f, 0x8a781, 0x8a783, 0x8a785, 0x8a787, 0x8a78c, - 0x8a78e, 0x8a791, 0x8a797, 0x8a799, 0x8a79b, 0x8a79d, 0x8a79f, 0x8a7a1, 0x8a7a3, - 0x8a7a5, 0x8a7a7, 0x8a7a9, 0x8a7b5, 0x8a7b7, 0x8a7fa, 0x900b5, 0x90101, 0x90103, - 0x90105, 0x90107, 0x90109, 0x9010b, 0x9010d, 0x9010f, 0x90111, 0x90113, 0x90115, - 0x90117, 0x90119, 0x9011b, 0x9011d, 0x9011f, 0x90121, 0x90123, 0x90125, 0x90127, - 0x90129, 0x9012b, 0x9012d, 0x9012f, 0x90131, 0x90133, 0x90135, 0x90137, 0x90138, - 0x9013a, 0x9013c, 0x9013e, 0x90140, 0x90142, 0x90144, 0x90146, 0x90148, 0x90149, - 0x9014b, 0x9014d, 0x9014f, 0x90151, 0x90153, 0x90155, 0x90157, 0x90159, 0x9015b, - 0x9015d, 0x9015f, 0x90161, 0x90163, 0x90165, 0x90167, 0x90169, 0x9016b, 0x9016d, - 0x9016f, 0x90171, 0x90173, 0x90175, 0x90177, 0x9017a, 0x9017c, 0x90183, 0x90185, - 0x90188, 0x9018c, 0x9018d, 0x90192, 0x90195, 0x9019e, 0x901a1, 0x901a3, 0x901a5, - 0x901a8, 0x901aa, 0x901ab, 0x901ad, 0x901b0, 0x901b4, 0x901b6, 0x901b9, 0x901ba, - 0x901c6, 0x901c9, 0x901cc, 0x901ce, 0x901d0, 0x901d2, 0x901d4, 0x901d6, 0x901d8, - 0x901da, 0x901dc, 0x901dd, 0x901df, 0x901e1, 0x901e3, 0x901e5, 0x901e7, 0x901e9, - 0x901eb, 0x901ed, 0x901ef, 0x901f0, 0x901f3, 0x901f5, 0x901f9, 0x901fb, 0x901fd, - 0x901ff, 0x90201, 0x90203, 0x90205, 0x90207, 0x90209, 0x9020b, 0x9020d, 0x9020f, - 0x90211, 0x90213, 0x90215, 0x90217, 0x90219, 0x9021b, 0x9021d, 0x9021f, 0x90221, - 0x90223, 0x90225, 0x90227, 0x90229, 0x9022b, 0x9022d, 0x9022f, 0x90231, 0x9023c, - 0x9023f, 0x90240, 0x90242, 0x90247, 0x90249, 0x9024b, 0x9024d, 0x90371, 0x90373, - 0x90377, 0x90390, 0x903d0, 0x903d1, 0x903d9, 0x903db, 0x903dd, 0x903df, 0x903e1, - 0x903e3, 0x903e5, 0x903e7, 0x903e9, 0x903eb, 0x903ed, 0x903f5, 0x903f8, 0x903fb, - 0x903fc, 0x90461, 0x90463, 0x90465, 0x90467, 0x90469, 0x9046b, 0x9046d, 0x9046f, - 0x90471, 0x90473, 0x90475, 0x90477, 0x90479, 0x9047b, 0x9047d, 0x9047f, 0x90481, - 0x9048b, 0x9048d, 0x9048f, 0x90491, 0x90493, 0x90495, 0x90497, 0x90499, 0x9049b, - 0x9049d, 0x9049f, 0x904a1, 0x904a3, 0x904a5, 0x904a7, 0x904a9, 0x904ab, 0x904ad, - 0x904af, 0x904b1, 0x904b3, 0x904b5, 0x904b7, 0x904b9, 0x904bb, 0x904bd, 0x904bf, - 0x904c2, 0x904c4, 0x904c6, 0x904c8, 0x904ca, 0x904cc, 0x904ce, 0x904cf, 0x904d1, - 0x904d3, 0x904d5, 0x904d7, 0x904d9, 0x904db, 0x904dd, 0x904df, 0x904e1, 0x904e3, - 0x904e5, 0x904e7, 0x904e9, 0x904eb, 0x904ed, 0x904ef, 0x904f1, 0x904f3, 0x904f5, - 0x904f7, 0x904f9, 0x904fb, 0x904fd, 0x904ff, 0x90501, 0x90503, 0x90505, 0x90507, - 0x90509, 0x9050b, 0x9050d, 0x9050f, 0x90511, 0x90513, 0x90515, 0x90517, 0x90519, - 0x9051b, 0x9051d, 0x9051f, 0x90521, 0x90523, 0x90525, 0x90527, 0x90529, 0x9052b, - 0x9052d, 0x9052f, 0x91e01, 0x91e03, 0x91e05, 0x91e07, 0x91e09, 0x91e0b, 0x91e0d, - 0x91e0f, 0x91e11, 0x91e13, 0x91e15, 0x91e17, 0x91e19, 0x91e1b, 0x91e1d, 0x91e1f, - 0x91e21, 0x91e23, 0x91e25, 0x91e27, 0x91e29, 0x91e2b, 0x91e2d, 0x91e2f, 0x91e31, - 0x91e33, 0x91e35, 0x91e37, 0x91e39, 0x91e3b, 0x91e3d, 0x91e3f, 0x91e41, 0x91e43, - 0x91e45, 0x91e47, 0x91e49, 0x91e4b, 0x91e4d, 0x91e4f, 0x91e51, 0x91e53, 0x91e55, - 0x91e57, 0x91e59, 0x91e5b, 0x91e5d, 0x91e5f, 0x91e61, 0x91e63, 0x91e65, 0x91e67, - 0x91e69, 0x91e6b, 0x91e6d, 0x91e6f, 0x91e71, 0x91e73, 0x91e75, 0x91e77, 0x91e79, - 0x91e7b, 0x91e7d, 0x91e7f, 0x91e81, 0x91e83, 0x91e85, 0x91e87, 0x91e89, 0x91e8b, - 0x91e8d, 0x91e8f, 0x91e91, 0x91e93, 0x91e9f, 0x91ea1, 0x91ea3, 0x91ea5, 0x91ea7, - 0x91ea9, 0x91eab, 0x91ead, 0x91eaf, 0x91eb1, 0x91eb3, 0x91eb5, 0x91eb7, 0x91eb9, - 0x91ebb, 0x91ebd, 0x91ebf, 0x91ec1, 0x91ec3, 0x91ec5, 0x91ec7, 0x91ec9, 0x91ecb, - 0x91ecd, 0x91ecf, 0x91ed1, 0x91ed3, 0x91ed5, 0x91ed7, 0x91ed9, 0x91edb, 0x91edd, - 0x91edf, 0x91ee1, 0x91ee3, 0x91ee5, 0x91ee7, 0x91ee9, 0x91eeb, 0x91eed, 0x91eef, - 0x91ef1, 0x91ef3, 0x91ef5, 0x91ef7, 0x91ef9, 0x91efb, 0x91efd, 0x91fb6, 0x91fb7, - 0x91fbe, 0x91fc6, 0x91fc7, 0x91fd6, 0x91fd7, 0x91ff6, 0x91ff7, 0x9210a, 0x9210e, - 0x9210f, 0x92113, 0x9212f, 0x92134, 0x92139, 0x9213c, 0x9213d, 0x9214e, 0x92184, - 0x92c61, 0x92c65, 0x92c66, 0x92c68, 0x92c6a, 0x92c6c, 0x92c71, 0x92c73, 0x92c74, - 0x92c81, 0x92c83, 0x92c85, 0x92c87, 0x92c89, 0x92c8b, 0x92c8d, 0x92c8f, 0x92c91, - 0x92c93, 0x92c95, 0x92c97, 0x92c99, 0x92c9b, 0x92c9d, 0x92c9f, 0x92ca1, 0x92ca3, - 0x92ca5, 0x92ca7, 0x92ca9, 0x92cab, 0x92cad, 0x92caf, 0x92cb1, 0x92cb3, 0x92cb5, - 0x92cb7, 0x92cb9, 0x92cbb, 0x92cbd, 0x92cbf, 0x92cc1, 0x92cc3, 0x92cc5, 0x92cc7, - 0x92cc9, 0x92ccb, 0x92ccd, 0x92ccf, 0x92cd1, 0x92cd3, 0x92cd5, 0x92cd7, 0x92cd9, - 0x92cdb, 0x92cdd, 0x92cdf, 0x92ce1, 0x92ce3, 0x92ce4, 0x92cec, 0x92cee, 0x92cf3, - 0x92d27, 0x92d2d, 0x9a641, 0x9a643, 0x9a645, 0x9a647, 0x9a649, 0x9a64b, 0x9a64d, - 0x9a64f, 0x9a651, 0x9a653, 0x9a655, 0x9a657, 0x9a659, 0x9a65b, 0x9a65d, 0x9a65f, - 0x9a661, 0x9a663, 0x9a665, 0x9a667, 0x9a669, 0x9a66b, 0x9a66d, 0x9a681, 0x9a683, - 0x9a685, 0x9a687, 0x9a689, 0x9a68b, 0x9a68d, 0x9a68f, 0x9a691, 0x9a693, 0x9a695, - 0x9a697, 0x9a699, 0x9a69b, 0x9a723, 0x9a725, 0x9a727, 0x9a729, 0x9a72b, 0x9a72d, - 0x9a733, 0x9a735, 0x9a737, 0x9a739, 0x9a73b, 0x9a73d, 0x9a73f, 0x9a741, 0x9a743, - 0x9a745, 0x9a747, 0x9a749, 0x9a74b, 0x9a74d, 0x9a74f, 0x9a751, 0x9a753, 0x9a755, - 0x9a757, 0x9a759, 0x9a75b, 0x9a75d, 0x9a75f, 0x9a761, 0x9a763, 0x9a765, 0x9a767, - 0x9a769, 0x9a76b, 0x9a76d, 0x9a76f, 0x9a77a, 0x9a77c, 0x9a77f, 0x9a781, 0x9a783, - 0x9a785, 0x9a787, 0x9a78c, 0x9a78e, 0x9a791, 0x9a797, 0x9a799, 0x9a79b, 0x9a79d, - 0x9a79f, 0x9a7a1, 0x9a7a3, 0x9a7a5, 0x9a7a7, 0x9a7a9, 0x9a7b5, 0x9a7b7, 0x9a7fa, - 0xa00b5, 0xa0101, 0xa0103, 0xa0105, 0xa0107, 0xa0109, 0xa010b, 0xa010d, 0xa010f, - 0xa0111, 0xa0113, 0xa0115, 0xa0117, 0xa0119, 0xa011b, 0xa011d, 0xa011f, 0xa0121, - 0xa0123, 0xa0125, 0xa0127, 0xa0129, 0xa012b, 0xa012d, 0xa012f, 0xa0131, 0xa0133, - 0xa0135, 0xa0137, 0xa0138, 0xa013a, 0xa013c, 0xa013e, 0xa0140, 0xa0142, 0xa0144, - 0xa0146, 0xa0148, 0xa0149, 0xa014b, 0xa014d, 0xa014f, 0xa0151, 0xa0153, 0xa0155, - 0xa0157, 0xa0159, 0xa015b, 0xa015d, 0xa015f, 0xa0161, 0xa0163, 0xa0165, 0xa0167, - 0xa0169, 0xa016b, 0xa016d, 0xa016f, 0xa0171, 0xa0173, 0xa0175, 0xa0177, 0xa017a, - 0xa017c, 0xa0183, 0xa0185, 0xa0188, 0xa018c, 0xa018d, 0xa0192, 0xa0195, 0xa019e, - 0xa01a1, 0xa01a3, 0xa01a5, 0xa01a8, 0xa01aa, 0xa01ab, 0xa01ad, 0xa01b0, 0xa01b4, - 0xa01b6, 0xa01b9, 0xa01ba, 0xa01c6, 0xa01c9, 0xa01cc, 0xa01ce, 0xa01d0, 0xa01d2, - 0xa01d4, 0xa01d6, 0xa01d8, 0xa01da, 0xa01dc, 0xa01dd, 0xa01df, 0xa01e1, 0xa01e3, - 0xa01e5, 0xa01e7, 0xa01e9, 0xa01eb, 0xa01ed, 0xa01ef, 0xa01f0, 0xa01f3, 0xa01f5, - 0xa01f9, 0xa01fb, 0xa01fd, 0xa01ff, 0xa0201, 0xa0203, 0xa0205, 0xa0207, 0xa0209, - 0xa020b, 0xa020d, 0xa020f, 0xa0211, 0xa0213, 0xa0215, 0xa0217, 0xa0219, 0xa021b, - 0xa021d, 0xa021f, 0xa0221, 0xa0223, 0xa0225, 0xa0227, 0xa0229, 0xa022b, 0xa022d, - 0xa022f, 0xa0231, 0xa023c, 0xa023f, 0xa0240, 0xa0242, 0xa0247, 0xa0249, 0xa024b, - 0xa024d, 0xa0371, 0xa0373, 0xa0377, 0xa0390, 0xa03d0, 0xa03d1, 0xa03d9, 0xa03db, - 0xa03dd, 0xa03df, 0xa03e1, 0xa03e3, 0xa03e5, 0xa03e7, 0xa03e9, 0xa03eb, 0xa03ed, - 0xa03f5, 0xa03f8, 0xa03fb, 0xa03fc, 0xa0461, 0xa0463, 0xa0465, 0xa0467, 0xa0469, - 0xa046b, 0xa046d, 0xa046f, 0xa0471, 0xa0473, 0xa0475, 0xa0477, 0xa0479, 0xa047b, - 0xa047d, 0xa047f, 0xa0481, 0xa048b, 0xa048d, 0xa048f, 0xa0491, 0xa0493, 0xa0495, - 0xa0497, 0xa0499, 0xa049b, 0xa049d, 0xa049f, 0xa04a1, 0xa04a3, 0xa04a5, 0xa04a7, - 0xa04a9, 0xa04ab, 0xa04ad, 0xa04af, 0xa04b1, 0xa04b3, 0xa04b5, 0xa04b7, 0xa04b9, - 0xa04bb, 0xa04bd, 0xa04bf, 0xa04c2, 0xa04c4, 0xa04c6, 0xa04c8, 0xa04ca, 0xa04cc, - 0xa04ce, 0xa04cf, 0xa04d1, 0xa04d3, 0xa04d5, 0xa04d7, 0xa04d9, 0xa04db, 0xa04dd, - 0xa04df, 0xa04e1, 0xa04e3, 0xa04e5, 0xa04e7, 0xa04e9, 0xa04eb, 0xa04ed, 0xa04ef, - 0xa04f1, 0xa04f3, 0xa04f5, 0xa04f7, 0xa04f9, 0xa04fb, 0xa04fd, 0xa04ff, 0xa0501, - 0xa0503, 0xa0505, 0xa0507, 0xa0509, 0xa050b, 0xa050d, 0xa050f, 0xa0511, 0xa0513, - 0xa0515, 0xa0517, 0xa0519, 0xa051b, 0xa051d, 0xa051f, 0xa0521, 0xa0523, 0xa0525, - 0xa0527, 0xa0529, 0xa052b, 0xa052d, 0xa052f, 0xa1e01, 0xa1e03, 0xa1e05, 0xa1e07, - 0xa1e09, 0xa1e0b, 0xa1e0d, 0xa1e0f, 0xa1e11, 0xa1e13, 0xa1e15, 0xa1e17, 0xa1e19, - 0xa1e1b, 0xa1e1d, 0xa1e1f, 0xa1e21, 0xa1e23, 0xa1e25, 0xa1e27, 0xa1e29, 0xa1e2b, - 0xa1e2d, 0xa1e2f, 0xa1e31, 0xa1e33, 0xa1e35, 0xa1e37, 0xa1e39, 0xa1e3b, 0xa1e3d, - 0xa1e3f, 0xa1e41, 0xa1e43, 0xa1e45, 0xa1e47, 0xa1e49, 0xa1e4b, 0xa1e4d, 0xa1e4f, - 0xa1e51, 0xa1e53, 0xa1e55, 0xa1e57, 0xa1e59, 0xa1e5b, 0xa1e5d, 0xa1e5f, 0xa1e61, - 0xa1e63, 0xa1e65, 0xa1e67, 0xa1e69, 0xa1e6b, 0xa1e6d, 0xa1e6f, 0xa1e71, 0xa1e73, - 0xa1e75, 0xa1e77, 0xa1e79, 0xa1e7b, 0xa1e7d, 0xa1e7f, 0xa1e81, 0xa1e83, 0xa1e85, - 0xa1e87, 0xa1e89, 0xa1e8b, 0xa1e8d, 0xa1e8f, 0xa1e91, 0xa1e93, 0xa1e9f, 0xa1ea1, - 0xa1ea3, 0xa1ea5, 0xa1ea7, 0xa1ea9, 0xa1eab, 0xa1ead, 0xa1eaf, 0xa1eb1, 0xa1eb3, - 0xa1eb5, 0xa1eb7, 0xa1eb9, 0xa1ebb, 0xa1ebd, 0xa1ebf, 0xa1ec1, 0xa1ec3, 0xa1ec5, - 0xa1ec7, 0xa1ec9, 0xa1ecb, 0xa1ecd, 0xa1ecf, 0xa1ed1, 0xa1ed3, 0xa1ed5, 0xa1ed7, - 0xa1ed9, 0xa1edb, 0xa1edd, 0xa1edf, 0xa1ee1, 0xa1ee3, 0xa1ee5, 0xa1ee7, 0xa1ee9, - 0xa1eeb, 0xa1eed, 0xa1eef, 0xa1ef1, 0xa1ef3, 0xa1ef5, 0xa1ef7, 0xa1ef9, 0xa1efb, - 0xa1efd, 0xa1fb6, 0xa1fb7, 0xa1fbe, 0xa1fc6, 0xa1fc7, 0xa1fd6, 0xa1fd7, 0xa1ff6, - 0xa1ff7, 0xa210a, 0xa210e, 0xa210f, 0xa2113, 0xa212f, 0xa2134, 0xa2139, 0xa213c, - 0xa213d, 0xa214e, 0xa2184, 0xa2c61, 0xa2c65, 0xa2c66, 0xa2c68, 0xa2c6a, 0xa2c6c, - 0xa2c71, 0xa2c73, 0xa2c74, 0xa2c81, 0xa2c83, 0xa2c85, 0xa2c87, 0xa2c89, 0xa2c8b, - 0xa2c8d, 0xa2c8f, 0xa2c91, 0xa2c93, 0xa2c95, 0xa2c97, 0xa2c99, 0xa2c9b, 0xa2c9d, - 0xa2c9f, 0xa2ca1, 0xa2ca3, 0xa2ca5, 0xa2ca7, 0xa2ca9, 0xa2cab, 0xa2cad, 0xa2caf, - 0xa2cb1, 0xa2cb3, 0xa2cb5, 0xa2cb7, 0xa2cb9, 0xa2cbb, 0xa2cbd, 0xa2cbf, 0xa2cc1, - 0xa2cc3, 0xa2cc5, 0xa2cc7, 0xa2cc9, 0xa2ccb, 0xa2ccd, 0xa2ccf, 0xa2cd1, 0xa2cd3, - 0xa2cd5, 0xa2cd7, 0xa2cd9, 0xa2cdb, 0xa2cdd, 0xa2cdf, 0xa2ce1, 0xa2ce3, 0xa2ce4, - 0xa2cec, 0xa2cee, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xaa641, 0xaa643, 0xaa645, 0xaa647, - 0xaa649, 0xaa64b, 0xaa64d, 0xaa64f, 0xaa651, 0xaa653, 0xaa655, 0xaa657, 0xaa659, - 0xaa65b, 0xaa65d, 0xaa65f, 0xaa661, 0xaa663, 0xaa665, 0xaa667, 0xaa669, 0xaa66b, - 0xaa66d, 0xaa681, 0xaa683, 0xaa685, 0xaa687, 0xaa689, 0xaa68b, 0xaa68d, 0xaa68f, - 0xaa691, 0xaa693, 0xaa695, 0xaa697, 0xaa699, 0xaa69b, 0xaa723, 0xaa725, 0xaa727, - 0xaa729, 0xaa72b, 0xaa72d, 0xaa733, 0xaa735, 0xaa737, 0xaa739, 0xaa73b, 0xaa73d, - 0xaa73f, 0xaa741, 0xaa743, 0xaa745, 0xaa747, 0xaa749, 0xaa74b, 0xaa74d, 0xaa74f, - 0xaa751, 0xaa753, 0xaa755, 0xaa757, 0xaa759, 0xaa75b, 0xaa75d, 0xaa75f, 0xaa761, - 0xaa763, 0xaa765, 0xaa767, 0xaa769, 0xaa76b, 0xaa76d, 0xaa76f, 0xaa77a, 0xaa77c, - 0xaa77f, 0xaa781, 0xaa783, 0xaa785, 0xaa787, 0xaa78c, 0xaa78e, 0xaa791, 0xaa797, - 0xaa799, 0xaa79b, 0xaa79d, 0xaa79f, 0xaa7a1, 0xaa7a3, 0xaa7a5, 0xaa7a7, 0xaa7a9, - 0xaa7b5, 0xaa7b7, 0xaa7fa, 0xb00b5, 0xb0101, 0xb0103, 0xb0105, 0xb0107, 0xb0109, - 0xb010b, 0xb010d, 0xb010f, 0xb0111, 0xb0113, 0xb0115, 0xb0117, 0xb0119, 0xb011b, - 0xb011d, 0xb011f, 0xb0121, 0xb0123, 0xb0125, 0xb0127, 0xb0129, 0xb012b, 0xb012d, - 0xb012f, 0xb0131, 0xb0133, 0xb0135, 0xb0137, 0xb0138, 0xb013a, 0xb013c, 0xb013e, - 0xb0140, 0xb0142, 0xb0144, 0xb0146, 0xb0148, 0xb0149, 0xb014b, 0xb014d, 0xb014f, - 0xb0151, 0xb0153, 0xb0155, 0xb0157, 0xb0159, 0xb015b, 0xb015d, 0xb015f, 0xb0161, - 0xb0163, 0xb0165, 0xb0167, 0xb0169, 0xb016b, 0xb016d, 0xb016f, 0xb0171, 0xb0173, - 0xb0175, 0xb0177, 0xb017a, 0xb017c, 0xb0183, 0xb0185, 0xb0188, 0xb018c, 0xb018d, - 0xb0192, 0xb0195, 0xb019e, 0xb01a1, 0xb01a3, 0xb01a5, 0xb01a8, 0xb01aa, 0xb01ab, - 0xb01ad, 0xb01b0, 0xb01b4, 0xb01b6, 0xb01b9, 0xb01ba, 0xb01c6, 0xb01c9, 0xb01cc, - 0xb01ce, 0xb01d0, 0xb01d2, 0xb01d4, 0xb01d6, 0xb01d8, 0xb01da, 0xb01dc, 0xb01dd, - 0xb01df, 0xb01e1, 0xb01e3, 0xb01e5, 0xb01e7, 0xb01e9, 0xb01eb, 0xb01ed, 0xb01ef, - 0xb01f0, 0xb01f3, 0xb01f5, 0xb01f9, 0xb01fb, 0xb01fd, 0xb01ff, 0xb0201, 0xb0203, - 0xb0205, 0xb0207, 0xb0209, 0xb020b, 0xb020d, 0xb020f, 0xb0211, 0xb0213, 0xb0215, - 0xb0217, 0xb0219, 0xb021b, 0xb021d, 0xb021f, 0xb0221, 0xb0223, 0xb0225, 0xb0227, - 0xb0229, 0xb022b, 0xb022d, 0xb022f, 0xb0231, 0xb023c, 0xb023f, 0xb0240, 0xb0242, - 0xb0247, 0xb0249, 0xb024b, 0xb024d, 0xb0371, 0xb0373, 0xb0377, 0xb0390, 0xb03d0, - 0xb03d1, 0xb03d9, 0xb03db, 0xb03dd, 0xb03df, 0xb03e1, 0xb03e3, 0xb03e5, 0xb03e7, - 0xb03e9, 0xb03eb, 0xb03ed, 0xb03f5, 0xb03f8, 0xb03fb, 0xb03fc, 0xb0461, 0xb0463, - 0xb0465, 0xb0467, 0xb0469, 0xb046b, 0xb046d, 0xb046f, 0xb0471, 0xb0473, 0xb0475, - 0xb0477, 0xb0479, 0xb047b, 0xb047d, 0xb047f, 0xb0481, 0xb048b, 0xb048d, 0xb048f, - 0xb0491, 0xb0493, 0xb0495, 0xb0497, 0xb0499, 0xb049b, 0xb049d, 0xb049f, 0xb04a1, - 0xb04a3, 0xb04a5, 0xb04a7, 0xb04a9, 0xb04ab, 0xb04ad, 0xb04af, 0xb04b1, 0xb04b3, - 0xb04b5, 0xb04b7, 0xb04b9, 0xb04bb, 0xb04bd, 0xb04bf, 0xb04c2, 0xb04c4, 0xb04c6, - 0xb04c8, 0xb04ca, 0xb04cc, 0xb04ce, 0xb04cf, 0xb04d1, 0xb04d3, 0xb04d5, 0xb04d7, - 0xb04d9, 0xb04db, 0xb04dd, 0xb04df, 0xb04e1, 0xb04e3, 0xb04e5, 0xb04e7, 0xb04e9, - 0xb04eb, 0xb04ed, 0xb04ef, 0xb04f1, 0xb04f3, 0xb04f5, 0xb04f7, 0xb04f9, 0xb04fb, - 0xb04fd, 0xb04ff, 0xb0501, 0xb0503, 0xb0505, 0xb0507, 0xb0509, 0xb050b, 0xb050d, - 0xb050f, 0xb0511, 0xb0513, 0xb0515, 0xb0517, 0xb0519, 0xb051b, 0xb051d, 0xb051f, - 0xb0521, 0xb0523, 0xb0525, 0xb0527, 0xb0529, 0xb052b, 0xb052d, 0xb052f, 0xb1e01, - 0xb1e03, 0xb1e05, 0xb1e07, 0xb1e09, 0xb1e0b, 0xb1e0d, 0xb1e0f, 0xb1e11, 0xb1e13, - 0xb1e15, 0xb1e17, 0xb1e19, 0xb1e1b, 0xb1e1d, 0xb1e1f, 0xb1e21, 0xb1e23, 0xb1e25, - 0xb1e27, 0xb1e29, 0xb1e2b, 0xb1e2d, 0xb1e2f, 0xb1e31, 0xb1e33, 0xb1e35, 0xb1e37, - 0xb1e39, 0xb1e3b, 0xb1e3d, 0xb1e3f, 0xb1e41, 0xb1e43, 0xb1e45, 0xb1e47, 0xb1e49, - 0xb1e4b, 0xb1e4d, 0xb1e4f, 0xb1e51, 0xb1e53, 0xb1e55, 0xb1e57, 0xb1e59, 0xb1e5b, - 0xb1e5d, 0xb1e5f, 0xb1e61, 0xb1e63, 0xb1e65, 0xb1e67, 0xb1e69, 0xb1e6b, 0xb1e6d, - 0xb1e6f, 0xb1e71, 0xb1e73, 0xb1e75, 0xb1e77, 0xb1e79, 0xb1e7b, 0xb1e7d, 0xb1e7f, - 0xb1e81, 0xb1e83, 0xb1e85, 0xb1e87, 0xb1e89, 0xb1e8b, 0xb1e8d, 0xb1e8f, 0xb1e91, - 0xb1e93, 0xb1e9f, 0xb1ea1, 0xb1ea3, 0xb1ea5, 0xb1ea7, 0xb1ea9, 0xb1eab, 0xb1ead, - 0xb1eaf, 0xb1eb1, 0xb1eb3, 0xb1eb5, 0xb1eb7, 0xb1eb9, 0xb1ebb, 0xb1ebd, 0xb1ebf, - 0xb1ec1, 0xb1ec3, 0xb1ec5, 0xb1ec7, 0xb1ec9, 0xb1ecb, 0xb1ecd, 0xb1ecf, 0xb1ed1, - 0xb1ed3, 0xb1ed5, 0xb1ed7, 0xb1ed9, 0xb1edb, 0xb1edd, 0xb1edf, 0xb1ee1, 0xb1ee3, - 0xb1ee5, 0xb1ee7, 0xb1ee9, 0xb1eeb, 0xb1eed, 0xb1eef, 0xb1ef1, 0xb1ef3, 0xb1ef5, - 0xb1ef7, 0xb1ef9, 0xb1efb, 0xb1efd, 0xb1fb6, 0xb1fb7, 0xb1fbe, 0xb1fc6, 0xb1fc7, - 0xb1fd6, 0xb1fd7, 0xb1ff6, 0xb1ff7, 0xb210a, 0xb210e, 0xb210f, 0xb2113, 0xb212f, - 0xb2134, 0xb2139, 0xb213c, 0xb213d, 0xb214e, 0xb2184, 0xb2c61, 0xb2c65, 0xb2c66, - 0xb2c68, 0xb2c6a, 0xb2c6c, 0xb2c71, 0xb2c73, 0xb2c74, 0xb2c81, 0xb2c83, 0xb2c85, - 0xb2c87, 0xb2c89, 0xb2c8b, 0xb2c8d, 0xb2c8f, 0xb2c91, 0xb2c93, 0xb2c95, 0xb2c97, - 0xb2c99, 0xb2c9b, 0xb2c9d, 0xb2c9f, 0xb2ca1, 0xb2ca3, 0xb2ca5, 0xb2ca7, 0xb2ca9, - 0xb2cab, 0xb2cad, 0xb2caf, 0xb2cb1, 0xb2cb3, 0xb2cb5, 0xb2cb7, 0xb2cb9, 0xb2cbb, - 0xb2cbd, 0xb2cbf, 0xb2cc1, 0xb2cc3, 0xb2cc5, 0xb2cc7, 0xb2cc9, 0xb2ccb, 0xb2ccd, - 0xb2ccf, 0xb2cd1, 0xb2cd3, 0xb2cd5, 0xb2cd7, 0xb2cd9, 0xb2cdb, 0xb2cdd, 0xb2cdf, - 0xb2ce1, 0xb2ce3, 0xb2ce4, 0xb2cec, 0xb2cee, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xba641, - 0xba643, 0xba645, 0xba647, 0xba649, 0xba64b, 0xba64d, 0xba64f, 0xba651, 0xba653, - 0xba655, 0xba657, 0xba659, 0xba65b, 0xba65d, 0xba65f, 0xba661, 0xba663, 0xba665, - 0xba667, 0xba669, 0xba66b, 0xba66d, 0xba681, 0xba683, 0xba685, 0xba687, 0xba689, - 0xba68b, 0xba68d, 0xba68f, 0xba691, 0xba693, 0xba695, 0xba697, 0xba699, 0xba69b, - 0xba723, 0xba725, 0xba727, 0xba729, 0xba72b, 0xba72d, 0xba733, 0xba735, 0xba737, - 0xba739, 0xba73b, 0xba73d, 0xba73f, 0xba741, 0xba743, 0xba745, 0xba747, 0xba749, - 0xba74b, 0xba74d, 0xba74f, 0xba751, 0xba753, 0xba755, 0xba757, 0xba759, 0xba75b, - 0xba75d, 0xba75f, 0xba761, 0xba763, 0xba765, 0xba767, 0xba769, 0xba76b, 0xba76d, - 0xba76f, 0xba77a, 0xba77c, 0xba77f, 0xba781, 0xba783, 0xba785, 0xba787, 0xba78c, - 0xba78e, 0xba791, 0xba797, 0xba799, 0xba79b, 0xba79d, 0xba79f, 0xba7a1, 0xba7a3, - 0xba7a5, 0xba7a7, 0xba7a9, 0xba7b5, 0xba7b7, 0xba7fa, 0xc00b5, 0xc0101, 0xc0103, - 0xc0105, 0xc0107, 0xc0109, 0xc010b, 0xc010d, 0xc010f, 0xc0111, 0xc0113, 0xc0115, - 0xc0117, 0xc0119, 0xc011b, 0xc011d, 0xc011f, 0xc0121, 0xc0123, 0xc0125, 0xc0127, - 0xc0129, 0xc012b, 0xc012d, 0xc012f, 0xc0131, 0xc0133, 0xc0135, 0xc0137, 0xc0138, - 0xc013a, 0xc013c, 0xc013e, 0xc0140, 0xc0142, 0xc0144, 0xc0146, 0xc0148, 0xc0149, - 0xc014b, 0xc014d, 0xc014f, 0xc0151, 0xc0153, 0xc0155, 0xc0157, 0xc0159, 0xc015b, - 0xc015d, 0xc015f, 0xc0161, 0xc0163, 0xc0165, 0xc0167, 0xc0169, 0xc016b, 0xc016d, - 0xc016f, 0xc0171, 0xc0173, 0xc0175, 0xc0177, 0xc017a, 0xc017c, 0xc0183, 0xc0185, - 0xc0188, 0xc018c, 0xc018d, 0xc0192, 0xc0195, 0xc019e, 0xc01a1, 0xc01a3, 0xc01a5, - 0xc01a8, 0xc01aa, 0xc01ab, 0xc01ad, 0xc01b0, 0xc01b4, 0xc01b6, 0xc01b9, 0xc01ba, - 0xc01c6, 0xc01c9, 0xc01cc, 0xc01ce, 0xc01d0, 0xc01d2, 0xc01d4, 0xc01d6, 0xc01d8, - 0xc01da, 0xc01dc, 0xc01dd, 0xc01df, 0xc01e1, 0xc01e3, 0xc01e5, 0xc01e7, 0xc01e9, - 0xc01eb, 0xc01ed, 0xc01ef, 0xc01f0, 0xc01f3, 0xc01f5, 0xc01f9, 0xc01fb, 0xc01fd, - 0xc01ff, 0xc0201, 0xc0203, 0xc0205, 0xc0207, 0xc0209, 0xc020b, 0xc020d, 0xc020f, - 0xc0211, 0xc0213, 0xc0215, 0xc0217, 0xc0219, 0xc021b, 0xc021d, 0xc021f, 0xc0221, - 0xc0223, 0xc0225, 0xc0227, 0xc0229, 0xc022b, 0xc022d, 0xc022f, 0xc0231, 0xc023c, - 0xc023f, 0xc0240, 0xc0242, 0xc0247, 0xc0249, 0xc024b, 0xc024d, 0xc0371, 0xc0373, - 0xc0377, 0xc0390, 0xc03d0, 0xc03d1, 0xc03d9, 0xc03db, 0xc03dd, 0xc03df, 0xc03e1, - 0xc03e3, 0xc03e5, 0xc03e7, 0xc03e9, 0xc03eb, 0xc03ed, 0xc03f5, 0xc03f8, 0xc03fb, - 0xc03fc, 0xc0461, 0xc0463, 0xc0465, 0xc0467, 0xc0469, 0xc046b, 0xc046d, 0xc046f, - 0xc0471, 0xc0473, 0xc0475, 0xc0477, 0xc0479, 0xc047b, 0xc047d, 0xc047f, 0xc0481, - 0xc048b, 0xc048d, 0xc048f, 0xc0491, 0xc0493, 0xc0495, 0xc0497, 0xc0499, 0xc049b, - 0xc049d, 0xc049f, 0xc04a1, 0xc04a3, 0xc04a5, 0xc04a7, 0xc04a9, 0xc04ab, 0xc04ad, - 0xc04af, 0xc04b1, 0xc04b3, 0xc04b5, 0xc04b7, 0xc04b9, 0xc04bb, 0xc04bd, 0xc04bf, - 0xc04c2, 0xc04c4, 0xc04c6, 0xc04c8, 0xc04ca, 0xc04cc, 0xc04ce, 0xc04cf, 0xc04d1, - 0xc04d3, 0xc04d5, 0xc04d7, 0xc04d9, 0xc04db, 0xc04dd, 0xc04df, 0xc04e1, 0xc04e3, - 0xc04e5, 0xc04e7, 0xc04e9, 0xc04eb, 0xc04ed, 0xc04ef, 0xc04f1, 0xc04f3, 0xc04f5, - 0xc04f7, 0xc04f9, 0xc04fb, 0xc04fd, 0xc04ff, 0xc0501, 0xc0503, 0xc0505, 0xc0507, - 0xc0509, 0xc050b, 0xc050d, 0xc050f, 0xc0511, 0xc0513, 0xc0515, 0xc0517, 0xc0519, - 0xc051b, 0xc051d, 0xc051f, 0xc0521, 0xc0523, 0xc0525, 0xc0527, 0xc0529, 0xc052b, - 0xc052d, 0xc052f, 0xc1e01, 0xc1e03, 0xc1e05, 0xc1e07, 0xc1e09, 0xc1e0b, 0xc1e0d, - 0xc1e0f, 0xc1e11, 0xc1e13, 0xc1e15, 0xc1e17, 0xc1e19, 0xc1e1b, 0xc1e1d, 0xc1e1f, - 0xc1e21, 0xc1e23, 0xc1e25, 0xc1e27, 0xc1e29, 0xc1e2b, 0xc1e2d, 0xc1e2f, 0xc1e31, - 0xc1e33, 0xc1e35, 0xc1e37, 0xc1e39, 0xc1e3b, 0xc1e3d, 0xc1e3f, 0xc1e41, 0xc1e43, - 0xc1e45, 0xc1e47, 0xc1e49, 0xc1e4b, 0xc1e4d, 0xc1e4f, 0xc1e51, 0xc1e53, 0xc1e55, - 0xc1e57, 0xc1e59, 0xc1e5b, 0xc1e5d, 0xc1e5f, 0xc1e61, 0xc1e63, 0xc1e65, 0xc1e67, - 0xc1e69, 0xc1e6b, 0xc1e6d, 0xc1e6f, 0xc1e71, 0xc1e73, 0xc1e75, 0xc1e77, 0xc1e79, - 0xc1e7b, 0xc1e7d, 0xc1e7f, 0xc1e81, 0xc1e83, 0xc1e85, 0xc1e87, 0xc1e89, 0xc1e8b, - 0xc1e8d, 0xc1e8f, 0xc1e91, 0xc1e93, 0xc1e9f, 0xc1ea1, 0xc1ea3, 0xc1ea5, 0xc1ea7, - 0xc1ea9, 0xc1eab, 0xc1ead, 0xc1eaf, 0xc1eb1, 0xc1eb3, 0xc1eb5, 0xc1eb7, 0xc1eb9, - 0xc1ebb, 0xc1ebd, 0xc1ebf, 0xc1ec1, 0xc1ec3, 0xc1ec5, 0xc1ec7, 0xc1ec9, 0xc1ecb, - 0xc1ecd, 0xc1ecf, 0xc1ed1, 0xc1ed3, 0xc1ed5, 0xc1ed7, 0xc1ed9, 0xc1edb, 0xc1edd, - 0xc1edf, 0xc1ee1, 0xc1ee3, 0xc1ee5, 0xc1ee7, 0xc1ee9, 0xc1eeb, 0xc1eed, 0xc1eef, - 0xc1ef1, 0xc1ef3, 0xc1ef5, 0xc1ef7, 0xc1ef9, 0xc1efb, 0xc1efd, 0xc1fb6, 0xc1fb7, - 0xc1fbe, 0xc1fc6, 0xc1fc7, 0xc1fd6, 0xc1fd7, 0xc1ff6, 0xc1ff7, 0xc210a, 0xc210e, - 0xc210f, 0xc2113, 0xc212f, 0xc2134, 0xc2139, 0xc213c, 0xc213d, 0xc214e, 0xc2184, - 0xc2c61, 0xc2c65, 0xc2c66, 0xc2c68, 0xc2c6a, 0xc2c6c, 0xc2c71, 0xc2c73, 0xc2c74, - 0xc2c81, 0xc2c83, 0xc2c85, 0xc2c87, 0xc2c89, 0xc2c8b, 0xc2c8d, 0xc2c8f, 0xc2c91, - 0xc2c93, 0xc2c95, 0xc2c97, 0xc2c99, 0xc2c9b, 0xc2c9d, 0xc2c9f, 0xc2ca1, 0xc2ca3, - 0xc2ca5, 0xc2ca7, 0xc2ca9, 0xc2cab, 0xc2cad, 0xc2caf, 0xc2cb1, 0xc2cb3, 0xc2cb5, - 0xc2cb7, 0xc2cb9, 0xc2cbb, 0xc2cbd, 0xc2cbf, 0xc2cc1, 0xc2cc3, 0xc2cc5, 0xc2cc7, - 0xc2cc9, 0xc2ccb, 0xc2ccd, 0xc2ccf, 0xc2cd1, 0xc2cd3, 0xc2cd5, 0xc2cd7, 0xc2cd9, - 0xc2cdb, 0xc2cdd, 0xc2cdf, 0xc2ce1, 0xc2ce3, 0xc2ce4, 0xc2cec, 0xc2cee, 0xc2cf3, - 0xc2d27, 0xc2d2d, 0xca641, 0xca643, 0xca645, 0xca647, 0xca649, 0xca64b, 0xca64d, - 0xca64f, 0xca651, 0xca653, 0xca655, 0xca657, 0xca659, 0xca65b, 0xca65d, 0xca65f, - 0xca661, 0xca663, 0xca665, 0xca667, 0xca669, 0xca66b, 0xca66d, 0xca681, 0xca683, - 0xca685, 0xca687, 0xca689, 0xca68b, 0xca68d, 0xca68f, 0xca691, 0xca693, 0xca695, - 0xca697, 0xca699, 0xca69b, 0xca723, 0xca725, 0xca727, 0xca729, 0xca72b, 0xca72d, - 0xca733, 0xca735, 0xca737, 0xca739, 0xca73b, 0xca73d, 0xca73f, 0xca741, 0xca743, - 0xca745, 0xca747, 0xca749, 0xca74b, 0xca74d, 0xca74f, 0xca751, 0xca753, 0xca755, - 0xca757, 0xca759, 0xca75b, 0xca75d, 0xca75f, 0xca761, 0xca763, 0xca765, 0xca767, - 0xca769, 0xca76b, 0xca76d, 0xca76f, 0xca77a, 0xca77c, 0xca77f, 0xca781, 0xca783, - 0xca785, 0xca787, 0xca78c, 0xca78e, 0xca791, 0xca797, 0xca799, 0xca79b, 0xca79d, - 0xca79f, 0xca7a1, 0xca7a3, 0xca7a5, 0xca7a7, 0xca7a9, 0xca7b5, 0xca7b7, 0xca7fa, - 0xd00b5, 0xd0101, 0xd0103, 0xd0105, 0xd0107, 0xd0109, 0xd010b, 0xd010d, 0xd010f, - 0xd0111, 0xd0113, 0xd0115, 0xd0117, 0xd0119, 0xd011b, 0xd011d, 0xd011f, 0xd0121, - 0xd0123, 0xd0125, 0xd0127, 0xd0129, 0xd012b, 0xd012d, 0xd012f, 0xd0131, 0xd0133, - 0xd0135, 0xd0137, 0xd0138, 0xd013a, 0xd013c, 0xd013e, 0xd0140, 0xd0142, 0xd0144, - 0xd0146, 0xd0148, 0xd0149, 0xd014b, 0xd014d, 0xd014f, 0xd0151, 0xd0153, 0xd0155, - 0xd0157, 0xd0159, 0xd015b, 0xd015d, 0xd015f, 0xd0161, 0xd0163, 0xd0165, 0xd0167, - 0xd0169, 0xd016b, 0xd016d, 0xd016f, 0xd0171, 0xd0173, 0xd0175, 0xd0177, 0xd017a, - 0xd017c, 0xd0183, 0xd0185, 0xd0188, 0xd018c, 0xd018d, 0xd0192, 0xd0195, 0xd019e, - 0xd01a1, 0xd01a3, 0xd01a5, 0xd01a8, 0xd01aa, 0xd01ab, 0xd01ad, 0xd01b0, 0xd01b4, - 0xd01b6, 0xd01b9, 0xd01ba, 0xd01c6, 0xd01c9, 0xd01cc, 0xd01ce, 0xd01d0, 0xd01d2, - 0xd01d4, 0xd01d6, 0xd01d8, 0xd01da, 0xd01dc, 0xd01dd, 0xd01df, 0xd01e1, 0xd01e3, - 0xd01e5, 0xd01e7, 0xd01e9, 0xd01eb, 0xd01ed, 0xd01ef, 0xd01f0, 0xd01f3, 0xd01f5, - 0xd01f9, 0xd01fb, 0xd01fd, 0xd01ff, 0xd0201, 0xd0203, 0xd0205, 0xd0207, 0xd0209, - 0xd020b, 0xd020d, 0xd020f, 0xd0211, 0xd0213, 0xd0215, 0xd0217, 0xd0219, 0xd021b, - 0xd021d, 0xd021f, 0xd0221, 0xd0223, 0xd0225, 0xd0227, 0xd0229, 0xd022b, 0xd022d, - 0xd022f, 0xd0231, 0xd023c, 0xd023f, 0xd0240, 0xd0242, 0xd0247, 0xd0249, 0xd024b, - 0xd024d, 0xd0371, 0xd0373, 0xd0377, 0xd0390, 0xd03d0, 0xd03d1, 0xd03d9, 0xd03db, - 0xd03dd, 0xd03df, 0xd03e1, 0xd03e3, 0xd03e5, 0xd03e7, 0xd03e9, 0xd03eb, 0xd03ed, - 0xd03f5, 0xd03f8, 0xd03fb, 0xd03fc, 0xd0461, 0xd0463, 0xd0465, 0xd0467, 0xd0469, - 0xd046b, 0xd046d, 0xd046f, 0xd0471, 0xd0473, 0xd0475, 0xd0477, 0xd0479, 0xd047b, - 0xd047d, 0xd047f, 0xd0481, 0xd048b, 0xd048d, 0xd048f, 0xd0491, 0xd0493, 0xd0495, - 0xd0497, 0xd0499, 0xd049b, 0xd049d, 0xd049f, 0xd04a1, 0xd04a3, 0xd04a5, 0xd04a7, - 0xd04a9, 0xd04ab, 0xd04ad, 0xd04af, 0xd04b1, 0xd04b3, 0xd04b5, 0xd04b7, 0xd04b9, - 0xd04bb, 0xd04bd, 0xd04bf, 0xd04c2, 0xd04c4, 0xd04c6, 0xd04c8, 0xd04ca, 0xd04cc, - 0xd04ce, 0xd04cf, 0xd04d1, 0xd04d3, 0xd04d5, 0xd04d7, 0xd04d9, 0xd04db, 0xd04dd, - 0xd04df, 0xd04e1, 0xd04e3, 0xd04e5, 0xd04e7, 0xd04e9, 0xd04eb, 0xd04ed, 0xd04ef, - 0xd04f1, 0xd04f3, 0xd04f5, 0xd04f7, 0xd04f9, 0xd04fb, 0xd04fd, 0xd04ff, 0xd0501, - 0xd0503, 0xd0505, 0xd0507, 0xd0509, 0xd050b, 0xd050d, 0xd050f, 0xd0511, 0xd0513, - 0xd0515, 0xd0517, 0xd0519, 0xd051b, 0xd051d, 0xd051f, 0xd0521, 0xd0523, 0xd0525, - 0xd0527, 0xd0529, 0xd052b, 0xd052d, 0xd052f, 0xd1e01, 0xd1e03, 0xd1e05, 0xd1e07, - 0xd1e09, 0xd1e0b, 0xd1e0d, 0xd1e0f, 0xd1e11, 0xd1e13, 0xd1e15, 0xd1e17, 0xd1e19, - 0xd1e1b, 0xd1e1d, 0xd1e1f, 0xd1e21, 0xd1e23, 0xd1e25, 0xd1e27, 0xd1e29, 0xd1e2b, - 0xd1e2d, 0xd1e2f, 0xd1e31, 0xd1e33, 0xd1e35, 0xd1e37, 0xd1e39, 0xd1e3b, 0xd1e3d, - 0xd1e3f, 0xd1e41, 0xd1e43, 0xd1e45, 0xd1e47, 0xd1e49, 0xd1e4b, 0xd1e4d, 0xd1e4f, - 0xd1e51, 0xd1e53, 0xd1e55, 0xd1e57, 0xd1e59, 0xd1e5b, 0xd1e5d, 0xd1e5f, 0xd1e61, - 0xd1e63, 0xd1e65, 0xd1e67, 0xd1e69, 0xd1e6b, 0xd1e6d, 0xd1e6f, 0xd1e71, 0xd1e73, - 0xd1e75, 0xd1e77, 0xd1e79, 0xd1e7b, 0xd1e7d, 0xd1e7f, 0xd1e81, 0xd1e83, 0xd1e85, - 0xd1e87, 0xd1e89, 0xd1e8b, 0xd1e8d, 0xd1e8f, 0xd1e91, 0xd1e93, 0xd1e9f, 0xd1ea1, - 0xd1ea3, 0xd1ea5, 0xd1ea7, 0xd1ea9, 0xd1eab, 0xd1ead, 0xd1eaf, 0xd1eb1, 0xd1eb3, - 0xd1eb5, 0xd1eb7, 0xd1eb9, 0xd1ebb, 0xd1ebd, 0xd1ebf, 0xd1ec1, 0xd1ec3, 0xd1ec5, - 0xd1ec7, 0xd1ec9, 0xd1ecb, 0xd1ecd, 0xd1ecf, 0xd1ed1, 0xd1ed3, 0xd1ed5, 0xd1ed7, - 0xd1ed9, 0xd1edb, 0xd1edd, 0xd1edf, 0xd1ee1, 0xd1ee3, 0xd1ee5, 0xd1ee7, 0xd1ee9, - 0xd1eeb, 0xd1eed, 0xd1eef, 0xd1ef1, 0xd1ef3, 0xd1ef5, 0xd1ef7, 0xd1ef9, 0xd1efb, - 0xd1efd, 0xd1fb6, 0xd1fb7, 0xd1fbe, 0xd1fc6, 0xd1fc7, 0xd1fd6, 0xd1fd7, 0xd1ff6, - 0xd1ff7, 0xd210a, 0xd210e, 0xd210f, 0xd2113, 0xd212f, 0xd2134, 0xd2139, 0xd213c, - 0xd213d, 0xd214e, 0xd2184, 0xd2c61, 0xd2c65, 0xd2c66, 0xd2c68, 0xd2c6a, 0xd2c6c, - 0xd2c71, 0xd2c73, 0xd2c74, 0xd2c81, 0xd2c83, 0xd2c85, 0xd2c87, 0xd2c89, 0xd2c8b, - 0xd2c8d, 0xd2c8f, 0xd2c91, 0xd2c93, 0xd2c95, 0xd2c97, 0xd2c99, 0xd2c9b, 0xd2c9d, - 0xd2c9f, 0xd2ca1, 0xd2ca3, 0xd2ca5, 0xd2ca7, 0xd2ca9, 0xd2cab, 0xd2cad, 0xd2caf, - 0xd2cb1, 0xd2cb3, 0xd2cb5, 0xd2cb7, 0xd2cb9, 0xd2cbb, 0xd2cbd, 0xd2cbf, 0xd2cc1, - 0xd2cc3, 0xd2cc5, 0xd2cc7, 0xd2cc9, 0xd2ccb, 0xd2ccd, 0xd2ccf, 0xd2cd1, 0xd2cd3, - 0xd2cd5, 0xd2cd7, 0xd2cd9, 0xd2cdb, 0xd2cdd, 0xd2cdf, 0xd2ce1, 0xd2ce3, 0xd2ce4, - 0xd2cec, 0xd2cee, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xda641, 0xda643, 0xda645, 0xda647, - 0xda649, 0xda64b, 0xda64d, 0xda64f, 0xda651, 0xda653, 0xda655, 0xda657, 0xda659, - 0xda65b, 0xda65d, 0xda65f, 0xda661, 0xda663, 0xda665, 0xda667, 0xda669, 0xda66b, - 0xda66d, 0xda681, 0xda683, 0xda685, 0xda687, 0xda689, 0xda68b, 0xda68d, 0xda68f, - 0xda691, 0xda693, 0xda695, 0xda697, 0xda699, 0xda69b, 0xda723, 0xda725, 0xda727, - 0xda729, 0xda72b, 0xda72d, 0xda733, 0xda735, 0xda737, 0xda739, 0xda73b, 0xda73d, - 0xda73f, 0xda741, 0xda743, 0xda745, 0xda747, 0xda749, 0xda74b, 0xda74d, 0xda74f, - 0xda751, 0xda753, 0xda755, 0xda757, 0xda759, 0xda75b, 0xda75d, 0xda75f, 0xda761, - 0xda763, 0xda765, 0xda767, 0xda769, 0xda76b, 0xda76d, 0xda76f, 0xda77a, 0xda77c, - 0xda77f, 0xda781, 0xda783, 0xda785, 0xda787, 0xda78c, 0xda78e, 0xda791, 0xda797, - 0xda799, 0xda79b, 0xda79d, 0xda79f, 0xda7a1, 0xda7a3, 0xda7a5, 0xda7a7, 0xda7a9, - 0xda7b5, 0xda7b7, 0xda7fa, 0xe00b5, 0xe0101, 0xe0103, 0xe0105, 0xe0107, 0xe0109, - 0xe010b, 0xe010d, 0xe010f, 0xe0111, 0xe0113, 0xe0115, 0xe0117, 0xe0119, 0xe011b, - 0xe011d, 0xe011f, 0xe0121, 0xe0123, 0xe0125, 0xe0127, 0xe0129, 0xe012b, 0xe012d, - 0xe012f, 0xe0131, 0xe0133, 0xe0135, 0xe0137, 0xe0138, 0xe013a, 0xe013c, 0xe013e, - 0xe0140, 0xe0142, 0xe0144, 0xe0146, 0xe0148, 0xe0149, 0xe014b, 0xe014d, 0xe014f, - 0xe0151, 0xe0153, 0xe0155, 0xe0157, 0xe0159, 0xe015b, 0xe015d, 0xe015f, 0xe0161, - 0xe0163, 0xe0165, 0xe0167, 0xe0169, 0xe016b, 0xe016d, 0xe016f, 0xe0171, 0xe0173, - 0xe0175, 0xe0177, 0xe017a, 0xe017c, 0xe0183, 0xe0185, 0xe0188, 0xe018c, 0xe018d, - 0xe0192, 0xe0195, 0xe019e, 0xe01a1, 0xe01a3, 0xe01a5, 0xe01a8, 0xe01aa, 0xe01ab, - 0xe01ad, 0xe01b0, 0xe01b4, 0xe01b6, 0xe01b9, 0xe01ba, 0xe01c6, 0xe01c9, 0xe01cc, - 0xe01ce, 0xe01d0, 0xe01d2, 0xe01d4, 0xe01d6, 0xe01d8, 0xe01da, 0xe01dc, 0xe01dd, - 0xe01df, 0xe01e1, 0xe01e3, 0xe01e5, 0xe01e7, 0xe01e9, 0xe01eb, 0xe01ed, 0xe01ef, - 0xe01f0, 0xe01f3, 0xe01f5, 0xe01f9, 0xe01fb, 0xe01fd, 0xe01ff, 0xe0201, 0xe0203, - 0xe0205, 0xe0207, 0xe0209, 0xe020b, 0xe020d, 0xe020f, 0xe0211, 0xe0213, 0xe0215, - 0xe0217, 0xe0219, 0xe021b, 0xe021d, 0xe021f, 0xe0221, 0xe0223, 0xe0225, 0xe0227, - 0xe0229, 0xe022b, 0xe022d, 0xe022f, 0xe0231, 0xe023c, 0xe023f, 0xe0240, 0xe0242, - 0xe0247, 0xe0249, 0xe024b, 0xe024d, 0xe0371, 0xe0373, 0xe0377, 0xe0390, 0xe03d0, - 0xe03d1, 0xe03d9, 0xe03db, 0xe03dd, 0xe03df, 0xe03e1, 0xe03e3, 0xe03e5, 0xe03e7, - 0xe03e9, 0xe03eb, 0xe03ed, 0xe03f5, 0xe03f8, 0xe03fb, 0xe03fc, 0xe0461, 0xe0463, - 0xe0465, 0xe0467, 0xe0469, 0xe046b, 0xe046d, 0xe046f, 0xe0471, 0xe0473, 0xe0475, - 0xe0477, 0xe0479, 0xe047b, 0xe047d, 0xe047f, 0xe0481, 0xe048b, 0xe048d, 0xe048f, - 0xe0491, 0xe0493, 0xe0495, 0xe0497, 0xe0499, 0xe049b, 0xe049d, 0xe049f, 0xe04a1, - 0xe04a3, 0xe04a5, 0xe04a7, 0xe04a9, 0xe04ab, 0xe04ad, 0xe04af, 0xe04b1, 0xe04b3, - 0xe04b5, 0xe04b7, 0xe04b9, 0xe04bb, 0xe04bd, 0xe04bf, 0xe04c2, 0xe04c4, 0xe04c6, - 0xe04c8, 0xe04ca, 0xe04cc, 0xe04ce, 0xe04cf, 0xe04d1, 0xe04d3, 0xe04d5, 0xe04d7, - 0xe04d9, 0xe04db, 0xe04dd, 0xe04df, 0xe04e1, 0xe04e3, 0xe04e5, 0xe04e7, 0xe04e9, - 0xe04eb, 0xe04ed, 0xe04ef, 0xe04f1, 0xe04f3, 0xe04f5, 0xe04f7, 0xe04f9, 0xe04fb, - 0xe04fd, 0xe04ff, 0xe0501, 0xe0503, 0xe0505, 0xe0507, 0xe0509, 0xe050b, 0xe050d, - 0xe050f, 0xe0511, 0xe0513, 0xe0515, 0xe0517, 0xe0519, 0xe051b, 0xe051d, 0xe051f, - 0xe0521, 0xe0523, 0xe0525, 0xe0527, 0xe0529, 0xe052b, 0xe052d, 0xe052f, 0xe1e01, - 0xe1e03, 0xe1e05, 0xe1e07, 0xe1e09, 0xe1e0b, 0xe1e0d, 0xe1e0f, 0xe1e11, 0xe1e13, - 0xe1e15, 0xe1e17, 0xe1e19, 0xe1e1b, 0xe1e1d, 0xe1e1f, 0xe1e21, 0xe1e23, 0xe1e25, - 0xe1e27, 0xe1e29, 0xe1e2b, 0xe1e2d, 0xe1e2f, 0xe1e31, 0xe1e33, 0xe1e35, 0xe1e37, - 0xe1e39, 0xe1e3b, 0xe1e3d, 0xe1e3f, 0xe1e41, 0xe1e43, 0xe1e45, 0xe1e47, 0xe1e49, - 0xe1e4b, 0xe1e4d, 0xe1e4f, 0xe1e51, 0xe1e53, 0xe1e55, 0xe1e57, 0xe1e59, 0xe1e5b, - 0xe1e5d, 0xe1e5f, 0xe1e61, 0xe1e63, 0xe1e65, 0xe1e67, 0xe1e69, 0xe1e6b, 0xe1e6d, - 0xe1e6f, 0xe1e71, 0xe1e73, 0xe1e75, 0xe1e77, 0xe1e79, 0xe1e7b, 0xe1e7d, 0xe1e7f, - 0xe1e81, 0xe1e83, 0xe1e85, 0xe1e87, 0xe1e89, 0xe1e8b, 0xe1e8d, 0xe1e8f, 0xe1e91, - 0xe1e93, 0xe1e9f, 0xe1ea1, 0xe1ea3, 0xe1ea5, 0xe1ea7, 0xe1ea9, 0xe1eab, 0xe1ead, - 0xe1eaf, 0xe1eb1, 0xe1eb3, 0xe1eb5, 0xe1eb7, 0xe1eb9, 0xe1ebb, 0xe1ebd, 0xe1ebf, - 0xe1ec1, 0xe1ec3, 0xe1ec5, 0xe1ec7, 0xe1ec9, 0xe1ecb, 0xe1ecd, 0xe1ecf, 0xe1ed1, - 0xe1ed3, 0xe1ed5, 0xe1ed7, 0xe1ed9, 0xe1edb, 0xe1edd, 0xe1edf, 0xe1ee1, 0xe1ee3, - 0xe1ee5, 0xe1ee7, 0xe1ee9, 0xe1eeb, 0xe1eed, 0xe1eef, 0xe1ef1, 0xe1ef3, 0xe1ef5, - 0xe1ef7, 0xe1ef9, 0xe1efb, 0xe1efd, 0xe1fb6, 0xe1fb7, 0xe1fbe, 0xe1fc6, 0xe1fc7, - 0xe1fd6, 0xe1fd7, 0xe1ff6, 0xe1ff7, 0xe210a, 0xe210e, 0xe210f, 0xe2113, 0xe212f, - 0xe2134, 0xe2139, 0xe213c, 0xe213d, 0xe214e, 0xe2184, 0xe2c61, 0xe2c65, 0xe2c66, - 0xe2c68, 0xe2c6a, 0xe2c6c, 0xe2c71, 0xe2c73, 0xe2c74, 0xe2c81, 0xe2c83, 0xe2c85, - 0xe2c87, 0xe2c89, 0xe2c8b, 0xe2c8d, 0xe2c8f, 0xe2c91, 0xe2c93, 0xe2c95, 0xe2c97, - 0xe2c99, 0xe2c9b, 0xe2c9d, 0xe2c9f, 0xe2ca1, 0xe2ca3, 0xe2ca5, 0xe2ca7, 0xe2ca9, - 0xe2cab, 0xe2cad, 0xe2caf, 0xe2cb1, 0xe2cb3, 0xe2cb5, 0xe2cb7, 0xe2cb9, 0xe2cbb, - 0xe2cbd, 0xe2cbf, 0xe2cc1, 0xe2cc3, 0xe2cc5, 0xe2cc7, 0xe2cc9, 0xe2ccb, 0xe2ccd, - 0xe2ccf, 0xe2cd1, 0xe2cd3, 0xe2cd5, 0xe2cd7, 0xe2cd9, 0xe2cdb, 0xe2cdd, 0xe2cdf, - 0xe2ce1, 0xe2ce3, 0xe2ce4, 0xe2cec, 0xe2cee, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xea641, - 0xea643, 0xea645, 0xea647, 0xea649, 0xea64b, 0xea64d, 0xea64f, 0xea651, 0xea653, - 0xea655, 0xea657, 0xea659, 0xea65b, 0xea65d, 0xea65f, 0xea661, 0xea663, 0xea665, - 0xea667, 0xea669, 0xea66b, 0xea66d, 0xea681, 0xea683, 0xea685, 0xea687, 0xea689, - 0xea68b, 0xea68d, 0xea68f, 0xea691, 0xea693, 0xea695, 0xea697, 0xea699, 0xea69b, - 0xea723, 0xea725, 0xea727, 0xea729, 0xea72b, 0xea72d, 0xea733, 0xea735, 0xea737, - 0xea739, 0xea73b, 0xea73d, 0xea73f, 0xea741, 0xea743, 0xea745, 0xea747, 0xea749, - 0xea74b, 0xea74d, 0xea74f, 0xea751, 0xea753, 0xea755, 0xea757, 0xea759, 0xea75b, - 0xea75d, 0xea75f, 0xea761, 0xea763, 0xea765, 0xea767, 0xea769, 0xea76b, 0xea76d, - 0xea76f, 0xea77a, 0xea77c, 0xea77f, 0xea781, 0xea783, 0xea785, 0xea787, 0xea78c, - 0xea78e, 0xea791, 0xea797, 0xea799, 0xea79b, 0xea79d, 0xea79f, 0xea7a1, 0xea7a3, - 0xea7a5, 0xea7a7, 0xea7a9, 0xea7b5, 0xea7b7, 0xea7fa, 0xf00b5, 0xf0101, 0xf0103, - 0xf0105, 0xf0107, 0xf0109, 0xf010b, 0xf010d, 0xf010f, 0xf0111, 0xf0113, 0xf0115, - 0xf0117, 0xf0119, 0xf011b, 0xf011d, 0xf011f, 0xf0121, 0xf0123, 0xf0125, 0xf0127, - 0xf0129, 0xf012b, 0xf012d, 0xf012f, 0xf0131, 0xf0133, 0xf0135, 0xf0137, 0xf0138, - 0xf013a, 0xf013c, 0xf013e, 0xf0140, 0xf0142, 0xf0144, 0xf0146, 0xf0148, 0xf0149, - 0xf014b, 0xf014d, 0xf014f, 0xf0151, 0xf0153, 0xf0155, 0xf0157, 0xf0159, 0xf015b, - 0xf015d, 0xf015f, 0xf0161, 0xf0163, 0xf0165, 0xf0167, 0xf0169, 0xf016b, 0xf016d, - 0xf016f, 0xf0171, 0xf0173, 0xf0175, 0xf0177, 0xf017a, 0xf017c, 0xf0183, 0xf0185, - 0xf0188, 0xf018c, 0xf018d, 0xf0192, 0xf0195, 0xf019e, 0xf01a1, 0xf01a3, 0xf01a5, - 0xf01a8, 0xf01aa, 0xf01ab, 0xf01ad, 0xf01b0, 0xf01b4, 0xf01b6, 0xf01b9, 0xf01ba, - 0xf01c6, 0xf01c9, 0xf01cc, 0xf01ce, 0xf01d0, 0xf01d2, 0xf01d4, 0xf01d6, 0xf01d8, - 0xf01da, 0xf01dc, 0xf01dd, 0xf01df, 0xf01e1, 0xf01e3, 0xf01e5, 0xf01e7, 0xf01e9, - 0xf01eb, 0xf01ed, 0xf01ef, 0xf01f0, 0xf01f3, 0xf01f5, 0xf01f9, 0xf01fb, 0xf01fd, - 0xf01ff, 0xf0201, 0xf0203, 0xf0205, 0xf0207, 0xf0209, 0xf020b, 0xf020d, 0xf020f, - 0xf0211, 0xf0213, 0xf0215, 0xf0217, 0xf0219, 0xf021b, 0xf021d, 0xf021f, 0xf0221, - 0xf0223, 0xf0225, 0xf0227, 0xf0229, 0xf022b, 0xf022d, 0xf022f, 0xf0231, 0xf023c, - 0xf023f, 0xf0240, 0xf0242, 0xf0247, 0xf0249, 0xf024b, 0xf024d, 0xf0371, 0xf0373, - 0xf0377, 0xf0390, 0xf03d0, 0xf03d1, 0xf03d9, 0xf03db, 0xf03dd, 0xf03df, 0xf03e1, - 0xf03e3, 0xf03e5, 0xf03e7, 0xf03e9, 0xf03eb, 0xf03ed, 0xf03f5, 0xf03f8, 0xf03fb, - 0xf03fc, 0xf0461, 0xf0463, 0xf0465, 0xf0467, 0xf0469, 0xf046b, 0xf046d, 0xf046f, - 0xf0471, 0xf0473, 0xf0475, 0xf0477, 0xf0479, 0xf047b, 0xf047d, 0xf047f, 0xf0481, - 0xf048b, 0xf048d, 0xf048f, 0xf0491, 0xf0493, 0xf0495, 0xf0497, 0xf0499, 0xf049b, - 0xf049d, 0xf049f, 0xf04a1, 0xf04a3, 0xf04a5, 0xf04a7, 0xf04a9, 0xf04ab, 0xf04ad, - 0xf04af, 0xf04b1, 0xf04b3, 0xf04b5, 0xf04b7, 0xf04b9, 0xf04bb, 0xf04bd, 0xf04bf, - 0xf04c2, 0xf04c4, 0xf04c6, 0xf04c8, 0xf04ca, 0xf04cc, 0xf04ce, 0xf04cf, 0xf04d1, - 0xf04d3, 0xf04d5, 0xf04d7, 0xf04d9, 0xf04db, 0xf04dd, 0xf04df, 0xf04e1, 0xf04e3, - 0xf04e5, 0xf04e7, 0xf04e9, 0xf04eb, 0xf04ed, 0xf04ef, 0xf04f1, 0xf04f3, 0xf04f5, - 0xf04f7, 0xf04f9, 0xf04fb, 0xf04fd, 0xf04ff, 0xf0501, 0xf0503, 0xf0505, 0xf0507, - 0xf0509, 0xf050b, 0xf050d, 0xf050f, 0xf0511, 0xf0513, 0xf0515, 0xf0517, 0xf0519, - 0xf051b, 0xf051d, 0xf051f, 0xf0521, 0xf0523, 0xf0525, 0xf0527, 0xf0529, 0xf052b, - 0xf052d, 0xf052f, 0xf1e01, 0xf1e03, 0xf1e05, 0xf1e07, 0xf1e09, 0xf1e0b, 0xf1e0d, - 0xf1e0f, 0xf1e11, 0xf1e13, 0xf1e15, 0xf1e17, 0xf1e19, 0xf1e1b, 0xf1e1d, 0xf1e1f, - 0xf1e21, 0xf1e23, 0xf1e25, 0xf1e27, 0xf1e29, 0xf1e2b, 0xf1e2d, 0xf1e2f, 0xf1e31, - 0xf1e33, 0xf1e35, 0xf1e37, 0xf1e39, 0xf1e3b, 0xf1e3d, 0xf1e3f, 0xf1e41, 0xf1e43, - 0xf1e45, 0xf1e47, 0xf1e49, 0xf1e4b, 0xf1e4d, 0xf1e4f, 0xf1e51, 0xf1e53, 0xf1e55, - 0xf1e57, 0xf1e59, 0xf1e5b, 0xf1e5d, 0xf1e5f, 0xf1e61, 0xf1e63, 0xf1e65, 0xf1e67, - 0xf1e69, 0xf1e6b, 0xf1e6d, 0xf1e6f, 0xf1e71, 0xf1e73, 0xf1e75, 0xf1e77, 0xf1e79, - 0xf1e7b, 0xf1e7d, 0xf1e7f, 0xf1e81, 0xf1e83, 0xf1e85, 0xf1e87, 0xf1e89, 0xf1e8b, - 0xf1e8d, 0xf1e8f, 0xf1e91, 0xf1e93, 0xf1e9f, 0xf1ea1, 0xf1ea3, 0xf1ea5, 0xf1ea7, - 0xf1ea9, 0xf1eab, 0xf1ead, 0xf1eaf, 0xf1eb1, 0xf1eb3, 0xf1eb5, 0xf1eb7, 0xf1eb9, - 0xf1ebb, 0xf1ebd, 0xf1ebf, 0xf1ec1, 0xf1ec3, 0xf1ec5, 0xf1ec7, 0xf1ec9, 0xf1ecb, - 0xf1ecd, 0xf1ecf, 0xf1ed1, 0xf1ed3, 0xf1ed5, 0xf1ed7, 0xf1ed9, 0xf1edb, 0xf1edd, - 0xf1edf, 0xf1ee1, 0xf1ee3, 0xf1ee5, 0xf1ee7, 0xf1ee9, 0xf1eeb, 0xf1eed, 0xf1eef, - 0xf1ef1, 0xf1ef3, 0xf1ef5, 0xf1ef7, 0xf1ef9, 0xf1efb, 0xf1efd, 0xf1fb6, 0xf1fb7, - 0xf1fbe, 0xf1fc6, 0xf1fc7, 0xf1fd6, 0xf1fd7, 0xf1ff6, 0xf1ff7, 0xf210a, 0xf210e, - 0xf210f, 0xf2113, 0xf212f, 0xf2134, 0xf2139, 0xf213c, 0xf213d, 0xf214e, 0xf2184, - 0xf2c61, 0xf2c65, 0xf2c66, 0xf2c68, 0xf2c6a, 0xf2c6c, 0xf2c71, 0xf2c73, 0xf2c74, - 0xf2c81, 0xf2c83, 0xf2c85, 0xf2c87, 0xf2c89, 0xf2c8b, 0xf2c8d, 0xf2c8f, 0xf2c91, - 0xf2c93, 0xf2c95, 0xf2c97, 0xf2c99, 0xf2c9b, 0xf2c9d, 0xf2c9f, 0xf2ca1, 0xf2ca3, - 0xf2ca5, 0xf2ca7, 0xf2ca9, 0xf2cab, 0xf2cad, 0xf2caf, 0xf2cb1, 0xf2cb3, 0xf2cb5, - 0xf2cb7, 0xf2cb9, 0xf2cbb, 0xf2cbd, 0xf2cbf, 0xf2cc1, 0xf2cc3, 0xf2cc5, 0xf2cc7, - 0xf2cc9, 0xf2ccb, 0xf2ccd, 0xf2ccf, 0xf2cd1, 0xf2cd3, 0xf2cd5, 0xf2cd7, 0xf2cd9, - 0xf2cdb, 0xf2cdd, 0xf2cdf, 0xf2ce1, 0xf2ce3, 0xf2ce4, 0xf2cec, 0xf2cee, 0xf2cf3, - 0xf2d27, 0xf2d2d, 0xfa641, 0xfa643, 0xfa645, 0xfa647, 0xfa649, 0xfa64b, 0xfa64d, - 0xfa64f, 0xfa651, 0xfa653, 0xfa655, 0xfa657, 0xfa659, 0xfa65b, 0xfa65d, 0xfa65f, - 0xfa661, 0xfa663, 0xfa665, 0xfa667, 0xfa669, 0xfa66b, 0xfa66d, 0xfa681, 0xfa683, - 0xfa685, 0xfa687, 0xfa689, 0xfa68b, 0xfa68d, 0xfa68f, 0xfa691, 0xfa693, 0xfa695, - 0xfa697, 0xfa699, 0xfa69b, 0xfa723, 0xfa725, 0xfa727, 0xfa729, 0xfa72b, 0xfa72d, - 0xfa733, 0xfa735, 0xfa737, 0xfa739, 0xfa73b, 0xfa73d, 0xfa73f, 0xfa741, 0xfa743, - 0xfa745, 0xfa747, 0xfa749, 0xfa74b, 0xfa74d, 0xfa74f, 0xfa751, 0xfa753, 0xfa755, - 0xfa757, 0xfa759, 0xfa75b, 0xfa75d, 0xfa75f, 0xfa761, 0xfa763, 0xfa765, 0xfa767, - 0xfa769, 0xfa76b, 0xfa76d, 0xfa76f, 0xfa77a, 0xfa77c, 0xfa77f, 0xfa781, 0xfa783, - 0xfa785, 0xfa787, 0xfa78c, 0xfa78e, 0xfa791, 0xfa797, 0xfa799, 0xfa79b, 0xfa79d, - 0xfa79f, 0xfa7a1, 0xfa7a3, 0xfa7a5, 0xfa7a7, 0xfa7a9, 0xfa7b5, 0xfa7b7, 0xfa7fa, - 0x1000b5, 0x100101, 0x100103, 0x100105, 0x100107, 0x100109, 0x10010b, 0x10010d, 0x10010f, - 0x100111, 0x100113, 0x100115, 0x100117, 0x100119, 0x10011b, 0x10011d, 0x10011f, 0x100121, - 0x100123, 0x100125, 0x100127, 0x100129, 0x10012b, 0x10012d, 0x10012f, 0x100131, 0x100133, - 0x100135, 0x100137, 0x100138, 0x10013a, 0x10013c, 0x10013e, 0x100140, 0x100142, 0x100144, - 0x100146, 0x100148, 0x100149, 0x10014b, 0x10014d, 0x10014f, 0x100151, 0x100153, 0x100155, - 0x100157, 0x100159, 0x10015b, 0x10015d, 0x10015f, 0x100161, 0x100163, 0x100165, 0x100167, - 0x100169, 0x10016b, 0x10016d, 0x10016f, 0x100171, 0x100173, 0x100175, 0x100177, 0x10017a, - 0x10017c, 0x100183, 0x100185, 0x100188, 0x10018c, 0x10018d, 0x100192, 0x100195, 0x10019e, - 0x1001a1, 0x1001a3, 0x1001a5, 0x1001a8, 0x1001aa, 0x1001ab, 0x1001ad, 0x1001b0, 0x1001b4, - 0x1001b6, 0x1001b9, 0x1001ba, 0x1001c6, 0x1001c9, 0x1001cc, 0x1001ce, 0x1001d0, 0x1001d2, - 0x1001d4, 0x1001d6, 0x1001d8, 0x1001da, 0x1001dc, 0x1001dd, 0x1001df, 0x1001e1, 0x1001e3, - 0x1001e5, 0x1001e7, 0x1001e9, 0x1001eb, 0x1001ed, 0x1001ef, 0x1001f0, 0x1001f3, 0x1001f5, - 0x1001f9, 0x1001fb, 0x1001fd, 0x1001ff, 0x100201, 0x100203, 0x100205, 0x100207, 0x100209, - 0x10020b, 0x10020d, 0x10020f, 0x100211, 0x100213, 0x100215, 0x100217, 0x100219, 0x10021b, - 0x10021d, 0x10021f, 0x100221, 0x100223, 0x100225, 0x100227, 0x100229, 0x10022b, 0x10022d, - 0x10022f, 0x100231, 0x10023c, 0x10023f, 0x100240, 0x100242, 0x100247, 0x100249, 0x10024b, - 0x10024d, 0x100371, 0x100373, 0x100377, 0x100390, 0x1003d0, 0x1003d1, 0x1003d9, 0x1003db, - 0x1003dd, 0x1003df, 0x1003e1, 0x1003e3, 0x1003e5, 0x1003e7, 0x1003e9, 0x1003eb, 0x1003ed, - 0x1003f5, 0x1003f8, 0x1003fb, 0x1003fc, 0x100461, 0x100463, 0x100465, 0x100467, 0x100469, - 0x10046b, 0x10046d, 0x10046f, 0x100471, 0x100473, 0x100475, 0x100477, 0x100479, 0x10047b, - 0x10047d, 0x10047f, 0x100481, 0x10048b, 0x10048d, 0x10048f, 0x100491, 0x100493, 0x100495, - 0x100497, 0x100499, 0x10049b, 0x10049d, 0x10049f, 0x1004a1, 0x1004a3, 0x1004a5, 0x1004a7, - 0x1004a9, 0x1004ab, 0x1004ad, 0x1004af, 0x1004b1, 0x1004b3, 0x1004b5, 0x1004b7, 0x1004b9, - 0x1004bb, 0x1004bd, 0x1004bf, 0x1004c2, 0x1004c4, 0x1004c6, 0x1004c8, 0x1004ca, 0x1004cc, - 0x1004ce, 0x1004cf, 0x1004d1, 0x1004d3, 0x1004d5, 0x1004d7, 0x1004d9, 0x1004db, 0x1004dd, - 0x1004df, 0x1004e1, 0x1004e3, 0x1004e5, 0x1004e7, 0x1004e9, 0x1004eb, 0x1004ed, 0x1004ef, - 0x1004f1, 0x1004f3, 0x1004f5, 0x1004f7, 0x1004f9, 0x1004fb, 0x1004fd, 0x1004ff, 0x100501, - 0x100503, 0x100505, 0x100507, 0x100509, 0x10050b, 0x10050d, 0x10050f, 0x100511, 0x100513, - 0x100515, 0x100517, 0x100519, 0x10051b, 0x10051d, 0x10051f, 0x100521, 0x100523, 0x100525, - 0x100527, 0x100529, 0x10052b, 0x10052d, 0x10052f, 0x101e01, 0x101e03, 0x101e05, 0x101e07, - 0x101e09, 0x101e0b, 0x101e0d, 0x101e0f, 0x101e11, 0x101e13, 0x101e15, 0x101e17, 0x101e19, - 0x101e1b, 0x101e1d, 0x101e1f, 0x101e21, 0x101e23, 0x101e25, 0x101e27, 0x101e29, 0x101e2b, - 0x101e2d, 0x101e2f, 0x101e31, 0x101e33, 0x101e35, 0x101e37, 0x101e39, 0x101e3b, 0x101e3d, - 0x101e3f, 0x101e41, 0x101e43, 0x101e45, 0x101e47, 0x101e49, 0x101e4b, 0x101e4d, 0x101e4f, - 0x101e51, 0x101e53, 0x101e55, 0x101e57, 0x101e59, 0x101e5b, 0x101e5d, 0x101e5f, 0x101e61, - 0x101e63, 0x101e65, 0x101e67, 0x101e69, 0x101e6b, 0x101e6d, 0x101e6f, 0x101e71, 0x101e73, - 0x101e75, 0x101e77, 0x101e79, 0x101e7b, 0x101e7d, 0x101e7f, 0x101e81, 0x101e83, 0x101e85, - 0x101e87, 0x101e89, 0x101e8b, 0x101e8d, 0x101e8f, 0x101e91, 0x101e93, 0x101e9f, 0x101ea1, - 0x101ea3, 0x101ea5, 0x101ea7, 0x101ea9, 0x101eab, 0x101ead, 0x101eaf, 0x101eb1, 0x101eb3, - 0x101eb5, 0x101eb7, 0x101eb9, 0x101ebb, 0x101ebd, 0x101ebf, 0x101ec1, 0x101ec3, 0x101ec5, - 0x101ec7, 0x101ec9, 0x101ecb, 0x101ecd, 0x101ecf, 0x101ed1, 0x101ed3, 0x101ed5, 0x101ed7, - 0x101ed9, 0x101edb, 0x101edd, 0x101edf, 0x101ee1, 0x101ee3, 0x101ee5, 0x101ee7, 0x101ee9, - 0x101eeb, 0x101eed, 0x101eef, 0x101ef1, 0x101ef3, 0x101ef5, 0x101ef7, 0x101ef9, 0x101efb, - 0x101efd, 0x101fb6, 0x101fb7, 0x101fbe, 0x101fc6, 0x101fc7, 0x101fd6, 0x101fd7, 0x101ff6, - 0x101ff7, 0x10210a, 0x10210e, 0x10210f, 0x102113, 0x10212f, 0x102134, 0x102139, 0x10213c, - 0x10213d, 0x10214e, 0x102184, 0x102c61, 0x102c65, 0x102c66, 0x102c68, 0x102c6a, 0x102c6c, - 0x102c71, 0x102c73, 0x102c74, 0x102c81, 0x102c83, 0x102c85, 0x102c87, 0x102c89, 0x102c8b, - 0x102c8d, 0x102c8f, 0x102c91, 0x102c93, 0x102c95, 0x102c97, 0x102c99, 0x102c9b, 0x102c9d, - 0x102c9f, 0x102ca1, 0x102ca3, 0x102ca5, 0x102ca7, 0x102ca9, 0x102cab, 0x102cad, 0x102caf, - 0x102cb1, 0x102cb3, 0x102cb5, 0x102cb7, 0x102cb9, 0x102cbb, 0x102cbd, 0x102cbf, 0x102cc1, - 0x102cc3, 0x102cc5, 0x102cc7, 0x102cc9, 0x102ccb, 0x102ccd, 0x102ccf, 0x102cd1, 0x102cd3, - 0x102cd5, 0x102cd7, 0x102cd9, 0x102cdb, 0x102cdd, 0x102cdf, 0x102ce1, 0x102ce3, 0x102ce4, - 0x102cec, 0x102cee, 0x102cf3, 0x102d27, 0x102d2d, 0x10a641, 0x10a643, 0x10a645, 0x10a647, - 0x10a649, 0x10a64b, 0x10a64d, 0x10a64f, 0x10a651, 0x10a653, 0x10a655, 0x10a657, 0x10a659, - 0x10a65b, 0x10a65d, 0x10a65f, 0x10a661, 0x10a663, 0x10a665, 0x10a667, 0x10a669, 0x10a66b, - 0x10a66d, 0x10a681, 0x10a683, 0x10a685, 0x10a687, 0x10a689, 0x10a68b, 0x10a68d, 0x10a68f, - 0x10a691, 0x10a693, 0x10a695, 0x10a697, 0x10a699, 0x10a69b, 0x10a723, 0x10a725, 0x10a727, - 0x10a729, 0x10a72b, 0x10a72d, 0x10a733, 0x10a735, 0x10a737, 0x10a739, 0x10a73b, 0x10a73d, - 0x10a73f, 0x10a741, 0x10a743, 0x10a745, 0x10a747, 0x10a749, 0x10a74b, 0x10a74d, 0x10a74f, - 0x10a751, 0x10a753, 0x10a755, 0x10a757, 0x10a759, 0x10a75b, 0x10a75d, 0x10a75f, 0x10a761, - 0x10a763, 0x10a765, 0x10a767, 0x10a769, 0x10a76b, 0x10a76d, 0x10a76f, 0x10a77a, 0x10a77c, - 0x10a77f, 0x10a781, 0x10a783, 0x10a785, 0x10a787, 0x10a78c, 0x10a78e, 0x10a791, 0x10a797, - 0x10a799, 0x10a79b, 0x10a79d, 0x10a79f, 0x10a7a1, 0x10a7a3, 0x10a7a5, 0x10a7a7, 0x10a7a9, - 0x10a7b5, 0x10a7b7, 0x10a7fa + ,0x1d4bb, 0x1d7cb #endif }; @@ -3626,166 +525,13 @@ static const crange upperRangeTable[] = { {0x2130, 0x2133}, {0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80}, {0xa7aa, 0xa7ae}, {0xa7b0, 0xa7b4}, {0xff21, 0xff3a} #if TCL_UTF_MAX > 4 - ,{0x10041, 0x1005a}, {0x100c0, 0x100d6}, {0x100d8, 0x100de}, {0x10189, 0x1018b}, - {0x1018e, 0x10191}, {0x10196, 0x10198}, {0x101b1, 0x101b3}, {0x101f6, 0x101f8}, - {0x10243, 0x10246}, {0x10388, 0x1038a}, {0x10391, 0x103a1}, {0x103a3, 0x103ab}, - {0x103d2, 0x103d4}, {0x103fd, 0x1042f}, {0x10531, 0x10556}, {0x110a0, 0x110c5}, - {0x113a0, 0x113f5}, {0x11f08, 0x11f0f}, {0x11f18, 0x11f1d}, {0x11f28, 0x11f2f}, - {0x11f38, 0x11f3f}, {0x11f48, 0x11f4d}, {0x11f68, 0x11f6f}, {0x11fb8, 0x11fbb}, - {0x11fc8, 0x11fcb}, {0x11fd8, 0x11fdb}, {0x11fe8, 0x11fec}, {0x11ff8, 0x11ffb}, - {0x1210b, 0x1210d}, {0x12110, 0x12112}, {0x12119, 0x1211d}, {0x1212a, 0x1212d}, - {0x12130, 0x12133}, {0x12c00, 0x12c2e}, {0x12c62, 0x12c64}, {0x12c6d, 0x12c70}, - {0x12c7e, 0x12c80}, {0x1a7aa, 0x1a7ae}, {0x1a7b0, 0x1a7b4}, {0x1ff21, 0x1ff3a}, - {0x20041, 0x2005a}, {0x200c0, 0x200d6}, {0x200d8, 0x200de}, {0x20189, 0x2018b}, - {0x2018e, 0x20191}, {0x20196, 0x20198}, {0x201b1, 0x201b3}, {0x201f6, 0x201f8}, - {0x20243, 0x20246}, {0x20388, 0x2038a}, {0x20391, 0x203a1}, {0x203a3, 0x203ab}, - {0x203d2, 0x203d4}, {0x203fd, 0x2042f}, {0x20531, 0x20556}, {0x210a0, 0x210c5}, - {0x213a0, 0x213f5}, {0x21f08, 0x21f0f}, {0x21f18, 0x21f1d}, {0x21f28, 0x21f2f}, - {0x21f38, 0x21f3f}, {0x21f48, 0x21f4d}, {0x21f68, 0x21f6f}, {0x21fb8, 0x21fbb}, - {0x21fc8, 0x21fcb}, {0x21fd8, 0x21fdb}, {0x21fe8, 0x21fec}, {0x21ff8, 0x21ffb}, - {0x2210b, 0x2210d}, {0x22110, 0x22112}, {0x22119, 0x2211d}, {0x2212a, 0x2212d}, - {0x22130, 0x22133}, {0x22c00, 0x22c2e}, {0x22c62, 0x22c64}, {0x22c6d, 0x22c70}, - {0x22c7e, 0x22c80}, {0x2a7aa, 0x2a7ae}, {0x2a7b0, 0x2a7b4}, {0x2ff21, 0x2ff3a}, - {0x30041, 0x3005a}, {0x300c0, 0x300d6}, {0x300d8, 0x300de}, {0x30189, 0x3018b}, - {0x3018e, 0x30191}, {0x30196, 0x30198}, {0x301b1, 0x301b3}, {0x301f6, 0x301f8}, - {0x30243, 0x30246}, {0x30388, 0x3038a}, {0x30391, 0x303a1}, {0x303a3, 0x303ab}, - {0x303d2, 0x303d4}, {0x303fd, 0x3042f}, {0x30531, 0x30556}, {0x310a0, 0x310c5}, - {0x313a0, 0x313f5}, {0x31f08, 0x31f0f}, {0x31f18, 0x31f1d}, {0x31f28, 0x31f2f}, - {0x31f38, 0x31f3f}, {0x31f48, 0x31f4d}, {0x31f68, 0x31f6f}, {0x31fb8, 0x31fbb}, - {0x31fc8, 0x31fcb}, {0x31fd8, 0x31fdb}, {0x31fe8, 0x31fec}, {0x31ff8, 0x31ffb}, - {0x3210b, 0x3210d}, {0x32110, 0x32112}, {0x32119, 0x3211d}, {0x3212a, 0x3212d}, - {0x32130, 0x32133}, {0x32c00, 0x32c2e}, {0x32c62, 0x32c64}, {0x32c6d, 0x32c70}, - {0x32c7e, 0x32c80}, {0x3a7aa, 0x3a7ae}, {0x3a7b0, 0x3a7b4}, {0x3ff21, 0x3ff3a}, - {0x40041, 0x4005a}, {0x400c0, 0x400d6}, {0x400d8, 0x400de}, {0x40189, 0x4018b}, - {0x4018e, 0x40191}, {0x40196, 0x40198}, {0x401b1, 0x401b3}, {0x401f6, 0x401f8}, - {0x40243, 0x40246}, {0x40388, 0x4038a}, {0x40391, 0x403a1}, {0x403a3, 0x403ab}, - {0x403d2, 0x403d4}, {0x403fd, 0x4042f}, {0x40531, 0x40556}, {0x410a0, 0x410c5}, - {0x413a0, 0x413f5}, {0x41f08, 0x41f0f}, {0x41f18, 0x41f1d}, {0x41f28, 0x41f2f}, - {0x41f38, 0x41f3f}, {0x41f48, 0x41f4d}, {0x41f68, 0x41f6f}, {0x41fb8, 0x41fbb}, - {0x41fc8, 0x41fcb}, {0x41fd8, 0x41fdb}, {0x41fe8, 0x41fec}, {0x41ff8, 0x41ffb}, - {0x4210b, 0x4210d}, {0x42110, 0x42112}, {0x42119, 0x4211d}, {0x4212a, 0x4212d}, - {0x42130, 0x42133}, {0x42c00, 0x42c2e}, {0x42c62, 0x42c64}, {0x42c6d, 0x42c70}, - {0x42c7e, 0x42c80}, {0x4a7aa, 0x4a7ae}, {0x4a7b0, 0x4a7b4}, {0x4ff21, 0x4ff3a}, - {0x50041, 0x5005a}, {0x500c0, 0x500d6}, {0x500d8, 0x500de}, {0x50189, 0x5018b}, - {0x5018e, 0x50191}, {0x50196, 0x50198}, {0x501b1, 0x501b3}, {0x501f6, 0x501f8}, - {0x50243, 0x50246}, {0x50388, 0x5038a}, {0x50391, 0x503a1}, {0x503a3, 0x503ab}, - {0x503d2, 0x503d4}, {0x503fd, 0x5042f}, {0x50531, 0x50556}, {0x510a0, 0x510c5}, - {0x513a0, 0x513f5}, {0x51f08, 0x51f0f}, {0x51f18, 0x51f1d}, {0x51f28, 0x51f2f}, - {0x51f38, 0x51f3f}, {0x51f48, 0x51f4d}, {0x51f68, 0x51f6f}, {0x51fb8, 0x51fbb}, - {0x51fc8, 0x51fcb}, {0x51fd8, 0x51fdb}, {0x51fe8, 0x51fec}, {0x51ff8, 0x51ffb}, - {0x5210b, 0x5210d}, {0x52110, 0x52112}, {0x52119, 0x5211d}, {0x5212a, 0x5212d}, - {0x52130, 0x52133}, {0x52c00, 0x52c2e}, {0x52c62, 0x52c64}, {0x52c6d, 0x52c70}, - {0x52c7e, 0x52c80}, {0x5a7aa, 0x5a7ae}, {0x5a7b0, 0x5a7b4}, {0x5ff21, 0x5ff3a}, - {0x60041, 0x6005a}, {0x600c0, 0x600d6}, {0x600d8, 0x600de}, {0x60189, 0x6018b}, - {0x6018e, 0x60191}, {0x60196, 0x60198}, {0x601b1, 0x601b3}, {0x601f6, 0x601f8}, - {0x60243, 0x60246}, {0x60388, 0x6038a}, {0x60391, 0x603a1}, {0x603a3, 0x603ab}, - {0x603d2, 0x603d4}, {0x603fd, 0x6042f}, {0x60531, 0x60556}, {0x610a0, 0x610c5}, - {0x613a0, 0x613f5}, {0x61f08, 0x61f0f}, {0x61f18, 0x61f1d}, {0x61f28, 0x61f2f}, - {0x61f38, 0x61f3f}, {0x61f48, 0x61f4d}, {0x61f68, 0x61f6f}, {0x61fb8, 0x61fbb}, - {0x61fc8, 0x61fcb}, {0x61fd8, 0x61fdb}, {0x61fe8, 0x61fec}, {0x61ff8, 0x61ffb}, - {0x6210b, 0x6210d}, {0x62110, 0x62112}, {0x62119, 0x6211d}, {0x6212a, 0x6212d}, - {0x62130, 0x62133}, {0x62c00, 0x62c2e}, {0x62c62, 0x62c64}, {0x62c6d, 0x62c70}, - {0x62c7e, 0x62c80}, {0x6a7aa, 0x6a7ae}, {0x6a7b0, 0x6a7b4}, {0x6ff21, 0x6ff3a}, - {0x70041, 0x7005a}, {0x700c0, 0x700d6}, {0x700d8, 0x700de}, {0x70189, 0x7018b}, - {0x7018e, 0x70191}, {0x70196, 0x70198}, {0x701b1, 0x701b3}, {0x701f6, 0x701f8}, - {0x70243, 0x70246}, {0x70388, 0x7038a}, {0x70391, 0x703a1}, {0x703a3, 0x703ab}, - {0x703d2, 0x703d4}, {0x703fd, 0x7042f}, {0x70531, 0x70556}, {0x710a0, 0x710c5}, - {0x713a0, 0x713f5}, {0x71f08, 0x71f0f}, {0x71f18, 0x71f1d}, {0x71f28, 0x71f2f}, - {0x71f38, 0x71f3f}, {0x71f48, 0x71f4d}, {0x71f68, 0x71f6f}, {0x71fb8, 0x71fbb}, - {0x71fc8, 0x71fcb}, {0x71fd8, 0x71fdb}, {0x71fe8, 0x71fec}, {0x71ff8, 0x71ffb}, - {0x7210b, 0x7210d}, {0x72110, 0x72112}, {0x72119, 0x7211d}, {0x7212a, 0x7212d}, - {0x72130, 0x72133}, {0x72c00, 0x72c2e}, {0x72c62, 0x72c64}, {0x72c6d, 0x72c70}, - {0x72c7e, 0x72c80}, {0x7a7aa, 0x7a7ae}, {0x7a7b0, 0x7a7b4}, {0x7ff21, 0x7ff3a}, - {0x80041, 0x8005a}, {0x800c0, 0x800d6}, {0x800d8, 0x800de}, {0x80189, 0x8018b}, - {0x8018e, 0x80191}, {0x80196, 0x80198}, {0x801b1, 0x801b3}, {0x801f6, 0x801f8}, - {0x80243, 0x80246}, {0x80388, 0x8038a}, {0x80391, 0x803a1}, {0x803a3, 0x803ab}, - {0x803d2, 0x803d4}, {0x803fd, 0x8042f}, {0x80531, 0x80556}, {0x810a0, 0x810c5}, - {0x813a0, 0x813f5}, {0x81f08, 0x81f0f}, {0x81f18, 0x81f1d}, {0x81f28, 0x81f2f}, - {0x81f38, 0x81f3f}, {0x81f48, 0x81f4d}, {0x81f68, 0x81f6f}, {0x81fb8, 0x81fbb}, - {0x81fc8, 0x81fcb}, {0x81fd8, 0x81fdb}, {0x81fe8, 0x81fec}, {0x81ff8, 0x81ffb}, - {0x8210b, 0x8210d}, {0x82110, 0x82112}, {0x82119, 0x8211d}, {0x8212a, 0x8212d}, - {0x82130, 0x82133}, {0x82c00, 0x82c2e}, {0x82c62, 0x82c64}, {0x82c6d, 0x82c70}, - {0x82c7e, 0x82c80}, {0x8a7aa, 0x8a7ae}, {0x8a7b0, 0x8a7b4}, {0x8ff21, 0x8ff3a}, - {0x90041, 0x9005a}, {0x900c0, 0x900d6}, {0x900d8, 0x900de}, {0x90189, 0x9018b}, - {0x9018e, 0x90191}, {0x90196, 0x90198}, {0x901b1, 0x901b3}, {0x901f6, 0x901f8}, - {0x90243, 0x90246}, {0x90388, 0x9038a}, {0x90391, 0x903a1}, {0x903a3, 0x903ab}, - {0x903d2, 0x903d4}, {0x903fd, 0x9042f}, {0x90531, 0x90556}, {0x910a0, 0x910c5}, - {0x913a0, 0x913f5}, {0x91f08, 0x91f0f}, {0x91f18, 0x91f1d}, {0x91f28, 0x91f2f}, - {0x91f38, 0x91f3f}, {0x91f48, 0x91f4d}, {0x91f68, 0x91f6f}, {0x91fb8, 0x91fbb}, - {0x91fc8, 0x91fcb}, {0x91fd8, 0x91fdb}, {0x91fe8, 0x91fec}, {0x91ff8, 0x91ffb}, - {0x9210b, 0x9210d}, {0x92110, 0x92112}, {0x92119, 0x9211d}, {0x9212a, 0x9212d}, - {0x92130, 0x92133}, {0x92c00, 0x92c2e}, {0x92c62, 0x92c64}, {0x92c6d, 0x92c70}, - {0x92c7e, 0x92c80}, {0x9a7aa, 0x9a7ae}, {0x9a7b0, 0x9a7b4}, {0x9ff21, 0x9ff3a}, - {0xa0041, 0xa005a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00de}, {0xa0189, 0xa018b}, - {0xa018e, 0xa0191}, {0xa0196, 0xa0198}, {0xa01b1, 0xa01b3}, {0xa01f6, 0xa01f8}, - {0xa0243, 0xa0246}, {0xa0388, 0xa038a}, {0xa0391, 0xa03a1}, {0xa03a3, 0xa03ab}, - {0xa03d2, 0xa03d4}, {0xa03fd, 0xa042f}, {0xa0531, 0xa0556}, {0xa10a0, 0xa10c5}, - {0xa13a0, 0xa13f5}, {0xa1f08, 0xa1f0f}, {0xa1f18, 0xa1f1d}, {0xa1f28, 0xa1f2f}, - {0xa1f38, 0xa1f3f}, {0xa1f48, 0xa1f4d}, {0xa1f68, 0xa1f6f}, {0xa1fb8, 0xa1fbb}, - {0xa1fc8, 0xa1fcb}, {0xa1fd8, 0xa1fdb}, {0xa1fe8, 0xa1fec}, {0xa1ff8, 0xa1ffb}, - {0xa210b, 0xa210d}, {0xa2110, 0xa2112}, {0xa2119, 0xa211d}, {0xa212a, 0xa212d}, - {0xa2130, 0xa2133}, {0xa2c00, 0xa2c2e}, {0xa2c62, 0xa2c64}, {0xa2c6d, 0xa2c70}, - {0xa2c7e, 0xa2c80}, {0xaa7aa, 0xaa7ae}, {0xaa7b0, 0xaa7b4}, {0xaff21, 0xaff3a}, - {0xb0041, 0xb005a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00de}, {0xb0189, 0xb018b}, - {0xb018e, 0xb0191}, {0xb0196, 0xb0198}, {0xb01b1, 0xb01b3}, {0xb01f6, 0xb01f8}, - {0xb0243, 0xb0246}, {0xb0388, 0xb038a}, {0xb0391, 0xb03a1}, {0xb03a3, 0xb03ab}, - {0xb03d2, 0xb03d4}, {0xb03fd, 0xb042f}, {0xb0531, 0xb0556}, {0xb10a0, 0xb10c5}, - {0xb13a0, 0xb13f5}, {0xb1f08, 0xb1f0f}, {0xb1f18, 0xb1f1d}, {0xb1f28, 0xb1f2f}, - {0xb1f38, 0xb1f3f}, {0xb1f48, 0xb1f4d}, {0xb1f68, 0xb1f6f}, {0xb1fb8, 0xb1fbb}, - {0xb1fc8, 0xb1fcb}, {0xb1fd8, 0xb1fdb}, {0xb1fe8, 0xb1fec}, {0xb1ff8, 0xb1ffb}, - {0xb210b, 0xb210d}, {0xb2110, 0xb2112}, {0xb2119, 0xb211d}, {0xb212a, 0xb212d}, - {0xb2130, 0xb2133}, {0xb2c00, 0xb2c2e}, {0xb2c62, 0xb2c64}, {0xb2c6d, 0xb2c70}, - {0xb2c7e, 0xb2c80}, {0xba7aa, 0xba7ae}, {0xba7b0, 0xba7b4}, {0xbff21, 0xbff3a}, - {0xc0041, 0xc005a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00de}, {0xc0189, 0xc018b}, - {0xc018e, 0xc0191}, {0xc0196, 0xc0198}, {0xc01b1, 0xc01b3}, {0xc01f6, 0xc01f8}, - {0xc0243, 0xc0246}, {0xc0388, 0xc038a}, {0xc0391, 0xc03a1}, {0xc03a3, 0xc03ab}, - {0xc03d2, 0xc03d4}, {0xc03fd, 0xc042f}, {0xc0531, 0xc0556}, {0xc10a0, 0xc10c5}, - {0xc13a0, 0xc13f5}, {0xc1f08, 0xc1f0f}, {0xc1f18, 0xc1f1d}, {0xc1f28, 0xc1f2f}, - {0xc1f38, 0xc1f3f}, {0xc1f48, 0xc1f4d}, {0xc1f68, 0xc1f6f}, {0xc1fb8, 0xc1fbb}, - {0xc1fc8, 0xc1fcb}, {0xc1fd8, 0xc1fdb}, {0xc1fe8, 0xc1fec}, {0xc1ff8, 0xc1ffb}, - {0xc210b, 0xc210d}, {0xc2110, 0xc2112}, {0xc2119, 0xc211d}, {0xc212a, 0xc212d}, - {0xc2130, 0xc2133}, {0xc2c00, 0xc2c2e}, {0xc2c62, 0xc2c64}, {0xc2c6d, 0xc2c70}, - {0xc2c7e, 0xc2c80}, {0xca7aa, 0xca7ae}, {0xca7b0, 0xca7b4}, {0xcff21, 0xcff3a}, - {0xd0041, 0xd005a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00de}, {0xd0189, 0xd018b}, - {0xd018e, 0xd0191}, {0xd0196, 0xd0198}, {0xd01b1, 0xd01b3}, {0xd01f6, 0xd01f8}, - {0xd0243, 0xd0246}, {0xd0388, 0xd038a}, {0xd0391, 0xd03a1}, {0xd03a3, 0xd03ab}, - {0xd03d2, 0xd03d4}, {0xd03fd, 0xd042f}, {0xd0531, 0xd0556}, {0xd10a0, 0xd10c5}, - {0xd13a0, 0xd13f5}, {0xd1f08, 0xd1f0f}, {0xd1f18, 0xd1f1d}, {0xd1f28, 0xd1f2f}, - {0xd1f38, 0xd1f3f}, {0xd1f48, 0xd1f4d}, {0xd1f68, 0xd1f6f}, {0xd1fb8, 0xd1fbb}, - {0xd1fc8, 0xd1fcb}, {0xd1fd8, 0xd1fdb}, {0xd1fe8, 0xd1fec}, {0xd1ff8, 0xd1ffb}, - {0xd210b, 0xd210d}, {0xd2110, 0xd2112}, {0xd2119, 0xd211d}, {0xd212a, 0xd212d}, - {0xd2130, 0xd2133}, {0xd2c00, 0xd2c2e}, {0xd2c62, 0xd2c64}, {0xd2c6d, 0xd2c70}, - {0xd2c7e, 0xd2c80}, {0xda7aa, 0xda7ae}, {0xda7b0, 0xda7b4}, {0xdff21, 0xdff3a}, - {0xe0041, 0xe005a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00de}, {0xe0189, 0xe018b}, - {0xe018e, 0xe0191}, {0xe0196, 0xe0198}, {0xe01b1, 0xe01b3}, {0xe01f6, 0xe01f8}, - {0xe0243, 0xe0246}, {0xe0388, 0xe038a}, {0xe0391, 0xe03a1}, {0xe03a3, 0xe03ab}, - {0xe03d2, 0xe03d4}, {0xe03fd, 0xe042f}, {0xe0531, 0xe0556}, {0xe10a0, 0xe10c5}, - {0xe13a0, 0xe13f5}, {0xe1f08, 0xe1f0f}, {0xe1f18, 0xe1f1d}, {0xe1f28, 0xe1f2f}, - {0xe1f38, 0xe1f3f}, {0xe1f48, 0xe1f4d}, {0xe1f68, 0xe1f6f}, {0xe1fb8, 0xe1fbb}, - {0xe1fc8, 0xe1fcb}, {0xe1fd8, 0xe1fdb}, {0xe1fe8, 0xe1fec}, {0xe1ff8, 0xe1ffb}, - {0xe210b, 0xe210d}, {0xe2110, 0xe2112}, {0xe2119, 0xe211d}, {0xe212a, 0xe212d}, - {0xe2130, 0xe2133}, {0xe2c00, 0xe2c2e}, {0xe2c62, 0xe2c64}, {0xe2c6d, 0xe2c70}, - {0xe2c7e, 0xe2c80}, {0xea7aa, 0xea7ae}, {0xea7b0, 0xea7b4}, {0xeff21, 0xeff3a}, - {0xf0041, 0xf005a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00de}, {0xf0189, 0xf018b}, - {0xf018e, 0xf0191}, {0xf0196, 0xf0198}, {0xf01b1, 0xf01b3}, {0xf01f6, 0xf01f8}, - {0xf0243, 0xf0246}, {0xf0388, 0xf038a}, {0xf0391, 0xf03a1}, {0xf03a3, 0xf03ab}, - {0xf03d2, 0xf03d4}, {0xf03fd, 0xf042f}, {0xf0531, 0xf0556}, {0xf10a0, 0xf10c5}, - {0xf13a0, 0xf13f5}, {0xf1f08, 0xf1f0f}, {0xf1f18, 0xf1f1d}, {0xf1f28, 0xf1f2f}, - {0xf1f38, 0xf1f3f}, {0xf1f48, 0xf1f4d}, {0xf1f68, 0xf1f6f}, {0xf1fb8, 0xf1fbb}, - {0xf1fc8, 0xf1fcb}, {0xf1fd8, 0xf1fdb}, {0xf1fe8, 0xf1fec}, {0xf1ff8, 0xf1ffb}, - {0xf210b, 0xf210d}, {0xf2110, 0xf2112}, {0xf2119, 0xf211d}, {0xf212a, 0xf212d}, - {0xf2130, 0xf2133}, {0xf2c00, 0xf2c2e}, {0xf2c62, 0xf2c64}, {0xf2c6d, 0xf2c70}, - {0xf2c7e, 0xf2c80}, {0xfa7aa, 0xfa7ae}, {0xfa7b0, 0xfa7b4}, {0xfff21, 0xfff3a}, - {0x100041, 0x10005a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000de}, {0x100189, 0x10018b}, - {0x10018e, 0x100191}, {0x100196, 0x100198}, {0x1001b1, 0x1001b3}, {0x1001f6, 0x1001f8}, - {0x100243, 0x100246}, {0x100388, 0x10038a}, {0x100391, 0x1003a1}, {0x1003a3, 0x1003ab}, - {0x1003d2, 0x1003d4}, {0x1003fd, 0x10042f}, {0x100531, 0x100556}, {0x1010a0, 0x1010c5}, - {0x1013a0, 0x1013f5}, {0x101f08, 0x101f0f}, {0x101f18, 0x101f1d}, {0x101f28, 0x101f2f}, - {0x101f38, 0x101f3f}, {0x101f48, 0x101f4d}, {0x101f68, 0x101f6f}, {0x101fb8, 0x101fbb}, - {0x101fc8, 0x101fcb}, {0x101fd8, 0x101fdb}, {0x101fe8, 0x101fec}, {0x101ff8, 0x101ffb}, - {0x10210b, 0x10210d}, {0x102110, 0x102112}, {0x102119, 0x10211d}, {0x10212a, 0x10212d}, - {0x102130, 0x102133}, {0x102c00, 0x102c2e}, {0x102c62, 0x102c64}, {0x102c6d, 0x102c70}, - {0x102c7e, 0x102c80}, {0x10a7aa, 0x10a7ae}, {0x10a7b0, 0x10a7b4}, {0x10ff21, 0x10ff3a} + ,{0x10400, 0x10427}, {0x104b0, 0x104d3}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf}, + {0x1d400, 0x1d419}, {0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, + {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, + {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, + {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, + {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, + {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}, {0x1e900, 0x1e921} #endif }; @@ -3856,1014 +602,8 @@ static const chr upperCharTable[] = { 0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798, 0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6 #if TCL_UTF_MAX > 4 - ,0x10100, 0x10102, 0x10104, 0x10106, 0x10108, 0x1010a, 0x1010c, 0x1010e, 0x10110, - 0x10112, 0x10114, 0x10116, 0x10118, 0x1011a, 0x1011c, 0x1011e, 0x10120, 0x10122, - 0x10124, 0x10126, 0x10128, 0x1012a, 0x1012c, 0x1012e, 0x10130, 0x10132, 0x10134, - 0x10136, 0x10139, 0x1013b, 0x1013d, 0x1013f, 0x10141, 0x10143, 0x10145, 0x10147, - 0x1014a, 0x1014c, 0x1014e, 0x10150, 0x10152, 0x10154, 0x10156, 0x10158, 0x1015a, - 0x1015c, 0x1015e, 0x10160, 0x10162, 0x10164, 0x10166, 0x10168, 0x1016a, 0x1016c, - 0x1016e, 0x10170, 0x10172, 0x10174, 0x10176, 0x10178, 0x10179, 0x1017b, 0x1017d, - 0x10181, 0x10182, 0x10184, 0x10186, 0x10187, 0x10193, 0x10194, 0x1019c, 0x1019d, - 0x1019f, 0x101a0, 0x101a2, 0x101a4, 0x101a6, 0x101a7, 0x101a9, 0x101ac, 0x101ae, - 0x101af, 0x101b5, 0x101b7, 0x101b8, 0x101bc, 0x101c4, 0x101c7, 0x101ca, 0x101cd, - 0x101cf, 0x101d1, 0x101d3, 0x101d5, 0x101d7, 0x101d9, 0x101db, 0x101de, 0x101e0, - 0x101e2, 0x101e4, 0x101e6, 0x101e8, 0x101ea, 0x101ec, 0x101ee, 0x101f1, 0x101f4, - 0x101fa, 0x101fc, 0x101fe, 0x10200, 0x10202, 0x10204, 0x10206, 0x10208, 0x1020a, - 0x1020c, 0x1020e, 0x10210, 0x10212, 0x10214, 0x10216, 0x10218, 0x1021a, 0x1021c, - 0x1021e, 0x10220, 0x10222, 0x10224, 0x10226, 0x10228, 0x1022a, 0x1022c, 0x1022e, - 0x10230, 0x10232, 0x1023a, 0x1023b, 0x1023d, 0x1023e, 0x10241, 0x10248, 0x1024a, - 0x1024c, 0x1024e, 0x10370, 0x10372, 0x10376, 0x1037f, 0x10386, 0x1038c, 0x1038e, - 0x1038f, 0x103cf, 0x103d8, 0x103da, 0x103dc, 0x103de, 0x103e0, 0x103e2, 0x103e4, - 0x103e6, 0x103e8, 0x103ea, 0x103ec, 0x103ee, 0x103f4, 0x103f7, 0x103f9, 0x103fa, - 0x10460, 0x10462, 0x10464, 0x10466, 0x10468, 0x1046a, 0x1046c, 0x1046e, 0x10470, - 0x10472, 0x10474, 0x10476, 0x10478, 0x1047a, 0x1047c, 0x1047e, 0x10480, 0x1048a, - 0x1048c, 0x1048e, 0x10490, 0x10492, 0x10494, 0x10496, 0x10498, 0x1049a, 0x1049c, - 0x1049e, 0x104a0, 0x104a2, 0x104a4, 0x104a6, 0x104a8, 0x104aa, 0x104ac, 0x104ae, - 0x104b0, 0x104b2, 0x104b4, 0x104b6, 0x104b8, 0x104ba, 0x104bc, 0x104be, 0x104c0, - 0x104c1, 0x104c3, 0x104c5, 0x104c7, 0x104c9, 0x104cb, 0x104cd, 0x104d0, 0x104d2, - 0x104d4, 0x104d6, 0x104d8, 0x104da, 0x104dc, 0x104de, 0x104e0, 0x104e2, 0x104e4, - 0x104e6, 0x104e8, 0x104ea, 0x104ec, 0x104ee, 0x104f0, 0x104f2, 0x104f4, 0x104f6, - 0x104f8, 0x104fa, 0x104fc, 0x104fe, 0x10500, 0x10502, 0x10504, 0x10506, 0x10508, - 0x1050a, 0x1050c, 0x1050e, 0x10510, 0x10512, 0x10514, 0x10516, 0x10518, 0x1051a, - 0x1051c, 0x1051e, 0x10520, 0x10522, 0x10524, 0x10526, 0x10528, 0x1052a, 0x1052c, - 0x1052e, 0x110c7, 0x110cd, 0x11e00, 0x11e02, 0x11e04, 0x11e06, 0x11e08, 0x11e0a, - 0x11e0c, 0x11e0e, 0x11e10, 0x11e12, 0x11e14, 0x11e16, 0x11e18, 0x11e1a, 0x11e1c, - 0x11e1e, 0x11e20, 0x11e22, 0x11e24, 0x11e26, 0x11e28, 0x11e2a, 0x11e2c, 0x11e2e, - 0x11e30, 0x11e32, 0x11e34, 0x11e36, 0x11e38, 0x11e3a, 0x11e3c, 0x11e3e, 0x11e40, - 0x11e42, 0x11e44, 0x11e46, 0x11e48, 0x11e4a, 0x11e4c, 0x11e4e, 0x11e50, 0x11e52, - 0x11e54, 0x11e56, 0x11e58, 0x11e5a, 0x11e5c, 0x11e5e, 0x11e60, 0x11e62, 0x11e64, - 0x11e66, 0x11e68, 0x11e6a, 0x11e6c, 0x11e6e, 0x11e70, 0x11e72, 0x11e74, 0x11e76, - 0x11e78, 0x11e7a, 0x11e7c, 0x11e7e, 0x11e80, 0x11e82, 0x11e84, 0x11e86, 0x11e88, - 0x11e8a, 0x11e8c, 0x11e8e, 0x11e90, 0x11e92, 0x11e94, 0x11e9e, 0x11ea0, 0x11ea2, - 0x11ea4, 0x11ea6, 0x11ea8, 0x11eaa, 0x11eac, 0x11eae, 0x11eb0, 0x11eb2, 0x11eb4, - 0x11eb6, 0x11eb8, 0x11eba, 0x11ebc, 0x11ebe, 0x11ec0, 0x11ec2, 0x11ec4, 0x11ec6, - 0x11ec8, 0x11eca, 0x11ecc, 0x11ece, 0x11ed0, 0x11ed2, 0x11ed4, 0x11ed6, 0x11ed8, - 0x11eda, 0x11edc, 0x11ede, 0x11ee0, 0x11ee2, 0x11ee4, 0x11ee6, 0x11ee8, 0x11eea, - 0x11eec, 0x11eee, 0x11ef0, 0x11ef2, 0x11ef4, 0x11ef6, 0x11ef8, 0x11efa, 0x11efc, - 0x11efe, 0x11f59, 0x11f5b, 0x11f5d, 0x11f5f, 0x12102, 0x12107, 0x12115, 0x12124, - 0x12126, 0x12128, 0x1213e, 0x1213f, 0x12145, 0x12183, 0x12c60, 0x12c67, 0x12c69, - 0x12c6b, 0x12c72, 0x12c75, 0x12c82, 0x12c84, 0x12c86, 0x12c88, 0x12c8a, 0x12c8c, - 0x12c8e, 0x12c90, 0x12c92, 0x12c94, 0x12c96, 0x12c98, 0x12c9a, 0x12c9c, 0x12c9e, - 0x12ca0, 0x12ca2, 0x12ca4, 0x12ca6, 0x12ca8, 0x12caa, 0x12cac, 0x12cae, 0x12cb0, - 0x12cb2, 0x12cb4, 0x12cb6, 0x12cb8, 0x12cba, 0x12cbc, 0x12cbe, 0x12cc0, 0x12cc2, - 0x12cc4, 0x12cc6, 0x12cc8, 0x12cca, 0x12ccc, 0x12cce, 0x12cd0, 0x12cd2, 0x12cd4, - 0x12cd6, 0x12cd8, 0x12cda, 0x12cdc, 0x12cde, 0x12ce0, 0x12ce2, 0x12ceb, 0x12ced, - 0x12cf2, 0x1a640, 0x1a642, 0x1a644, 0x1a646, 0x1a648, 0x1a64a, 0x1a64c, 0x1a64e, - 0x1a650, 0x1a652, 0x1a654, 0x1a656, 0x1a658, 0x1a65a, 0x1a65c, 0x1a65e, 0x1a660, - 0x1a662, 0x1a664, 0x1a666, 0x1a668, 0x1a66a, 0x1a66c, 0x1a680, 0x1a682, 0x1a684, - 0x1a686, 0x1a688, 0x1a68a, 0x1a68c, 0x1a68e, 0x1a690, 0x1a692, 0x1a694, 0x1a696, - 0x1a698, 0x1a69a, 0x1a722, 0x1a724, 0x1a726, 0x1a728, 0x1a72a, 0x1a72c, 0x1a72e, - 0x1a732, 0x1a734, 0x1a736, 0x1a738, 0x1a73a, 0x1a73c, 0x1a73e, 0x1a740, 0x1a742, - 0x1a744, 0x1a746, 0x1a748, 0x1a74a, 0x1a74c, 0x1a74e, 0x1a750, 0x1a752, 0x1a754, - 0x1a756, 0x1a758, 0x1a75a, 0x1a75c, 0x1a75e, 0x1a760, 0x1a762, 0x1a764, 0x1a766, - 0x1a768, 0x1a76a, 0x1a76c, 0x1a76e, 0x1a779, 0x1a77b, 0x1a77d, 0x1a77e, 0x1a780, - 0x1a782, 0x1a784, 0x1a786, 0x1a78b, 0x1a78d, 0x1a790, 0x1a792, 0x1a796, 0x1a798, - 0x1a79a, 0x1a79c, 0x1a79e, 0x1a7a0, 0x1a7a2, 0x1a7a4, 0x1a7a6, 0x1a7a8, 0x1a7b6, - 0x20100, 0x20102, 0x20104, 0x20106, 0x20108, 0x2010a, 0x2010c, 0x2010e, 0x20110, - 0x20112, 0x20114, 0x20116, 0x20118, 0x2011a, 0x2011c, 0x2011e, 0x20120, 0x20122, - 0x20124, 0x20126, 0x20128, 0x2012a, 0x2012c, 0x2012e, 0x20130, 0x20132, 0x20134, - 0x20136, 0x20139, 0x2013b, 0x2013d, 0x2013f, 0x20141, 0x20143, 0x20145, 0x20147, - 0x2014a, 0x2014c, 0x2014e, 0x20150, 0x20152, 0x20154, 0x20156, 0x20158, 0x2015a, - 0x2015c, 0x2015e, 0x20160, 0x20162, 0x20164, 0x20166, 0x20168, 0x2016a, 0x2016c, - 0x2016e, 0x20170, 0x20172, 0x20174, 0x20176, 0x20178, 0x20179, 0x2017b, 0x2017d, - 0x20181, 0x20182, 0x20184, 0x20186, 0x20187, 0x20193, 0x20194, 0x2019c, 0x2019d, - 0x2019f, 0x201a0, 0x201a2, 0x201a4, 0x201a6, 0x201a7, 0x201a9, 0x201ac, 0x201ae, - 0x201af, 0x201b5, 0x201b7, 0x201b8, 0x201bc, 0x201c4, 0x201c7, 0x201ca, 0x201cd, - 0x201cf, 0x201d1, 0x201d3, 0x201d5, 0x201d7, 0x201d9, 0x201db, 0x201de, 0x201e0, - 0x201e2, 0x201e4, 0x201e6, 0x201e8, 0x201ea, 0x201ec, 0x201ee, 0x201f1, 0x201f4, - 0x201fa, 0x201fc, 0x201fe, 0x20200, 0x20202, 0x20204, 0x20206, 0x20208, 0x2020a, - 0x2020c, 0x2020e, 0x20210, 0x20212, 0x20214, 0x20216, 0x20218, 0x2021a, 0x2021c, - 0x2021e, 0x20220, 0x20222, 0x20224, 0x20226, 0x20228, 0x2022a, 0x2022c, 0x2022e, - 0x20230, 0x20232, 0x2023a, 0x2023b, 0x2023d, 0x2023e, 0x20241, 0x20248, 0x2024a, - 0x2024c, 0x2024e, 0x20370, 0x20372, 0x20376, 0x2037f, 0x20386, 0x2038c, 0x2038e, - 0x2038f, 0x203cf, 0x203d8, 0x203da, 0x203dc, 0x203de, 0x203e0, 0x203e2, 0x203e4, - 0x203e6, 0x203e8, 0x203ea, 0x203ec, 0x203ee, 0x203f4, 0x203f7, 0x203f9, 0x203fa, - 0x20460, 0x20462, 0x20464, 0x20466, 0x20468, 0x2046a, 0x2046c, 0x2046e, 0x20470, - 0x20472, 0x20474, 0x20476, 0x20478, 0x2047a, 0x2047c, 0x2047e, 0x20480, 0x2048a, - 0x2048c, 0x2048e, 0x20490, 0x20492, 0x20494, 0x20496, 0x20498, 0x2049a, 0x2049c, - 0x2049e, 0x204a0, 0x204a2, 0x204a4, 0x204a6, 0x204a8, 0x204aa, 0x204ac, 0x204ae, - 0x204b0, 0x204b2, 0x204b4, 0x204b6, 0x204b8, 0x204ba, 0x204bc, 0x204be, 0x204c0, - 0x204c1, 0x204c3, 0x204c5, 0x204c7, 0x204c9, 0x204cb, 0x204cd, 0x204d0, 0x204d2, - 0x204d4, 0x204d6, 0x204d8, 0x204da, 0x204dc, 0x204de, 0x204e0, 0x204e2, 0x204e4, - 0x204e6, 0x204e8, 0x204ea, 0x204ec, 0x204ee, 0x204f0, 0x204f2, 0x204f4, 0x204f6, - 0x204f8, 0x204fa, 0x204fc, 0x204fe, 0x20500, 0x20502, 0x20504, 0x20506, 0x20508, - 0x2050a, 0x2050c, 0x2050e, 0x20510, 0x20512, 0x20514, 0x20516, 0x20518, 0x2051a, - 0x2051c, 0x2051e, 0x20520, 0x20522, 0x20524, 0x20526, 0x20528, 0x2052a, 0x2052c, - 0x2052e, 0x210c7, 0x210cd, 0x21e00, 0x21e02, 0x21e04, 0x21e06, 0x21e08, 0x21e0a, - 0x21e0c, 0x21e0e, 0x21e10, 0x21e12, 0x21e14, 0x21e16, 0x21e18, 0x21e1a, 0x21e1c, - 0x21e1e, 0x21e20, 0x21e22, 0x21e24, 0x21e26, 0x21e28, 0x21e2a, 0x21e2c, 0x21e2e, - 0x21e30, 0x21e32, 0x21e34, 0x21e36, 0x21e38, 0x21e3a, 0x21e3c, 0x21e3e, 0x21e40, - 0x21e42, 0x21e44, 0x21e46, 0x21e48, 0x21e4a, 0x21e4c, 0x21e4e, 0x21e50, 0x21e52, - 0x21e54, 0x21e56, 0x21e58, 0x21e5a, 0x21e5c, 0x21e5e, 0x21e60, 0x21e62, 0x21e64, - 0x21e66, 0x21e68, 0x21e6a, 0x21e6c, 0x21e6e, 0x21e70, 0x21e72, 0x21e74, 0x21e76, - 0x21e78, 0x21e7a, 0x21e7c, 0x21e7e, 0x21e80, 0x21e82, 0x21e84, 0x21e86, 0x21e88, - 0x21e8a, 0x21e8c, 0x21e8e, 0x21e90, 0x21e92, 0x21e94, 0x21e9e, 0x21ea0, 0x21ea2, - 0x21ea4, 0x21ea6, 0x21ea8, 0x21eaa, 0x21eac, 0x21eae, 0x21eb0, 0x21eb2, 0x21eb4, - 0x21eb6, 0x21eb8, 0x21eba, 0x21ebc, 0x21ebe, 0x21ec0, 0x21ec2, 0x21ec4, 0x21ec6, - 0x21ec8, 0x21eca, 0x21ecc, 0x21ece, 0x21ed0, 0x21ed2, 0x21ed4, 0x21ed6, 0x21ed8, - 0x21eda, 0x21edc, 0x21ede, 0x21ee0, 0x21ee2, 0x21ee4, 0x21ee6, 0x21ee8, 0x21eea, - 0x21eec, 0x21eee, 0x21ef0, 0x21ef2, 0x21ef4, 0x21ef6, 0x21ef8, 0x21efa, 0x21efc, - 0x21efe, 0x21f59, 0x21f5b, 0x21f5d, 0x21f5f, 0x22102, 0x22107, 0x22115, 0x22124, - 0x22126, 0x22128, 0x2213e, 0x2213f, 0x22145, 0x22183, 0x22c60, 0x22c67, 0x22c69, - 0x22c6b, 0x22c72, 0x22c75, 0x22c82, 0x22c84, 0x22c86, 0x22c88, 0x22c8a, 0x22c8c, - 0x22c8e, 0x22c90, 0x22c92, 0x22c94, 0x22c96, 0x22c98, 0x22c9a, 0x22c9c, 0x22c9e, - 0x22ca0, 0x22ca2, 0x22ca4, 0x22ca6, 0x22ca8, 0x22caa, 0x22cac, 0x22cae, 0x22cb0, - 0x22cb2, 0x22cb4, 0x22cb6, 0x22cb8, 0x22cba, 0x22cbc, 0x22cbe, 0x22cc0, 0x22cc2, - 0x22cc4, 0x22cc6, 0x22cc8, 0x22cca, 0x22ccc, 0x22cce, 0x22cd0, 0x22cd2, 0x22cd4, - 0x22cd6, 0x22cd8, 0x22cda, 0x22cdc, 0x22cde, 0x22ce0, 0x22ce2, 0x22ceb, 0x22ced, - 0x22cf2, 0x2a640, 0x2a642, 0x2a644, 0x2a646, 0x2a648, 0x2a64a, 0x2a64c, 0x2a64e, - 0x2a650, 0x2a652, 0x2a654, 0x2a656, 0x2a658, 0x2a65a, 0x2a65c, 0x2a65e, 0x2a660, - 0x2a662, 0x2a664, 0x2a666, 0x2a668, 0x2a66a, 0x2a66c, 0x2a680, 0x2a682, 0x2a684, - 0x2a686, 0x2a688, 0x2a68a, 0x2a68c, 0x2a68e, 0x2a690, 0x2a692, 0x2a694, 0x2a696, - 0x2a698, 0x2a69a, 0x2a722, 0x2a724, 0x2a726, 0x2a728, 0x2a72a, 0x2a72c, 0x2a72e, - 0x2a732, 0x2a734, 0x2a736, 0x2a738, 0x2a73a, 0x2a73c, 0x2a73e, 0x2a740, 0x2a742, - 0x2a744, 0x2a746, 0x2a748, 0x2a74a, 0x2a74c, 0x2a74e, 0x2a750, 0x2a752, 0x2a754, - 0x2a756, 0x2a758, 0x2a75a, 0x2a75c, 0x2a75e, 0x2a760, 0x2a762, 0x2a764, 0x2a766, - 0x2a768, 0x2a76a, 0x2a76c, 0x2a76e, 0x2a779, 0x2a77b, 0x2a77d, 0x2a77e, 0x2a780, - 0x2a782, 0x2a784, 0x2a786, 0x2a78b, 0x2a78d, 0x2a790, 0x2a792, 0x2a796, 0x2a798, - 0x2a79a, 0x2a79c, 0x2a79e, 0x2a7a0, 0x2a7a2, 0x2a7a4, 0x2a7a6, 0x2a7a8, 0x2a7b6, - 0x30100, 0x30102, 0x30104, 0x30106, 0x30108, 0x3010a, 0x3010c, 0x3010e, 0x30110, - 0x30112, 0x30114, 0x30116, 0x30118, 0x3011a, 0x3011c, 0x3011e, 0x30120, 0x30122, - 0x30124, 0x30126, 0x30128, 0x3012a, 0x3012c, 0x3012e, 0x30130, 0x30132, 0x30134, - 0x30136, 0x30139, 0x3013b, 0x3013d, 0x3013f, 0x30141, 0x30143, 0x30145, 0x30147, - 0x3014a, 0x3014c, 0x3014e, 0x30150, 0x30152, 0x30154, 0x30156, 0x30158, 0x3015a, - 0x3015c, 0x3015e, 0x30160, 0x30162, 0x30164, 0x30166, 0x30168, 0x3016a, 0x3016c, - 0x3016e, 0x30170, 0x30172, 0x30174, 0x30176, 0x30178, 0x30179, 0x3017b, 0x3017d, - 0x30181, 0x30182, 0x30184, 0x30186, 0x30187, 0x30193, 0x30194, 0x3019c, 0x3019d, - 0x3019f, 0x301a0, 0x301a2, 0x301a4, 0x301a6, 0x301a7, 0x301a9, 0x301ac, 0x301ae, - 0x301af, 0x301b5, 0x301b7, 0x301b8, 0x301bc, 0x301c4, 0x301c7, 0x301ca, 0x301cd, - 0x301cf, 0x301d1, 0x301d3, 0x301d5, 0x301d7, 0x301d9, 0x301db, 0x301de, 0x301e0, - 0x301e2, 0x301e4, 0x301e6, 0x301e8, 0x301ea, 0x301ec, 0x301ee, 0x301f1, 0x301f4, - 0x301fa, 0x301fc, 0x301fe, 0x30200, 0x30202, 0x30204, 0x30206, 0x30208, 0x3020a, - 0x3020c, 0x3020e, 0x30210, 0x30212, 0x30214, 0x30216, 0x30218, 0x3021a, 0x3021c, - 0x3021e, 0x30220, 0x30222, 0x30224, 0x30226, 0x30228, 0x3022a, 0x3022c, 0x3022e, - 0x30230, 0x30232, 0x3023a, 0x3023b, 0x3023d, 0x3023e, 0x30241, 0x30248, 0x3024a, - 0x3024c, 0x3024e, 0x30370, 0x30372, 0x30376, 0x3037f, 0x30386, 0x3038c, 0x3038e, - 0x3038f, 0x303cf, 0x303d8, 0x303da, 0x303dc, 0x303de, 0x303e0, 0x303e2, 0x303e4, - 0x303e6, 0x303e8, 0x303ea, 0x303ec, 0x303ee, 0x303f4, 0x303f7, 0x303f9, 0x303fa, - 0x30460, 0x30462, 0x30464, 0x30466, 0x30468, 0x3046a, 0x3046c, 0x3046e, 0x30470, - 0x30472, 0x30474, 0x30476, 0x30478, 0x3047a, 0x3047c, 0x3047e, 0x30480, 0x3048a, - 0x3048c, 0x3048e, 0x30490, 0x30492, 0x30494, 0x30496, 0x30498, 0x3049a, 0x3049c, - 0x3049e, 0x304a0, 0x304a2, 0x304a4, 0x304a6, 0x304a8, 0x304aa, 0x304ac, 0x304ae, - 0x304b0, 0x304b2, 0x304b4, 0x304b6, 0x304b8, 0x304ba, 0x304bc, 0x304be, 0x304c0, - 0x304c1, 0x304c3, 0x304c5, 0x304c7, 0x304c9, 0x304cb, 0x304cd, 0x304d0, 0x304d2, - 0x304d4, 0x304d6, 0x304d8, 0x304da, 0x304dc, 0x304de, 0x304e0, 0x304e2, 0x304e4, - 0x304e6, 0x304e8, 0x304ea, 0x304ec, 0x304ee, 0x304f0, 0x304f2, 0x304f4, 0x304f6, - 0x304f8, 0x304fa, 0x304fc, 0x304fe, 0x30500, 0x30502, 0x30504, 0x30506, 0x30508, - 0x3050a, 0x3050c, 0x3050e, 0x30510, 0x30512, 0x30514, 0x30516, 0x30518, 0x3051a, - 0x3051c, 0x3051e, 0x30520, 0x30522, 0x30524, 0x30526, 0x30528, 0x3052a, 0x3052c, - 0x3052e, 0x310c7, 0x310cd, 0x31e00, 0x31e02, 0x31e04, 0x31e06, 0x31e08, 0x31e0a, - 0x31e0c, 0x31e0e, 0x31e10, 0x31e12, 0x31e14, 0x31e16, 0x31e18, 0x31e1a, 0x31e1c, - 0x31e1e, 0x31e20, 0x31e22, 0x31e24, 0x31e26, 0x31e28, 0x31e2a, 0x31e2c, 0x31e2e, - 0x31e30, 0x31e32, 0x31e34, 0x31e36, 0x31e38, 0x31e3a, 0x31e3c, 0x31e3e, 0x31e40, - 0x31e42, 0x31e44, 0x31e46, 0x31e48, 0x31e4a, 0x31e4c, 0x31e4e, 0x31e50, 0x31e52, - 0x31e54, 0x31e56, 0x31e58, 0x31e5a, 0x31e5c, 0x31e5e, 0x31e60, 0x31e62, 0x31e64, - 0x31e66, 0x31e68, 0x31e6a, 0x31e6c, 0x31e6e, 0x31e70, 0x31e72, 0x31e74, 0x31e76, - 0x31e78, 0x31e7a, 0x31e7c, 0x31e7e, 0x31e80, 0x31e82, 0x31e84, 0x31e86, 0x31e88, - 0x31e8a, 0x31e8c, 0x31e8e, 0x31e90, 0x31e92, 0x31e94, 0x31e9e, 0x31ea0, 0x31ea2, - 0x31ea4, 0x31ea6, 0x31ea8, 0x31eaa, 0x31eac, 0x31eae, 0x31eb0, 0x31eb2, 0x31eb4, - 0x31eb6, 0x31eb8, 0x31eba, 0x31ebc, 0x31ebe, 0x31ec0, 0x31ec2, 0x31ec4, 0x31ec6, - 0x31ec8, 0x31eca, 0x31ecc, 0x31ece, 0x31ed0, 0x31ed2, 0x31ed4, 0x31ed6, 0x31ed8, - 0x31eda, 0x31edc, 0x31ede, 0x31ee0, 0x31ee2, 0x31ee4, 0x31ee6, 0x31ee8, 0x31eea, - 0x31eec, 0x31eee, 0x31ef0, 0x31ef2, 0x31ef4, 0x31ef6, 0x31ef8, 0x31efa, 0x31efc, - 0x31efe, 0x31f59, 0x31f5b, 0x31f5d, 0x31f5f, 0x32102, 0x32107, 0x32115, 0x32124, - 0x32126, 0x32128, 0x3213e, 0x3213f, 0x32145, 0x32183, 0x32c60, 0x32c67, 0x32c69, - 0x32c6b, 0x32c72, 0x32c75, 0x32c82, 0x32c84, 0x32c86, 0x32c88, 0x32c8a, 0x32c8c, - 0x32c8e, 0x32c90, 0x32c92, 0x32c94, 0x32c96, 0x32c98, 0x32c9a, 0x32c9c, 0x32c9e, - 0x32ca0, 0x32ca2, 0x32ca4, 0x32ca6, 0x32ca8, 0x32caa, 0x32cac, 0x32cae, 0x32cb0, - 0x32cb2, 0x32cb4, 0x32cb6, 0x32cb8, 0x32cba, 0x32cbc, 0x32cbe, 0x32cc0, 0x32cc2, - 0x32cc4, 0x32cc6, 0x32cc8, 0x32cca, 0x32ccc, 0x32cce, 0x32cd0, 0x32cd2, 0x32cd4, - 0x32cd6, 0x32cd8, 0x32cda, 0x32cdc, 0x32cde, 0x32ce0, 0x32ce2, 0x32ceb, 0x32ced, - 0x32cf2, 0x3a640, 0x3a642, 0x3a644, 0x3a646, 0x3a648, 0x3a64a, 0x3a64c, 0x3a64e, - 0x3a650, 0x3a652, 0x3a654, 0x3a656, 0x3a658, 0x3a65a, 0x3a65c, 0x3a65e, 0x3a660, - 0x3a662, 0x3a664, 0x3a666, 0x3a668, 0x3a66a, 0x3a66c, 0x3a680, 0x3a682, 0x3a684, - 0x3a686, 0x3a688, 0x3a68a, 0x3a68c, 0x3a68e, 0x3a690, 0x3a692, 0x3a694, 0x3a696, - 0x3a698, 0x3a69a, 0x3a722, 0x3a724, 0x3a726, 0x3a728, 0x3a72a, 0x3a72c, 0x3a72e, - 0x3a732, 0x3a734, 0x3a736, 0x3a738, 0x3a73a, 0x3a73c, 0x3a73e, 0x3a740, 0x3a742, - 0x3a744, 0x3a746, 0x3a748, 0x3a74a, 0x3a74c, 0x3a74e, 0x3a750, 0x3a752, 0x3a754, - 0x3a756, 0x3a758, 0x3a75a, 0x3a75c, 0x3a75e, 0x3a760, 0x3a762, 0x3a764, 0x3a766, - 0x3a768, 0x3a76a, 0x3a76c, 0x3a76e, 0x3a779, 0x3a77b, 0x3a77d, 0x3a77e, 0x3a780, - 0x3a782, 0x3a784, 0x3a786, 0x3a78b, 0x3a78d, 0x3a790, 0x3a792, 0x3a796, 0x3a798, - 0x3a79a, 0x3a79c, 0x3a79e, 0x3a7a0, 0x3a7a2, 0x3a7a4, 0x3a7a6, 0x3a7a8, 0x3a7b6, - 0x40100, 0x40102, 0x40104, 0x40106, 0x40108, 0x4010a, 0x4010c, 0x4010e, 0x40110, - 0x40112, 0x40114, 0x40116, 0x40118, 0x4011a, 0x4011c, 0x4011e, 0x40120, 0x40122, - 0x40124, 0x40126, 0x40128, 0x4012a, 0x4012c, 0x4012e, 0x40130, 0x40132, 0x40134, - 0x40136, 0x40139, 0x4013b, 0x4013d, 0x4013f, 0x40141, 0x40143, 0x40145, 0x40147, - 0x4014a, 0x4014c, 0x4014e, 0x40150, 0x40152, 0x40154, 0x40156, 0x40158, 0x4015a, - 0x4015c, 0x4015e, 0x40160, 0x40162, 0x40164, 0x40166, 0x40168, 0x4016a, 0x4016c, - 0x4016e, 0x40170, 0x40172, 0x40174, 0x40176, 0x40178, 0x40179, 0x4017b, 0x4017d, - 0x40181, 0x40182, 0x40184, 0x40186, 0x40187, 0x40193, 0x40194, 0x4019c, 0x4019d, - 0x4019f, 0x401a0, 0x401a2, 0x401a4, 0x401a6, 0x401a7, 0x401a9, 0x401ac, 0x401ae, - 0x401af, 0x401b5, 0x401b7, 0x401b8, 0x401bc, 0x401c4, 0x401c7, 0x401ca, 0x401cd, - 0x401cf, 0x401d1, 0x401d3, 0x401d5, 0x401d7, 0x401d9, 0x401db, 0x401de, 0x401e0, - 0x401e2, 0x401e4, 0x401e6, 0x401e8, 0x401ea, 0x401ec, 0x401ee, 0x401f1, 0x401f4, - 0x401fa, 0x401fc, 0x401fe, 0x40200, 0x40202, 0x40204, 0x40206, 0x40208, 0x4020a, - 0x4020c, 0x4020e, 0x40210, 0x40212, 0x40214, 0x40216, 0x40218, 0x4021a, 0x4021c, - 0x4021e, 0x40220, 0x40222, 0x40224, 0x40226, 0x40228, 0x4022a, 0x4022c, 0x4022e, - 0x40230, 0x40232, 0x4023a, 0x4023b, 0x4023d, 0x4023e, 0x40241, 0x40248, 0x4024a, - 0x4024c, 0x4024e, 0x40370, 0x40372, 0x40376, 0x4037f, 0x40386, 0x4038c, 0x4038e, - 0x4038f, 0x403cf, 0x403d8, 0x403da, 0x403dc, 0x403de, 0x403e0, 0x403e2, 0x403e4, - 0x403e6, 0x403e8, 0x403ea, 0x403ec, 0x403ee, 0x403f4, 0x403f7, 0x403f9, 0x403fa, - 0x40460, 0x40462, 0x40464, 0x40466, 0x40468, 0x4046a, 0x4046c, 0x4046e, 0x40470, - 0x40472, 0x40474, 0x40476, 0x40478, 0x4047a, 0x4047c, 0x4047e, 0x40480, 0x4048a, - 0x4048c, 0x4048e, 0x40490, 0x40492, 0x40494, 0x40496, 0x40498, 0x4049a, 0x4049c, - 0x4049e, 0x404a0, 0x404a2, 0x404a4, 0x404a6, 0x404a8, 0x404aa, 0x404ac, 0x404ae, - 0x404b0, 0x404b2, 0x404b4, 0x404b6, 0x404b8, 0x404ba, 0x404bc, 0x404be, 0x404c0, - 0x404c1, 0x404c3, 0x404c5, 0x404c7, 0x404c9, 0x404cb, 0x404cd, 0x404d0, 0x404d2, - 0x404d4, 0x404d6, 0x404d8, 0x404da, 0x404dc, 0x404de, 0x404e0, 0x404e2, 0x404e4, - 0x404e6, 0x404e8, 0x404ea, 0x404ec, 0x404ee, 0x404f0, 0x404f2, 0x404f4, 0x404f6, - 0x404f8, 0x404fa, 0x404fc, 0x404fe, 0x40500, 0x40502, 0x40504, 0x40506, 0x40508, - 0x4050a, 0x4050c, 0x4050e, 0x40510, 0x40512, 0x40514, 0x40516, 0x40518, 0x4051a, - 0x4051c, 0x4051e, 0x40520, 0x40522, 0x40524, 0x40526, 0x40528, 0x4052a, 0x4052c, - 0x4052e, 0x410c7, 0x410cd, 0x41e00, 0x41e02, 0x41e04, 0x41e06, 0x41e08, 0x41e0a, - 0x41e0c, 0x41e0e, 0x41e10, 0x41e12, 0x41e14, 0x41e16, 0x41e18, 0x41e1a, 0x41e1c, - 0x41e1e, 0x41e20, 0x41e22, 0x41e24, 0x41e26, 0x41e28, 0x41e2a, 0x41e2c, 0x41e2e, - 0x41e30, 0x41e32, 0x41e34, 0x41e36, 0x41e38, 0x41e3a, 0x41e3c, 0x41e3e, 0x41e40, - 0x41e42, 0x41e44, 0x41e46, 0x41e48, 0x41e4a, 0x41e4c, 0x41e4e, 0x41e50, 0x41e52, - 0x41e54, 0x41e56, 0x41e58, 0x41e5a, 0x41e5c, 0x41e5e, 0x41e60, 0x41e62, 0x41e64, - 0x41e66, 0x41e68, 0x41e6a, 0x41e6c, 0x41e6e, 0x41e70, 0x41e72, 0x41e74, 0x41e76, - 0x41e78, 0x41e7a, 0x41e7c, 0x41e7e, 0x41e80, 0x41e82, 0x41e84, 0x41e86, 0x41e88, - 0x41e8a, 0x41e8c, 0x41e8e, 0x41e90, 0x41e92, 0x41e94, 0x41e9e, 0x41ea0, 0x41ea2, - 0x41ea4, 0x41ea6, 0x41ea8, 0x41eaa, 0x41eac, 0x41eae, 0x41eb0, 0x41eb2, 0x41eb4, - 0x41eb6, 0x41eb8, 0x41eba, 0x41ebc, 0x41ebe, 0x41ec0, 0x41ec2, 0x41ec4, 0x41ec6, - 0x41ec8, 0x41eca, 0x41ecc, 0x41ece, 0x41ed0, 0x41ed2, 0x41ed4, 0x41ed6, 0x41ed8, - 0x41eda, 0x41edc, 0x41ede, 0x41ee0, 0x41ee2, 0x41ee4, 0x41ee6, 0x41ee8, 0x41eea, - 0x41eec, 0x41eee, 0x41ef0, 0x41ef2, 0x41ef4, 0x41ef6, 0x41ef8, 0x41efa, 0x41efc, - 0x41efe, 0x41f59, 0x41f5b, 0x41f5d, 0x41f5f, 0x42102, 0x42107, 0x42115, 0x42124, - 0x42126, 0x42128, 0x4213e, 0x4213f, 0x42145, 0x42183, 0x42c60, 0x42c67, 0x42c69, - 0x42c6b, 0x42c72, 0x42c75, 0x42c82, 0x42c84, 0x42c86, 0x42c88, 0x42c8a, 0x42c8c, - 0x42c8e, 0x42c90, 0x42c92, 0x42c94, 0x42c96, 0x42c98, 0x42c9a, 0x42c9c, 0x42c9e, - 0x42ca0, 0x42ca2, 0x42ca4, 0x42ca6, 0x42ca8, 0x42caa, 0x42cac, 0x42cae, 0x42cb0, - 0x42cb2, 0x42cb4, 0x42cb6, 0x42cb8, 0x42cba, 0x42cbc, 0x42cbe, 0x42cc0, 0x42cc2, - 0x42cc4, 0x42cc6, 0x42cc8, 0x42cca, 0x42ccc, 0x42cce, 0x42cd0, 0x42cd2, 0x42cd4, - 0x42cd6, 0x42cd8, 0x42cda, 0x42cdc, 0x42cde, 0x42ce0, 0x42ce2, 0x42ceb, 0x42ced, - 0x42cf2, 0x4a640, 0x4a642, 0x4a644, 0x4a646, 0x4a648, 0x4a64a, 0x4a64c, 0x4a64e, - 0x4a650, 0x4a652, 0x4a654, 0x4a656, 0x4a658, 0x4a65a, 0x4a65c, 0x4a65e, 0x4a660, - 0x4a662, 0x4a664, 0x4a666, 0x4a668, 0x4a66a, 0x4a66c, 0x4a680, 0x4a682, 0x4a684, - 0x4a686, 0x4a688, 0x4a68a, 0x4a68c, 0x4a68e, 0x4a690, 0x4a692, 0x4a694, 0x4a696, - 0x4a698, 0x4a69a, 0x4a722, 0x4a724, 0x4a726, 0x4a728, 0x4a72a, 0x4a72c, 0x4a72e, - 0x4a732, 0x4a734, 0x4a736, 0x4a738, 0x4a73a, 0x4a73c, 0x4a73e, 0x4a740, 0x4a742, - 0x4a744, 0x4a746, 0x4a748, 0x4a74a, 0x4a74c, 0x4a74e, 0x4a750, 0x4a752, 0x4a754, - 0x4a756, 0x4a758, 0x4a75a, 0x4a75c, 0x4a75e, 0x4a760, 0x4a762, 0x4a764, 0x4a766, - 0x4a768, 0x4a76a, 0x4a76c, 0x4a76e, 0x4a779, 0x4a77b, 0x4a77d, 0x4a77e, 0x4a780, - 0x4a782, 0x4a784, 0x4a786, 0x4a78b, 0x4a78d, 0x4a790, 0x4a792, 0x4a796, 0x4a798, - 0x4a79a, 0x4a79c, 0x4a79e, 0x4a7a0, 0x4a7a2, 0x4a7a4, 0x4a7a6, 0x4a7a8, 0x4a7b6, - 0x50100, 0x50102, 0x50104, 0x50106, 0x50108, 0x5010a, 0x5010c, 0x5010e, 0x50110, - 0x50112, 0x50114, 0x50116, 0x50118, 0x5011a, 0x5011c, 0x5011e, 0x50120, 0x50122, - 0x50124, 0x50126, 0x50128, 0x5012a, 0x5012c, 0x5012e, 0x50130, 0x50132, 0x50134, - 0x50136, 0x50139, 0x5013b, 0x5013d, 0x5013f, 0x50141, 0x50143, 0x50145, 0x50147, - 0x5014a, 0x5014c, 0x5014e, 0x50150, 0x50152, 0x50154, 0x50156, 0x50158, 0x5015a, - 0x5015c, 0x5015e, 0x50160, 0x50162, 0x50164, 0x50166, 0x50168, 0x5016a, 0x5016c, - 0x5016e, 0x50170, 0x50172, 0x50174, 0x50176, 0x50178, 0x50179, 0x5017b, 0x5017d, - 0x50181, 0x50182, 0x50184, 0x50186, 0x50187, 0x50193, 0x50194, 0x5019c, 0x5019d, - 0x5019f, 0x501a0, 0x501a2, 0x501a4, 0x501a6, 0x501a7, 0x501a9, 0x501ac, 0x501ae, - 0x501af, 0x501b5, 0x501b7, 0x501b8, 0x501bc, 0x501c4, 0x501c7, 0x501ca, 0x501cd, - 0x501cf, 0x501d1, 0x501d3, 0x501d5, 0x501d7, 0x501d9, 0x501db, 0x501de, 0x501e0, - 0x501e2, 0x501e4, 0x501e6, 0x501e8, 0x501ea, 0x501ec, 0x501ee, 0x501f1, 0x501f4, - 0x501fa, 0x501fc, 0x501fe, 0x50200, 0x50202, 0x50204, 0x50206, 0x50208, 0x5020a, - 0x5020c, 0x5020e, 0x50210, 0x50212, 0x50214, 0x50216, 0x50218, 0x5021a, 0x5021c, - 0x5021e, 0x50220, 0x50222, 0x50224, 0x50226, 0x50228, 0x5022a, 0x5022c, 0x5022e, - 0x50230, 0x50232, 0x5023a, 0x5023b, 0x5023d, 0x5023e, 0x50241, 0x50248, 0x5024a, - 0x5024c, 0x5024e, 0x50370, 0x50372, 0x50376, 0x5037f, 0x50386, 0x5038c, 0x5038e, - 0x5038f, 0x503cf, 0x503d8, 0x503da, 0x503dc, 0x503de, 0x503e0, 0x503e2, 0x503e4, - 0x503e6, 0x503e8, 0x503ea, 0x503ec, 0x503ee, 0x503f4, 0x503f7, 0x503f9, 0x503fa, - 0x50460, 0x50462, 0x50464, 0x50466, 0x50468, 0x5046a, 0x5046c, 0x5046e, 0x50470, - 0x50472, 0x50474, 0x50476, 0x50478, 0x5047a, 0x5047c, 0x5047e, 0x50480, 0x5048a, - 0x5048c, 0x5048e, 0x50490, 0x50492, 0x50494, 0x50496, 0x50498, 0x5049a, 0x5049c, - 0x5049e, 0x504a0, 0x504a2, 0x504a4, 0x504a6, 0x504a8, 0x504aa, 0x504ac, 0x504ae, - 0x504b0, 0x504b2, 0x504b4, 0x504b6, 0x504b8, 0x504ba, 0x504bc, 0x504be, 0x504c0, - 0x504c1, 0x504c3, 0x504c5, 0x504c7, 0x504c9, 0x504cb, 0x504cd, 0x504d0, 0x504d2, - 0x504d4, 0x504d6, 0x504d8, 0x504da, 0x504dc, 0x504de, 0x504e0, 0x504e2, 0x504e4, - 0x504e6, 0x504e8, 0x504ea, 0x504ec, 0x504ee, 0x504f0, 0x504f2, 0x504f4, 0x504f6, - 0x504f8, 0x504fa, 0x504fc, 0x504fe, 0x50500, 0x50502, 0x50504, 0x50506, 0x50508, - 0x5050a, 0x5050c, 0x5050e, 0x50510, 0x50512, 0x50514, 0x50516, 0x50518, 0x5051a, - 0x5051c, 0x5051e, 0x50520, 0x50522, 0x50524, 0x50526, 0x50528, 0x5052a, 0x5052c, - 0x5052e, 0x510c7, 0x510cd, 0x51e00, 0x51e02, 0x51e04, 0x51e06, 0x51e08, 0x51e0a, - 0x51e0c, 0x51e0e, 0x51e10, 0x51e12, 0x51e14, 0x51e16, 0x51e18, 0x51e1a, 0x51e1c, - 0x51e1e, 0x51e20, 0x51e22, 0x51e24, 0x51e26, 0x51e28, 0x51e2a, 0x51e2c, 0x51e2e, - 0x51e30, 0x51e32, 0x51e34, 0x51e36, 0x51e38, 0x51e3a, 0x51e3c, 0x51e3e, 0x51e40, - 0x51e42, 0x51e44, 0x51e46, 0x51e48, 0x51e4a, 0x51e4c, 0x51e4e, 0x51e50, 0x51e52, - 0x51e54, 0x51e56, 0x51e58, 0x51e5a, 0x51e5c, 0x51e5e, 0x51e60, 0x51e62, 0x51e64, - 0x51e66, 0x51e68, 0x51e6a, 0x51e6c, 0x51e6e, 0x51e70, 0x51e72, 0x51e74, 0x51e76, - 0x51e78, 0x51e7a, 0x51e7c, 0x51e7e, 0x51e80, 0x51e82, 0x51e84, 0x51e86, 0x51e88, - 0x51e8a, 0x51e8c, 0x51e8e, 0x51e90, 0x51e92, 0x51e94, 0x51e9e, 0x51ea0, 0x51ea2, - 0x51ea4, 0x51ea6, 0x51ea8, 0x51eaa, 0x51eac, 0x51eae, 0x51eb0, 0x51eb2, 0x51eb4, - 0x51eb6, 0x51eb8, 0x51eba, 0x51ebc, 0x51ebe, 0x51ec0, 0x51ec2, 0x51ec4, 0x51ec6, - 0x51ec8, 0x51eca, 0x51ecc, 0x51ece, 0x51ed0, 0x51ed2, 0x51ed4, 0x51ed6, 0x51ed8, - 0x51eda, 0x51edc, 0x51ede, 0x51ee0, 0x51ee2, 0x51ee4, 0x51ee6, 0x51ee8, 0x51eea, - 0x51eec, 0x51eee, 0x51ef0, 0x51ef2, 0x51ef4, 0x51ef6, 0x51ef8, 0x51efa, 0x51efc, - 0x51efe, 0x51f59, 0x51f5b, 0x51f5d, 0x51f5f, 0x52102, 0x52107, 0x52115, 0x52124, - 0x52126, 0x52128, 0x5213e, 0x5213f, 0x52145, 0x52183, 0x52c60, 0x52c67, 0x52c69, - 0x52c6b, 0x52c72, 0x52c75, 0x52c82, 0x52c84, 0x52c86, 0x52c88, 0x52c8a, 0x52c8c, - 0x52c8e, 0x52c90, 0x52c92, 0x52c94, 0x52c96, 0x52c98, 0x52c9a, 0x52c9c, 0x52c9e, - 0x52ca0, 0x52ca2, 0x52ca4, 0x52ca6, 0x52ca8, 0x52caa, 0x52cac, 0x52cae, 0x52cb0, - 0x52cb2, 0x52cb4, 0x52cb6, 0x52cb8, 0x52cba, 0x52cbc, 0x52cbe, 0x52cc0, 0x52cc2, - 0x52cc4, 0x52cc6, 0x52cc8, 0x52cca, 0x52ccc, 0x52cce, 0x52cd0, 0x52cd2, 0x52cd4, - 0x52cd6, 0x52cd8, 0x52cda, 0x52cdc, 0x52cde, 0x52ce0, 0x52ce2, 0x52ceb, 0x52ced, - 0x52cf2, 0x5a640, 0x5a642, 0x5a644, 0x5a646, 0x5a648, 0x5a64a, 0x5a64c, 0x5a64e, - 0x5a650, 0x5a652, 0x5a654, 0x5a656, 0x5a658, 0x5a65a, 0x5a65c, 0x5a65e, 0x5a660, - 0x5a662, 0x5a664, 0x5a666, 0x5a668, 0x5a66a, 0x5a66c, 0x5a680, 0x5a682, 0x5a684, - 0x5a686, 0x5a688, 0x5a68a, 0x5a68c, 0x5a68e, 0x5a690, 0x5a692, 0x5a694, 0x5a696, - 0x5a698, 0x5a69a, 0x5a722, 0x5a724, 0x5a726, 0x5a728, 0x5a72a, 0x5a72c, 0x5a72e, - 0x5a732, 0x5a734, 0x5a736, 0x5a738, 0x5a73a, 0x5a73c, 0x5a73e, 0x5a740, 0x5a742, - 0x5a744, 0x5a746, 0x5a748, 0x5a74a, 0x5a74c, 0x5a74e, 0x5a750, 0x5a752, 0x5a754, - 0x5a756, 0x5a758, 0x5a75a, 0x5a75c, 0x5a75e, 0x5a760, 0x5a762, 0x5a764, 0x5a766, - 0x5a768, 0x5a76a, 0x5a76c, 0x5a76e, 0x5a779, 0x5a77b, 0x5a77d, 0x5a77e, 0x5a780, - 0x5a782, 0x5a784, 0x5a786, 0x5a78b, 0x5a78d, 0x5a790, 0x5a792, 0x5a796, 0x5a798, - 0x5a79a, 0x5a79c, 0x5a79e, 0x5a7a0, 0x5a7a2, 0x5a7a4, 0x5a7a6, 0x5a7a8, 0x5a7b6, - 0x60100, 0x60102, 0x60104, 0x60106, 0x60108, 0x6010a, 0x6010c, 0x6010e, 0x60110, - 0x60112, 0x60114, 0x60116, 0x60118, 0x6011a, 0x6011c, 0x6011e, 0x60120, 0x60122, - 0x60124, 0x60126, 0x60128, 0x6012a, 0x6012c, 0x6012e, 0x60130, 0x60132, 0x60134, - 0x60136, 0x60139, 0x6013b, 0x6013d, 0x6013f, 0x60141, 0x60143, 0x60145, 0x60147, - 0x6014a, 0x6014c, 0x6014e, 0x60150, 0x60152, 0x60154, 0x60156, 0x60158, 0x6015a, - 0x6015c, 0x6015e, 0x60160, 0x60162, 0x60164, 0x60166, 0x60168, 0x6016a, 0x6016c, - 0x6016e, 0x60170, 0x60172, 0x60174, 0x60176, 0x60178, 0x60179, 0x6017b, 0x6017d, - 0x60181, 0x60182, 0x60184, 0x60186, 0x60187, 0x60193, 0x60194, 0x6019c, 0x6019d, - 0x6019f, 0x601a0, 0x601a2, 0x601a4, 0x601a6, 0x601a7, 0x601a9, 0x601ac, 0x601ae, - 0x601af, 0x601b5, 0x601b7, 0x601b8, 0x601bc, 0x601c4, 0x601c7, 0x601ca, 0x601cd, - 0x601cf, 0x601d1, 0x601d3, 0x601d5, 0x601d7, 0x601d9, 0x601db, 0x601de, 0x601e0, - 0x601e2, 0x601e4, 0x601e6, 0x601e8, 0x601ea, 0x601ec, 0x601ee, 0x601f1, 0x601f4, - 0x601fa, 0x601fc, 0x601fe, 0x60200, 0x60202, 0x60204, 0x60206, 0x60208, 0x6020a, - 0x6020c, 0x6020e, 0x60210, 0x60212, 0x60214, 0x60216, 0x60218, 0x6021a, 0x6021c, - 0x6021e, 0x60220, 0x60222, 0x60224, 0x60226, 0x60228, 0x6022a, 0x6022c, 0x6022e, - 0x60230, 0x60232, 0x6023a, 0x6023b, 0x6023d, 0x6023e, 0x60241, 0x60248, 0x6024a, - 0x6024c, 0x6024e, 0x60370, 0x60372, 0x60376, 0x6037f, 0x60386, 0x6038c, 0x6038e, - 0x6038f, 0x603cf, 0x603d8, 0x603da, 0x603dc, 0x603de, 0x603e0, 0x603e2, 0x603e4, - 0x603e6, 0x603e8, 0x603ea, 0x603ec, 0x603ee, 0x603f4, 0x603f7, 0x603f9, 0x603fa, - 0x60460, 0x60462, 0x60464, 0x60466, 0x60468, 0x6046a, 0x6046c, 0x6046e, 0x60470, - 0x60472, 0x60474, 0x60476, 0x60478, 0x6047a, 0x6047c, 0x6047e, 0x60480, 0x6048a, - 0x6048c, 0x6048e, 0x60490, 0x60492, 0x60494, 0x60496, 0x60498, 0x6049a, 0x6049c, - 0x6049e, 0x604a0, 0x604a2, 0x604a4, 0x604a6, 0x604a8, 0x604aa, 0x604ac, 0x604ae, - 0x604b0, 0x604b2, 0x604b4, 0x604b6, 0x604b8, 0x604ba, 0x604bc, 0x604be, 0x604c0, - 0x604c1, 0x604c3, 0x604c5, 0x604c7, 0x604c9, 0x604cb, 0x604cd, 0x604d0, 0x604d2, - 0x604d4, 0x604d6, 0x604d8, 0x604da, 0x604dc, 0x604de, 0x604e0, 0x604e2, 0x604e4, - 0x604e6, 0x604e8, 0x604ea, 0x604ec, 0x604ee, 0x604f0, 0x604f2, 0x604f4, 0x604f6, - 0x604f8, 0x604fa, 0x604fc, 0x604fe, 0x60500, 0x60502, 0x60504, 0x60506, 0x60508, - 0x6050a, 0x6050c, 0x6050e, 0x60510, 0x60512, 0x60514, 0x60516, 0x60518, 0x6051a, - 0x6051c, 0x6051e, 0x60520, 0x60522, 0x60524, 0x60526, 0x60528, 0x6052a, 0x6052c, - 0x6052e, 0x610c7, 0x610cd, 0x61e00, 0x61e02, 0x61e04, 0x61e06, 0x61e08, 0x61e0a, - 0x61e0c, 0x61e0e, 0x61e10, 0x61e12, 0x61e14, 0x61e16, 0x61e18, 0x61e1a, 0x61e1c, - 0x61e1e, 0x61e20, 0x61e22, 0x61e24, 0x61e26, 0x61e28, 0x61e2a, 0x61e2c, 0x61e2e, - 0x61e30, 0x61e32, 0x61e34, 0x61e36, 0x61e38, 0x61e3a, 0x61e3c, 0x61e3e, 0x61e40, - 0x61e42, 0x61e44, 0x61e46, 0x61e48, 0x61e4a, 0x61e4c, 0x61e4e, 0x61e50, 0x61e52, - 0x61e54, 0x61e56, 0x61e58, 0x61e5a, 0x61e5c, 0x61e5e, 0x61e60, 0x61e62, 0x61e64, - 0x61e66, 0x61e68, 0x61e6a, 0x61e6c, 0x61e6e, 0x61e70, 0x61e72, 0x61e74, 0x61e76, - 0x61e78, 0x61e7a, 0x61e7c, 0x61e7e, 0x61e80, 0x61e82, 0x61e84, 0x61e86, 0x61e88, - 0x61e8a, 0x61e8c, 0x61e8e, 0x61e90, 0x61e92, 0x61e94, 0x61e9e, 0x61ea0, 0x61ea2, - 0x61ea4, 0x61ea6, 0x61ea8, 0x61eaa, 0x61eac, 0x61eae, 0x61eb0, 0x61eb2, 0x61eb4, - 0x61eb6, 0x61eb8, 0x61eba, 0x61ebc, 0x61ebe, 0x61ec0, 0x61ec2, 0x61ec4, 0x61ec6, - 0x61ec8, 0x61eca, 0x61ecc, 0x61ece, 0x61ed0, 0x61ed2, 0x61ed4, 0x61ed6, 0x61ed8, - 0x61eda, 0x61edc, 0x61ede, 0x61ee0, 0x61ee2, 0x61ee4, 0x61ee6, 0x61ee8, 0x61eea, - 0x61eec, 0x61eee, 0x61ef0, 0x61ef2, 0x61ef4, 0x61ef6, 0x61ef8, 0x61efa, 0x61efc, - 0x61efe, 0x61f59, 0x61f5b, 0x61f5d, 0x61f5f, 0x62102, 0x62107, 0x62115, 0x62124, - 0x62126, 0x62128, 0x6213e, 0x6213f, 0x62145, 0x62183, 0x62c60, 0x62c67, 0x62c69, - 0x62c6b, 0x62c72, 0x62c75, 0x62c82, 0x62c84, 0x62c86, 0x62c88, 0x62c8a, 0x62c8c, - 0x62c8e, 0x62c90, 0x62c92, 0x62c94, 0x62c96, 0x62c98, 0x62c9a, 0x62c9c, 0x62c9e, - 0x62ca0, 0x62ca2, 0x62ca4, 0x62ca6, 0x62ca8, 0x62caa, 0x62cac, 0x62cae, 0x62cb0, - 0x62cb2, 0x62cb4, 0x62cb6, 0x62cb8, 0x62cba, 0x62cbc, 0x62cbe, 0x62cc0, 0x62cc2, - 0x62cc4, 0x62cc6, 0x62cc8, 0x62cca, 0x62ccc, 0x62cce, 0x62cd0, 0x62cd2, 0x62cd4, - 0x62cd6, 0x62cd8, 0x62cda, 0x62cdc, 0x62cde, 0x62ce0, 0x62ce2, 0x62ceb, 0x62ced, - 0x62cf2, 0x6a640, 0x6a642, 0x6a644, 0x6a646, 0x6a648, 0x6a64a, 0x6a64c, 0x6a64e, - 0x6a650, 0x6a652, 0x6a654, 0x6a656, 0x6a658, 0x6a65a, 0x6a65c, 0x6a65e, 0x6a660, - 0x6a662, 0x6a664, 0x6a666, 0x6a668, 0x6a66a, 0x6a66c, 0x6a680, 0x6a682, 0x6a684, - 0x6a686, 0x6a688, 0x6a68a, 0x6a68c, 0x6a68e, 0x6a690, 0x6a692, 0x6a694, 0x6a696, - 0x6a698, 0x6a69a, 0x6a722, 0x6a724, 0x6a726, 0x6a728, 0x6a72a, 0x6a72c, 0x6a72e, - 0x6a732, 0x6a734, 0x6a736, 0x6a738, 0x6a73a, 0x6a73c, 0x6a73e, 0x6a740, 0x6a742, - 0x6a744, 0x6a746, 0x6a748, 0x6a74a, 0x6a74c, 0x6a74e, 0x6a750, 0x6a752, 0x6a754, - 0x6a756, 0x6a758, 0x6a75a, 0x6a75c, 0x6a75e, 0x6a760, 0x6a762, 0x6a764, 0x6a766, - 0x6a768, 0x6a76a, 0x6a76c, 0x6a76e, 0x6a779, 0x6a77b, 0x6a77d, 0x6a77e, 0x6a780, - 0x6a782, 0x6a784, 0x6a786, 0x6a78b, 0x6a78d, 0x6a790, 0x6a792, 0x6a796, 0x6a798, - 0x6a79a, 0x6a79c, 0x6a79e, 0x6a7a0, 0x6a7a2, 0x6a7a4, 0x6a7a6, 0x6a7a8, 0x6a7b6, - 0x70100, 0x70102, 0x70104, 0x70106, 0x70108, 0x7010a, 0x7010c, 0x7010e, 0x70110, - 0x70112, 0x70114, 0x70116, 0x70118, 0x7011a, 0x7011c, 0x7011e, 0x70120, 0x70122, - 0x70124, 0x70126, 0x70128, 0x7012a, 0x7012c, 0x7012e, 0x70130, 0x70132, 0x70134, - 0x70136, 0x70139, 0x7013b, 0x7013d, 0x7013f, 0x70141, 0x70143, 0x70145, 0x70147, - 0x7014a, 0x7014c, 0x7014e, 0x70150, 0x70152, 0x70154, 0x70156, 0x70158, 0x7015a, - 0x7015c, 0x7015e, 0x70160, 0x70162, 0x70164, 0x70166, 0x70168, 0x7016a, 0x7016c, - 0x7016e, 0x70170, 0x70172, 0x70174, 0x70176, 0x70178, 0x70179, 0x7017b, 0x7017d, - 0x70181, 0x70182, 0x70184, 0x70186, 0x70187, 0x70193, 0x70194, 0x7019c, 0x7019d, - 0x7019f, 0x701a0, 0x701a2, 0x701a4, 0x701a6, 0x701a7, 0x701a9, 0x701ac, 0x701ae, - 0x701af, 0x701b5, 0x701b7, 0x701b8, 0x701bc, 0x701c4, 0x701c7, 0x701ca, 0x701cd, - 0x701cf, 0x701d1, 0x701d3, 0x701d5, 0x701d7, 0x701d9, 0x701db, 0x701de, 0x701e0, - 0x701e2, 0x701e4, 0x701e6, 0x701e8, 0x701ea, 0x701ec, 0x701ee, 0x701f1, 0x701f4, - 0x701fa, 0x701fc, 0x701fe, 0x70200, 0x70202, 0x70204, 0x70206, 0x70208, 0x7020a, - 0x7020c, 0x7020e, 0x70210, 0x70212, 0x70214, 0x70216, 0x70218, 0x7021a, 0x7021c, - 0x7021e, 0x70220, 0x70222, 0x70224, 0x70226, 0x70228, 0x7022a, 0x7022c, 0x7022e, - 0x70230, 0x70232, 0x7023a, 0x7023b, 0x7023d, 0x7023e, 0x70241, 0x70248, 0x7024a, - 0x7024c, 0x7024e, 0x70370, 0x70372, 0x70376, 0x7037f, 0x70386, 0x7038c, 0x7038e, - 0x7038f, 0x703cf, 0x703d8, 0x703da, 0x703dc, 0x703de, 0x703e0, 0x703e2, 0x703e4, - 0x703e6, 0x703e8, 0x703ea, 0x703ec, 0x703ee, 0x703f4, 0x703f7, 0x703f9, 0x703fa, - 0x70460, 0x70462, 0x70464, 0x70466, 0x70468, 0x7046a, 0x7046c, 0x7046e, 0x70470, - 0x70472, 0x70474, 0x70476, 0x70478, 0x7047a, 0x7047c, 0x7047e, 0x70480, 0x7048a, - 0x7048c, 0x7048e, 0x70490, 0x70492, 0x70494, 0x70496, 0x70498, 0x7049a, 0x7049c, - 0x7049e, 0x704a0, 0x704a2, 0x704a4, 0x704a6, 0x704a8, 0x704aa, 0x704ac, 0x704ae, - 0x704b0, 0x704b2, 0x704b4, 0x704b6, 0x704b8, 0x704ba, 0x704bc, 0x704be, 0x704c0, - 0x704c1, 0x704c3, 0x704c5, 0x704c7, 0x704c9, 0x704cb, 0x704cd, 0x704d0, 0x704d2, - 0x704d4, 0x704d6, 0x704d8, 0x704da, 0x704dc, 0x704de, 0x704e0, 0x704e2, 0x704e4, - 0x704e6, 0x704e8, 0x704ea, 0x704ec, 0x704ee, 0x704f0, 0x704f2, 0x704f4, 0x704f6, - 0x704f8, 0x704fa, 0x704fc, 0x704fe, 0x70500, 0x70502, 0x70504, 0x70506, 0x70508, - 0x7050a, 0x7050c, 0x7050e, 0x70510, 0x70512, 0x70514, 0x70516, 0x70518, 0x7051a, - 0x7051c, 0x7051e, 0x70520, 0x70522, 0x70524, 0x70526, 0x70528, 0x7052a, 0x7052c, - 0x7052e, 0x710c7, 0x710cd, 0x71e00, 0x71e02, 0x71e04, 0x71e06, 0x71e08, 0x71e0a, - 0x71e0c, 0x71e0e, 0x71e10, 0x71e12, 0x71e14, 0x71e16, 0x71e18, 0x71e1a, 0x71e1c, - 0x71e1e, 0x71e20, 0x71e22, 0x71e24, 0x71e26, 0x71e28, 0x71e2a, 0x71e2c, 0x71e2e, - 0x71e30, 0x71e32, 0x71e34, 0x71e36, 0x71e38, 0x71e3a, 0x71e3c, 0x71e3e, 0x71e40, - 0x71e42, 0x71e44, 0x71e46, 0x71e48, 0x71e4a, 0x71e4c, 0x71e4e, 0x71e50, 0x71e52, - 0x71e54, 0x71e56, 0x71e58, 0x71e5a, 0x71e5c, 0x71e5e, 0x71e60, 0x71e62, 0x71e64, - 0x71e66, 0x71e68, 0x71e6a, 0x71e6c, 0x71e6e, 0x71e70, 0x71e72, 0x71e74, 0x71e76, - 0x71e78, 0x71e7a, 0x71e7c, 0x71e7e, 0x71e80, 0x71e82, 0x71e84, 0x71e86, 0x71e88, - 0x71e8a, 0x71e8c, 0x71e8e, 0x71e90, 0x71e92, 0x71e94, 0x71e9e, 0x71ea0, 0x71ea2, - 0x71ea4, 0x71ea6, 0x71ea8, 0x71eaa, 0x71eac, 0x71eae, 0x71eb0, 0x71eb2, 0x71eb4, - 0x71eb6, 0x71eb8, 0x71eba, 0x71ebc, 0x71ebe, 0x71ec0, 0x71ec2, 0x71ec4, 0x71ec6, - 0x71ec8, 0x71eca, 0x71ecc, 0x71ece, 0x71ed0, 0x71ed2, 0x71ed4, 0x71ed6, 0x71ed8, - 0x71eda, 0x71edc, 0x71ede, 0x71ee0, 0x71ee2, 0x71ee4, 0x71ee6, 0x71ee8, 0x71eea, - 0x71eec, 0x71eee, 0x71ef0, 0x71ef2, 0x71ef4, 0x71ef6, 0x71ef8, 0x71efa, 0x71efc, - 0x71efe, 0x71f59, 0x71f5b, 0x71f5d, 0x71f5f, 0x72102, 0x72107, 0x72115, 0x72124, - 0x72126, 0x72128, 0x7213e, 0x7213f, 0x72145, 0x72183, 0x72c60, 0x72c67, 0x72c69, - 0x72c6b, 0x72c72, 0x72c75, 0x72c82, 0x72c84, 0x72c86, 0x72c88, 0x72c8a, 0x72c8c, - 0x72c8e, 0x72c90, 0x72c92, 0x72c94, 0x72c96, 0x72c98, 0x72c9a, 0x72c9c, 0x72c9e, - 0x72ca0, 0x72ca2, 0x72ca4, 0x72ca6, 0x72ca8, 0x72caa, 0x72cac, 0x72cae, 0x72cb0, - 0x72cb2, 0x72cb4, 0x72cb6, 0x72cb8, 0x72cba, 0x72cbc, 0x72cbe, 0x72cc0, 0x72cc2, - 0x72cc4, 0x72cc6, 0x72cc8, 0x72cca, 0x72ccc, 0x72cce, 0x72cd0, 0x72cd2, 0x72cd4, - 0x72cd6, 0x72cd8, 0x72cda, 0x72cdc, 0x72cde, 0x72ce0, 0x72ce2, 0x72ceb, 0x72ced, - 0x72cf2, 0x7a640, 0x7a642, 0x7a644, 0x7a646, 0x7a648, 0x7a64a, 0x7a64c, 0x7a64e, - 0x7a650, 0x7a652, 0x7a654, 0x7a656, 0x7a658, 0x7a65a, 0x7a65c, 0x7a65e, 0x7a660, - 0x7a662, 0x7a664, 0x7a666, 0x7a668, 0x7a66a, 0x7a66c, 0x7a680, 0x7a682, 0x7a684, - 0x7a686, 0x7a688, 0x7a68a, 0x7a68c, 0x7a68e, 0x7a690, 0x7a692, 0x7a694, 0x7a696, - 0x7a698, 0x7a69a, 0x7a722, 0x7a724, 0x7a726, 0x7a728, 0x7a72a, 0x7a72c, 0x7a72e, - 0x7a732, 0x7a734, 0x7a736, 0x7a738, 0x7a73a, 0x7a73c, 0x7a73e, 0x7a740, 0x7a742, - 0x7a744, 0x7a746, 0x7a748, 0x7a74a, 0x7a74c, 0x7a74e, 0x7a750, 0x7a752, 0x7a754, - 0x7a756, 0x7a758, 0x7a75a, 0x7a75c, 0x7a75e, 0x7a760, 0x7a762, 0x7a764, 0x7a766, - 0x7a768, 0x7a76a, 0x7a76c, 0x7a76e, 0x7a779, 0x7a77b, 0x7a77d, 0x7a77e, 0x7a780, - 0x7a782, 0x7a784, 0x7a786, 0x7a78b, 0x7a78d, 0x7a790, 0x7a792, 0x7a796, 0x7a798, - 0x7a79a, 0x7a79c, 0x7a79e, 0x7a7a0, 0x7a7a2, 0x7a7a4, 0x7a7a6, 0x7a7a8, 0x7a7b6, - 0x80100, 0x80102, 0x80104, 0x80106, 0x80108, 0x8010a, 0x8010c, 0x8010e, 0x80110, - 0x80112, 0x80114, 0x80116, 0x80118, 0x8011a, 0x8011c, 0x8011e, 0x80120, 0x80122, - 0x80124, 0x80126, 0x80128, 0x8012a, 0x8012c, 0x8012e, 0x80130, 0x80132, 0x80134, - 0x80136, 0x80139, 0x8013b, 0x8013d, 0x8013f, 0x80141, 0x80143, 0x80145, 0x80147, - 0x8014a, 0x8014c, 0x8014e, 0x80150, 0x80152, 0x80154, 0x80156, 0x80158, 0x8015a, - 0x8015c, 0x8015e, 0x80160, 0x80162, 0x80164, 0x80166, 0x80168, 0x8016a, 0x8016c, - 0x8016e, 0x80170, 0x80172, 0x80174, 0x80176, 0x80178, 0x80179, 0x8017b, 0x8017d, - 0x80181, 0x80182, 0x80184, 0x80186, 0x80187, 0x80193, 0x80194, 0x8019c, 0x8019d, - 0x8019f, 0x801a0, 0x801a2, 0x801a4, 0x801a6, 0x801a7, 0x801a9, 0x801ac, 0x801ae, - 0x801af, 0x801b5, 0x801b7, 0x801b8, 0x801bc, 0x801c4, 0x801c7, 0x801ca, 0x801cd, - 0x801cf, 0x801d1, 0x801d3, 0x801d5, 0x801d7, 0x801d9, 0x801db, 0x801de, 0x801e0, - 0x801e2, 0x801e4, 0x801e6, 0x801e8, 0x801ea, 0x801ec, 0x801ee, 0x801f1, 0x801f4, - 0x801fa, 0x801fc, 0x801fe, 0x80200, 0x80202, 0x80204, 0x80206, 0x80208, 0x8020a, - 0x8020c, 0x8020e, 0x80210, 0x80212, 0x80214, 0x80216, 0x80218, 0x8021a, 0x8021c, - 0x8021e, 0x80220, 0x80222, 0x80224, 0x80226, 0x80228, 0x8022a, 0x8022c, 0x8022e, - 0x80230, 0x80232, 0x8023a, 0x8023b, 0x8023d, 0x8023e, 0x80241, 0x80248, 0x8024a, - 0x8024c, 0x8024e, 0x80370, 0x80372, 0x80376, 0x8037f, 0x80386, 0x8038c, 0x8038e, - 0x8038f, 0x803cf, 0x803d8, 0x803da, 0x803dc, 0x803de, 0x803e0, 0x803e2, 0x803e4, - 0x803e6, 0x803e8, 0x803ea, 0x803ec, 0x803ee, 0x803f4, 0x803f7, 0x803f9, 0x803fa, - 0x80460, 0x80462, 0x80464, 0x80466, 0x80468, 0x8046a, 0x8046c, 0x8046e, 0x80470, - 0x80472, 0x80474, 0x80476, 0x80478, 0x8047a, 0x8047c, 0x8047e, 0x80480, 0x8048a, - 0x8048c, 0x8048e, 0x80490, 0x80492, 0x80494, 0x80496, 0x80498, 0x8049a, 0x8049c, - 0x8049e, 0x804a0, 0x804a2, 0x804a4, 0x804a6, 0x804a8, 0x804aa, 0x804ac, 0x804ae, - 0x804b0, 0x804b2, 0x804b4, 0x804b6, 0x804b8, 0x804ba, 0x804bc, 0x804be, 0x804c0, - 0x804c1, 0x804c3, 0x804c5, 0x804c7, 0x804c9, 0x804cb, 0x804cd, 0x804d0, 0x804d2, - 0x804d4, 0x804d6, 0x804d8, 0x804da, 0x804dc, 0x804de, 0x804e0, 0x804e2, 0x804e4, - 0x804e6, 0x804e8, 0x804ea, 0x804ec, 0x804ee, 0x804f0, 0x804f2, 0x804f4, 0x804f6, - 0x804f8, 0x804fa, 0x804fc, 0x804fe, 0x80500, 0x80502, 0x80504, 0x80506, 0x80508, - 0x8050a, 0x8050c, 0x8050e, 0x80510, 0x80512, 0x80514, 0x80516, 0x80518, 0x8051a, - 0x8051c, 0x8051e, 0x80520, 0x80522, 0x80524, 0x80526, 0x80528, 0x8052a, 0x8052c, - 0x8052e, 0x810c7, 0x810cd, 0x81e00, 0x81e02, 0x81e04, 0x81e06, 0x81e08, 0x81e0a, - 0x81e0c, 0x81e0e, 0x81e10, 0x81e12, 0x81e14, 0x81e16, 0x81e18, 0x81e1a, 0x81e1c, - 0x81e1e, 0x81e20, 0x81e22, 0x81e24, 0x81e26, 0x81e28, 0x81e2a, 0x81e2c, 0x81e2e, - 0x81e30, 0x81e32, 0x81e34, 0x81e36, 0x81e38, 0x81e3a, 0x81e3c, 0x81e3e, 0x81e40, - 0x81e42, 0x81e44, 0x81e46, 0x81e48, 0x81e4a, 0x81e4c, 0x81e4e, 0x81e50, 0x81e52, - 0x81e54, 0x81e56, 0x81e58, 0x81e5a, 0x81e5c, 0x81e5e, 0x81e60, 0x81e62, 0x81e64, - 0x81e66, 0x81e68, 0x81e6a, 0x81e6c, 0x81e6e, 0x81e70, 0x81e72, 0x81e74, 0x81e76, - 0x81e78, 0x81e7a, 0x81e7c, 0x81e7e, 0x81e80, 0x81e82, 0x81e84, 0x81e86, 0x81e88, - 0x81e8a, 0x81e8c, 0x81e8e, 0x81e90, 0x81e92, 0x81e94, 0x81e9e, 0x81ea0, 0x81ea2, - 0x81ea4, 0x81ea6, 0x81ea8, 0x81eaa, 0x81eac, 0x81eae, 0x81eb0, 0x81eb2, 0x81eb4, - 0x81eb6, 0x81eb8, 0x81eba, 0x81ebc, 0x81ebe, 0x81ec0, 0x81ec2, 0x81ec4, 0x81ec6, - 0x81ec8, 0x81eca, 0x81ecc, 0x81ece, 0x81ed0, 0x81ed2, 0x81ed4, 0x81ed6, 0x81ed8, - 0x81eda, 0x81edc, 0x81ede, 0x81ee0, 0x81ee2, 0x81ee4, 0x81ee6, 0x81ee8, 0x81eea, - 0x81eec, 0x81eee, 0x81ef0, 0x81ef2, 0x81ef4, 0x81ef6, 0x81ef8, 0x81efa, 0x81efc, - 0x81efe, 0x81f59, 0x81f5b, 0x81f5d, 0x81f5f, 0x82102, 0x82107, 0x82115, 0x82124, - 0x82126, 0x82128, 0x8213e, 0x8213f, 0x82145, 0x82183, 0x82c60, 0x82c67, 0x82c69, - 0x82c6b, 0x82c72, 0x82c75, 0x82c82, 0x82c84, 0x82c86, 0x82c88, 0x82c8a, 0x82c8c, - 0x82c8e, 0x82c90, 0x82c92, 0x82c94, 0x82c96, 0x82c98, 0x82c9a, 0x82c9c, 0x82c9e, - 0x82ca0, 0x82ca2, 0x82ca4, 0x82ca6, 0x82ca8, 0x82caa, 0x82cac, 0x82cae, 0x82cb0, - 0x82cb2, 0x82cb4, 0x82cb6, 0x82cb8, 0x82cba, 0x82cbc, 0x82cbe, 0x82cc0, 0x82cc2, - 0x82cc4, 0x82cc6, 0x82cc8, 0x82cca, 0x82ccc, 0x82cce, 0x82cd0, 0x82cd2, 0x82cd4, - 0x82cd6, 0x82cd8, 0x82cda, 0x82cdc, 0x82cde, 0x82ce0, 0x82ce2, 0x82ceb, 0x82ced, - 0x82cf2, 0x8a640, 0x8a642, 0x8a644, 0x8a646, 0x8a648, 0x8a64a, 0x8a64c, 0x8a64e, - 0x8a650, 0x8a652, 0x8a654, 0x8a656, 0x8a658, 0x8a65a, 0x8a65c, 0x8a65e, 0x8a660, - 0x8a662, 0x8a664, 0x8a666, 0x8a668, 0x8a66a, 0x8a66c, 0x8a680, 0x8a682, 0x8a684, - 0x8a686, 0x8a688, 0x8a68a, 0x8a68c, 0x8a68e, 0x8a690, 0x8a692, 0x8a694, 0x8a696, - 0x8a698, 0x8a69a, 0x8a722, 0x8a724, 0x8a726, 0x8a728, 0x8a72a, 0x8a72c, 0x8a72e, - 0x8a732, 0x8a734, 0x8a736, 0x8a738, 0x8a73a, 0x8a73c, 0x8a73e, 0x8a740, 0x8a742, - 0x8a744, 0x8a746, 0x8a748, 0x8a74a, 0x8a74c, 0x8a74e, 0x8a750, 0x8a752, 0x8a754, - 0x8a756, 0x8a758, 0x8a75a, 0x8a75c, 0x8a75e, 0x8a760, 0x8a762, 0x8a764, 0x8a766, - 0x8a768, 0x8a76a, 0x8a76c, 0x8a76e, 0x8a779, 0x8a77b, 0x8a77d, 0x8a77e, 0x8a780, - 0x8a782, 0x8a784, 0x8a786, 0x8a78b, 0x8a78d, 0x8a790, 0x8a792, 0x8a796, 0x8a798, - 0x8a79a, 0x8a79c, 0x8a79e, 0x8a7a0, 0x8a7a2, 0x8a7a4, 0x8a7a6, 0x8a7a8, 0x8a7b6, - 0x90100, 0x90102, 0x90104, 0x90106, 0x90108, 0x9010a, 0x9010c, 0x9010e, 0x90110, - 0x90112, 0x90114, 0x90116, 0x90118, 0x9011a, 0x9011c, 0x9011e, 0x90120, 0x90122, - 0x90124, 0x90126, 0x90128, 0x9012a, 0x9012c, 0x9012e, 0x90130, 0x90132, 0x90134, - 0x90136, 0x90139, 0x9013b, 0x9013d, 0x9013f, 0x90141, 0x90143, 0x90145, 0x90147, - 0x9014a, 0x9014c, 0x9014e, 0x90150, 0x90152, 0x90154, 0x90156, 0x90158, 0x9015a, - 0x9015c, 0x9015e, 0x90160, 0x90162, 0x90164, 0x90166, 0x90168, 0x9016a, 0x9016c, - 0x9016e, 0x90170, 0x90172, 0x90174, 0x90176, 0x90178, 0x90179, 0x9017b, 0x9017d, - 0x90181, 0x90182, 0x90184, 0x90186, 0x90187, 0x90193, 0x90194, 0x9019c, 0x9019d, - 0x9019f, 0x901a0, 0x901a2, 0x901a4, 0x901a6, 0x901a7, 0x901a9, 0x901ac, 0x901ae, - 0x901af, 0x901b5, 0x901b7, 0x901b8, 0x901bc, 0x901c4, 0x901c7, 0x901ca, 0x901cd, - 0x901cf, 0x901d1, 0x901d3, 0x901d5, 0x901d7, 0x901d9, 0x901db, 0x901de, 0x901e0, - 0x901e2, 0x901e4, 0x901e6, 0x901e8, 0x901ea, 0x901ec, 0x901ee, 0x901f1, 0x901f4, - 0x901fa, 0x901fc, 0x901fe, 0x90200, 0x90202, 0x90204, 0x90206, 0x90208, 0x9020a, - 0x9020c, 0x9020e, 0x90210, 0x90212, 0x90214, 0x90216, 0x90218, 0x9021a, 0x9021c, - 0x9021e, 0x90220, 0x90222, 0x90224, 0x90226, 0x90228, 0x9022a, 0x9022c, 0x9022e, - 0x90230, 0x90232, 0x9023a, 0x9023b, 0x9023d, 0x9023e, 0x90241, 0x90248, 0x9024a, - 0x9024c, 0x9024e, 0x90370, 0x90372, 0x90376, 0x9037f, 0x90386, 0x9038c, 0x9038e, - 0x9038f, 0x903cf, 0x903d8, 0x903da, 0x903dc, 0x903de, 0x903e0, 0x903e2, 0x903e4, - 0x903e6, 0x903e8, 0x903ea, 0x903ec, 0x903ee, 0x903f4, 0x903f7, 0x903f9, 0x903fa, - 0x90460, 0x90462, 0x90464, 0x90466, 0x90468, 0x9046a, 0x9046c, 0x9046e, 0x90470, - 0x90472, 0x90474, 0x90476, 0x90478, 0x9047a, 0x9047c, 0x9047e, 0x90480, 0x9048a, - 0x9048c, 0x9048e, 0x90490, 0x90492, 0x90494, 0x90496, 0x90498, 0x9049a, 0x9049c, - 0x9049e, 0x904a0, 0x904a2, 0x904a4, 0x904a6, 0x904a8, 0x904aa, 0x904ac, 0x904ae, - 0x904b0, 0x904b2, 0x904b4, 0x904b6, 0x904b8, 0x904ba, 0x904bc, 0x904be, 0x904c0, - 0x904c1, 0x904c3, 0x904c5, 0x904c7, 0x904c9, 0x904cb, 0x904cd, 0x904d0, 0x904d2, - 0x904d4, 0x904d6, 0x904d8, 0x904da, 0x904dc, 0x904de, 0x904e0, 0x904e2, 0x904e4, - 0x904e6, 0x904e8, 0x904ea, 0x904ec, 0x904ee, 0x904f0, 0x904f2, 0x904f4, 0x904f6, - 0x904f8, 0x904fa, 0x904fc, 0x904fe, 0x90500, 0x90502, 0x90504, 0x90506, 0x90508, - 0x9050a, 0x9050c, 0x9050e, 0x90510, 0x90512, 0x90514, 0x90516, 0x90518, 0x9051a, - 0x9051c, 0x9051e, 0x90520, 0x90522, 0x90524, 0x90526, 0x90528, 0x9052a, 0x9052c, - 0x9052e, 0x910c7, 0x910cd, 0x91e00, 0x91e02, 0x91e04, 0x91e06, 0x91e08, 0x91e0a, - 0x91e0c, 0x91e0e, 0x91e10, 0x91e12, 0x91e14, 0x91e16, 0x91e18, 0x91e1a, 0x91e1c, - 0x91e1e, 0x91e20, 0x91e22, 0x91e24, 0x91e26, 0x91e28, 0x91e2a, 0x91e2c, 0x91e2e, - 0x91e30, 0x91e32, 0x91e34, 0x91e36, 0x91e38, 0x91e3a, 0x91e3c, 0x91e3e, 0x91e40, - 0x91e42, 0x91e44, 0x91e46, 0x91e48, 0x91e4a, 0x91e4c, 0x91e4e, 0x91e50, 0x91e52, - 0x91e54, 0x91e56, 0x91e58, 0x91e5a, 0x91e5c, 0x91e5e, 0x91e60, 0x91e62, 0x91e64, - 0x91e66, 0x91e68, 0x91e6a, 0x91e6c, 0x91e6e, 0x91e70, 0x91e72, 0x91e74, 0x91e76, - 0x91e78, 0x91e7a, 0x91e7c, 0x91e7e, 0x91e80, 0x91e82, 0x91e84, 0x91e86, 0x91e88, - 0x91e8a, 0x91e8c, 0x91e8e, 0x91e90, 0x91e92, 0x91e94, 0x91e9e, 0x91ea0, 0x91ea2, - 0x91ea4, 0x91ea6, 0x91ea8, 0x91eaa, 0x91eac, 0x91eae, 0x91eb0, 0x91eb2, 0x91eb4, - 0x91eb6, 0x91eb8, 0x91eba, 0x91ebc, 0x91ebe, 0x91ec0, 0x91ec2, 0x91ec4, 0x91ec6, - 0x91ec8, 0x91eca, 0x91ecc, 0x91ece, 0x91ed0, 0x91ed2, 0x91ed4, 0x91ed6, 0x91ed8, - 0x91eda, 0x91edc, 0x91ede, 0x91ee0, 0x91ee2, 0x91ee4, 0x91ee6, 0x91ee8, 0x91eea, - 0x91eec, 0x91eee, 0x91ef0, 0x91ef2, 0x91ef4, 0x91ef6, 0x91ef8, 0x91efa, 0x91efc, - 0x91efe, 0x91f59, 0x91f5b, 0x91f5d, 0x91f5f, 0x92102, 0x92107, 0x92115, 0x92124, - 0x92126, 0x92128, 0x9213e, 0x9213f, 0x92145, 0x92183, 0x92c60, 0x92c67, 0x92c69, - 0x92c6b, 0x92c72, 0x92c75, 0x92c82, 0x92c84, 0x92c86, 0x92c88, 0x92c8a, 0x92c8c, - 0x92c8e, 0x92c90, 0x92c92, 0x92c94, 0x92c96, 0x92c98, 0x92c9a, 0x92c9c, 0x92c9e, - 0x92ca0, 0x92ca2, 0x92ca4, 0x92ca6, 0x92ca8, 0x92caa, 0x92cac, 0x92cae, 0x92cb0, - 0x92cb2, 0x92cb4, 0x92cb6, 0x92cb8, 0x92cba, 0x92cbc, 0x92cbe, 0x92cc0, 0x92cc2, - 0x92cc4, 0x92cc6, 0x92cc8, 0x92cca, 0x92ccc, 0x92cce, 0x92cd0, 0x92cd2, 0x92cd4, - 0x92cd6, 0x92cd8, 0x92cda, 0x92cdc, 0x92cde, 0x92ce0, 0x92ce2, 0x92ceb, 0x92ced, - 0x92cf2, 0x9a640, 0x9a642, 0x9a644, 0x9a646, 0x9a648, 0x9a64a, 0x9a64c, 0x9a64e, - 0x9a650, 0x9a652, 0x9a654, 0x9a656, 0x9a658, 0x9a65a, 0x9a65c, 0x9a65e, 0x9a660, - 0x9a662, 0x9a664, 0x9a666, 0x9a668, 0x9a66a, 0x9a66c, 0x9a680, 0x9a682, 0x9a684, - 0x9a686, 0x9a688, 0x9a68a, 0x9a68c, 0x9a68e, 0x9a690, 0x9a692, 0x9a694, 0x9a696, - 0x9a698, 0x9a69a, 0x9a722, 0x9a724, 0x9a726, 0x9a728, 0x9a72a, 0x9a72c, 0x9a72e, - 0x9a732, 0x9a734, 0x9a736, 0x9a738, 0x9a73a, 0x9a73c, 0x9a73e, 0x9a740, 0x9a742, - 0x9a744, 0x9a746, 0x9a748, 0x9a74a, 0x9a74c, 0x9a74e, 0x9a750, 0x9a752, 0x9a754, - 0x9a756, 0x9a758, 0x9a75a, 0x9a75c, 0x9a75e, 0x9a760, 0x9a762, 0x9a764, 0x9a766, - 0x9a768, 0x9a76a, 0x9a76c, 0x9a76e, 0x9a779, 0x9a77b, 0x9a77d, 0x9a77e, 0x9a780, - 0x9a782, 0x9a784, 0x9a786, 0x9a78b, 0x9a78d, 0x9a790, 0x9a792, 0x9a796, 0x9a798, - 0x9a79a, 0x9a79c, 0x9a79e, 0x9a7a0, 0x9a7a2, 0x9a7a4, 0x9a7a6, 0x9a7a8, 0x9a7b6, - 0xa0100, 0xa0102, 0xa0104, 0xa0106, 0xa0108, 0xa010a, 0xa010c, 0xa010e, 0xa0110, - 0xa0112, 0xa0114, 0xa0116, 0xa0118, 0xa011a, 0xa011c, 0xa011e, 0xa0120, 0xa0122, - 0xa0124, 0xa0126, 0xa0128, 0xa012a, 0xa012c, 0xa012e, 0xa0130, 0xa0132, 0xa0134, - 0xa0136, 0xa0139, 0xa013b, 0xa013d, 0xa013f, 0xa0141, 0xa0143, 0xa0145, 0xa0147, - 0xa014a, 0xa014c, 0xa014e, 0xa0150, 0xa0152, 0xa0154, 0xa0156, 0xa0158, 0xa015a, - 0xa015c, 0xa015e, 0xa0160, 0xa0162, 0xa0164, 0xa0166, 0xa0168, 0xa016a, 0xa016c, - 0xa016e, 0xa0170, 0xa0172, 0xa0174, 0xa0176, 0xa0178, 0xa0179, 0xa017b, 0xa017d, - 0xa0181, 0xa0182, 0xa0184, 0xa0186, 0xa0187, 0xa0193, 0xa0194, 0xa019c, 0xa019d, - 0xa019f, 0xa01a0, 0xa01a2, 0xa01a4, 0xa01a6, 0xa01a7, 0xa01a9, 0xa01ac, 0xa01ae, - 0xa01af, 0xa01b5, 0xa01b7, 0xa01b8, 0xa01bc, 0xa01c4, 0xa01c7, 0xa01ca, 0xa01cd, - 0xa01cf, 0xa01d1, 0xa01d3, 0xa01d5, 0xa01d7, 0xa01d9, 0xa01db, 0xa01de, 0xa01e0, - 0xa01e2, 0xa01e4, 0xa01e6, 0xa01e8, 0xa01ea, 0xa01ec, 0xa01ee, 0xa01f1, 0xa01f4, - 0xa01fa, 0xa01fc, 0xa01fe, 0xa0200, 0xa0202, 0xa0204, 0xa0206, 0xa0208, 0xa020a, - 0xa020c, 0xa020e, 0xa0210, 0xa0212, 0xa0214, 0xa0216, 0xa0218, 0xa021a, 0xa021c, - 0xa021e, 0xa0220, 0xa0222, 0xa0224, 0xa0226, 0xa0228, 0xa022a, 0xa022c, 0xa022e, - 0xa0230, 0xa0232, 0xa023a, 0xa023b, 0xa023d, 0xa023e, 0xa0241, 0xa0248, 0xa024a, - 0xa024c, 0xa024e, 0xa0370, 0xa0372, 0xa0376, 0xa037f, 0xa0386, 0xa038c, 0xa038e, - 0xa038f, 0xa03cf, 0xa03d8, 0xa03da, 0xa03dc, 0xa03de, 0xa03e0, 0xa03e2, 0xa03e4, - 0xa03e6, 0xa03e8, 0xa03ea, 0xa03ec, 0xa03ee, 0xa03f4, 0xa03f7, 0xa03f9, 0xa03fa, - 0xa0460, 0xa0462, 0xa0464, 0xa0466, 0xa0468, 0xa046a, 0xa046c, 0xa046e, 0xa0470, - 0xa0472, 0xa0474, 0xa0476, 0xa0478, 0xa047a, 0xa047c, 0xa047e, 0xa0480, 0xa048a, - 0xa048c, 0xa048e, 0xa0490, 0xa0492, 0xa0494, 0xa0496, 0xa0498, 0xa049a, 0xa049c, - 0xa049e, 0xa04a0, 0xa04a2, 0xa04a4, 0xa04a6, 0xa04a8, 0xa04aa, 0xa04ac, 0xa04ae, - 0xa04b0, 0xa04b2, 0xa04b4, 0xa04b6, 0xa04b8, 0xa04ba, 0xa04bc, 0xa04be, 0xa04c0, - 0xa04c1, 0xa04c3, 0xa04c5, 0xa04c7, 0xa04c9, 0xa04cb, 0xa04cd, 0xa04d0, 0xa04d2, - 0xa04d4, 0xa04d6, 0xa04d8, 0xa04da, 0xa04dc, 0xa04de, 0xa04e0, 0xa04e2, 0xa04e4, - 0xa04e6, 0xa04e8, 0xa04ea, 0xa04ec, 0xa04ee, 0xa04f0, 0xa04f2, 0xa04f4, 0xa04f6, - 0xa04f8, 0xa04fa, 0xa04fc, 0xa04fe, 0xa0500, 0xa0502, 0xa0504, 0xa0506, 0xa0508, - 0xa050a, 0xa050c, 0xa050e, 0xa0510, 0xa0512, 0xa0514, 0xa0516, 0xa0518, 0xa051a, - 0xa051c, 0xa051e, 0xa0520, 0xa0522, 0xa0524, 0xa0526, 0xa0528, 0xa052a, 0xa052c, - 0xa052e, 0xa10c7, 0xa10cd, 0xa1e00, 0xa1e02, 0xa1e04, 0xa1e06, 0xa1e08, 0xa1e0a, - 0xa1e0c, 0xa1e0e, 0xa1e10, 0xa1e12, 0xa1e14, 0xa1e16, 0xa1e18, 0xa1e1a, 0xa1e1c, - 0xa1e1e, 0xa1e20, 0xa1e22, 0xa1e24, 0xa1e26, 0xa1e28, 0xa1e2a, 0xa1e2c, 0xa1e2e, - 0xa1e30, 0xa1e32, 0xa1e34, 0xa1e36, 0xa1e38, 0xa1e3a, 0xa1e3c, 0xa1e3e, 0xa1e40, - 0xa1e42, 0xa1e44, 0xa1e46, 0xa1e48, 0xa1e4a, 0xa1e4c, 0xa1e4e, 0xa1e50, 0xa1e52, - 0xa1e54, 0xa1e56, 0xa1e58, 0xa1e5a, 0xa1e5c, 0xa1e5e, 0xa1e60, 0xa1e62, 0xa1e64, - 0xa1e66, 0xa1e68, 0xa1e6a, 0xa1e6c, 0xa1e6e, 0xa1e70, 0xa1e72, 0xa1e74, 0xa1e76, - 0xa1e78, 0xa1e7a, 0xa1e7c, 0xa1e7e, 0xa1e80, 0xa1e82, 0xa1e84, 0xa1e86, 0xa1e88, - 0xa1e8a, 0xa1e8c, 0xa1e8e, 0xa1e90, 0xa1e92, 0xa1e94, 0xa1e9e, 0xa1ea0, 0xa1ea2, - 0xa1ea4, 0xa1ea6, 0xa1ea8, 0xa1eaa, 0xa1eac, 0xa1eae, 0xa1eb0, 0xa1eb2, 0xa1eb4, - 0xa1eb6, 0xa1eb8, 0xa1eba, 0xa1ebc, 0xa1ebe, 0xa1ec0, 0xa1ec2, 0xa1ec4, 0xa1ec6, - 0xa1ec8, 0xa1eca, 0xa1ecc, 0xa1ece, 0xa1ed0, 0xa1ed2, 0xa1ed4, 0xa1ed6, 0xa1ed8, - 0xa1eda, 0xa1edc, 0xa1ede, 0xa1ee0, 0xa1ee2, 0xa1ee4, 0xa1ee6, 0xa1ee8, 0xa1eea, - 0xa1eec, 0xa1eee, 0xa1ef0, 0xa1ef2, 0xa1ef4, 0xa1ef6, 0xa1ef8, 0xa1efa, 0xa1efc, - 0xa1efe, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1f5f, 0xa2102, 0xa2107, 0xa2115, 0xa2124, - 0xa2126, 0xa2128, 0xa213e, 0xa213f, 0xa2145, 0xa2183, 0xa2c60, 0xa2c67, 0xa2c69, - 0xa2c6b, 0xa2c72, 0xa2c75, 0xa2c82, 0xa2c84, 0xa2c86, 0xa2c88, 0xa2c8a, 0xa2c8c, - 0xa2c8e, 0xa2c90, 0xa2c92, 0xa2c94, 0xa2c96, 0xa2c98, 0xa2c9a, 0xa2c9c, 0xa2c9e, - 0xa2ca0, 0xa2ca2, 0xa2ca4, 0xa2ca6, 0xa2ca8, 0xa2caa, 0xa2cac, 0xa2cae, 0xa2cb0, - 0xa2cb2, 0xa2cb4, 0xa2cb6, 0xa2cb8, 0xa2cba, 0xa2cbc, 0xa2cbe, 0xa2cc0, 0xa2cc2, - 0xa2cc4, 0xa2cc6, 0xa2cc8, 0xa2cca, 0xa2ccc, 0xa2cce, 0xa2cd0, 0xa2cd2, 0xa2cd4, - 0xa2cd6, 0xa2cd8, 0xa2cda, 0xa2cdc, 0xa2cde, 0xa2ce0, 0xa2ce2, 0xa2ceb, 0xa2ced, - 0xa2cf2, 0xaa640, 0xaa642, 0xaa644, 0xaa646, 0xaa648, 0xaa64a, 0xaa64c, 0xaa64e, - 0xaa650, 0xaa652, 0xaa654, 0xaa656, 0xaa658, 0xaa65a, 0xaa65c, 0xaa65e, 0xaa660, - 0xaa662, 0xaa664, 0xaa666, 0xaa668, 0xaa66a, 0xaa66c, 0xaa680, 0xaa682, 0xaa684, - 0xaa686, 0xaa688, 0xaa68a, 0xaa68c, 0xaa68e, 0xaa690, 0xaa692, 0xaa694, 0xaa696, - 0xaa698, 0xaa69a, 0xaa722, 0xaa724, 0xaa726, 0xaa728, 0xaa72a, 0xaa72c, 0xaa72e, - 0xaa732, 0xaa734, 0xaa736, 0xaa738, 0xaa73a, 0xaa73c, 0xaa73e, 0xaa740, 0xaa742, - 0xaa744, 0xaa746, 0xaa748, 0xaa74a, 0xaa74c, 0xaa74e, 0xaa750, 0xaa752, 0xaa754, - 0xaa756, 0xaa758, 0xaa75a, 0xaa75c, 0xaa75e, 0xaa760, 0xaa762, 0xaa764, 0xaa766, - 0xaa768, 0xaa76a, 0xaa76c, 0xaa76e, 0xaa779, 0xaa77b, 0xaa77d, 0xaa77e, 0xaa780, - 0xaa782, 0xaa784, 0xaa786, 0xaa78b, 0xaa78d, 0xaa790, 0xaa792, 0xaa796, 0xaa798, - 0xaa79a, 0xaa79c, 0xaa79e, 0xaa7a0, 0xaa7a2, 0xaa7a4, 0xaa7a6, 0xaa7a8, 0xaa7b6, - 0xb0100, 0xb0102, 0xb0104, 0xb0106, 0xb0108, 0xb010a, 0xb010c, 0xb010e, 0xb0110, - 0xb0112, 0xb0114, 0xb0116, 0xb0118, 0xb011a, 0xb011c, 0xb011e, 0xb0120, 0xb0122, - 0xb0124, 0xb0126, 0xb0128, 0xb012a, 0xb012c, 0xb012e, 0xb0130, 0xb0132, 0xb0134, - 0xb0136, 0xb0139, 0xb013b, 0xb013d, 0xb013f, 0xb0141, 0xb0143, 0xb0145, 0xb0147, - 0xb014a, 0xb014c, 0xb014e, 0xb0150, 0xb0152, 0xb0154, 0xb0156, 0xb0158, 0xb015a, - 0xb015c, 0xb015e, 0xb0160, 0xb0162, 0xb0164, 0xb0166, 0xb0168, 0xb016a, 0xb016c, - 0xb016e, 0xb0170, 0xb0172, 0xb0174, 0xb0176, 0xb0178, 0xb0179, 0xb017b, 0xb017d, - 0xb0181, 0xb0182, 0xb0184, 0xb0186, 0xb0187, 0xb0193, 0xb0194, 0xb019c, 0xb019d, - 0xb019f, 0xb01a0, 0xb01a2, 0xb01a4, 0xb01a6, 0xb01a7, 0xb01a9, 0xb01ac, 0xb01ae, - 0xb01af, 0xb01b5, 0xb01b7, 0xb01b8, 0xb01bc, 0xb01c4, 0xb01c7, 0xb01ca, 0xb01cd, - 0xb01cf, 0xb01d1, 0xb01d3, 0xb01d5, 0xb01d7, 0xb01d9, 0xb01db, 0xb01de, 0xb01e0, - 0xb01e2, 0xb01e4, 0xb01e6, 0xb01e8, 0xb01ea, 0xb01ec, 0xb01ee, 0xb01f1, 0xb01f4, - 0xb01fa, 0xb01fc, 0xb01fe, 0xb0200, 0xb0202, 0xb0204, 0xb0206, 0xb0208, 0xb020a, - 0xb020c, 0xb020e, 0xb0210, 0xb0212, 0xb0214, 0xb0216, 0xb0218, 0xb021a, 0xb021c, - 0xb021e, 0xb0220, 0xb0222, 0xb0224, 0xb0226, 0xb0228, 0xb022a, 0xb022c, 0xb022e, - 0xb0230, 0xb0232, 0xb023a, 0xb023b, 0xb023d, 0xb023e, 0xb0241, 0xb0248, 0xb024a, - 0xb024c, 0xb024e, 0xb0370, 0xb0372, 0xb0376, 0xb037f, 0xb0386, 0xb038c, 0xb038e, - 0xb038f, 0xb03cf, 0xb03d8, 0xb03da, 0xb03dc, 0xb03de, 0xb03e0, 0xb03e2, 0xb03e4, - 0xb03e6, 0xb03e8, 0xb03ea, 0xb03ec, 0xb03ee, 0xb03f4, 0xb03f7, 0xb03f9, 0xb03fa, - 0xb0460, 0xb0462, 0xb0464, 0xb0466, 0xb0468, 0xb046a, 0xb046c, 0xb046e, 0xb0470, - 0xb0472, 0xb0474, 0xb0476, 0xb0478, 0xb047a, 0xb047c, 0xb047e, 0xb0480, 0xb048a, - 0xb048c, 0xb048e, 0xb0490, 0xb0492, 0xb0494, 0xb0496, 0xb0498, 0xb049a, 0xb049c, - 0xb049e, 0xb04a0, 0xb04a2, 0xb04a4, 0xb04a6, 0xb04a8, 0xb04aa, 0xb04ac, 0xb04ae, - 0xb04b0, 0xb04b2, 0xb04b4, 0xb04b6, 0xb04b8, 0xb04ba, 0xb04bc, 0xb04be, 0xb04c0, - 0xb04c1, 0xb04c3, 0xb04c5, 0xb04c7, 0xb04c9, 0xb04cb, 0xb04cd, 0xb04d0, 0xb04d2, - 0xb04d4, 0xb04d6, 0xb04d8, 0xb04da, 0xb04dc, 0xb04de, 0xb04e0, 0xb04e2, 0xb04e4, - 0xb04e6, 0xb04e8, 0xb04ea, 0xb04ec, 0xb04ee, 0xb04f0, 0xb04f2, 0xb04f4, 0xb04f6, - 0xb04f8, 0xb04fa, 0xb04fc, 0xb04fe, 0xb0500, 0xb0502, 0xb0504, 0xb0506, 0xb0508, - 0xb050a, 0xb050c, 0xb050e, 0xb0510, 0xb0512, 0xb0514, 0xb0516, 0xb0518, 0xb051a, - 0xb051c, 0xb051e, 0xb0520, 0xb0522, 0xb0524, 0xb0526, 0xb0528, 0xb052a, 0xb052c, - 0xb052e, 0xb10c7, 0xb10cd, 0xb1e00, 0xb1e02, 0xb1e04, 0xb1e06, 0xb1e08, 0xb1e0a, - 0xb1e0c, 0xb1e0e, 0xb1e10, 0xb1e12, 0xb1e14, 0xb1e16, 0xb1e18, 0xb1e1a, 0xb1e1c, - 0xb1e1e, 0xb1e20, 0xb1e22, 0xb1e24, 0xb1e26, 0xb1e28, 0xb1e2a, 0xb1e2c, 0xb1e2e, - 0xb1e30, 0xb1e32, 0xb1e34, 0xb1e36, 0xb1e38, 0xb1e3a, 0xb1e3c, 0xb1e3e, 0xb1e40, - 0xb1e42, 0xb1e44, 0xb1e46, 0xb1e48, 0xb1e4a, 0xb1e4c, 0xb1e4e, 0xb1e50, 0xb1e52, - 0xb1e54, 0xb1e56, 0xb1e58, 0xb1e5a, 0xb1e5c, 0xb1e5e, 0xb1e60, 0xb1e62, 0xb1e64, - 0xb1e66, 0xb1e68, 0xb1e6a, 0xb1e6c, 0xb1e6e, 0xb1e70, 0xb1e72, 0xb1e74, 0xb1e76, - 0xb1e78, 0xb1e7a, 0xb1e7c, 0xb1e7e, 0xb1e80, 0xb1e82, 0xb1e84, 0xb1e86, 0xb1e88, - 0xb1e8a, 0xb1e8c, 0xb1e8e, 0xb1e90, 0xb1e92, 0xb1e94, 0xb1e9e, 0xb1ea0, 0xb1ea2, - 0xb1ea4, 0xb1ea6, 0xb1ea8, 0xb1eaa, 0xb1eac, 0xb1eae, 0xb1eb0, 0xb1eb2, 0xb1eb4, - 0xb1eb6, 0xb1eb8, 0xb1eba, 0xb1ebc, 0xb1ebe, 0xb1ec0, 0xb1ec2, 0xb1ec4, 0xb1ec6, - 0xb1ec8, 0xb1eca, 0xb1ecc, 0xb1ece, 0xb1ed0, 0xb1ed2, 0xb1ed4, 0xb1ed6, 0xb1ed8, - 0xb1eda, 0xb1edc, 0xb1ede, 0xb1ee0, 0xb1ee2, 0xb1ee4, 0xb1ee6, 0xb1ee8, 0xb1eea, - 0xb1eec, 0xb1eee, 0xb1ef0, 0xb1ef2, 0xb1ef4, 0xb1ef6, 0xb1ef8, 0xb1efa, 0xb1efc, - 0xb1efe, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1f5f, 0xb2102, 0xb2107, 0xb2115, 0xb2124, - 0xb2126, 0xb2128, 0xb213e, 0xb213f, 0xb2145, 0xb2183, 0xb2c60, 0xb2c67, 0xb2c69, - 0xb2c6b, 0xb2c72, 0xb2c75, 0xb2c82, 0xb2c84, 0xb2c86, 0xb2c88, 0xb2c8a, 0xb2c8c, - 0xb2c8e, 0xb2c90, 0xb2c92, 0xb2c94, 0xb2c96, 0xb2c98, 0xb2c9a, 0xb2c9c, 0xb2c9e, - 0xb2ca0, 0xb2ca2, 0xb2ca4, 0xb2ca6, 0xb2ca8, 0xb2caa, 0xb2cac, 0xb2cae, 0xb2cb0, - 0xb2cb2, 0xb2cb4, 0xb2cb6, 0xb2cb8, 0xb2cba, 0xb2cbc, 0xb2cbe, 0xb2cc0, 0xb2cc2, - 0xb2cc4, 0xb2cc6, 0xb2cc8, 0xb2cca, 0xb2ccc, 0xb2cce, 0xb2cd0, 0xb2cd2, 0xb2cd4, - 0xb2cd6, 0xb2cd8, 0xb2cda, 0xb2cdc, 0xb2cde, 0xb2ce0, 0xb2ce2, 0xb2ceb, 0xb2ced, - 0xb2cf2, 0xba640, 0xba642, 0xba644, 0xba646, 0xba648, 0xba64a, 0xba64c, 0xba64e, - 0xba650, 0xba652, 0xba654, 0xba656, 0xba658, 0xba65a, 0xba65c, 0xba65e, 0xba660, - 0xba662, 0xba664, 0xba666, 0xba668, 0xba66a, 0xba66c, 0xba680, 0xba682, 0xba684, - 0xba686, 0xba688, 0xba68a, 0xba68c, 0xba68e, 0xba690, 0xba692, 0xba694, 0xba696, - 0xba698, 0xba69a, 0xba722, 0xba724, 0xba726, 0xba728, 0xba72a, 0xba72c, 0xba72e, - 0xba732, 0xba734, 0xba736, 0xba738, 0xba73a, 0xba73c, 0xba73e, 0xba740, 0xba742, - 0xba744, 0xba746, 0xba748, 0xba74a, 0xba74c, 0xba74e, 0xba750, 0xba752, 0xba754, - 0xba756, 0xba758, 0xba75a, 0xba75c, 0xba75e, 0xba760, 0xba762, 0xba764, 0xba766, - 0xba768, 0xba76a, 0xba76c, 0xba76e, 0xba779, 0xba77b, 0xba77d, 0xba77e, 0xba780, - 0xba782, 0xba784, 0xba786, 0xba78b, 0xba78d, 0xba790, 0xba792, 0xba796, 0xba798, - 0xba79a, 0xba79c, 0xba79e, 0xba7a0, 0xba7a2, 0xba7a4, 0xba7a6, 0xba7a8, 0xba7b6, - 0xc0100, 0xc0102, 0xc0104, 0xc0106, 0xc0108, 0xc010a, 0xc010c, 0xc010e, 0xc0110, - 0xc0112, 0xc0114, 0xc0116, 0xc0118, 0xc011a, 0xc011c, 0xc011e, 0xc0120, 0xc0122, - 0xc0124, 0xc0126, 0xc0128, 0xc012a, 0xc012c, 0xc012e, 0xc0130, 0xc0132, 0xc0134, - 0xc0136, 0xc0139, 0xc013b, 0xc013d, 0xc013f, 0xc0141, 0xc0143, 0xc0145, 0xc0147, - 0xc014a, 0xc014c, 0xc014e, 0xc0150, 0xc0152, 0xc0154, 0xc0156, 0xc0158, 0xc015a, - 0xc015c, 0xc015e, 0xc0160, 0xc0162, 0xc0164, 0xc0166, 0xc0168, 0xc016a, 0xc016c, - 0xc016e, 0xc0170, 0xc0172, 0xc0174, 0xc0176, 0xc0178, 0xc0179, 0xc017b, 0xc017d, - 0xc0181, 0xc0182, 0xc0184, 0xc0186, 0xc0187, 0xc0193, 0xc0194, 0xc019c, 0xc019d, - 0xc019f, 0xc01a0, 0xc01a2, 0xc01a4, 0xc01a6, 0xc01a7, 0xc01a9, 0xc01ac, 0xc01ae, - 0xc01af, 0xc01b5, 0xc01b7, 0xc01b8, 0xc01bc, 0xc01c4, 0xc01c7, 0xc01ca, 0xc01cd, - 0xc01cf, 0xc01d1, 0xc01d3, 0xc01d5, 0xc01d7, 0xc01d9, 0xc01db, 0xc01de, 0xc01e0, - 0xc01e2, 0xc01e4, 0xc01e6, 0xc01e8, 0xc01ea, 0xc01ec, 0xc01ee, 0xc01f1, 0xc01f4, - 0xc01fa, 0xc01fc, 0xc01fe, 0xc0200, 0xc0202, 0xc0204, 0xc0206, 0xc0208, 0xc020a, - 0xc020c, 0xc020e, 0xc0210, 0xc0212, 0xc0214, 0xc0216, 0xc0218, 0xc021a, 0xc021c, - 0xc021e, 0xc0220, 0xc0222, 0xc0224, 0xc0226, 0xc0228, 0xc022a, 0xc022c, 0xc022e, - 0xc0230, 0xc0232, 0xc023a, 0xc023b, 0xc023d, 0xc023e, 0xc0241, 0xc0248, 0xc024a, - 0xc024c, 0xc024e, 0xc0370, 0xc0372, 0xc0376, 0xc037f, 0xc0386, 0xc038c, 0xc038e, - 0xc038f, 0xc03cf, 0xc03d8, 0xc03da, 0xc03dc, 0xc03de, 0xc03e0, 0xc03e2, 0xc03e4, - 0xc03e6, 0xc03e8, 0xc03ea, 0xc03ec, 0xc03ee, 0xc03f4, 0xc03f7, 0xc03f9, 0xc03fa, - 0xc0460, 0xc0462, 0xc0464, 0xc0466, 0xc0468, 0xc046a, 0xc046c, 0xc046e, 0xc0470, - 0xc0472, 0xc0474, 0xc0476, 0xc0478, 0xc047a, 0xc047c, 0xc047e, 0xc0480, 0xc048a, - 0xc048c, 0xc048e, 0xc0490, 0xc0492, 0xc0494, 0xc0496, 0xc0498, 0xc049a, 0xc049c, - 0xc049e, 0xc04a0, 0xc04a2, 0xc04a4, 0xc04a6, 0xc04a8, 0xc04aa, 0xc04ac, 0xc04ae, - 0xc04b0, 0xc04b2, 0xc04b4, 0xc04b6, 0xc04b8, 0xc04ba, 0xc04bc, 0xc04be, 0xc04c0, - 0xc04c1, 0xc04c3, 0xc04c5, 0xc04c7, 0xc04c9, 0xc04cb, 0xc04cd, 0xc04d0, 0xc04d2, - 0xc04d4, 0xc04d6, 0xc04d8, 0xc04da, 0xc04dc, 0xc04de, 0xc04e0, 0xc04e2, 0xc04e4, - 0xc04e6, 0xc04e8, 0xc04ea, 0xc04ec, 0xc04ee, 0xc04f0, 0xc04f2, 0xc04f4, 0xc04f6, - 0xc04f8, 0xc04fa, 0xc04fc, 0xc04fe, 0xc0500, 0xc0502, 0xc0504, 0xc0506, 0xc0508, - 0xc050a, 0xc050c, 0xc050e, 0xc0510, 0xc0512, 0xc0514, 0xc0516, 0xc0518, 0xc051a, - 0xc051c, 0xc051e, 0xc0520, 0xc0522, 0xc0524, 0xc0526, 0xc0528, 0xc052a, 0xc052c, - 0xc052e, 0xc10c7, 0xc10cd, 0xc1e00, 0xc1e02, 0xc1e04, 0xc1e06, 0xc1e08, 0xc1e0a, - 0xc1e0c, 0xc1e0e, 0xc1e10, 0xc1e12, 0xc1e14, 0xc1e16, 0xc1e18, 0xc1e1a, 0xc1e1c, - 0xc1e1e, 0xc1e20, 0xc1e22, 0xc1e24, 0xc1e26, 0xc1e28, 0xc1e2a, 0xc1e2c, 0xc1e2e, - 0xc1e30, 0xc1e32, 0xc1e34, 0xc1e36, 0xc1e38, 0xc1e3a, 0xc1e3c, 0xc1e3e, 0xc1e40, - 0xc1e42, 0xc1e44, 0xc1e46, 0xc1e48, 0xc1e4a, 0xc1e4c, 0xc1e4e, 0xc1e50, 0xc1e52, - 0xc1e54, 0xc1e56, 0xc1e58, 0xc1e5a, 0xc1e5c, 0xc1e5e, 0xc1e60, 0xc1e62, 0xc1e64, - 0xc1e66, 0xc1e68, 0xc1e6a, 0xc1e6c, 0xc1e6e, 0xc1e70, 0xc1e72, 0xc1e74, 0xc1e76, - 0xc1e78, 0xc1e7a, 0xc1e7c, 0xc1e7e, 0xc1e80, 0xc1e82, 0xc1e84, 0xc1e86, 0xc1e88, - 0xc1e8a, 0xc1e8c, 0xc1e8e, 0xc1e90, 0xc1e92, 0xc1e94, 0xc1e9e, 0xc1ea0, 0xc1ea2, - 0xc1ea4, 0xc1ea6, 0xc1ea8, 0xc1eaa, 0xc1eac, 0xc1eae, 0xc1eb0, 0xc1eb2, 0xc1eb4, - 0xc1eb6, 0xc1eb8, 0xc1eba, 0xc1ebc, 0xc1ebe, 0xc1ec0, 0xc1ec2, 0xc1ec4, 0xc1ec6, - 0xc1ec8, 0xc1eca, 0xc1ecc, 0xc1ece, 0xc1ed0, 0xc1ed2, 0xc1ed4, 0xc1ed6, 0xc1ed8, - 0xc1eda, 0xc1edc, 0xc1ede, 0xc1ee0, 0xc1ee2, 0xc1ee4, 0xc1ee6, 0xc1ee8, 0xc1eea, - 0xc1eec, 0xc1eee, 0xc1ef0, 0xc1ef2, 0xc1ef4, 0xc1ef6, 0xc1ef8, 0xc1efa, 0xc1efc, - 0xc1efe, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1f5f, 0xc2102, 0xc2107, 0xc2115, 0xc2124, - 0xc2126, 0xc2128, 0xc213e, 0xc213f, 0xc2145, 0xc2183, 0xc2c60, 0xc2c67, 0xc2c69, - 0xc2c6b, 0xc2c72, 0xc2c75, 0xc2c82, 0xc2c84, 0xc2c86, 0xc2c88, 0xc2c8a, 0xc2c8c, - 0xc2c8e, 0xc2c90, 0xc2c92, 0xc2c94, 0xc2c96, 0xc2c98, 0xc2c9a, 0xc2c9c, 0xc2c9e, - 0xc2ca0, 0xc2ca2, 0xc2ca4, 0xc2ca6, 0xc2ca8, 0xc2caa, 0xc2cac, 0xc2cae, 0xc2cb0, - 0xc2cb2, 0xc2cb4, 0xc2cb6, 0xc2cb8, 0xc2cba, 0xc2cbc, 0xc2cbe, 0xc2cc0, 0xc2cc2, - 0xc2cc4, 0xc2cc6, 0xc2cc8, 0xc2cca, 0xc2ccc, 0xc2cce, 0xc2cd0, 0xc2cd2, 0xc2cd4, - 0xc2cd6, 0xc2cd8, 0xc2cda, 0xc2cdc, 0xc2cde, 0xc2ce0, 0xc2ce2, 0xc2ceb, 0xc2ced, - 0xc2cf2, 0xca640, 0xca642, 0xca644, 0xca646, 0xca648, 0xca64a, 0xca64c, 0xca64e, - 0xca650, 0xca652, 0xca654, 0xca656, 0xca658, 0xca65a, 0xca65c, 0xca65e, 0xca660, - 0xca662, 0xca664, 0xca666, 0xca668, 0xca66a, 0xca66c, 0xca680, 0xca682, 0xca684, - 0xca686, 0xca688, 0xca68a, 0xca68c, 0xca68e, 0xca690, 0xca692, 0xca694, 0xca696, - 0xca698, 0xca69a, 0xca722, 0xca724, 0xca726, 0xca728, 0xca72a, 0xca72c, 0xca72e, - 0xca732, 0xca734, 0xca736, 0xca738, 0xca73a, 0xca73c, 0xca73e, 0xca740, 0xca742, - 0xca744, 0xca746, 0xca748, 0xca74a, 0xca74c, 0xca74e, 0xca750, 0xca752, 0xca754, - 0xca756, 0xca758, 0xca75a, 0xca75c, 0xca75e, 0xca760, 0xca762, 0xca764, 0xca766, - 0xca768, 0xca76a, 0xca76c, 0xca76e, 0xca779, 0xca77b, 0xca77d, 0xca77e, 0xca780, - 0xca782, 0xca784, 0xca786, 0xca78b, 0xca78d, 0xca790, 0xca792, 0xca796, 0xca798, - 0xca79a, 0xca79c, 0xca79e, 0xca7a0, 0xca7a2, 0xca7a4, 0xca7a6, 0xca7a8, 0xca7b6, - 0xd0100, 0xd0102, 0xd0104, 0xd0106, 0xd0108, 0xd010a, 0xd010c, 0xd010e, 0xd0110, - 0xd0112, 0xd0114, 0xd0116, 0xd0118, 0xd011a, 0xd011c, 0xd011e, 0xd0120, 0xd0122, - 0xd0124, 0xd0126, 0xd0128, 0xd012a, 0xd012c, 0xd012e, 0xd0130, 0xd0132, 0xd0134, - 0xd0136, 0xd0139, 0xd013b, 0xd013d, 0xd013f, 0xd0141, 0xd0143, 0xd0145, 0xd0147, - 0xd014a, 0xd014c, 0xd014e, 0xd0150, 0xd0152, 0xd0154, 0xd0156, 0xd0158, 0xd015a, - 0xd015c, 0xd015e, 0xd0160, 0xd0162, 0xd0164, 0xd0166, 0xd0168, 0xd016a, 0xd016c, - 0xd016e, 0xd0170, 0xd0172, 0xd0174, 0xd0176, 0xd0178, 0xd0179, 0xd017b, 0xd017d, - 0xd0181, 0xd0182, 0xd0184, 0xd0186, 0xd0187, 0xd0193, 0xd0194, 0xd019c, 0xd019d, - 0xd019f, 0xd01a0, 0xd01a2, 0xd01a4, 0xd01a6, 0xd01a7, 0xd01a9, 0xd01ac, 0xd01ae, - 0xd01af, 0xd01b5, 0xd01b7, 0xd01b8, 0xd01bc, 0xd01c4, 0xd01c7, 0xd01ca, 0xd01cd, - 0xd01cf, 0xd01d1, 0xd01d3, 0xd01d5, 0xd01d7, 0xd01d9, 0xd01db, 0xd01de, 0xd01e0, - 0xd01e2, 0xd01e4, 0xd01e6, 0xd01e8, 0xd01ea, 0xd01ec, 0xd01ee, 0xd01f1, 0xd01f4, - 0xd01fa, 0xd01fc, 0xd01fe, 0xd0200, 0xd0202, 0xd0204, 0xd0206, 0xd0208, 0xd020a, - 0xd020c, 0xd020e, 0xd0210, 0xd0212, 0xd0214, 0xd0216, 0xd0218, 0xd021a, 0xd021c, - 0xd021e, 0xd0220, 0xd0222, 0xd0224, 0xd0226, 0xd0228, 0xd022a, 0xd022c, 0xd022e, - 0xd0230, 0xd0232, 0xd023a, 0xd023b, 0xd023d, 0xd023e, 0xd0241, 0xd0248, 0xd024a, - 0xd024c, 0xd024e, 0xd0370, 0xd0372, 0xd0376, 0xd037f, 0xd0386, 0xd038c, 0xd038e, - 0xd038f, 0xd03cf, 0xd03d8, 0xd03da, 0xd03dc, 0xd03de, 0xd03e0, 0xd03e2, 0xd03e4, - 0xd03e6, 0xd03e8, 0xd03ea, 0xd03ec, 0xd03ee, 0xd03f4, 0xd03f7, 0xd03f9, 0xd03fa, - 0xd0460, 0xd0462, 0xd0464, 0xd0466, 0xd0468, 0xd046a, 0xd046c, 0xd046e, 0xd0470, - 0xd0472, 0xd0474, 0xd0476, 0xd0478, 0xd047a, 0xd047c, 0xd047e, 0xd0480, 0xd048a, - 0xd048c, 0xd048e, 0xd0490, 0xd0492, 0xd0494, 0xd0496, 0xd0498, 0xd049a, 0xd049c, - 0xd049e, 0xd04a0, 0xd04a2, 0xd04a4, 0xd04a6, 0xd04a8, 0xd04aa, 0xd04ac, 0xd04ae, - 0xd04b0, 0xd04b2, 0xd04b4, 0xd04b6, 0xd04b8, 0xd04ba, 0xd04bc, 0xd04be, 0xd04c0, - 0xd04c1, 0xd04c3, 0xd04c5, 0xd04c7, 0xd04c9, 0xd04cb, 0xd04cd, 0xd04d0, 0xd04d2, - 0xd04d4, 0xd04d6, 0xd04d8, 0xd04da, 0xd04dc, 0xd04de, 0xd04e0, 0xd04e2, 0xd04e4, - 0xd04e6, 0xd04e8, 0xd04ea, 0xd04ec, 0xd04ee, 0xd04f0, 0xd04f2, 0xd04f4, 0xd04f6, - 0xd04f8, 0xd04fa, 0xd04fc, 0xd04fe, 0xd0500, 0xd0502, 0xd0504, 0xd0506, 0xd0508, - 0xd050a, 0xd050c, 0xd050e, 0xd0510, 0xd0512, 0xd0514, 0xd0516, 0xd0518, 0xd051a, - 0xd051c, 0xd051e, 0xd0520, 0xd0522, 0xd0524, 0xd0526, 0xd0528, 0xd052a, 0xd052c, - 0xd052e, 0xd10c7, 0xd10cd, 0xd1e00, 0xd1e02, 0xd1e04, 0xd1e06, 0xd1e08, 0xd1e0a, - 0xd1e0c, 0xd1e0e, 0xd1e10, 0xd1e12, 0xd1e14, 0xd1e16, 0xd1e18, 0xd1e1a, 0xd1e1c, - 0xd1e1e, 0xd1e20, 0xd1e22, 0xd1e24, 0xd1e26, 0xd1e28, 0xd1e2a, 0xd1e2c, 0xd1e2e, - 0xd1e30, 0xd1e32, 0xd1e34, 0xd1e36, 0xd1e38, 0xd1e3a, 0xd1e3c, 0xd1e3e, 0xd1e40, - 0xd1e42, 0xd1e44, 0xd1e46, 0xd1e48, 0xd1e4a, 0xd1e4c, 0xd1e4e, 0xd1e50, 0xd1e52, - 0xd1e54, 0xd1e56, 0xd1e58, 0xd1e5a, 0xd1e5c, 0xd1e5e, 0xd1e60, 0xd1e62, 0xd1e64, - 0xd1e66, 0xd1e68, 0xd1e6a, 0xd1e6c, 0xd1e6e, 0xd1e70, 0xd1e72, 0xd1e74, 0xd1e76, - 0xd1e78, 0xd1e7a, 0xd1e7c, 0xd1e7e, 0xd1e80, 0xd1e82, 0xd1e84, 0xd1e86, 0xd1e88, - 0xd1e8a, 0xd1e8c, 0xd1e8e, 0xd1e90, 0xd1e92, 0xd1e94, 0xd1e9e, 0xd1ea0, 0xd1ea2, - 0xd1ea4, 0xd1ea6, 0xd1ea8, 0xd1eaa, 0xd1eac, 0xd1eae, 0xd1eb0, 0xd1eb2, 0xd1eb4, - 0xd1eb6, 0xd1eb8, 0xd1eba, 0xd1ebc, 0xd1ebe, 0xd1ec0, 0xd1ec2, 0xd1ec4, 0xd1ec6, - 0xd1ec8, 0xd1eca, 0xd1ecc, 0xd1ece, 0xd1ed0, 0xd1ed2, 0xd1ed4, 0xd1ed6, 0xd1ed8, - 0xd1eda, 0xd1edc, 0xd1ede, 0xd1ee0, 0xd1ee2, 0xd1ee4, 0xd1ee6, 0xd1ee8, 0xd1eea, - 0xd1eec, 0xd1eee, 0xd1ef0, 0xd1ef2, 0xd1ef4, 0xd1ef6, 0xd1ef8, 0xd1efa, 0xd1efc, - 0xd1efe, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1f5f, 0xd2102, 0xd2107, 0xd2115, 0xd2124, - 0xd2126, 0xd2128, 0xd213e, 0xd213f, 0xd2145, 0xd2183, 0xd2c60, 0xd2c67, 0xd2c69, - 0xd2c6b, 0xd2c72, 0xd2c75, 0xd2c82, 0xd2c84, 0xd2c86, 0xd2c88, 0xd2c8a, 0xd2c8c, - 0xd2c8e, 0xd2c90, 0xd2c92, 0xd2c94, 0xd2c96, 0xd2c98, 0xd2c9a, 0xd2c9c, 0xd2c9e, - 0xd2ca0, 0xd2ca2, 0xd2ca4, 0xd2ca6, 0xd2ca8, 0xd2caa, 0xd2cac, 0xd2cae, 0xd2cb0, - 0xd2cb2, 0xd2cb4, 0xd2cb6, 0xd2cb8, 0xd2cba, 0xd2cbc, 0xd2cbe, 0xd2cc0, 0xd2cc2, - 0xd2cc4, 0xd2cc6, 0xd2cc8, 0xd2cca, 0xd2ccc, 0xd2cce, 0xd2cd0, 0xd2cd2, 0xd2cd4, - 0xd2cd6, 0xd2cd8, 0xd2cda, 0xd2cdc, 0xd2cde, 0xd2ce0, 0xd2ce2, 0xd2ceb, 0xd2ced, - 0xd2cf2, 0xda640, 0xda642, 0xda644, 0xda646, 0xda648, 0xda64a, 0xda64c, 0xda64e, - 0xda650, 0xda652, 0xda654, 0xda656, 0xda658, 0xda65a, 0xda65c, 0xda65e, 0xda660, - 0xda662, 0xda664, 0xda666, 0xda668, 0xda66a, 0xda66c, 0xda680, 0xda682, 0xda684, - 0xda686, 0xda688, 0xda68a, 0xda68c, 0xda68e, 0xda690, 0xda692, 0xda694, 0xda696, - 0xda698, 0xda69a, 0xda722, 0xda724, 0xda726, 0xda728, 0xda72a, 0xda72c, 0xda72e, - 0xda732, 0xda734, 0xda736, 0xda738, 0xda73a, 0xda73c, 0xda73e, 0xda740, 0xda742, - 0xda744, 0xda746, 0xda748, 0xda74a, 0xda74c, 0xda74e, 0xda750, 0xda752, 0xda754, - 0xda756, 0xda758, 0xda75a, 0xda75c, 0xda75e, 0xda760, 0xda762, 0xda764, 0xda766, - 0xda768, 0xda76a, 0xda76c, 0xda76e, 0xda779, 0xda77b, 0xda77d, 0xda77e, 0xda780, - 0xda782, 0xda784, 0xda786, 0xda78b, 0xda78d, 0xda790, 0xda792, 0xda796, 0xda798, - 0xda79a, 0xda79c, 0xda79e, 0xda7a0, 0xda7a2, 0xda7a4, 0xda7a6, 0xda7a8, 0xda7b6, - 0xe0100, 0xe0102, 0xe0104, 0xe0106, 0xe0108, 0xe010a, 0xe010c, 0xe010e, 0xe0110, - 0xe0112, 0xe0114, 0xe0116, 0xe0118, 0xe011a, 0xe011c, 0xe011e, 0xe0120, 0xe0122, - 0xe0124, 0xe0126, 0xe0128, 0xe012a, 0xe012c, 0xe012e, 0xe0130, 0xe0132, 0xe0134, - 0xe0136, 0xe0139, 0xe013b, 0xe013d, 0xe013f, 0xe0141, 0xe0143, 0xe0145, 0xe0147, - 0xe014a, 0xe014c, 0xe014e, 0xe0150, 0xe0152, 0xe0154, 0xe0156, 0xe0158, 0xe015a, - 0xe015c, 0xe015e, 0xe0160, 0xe0162, 0xe0164, 0xe0166, 0xe0168, 0xe016a, 0xe016c, - 0xe016e, 0xe0170, 0xe0172, 0xe0174, 0xe0176, 0xe0178, 0xe0179, 0xe017b, 0xe017d, - 0xe0181, 0xe0182, 0xe0184, 0xe0186, 0xe0187, 0xe0193, 0xe0194, 0xe019c, 0xe019d, - 0xe019f, 0xe01a0, 0xe01a2, 0xe01a4, 0xe01a6, 0xe01a7, 0xe01a9, 0xe01ac, 0xe01ae, - 0xe01af, 0xe01b5, 0xe01b7, 0xe01b8, 0xe01bc, 0xe01c4, 0xe01c7, 0xe01ca, 0xe01cd, - 0xe01cf, 0xe01d1, 0xe01d3, 0xe01d5, 0xe01d7, 0xe01d9, 0xe01db, 0xe01de, 0xe01e0, - 0xe01e2, 0xe01e4, 0xe01e6, 0xe01e8, 0xe01ea, 0xe01ec, 0xe01ee, 0xe01f1, 0xe01f4, - 0xe01fa, 0xe01fc, 0xe01fe, 0xe0200, 0xe0202, 0xe0204, 0xe0206, 0xe0208, 0xe020a, - 0xe020c, 0xe020e, 0xe0210, 0xe0212, 0xe0214, 0xe0216, 0xe0218, 0xe021a, 0xe021c, - 0xe021e, 0xe0220, 0xe0222, 0xe0224, 0xe0226, 0xe0228, 0xe022a, 0xe022c, 0xe022e, - 0xe0230, 0xe0232, 0xe023a, 0xe023b, 0xe023d, 0xe023e, 0xe0241, 0xe0248, 0xe024a, - 0xe024c, 0xe024e, 0xe0370, 0xe0372, 0xe0376, 0xe037f, 0xe0386, 0xe038c, 0xe038e, - 0xe038f, 0xe03cf, 0xe03d8, 0xe03da, 0xe03dc, 0xe03de, 0xe03e0, 0xe03e2, 0xe03e4, - 0xe03e6, 0xe03e8, 0xe03ea, 0xe03ec, 0xe03ee, 0xe03f4, 0xe03f7, 0xe03f9, 0xe03fa, - 0xe0460, 0xe0462, 0xe0464, 0xe0466, 0xe0468, 0xe046a, 0xe046c, 0xe046e, 0xe0470, - 0xe0472, 0xe0474, 0xe0476, 0xe0478, 0xe047a, 0xe047c, 0xe047e, 0xe0480, 0xe048a, - 0xe048c, 0xe048e, 0xe0490, 0xe0492, 0xe0494, 0xe0496, 0xe0498, 0xe049a, 0xe049c, - 0xe049e, 0xe04a0, 0xe04a2, 0xe04a4, 0xe04a6, 0xe04a8, 0xe04aa, 0xe04ac, 0xe04ae, - 0xe04b0, 0xe04b2, 0xe04b4, 0xe04b6, 0xe04b8, 0xe04ba, 0xe04bc, 0xe04be, 0xe04c0, - 0xe04c1, 0xe04c3, 0xe04c5, 0xe04c7, 0xe04c9, 0xe04cb, 0xe04cd, 0xe04d0, 0xe04d2, - 0xe04d4, 0xe04d6, 0xe04d8, 0xe04da, 0xe04dc, 0xe04de, 0xe04e0, 0xe04e2, 0xe04e4, - 0xe04e6, 0xe04e8, 0xe04ea, 0xe04ec, 0xe04ee, 0xe04f0, 0xe04f2, 0xe04f4, 0xe04f6, - 0xe04f8, 0xe04fa, 0xe04fc, 0xe04fe, 0xe0500, 0xe0502, 0xe0504, 0xe0506, 0xe0508, - 0xe050a, 0xe050c, 0xe050e, 0xe0510, 0xe0512, 0xe0514, 0xe0516, 0xe0518, 0xe051a, - 0xe051c, 0xe051e, 0xe0520, 0xe0522, 0xe0524, 0xe0526, 0xe0528, 0xe052a, 0xe052c, - 0xe052e, 0xe10c7, 0xe10cd, 0xe1e00, 0xe1e02, 0xe1e04, 0xe1e06, 0xe1e08, 0xe1e0a, - 0xe1e0c, 0xe1e0e, 0xe1e10, 0xe1e12, 0xe1e14, 0xe1e16, 0xe1e18, 0xe1e1a, 0xe1e1c, - 0xe1e1e, 0xe1e20, 0xe1e22, 0xe1e24, 0xe1e26, 0xe1e28, 0xe1e2a, 0xe1e2c, 0xe1e2e, - 0xe1e30, 0xe1e32, 0xe1e34, 0xe1e36, 0xe1e38, 0xe1e3a, 0xe1e3c, 0xe1e3e, 0xe1e40, - 0xe1e42, 0xe1e44, 0xe1e46, 0xe1e48, 0xe1e4a, 0xe1e4c, 0xe1e4e, 0xe1e50, 0xe1e52, - 0xe1e54, 0xe1e56, 0xe1e58, 0xe1e5a, 0xe1e5c, 0xe1e5e, 0xe1e60, 0xe1e62, 0xe1e64, - 0xe1e66, 0xe1e68, 0xe1e6a, 0xe1e6c, 0xe1e6e, 0xe1e70, 0xe1e72, 0xe1e74, 0xe1e76, - 0xe1e78, 0xe1e7a, 0xe1e7c, 0xe1e7e, 0xe1e80, 0xe1e82, 0xe1e84, 0xe1e86, 0xe1e88, - 0xe1e8a, 0xe1e8c, 0xe1e8e, 0xe1e90, 0xe1e92, 0xe1e94, 0xe1e9e, 0xe1ea0, 0xe1ea2, - 0xe1ea4, 0xe1ea6, 0xe1ea8, 0xe1eaa, 0xe1eac, 0xe1eae, 0xe1eb0, 0xe1eb2, 0xe1eb4, - 0xe1eb6, 0xe1eb8, 0xe1eba, 0xe1ebc, 0xe1ebe, 0xe1ec0, 0xe1ec2, 0xe1ec4, 0xe1ec6, - 0xe1ec8, 0xe1eca, 0xe1ecc, 0xe1ece, 0xe1ed0, 0xe1ed2, 0xe1ed4, 0xe1ed6, 0xe1ed8, - 0xe1eda, 0xe1edc, 0xe1ede, 0xe1ee0, 0xe1ee2, 0xe1ee4, 0xe1ee6, 0xe1ee8, 0xe1eea, - 0xe1eec, 0xe1eee, 0xe1ef0, 0xe1ef2, 0xe1ef4, 0xe1ef6, 0xe1ef8, 0xe1efa, 0xe1efc, - 0xe1efe, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1f5f, 0xe2102, 0xe2107, 0xe2115, 0xe2124, - 0xe2126, 0xe2128, 0xe213e, 0xe213f, 0xe2145, 0xe2183, 0xe2c60, 0xe2c67, 0xe2c69, - 0xe2c6b, 0xe2c72, 0xe2c75, 0xe2c82, 0xe2c84, 0xe2c86, 0xe2c88, 0xe2c8a, 0xe2c8c, - 0xe2c8e, 0xe2c90, 0xe2c92, 0xe2c94, 0xe2c96, 0xe2c98, 0xe2c9a, 0xe2c9c, 0xe2c9e, - 0xe2ca0, 0xe2ca2, 0xe2ca4, 0xe2ca6, 0xe2ca8, 0xe2caa, 0xe2cac, 0xe2cae, 0xe2cb0, - 0xe2cb2, 0xe2cb4, 0xe2cb6, 0xe2cb8, 0xe2cba, 0xe2cbc, 0xe2cbe, 0xe2cc0, 0xe2cc2, - 0xe2cc4, 0xe2cc6, 0xe2cc8, 0xe2cca, 0xe2ccc, 0xe2cce, 0xe2cd0, 0xe2cd2, 0xe2cd4, - 0xe2cd6, 0xe2cd8, 0xe2cda, 0xe2cdc, 0xe2cde, 0xe2ce0, 0xe2ce2, 0xe2ceb, 0xe2ced, - 0xe2cf2, 0xea640, 0xea642, 0xea644, 0xea646, 0xea648, 0xea64a, 0xea64c, 0xea64e, - 0xea650, 0xea652, 0xea654, 0xea656, 0xea658, 0xea65a, 0xea65c, 0xea65e, 0xea660, - 0xea662, 0xea664, 0xea666, 0xea668, 0xea66a, 0xea66c, 0xea680, 0xea682, 0xea684, - 0xea686, 0xea688, 0xea68a, 0xea68c, 0xea68e, 0xea690, 0xea692, 0xea694, 0xea696, - 0xea698, 0xea69a, 0xea722, 0xea724, 0xea726, 0xea728, 0xea72a, 0xea72c, 0xea72e, - 0xea732, 0xea734, 0xea736, 0xea738, 0xea73a, 0xea73c, 0xea73e, 0xea740, 0xea742, - 0xea744, 0xea746, 0xea748, 0xea74a, 0xea74c, 0xea74e, 0xea750, 0xea752, 0xea754, - 0xea756, 0xea758, 0xea75a, 0xea75c, 0xea75e, 0xea760, 0xea762, 0xea764, 0xea766, - 0xea768, 0xea76a, 0xea76c, 0xea76e, 0xea779, 0xea77b, 0xea77d, 0xea77e, 0xea780, - 0xea782, 0xea784, 0xea786, 0xea78b, 0xea78d, 0xea790, 0xea792, 0xea796, 0xea798, - 0xea79a, 0xea79c, 0xea79e, 0xea7a0, 0xea7a2, 0xea7a4, 0xea7a6, 0xea7a8, 0xea7b6, - 0xf0100, 0xf0102, 0xf0104, 0xf0106, 0xf0108, 0xf010a, 0xf010c, 0xf010e, 0xf0110, - 0xf0112, 0xf0114, 0xf0116, 0xf0118, 0xf011a, 0xf011c, 0xf011e, 0xf0120, 0xf0122, - 0xf0124, 0xf0126, 0xf0128, 0xf012a, 0xf012c, 0xf012e, 0xf0130, 0xf0132, 0xf0134, - 0xf0136, 0xf0139, 0xf013b, 0xf013d, 0xf013f, 0xf0141, 0xf0143, 0xf0145, 0xf0147, - 0xf014a, 0xf014c, 0xf014e, 0xf0150, 0xf0152, 0xf0154, 0xf0156, 0xf0158, 0xf015a, - 0xf015c, 0xf015e, 0xf0160, 0xf0162, 0xf0164, 0xf0166, 0xf0168, 0xf016a, 0xf016c, - 0xf016e, 0xf0170, 0xf0172, 0xf0174, 0xf0176, 0xf0178, 0xf0179, 0xf017b, 0xf017d, - 0xf0181, 0xf0182, 0xf0184, 0xf0186, 0xf0187, 0xf0193, 0xf0194, 0xf019c, 0xf019d, - 0xf019f, 0xf01a0, 0xf01a2, 0xf01a4, 0xf01a6, 0xf01a7, 0xf01a9, 0xf01ac, 0xf01ae, - 0xf01af, 0xf01b5, 0xf01b7, 0xf01b8, 0xf01bc, 0xf01c4, 0xf01c7, 0xf01ca, 0xf01cd, - 0xf01cf, 0xf01d1, 0xf01d3, 0xf01d5, 0xf01d7, 0xf01d9, 0xf01db, 0xf01de, 0xf01e0, - 0xf01e2, 0xf01e4, 0xf01e6, 0xf01e8, 0xf01ea, 0xf01ec, 0xf01ee, 0xf01f1, 0xf01f4, - 0xf01fa, 0xf01fc, 0xf01fe, 0xf0200, 0xf0202, 0xf0204, 0xf0206, 0xf0208, 0xf020a, - 0xf020c, 0xf020e, 0xf0210, 0xf0212, 0xf0214, 0xf0216, 0xf0218, 0xf021a, 0xf021c, - 0xf021e, 0xf0220, 0xf0222, 0xf0224, 0xf0226, 0xf0228, 0xf022a, 0xf022c, 0xf022e, - 0xf0230, 0xf0232, 0xf023a, 0xf023b, 0xf023d, 0xf023e, 0xf0241, 0xf0248, 0xf024a, - 0xf024c, 0xf024e, 0xf0370, 0xf0372, 0xf0376, 0xf037f, 0xf0386, 0xf038c, 0xf038e, - 0xf038f, 0xf03cf, 0xf03d8, 0xf03da, 0xf03dc, 0xf03de, 0xf03e0, 0xf03e2, 0xf03e4, - 0xf03e6, 0xf03e8, 0xf03ea, 0xf03ec, 0xf03ee, 0xf03f4, 0xf03f7, 0xf03f9, 0xf03fa, - 0xf0460, 0xf0462, 0xf0464, 0xf0466, 0xf0468, 0xf046a, 0xf046c, 0xf046e, 0xf0470, - 0xf0472, 0xf0474, 0xf0476, 0xf0478, 0xf047a, 0xf047c, 0xf047e, 0xf0480, 0xf048a, - 0xf048c, 0xf048e, 0xf0490, 0xf0492, 0xf0494, 0xf0496, 0xf0498, 0xf049a, 0xf049c, - 0xf049e, 0xf04a0, 0xf04a2, 0xf04a4, 0xf04a6, 0xf04a8, 0xf04aa, 0xf04ac, 0xf04ae, - 0xf04b0, 0xf04b2, 0xf04b4, 0xf04b6, 0xf04b8, 0xf04ba, 0xf04bc, 0xf04be, 0xf04c0, - 0xf04c1, 0xf04c3, 0xf04c5, 0xf04c7, 0xf04c9, 0xf04cb, 0xf04cd, 0xf04d0, 0xf04d2, - 0xf04d4, 0xf04d6, 0xf04d8, 0xf04da, 0xf04dc, 0xf04de, 0xf04e0, 0xf04e2, 0xf04e4, - 0xf04e6, 0xf04e8, 0xf04ea, 0xf04ec, 0xf04ee, 0xf04f0, 0xf04f2, 0xf04f4, 0xf04f6, - 0xf04f8, 0xf04fa, 0xf04fc, 0xf04fe, 0xf0500, 0xf0502, 0xf0504, 0xf0506, 0xf0508, - 0xf050a, 0xf050c, 0xf050e, 0xf0510, 0xf0512, 0xf0514, 0xf0516, 0xf0518, 0xf051a, - 0xf051c, 0xf051e, 0xf0520, 0xf0522, 0xf0524, 0xf0526, 0xf0528, 0xf052a, 0xf052c, - 0xf052e, 0xf10c7, 0xf10cd, 0xf1e00, 0xf1e02, 0xf1e04, 0xf1e06, 0xf1e08, 0xf1e0a, - 0xf1e0c, 0xf1e0e, 0xf1e10, 0xf1e12, 0xf1e14, 0xf1e16, 0xf1e18, 0xf1e1a, 0xf1e1c, - 0xf1e1e, 0xf1e20, 0xf1e22, 0xf1e24, 0xf1e26, 0xf1e28, 0xf1e2a, 0xf1e2c, 0xf1e2e, - 0xf1e30, 0xf1e32, 0xf1e34, 0xf1e36, 0xf1e38, 0xf1e3a, 0xf1e3c, 0xf1e3e, 0xf1e40, - 0xf1e42, 0xf1e44, 0xf1e46, 0xf1e48, 0xf1e4a, 0xf1e4c, 0xf1e4e, 0xf1e50, 0xf1e52, - 0xf1e54, 0xf1e56, 0xf1e58, 0xf1e5a, 0xf1e5c, 0xf1e5e, 0xf1e60, 0xf1e62, 0xf1e64, - 0xf1e66, 0xf1e68, 0xf1e6a, 0xf1e6c, 0xf1e6e, 0xf1e70, 0xf1e72, 0xf1e74, 0xf1e76, - 0xf1e78, 0xf1e7a, 0xf1e7c, 0xf1e7e, 0xf1e80, 0xf1e82, 0xf1e84, 0xf1e86, 0xf1e88, - 0xf1e8a, 0xf1e8c, 0xf1e8e, 0xf1e90, 0xf1e92, 0xf1e94, 0xf1e9e, 0xf1ea0, 0xf1ea2, - 0xf1ea4, 0xf1ea6, 0xf1ea8, 0xf1eaa, 0xf1eac, 0xf1eae, 0xf1eb0, 0xf1eb2, 0xf1eb4, - 0xf1eb6, 0xf1eb8, 0xf1eba, 0xf1ebc, 0xf1ebe, 0xf1ec0, 0xf1ec2, 0xf1ec4, 0xf1ec6, - 0xf1ec8, 0xf1eca, 0xf1ecc, 0xf1ece, 0xf1ed0, 0xf1ed2, 0xf1ed4, 0xf1ed6, 0xf1ed8, - 0xf1eda, 0xf1edc, 0xf1ede, 0xf1ee0, 0xf1ee2, 0xf1ee4, 0xf1ee6, 0xf1ee8, 0xf1eea, - 0xf1eec, 0xf1eee, 0xf1ef0, 0xf1ef2, 0xf1ef4, 0xf1ef6, 0xf1ef8, 0xf1efa, 0xf1efc, - 0xf1efe, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1f5f, 0xf2102, 0xf2107, 0xf2115, 0xf2124, - 0xf2126, 0xf2128, 0xf213e, 0xf213f, 0xf2145, 0xf2183, 0xf2c60, 0xf2c67, 0xf2c69, - 0xf2c6b, 0xf2c72, 0xf2c75, 0xf2c82, 0xf2c84, 0xf2c86, 0xf2c88, 0xf2c8a, 0xf2c8c, - 0xf2c8e, 0xf2c90, 0xf2c92, 0xf2c94, 0xf2c96, 0xf2c98, 0xf2c9a, 0xf2c9c, 0xf2c9e, - 0xf2ca0, 0xf2ca2, 0xf2ca4, 0xf2ca6, 0xf2ca8, 0xf2caa, 0xf2cac, 0xf2cae, 0xf2cb0, - 0xf2cb2, 0xf2cb4, 0xf2cb6, 0xf2cb8, 0xf2cba, 0xf2cbc, 0xf2cbe, 0xf2cc0, 0xf2cc2, - 0xf2cc4, 0xf2cc6, 0xf2cc8, 0xf2cca, 0xf2ccc, 0xf2cce, 0xf2cd0, 0xf2cd2, 0xf2cd4, - 0xf2cd6, 0xf2cd8, 0xf2cda, 0xf2cdc, 0xf2cde, 0xf2ce0, 0xf2ce2, 0xf2ceb, 0xf2ced, - 0xf2cf2, 0xfa640, 0xfa642, 0xfa644, 0xfa646, 0xfa648, 0xfa64a, 0xfa64c, 0xfa64e, - 0xfa650, 0xfa652, 0xfa654, 0xfa656, 0xfa658, 0xfa65a, 0xfa65c, 0xfa65e, 0xfa660, - 0xfa662, 0xfa664, 0xfa666, 0xfa668, 0xfa66a, 0xfa66c, 0xfa680, 0xfa682, 0xfa684, - 0xfa686, 0xfa688, 0xfa68a, 0xfa68c, 0xfa68e, 0xfa690, 0xfa692, 0xfa694, 0xfa696, - 0xfa698, 0xfa69a, 0xfa722, 0xfa724, 0xfa726, 0xfa728, 0xfa72a, 0xfa72c, 0xfa72e, - 0xfa732, 0xfa734, 0xfa736, 0xfa738, 0xfa73a, 0xfa73c, 0xfa73e, 0xfa740, 0xfa742, - 0xfa744, 0xfa746, 0xfa748, 0xfa74a, 0xfa74c, 0xfa74e, 0xfa750, 0xfa752, 0xfa754, - 0xfa756, 0xfa758, 0xfa75a, 0xfa75c, 0xfa75e, 0xfa760, 0xfa762, 0xfa764, 0xfa766, - 0xfa768, 0xfa76a, 0xfa76c, 0xfa76e, 0xfa779, 0xfa77b, 0xfa77d, 0xfa77e, 0xfa780, - 0xfa782, 0xfa784, 0xfa786, 0xfa78b, 0xfa78d, 0xfa790, 0xfa792, 0xfa796, 0xfa798, - 0xfa79a, 0xfa79c, 0xfa79e, 0xfa7a0, 0xfa7a2, 0xfa7a4, 0xfa7a6, 0xfa7a8, 0xfa7b6, - 0x100100, 0x100102, 0x100104, 0x100106, 0x100108, 0x10010a, 0x10010c, 0x10010e, 0x100110, - 0x100112, 0x100114, 0x100116, 0x100118, 0x10011a, 0x10011c, 0x10011e, 0x100120, 0x100122, - 0x100124, 0x100126, 0x100128, 0x10012a, 0x10012c, 0x10012e, 0x100130, 0x100132, 0x100134, - 0x100136, 0x100139, 0x10013b, 0x10013d, 0x10013f, 0x100141, 0x100143, 0x100145, 0x100147, - 0x10014a, 0x10014c, 0x10014e, 0x100150, 0x100152, 0x100154, 0x100156, 0x100158, 0x10015a, - 0x10015c, 0x10015e, 0x100160, 0x100162, 0x100164, 0x100166, 0x100168, 0x10016a, 0x10016c, - 0x10016e, 0x100170, 0x100172, 0x100174, 0x100176, 0x100178, 0x100179, 0x10017b, 0x10017d, - 0x100181, 0x100182, 0x100184, 0x100186, 0x100187, 0x100193, 0x100194, 0x10019c, 0x10019d, - 0x10019f, 0x1001a0, 0x1001a2, 0x1001a4, 0x1001a6, 0x1001a7, 0x1001a9, 0x1001ac, 0x1001ae, - 0x1001af, 0x1001b5, 0x1001b7, 0x1001b8, 0x1001bc, 0x1001c4, 0x1001c7, 0x1001ca, 0x1001cd, - 0x1001cf, 0x1001d1, 0x1001d3, 0x1001d5, 0x1001d7, 0x1001d9, 0x1001db, 0x1001de, 0x1001e0, - 0x1001e2, 0x1001e4, 0x1001e6, 0x1001e8, 0x1001ea, 0x1001ec, 0x1001ee, 0x1001f1, 0x1001f4, - 0x1001fa, 0x1001fc, 0x1001fe, 0x100200, 0x100202, 0x100204, 0x100206, 0x100208, 0x10020a, - 0x10020c, 0x10020e, 0x100210, 0x100212, 0x100214, 0x100216, 0x100218, 0x10021a, 0x10021c, - 0x10021e, 0x100220, 0x100222, 0x100224, 0x100226, 0x100228, 0x10022a, 0x10022c, 0x10022e, - 0x100230, 0x100232, 0x10023a, 0x10023b, 0x10023d, 0x10023e, 0x100241, 0x100248, 0x10024a, - 0x10024c, 0x10024e, 0x100370, 0x100372, 0x100376, 0x10037f, 0x100386, 0x10038c, 0x10038e, - 0x10038f, 0x1003cf, 0x1003d8, 0x1003da, 0x1003dc, 0x1003de, 0x1003e0, 0x1003e2, 0x1003e4, - 0x1003e6, 0x1003e8, 0x1003ea, 0x1003ec, 0x1003ee, 0x1003f4, 0x1003f7, 0x1003f9, 0x1003fa, - 0x100460, 0x100462, 0x100464, 0x100466, 0x100468, 0x10046a, 0x10046c, 0x10046e, 0x100470, - 0x100472, 0x100474, 0x100476, 0x100478, 0x10047a, 0x10047c, 0x10047e, 0x100480, 0x10048a, - 0x10048c, 0x10048e, 0x100490, 0x100492, 0x100494, 0x100496, 0x100498, 0x10049a, 0x10049c, - 0x10049e, 0x1004a0, 0x1004a2, 0x1004a4, 0x1004a6, 0x1004a8, 0x1004aa, 0x1004ac, 0x1004ae, - 0x1004b0, 0x1004b2, 0x1004b4, 0x1004b6, 0x1004b8, 0x1004ba, 0x1004bc, 0x1004be, 0x1004c0, - 0x1004c1, 0x1004c3, 0x1004c5, 0x1004c7, 0x1004c9, 0x1004cb, 0x1004cd, 0x1004d0, 0x1004d2, - 0x1004d4, 0x1004d6, 0x1004d8, 0x1004da, 0x1004dc, 0x1004de, 0x1004e0, 0x1004e2, 0x1004e4, - 0x1004e6, 0x1004e8, 0x1004ea, 0x1004ec, 0x1004ee, 0x1004f0, 0x1004f2, 0x1004f4, 0x1004f6, - 0x1004f8, 0x1004fa, 0x1004fc, 0x1004fe, 0x100500, 0x100502, 0x100504, 0x100506, 0x100508, - 0x10050a, 0x10050c, 0x10050e, 0x100510, 0x100512, 0x100514, 0x100516, 0x100518, 0x10051a, - 0x10051c, 0x10051e, 0x100520, 0x100522, 0x100524, 0x100526, 0x100528, 0x10052a, 0x10052c, - 0x10052e, 0x1010c7, 0x1010cd, 0x101e00, 0x101e02, 0x101e04, 0x101e06, 0x101e08, 0x101e0a, - 0x101e0c, 0x101e0e, 0x101e10, 0x101e12, 0x101e14, 0x101e16, 0x101e18, 0x101e1a, 0x101e1c, - 0x101e1e, 0x101e20, 0x101e22, 0x101e24, 0x101e26, 0x101e28, 0x101e2a, 0x101e2c, 0x101e2e, - 0x101e30, 0x101e32, 0x101e34, 0x101e36, 0x101e38, 0x101e3a, 0x101e3c, 0x101e3e, 0x101e40, - 0x101e42, 0x101e44, 0x101e46, 0x101e48, 0x101e4a, 0x101e4c, 0x101e4e, 0x101e50, 0x101e52, - 0x101e54, 0x101e56, 0x101e58, 0x101e5a, 0x101e5c, 0x101e5e, 0x101e60, 0x101e62, 0x101e64, - 0x101e66, 0x101e68, 0x101e6a, 0x101e6c, 0x101e6e, 0x101e70, 0x101e72, 0x101e74, 0x101e76, - 0x101e78, 0x101e7a, 0x101e7c, 0x101e7e, 0x101e80, 0x101e82, 0x101e84, 0x101e86, 0x101e88, - 0x101e8a, 0x101e8c, 0x101e8e, 0x101e90, 0x101e92, 0x101e94, 0x101e9e, 0x101ea0, 0x101ea2, - 0x101ea4, 0x101ea6, 0x101ea8, 0x101eaa, 0x101eac, 0x101eae, 0x101eb0, 0x101eb2, 0x101eb4, - 0x101eb6, 0x101eb8, 0x101eba, 0x101ebc, 0x101ebe, 0x101ec0, 0x101ec2, 0x101ec4, 0x101ec6, - 0x101ec8, 0x101eca, 0x101ecc, 0x101ece, 0x101ed0, 0x101ed2, 0x101ed4, 0x101ed6, 0x101ed8, - 0x101eda, 0x101edc, 0x101ede, 0x101ee0, 0x101ee2, 0x101ee4, 0x101ee6, 0x101ee8, 0x101eea, - 0x101eec, 0x101eee, 0x101ef0, 0x101ef2, 0x101ef4, 0x101ef6, 0x101ef8, 0x101efa, 0x101efc, - 0x101efe, 0x101f59, 0x101f5b, 0x101f5d, 0x101f5f, 0x102102, 0x102107, 0x102115, 0x102124, - 0x102126, 0x102128, 0x10213e, 0x10213f, 0x102145, 0x102183, 0x102c60, 0x102c67, 0x102c69, - 0x102c6b, 0x102c72, 0x102c75, 0x102c82, 0x102c84, 0x102c86, 0x102c88, 0x102c8a, 0x102c8c, - 0x102c8e, 0x102c90, 0x102c92, 0x102c94, 0x102c96, 0x102c98, 0x102c9a, 0x102c9c, 0x102c9e, - 0x102ca0, 0x102ca2, 0x102ca4, 0x102ca6, 0x102ca8, 0x102caa, 0x102cac, 0x102cae, 0x102cb0, - 0x102cb2, 0x102cb4, 0x102cb6, 0x102cb8, 0x102cba, 0x102cbc, 0x102cbe, 0x102cc0, 0x102cc2, - 0x102cc4, 0x102cc6, 0x102cc8, 0x102cca, 0x102ccc, 0x102cce, 0x102cd0, 0x102cd2, 0x102cd4, - 0x102cd6, 0x102cd8, 0x102cda, 0x102cdc, 0x102cde, 0x102ce0, 0x102ce2, 0x102ceb, 0x102ced, - 0x102cf2, 0x10a640, 0x10a642, 0x10a644, 0x10a646, 0x10a648, 0x10a64a, 0x10a64c, 0x10a64e, - 0x10a650, 0x10a652, 0x10a654, 0x10a656, 0x10a658, 0x10a65a, 0x10a65c, 0x10a65e, 0x10a660, - 0x10a662, 0x10a664, 0x10a666, 0x10a668, 0x10a66a, 0x10a66c, 0x10a680, 0x10a682, 0x10a684, - 0x10a686, 0x10a688, 0x10a68a, 0x10a68c, 0x10a68e, 0x10a690, 0x10a692, 0x10a694, 0x10a696, - 0x10a698, 0x10a69a, 0x10a722, 0x10a724, 0x10a726, 0x10a728, 0x10a72a, 0x10a72c, 0x10a72e, - 0x10a732, 0x10a734, 0x10a736, 0x10a738, 0x10a73a, 0x10a73c, 0x10a73e, 0x10a740, 0x10a742, - 0x10a744, 0x10a746, 0x10a748, 0x10a74a, 0x10a74c, 0x10a74e, 0x10a750, 0x10a752, 0x10a754, - 0x10a756, 0x10a758, 0x10a75a, 0x10a75c, 0x10a75e, 0x10a760, 0x10a762, 0x10a764, 0x10a766, - 0x10a768, 0x10a76a, 0x10a76c, 0x10a76e, 0x10a779, 0x10a77b, 0x10a77d, 0x10a77e, 0x10a780, - 0x10a782, 0x10a784, 0x10a786, 0x10a78b, 0x10a78d, 0x10a790, 0x10a792, 0x10a796, 0x10a798, - 0x10a79a, 0x10a79c, 0x10a79e, 0x10a7a0, 0x10a7a2, 0x10a7a4, 0x10a7a6, 0x10a7a8, 0x10a7b6 + ,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538, + 0x1d539, 0x1d546, 0x1d7ca #endif }; @@ -4944,6 +684,10 @@ static const crange graphRangeTable[] = { {0xaadb, 0xaaf6}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab65}, {0xab70, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, + {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, + {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, + {0xde00, 0xde3e}, {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, + {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19}, @@ -4951,1222 +695,64 @@ static const crange graphRangeTable[] = { {0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6}, {0xffe8, 0xffee} #if TCL_UTF_MAX > 4 - ,{0x10021, 0x1007e}, {0x100a1, 0x100ac}, {0x100ae, 0x10377}, {0x1037a, 0x1037f}, - {0x10384, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x1052f}, {0x10531, 0x10556}, - {0x10559, 0x1055f}, {0x10561, 0x10587}, {0x1058d, 0x1058f}, {0x10591, 0x105c7}, - {0x105d0, 0x105ea}, {0x105f0, 0x105f4}, {0x10606, 0x1061b}, {0x1061e, 0x106dc}, - {0x106de, 0x1070d}, {0x10710, 0x1074a}, {0x1074d, 0x107b1}, {0x107c0, 0x107fa}, - {0x10800, 0x1082d}, {0x10830, 0x1083e}, {0x10840, 0x1085b}, {0x10860, 0x1086a}, - {0x108a0, 0x108b4}, {0x108b6, 0x108bd}, {0x108d4, 0x108e1}, {0x108e3, 0x10983}, - {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, - {0x109bc, 0x109c4}, {0x109cb, 0x109ce}, {0x109df, 0x109e3}, {0x109e6, 0x109fd}, - {0x10a01, 0x10a03}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, - {0x10a3e, 0x10a42}, {0x10a4b, 0x10a4d}, {0x10a59, 0x10a5c}, {0x10a66, 0x10a75}, - {0x10a81, 0x10a83}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, {0x10a93, 0x10aa8}, - {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10abc, 0x10ac5}, {0x10ac7, 0x10ac9}, - {0x10acb, 0x10acd}, {0x10ae0, 0x10ae3}, {0x10ae6, 0x10af1}, {0x10af9, 0x10aff}, - {0x10b01, 0x10b03}, {0x10b05, 0x10b0c}, {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, - {0x10b35, 0x10b39}, {0x10b3c, 0x10b44}, {0x10b4b, 0x10b4d}, {0x10b5f, 0x10b63}, - {0x10b66, 0x10b77}, {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, - {0x10ba8, 0x10baa}, {0x10bae, 0x10bb9}, {0x10bbe, 0x10bc2}, {0x10bc6, 0x10bc8}, - {0x10bca, 0x10bcd}, {0x10be6, 0x10bfa}, {0x10c00, 0x10c03}, {0x10c05, 0x10c0c}, - {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, {0x10c2a, 0x10c39}, {0x10c3d, 0x10c44}, - {0x10c46, 0x10c48}, {0x10c4a, 0x10c4d}, {0x10c58, 0x10c5a}, {0x10c60, 0x10c63}, - {0x10c66, 0x10c6f}, {0x10c78, 0x10c83}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, - {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10cbc, 0x10cc4}, - {0x10cc6, 0x10cc8}, {0x10cca, 0x10ccd}, {0x10ce0, 0x10ce3}, {0x10ce6, 0x10cef}, - {0x10d00, 0x10d03}, {0x10d05, 0x10d0c}, {0x10d0e, 0x10d10}, {0x10d12, 0x10d44}, - {0x10d46, 0x10d48}, {0x10d4a, 0x10d4f}, {0x10d54, 0x10d63}, {0x10d66, 0x10d7f}, - {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, {0x10dc0, 0x10dc6}, - {0x10dcf, 0x10dd4}, {0x10dd8, 0x10ddf}, {0x10de6, 0x10def}, {0x10df2, 0x10df4}, - {0x10e01, 0x10e3a}, {0x10e3f, 0x10e5b}, {0x10e94, 0x10e97}, {0x10e99, 0x10e9f}, - {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb9}, {0x10ebb, 0x10ebd}, {0x10ec0, 0x10ec4}, - {0x10ec8, 0x10ecd}, {0x10ed0, 0x10ed9}, {0x10edc, 0x10edf}, {0x10f00, 0x10f47}, - {0x10f49, 0x10f6c}, {0x10f71, 0x10f97}, {0x10f99, 0x10fbc}, {0x10fbe, 0x10fcc}, - {0x10fce, 0x10fda}, {0x11000, 0x110c5}, {0x110d0, 0x11248}, {0x1124a, 0x1124d}, - {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, {0x1128a, 0x1128d}, - {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, {0x112c2, 0x112c5}, - {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, {0x11318, 0x1135a}, - {0x1135d, 0x1137c}, {0x11380, 0x11399}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, - {0x11400, 0x1167f}, {0x11681, 0x1169c}, {0x116a0, 0x116f8}, {0x11700, 0x1170c}, - {0x1170e, 0x11714}, {0x11720, 0x11736}, {0x11740, 0x11753}, {0x11760, 0x1176c}, - {0x1176e, 0x11770}, {0x11780, 0x117dd}, {0x117e0, 0x117e9}, {0x117f0, 0x117f9}, - {0x11800, 0x1180d}, {0x11810, 0x11819}, {0x11820, 0x11877}, {0x11880, 0x118aa}, - {0x118b0, 0x118f5}, {0x11900, 0x1191e}, {0x11920, 0x1192b}, {0x11930, 0x1193b}, - {0x11944, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, {0x119b0, 0x119c9}, - {0x119d0, 0x119da}, {0x119de, 0x11a1b}, {0x11a1e, 0x11a5e}, {0x11a60, 0x11a7c}, - {0x11a7f, 0x11a89}, {0x11a90, 0x11a99}, {0x11aa0, 0x11aad}, {0x11ab0, 0x11abe}, - {0x11b00, 0x11b4b}, {0x11b50, 0x11b7c}, {0x11b80, 0x11bf3}, {0x11bfc, 0x11c37}, - {0x11c3b, 0x11c49}, {0x11c4d, 0x11c88}, {0x11cc0, 0x11cc7}, {0x11cd0, 0x11cf9}, - {0x11d00, 0x11df9}, {0x11dfb, 0x11f15}, {0x11f18, 0x11f1d}, {0x11f20, 0x11f45}, - {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, {0x11f80, 0x11fb4}, - {0x11fb6, 0x11fc4}, {0x11fc6, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fdd, 0x11fef}, - {0x11ff2, 0x11ff4}, {0x11ff6, 0x11ffe}, {0x12010, 0x12027}, {0x12030, 0x1205e}, - {0x12074, 0x1208e}, {0x12090, 0x1209c}, {0x120a0, 0x120bf}, {0x120d0, 0x120f0}, - {0x12100, 0x1218b}, {0x12190, 0x12426}, {0x12440, 0x1244a}, {0x12460, 0x12b73}, - {0x12b76, 0x12b95}, {0x12b98, 0x12bb9}, {0x12bbd, 0x12bc8}, {0x12bca, 0x12bd2}, - {0x12bec, 0x12bef}, {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12cf3}, - {0x12cf9, 0x12d25}, {0x12d30, 0x12d67}, {0x12d7f, 0x12d96}, {0x12da0, 0x12da6}, - {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, - {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x12de0, 0x12e49}, - {0x12e80, 0x12e99}, {0x12e9b, 0x12ef3}, {0x12f00, 0x12fd5}, {0x12ff0, 0x12ffb}, - {0x13001, 0x1303f}, {0x13041, 0x13096}, {0x13099, 0x130ff}, {0x13105, 0x1312e}, - {0x13131, 0x1318e}, {0x13190, 0x131ba}, {0x131c0, 0x131e3}, {0x131f0, 0x1321e}, - {0x13220, 0x132fe}, {0x13300, 0x14db5}, {0x14dc0, 0x19fea}, {0x1a000, 0x1a48c}, - {0x1a490, 0x1a4c6}, {0x1a4d0, 0x1a62b}, {0x1a640, 0x1a6f7}, {0x1a700, 0x1a7ae}, - {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a82b}, {0x1a830, 0x1a839}, {0x1a840, 0x1a877}, - {0x1a880, 0x1a8c5}, {0x1a8ce, 0x1a8d9}, {0x1a8e0, 0x1a8fd}, {0x1a900, 0x1a953}, - {0x1a95f, 0x1a97c}, {0x1a980, 0x1a9cd}, {0x1a9cf, 0x1a9d9}, {0x1a9de, 0x1a9fe}, - {0x1aa00, 0x1aa36}, {0x1aa40, 0x1aa4d}, {0x1aa50, 0x1aa59}, {0x1aa5c, 0x1aac2}, - {0x1aadb, 0x1aaf6}, {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, - {0x1ab20, 0x1ab26}, {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab65}, {0x1ab70, 0x1abed}, - {0x1abf0, 0x1abf9}, {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, - {0x1f900, 0x1fa6d}, {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, - {0x1fb1d, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbc1}, {0x1fbd3, 0x1fd3f}, - {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfd}, {0x1fe00, 0x1fe19}, - {0x1fe20, 0x1fe52}, {0x1fe54, 0x1fe66}, {0x1fe68, 0x1fe6b}, {0x1fe70, 0x1fe74}, - {0x1fe76, 0x1fefc}, {0x1ff01, 0x1ffbe}, {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, - {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, {0x1ffe0, 0x1ffe6}, {0x1ffe8, 0x1ffee}, - {0x20021, 0x2007e}, {0x200a1, 0x200ac}, {0x200ae, 0x20377}, {0x2037a, 0x2037f}, - {0x20384, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x2052f}, {0x20531, 0x20556}, - {0x20559, 0x2055f}, {0x20561, 0x20587}, {0x2058d, 0x2058f}, {0x20591, 0x205c7}, - {0x205d0, 0x205ea}, {0x205f0, 0x205f4}, {0x20606, 0x2061b}, {0x2061e, 0x206dc}, - {0x206de, 0x2070d}, {0x20710, 0x2074a}, {0x2074d, 0x207b1}, {0x207c0, 0x207fa}, - {0x20800, 0x2082d}, {0x20830, 0x2083e}, {0x20840, 0x2085b}, {0x20860, 0x2086a}, - {0x208a0, 0x208b4}, {0x208b6, 0x208bd}, {0x208d4, 0x208e1}, {0x208e3, 0x20983}, - {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, - {0x209bc, 0x209c4}, {0x209cb, 0x209ce}, {0x209df, 0x209e3}, {0x209e6, 0x209fd}, - {0x20a01, 0x20a03}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, - {0x20a3e, 0x20a42}, {0x20a4b, 0x20a4d}, {0x20a59, 0x20a5c}, {0x20a66, 0x20a75}, - {0x20a81, 0x20a83}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, {0x20a93, 0x20aa8}, - {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20abc, 0x20ac5}, {0x20ac7, 0x20ac9}, - {0x20acb, 0x20acd}, {0x20ae0, 0x20ae3}, {0x20ae6, 0x20af1}, {0x20af9, 0x20aff}, - {0x20b01, 0x20b03}, {0x20b05, 0x20b0c}, {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, - {0x20b35, 0x20b39}, {0x20b3c, 0x20b44}, {0x20b4b, 0x20b4d}, {0x20b5f, 0x20b63}, - {0x20b66, 0x20b77}, {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, - {0x20ba8, 0x20baa}, {0x20bae, 0x20bb9}, {0x20bbe, 0x20bc2}, {0x20bc6, 0x20bc8}, - {0x20bca, 0x20bcd}, {0x20be6, 0x20bfa}, {0x20c00, 0x20c03}, {0x20c05, 0x20c0c}, - {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, {0x20c2a, 0x20c39}, {0x20c3d, 0x20c44}, - {0x20c46, 0x20c48}, {0x20c4a, 0x20c4d}, {0x20c58, 0x20c5a}, {0x20c60, 0x20c63}, - {0x20c66, 0x20c6f}, {0x20c78, 0x20c83}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, - {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20cbc, 0x20cc4}, - {0x20cc6, 0x20cc8}, {0x20cca, 0x20ccd}, {0x20ce0, 0x20ce3}, {0x20ce6, 0x20cef}, - {0x20d00, 0x20d03}, {0x20d05, 0x20d0c}, {0x20d0e, 0x20d10}, {0x20d12, 0x20d44}, - {0x20d46, 0x20d48}, {0x20d4a, 0x20d4f}, {0x20d54, 0x20d63}, {0x20d66, 0x20d7f}, - {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, {0x20dc0, 0x20dc6}, - {0x20dcf, 0x20dd4}, {0x20dd8, 0x20ddf}, {0x20de6, 0x20def}, {0x20df2, 0x20df4}, - {0x20e01, 0x20e3a}, {0x20e3f, 0x20e5b}, {0x20e94, 0x20e97}, {0x20e99, 0x20e9f}, - {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb9}, {0x20ebb, 0x20ebd}, {0x20ec0, 0x20ec4}, - {0x20ec8, 0x20ecd}, {0x20ed0, 0x20ed9}, {0x20edc, 0x20edf}, {0x20f00, 0x20f47}, - {0x20f49, 0x20f6c}, {0x20f71, 0x20f97}, {0x20f99, 0x20fbc}, {0x20fbe, 0x20fcc}, - {0x20fce, 0x20fda}, {0x21000, 0x210c5}, {0x210d0, 0x21248}, {0x2124a, 0x2124d}, - {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, {0x2128a, 0x2128d}, - {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, {0x212c2, 0x212c5}, - {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, {0x21318, 0x2135a}, - {0x2135d, 0x2137c}, {0x21380, 0x21399}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, - {0x21400, 0x2167f}, {0x21681, 0x2169c}, {0x216a0, 0x216f8}, {0x21700, 0x2170c}, - {0x2170e, 0x21714}, {0x21720, 0x21736}, {0x21740, 0x21753}, {0x21760, 0x2176c}, - {0x2176e, 0x21770}, {0x21780, 0x217dd}, {0x217e0, 0x217e9}, {0x217f0, 0x217f9}, - {0x21800, 0x2180d}, {0x21810, 0x21819}, {0x21820, 0x21877}, {0x21880, 0x218aa}, - {0x218b0, 0x218f5}, {0x21900, 0x2191e}, {0x21920, 0x2192b}, {0x21930, 0x2193b}, - {0x21944, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, {0x219b0, 0x219c9}, - {0x219d0, 0x219da}, {0x219de, 0x21a1b}, {0x21a1e, 0x21a5e}, {0x21a60, 0x21a7c}, - {0x21a7f, 0x21a89}, {0x21a90, 0x21a99}, {0x21aa0, 0x21aad}, {0x21ab0, 0x21abe}, - {0x21b00, 0x21b4b}, {0x21b50, 0x21b7c}, {0x21b80, 0x21bf3}, {0x21bfc, 0x21c37}, - {0x21c3b, 0x21c49}, {0x21c4d, 0x21c88}, {0x21cc0, 0x21cc7}, {0x21cd0, 0x21cf9}, - {0x21d00, 0x21df9}, {0x21dfb, 0x21f15}, {0x21f18, 0x21f1d}, {0x21f20, 0x21f45}, - {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, {0x21f80, 0x21fb4}, - {0x21fb6, 0x21fc4}, {0x21fc6, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fdd, 0x21fef}, - {0x21ff2, 0x21ff4}, {0x21ff6, 0x21ffe}, {0x22010, 0x22027}, {0x22030, 0x2205e}, - {0x22074, 0x2208e}, {0x22090, 0x2209c}, {0x220a0, 0x220bf}, {0x220d0, 0x220f0}, - {0x22100, 0x2218b}, {0x22190, 0x22426}, {0x22440, 0x2244a}, {0x22460, 0x22b73}, - {0x22b76, 0x22b95}, {0x22b98, 0x22bb9}, {0x22bbd, 0x22bc8}, {0x22bca, 0x22bd2}, - {0x22bec, 0x22bef}, {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22cf3}, - {0x22cf9, 0x22d25}, {0x22d30, 0x22d67}, {0x22d7f, 0x22d96}, {0x22da0, 0x22da6}, - {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, - {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x22de0, 0x22e49}, - {0x22e80, 0x22e99}, {0x22e9b, 0x22ef3}, {0x22f00, 0x22fd5}, {0x22ff0, 0x22ffb}, - {0x23001, 0x2303f}, {0x23041, 0x23096}, {0x23099, 0x230ff}, {0x23105, 0x2312e}, - {0x23131, 0x2318e}, {0x23190, 0x231ba}, {0x231c0, 0x231e3}, {0x231f0, 0x2321e}, - {0x23220, 0x232fe}, {0x23300, 0x24db5}, {0x24dc0, 0x29fea}, {0x2a000, 0x2a48c}, - {0x2a490, 0x2a4c6}, {0x2a4d0, 0x2a62b}, {0x2a640, 0x2a6f7}, {0x2a700, 0x2a7ae}, - {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a82b}, {0x2a830, 0x2a839}, {0x2a840, 0x2a877}, - {0x2a880, 0x2a8c5}, {0x2a8ce, 0x2a8d9}, {0x2a8e0, 0x2a8fd}, {0x2a900, 0x2a953}, - {0x2a95f, 0x2a97c}, {0x2a980, 0x2a9cd}, {0x2a9cf, 0x2a9d9}, {0x2a9de, 0x2a9fe}, - {0x2aa00, 0x2aa36}, {0x2aa40, 0x2aa4d}, {0x2aa50, 0x2aa59}, {0x2aa5c, 0x2aac2}, - {0x2aadb, 0x2aaf6}, {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, - {0x2ab20, 0x2ab26}, {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab65}, {0x2ab70, 0x2abed}, - {0x2abf0, 0x2abf9}, {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, - {0x2f900, 0x2fa6d}, {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, - {0x2fb1d, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbc1}, {0x2fbd3, 0x2fd3f}, - {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfd}, {0x2fe00, 0x2fe19}, - {0x2fe20, 0x2fe52}, {0x2fe54, 0x2fe66}, {0x2fe68, 0x2fe6b}, {0x2fe70, 0x2fe74}, - {0x2fe76, 0x2fefc}, {0x2ff01, 0x2ffbe}, {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, - {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, {0x2ffe0, 0x2ffe6}, {0x2ffe8, 0x2ffee}, - {0x30021, 0x3007e}, {0x300a1, 0x300ac}, {0x300ae, 0x30377}, {0x3037a, 0x3037f}, - {0x30384, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x3052f}, {0x30531, 0x30556}, - {0x30559, 0x3055f}, {0x30561, 0x30587}, {0x3058d, 0x3058f}, {0x30591, 0x305c7}, - {0x305d0, 0x305ea}, {0x305f0, 0x305f4}, {0x30606, 0x3061b}, {0x3061e, 0x306dc}, - {0x306de, 0x3070d}, {0x30710, 0x3074a}, {0x3074d, 0x307b1}, {0x307c0, 0x307fa}, - {0x30800, 0x3082d}, {0x30830, 0x3083e}, {0x30840, 0x3085b}, {0x30860, 0x3086a}, - {0x308a0, 0x308b4}, {0x308b6, 0x308bd}, {0x308d4, 0x308e1}, {0x308e3, 0x30983}, - {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, - {0x309bc, 0x309c4}, {0x309cb, 0x309ce}, {0x309df, 0x309e3}, {0x309e6, 0x309fd}, - {0x30a01, 0x30a03}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, - {0x30a3e, 0x30a42}, {0x30a4b, 0x30a4d}, {0x30a59, 0x30a5c}, {0x30a66, 0x30a75}, - {0x30a81, 0x30a83}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, {0x30a93, 0x30aa8}, - {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30abc, 0x30ac5}, {0x30ac7, 0x30ac9}, - {0x30acb, 0x30acd}, {0x30ae0, 0x30ae3}, {0x30ae6, 0x30af1}, {0x30af9, 0x30aff}, - {0x30b01, 0x30b03}, {0x30b05, 0x30b0c}, {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, - {0x30b35, 0x30b39}, {0x30b3c, 0x30b44}, {0x30b4b, 0x30b4d}, {0x30b5f, 0x30b63}, - {0x30b66, 0x30b77}, {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, - {0x30ba8, 0x30baa}, {0x30bae, 0x30bb9}, {0x30bbe, 0x30bc2}, {0x30bc6, 0x30bc8}, - {0x30bca, 0x30bcd}, {0x30be6, 0x30bfa}, {0x30c00, 0x30c03}, {0x30c05, 0x30c0c}, - {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, {0x30c2a, 0x30c39}, {0x30c3d, 0x30c44}, - {0x30c46, 0x30c48}, {0x30c4a, 0x30c4d}, {0x30c58, 0x30c5a}, {0x30c60, 0x30c63}, - {0x30c66, 0x30c6f}, {0x30c78, 0x30c83}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, - {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30cbc, 0x30cc4}, - {0x30cc6, 0x30cc8}, {0x30cca, 0x30ccd}, {0x30ce0, 0x30ce3}, {0x30ce6, 0x30cef}, - {0x30d00, 0x30d03}, {0x30d05, 0x30d0c}, {0x30d0e, 0x30d10}, {0x30d12, 0x30d44}, - {0x30d46, 0x30d48}, {0x30d4a, 0x30d4f}, {0x30d54, 0x30d63}, {0x30d66, 0x30d7f}, - {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, {0x30dc0, 0x30dc6}, - {0x30dcf, 0x30dd4}, {0x30dd8, 0x30ddf}, {0x30de6, 0x30def}, {0x30df2, 0x30df4}, - {0x30e01, 0x30e3a}, {0x30e3f, 0x30e5b}, {0x30e94, 0x30e97}, {0x30e99, 0x30e9f}, - {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb9}, {0x30ebb, 0x30ebd}, {0x30ec0, 0x30ec4}, - {0x30ec8, 0x30ecd}, {0x30ed0, 0x30ed9}, {0x30edc, 0x30edf}, {0x30f00, 0x30f47}, - {0x30f49, 0x30f6c}, {0x30f71, 0x30f97}, {0x30f99, 0x30fbc}, {0x30fbe, 0x30fcc}, - {0x30fce, 0x30fda}, {0x31000, 0x310c5}, {0x310d0, 0x31248}, {0x3124a, 0x3124d}, - {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, {0x3128a, 0x3128d}, - {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, {0x312c2, 0x312c5}, - {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, {0x31318, 0x3135a}, - {0x3135d, 0x3137c}, {0x31380, 0x31399}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, - {0x31400, 0x3167f}, {0x31681, 0x3169c}, {0x316a0, 0x316f8}, {0x31700, 0x3170c}, - {0x3170e, 0x31714}, {0x31720, 0x31736}, {0x31740, 0x31753}, {0x31760, 0x3176c}, - {0x3176e, 0x31770}, {0x31780, 0x317dd}, {0x317e0, 0x317e9}, {0x317f0, 0x317f9}, - {0x31800, 0x3180d}, {0x31810, 0x31819}, {0x31820, 0x31877}, {0x31880, 0x318aa}, - {0x318b0, 0x318f5}, {0x31900, 0x3191e}, {0x31920, 0x3192b}, {0x31930, 0x3193b}, - {0x31944, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, {0x319b0, 0x319c9}, - {0x319d0, 0x319da}, {0x319de, 0x31a1b}, {0x31a1e, 0x31a5e}, {0x31a60, 0x31a7c}, - {0x31a7f, 0x31a89}, {0x31a90, 0x31a99}, {0x31aa0, 0x31aad}, {0x31ab0, 0x31abe}, - {0x31b00, 0x31b4b}, {0x31b50, 0x31b7c}, {0x31b80, 0x31bf3}, {0x31bfc, 0x31c37}, - {0x31c3b, 0x31c49}, {0x31c4d, 0x31c88}, {0x31cc0, 0x31cc7}, {0x31cd0, 0x31cf9}, - {0x31d00, 0x31df9}, {0x31dfb, 0x31f15}, {0x31f18, 0x31f1d}, {0x31f20, 0x31f45}, - {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, {0x31f80, 0x31fb4}, - {0x31fb6, 0x31fc4}, {0x31fc6, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fdd, 0x31fef}, - {0x31ff2, 0x31ff4}, {0x31ff6, 0x31ffe}, {0x32010, 0x32027}, {0x32030, 0x3205e}, - {0x32074, 0x3208e}, {0x32090, 0x3209c}, {0x320a0, 0x320bf}, {0x320d0, 0x320f0}, - {0x32100, 0x3218b}, {0x32190, 0x32426}, {0x32440, 0x3244a}, {0x32460, 0x32b73}, - {0x32b76, 0x32b95}, {0x32b98, 0x32bb9}, {0x32bbd, 0x32bc8}, {0x32bca, 0x32bd2}, - {0x32bec, 0x32bef}, {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32cf3}, - {0x32cf9, 0x32d25}, {0x32d30, 0x32d67}, {0x32d7f, 0x32d96}, {0x32da0, 0x32da6}, - {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, - {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x32de0, 0x32e49}, - {0x32e80, 0x32e99}, {0x32e9b, 0x32ef3}, {0x32f00, 0x32fd5}, {0x32ff0, 0x32ffb}, - {0x33001, 0x3303f}, {0x33041, 0x33096}, {0x33099, 0x330ff}, {0x33105, 0x3312e}, - {0x33131, 0x3318e}, {0x33190, 0x331ba}, {0x331c0, 0x331e3}, {0x331f0, 0x3321e}, - {0x33220, 0x332fe}, {0x33300, 0x34db5}, {0x34dc0, 0x39fea}, {0x3a000, 0x3a48c}, - {0x3a490, 0x3a4c6}, {0x3a4d0, 0x3a62b}, {0x3a640, 0x3a6f7}, {0x3a700, 0x3a7ae}, - {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a82b}, {0x3a830, 0x3a839}, {0x3a840, 0x3a877}, - {0x3a880, 0x3a8c5}, {0x3a8ce, 0x3a8d9}, {0x3a8e0, 0x3a8fd}, {0x3a900, 0x3a953}, - {0x3a95f, 0x3a97c}, {0x3a980, 0x3a9cd}, {0x3a9cf, 0x3a9d9}, {0x3a9de, 0x3a9fe}, - {0x3aa00, 0x3aa36}, {0x3aa40, 0x3aa4d}, {0x3aa50, 0x3aa59}, {0x3aa5c, 0x3aac2}, - {0x3aadb, 0x3aaf6}, {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, - {0x3ab20, 0x3ab26}, {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab65}, {0x3ab70, 0x3abed}, - {0x3abf0, 0x3abf9}, {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, - {0x3f900, 0x3fa6d}, {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, - {0x3fb1d, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbc1}, {0x3fbd3, 0x3fd3f}, - {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfd}, {0x3fe00, 0x3fe19}, - {0x3fe20, 0x3fe52}, {0x3fe54, 0x3fe66}, {0x3fe68, 0x3fe6b}, {0x3fe70, 0x3fe74}, - {0x3fe76, 0x3fefc}, {0x3ff01, 0x3ffbe}, {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, - {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, {0x3ffe0, 0x3ffe6}, {0x3ffe8, 0x3ffee}, - {0x40021, 0x4007e}, {0x400a1, 0x400ac}, {0x400ae, 0x40377}, {0x4037a, 0x4037f}, - {0x40384, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x4052f}, {0x40531, 0x40556}, - {0x40559, 0x4055f}, {0x40561, 0x40587}, {0x4058d, 0x4058f}, {0x40591, 0x405c7}, - {0x405d0, 0x405ea}, {0x405f0, 0x405f4}, {0x40606, 0x4061b}, {0x4061e, 0x406dc}, - {0x406de, 0x4070d}, {0x40710, 0x4074a}, {0x4074d, 0x407b1}, {0x407c0, 0x407fa}, - {0x40800, 0x4082d}, {0x40830, 0x4083e}, {0x40840, 0x4085b}, {0x40860, 0x4086a}, - {0x408a0, 0x408b4}, {0x408b6, 0x408bd}, {0x408d4, 0x408e1}, {0x408e3, 0x40983}, - {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, - {0x409bc, 0x409c4}, {0x409cb, 0x409ce}, {0x409df, 0x409e3}, {0x409e6, 0x409fd}, - {0x40a01, 0x40a03}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, - {0x40a3e, 0x40a42}, {0x40a4b, 0x40a4d}, {0x40a59, 0x40a5c}, {0x40a66, 0x40a75}, - {0x40a81, 0x40a83}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, {0x40a93, 0x40aa8}, - {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40abc, 0x40ac5}, {0x40ac7, 0x40ac9}, - {0x40acb, 0x40acd}, {0x40ae0, 0x40ae3}, {0x40ae6, 0x40af1}, {0x40af9, 0x40aff}, - {0x40b01, 0x40b03}, {0x40b05, 0x40b0c}, {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, - {0x40b35, 0x40b39}, {0x40b3c, 0x40b44}, {0x40b4b, 0x40b4d}, {0x40b5f, 0x40b63}, - {0x40b66, 0x40b77}, {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, - {0x40ba8, 0x40baa}, {0x40bae, 0x40bb9}, {0x40bbe, 0x40bc2}, {0x40bc6, 0x40bc8}, - {0x40bca, 0x40bcd}, {0x40be6, 0x40bfa}, {0x40c00, 0x40c03}, {0x40c05, 0x40c0c}, - {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, {0x40c2a, 0x40c39}, {0x40c3d, 0x40c44}, - {0x40c46, 0x40c48}, {0x40c4a, 0x40c4d}, {0x40c58, 0x40c5a}, {0x40c60, 0x40c63}, - {0x40c66, 0x40c6f}, {0x40c78, 0x40c83}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, - {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40cbc, 0x40cc4}, - {0x40cc6, 0x40cc8}, {0x40cca, 0x40ccd}, {0x40ce0, 0x40ce3}, {0x40ce6, 0x40cef}, - {0x40d00, 0x40d03}, {0x40d05, 0x40d0c}, {0x40d0e, 0x40d10}, {0x40d12, 0x40d44}, - {0x40d46, 0x40d48}, {0x40d4a, 0x40d4f}, {0x40d54, 0x40d63}, {0x40d66, 0x40d7f}, - {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, {0x40dc0, 0x40dc6}, - {0x40dcf, 0x40dd4}, {0x40dd8, 0x40ddf}, {0x40de6, 0x40def}, {0x40df2, 0x40df4}, - {0x40e01, 0x40e3a}, {0x40e3f, 0x40e5b}, {0x40e94, 0x40e97}, {0x40e99, 0x40e9f}, - {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb9}, {0x40ebb, 0x40ebd}, {0x40ec0, 0x40ec4}, - {0x40ec8, 0x40ecd}, {0x40ed0, 0x40ed9}, {0x40edc, 0x40edf}, {0x40f00, 0x40f47}, - {0x40f49, 0x40f6c}, {0x40f71, 0x40f97}, {0x40f99, 0x40fbc}, {0x40fbe, 0x40fcc}, - {0x40fce, 0x40fda}, {0x41000, 0x410c5}, {0x410d0, 0x41248}, {0x4124a, 0x4124d}, - {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, {0x4128a, 0x4128d}, - {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, {0x412c2, 0x412c5}, - {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, {0x41318, 0x4135a}, - {0x4135d, 0x4137c}, {0x41380, 0x41399}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, - {0x41400, 0x4167f}, {0x41681, 0x4169c}, {0x416a0, 0x416f8}, {0x41700, 0x4170c}, - {0x4170e, 0x41714}, {0x41720, 0x41736}, {0x41740, 0x41753}, {0x41760, 0x4176c}, - {0x4176e, 0x41770}, {0x41780, 0x417dd}, {0x417e0, 0x417e9}, {0x417f0, 0x417f9}, - {0x41800, 0x4180d}, {0x41810, 0x41819}, {0x41820, 0x41877}, {0x41880, 0x418aa}, - {0x418b0, 0x418f5}, {0x41900, 0x4191e}, {0x41920, 0x4192b}, {0x41930, 0x4193b}, - {0x41944, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, {0x419b0, 0x419c9}, - {0x419d0, 0x419da}, {0x419de, 0x41a1b}, {0x41a1e, 0x41a5e}, {0x41a60, 0x41a7c}, - {0x41a7f, 0x41a89}, {0x41a90, 0x41a99}, {0x41aa0, 0x41aad}, {0x41ab0, 0x41abe}, - {0x41b00, 0x41b4b}, {0x41b50, 0x41b7c}, {0x41b80, 0x41bf3}, {0x41bfc, 0x41c37}, - {0x41c3b, 0x41c49}, {0x41c4d, 0x41c88}, {0x41cc0, 0x41cc7}, {0x41cd0, 0x41cf9}, - {0x41d00, 0x41df9}, {0x41dfb, 0x41f15}, {0x41f18, 0x41f1d}, {0x41f20, 0x41f45}, - {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, {0x41f80, 0x41fb4}, - {0x41fb6, 0x41fc4}, {0x41fc6, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fdd, 0x41fef}, - {0x41ff2, 0x41ff4}, {0x41ff6, 0x41ffe}, {0x42010, 0x42027}, {0x42030, 0x4205e}, - {0x42074, 0x4208e}, {0x42090, 0x4209c}, {0x420a0, 0x420bf}, {0x420d0, 0x420f0}, - {0x42100, 0x4218b}, {0x42190, 0x42426}, {0x42440, 0x4244a}, {0x42460, 0x42b73}, - {0x42b76, 0x42b95}, {0x42b98, 0x42bb9}, {0x42bbd, 0x42bc8}, {0x42bca, 0x42bd2}, - {0x42bec, 0x42bef}, {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42cf3}, - {0x42cf9, 0x42d25}, {0x42d30, 0x42d67}, {0x42d7f, 0x42d96}, {0x42da0, 0x42da6}, - {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, - {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x42de0, 0x42e49}, - {0x42e80, 0x42e99}, {0x42e9b, 0x42ef3}, {0x42f00, 0x42fd5}, {0x42ff0, 0x42ffb}, - {0x43001, 0x4303f}, {0x43041, 0x43096}, {0x43099, 0x430ff}, {0x43105, 0x4312e}, - {0x43131, 0x4318e}, {0x43190, 0x431ba}, {0x431c0, 0x431e3}, {0x431f0, 0x4321e}, - {0x43220, 0x432fe}, {0x43300, 0x44db5}, {0x44dc0, 0x49fea}, {0x4a000, 0x4a48c}, - {0x4a490, 0x4a4c6}, {0x4a4d0, 0x4a62b}, {0x4a640, 0x4a6f7}, {0x4a700, 0x4a7ae}, - {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a82b}, {0x4a830, 0x4a839}, {0x4a840, 0x4a877}, - {0x4a880, 0x4a8c5}, {0x4a8ce, 0x4a8d9}, {0x4a8e0, 0x4a8fd}, {0x4a900, 0x4a953}, - {0x4a95f, 0x4a97c}, {0x4a980, 0x4a9cd}, {0x4a9cf, 0x4a9d9}, {0x4a9de, 0x4a9fe}, - {0x4aa00, 0x4aa36}, {0x4aa40, 0x4aa4d}, {0x4aa50, 0x4aa59}, {0x4aa5c, 0x4aac2}, - {0x4aadb, 0x4aaf6}, {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, - {0x4ab20, 0x4ab26}, {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab65}, {0x4ab70, 0x4abed}, - {0x4abf0, 0x4abf9}, {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, - {0x4f900, 0x4fa6d}, {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, - {0x4fb1d, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbc1}, {0x4fbd3, 0x4fd3f}, - {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfd}, {0x4fe00, 0x4fe19}, - {0x4fe20, 0x4fe52}, {0x4fe54, 0x4fe66}, {0x4fe68, 0x4fe6b}, {0x4fe70, 0x4fe74}, - {0x4fe76, 0x4fefc}, {0x4ff01, 0x4ffbe}, {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, - {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, {0x4ffe0, 0x4ffe6}, {0x4ffe8, 0x4ffee}, - {0x50021, 0x5007e}, {0x500a1, 0x500ac}, {0x500ae, 0x50377}, {0x5037a, 0x5037f}, - {0x50384, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x5052f}, {0x50531, 0x50556}, - {0x50559, 0x5055f}, {0x50561, 0x50587}, {0x5058d, 0x5058f}, {0x50591, 0x505c7}, - {0x505d0, 0x505ea}, {0x505f0, 0x505f4}, {0x50606, 0x5061b}, {0x5061e, 0x506dc}, - {0x506de, 0x5070d}, {0x50710, 0x5074a}, {0x5074d, 0x507b1}, {0x507c0, 0x507fa}, - {0x50800, 0x5082d}, {0x50830, 0x5083e}, {0x50840, 0x5085b}, {0x50860, 0x5086a}, - {0x508a0, 0x508b4}, {0x508b6, 0x508bd}, {0x508d4, 0x508e1}, {0x508e3, 0x50983}, - {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, - {0x509bc, 0x509c4}, {0x509cb, 0x509ce}, {0x509df, 0x509e3}, {0x509e6, 0x509fd}, - {0x50a01, 0x50a03}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, - {0x50a3e, 0x50a42}, {0x50a4b, 0x50a4d}, {0x50a59, 0x50a5c}, {0x50a66, 0x50a75}, - {0x50a81, 0x50a83}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, {0x50a93, 0x50aa8}, - {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50abc, 0x50ac5}, {0x50ac7, 0x50ac9}, - {0x50acb, 0x50acd}, {0x50ae0, 0x50ae3}, {0x50ae6, 0x50af1}, {0x50af9, 0x50aff}, - {0x50b01, 0x50b03}, {0x50b05, 0x50b0c}, {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, - {0x50b35, 0x50b39}, {0x50b3c, 0x50b44}, {0x50b4b, 0x50b4d}, {0x50b5f, 0x50b63}, - {0x50b66, 0x50b77}, {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, - {0x50ba8, 0x50baa}, {0x50bae, 0x50bb9}, {0x50bbe, 0x50bc2}, {0x50bc6, 0x50bc8}, - {0x50bca, 0x50bcd}, {0x50be6, 0x50bfa}, {0x50c00, 0x50c03}, {0x50c05, 0x50c0c}, - {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, {0x50c2a, 0x50c39}, {0x50c3d, 0x50c44}, - {0x50c46, 0x50c48}, {0x50c4a, 0x50c4d}, {0x50c58, 0x50c5a}, {0x50c60, 0x50c63}, - {0x50c66, 0x50c6f}, {0x50c78, 0x50c83}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, - {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50cbc, 0x50cc4}, - {0x50cc6, 0x50cc8}, {0x50cca, 0x50ccd}, {0x50ce0, 0x50ce3}, {0x50ce6, 0x50cef}, - {0x50d00, 0x50d03}, {0x50d05, 0x50d0c}, {0x50d0e, 0x50d10}, {0x50d12, 0x50d44}, - {0x50d46, 0x50d48}, {0x50d4a, 0x50d4f}, {0x50d54, 0x50d63}, {0x50d66, 0x50d7f}, - {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, {0x50dc0, 0x50dc6}, - {0x50dcf, 0x50dd4}, {0x50dd8, 0x50ddf}, {0x50de6, 0x50def}, {0x50df2, 0x50df4}, - {0x50e01, 0x50e3a}, {0x50e3f, 0x50e5b}, {0x50e94, 0x50e97}, {0x50e99, 0x50e9f}, - {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb9}, {0x50ebb, 0x50ebd}, {0x50ec0, 0x50ec4}, - {0x50ec8, 0x50ecd}, {0x50ed0, 0x50ed9}, {0x50edc, 0x50edf}, {0x50f00, 0x50f47}, - {0x50f49, 0x50f6c}, {0x50f71, 0x50f97}, {0x50f99, 0x50fbc}, {0x50fbe, 0x50fcc}, - {0x50fce, 0x50fda}, {0x51000, 0x510c5}, {0x510d0, 0x51248}, {0x5124a, 0x5124d}, - {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, {0x5128a, 0x5128d}, - {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, {0x512c2, 0x512c5}, - {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, {0x51318, 0x5135a}, - {0x5135d, 0x5137c}, {0x51380, 0x51399}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, - {0x51400, 0x5167f}, {0x51681, 0x5169c}, {0x516a0, 0x516f8}, {0x51700, 0x5170c}, - {0x5170e, 0x51714}, {0x51720, 0x51736}, {0x51740, 0x51753}, {0x51760, 0x5176c}, - {0x5176e, 0x51770}, {0x51780, 0x517dd}, {0x517e0, 0x517e9}, {0x517f0, 0x517f9}, - {0x51800, 0x5180d}, {0x51810, 0x51819}, {0x51820, 0x51877}, {0x51880, 0x518aa}, - {0x518b0, 0x518f5}, {0x51900, 0x5191e}, {0x51920, 0x5192b}, {0x51930, 0x5193b}, - {0x51944, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, {0x519b0, 0x519c9}, - {0x519d0, 0x519da}, {0x519de, 0x51a1b}, {0x51a1e, 0x51a5e}, {0x51a60, 0x51a7c}, - {0x51a7f, 0x51a89}, {0x51a90, 0x51a99}, {0x51aa0, 0x51aad}, {0x51ab0, 0x51abe}, - {0x51b00, 0x51b4b}, {0x51b50, 0x51b7c}, {0x51b80, 0x51bf3}, {0x51bfc, 0x51c37}, - {0x51c3b, 0x51c49}, {0x51c4d, 0x51c88}, {0x51cc0, 0x51cc7}, {0x51cd0, 0x51cf9}, - {0x51d00, 0x51df9}, {0x51dfb, 0x51f15}, {0x51f18, 0x51f1d}, {0x51f20, 0x51f45}, - {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, {0x51f80, 0x51fb4}, - {0x51fb6, 0x51fc4}, {0x51fc6, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fdd, 0x51fef}, - {0x51ff2, 0x51ff4}, {0x51ff6, 0x51ffe}, {0x52010, 0x52027}, {0x52030, 0x5205e}, - {0x52074, 0x5208e}, {0x52090, 0x5209c}, {0x520a0, 0x520bf}, {0x520d0, 0x520f0}, - {0x52100, 0x5218b}, {0x52190, 0x52426}, {0x52440, 0x5244a}, {0x52460, 0x52b73}, - {0x52b76, 0x52b95}, {0x52b98, 0x52bb9}, {0x52bbd, 0x52bc8}, {0x52bca, 0x52bd2}, - {0x52bec, 0x52bef}, {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52cf3}, - {0x52cf9, 0x52d25}, {0x52d30, 0x52d67}, {0x52d7f, 0x52d96}, {0x52da0, 0x52da6}, - {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, - {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x52de0, 0x52e49}, - {0x52e80, 0x52e99}, {0x52e9b, 0x52ef3}, {0x52f00, 0x52fd5}, {0x52ff0, 0x52ffb}, - {0x53001, 0x5303f}, {0x53041, 0x53096}, {0x53099, 0x530ff}, {0x53105, 0x5312e}, - {0x53131, 0x5318e}, {0x53190, 0x531ba}, {0x531c0, 0x531e3}, {0x531f0, 0x5321e}, - {0x53220, 0x532fe}, {0x53300, 0x54db5}, {0x54dc0, 0x59fea}, {0x5a000, 0x5a48c}, - {0x5a490, 0x5a4c6}, {0x5a4d0, 0x5a62b}, {0x5a640, 0x5a6f7}, {0x5a700, 0x5a7ae}, - {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a82b}, {0x5a830, 0x5a839}, {0x5a840, 0x5a877}, - {0x5a880, 0x5a8c5}, {0x5a8ce, 0x5a8d9}, {0x5a8e0, 0x5a8fd}, {0x5a900, 0x5a953}, - {0x5a95f, 0x5a97c}, {0x5a980, 0x5a9cd}, {0x5a9cf, 0x5a9d9}, {0x5a9de, 0x5a9fe}, - {0x5aa00, 0x5aa36}, {0x5aa40, 0x5aa4d}, {0x5aa50, 0x5aa59}, {0x5aa5c, 0x5aac2}, - {0x5aadb, 0x5aaf6}, {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, - {0x5ab20, 0x5ab26}, {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab65}, {0x5ab70, 0x5abed}, - {0x5abf0, 0x5abf9}, {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, - {0x5f900, 0x5fa6d}, {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, - {0x5fb1d, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbc1}, {0x5fbd3, 0x5fd3f}, - {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfd}, {0x5fe00, 0x5fe19}, - {0x5fe20, 0x5fe52}, {0x5fe54, 0x5fe66}, {0x5fe68, 0x5fe6b}, {0x5fe70, 0x5fe74}, - {0x5fe76, 0x5fefc}, {0x5ff01, 0x5ffbe}, {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, - {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, {0x5ffe0, 0x5ffe6}, {0x5ffe8, 0x5ffee}, - {0x60021, 0x6007e}, {0x600a1, 0x600ac}, {0x600ae, 0x60377}, {0x6037a, 0x6037f}, - {0x60384, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x6052f}, {0x60531, 0x60556}, - {0x60559, 0x6055f}, {0x60561, 0x60587}, {0x6058d, 0x6058f}, {0x60591, 0x605c7}, - {0x605d0, 0x605ea}, {0x605f0, 0x605f4}, {0x60606, 0x6061b}, {0x6061e, 0x606dc}, - {0x606de, 0x6070d}, {0x60710, 0x6074a}, {0x6074d, 0x607b1}, {0x607c0, 0x607fa}, - {0x60800, 0x6082d}, {0x60830, 0x6083e}, {0x60840, 0x6085b}, {0x60860, 0x6086a}, - {0x608a0, 0x608b4}, {0x608b6, 0x608bd}, {0x608d4, 0x608e1}, {0x608e3, 0x60983}, - {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, - {0x609bc, 0x609c4}, {0x609cb, 0x609ce}, {0x609df, 0x609e3}, {0x609e6, 0x609fd}, - {0x60a01, 0x60a03}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, - {0x60a3e, 0x60a42}, {0x60a4b, 0x60a4d}, {0x60a59, 0x60a5c}, {0x60a66, 0x60a75}, - {0x60a81, 0x60a83}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, {0x60a93, 0x60aa8}, - {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60abc, 0x60ac5}, {0x60ac7, 0x60ac9}, - {0x60acb, 0x60acd}, {0x60ae0, 0x60ae3}, {0x60ae6, 0x60af1}, {0x60af9, 0x60aff}, - {0x60b01, 0x60b03}, {0x60b05, 0x60b0c}, {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, - {0x60b35, 0x60b39}, {0x60b3c, 0x60b44}, {0x60b4b, 0x60b4d}, {0x60b5f, 0x60b63}, - {0x60b66, 0x60b77}, {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, - {0x60ba8, 0x60baa}, {0x60bae, 0x60bb9}, {0x60bbe, 0x60bc2}, {0x60bc6, 0x60bc8}, - {0x60bca, 0x60bcd}, {0x60be6, 0x60bfa}, {0x60c00, 0x60c03}, {0x60c05, 0x60c0c}, - {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, {0x60c2a, 0x60c39}, {0x60c3d, 0x60c44}, - {0x60c46, 0x60c48}, {0x60c4a, 0x60c4d}, {0x60c58, 0x60c5a}, {0x60c60, 0x60c63}, - {0x60c66, 0x60c6f}, {0x60c78, 0x60c83}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, - {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60cbc, 0x60cc4}, - {0x60cc6, 0x60cc8}, {0x60cca, 0x60ccd}, {0x60ce0, 0x60ce3}, {0x60ce6, 0x60cef}, - {0x60d00, 0x60d03}, {0x60d05, 0x60d0c}, {0x60d0e, 0x60d10}, {0x60d12, 0x60d44}, - {0x60d46, 0x60d48}, {0x60d4a, 0x60d4f}, {0x60d54, 0x60d63}, {0x60d66, 0x60d7f}, - {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, {0x60dc0, 0x60dc6}, - {0x60dcf, 0x60dd4}, {0x60dd8, 0x60ddf}, {0x60de6, 0x60def}, {0x60df2, 0x60df4}, - {0x60e01, 0x60e3a}, {0x60e3f, 0x60e5b}, {0x60e94, 0x60e97}, {0x60e99, 0x60e9f}, - {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb9}, {0x60ebb, 0x60ebd}, {0x60ec0, 0x60ec4}, - {0x60ec8, 0x60ecd}, {0x60ed0, 0x60ed9}, {0x60edc, 0x60edf}, {0x60f00, 0x60f47}, - {0x60f49, 0x60f6c}, {0x60f71, 0x60f97}, {0x60f99, 0x60fbc}, {0x60fbe, 0x60fcc}, - {0x60fce, 0x60fda}, {0x61000, 0x610c5}, {0x610d0, 0x61248}, {0x6124a, 0x6124d}, - {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, {0x6128a, 0x6128d}, - {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, {0x612c2, 0x612c5}, - {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, {0x61318, 0x6135a}, - {0x6135d, 0x6137c}, {0x61380, 0x61399}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, - {0x61400, 0x6167f}, {0x61681, 0x6169c}, {0x616a0, 0x616f8}, {0x61700, 0x6170c}, - {0x6170e, 0x61714}, {0x61720, 0x61736}, {0x61740, 0x61753}, {0x61760, 0x6176c}, - {0x6176e, 0x61770}, {0x61780, 0x617dd}, {0x617e0, 0x617e9}, {0x617f0, 0x617f9}, - {0x61800, 0x6180d}, {0x61810, 0x61819}, {0x61820, 0x61877}, {0x61880, 0x618aa}, - {0x618b0, 0x618f5}, {0x61900, 0x6191e}, {0x61920, 0x6192b}, {0x61930, 0x6193b}, - {0x61944, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, {0x619b0, 0x619c9}, - {0x619d0, 0x619da}, {0x619de, 0x61a1b}, {0x61a1e, 0x61a5e}, {0x61a60, 0x61a7c}, - {0x61a7f, 0x61a89}, {0x61a90, 0x61a99}, {0x61aa0, 0x61aad}, {0x61ab0, 0x61abe}, - {0x61b00, 0x61b4b}, {0x61b50, 0x61b7c}, {0x61b80, 0x61bf3}, {0x61bfc, 0x61c37}, - {0x61c3b, 0x61c49}, {0x61c4d, 0x61c88}, {0x61cc0, 0x61cc7}, {0x61cd0, 0x61cf9}, - {0x61d00, 0x61df9}, {0x61dfb, 0x61f15}, {0x61f18, 0x61f1d}, {0x61f20, 0x61f45}, - {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, {0x61f80, 0x61fb4}, - {0x61fb6, 0x61fc4}, {0x61fc6, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fdd, 0x61fef}, - {0x61ff2, 0x61ff4}, {0x61ff6, 0x61ffe}, {0x62010, 0x62027}, {0x62030, 0x6205e}, - {0x62074, 0x6208e}, {0x62090, 0x6209c}, {0x620a0, 0x620bf}, {0x620d0, 0x620f0}, - {0x62100, 0x6218b}, {0x62190, 0x62426}, {0x62440, 0x6244a}, {0x62460, 0x62b73}, - {0x62b76, 0x62b95}, {0x62b98, 0x62bb9}, {0x62bbd, 0x62bc8}, {0x62bca, 0x62bd2}, - {0x62bec, 0x62bef}, {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62cf3}, - {0x62cf9, 0x62d25}, {0x62d30, 0x62d67}, {0x62d7f, 0x62d96}, {0x62da0, 0x62da6}, - {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, - {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x62de0, 0x62e49}, - {0x62e80, 0x62e99}, {0x62e9b, 0x62ef3}, {0x62f00, 0x62fd5}, {0x62ff0, 0x62ffb}, - {0x63001, 0x6303f}, {0x63041, 0x63096}, {0x63099, 0x630ff}, {0x63105, 0x6312e}, - {0x63131, 0x6318e}, {0x63190, 0x631ba}, {0x631c0, 0x631e3}, {0x631f0, 0x6321e}, - {0x63220, 0x632fe}, {0x63300, 0x64db5}, {0x64dc0, 0x69fea}, {0x6a000, 0x6a48c}, - {0x6a490, 0x6a4c6}, {0x6a4d0, 0x6a62b}, {0x6a640, 0x6a6f7}, {0x6a700, 0x6a7ae}, - {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a82b}, {0x6a830, 0x6a839}, {0x6a840, 0x6a877}, - {0x6a880, 0x6a8c5}, {0x6a8ce, 0x6a8d9}, {0x6a8e0, 0x6a8fd}, {0x6a900, 0x6a953}, - {0x6a95f, 0x6a97c}, {0x6a980, 0x6a9cd}, {0x6a9cf, 0x6a9d9}, {0x6a9de, 0x6a9fe}, - {0x6aa00, 0x6aa36}, {0x6aa40, 0x6aa4d}, {0x6aa50, 0x6aa59}, {0x6aa5c, 0x6aac2}, - {0x6aadb, 0x6aaf6}, {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, - {0x6ab20, 0x6ab26}, {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab65}, {0x6ab70, 0x6abed}, - {0x6abf0, 0x6abf9}, {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, - {0x6f900, 0x6fa6d}, {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, - {0x6fb1d, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbc1}, {0x6fbd3, 0x6fd3f}, - {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfd}, {0x6fe00, 0x6fe19}, - {0x6fe20, 0x6fe52}, {0x6fe54, 0x6fe66}, {0x6fe68, 0x6fe6b}, {0x6fe70, 0x6fe74}, - {0x6fe76, 0x6fefc}, {0x6ff01, 0x6ffbe}, {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, - {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, {0x6ffe0, 0x6ffe6}, {0x6ffe8, 0x6ffee}, - {0x70021, 0x7007e}, {0x700a1, 0x700ac}, {0x700ae, 0x70377}, {0x7037a, 0x7037f}, - {0x70384, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x7052f}, {0x70531, 0x70556}, - {0x70559, 0x7055f}, {0x70561, 0x70587}, {0x7058d, 0x7058f}, {0x70591, 0x705c7}, - {0x705d0, 0x705ea}, {0x705f0, 0x705f4}, {0x70606, 0x7061b}, {0x7061e, 0x706dc}, - {0x706de, 0x7070d}, {0x70710, 0x7074a}, {0x7074d, 0x707b1}, {0x707c0, 0x707fa}, - {0x70800, 0x7082d}, {0x70830, 0x7083e}, {0x70840, 0x7085b}, {0x70860, 0x7086a}, - {0x708a0, 0x708b4}, {0x708b6, 0x708bd}, {0x708d4, 0x708e1}, {0x708e3, 0x70983}, - {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, - {0x709bc, 0x709c4}, {0x709cb, 0x709ce}, {0x709df, 0x709e3}, {0x709e6, 0x709fd}, - {0x70a01, 0x70a03}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, - {0x70a3e, 0x70a42}, {0x70a4b, 0x70a4d}, {0x70a59, 0x70a5c}, {0x70a66, 0x70a75}, - {0x70a81, 0x70a83}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, {0x70a93, 0x70aa8}, - {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70abc, 0x70ac5}, {0x70ac7, 0x70ac9}, - {0x70acb, 0x70acd}, {0x70ae0, 0x70ae3}, {0x70ae6, 0x70af1}, {0x70af9, 0x70aff}, - {0x70b01, 0x70b03}, {0x70b05, 0x70b0c}, {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, - {0x70b35, 0x70b39}, {0x70b3c, 0x70b44}, {0x70b4b, 0x70b4d}, {0x70b5f, 0x70b63}, - {0x70b66, 0x70b77}, {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, - {0x70ba8, 0x70baa}, {0x70bae, 0x70bb9}, {0x70bbe, 0x70bc2}, {0x70bc6, 0x70bc8}, - {0x70bca, 0x70bcd}, {0x70be6, 0x70bfa}, {0x70c00, 0x70c03}, {0x70c05, 0x70c0c}, - {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, {0x70c2a, 0x70c39}, {0x70c3d, 0x70c44}, - {0x70c46, 0x70c48}, {0x70c4a, 0x70c4d}, {0x70c58, 0x70c5a}, {0x70c60, 0x70c63}, - {0x70c66, 0x70c6f}, {0x70c78, 0x70c83}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, - {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70cbc, 0x70cc4}, - {0x70cc6, 0x70cc8}, {0x70cca, 0x70ccd}, {0x70ce0, 0x70ce3}, {0x70ce6, 0x70cef}, - {0x70d00, 0x70d03}, {0x70d05, 0x70d0c}, {0x70d0e, 0x70d10}, {0x70d12, 0x70d44}, - {0x70d46, 0x70d48}, {0x70d4a, 0x70d4f}, {0x70d54, 0x70d63}, {0x70d66, 0x70d7f}, - {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, {0x70dc0, 0x70dc6}, - {0x70dcf, 0x70dd4}, {0x70dd8, 0x70ddf}, {0x70de6, 0x70def}, {0x70df2, 0x70df4}, - {0x70e01, 0x70e3a}, {0x70e3f, 0x70e5b}, {0x70e94, 0x70e97}, {0x70e99, 0x70e9f}, - {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb9}, {0x70ebb, 0x70ebd}, {0x70ec0, 0x70ec4}, - {0x70ec8, 0x70ecd}, {0x70ed0, 0x70ed9}, {0x70edc, 0x70edf}, {0x70f00, 0x70f47}, - {0x70f49, 0x70f6c}, {0x70f71, 0x70f97}, {0x70f99, 0x70fbc}, {0x70fbe, 0x70fcc}, - {0x70fce, 0x70fda}, {0x71000, 0x710c5}, {0x710d0, 0x71248}, {0x7124a, 0x7124d}, - {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, {0x7128a, 0x7128d}, - {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, {0x712c2, 0x712c5}, - {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, {0x71318, 0x7135a}, - {0x7135d, 0x7137c}, {0x71380, 0x71399}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, - {0x71400, 0x7167f}, {0x71681, 0x7169c}, {0x716a0, 0x716f8}, {0x71700, 0x7170c}, - {0x7170e, 0x71714}, {0x71720, 0x71736}, {0x71740, 0x71753}, {0x71760, 0x7176c}, - {0x7176e, 0x71770}, {0x71780, 0x717dd}, {0x717e0, 0x717e9}, {0x717f0, 0x717f9}, - {0x71800, 0x7180d}, {0x71810, 0x71819}, {0x71820, 0x71877}, {0x71880, 0x718aa}, - {0x718b0, 0x718f5}, {0x71900, 0x7191e}, {0x71920, 0x7192b}, {0x71930, 0x7193b}, - {0x71944, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, {0x719b0, 0x719c9}, - {0x719d0, 0x719da}, {0x719de, 0x71a1b}, {0x71a1e, 0x71a5e}, {0x71a60, 0x71a7c}, - {0x71a7f, 0x71a89}, {0x71a90, 0x71a99}, {0x71aa0, 0x71aad}, {0x71ab0, 0x71abe}, - {0x71b00, 0x71b4b}, {0x71b50, 0x71b7c}, {0x71b80, 0x71bf3}, {0x71bfc, 0x71c37}, - {0x71c3b, 0x71c49}, {0x71c4d, 0x71c88}, {0x71cc0, 0x71cc7}, {0x71cd0, 0x71cf9}, - {0x71d00, 0x71df9}, {0x71dfb, 0x71f15}, {0x71f18, 0x71f1d}, {0x71f20, 0x71f45}, - {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, {0x71f80, 0x71fb4}, - {0x71fb6, 0x71fc4}, {0x71fc6, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fdd, 0x71fef}, - {0x71ff2, 0x71ff4}, {0x71ff6, 0x71ffe}, {0x72010, 0x72027}, {0x72030, 0x7205e}, - {0x72074, 0x7208e}, {0x72090, 0x7209c}, {0x720a0, 0x720bf}, {0x720d0, 0x720f0}, - {0x72100, 0x7218b}, {0x72190, 0x72426}, {0x72440, 0x7244a}, {0x72460, 0x72b73}, - {0x72b76, 0x72b95}, {0x72b98, 0x72bb9}, {0x72bbd, 0x72bc8}, {0x72bca, 0x72bd2}, - {0x72bec, 0x72bef}, {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72cf3}, - {0x72cf9, 0x72d25}, {0x72d30, 0x72d67}, {0x72d7f, 0x72d96}, {0x72da0, 0x72da6}, - {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, - {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x72de0, 0x72e49}, - {0x72e80, 0x72e99}, {0x72e9b, 0x72ef3}, {0x72f00, 0x72fd5}, {0x72ff0, 0x72ffb}, - {0x73001, 0x7303f}, {0x73041, 0x73096}, {0x73099, 0x730ff}, {0x73105, 0x7312e}, - {0x73131, 0x7318e}, {0x73190, 0x731ba}, {0x731c0, 0x731e3}, {0x731f0, 0x7321e}, - {0x73220, 0x732fe}, {0x73300, 0x74db5}, {0x74dc0, 0x79fea}, {0x7a000, 0x7a48c}, - {0x7a490, 0x7a4c6}, {0x7a4d0, 0x7a62b}, {0x7a640, 0x7a6f7}, {0x7a700, 0x7a7ae}, - {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a82b}, {0x7a830, 0x7a839}, {0x7a840, 0x7a877}, - {0x7a880, 0x7a8c5}, {0x7a8ce, 0x7a8d9}, {0x7a8e0, 0x7a8fd}, {0x7a900, 0x7a953}, - {0x7a95f, 0x7a97c}, {0x7a980, 0x7a9cd}, {0x7a9cf, 0x7a9d9}, {0x7a9de, 0x7a9fe}, - {0x7aa00, 0x7aa36}, {0x7aa40, 0x7aa4d}, {0x7aa50, 0x7aa59}, {0x7aa5c, 0x7aac2}, - {0x7aadb, 0x7aaf6}, {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, - {0x7ab20, 0x7ab26}, {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab65}, {0x7ab70, 0x7abed}, - {0x7abf0, 0x7abf9}, {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, - {0x7f900, 0x7fa6d}, {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, - {0x7fb1d, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbc1}, {0x7fbd3, 0x7fd3f}, - {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfd}, {0x7fe00, 0x7fe19}, - {0x7fe20, 0x7fe52}, {0x7fe54, 0x7fe66}, {0x7fe68, 0x7fe6b}, {0x7fe70, 0x7fe74}, - {0x7fe76, 0x7fefc}, {0x7ff01, 0x7ffbe}, {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, - {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, {0x7ffe0, 0x7ffe6}, {0x7ffe8, 0x7ffee}, - {0x80021, 0x8007e}, {0x800a1, 0x800ac}, {0x800ae, 0x80377}, {0x8037a, 0x8037f}, - {0x80384, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x8052f}, {0x80531, 0x80556}, - {0x80559, 0x8055f}, {0x80561, 0x80587}, {0x8058d, 0x8058f}, {0x80591, 0x805c7}, - {0x805d0, 0x805ea}, {0x805f0, 0x805f4}, {0x80606, 0x8061b}, {0x8061e, 0x806dc}, - {0x806de, 0x8070d}, {0x80710, 0x8074a}, {0x8074d, 0x807b1}, {0x807c0, 0x807fa}, - {0x80800, 0x8082d}, {0x80830, 0x8083e}, {0x80840, 0x8085b}, {0x80860, 0x8086a}, - {0x808a0, 0x808b4}, {0x808b6, 0x808bd}, {0x808d4, 0x808e1}, {0x808e3, 0x80983}, - {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, - {0x809bc, 0x809c4}, {0x809cb, 0x809ce}, {0x809df, 0x809e3}, {0x809e6, 0x809fd}, - {0x80a01, 0x80a03}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, - {0x80a3e, 0x80a42}, {0x80a4b, 0x80a4d}, {0x80a59, 0x80a5c}, {0x80a66, 0x80a75}, - {0x80a81, 0x80a83}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, {0x80a93, 0x80aa8}, - {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80abc, 0x80ac5}, {0x80ac7, 0x80ac9}, - {0x80acb, 0x80acd}, {0x80ae0, 0x80ae3}, {0x80ae6, 0x80af1}, {0x80af9, 0x80aff}, - {0x80b01, 0x80b03}, {0x80b05, 0x80b0c}, {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, - {0x80b35, 0x80b39}, {0x80b3c, 0x80b44}, {0x80b4b, 0x80b4d}, {0x80b5f, 0x80b63}, - {0x80b66, 0x80b77}, {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, - {0x80ba8, 0x80baa}, {0x80bae, 0x80bb9}, {0x80bbe, 0x80bc2}, {0x80bc6, 0x80bc8}, - {0x80bca, 0x80bcd}, {0x80be6, 0x80bfa}, {0x80c00, 0x80c03}, {0x80c05, 0x80c0c}, - {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, {0x80c2a, 0x80c39}, {0x80c3d, 0x80c44}, - {0x80c46, 0x80c48}, {0x80c4a, 0x80c4d}, {0x80c58, 0x80c5a}, {0x80c60, 0x80c63}, - {0x80c66, 0x80c6f}, {0x80c78, 0x80c83}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, - {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80cbc, 0x80cc4}, - {0x80cc6, 0x80cc8}, {0x80cca, 0x80ccd}, {0x80ce0, 0x80ce3}, {0x80ce6, 0x80cef}, - {0x80d00, 0x80d03}, {0x80d05, 0x80d0c}, {0x80d0e, 0x80d10}, {0x80d12, 0x80d44}, - {0x80d46, 0x80d48}, {0x80d4a, 0x80d4f}, {0x80d54, 0x80d63}, {0x80d66, 0x80d7f}, - {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, {0x80dc0, 0x80dc6}, - {0x80dcf, 0x80dd4}, {0x80dd8, 0x80ddf}, {0x80de6, 0x80def}, {0x80df2, 0x80df4}, - {0x80e01, 0x80e3a}, {0x80e3f, 0x80e5b}, {0x80e94, 0x80e97}, {0x80e99, 0x80e9f}, - {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb9}, {0x80ebb, 0x80ebd}, {0x80ec0, 0x80ec4}, - {0x80ec8, 0x80ecd}, {0x80ed0, 0x80ed9}, {0x80edc, 0x80edf}, {0x80f00, 0x80f47}, - {0x80f49, 0x80f6c}, {0x80f71, 0x80f97}, {0x80f99, 0x80fbc}, {0x80fbe, 0x80fcc}, - {0x80fce, 0x80fda}, {0x81000, 0x810c5}, {0x810d0, 0x81248}, {0x8124a, 0x8124d}, - {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, {0x8128a, 0x8128d}, - {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, {0x812c2, 0x812c5}, - {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, {0x81318, 0x8135a}, - {0x8135d, 0x8137c}, {0x81380, 0x81399}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, - {0x81400, 0x8167f}, {0x81681, 0x8169c}, {0x816a0, 0x816f8}, {0x81700, 0x8170c}, - {0x8170e, 0x81714}, {0x81720, 0x81736}, {0x81740, 0x81753}, {0x81760, 0x8176c}, - {0x8176e, 0x81770}, {0x81780, 0x817dd}, {0x817e0, 0x817e9}, {0x817f0, 0x817f9}, - {0x81800, 0x8180d}, {0x81810, 0x81819}, {0x81820, 0x81877}, {0x81880, 0x818aa}, - {0x818b0, 0x818f5}, {0x81900, 0x8191e}, {0x81920, 0x8192b}, {0x81930, 0x8193b}, - {0x81944, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, {0x819b0, 0x819c9}, - {0x819d0, 0x819da}, {0x819de, 0x81a1b}, {0x81a1e, 0x81a5e}, {0x81a60, 0x81a7c}, - {0x81a7f, 0x81a89}, {0x81a90, 0x81a99}, {0x81aa0, 0x81aad}, {0x81ab0, 0x81abe}, - {0x81b00, 0x81b4b}, {0x81b50, 0x81b7c}, {0x81b80, 0x81bf3}, {0x81bfc, 0x81c37}, - {0x81c3b, 0x81c49}, {0x81c4d, 0x81c88}, {0x81cc0, 0x81cc7}, {0x81cd0, 0x81cf9}, - {0x81d00, 0x81df9}, {0x81dfb, 0x81f15}, {0x81f18, 0x81f1d}, {0x81f20, 0x81f45}, - {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, {0x81f80, 0x81fb4}, - {0x81fb6, 0x81fc4}, {0x81fc6, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fdd, 0x81fef}, - {0x81ff2, 0x81ff4}, {0x81ff6, 0x81ffe}, {0x82010, 0x82027}, {0x82030, 0x8205e}, - {0x82074, 0x8208e}, {0x82090, 0x8209c}, {0x820a0, 0x820bf}, {0x820d0, 0x820f0}, - {0x82100, 0x8218b}, {0x82190, 0x82426}, {0x82440, 0x8244a}, {0x82460, 0x82b73}, - {0x82b76, 0x82b95}, {0x82b98, 0x82bb9}, {0x82bbd, 0x82bc8}, {0x82bca, 0x82bd2}, - {0x82bec, 0x82bef}, {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82cf3}, - {0x82cf9, 0x82d25}, {0x82d30, 0x82d67}, {0x82d7f, 0x82d96}, {0x82da0, 0x82da6}, - {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, - {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x82de0, 0x82e49}, - {0x82e80, 0x82e99}, {0x82e9b, 0x82ef3}, {0x82f00, 0x82fd5}, {0x82ff0, 0x82ffb}, - {0x83001, 0x8303f}, {0x83041, 0x83096}, {0x83099, 0x830ff}, {0x83105, 0x8312e}, - {0x83131, 0x8318e}, {0x83190, 0x831ba}, {0x831c0, 0x831e3}, {0x831f0, 0x8321e}, - {0x83220, 0x832fe}, {0x83300, 0x84db5}, {0x84dc0, 0x89fea}, {0x8a000, 0x8a48c}, - {0x8a490, 0x8a4c6}, {0x8a4d0, 0x8a62b}, {0x8a640, 0x8a6f7}, {0x8a700, 0x8a7ae}, - {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a82b}, {0x8a830, 0x8a839}, {0x8a840, 0x8a877}, - {0x8a880, 0x8a8c5}, {0x8a8ce, 0x8a8d9}, {0x8a8e0, 0x8a8fd}, {0x8a900, 0x8a953}, - {0x8a95f, 0x8a97c}, {0x8a980, 0x8a9cd}, {0x8a9cf, 0x8a9d9}, {0x8a9de, 0x8a9fe}, - {0x8aa00, 0x8aa36}, {0x8aa40, 0x8aa4d}, {0x8aa50, 0x8aa59}, {0x8aa5c, 0x8aac2}, - {0x8aadb, 0x8aaf6}, {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, - {0x8ab20, 0x8ab26}, {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab65}, {0x8ab70, 0x8abed}, - {0x8abf0, 0x8abf9}, {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, - {0x8f900, 0x8fa6d}, {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, - {0x8fb1d, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbc1}, {0x8fbd3, 0x8fd3f}, - {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfd}, {0x8fe00, 0x8fe19}, - {0x8fe20, 0x8fe52}, {0x8fe54, 0x8fe66}, {0x8fe68, 0x8fe6b}, {0x8fe70, 0x8fe74}, - {0x8fe76, 0x8fefc}, {0x8ff01, 0x8ffbe}, {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, - {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, {0x8ffe0, 0x8ffe6}, {0x8ffe8, 0x8ffee}, - {0x90021, 0x9007e}, {0x900a1, 0x900ac}, {0x900ae, 0x90377}, {0x9037a, 0x9037f}, - {0x90384, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x9052f}, {0x90531, 0x90556}, - {0x90559, 0x9055f}, {0x90561, 0x90587}, {0x9058d, 0x9058f}, {0x90591, 0x905c7}, - {0x905d0, 0x905ea}, {0x905f0, 0x905f4}, {0x90606, 0x9061b}, {0x9061e, 0x906dc}, - {0x906de, 0x9070d}, {0x90710, 0x9074a}, {0x9074d, 0x907b1}, {0x907c0, 0x907fa}, - {0x90800, 0x9082d}, {0x90830, 0x9083e}, {0x90840, 0x9085b}, {0x90860, 0x9086a}, - {0x908a0, 0x908b4}, {0x908b6, 0x908bd}, {0x908d4, 0x908e1}, {0x908e3, 0x90983}, - {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, - {0x909bc, 0x909c4}, {0x909cb, 0x909ce}, {0x909df, 0x909e3}, {0x909e6, 0x909fd}, - {0x90a01, 0x90a03}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, - {0x90a3e, 0x90a42}, {0x90a4b, 0x90a4d}, {0x90a59, 0x90a5c}, {0x90a66, 0x90a75}, - {0x90a81, 0x90a83}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, {0x90a93, 0x90aa8}, - {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90abc, 0x90ac5}, {0x90ac7, 0x90ac9}, - {0x90acb, 0x90acd}, {0x90ae0, 0x90ae3}, {0x90ae6, 0x90af1}, {0x90af9, 0x90aff}, - {0x90b01, 0x90b03}, {0x90b05, 0x90b0c}, {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, - {0x90b35, 0x90b39}, {0x90b3c, 0x90b44}, {0x90b4b, 0x90b4d}, {0x90b5f, 0x90b63}, - {0x90b66, 0x90b77}, {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, - {0x90ba8, 0x90baa}, {0x90bae, 0x90bb9}, {0x90bbe, 0x90bc2}, {0x90bc6, 0x90bc8}, - {0x90bca, 0x90bcd}, {0x90be6, 0x90bfa}, {0x90c00, 0x90c03}, {0x90c05, 0x90c0c}, - {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, {0x90c2a, 0x90c39}, {0x90c3d, 0x90c44}, - {0x90c46, 0x90c48}, {0x90c4a, 0x90c4d}, {0x90c58, 0x90c5a}, {0x90c60, 0x90c63}, - {0x90c66, 0x90c6f}, {0x90c78, 0x90c83}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, - {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90cbc, 0x90cc4}, - {0x90cc6, 0x90cc8}, {0x90cca, 0x90ccd}, {0x90ce0, 0x90ce3}, {0x90ce6, 0x90cef}, - {0x90d00, 0x90d03}, {0x90d05, 0x90d0c}, {0x90d0e, 0x90d10}, {0x90d12, 0x90d44}, - {0x90d46, 0x90d48}, {0x90d4a, 0x90d4f}, {0x90d54, 0x90d63}, {0x90d66, 0x90d7f}, - {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, {0x90dc0, 0x90dc6}, - {0x90dcf, 0x90dd4}, {0x90dd8, 0x90ddf}, {0x90de6, 0x90def}, {0x90df2, 0x90df4}, - {0x90e01, 0x90e3a}, {0x90e3f, 0x90e5b}, {0x90e94, 0x90e97}, {0x90e99, 0x90e9f}, - {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb9}, {0x90ebb, 0x90ebd}, {0x90ec0, 0x90ec4}, - {0x90ec8, 0x90ecd}, {0x90ed0, 0x90ed9}, {0x90edc, 0x90edf}, {0x90f00, 0x90f47}, - {0x90f49, 0x90f6c}, {0x90f71, 0x90f97}, {0x90f99, 0x90fbc}, {0x90fbe, 0x90fcc}, - {0x90fce, 0x90fda}, {0x91000, 0x910c5}, {0x910d0, 0x91248}, {0x9124a, 0x9124d}, - {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, {0x9128a, 0x9128d}, - {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, {0x912c2, 0x912c5}, - {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, {0x91318, 0x9135a}, - {0x9135d, 0x9137c}, {0x91380, 0x91399}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, - {0x91400, 0x9167f}, {0x91681, 0x9169c}, {0x916a0, 0x916f8}, {0x91700, 0x9170c}, - {0x9170e, 0x91714}, {0x91720, 0x91736}, {0x91740, 0x91753}, {0x91760, 0x9176c}, - {0x9176e, 0x91770}, {0x91780, 0x917dd}, {0x917e0, 0x917e9}, {0x917f0, 0x917f9}, - {0x91800, 0x9180d}, {0x91810, 0x91819}, {0x91820, 0x91877}, {0x91880, 0x918aa}, - {0x918b0, 0x918f5}, {0x91900, 0x9191e}, {0x91920, 0x9192b}, {0x91930, 0x9193b}, - {0x91944, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, {0x919b0, 0x919c9}, - {0x919d0, 0x919da}, {0x919de, 0x91a1b}, {0x91a1e, 0x91a5e}, {0x91a60, 0x91a7c}, - {0x91a7f, 0x91a89}, {0x91a90, 0x91a99}, {0x91aa0, 0x91aad}, {0x91ab0, 0x91abe}, - {0x91b00, 0x91b4b}, {0x91b50, 0x91b7c}, {0x91b80, 0x91bf3}, {0x91bfc, 0x91c37}, - {0x91c3b, 0x91c49}, {0x91c4d, 0x91c88}, {0x91cc0, 0x91cc7}, {0x91cd0, 0x91cf9}, - {0x91d00, 0x91df9}, {0x91dfb, 0x91f15}, {0x91f18, 0x91f1d}, {0x91f20, 0x91f45}, - {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, {0x91f80, 0x91fb4}, - {0x91fb6, 0x91fc4}, {0x91fc6, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fdd, 0x91fef}, - {0x91ff2, 0x91ff4}, {0x91ff6, 0x91ffe}, {0x92010, 0x92027}, {0x92030, 0x9205e}, - {0x92074, 0x9208e}, {0x92090, 0x9209c}, {0x920a0, 0x920bf}, {0x920d0, 0x920f0}, - {0x92100, 0x9218b}, {0x92190, 0x92426}, {0x92440, 0x9244a}, {0x92460, 0x92b73}, - {0x92b76, 0x92b95}, {0x92b98, 0x92bb9}, {0x92bbd, 0x92bc8}, {0x92bca, 0x92bd2}, - {0x92bec, 0x92bef}, {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92cf3}, - {0x92cf9, 0x92d25}, {0x92d30, 0x92d67}, {0x92d7f, 0x92d96}, {0x92da0, 0x92da6}, - {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, - {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x92de0, 0x92e49}, - {0x92e80, 0x92e99}, {0x92e9b, 0x92ef3}, {0x92f00, 0x92fd5}, {0x92ff0, 0x92ffb}, - {0x93001, 0x9303f}, {0x93041, 0x93096}, {0x93099, 0x930ff}, {0x93105, 0x9312e}, - {0x93131, 0x9318e}, {0x93190, 0x931ba}, {0x931c0, 0x931e3}, {0x931f0, 0x9321e}, - {0x93220, 0x932fe}, {0x93300, 0x94db5}, {0x94dc0, 0x99fea}, {0x9a000, 0x9a48c}, - {0x9a490, 0x9a4c6}, {0x9a4d0, 0x9a62b}, {0x9a640, 0x9a6f7}, {0x9a700, 0x9a7ae}, - {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a82b}, {0x9a830, 0x9a839}, {0x9a840, 0x9a877}, - {0x9a880, 0x9a8c5}, {0x9a8ce, 0x9a8d9}, {0x9a8e0, 0x9a8fd}, {0x9a900, 0x9a953}, - {0x9a95f, 0x9a97c}, {0x9a980, 0x9a9cd}, {0x9a9cf, 0x9a9d9}, {0x9a9de, 0x9a9fe}, - {0x9aa00, 0x9aa36}, {0x9aa40, 0x9aa4d}, {0x9aa50, 0x9aa59}, {0x9aa5c, 0x9aac2}, - {0x9aadb, 0x9aaf6}, {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, - {0x9ab20, 0x9ab26}, {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab65}, {0x9ab70, 0x9abed}, - {0x9abf0, 0x9abf9}, {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, - {0x9f900, 0x9fa6d}, {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, - {0x9fb1d, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbc1}, {0x9fbd3, 0x9fd3f}, - {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfd}, {0x9fe00, 0x9fe19}, - {0x9fe20, 0x9fe52}, {0x9fe54, 0x9fe66}, {0x9fe68, 0x9fe6b}, {0x9fe70, 0x9fe74}, - {0x9fe76, 0x9fefc}, {0x9ff01, 0x9ffbe}, {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, - {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, {0x9ffe0, 0x9ffe6}, {0x9ffe8, 0x9ffee}, - {0xa0021, 0xa007e}, {0xa00a1, 0xa00ac}, {0xa00ae, 0xa0377}, {0xa037a, 0xa037f}, - {0xa0384, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa052f}, {0xa0531, 0xa0556}, - {0xa0559, 0xa055f}, {0xa0561, 0xa0587}, {0xa058d, 0xa058f}, {0xa0591, 0xa05c7}, - {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f4}, {0xa0606, 0xa061b}, {0xa061e, 0xa06dc}, - {0xa06de, 0xa070d}, {0xa0710, 0xa074a}, {0xa074d, 0xa07b1}, {0xa07c0, 0xa07fa}, - {0xa0800, 0xa082d}, {0xa0830, 0xa083e}, {0xa0840, 0xa085b}, {0xa0860, 0xa086a}, - {0xa08a0, 0xa08b4}, {0xa08b6, 0xa08bd}, {0xa08d4, 0xa08e1}, {0xa08e3, 0xa0983}, - {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, - {0xa09bc, 0xa09c4}, {0xa09cb, 0xa09ce}, {0xa09df, 0xa09e3}, {0xa09e6, 0xa09fd}, - {0xa0a01, 0xa0a03}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, - {0xa0a3e, 0xa0a42}, {0xa0a4b, 0xa0a4d}, {0xa0a59, 0xa0a5c}, {0xa0a66, 0xa0a75}, - {0xa0a81, 0xa0a83}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, {0xa0a93, 0xa0aa8}, - {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0abc, 0xa0ac5}, {0xa0ac7, 0xa0ac9}, - {0xa0acb, 0xa0acd}, {0xa0ae0, 0xa0ae3}, {0xa0ae6, 0xa0af1}, {0xa0af9, 0xa0aff}, - {0xa0b01, 0xa0b03}, {0xa0b05, 0xa0b0c}, {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, - {0xa0b35, 0xa0b39}, {0xa0b3c, 0xa0b44}, {0xa0b4b, 0xa0b4d}, {0xa0b5f, 0xa0b63}, - {0xa0b66, 0xa0b77}, {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, - {0xa0ba8, 0xa0baa}, {0xa0bae, 0xa0bb9}, {0xa0bbe, 0xa0bc2}, {0xa0bc6, 0xa0bc8}, - {0xa0bca, 0xa0bcd}, {0xa0be6, 0xa0bfa}, {0xa0c00, 0xa0c03}, {0xa0c05, 0xa0c0c}, - {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, {0xa0c2a, 0xa0c39}, {0xa0c3d, 0xa0c44}, - {0xa0c46, 0xa0c48}, {0xa0c4a, 0xa0c4d}, {0xa0c58, 0xa0c5a}, {0xa0c60, 0xa0c63}, - {0xa0c66, 0xa0c6f}, {0xa0c78, 0xa0c83}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, - {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0cbc, 0xa0cc4}, - {0xa0cc6, 0xa0cc8}, {0xa0cca, 0xa0ccd}, {0xa0ce0, 0xa0ce3}, {0xa0ce6, 0xa0cef}, - {0xa0d00, 0xa0d03}, {0xa0d05, 0xa0d0c}, {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d44}, - {0xa0d46, 0xa0d48}, {0xa0d4a, 0xa0d4f}, {0xa0d54, 0xa0d63}, {0xa0d66, 0xa0d7f}, - {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, {0xa0dc0, 0xa0dc6}, - {0xa0dcf, 0xa0dd4}, {0xa0dd8, 0xa0ddf}, {0xa0de6, 0xa0def}, {0xa0df2, 0xa0df4}, - {0xa0e01, 0xa0e3a}, {0xa0e3f, 0xa0e5b}, {0xa0e94, 0xa0e97}, {0xa0e99, 0xa0e9f}, - {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb9}, {0xa0ebb, 0xa0ebd}, {0xa0ec0, 0xa0ec4}, - {0xa0ec8, 0xa0ecd}, {0xa0ed0, 0xa0ed9}, {0xa0edc, 0xa0edf}, {0xa0f00, 0xa0f47}, - {0xa0f49, 0xa0f6c}, {0xa0f71, 0xa0f97}, {0xa0f99, 0xa0fbc}, {0xa0fbe, 0xa0fcc}, - {0xa0fce, 0xa0fda}, {0xa1000, 0xa10c5}, {0xa10d0, 0xa1248}, {0xa124a, 0xa124d}, - {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, {0xa128a, 0xa128d}, - {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, {0xa12c2, 0xa12c5}, - {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, {0xa1318, 0xa135a}, - {0xa135d, 0xa137c}, {0xa1380, 0xa1399}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, - {0xa1400, 0xa167f}, {0xa1681, 0xa169c}, {0xa16a0, 0xa16f8}, {0xa1700, 0xa170c}, - {0xa170e, 0xa1714}, {0xa1720, 0xa1736}, {0xa1740, 0xa1753}, {0xa1760, 0xa176c}, - {0xa176e, 0xa1770}, {0xa1780, 0xa17dd}, {0xa17e0, 0xa17e9}, {0xa17f0, 0xa17f9}, - {0xa1800, 0xa180d}, {0xa1810, 0xa1819}, {0xa1820, 0xa1877}, {0xa1880, 0xa18aa}, - {0xa18b0, 0xa18f5}, {0xa1900, 0xa191e}, {0xa1920, 0xa192b}, {0xa1930, 0xa193b}, - {0xa1944, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, {0xa19b0, 0xa19c9}, - {0xa19d0, 0xa19da}, {0xa19de, 0xa1a1b}, {0xa1a1e, 0xa1a5e}, {0xa1a60, 0xa1a7c}, - {0xa1a7f, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1aa0, 0xa1aad}, {0xa1ab0, 0xa1abe}, - {0xa1b00, 0xa1b4b}, {0xa1b50, 0xa1b7c}, {0xa1b80, 0xa1bf3}, {0xa1bfc, 0xa1c37}, - {0xa1c3b, 0xa1c49}, {0xa1c4d, 0xa1c88}, {0xa1cc0, 0xa1cc7}, {0xa1cd0, 0xa1cf9}, - {0xa1d00, 0xa1df9}, {0xa1dfb, 0xa1f15}, {0xa1f18, 0xa1f1d}, {0xa1f20, 0xa1f45}, - {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, {0xa1f80, 0xa1fb4}, - {0xa1fb6, 0xa1fc4}, {0xa1fc6, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fdd, 0xa1fef}, - {0xa1ff2, 0xa1ff4}, {0xa1ff6, 0xa1ffe}, {0xa2010, 0xa2027}, {0xa2030, 0xa205e}, - {0xa2074, 0xa208e}, {0xa2090, 0xa209c}, {0xa20a0, 0xa20bf}, {0xa20d0, 0xa20f0}, - {0xa2100, 0xa218b}, {0xa2190, 0xa2426}, {0xa2440, 0xa244a}, {0xa2460, 0xa2b73}, - {0xa2b76, 0xa2b95}, {0xa2b98, 0xa2bb9}, {0xa2bbd, 0xa2bc8}, {0xa2bca, 0xa2bd2}, - {0xa2bec, 0xa2bef}, {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2cf3}, - {0xa2cf9, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d7f, 0xa2d96}, {0xa2da0, 0xa2da6}, - {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, - {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa2de0, 0xa2e49}, - {0xa2e80, 0xa2e99}, {0xa2e9b, 0xa2ef3}, {0xa2f00, 0xa2fd5}, {0xa2ff0, 0xa2ffb}, - {0xa3001, 0xa303f}, {0xa3041, 0xa3096}, {0xa3099, 0xa30ff}, {0xa3105, 0xa312e}, - {0xa3131, 0xa318e}, {0xa3190, 0xa31ba}, {0xa31c0, 0xa31e3}, {0xa31f0, 0xa321e}, - {0xa3220, 0xa32fe}, {0xa3300, 0xa4db5}, {0xa4dc0, 0xa9fea}, {0xaa000, 0xaa48c}, - {0xaa490, 0xaa4c6}, {0xaa4d0, 0xaa62b}, {0xaa640, 0xaa6f7}, {0xaa700, 0xaa7ae}, - {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa82b}, {0xaa830, 0xaa839}, {0xaa840, 0xaa877}, - {0xaa880, 0xaa8c5}, {0xaa8ce, 0xaa8d9}, {0xaa8e0, 0xaa8fd}, {0xaa900, 0xaa953}, - {0xaa95f, 0xaa97c}, {0xaa980, 0xaa9cd}, {0xaa9cf, 0xaa9d9}, {0xaa9de, 0xaa9fe}, - {0xaaa00, 0xaaa36}, {0xaaa40, 0xaaa4d}, {0xaaa50, 0xaaa59}, {0xaaa5c, 0xaaac2}, - {0xaaadb, 0xaaaf6}, {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, - {0xaab20, 0xaab26}, {0xaab28, 0xaab2e}, {0xaab30, 0xaab65}, {0xaab70, 0xaabed}, - {0xaabf0, 0xaabf9}, {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, - {0xaf900, 0xafa6d}, {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, - {0xafb1d, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbc1}, {0xafbd3, 0xafd3f}, - {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfd}, {0xafe00, 0xafe19}, - {0xafe20, 0xafe52}, {0xafe54, 0xafe66}, {0xafe68, 0xafe6b}, {0xafe70, 0xafe74}, - {0xafe76, 0xafefc}, {0xaff01, 0xaffbe}, {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, - {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, {0xaffe0, 0xaffe6}, {0xaffe8, 0xaffee}, - {0xb0021, 0xb007e}, {0xb00a1, 0xb00ac}, {0xb00ae, 0xb0377}, {0xb037a, 0xb037f}, - {0xb0384, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb052f}, {0xb0531, 0xb0556}, - {0xb0559, 0xb055f}, {0xb0561, 0xb0587}, {0xb058d, 0xb058f}, {0xb0591, 0xb05c7}, - {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f4}, {0xb0606, 0xb061b}, {0xb061e, 0xb06dc}, - {0xb06de, 0xb070d}, {0xb0710, 0xb074a}, {0xb074d, 0xb07b1}, {0xb07c0, 0xb07fa}, - {0xb0800, 0xb082d}, {0xb0830, 0xb083e}, {0xb0840, 0xb085b}, {0xb0860, 0xb086a}, - {0xb08a0, 0xb08b4}, {0xb08b6, 0xb08bd}, {0xb08d4, 0xb08e1}, {0xb08e3, 0xb0983}, - {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, - {0xb09bc, 0xb09c4}, {0xb09cb, 0xb09ce}, {0xb09df, 0xb09e3}, {0xb09e6, 0xb09fd}, - {0xb0a01, 0xb0a03}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, - {0xb0a3e, 0xb0a42}, {0xb0a4b, 0xb0a4d}, {0xb0a59, 0xb0a5c}, {0xb0a66, 0xb0a75}, - {0xb0a81, 0xb0a83}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, {0xb0a93, 0xb0aa8}, - {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0abc, 0xb0ac5}, {0xb0ac7, 0xb0ac9}, - {0xb0acb, 0xb0acd}, {0xb0ae0, 0xb0ae3}, {0xb0ae6, 0xb0af1}, {0xb0af9, 0xb0aff}, - {0xb0b01, 0xb0b03}, {0xb0b05, 0xb0b0c}, {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, - {0xb0b35, 0xb0b39}, {0xb0b3c, 0xb0b44}, {0xb0b4b, 0xb0b4d}, {0xb0b5f, 0xb0b63}, - {0xb0b66, 0xb0b77}, {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, - {0xb0ba8, 0xb0baa}, {0xb0bae, 0xb0bb9}, {0xb0bbe, 0xb0bc2}, {0xb0bc6, 0xb0bc8}, - {0xb0bca, 0xb0bcd}, {0xb0be6, 0xb0bfa}, {0xb0c00, 0xb0c03}, {0xb0c05, 0xb0c0c}, - {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, {0xb0c2a, 0xb0c39}, {0xb0c3d, 0xb0c44}, - {0xb0c46, 0xb0c48}, {0xb0c4a, 0xb0c4d}, {0xb0c58, 0xb0c5a}, {0xb0c60, 0xb0c63}, - {0xb0c66, 0xb0c6f}, {0xb0c78, 0xb0c83}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, - {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0cbc, 0xb0cc4}, - {0xb0cc6, 0xb0cc8}, {0xb0cca, 0xb0ccd}, {0xb0ce0, 0xb0ce3}, {0xb0ce6, 0xb0cef}, - {0xb0d00, 0xb0d03}, {0xb0d05, 0xb0d0c}, {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d44}, - {0xb0d46, 0xb0d48}, {0xb0d4a, 0xb0d4f}, {0xb0d54, 0xb0d63}, {0xb0d66, 0xb0d7f}, - {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, {0xb0dc0, 0xb0dc6}, - {0xb0dcf, 0xb0dd4}, {0xb0dd8, 0xb0ddf}, {0xb0de6, 0xb0def}, {0xb0df2, 0xb0df4}, - {0xb0e01, 0xb0e3a}, {0xb0e3f, 0xb0e5b}, {0xb0e94, 0xb0e97}, {0xb0e99, 0xb0e9f}, - {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb9}, {0xb0ebb, 0xb0ebd}, {0xb0ec0, 0xb0ec4}, - {0xb0ec8, 0xb0ecd}, {0xb0ed0, 0xb0ed9}, {0xb0edc, 0xb0edf}, {0xb0f00, 0xb0f47}, - {0xb0f49, 0xb0f6c}, {0xb0f71, 0xb0f97}, {0xb0f99, 0xb0fbc}, {0xb0fbe, 0xb0fcc}, - {0xb0fce, 0xb0fda}, {0xb1000, 0xb10c5}, {0xb10d0, 0xb1248}, {0xb124a, 0xb124d}, - {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, {0xb128a, 0xb128d}, - {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, {0xb12c2, 0xb12c5}, - {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, {0xb1318, 0xb135a}, - {0xb135d, 0xb137c}, {0xb1380, 0xb1399}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, - {0xb1400, 0xb167f}, {0xb1681, 0xb169c}, {0xb16a0, 0xb16f8}, {0xb1700, 0xb170c}, - {0xb170e, 0xb1714}, {0xb1720, 0xb1736}, {0xb1740, 0xb1753}, {0xb1760, 0xb176c}, - {0xb176e, 0xb1770}, {0xb1780, 0xb17dd}, {0xb17e0, 0xb17e9}, {0xb17f0, 0xb17f9}, - {0xb1800, 0xb180d}, {0xb1810, 0xb1819}, {0xb1820, 0xb1877}, {0xb1880, 0xb18aa}, - {0xb18b0, 0xb18f5}, {0xb1900, 0xb191e}, {0xb1920, 0xb192b}, {0xb1930, 0xb193b}, - {0xb1944, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, {0xb19b0, 0xb19c9}, - {0xb19d0, 0xb19da}, {0xb19de, 0xb1a1b}, {0xb1a1e, 0xb1a5e}, {0xb1a60, 0xb1a7c}, - {0xb1a7f, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1aa0, 0xb1aad}, {0xb1ab0, 0xb1abe}, - {0xb1b00, 0xb1b4b}, {0xb1b50, 0xb1b7c}, {0xb1b80, 0xb1bf3}, {0xb1bfc, 0xb1c37}, - {0xb1c3b, 0xb1c49}, {0xb1c4d, 0xb1c88}, {0xb1cc0, 0xb1cc7}, {0xb1cd0, 0xb1cf9}, - {0xb1d00, 0xb1df9}, {0xb1dfb, 0xb1f15}, {0xb1f18, 0xb1f1d}, {0xb1f20, 0xb1f45}, - {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, {0xb1f80, 0xb1fb4}, - {0xb1fb6, 0xb1fc4}, {0xb1fc6, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fdd, 0xb1fef}, - {0xb1ff2, 0xb1ff4}, {0xb1ff6, 0xb1ffe}, {0xb2010, 0xb2027}, {0xb2030, 0xb205e}, - {0xb2074, 0xb208e}, {0xb2090, 0xb209c}, {0xb20a0, 0xb20bf}, {0xb20d0, 0xb20f0}, - {0xb2100, 0xb218b}, {0xb2190, 0xb2426}, {0xb2440, 0xb244a}, {0xb2460, 0xb2b73}, - {0xb2b76, 0xb2b95}, {0xb2b98, 0xb2bb9}, {0xb2bbd, 0xb2bc8}, {0xb2bca, 0xb2bd2}, - {0xb2bec, 0xb2bef}, {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2cf3}, - {0xb2cf9, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d7f, 0xb2d96}, {0xb2da0, 0xb2da6}, - {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, - {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb2de0, 0xb2e49}, - {0xb2e80, 0xb2e99}, {0xb2e9b, 0xb2ef3}, {0xb2f00, 0xb2fd5}, {0xb2ff0, 0xb2ffb}, - {0xb3001, 0xb303f}, {0xb3041, 0xb3096}, {0xb3099, 0xb30ff}, {0xb3105, 0xb312e}, - {0xb3131, 0xb318e}, {0xb3190, 0xb31ba}, {0xb31c0, 0xb31e3}, {0xb31f0, 0xb321e}, - {0xb3220, 0xb32fe}, {0xb3300, 0xb4db5}, {0xb4dc0, 0xb9fea}, {0xba000, 0xba48c}, - {0xba490, 0xba4c6}, {0xba4d0, 0xba62b}, {0xba640, 0xba6f7}, {0xba700, 0xba7ae}, - {0xba7b0, 0xba7b7}, {0xba7f7, 0xba82b}, {0xba830, 0xba839}, {0xba840, 0xba877}, - {0xba880, 0xba8c5}, {0xba8ce, 0xba8d9}, {0xba8e0, 0xba8fd}, {0xba900, 0xba953}, - {0xba95f, 0xba97c}, {0xba980, 0xba9cd}, {0xba9cf, 0xba9d9}, {0xba9de, 0xba9fe}, - {0xbaa00, 0xbaa36}, {0xbaa40, 0xbaa4d}, {0xbaa50, 0xbaa59}, {0xbaa5c, 0xbaac2}, - {0xbaadb, 0xbaaf6}, {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, - {0xbab20, 0xbab26}, {0xbab28, 0xbab2e}, {0xbab30, 0xbab65}, {0xbab70, 0xbabed}, - {0xbabf0, 0xbabf9}, {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, - {0xbf900, 0xbfa6d}, {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, - {0xbfb1d, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbc1}, {0xbfbd3, 0xbfd3f}, - {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfd}, {0xbfe00, 0xbfe19}, - {0xbfe20, 0xbfe52}, {0xbfe54, 0xbfe66}, {0xbfe68, 0xbfe6b}, {0xbfe70, 0xbfe74}, - {0xbfe76, 0xbfefc}, {0xbff01, 0xbffbe}, {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, - {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, {0xbffe0, 0xbffe6}, {0xbffe8, 0xbffee}, - {0xc0021, 0xc007e}, {0xc00a1, 0xc00ac}, {0xc00ae, 0xc0377}, {0xc037a, 0xc037f}, - {0xc0384, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc052f}, {0xc0531, 0xc0556}, - {0xc0559, 0xc055f}, {0xc0561, 0xc0587}, {0xc058d, 0xc058f}, {0xc0591, 0xc05c7}, - {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f4}, {0xc0606, 0xc061b}, {0xc061e, 0xc06dc}, - {0xc06de, 0xc070d}, {0xc0710, 0xc074a}, {0xc074d, 0xc07b1}, {0xc07c0, 0xc07fa}, - {0xc0800, 0xc082d}, {0xc0830, 0xc083e}, {0xc0840, 0xc085b}, {0xc0860, 0xc086a}, - {0xc08a0, 0xc08b4}, {0xc08b6, 0xc08bd}, {0xc08d4, 0xc08e1}, {0xc08e3, 0xc0983}, - {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, - {0xc09bc, 0xc09c4}, {0xc09cb, 0xc09ce}, {0xc09df, 0xc09e3}, {0xc09e6, 0xc09fd}, - {0xc0a01, 0xc0a03}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, - {0xc0a3e, 0xc0a42}, {0xc0a4b, 0xc0a4d}, {0xc0a59, 0xc0a5c}, {0xc0a66, 0xc0a75}, - {0xc0a81, 0xc0a83}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, {0xc0a93, 0xc0aa8}, - {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0abc, 0xc0ac5}, {0xc0ac7, 0xc0ac9}, - {0xc0acb, 0xc0acd}, {0xc0ae0, 0xc0ae3}, {0xc0ae6, 0xc0af1}, {0xc0af9, 0xc0aff}, - {0xc0b01, 0xc0b03}, {0xc0b05, 0xc0b0c}, {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, - {0xc0b35, 0xc0b39}, {0xc0b3c, 0xc0b44}, {0xc0b4b, 0xc0b4d}, {0xc0b5f, 0xc0b63}, - {0xc0b66, 0xc0b77}, {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, - {0xc0ba8, 0xc0baa}, {0xc0bae, 0xc0bb9}, {0xc0bbe, 0xc0bc2}, {0xc0bc6, 0xc0bc8}, - {0xc0bca, 0xc0bcd}, {0xc0be6, 0xc0bfa}, {0xc0c00, 0xc0c03}, {0xc0c05, 0xc0c0c}, - {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, {0xc0c2a, 0xc0c39}, {0xc0c3d, 0xc0c44}, - {0xc0c46, 0xc0c48}, {0xc0c4a, 0xc0c4d}, {0xc0c58, 0xc0c5a}, {0xc0c60, 0xc0c63}, - {0xc0c66, 0xc0c6f}, {0xc0c78, 0xc0c83}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, - {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0cbc, 0xc0cc4}, - {0xc0cc6, 0xc0cc8}, {0xc0cca, 0xc0ccd}, {0xc0ce0, 0xc0ce3}, {0xc0ce6, 0xc0cef}, - {0xc0d00, 0xc0d03}, {0xc0d05, 0xc0d0c}, {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d44}, - {0xc0d46, 0xc0d48}, {0xc0d4a, 0xc0d4f}, {0xc0d54, 0xc0d63}, {0xc0d66, 0xc0d7f}, - {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, {0xc0dc0, 0xc0dc6}, - {0xc0dcf, 0xc0dd4}, {0xc0dd8, 0xc0ddf}, {0xc0de6, 0xc0def}, {0xc0df2, 0xc0df4}, - {0xc0e01, 0xc0e3a}, {0xc0e3f, 0xc0e5b}, {0xc0e94, 0xc0e97}, {0xc0e99, 0xc0e9f}, - {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb9}, {0xc0ebb, 0xc0ebd}, {0xc0ec0, 0xc0ec4}, - {0xc0ec8, 0xc0ecd}, {0xc0ed0, 0xc0ed9}, {0xc0edc, 0xc0edf}, {0xc0f00, 0xc0f47}, - {0xc0f49, 0xc0f6c}, {0xc0f71, 0xc0f97}, {0xc0f99, 0xc0fbc}, {0xc0fbe, 0xc0fcc}, - {0xc0fce, 0xc0fda}, {0xc1000, 0xc10c5}, {0xc10d0, 0xc1248}, {0xc124a, 0xc124d}, - {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, {0xc128a, 0xc128d}, - {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, {0xc12c2, 0xc12c5}, - {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, {0xc1318, 0xc135a}, - {0xc135d, 0xc137c}, {0xc1380, 0xc1399}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, - {0xc1400, 0xc167f}, {0xc1681, 0xc169c}, {0xc16a0, 0xc16f8}, {0xc1700, 0xc170c}, - {0xc170e, 0xc1714}, {0xc1720, 0xc1736}, {0xc1740, 0xc1753}, {0xc1760, 0xc176c}, - {0xc176e, 0xc1770}, {0xc1780, 0xc17dd}, {0xc17e0, 0xc17e9}, {0xc17f0, 0xc17f9}, - {0xc1800, 0xc180d}, {0xc1810, 0xc1819}, {0xc1820, 0xc1877}, {0xc1880, 0xc18aa}, - {0xc18b0, 0xc18f5}, {0xc1900, 0xc191e}, {0xc1920, 0xc192b}, {0xc1930, 0xc193b}, - {0xc1944, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, {0xc19b0, 0xc19c9}, - {0xc19d0, 0xc19da}, {0xc19de, 0xc1a1b}, {0xc1a1e, 0xc1a5e}, {0xc1a60, 0xc1a7c}, - {0xc1a7f, 0xc1a89}, {0xc1a90, 0xc1a99}, {0xc1aa0, 0xc1aad}, {0xc1ab0, 0xc1abe}, - {0xc1b00, 0xc1b4b}, {0xc1b50, 0xc1b7c}, {0xc1b80, 0xc1bf3}, {0xc1bfc, 0xc1c37}, - {0xc1c3b, 0xc1c49}, {0xc1c4d, 0xc1c88}, {0xc1cc0, 0xc1cc7}, {0xc1cd0, 0xc1cf9}, - {0xc1d00, 0xc1df9}, {0xc1dfb, 0xc1f15}, {0xc1f18, 0xc1f1d}, {0xc1f20, 0xc1f45}, - {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, {0xc1f80, 0xc1fb4}, - {0xc1fb6, 0xc1fc4}, {0xc1fc6, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fdd, 0xc1fef}, - {0xc1ff2, 0xc1ff4}, {0xc1ff6, 0xc1ffe}, {0xc2010, 0xc2027}, {0xc2030, 0xc205e}, - {0xc2074, 0xc208e}, {0xc2090, 0xc209c}, {0xc20a0, 0xc20bf}, {0xc20d0, 0xc20f0}, - {0xc2100, 0xc218b}, {0xc2190, 0xc2426}, {0xc2440, 0xc244a}, {0xc2460, 0xc2b73}, - {0xc2b76, 0xc2b95}, {0xc2b98, 0xc2bb9}, {0xc2bbd, 0xc2bc8}, {0xc2bca, 0xc2bd2}, - {0xc2bec, 0xc2bef}, {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2cf3}, - {0xc2cf9, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d7f, 0xc2d96}, {0xc2da0, 0xc2da6}, - {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, - {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc2de0, 0xc2e49}, - {0xc2e80, 0xc2e99}, {0xc2e9b, 0xc2ef3}, {0xc2f00, 0xc2fd5}, {0xc2ff0, 0xc2ffb}, - {0xc3001, 0xc303f}, {0xc3041, 0xc3096}, {0xc3099, 0xc30ff}, {0xc3105, 0xc312e}, - {0xc3131, 0xc318e}, {0xc3190, 0xc31ba}, {0xc31c0, 0xc31e3}, {0xc31f0, 0xc321e}, - {0xc3220, 0xc32fe}, {0xc3300, 0xc4db5}, {0xc4dc0, 0xc9fea}, {0xca000, 0xca48c}, - {0xca490, 0xca4c6}, {0xca4d0, 0xca62b}, {0xca640, 0xca6f7}, {0xca700, 0xca7ae}, - {0xca7b0, 0xca7b7}, {0xca7f7, 0xca82b}, {0xca830, 0xca839}, {0xca840, 0xca877}, - {0xca880, 0xca8c5}, {0xca8ce, 0xca8d9}, {0xca8e0, 0xca8fd}, {0xca900, 0xca953}, - {0xca95f, 0xca97c}, {0xca980, 0xca9cd}, {0xca9cf, 0xca9d9}, {0xca9de, 0xca9fe}, - {0xcaa00, 0xcaa36}, {0xcaa40, 0xcaa4d}, {0xcaa50, 0xcaa59}, {0xcaa5c, 0xcaac2}, - {0xcaadb, 0xcaaf6}, {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, - {0xcab20, 0xcab26}, {0xcab28, 0xcab2e}, {0xcab30, 0xcab65}, {0xcab70, 0xcabed}, - {0xcabf0, 0xcabf9}, {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, - {0xcf900, 0xcfa6d}, {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, - {0xcfb1d, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbc1}, {0xcfbd3, 0xcfd3f}, - {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfd}, {0xcfe00, 0xcfe19}, - {0xcfe20, 0xcfe52}, {0xcfe54, 0xcfe66}, {0xcfe68, 0xcfe6b}, {0xcfe70, 0xcfe74}, - {0xcfe76, 0xcfefc}, {0xcff01, 0xcffbe}, {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, - {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, {0xcffe0, 0xcffe6}, {0xcffe8, 0xcffee}, - {0xd0021, 0xd007e}, {0xd00a1, 0xd00ac}, {0xd00ae, 0xd0377}, {0xd037a, 0xd037f}, - {0xd0384, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd052f}, {0xd0531, 0xd0556}, - {0xd0559, 0xd055f}, {0xd0561, 0xd0587}, {0xd058d, 0xd058f}, {0xd0591, 0xd05c7}, - {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f4}, {0xd0606, 0xd061b}, {0xd061e, 0xd06dc}, - {0xd06de, 0xd070d}, {0xd0710, 0xd074a}, {0xd074d, 0xd07b1}, {0xd07c0, 0xd07fa}, - {0xd0800, 0xd082d}, {0xd0830, 0xd083e}, {0xd0840, 0xd085b}, {0xd0860, 0xd086a}, - {0xd08a0, 0xd08b4}, {0xd08b6, 0xd08bd}, {0xd08d4, 0xd08e1}, {0xd08e3, 0xd0983}, - {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, - {0xd09bc, 0xd09c4}, {0xd09cb, 0xd09ce}, {0xd09df, 0xd09e3}, {0xd09e6, 0xd09fd}, - {0xd0a01, 0xd0a03}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, - {0xd0a3e, 0xd0a42}, {0xd0a4b, 0xd0a4d}, {0xd0a59, 0xd0a5c}, {0xd0a66, 0xd0a75}, - {0xd0a81, 0xd0a83}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, {0xd0a93, 0xd0aa8}, - {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0abc, 0xd0ac5}, {0xd0ac7, 0xd0ac9}, - {0xd0acb, 0xd0acd}, {0xd0ae0, 0xd0ae3}, {0xd0ae6, 0xd0af1}, {0xd0af9, 0xd0aff}, - {0xd0b01, 0xd0b03}, {0xd0b05, 0xd0b0c}, {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, - {0xd0b35, 0xd0b39}, {0xd0b3c, 0xd0b44}, {0xd0b4b, 0xd0b4d}, {0xd0b5f, 0xd0b63}, - {0xd0b66, 0xd0b77}, {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, - {0xd0ba8, 0xd0baa}, {0xd0bae, 0xd0bb9}, {0xd0bbe, 0xd0bc2}, {0xd0bc6, 0xd0bc8}, - {0xd0bca, 0xd0bcd}, {0xd0be6, 0xd0bfa}, {0xd0c00, 0xd0c03}, {0xd0c05, 0xd0c0c}, - {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, {0xd0c2a, 0xd0c39}, {0xd0c3d, 0xd0c44}, - {0xd0c46, 0xd0c48}, {0xd0c4a, 0xd0c4d}, {0xd0c58, 0xd0c5a}, {0xd0c60, 0xd0c63}, - {0xd0c66, 0xd0c6f}, {0xd0c78, 0xd0c83}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, - {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0cbc, 0xd0cc4}, - {0xd0cc6, 0xd0cc8}, {0xd0cca, 0xd0ccd}, {0xd0ce0, 0xd0ce3}, {0xd0ce6, 0xd0cef}, - {0xd0d00, 0xd0d03}, {0xd0d05, 0xd0d0c}, {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d44}, - {0xd0d46, 0xd0d48}, {0xd0d4a, 0xd0d4f}, {0xd0d54, 0xd0d63}, {0xd0d66, 0xd0d7f}, - {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, {0xd0dc0, 0xd0dc6}, - {0xd0dcf, 0xd0dd4}, {0xd0dd8, 0xd0ddf}, {0xd0de6, 0xd0def}, {0xd0df2, 0xd0df4}, - {0xd0e01, 0xd0e3a}, {0xd0e3f, 0xd0e5b}, {0xd0e94, 0xd0e97}, {0xd0e99, 0xd0e9f}, - {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb9}, {0xd0ebb, 0xd0ebd}, {0xd0ec0, 0xd0ec4}, - {0xd0ec8, 0xd0ecd}, {0xd0ed0, 0xd0ed9}, {0xd0edc, 0xd0edf}, {0xd0f00, 0xd0f47}, - {0xd0f49, 0xd0f6c}, {0xd0f71, 0xd0f97}, {0xd0f99, 0xd0fbc}, {0xd0fbe, 0xd0fcc}, - {0xd0fce, 0xd0fda}, {0xd1000, 0xd10c5}, {0xd10d0, 0xd1248}, {0xd124a, 0xd124d}, - {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, {0xd128a, 0xd128d}, - {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, {0xd12c2, 0xd12c5}, - {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, {0xd1318, 0xd135a}, - {0xd135d, 0xd137c}, {0xd1380, 0xd1399}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, - {0xd1400, 0xd167f}, {0xd1681, 0xd169c}, {0xd16a0, 0xd16f8}, {0xd1700, 0xd170c}, - {0xd170e, 0xd1714}, {0xd1720, 0xd1736}, {0xd1740, 0xd1753}, {0xd1760, 0xd176c}, - {0xd176e, 0xd1770}, {0xd1780, 0xd17dd}, {0xd17e0, 0xd17e9}, {0xd17f0, 0xd17f9}, - {0xd1800, 0xd180d}, {0xd1810, 0xd1819}, {0xd1820, 0xd1877}, {0xd1880, 0xd18aa}, - {0xd18b0, 0xd18f5}, {0xd1900, 0xd191e}, {0xd1920, 0xd192b}, {0xd1930, 0xd193b}, - {0xd1944, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, {0xd19b0, 0xd19c9}, - {0xd19d0, 0xd19da}, {0xd19de, 0xd1a1b}, {0xd1a1e, 0xd1a5e}, {0xd1a60, 0xd1a7c}, - {0xd1a7f, 0xd1a89}, {0xd1a90, 0xd1a99}, {0xd1aa0, 0xd1aad}, {0xd1ab0, 0xd1abe}, - {0xd1b00, 0xd1b4b}, {0xd1b50, 0xd1b7c}, {0xd1b80, 0xd1bf3}, {0xd1bfc, 0xd1c37}, - {0xd1c3b, 0xd1c49}, {0xd1c4d, 0xd1c88}, {0xd1cc0, 0xd1cc7}, {0xd1cd0, 0xd1cf9}, - {0xd1d00, 0xd1df9}, {0xd1dfb, 0xd1f15}, {0xd1f18, 0xd1f1d}, {0xd1f20, 0xd1f45}, - {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, {0xd1f80, 0xd1fb4}, - {0xd1fb6, 0xd1fc4}, {0xd1fc6, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fdd, 0xd1fef}, - {0xd1ff2, 0xd1ff4}, {0xd1ff6, 0xd1ffe}, {0xd2010, 0xd2027}, {0xd2030, 0xd205e}, - {0xd2074, 0xd208e}, {0xd2090, 0xd209c}, {0xd20a0, 0xd20bf}, {0xd20d0, 0xd20f0}, - {0xd2100, 0xd218b}, {0xd2190, 0xd2426}, {0xd2440, 0xd244a}, {0xd2460, 0xd2b73}, - {0xd2b76, 0xd2b95}, {0xd2b98, 0xd2bb9}, {0xd2bbd, 0xd2bc8}, {0xd2bca, 0xd2bd2}, - {0xd2bec, 0xd2bef}, {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2cf3}, - {0xd2cf9, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d7f, 0xd2d96}, {0xd2da0, 0xd2da6}, - {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, - {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd2de0, 0xd2e49}, - {0xd2e80, 0xd2e99}, {0xd2e9b, 0xd2ef3}, {0xd2f00, 0xd2fd5}, {0xd2ff0, 0xd2ffb}, - {0xd3001, 0xd303f}, {0xd3041, 0xd3096}, {0xd3099, 0xd30ff}, {0xd3105, 0xd312e}, - {0xd3131, 0xd318e}, {0xd3190, 0xd31ba}, {0xd31c0, 0xd31e3}, {0xd31f0, 0xd321e}, - {0xd3220, 0xd32fe}, {0xd3300, 0xd4db5}, {0xd4dc0, 0xd9fea}, {0xda000, 0xda48c}, - {0xda490, 0xda4c6}, {0xda4d0, 0xda62b}, {0xda640, 0xda6f7}, {0xda700, 0xda7ae}, - {0xda7b0, 0xda7b7}, {0xda7f7, 0xda82b}, {0xda830, 0xda839}, {0xda840, 0xda877}, - {0xda880, 0xda8c5}, {0xda8ce, 0xda8d9}, {0xda8e0, 0xda8fd}, {0xda900, 0xda953}, - {0xda95f, 0xda97c}, {0xda980, 0xda9cd}, {0xda9cf, 0xda9d9}, {0xda9de, 0xda9fe}, - {0xdaa00, 0xdaa36}, {0xdaa40, 0xdaa4d}, {0xdaa50, 0xdaa59}, {0xdaa5c, 0xdaac2}, - {0xdaadb, 0xdaaf6}, {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, - {0xdab20, 0xdab26}, {0xdab28, 0xdab2e}, {0xdab30, 0xdab65}, {0xdab70, 0xdabed}, - {0xdabf0, 0xdabf9}, {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, - {0xdf900, 0xdfa6d}, {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, - {0xdfb1d, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbc1}, {0xdfbd3, 0xdfd3f}, - {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfd}, {0xdfe00, 0xdfe19}, - {0xdfe20, 0xdfe52}, {0xdfe54, 0xdfe66}, {0xdfe68, 0xdfe6b}, {0xdfe70, 0xdfe74}, - {0xdfe76, 0xdfefc}, {0xdff01, 0xdffbe}, {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, - {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, {0xdffe0, 0xdffe6}, {0xdffe8, 0xdffee}, - {0xe0021, 0xe007e}, {0xe00a1, 0xe00ac}, {0xe00ae, 0xe0377}, {0xe037a, 0xe037f}, - {0xe0384, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe052f}, {0xe0531, 0xe0556}, - {0xe0559, 0xe055f}, {0xe0561, 0xe0587}, {0xe058d, 0xe058f}, {0xe0591, 0xe05c7}, - {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f4}, {0xe0606, 0xe061b}, {0xe061e, 0xe06dc}, - {0xe06de, 0xe070d}, {0xe0710, 0xe074a}, {0xe074d, 0xe07b1}, {0xe07c0, 0xe07fa}, - {0xe0800, 0xe082d}, {0xe0830, 0xe083e}, {0xe0840, 0xe085b}, {0xe0860, 0xe086a}, - {0xe08a0, 0xe08b4}, {0xe08b6, 0xe08bd}, {0xe08d4, 0xe08e1}, {0xe08e3, 0xe0983}, - {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, - {0xe09bc, 0xe09c4}, {0xe09cb, 0xe09ce}, {0xe09df, 0xe09e3}, {0xe09e6, 0xe09fd}, - {0xe0a01, 0xe0a03}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, - {0xe0a3e, 0xe0a42}, {0xe0a4b, 0xe0a4d}, {0xe0a59, 0xe0a5c}, {0xe0a66, 0xe0a75}, - {0xe0a81, 0xe0a83}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, {0xe0a93, 0xe0aa8}, - {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0abc, 0xe0ac5}, {0xe0ac7, 0xe0ac9}, - {0xe0acb, 0xe0acd}, {0xe0ae0, 0xe0ae3}, {0xe0ae6, 0xe0af1}, {0xe0af9, 0xe0aff}, - {0xe0b01, 0xe0b03}, {0xe0b05, 0xe0b0c}, {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, - {0xe0b35, 0xe0b39}, {0xe0b3c, 0xe0b44}, {0xe0b4b, 0xe0b4d}, {0xe0b5f, 0xe0b63}, - {0xe0b66, 0xe0b77}, {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, - {0xe0ba8, 0xe0baa}, {0xe0bae, 0xe0bb9}, {0xe0bbe, 0xe0bc2}, {0xe0bc6, 0xe0bc8}, - {0xe0bca, 0xe0bcd}, {0xe0be6, 0xe0bfa}, {0xe0c00, 0xe0c03}, {0xe0c05, 0xe0c0c}, - {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, {0xe0c2a, 0xe0c39}, {0xe0c3d, 0xe0c44}, - {0xe0c46, 0xe0c48}, {0xe0c4a, 0xe0c4d}, {0xe0c58, 0xe0c5a}, {0xe0c60, 0xe0c63}, - {0xe0c66, 0xe0c6f}, {0xe0c78, 0xe0c83}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, - {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0cbc, 0xe0cc4}, - {0xe0cc6, 0xe0cc8}, {0xe0cca, 0xe0ccd}, {0xe0ce0, 0xe0ce3}, {0xe0ce6, 0xe0cef}, - {0xe0d00, 0xe0d03}, {0xe0d05, 0xe0d0c}, {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d44}, - {0xe0d46, 0xe0d48}, {0xe0d4a, 0xe0d4f}, {0xe0d54, 0xe0d63}, {0xe0d66, 0xe0d7f}, - {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, {0xe0dc0, 0xe0dc6}, - {0xe0dcf, 0xe0dd4}, {0xe0dd8, 0xe0ddf}, {0xe0de6, 0xe0def}, {0xe0df2, 0xe0df4}, - {0xe0e01, 0xe0e3a}, {0xe0e3f, 0xe0e5b}, {0xe0e94, 0xe0e97}, {0xe0e99, 0xe0e9f}, - {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb9}, {0xe0ebb, 0xe0ebd}, {0xe0ec0, 0xe0ec4}, - {0xe0ec8, 0xe0ecd}, {0xe0ed0, 0xe0ed9}, {0xe0edc, 0xe0edf}, {0xe0f00, 0xe0f47}, - {0xe0f49, 0xe0f6c}, {0xe0f71, 0xe0f97}, {0xe0f99, 0xe0fbc}, {0xe0fbe, 0xe0fcc}, - {0xe0fce, 0xe0fda}, {0xe1000, 0xe10c5}, {0xe10d0, 0xe1248}, {0xe124a, 0xe124d}, - {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, {0xe128a, 0xe128d}, - {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, {0xe12c2, 0xe12c5}, - {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, {0xe1318, 0xe135a}, - {0xe135d, 0xe137c}, {0xe1380, 0xe1399}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, - {0xe1400, 0xe167f}, {0xe1681, 0xe169c}, {0xe16a0, 0xe16f8}, {0xe1700, 0xe170c}, - {0xe170e, 0xe1714}, {0xe1720, 0xe1736}, {0xe1740, 0xe1753}, {0xe1760, 0xe176c}, - {0xe176e, 0xe1770}, {0xe1780, 0xe17dd}, {0xe17e0, 0xe17e9}, {0xe17f0, 0xe17f9}, - {0xe1800, 0xe180d}, {0xe1810, 0xe1819}, {0xe1820, 0xe1877}, {0xe1880, 0xe18aa}, - {0xe18b0, 0xe18f5}, {0xe1900, 0xe191e}, {0xe1920, 0xe192b}, {0xe1930, 0xe193b}, - {0xe1944, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, {0xe19b0, 0xe19c9}, - {0xe19d0, 0xe19da}, {0xe19de, 0xe1a1b}, {0xe1a1e, 0xe1a5e}, {0xe1a60, 0xe1a7c}, - {0xe1a7f, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1aa0, 0xe1aad}, {0xe1ab0, 0xe1abe}, - {0xe1b00, 0xe1b4b}, {0xe1b50, 0xe1b7c}, {0xe1b80, 0xe1bf3}, {0xe1bfc, 0xe1c37}, - {0xe1c3b, 0xe1c49}, {0xe1c4d, 0xe1c88}, {0xe1cc0, 0xe1cc7}, {0xe1cd0, 0xe1cf9}, - {0xe1d00, 0xe1df9}, {0xe1dfb, 0xe1f15}, {0xe1f18, 0xe1f1d}, {0xe1f20, 0xe1f45}, - {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, {0xe1f80, 0xe1fb4}, - {0xe1fb6, 0xe1fc4}, {0xe1fc6, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fdd, 0xe1fef}, - {0xe1ff2, 0xe1ff4}, {0xe1ff6, 0xe1ffe}, {0xe2010, 0xe2027}, {0xe2030, 0xe205e}, - {0xe2074, 0xe208e}, {0xe2090, 0xe209c}, {0xe20a0, 0xe20bf}, {0xe20d0, 0xe20f0}, - {0xe2100, 0xe218b}, {0xe2190, 0xe2426}, {0xe2440, 0xe244a}, {0xe2460, 0xe2b73}, - {0xe2b76, 0xe2b95}, {0xe2b98, 0xe2bb9}, {0xe2bbd, 0xe2bc8}, {0xe2bca, 0xe2bd2}, - {0xe2bec, 0xe2bef}, {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2cf3}, - {0xe2cf9, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d7f, 0xe2d96}, {0xe2da0, 0xe2da6}, - {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, - {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe2de0, 0xe2e49}, - {0xe2e80, 0xe2e99}, {0xe2e9b, 0xe2ef3}, {0xe2f00, 0xe2fd5}, {0xe2ff0, 0xe2ffb}, - {0xe3001, 0xe303f}, {0xe3041, 0xe3096}, {0xe3099, 0xe30ff}, {0xe3105, 0xe312e}, - {0xe3131, 0xe318e}, {0xe3190, 0xe31ba}, {0xe31c0, 0xe31e3}, {0xe31f0, 0xe321e}, - {0xe3220, 0xe32fe}, {0xe3300, 0xe4db5}, {0xe4dc0, 0xe9fea}, {0xea000, 0xea48c}, - {0xea490, 0xea4c6}, {0xea4d0, 0xea62b}, {0xea640, 0xea6f7}, {0xea700, 0xea7ae}, - {0xea7b0, 0xea7b7}, {0xea7f7, 0xea82b}, {0xea830, 0xea839}, {0xea840, 0xea877}, - {0xea880, 0xea8c5}, {0xea8ce, 0xea8d9}, {0xea8e0, 0xea8fd}, {0xea900, 0xea953}, - {0xea95f, 0xea97c}, {0xea980, 0xea9cd}, {0xea9cf, 0xea9d9}, {0xea9de, 0xea9fe}, - {0xeaa00, 0xeaa36}, {0xeaa40, 0xeaa4d}, {0xeaa50, 0xeaa59}, {0xeaa5c, 0xeaac2}, - {0xeaadb, 0xeaaf6}, {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, - {0xeab20, 0xeab26}, {0xeab28, 0xeab2e}, {0xeab30, 0xeab65}, {0xeab70, 0xeabed}, - {0xeabf0, 0xeabf9}, {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, - {0xef900, 0xefa6d}, {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, - {0xefb1d, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbc1}, {0xefbd3, 0xefd3f}, - {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfd}, {0xefe00, 0xefe19}, - {0xefe20, 0xefe52}, {0xefe54, 0xefe66}, {0xefe68, 0xefe6b}, {0xefe70, 0xefe74}, - {0xefe76, 0xefefc}, {0xeff01, 0xeffbe}, {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, - {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, {0xeffe0, 0xeffe6}, {0xeffe8, 0xeffee}, - {0xf0021, 0xf007e}, {0xf00a1, 0xf00ac}, {0xf00ae, 0xf0377}, {0xf037a, 0xf037f}, - {0xf0384, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf052f}, {0xf0531, 0xf0556}, - {0xf0559, 0xf055f}, {0xf0561, 0xf0587}, {0xf058d, 0xf058f}, {0xf0591, 0xf05c7}, - {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f4}, {0xf0606, 0xf061b}, {0xf061e, 0xf06dc}, - {0xf06de, 0xf070d}, {0xf0710, 0xf074a}, {0xf074d, 0xf07b1}, {0xf07c0, 0xf07fa}, - {0xf0800, 0xf082d}, {0xf0830, 0xf083e}, {0xf0840, 0xf085b}, {0xf0860, 0xf086a}, - {0xf08a0, 0xf08b4}, {0xf08b6, 0xf08bd}, {0xf08d4, 0xf08e1}, {0xf08e3, 0xf0983}, - {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, - {0xf09bc, 0xf09c4}, {0xf09cb, 0xf09ce}, {0xf09df, 0xf09e3}, {0xf09e6, 0xf09fd}, - {0xf0a01, 0xf0a03}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, - {0xf0a3e, 0xf0a42}, {0xf0a4b, 0xf0a4d}, {0xf0a59, 0xf0a5c}, {0xf0a66, 0xf0a75}, - {0xf0a81, 0xf0a83}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, {0xf0a93, 0xf0aa8}, - {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0abc, 0xf0ac5}, {0xf0ac7, 0xf0ac9}, - {0xf0acb, 0xf0acd}, {0xf0ae0, 0xf0ae3}, {0xf0ae6, 0xf0af1}, {0xf0af9, 0xf0aff}, - {0xf0b01, 0xf0b03}, {0xf0b05, 0xf0b0c}, {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, - {0xf0b35, 0xf0b39}, {0xf0b3c, 0xf0b44}, {0xf0b4b, 0xf0b4d}, {0xf0b5f, 0xf0b63}, - {0xf0b66, 0xf0b77}, {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, - {0xf0ba8, 0xf0baa}, {0xf0bae, 0xf0bb9}, {0xf0bbe, 0xf0bc2}, {0xf0bc6, 0xf0bc8}, - {0xf0bca, 0xf0bcd}, {0xf0be6, 0xf0bfa}, {0xf0c00, 0xf0c03}, {0xf0c05, 0xf0c0c}, - {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, {0xf0c2a, 0xf0c39}, {0xf0c3d, 0xf0c44}, - {0xf0c46, 0xf0c48}, {0xf0c4a, 0xf0c4d}, {0xf0c58, 0xf0c5a}, {0xf0c60, 0xf0c63}, - {0xf0c66, 0xf0c6f}, {0xf0c78, 0xf0c83}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, - {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0cbc, 0xf0cc4}, - {0xf0cc6, 0xf0cc8}, {0xf0cca, 0xf0ccd}, {0xf0ce0, 0xf0ce3}, {0xf0ce6, 0xf0cef}, - {0xf0d00, 0xf0d03}, {0xf0d05, 0xf0d0c}, {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d44}, - {0xf0d46, 0xf0d48}, {0xf0d4a, 0xf0d4f}, {0xf0d54, 0xf0d63}, {0xf0d66, 0xf0d7f}, - {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, {0xf0dc0, 0xf0dc6}, - {0xf0dcf, 0xf0dd4}, {0xf0dd8, 0xf0ddf}, {0xf0de6, 0xf0def}, {0xf0df2, 0xf0df4}, - {0xf0e01, 0xf0e3a}, {0xf0e3f, 0xf0e5b}, {0xf0e94, 0xf0e97}, {0xf0e99, 0xf0e9f}, - {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb9}, {0xf0ebb, 0xf0ebd}, {0xf0ec0, 0xf0ec4}, - {0xf0ec8, 0xf0ecd}, {0xf0ed0, 0xf0ed9}, {0xf0edc, 0xf0edf}, {0xf0f00, 0xf0f47}, - {0xf0f49, 0xf0f6c}, {0xf0f71, 0xf0f97}, {0xf0f99, 0xf0fbc}, {0xf0fbe, 0xf0fcc}, - {0xf0fce, 0xf0fda}, {0xf1000, 0xf10c5}, {0xf10d0, 0xf1248}, {0xf124a, 0xf124d}, - {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, {0xf128a, 0xf128d}, - {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, {0xf12c2, 0xf12c5}, - {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, {0xf1318, 0xf135a}, - {0xf135d, 0xf137c}, {0xf1380, 0xf1399}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, - {0xf1400, 0xf167f}, {0xf1681, 0xf169c}, {0xf16a0, 0xf16f8}, {0xf1700, 0xf170c}, - {0xf170e, 0xf1714}, {0xf1720, 0xf1736}, {0xf1740, 0xf1753}, {0xf1760, 0xf176c}, - {0xf176e, 0xf1770}, {0xf1780, 0xf17dd}, {0xf17e0, 0xf17e9}, {0xf17f0, 0xf17f9}, - {0xf1800, 0xf180d}, {0xf1810, 0xf1819}, {0xf1820, 0xf1877}, {0xf1880, 0xf18aa}, - {0xf18b0, 0xf18f5}, {0xf1900, 0xf191e}, {0xf1920, 0xf192b}, {0xf1930, 0xf193b}, - {0xf1944, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, {0xf19b0, 0xf19c9}, - {0xf19d0, 0xf19da}, {0xf19de, 0xf1a1b}, {0xf1a1e, 0xf1a5e}, {0xf1a60, 0xf1a7c}, - {0xf1a7f, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1aa0, 0xf1aad}, {0xf1ab0, 0xf1abe}, - {0xf1b00, 0xf1b4b}, {0xf1b50, 0xf1b7c}, {0xf1b80, 0xf1bf3}, {0xf1bfc, 0xf1c37}, - {0xf1c3b, 0xf1c49}, {0xf1c4d, 0xf1c88}, {0xf1cc0, 0xf1cc7}, {0xf1cd0, 0xf1cf9}, - {0xf1d00, 0xf1df9}, {0xf1dfb, 0xf1f15}, {0xf1f18, 0xf1f1d}, {0xf1f20, 0xf1f45}, - {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, {0xf1f80, 0xf1fb4}, - {0xf1fb6, 0xf1fc4}, {0xf1fc6, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fdd, 0xf1fef}, - {0xf1ff2, 0xf1ff4}, {0xf1ff6, 0xf1ffe}, {0xf2010, 0xf2027}, {0xf2030, 0xf205e}, - {0xf2074, 0xf208e}, {0xf2090, 0xf209c}, {0xf20a0, 0xf20bf}, {0xf20d0, 0xf20f0}, - {0xf2100, 0xf218b}, {0xf2190, 0xf2426}, {0xf2440, 0xf244a}, {0xf2460, 0xf2b73}, - {0xf2b76, 0xf2b95}, {0xf2b98, 0xf2bb9}, {0xf2bbd, 0xf2bc8}, {0xf2bca, 0xf2bd2}, - {0xf2bec, 0xf2bef}, {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2cf3}, - {0xf2cf9, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d7f, 0xf2d96}, {0xf2da0, 0xf2da6}, - {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, - {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf2de0, 0xf2e49}, - {0xf2e80, 0xf2e99}, {0xf2e9b, 0xf2ef3}, {0xf2f00, 0xf2fd5}, {0xf2ff0, 0xf2ffb}, - {0xf3001, 0xf303f}, {0xf3041, 0xf3096}, {0xf3099, 0xf30ff}, {0xf3105, 0xf312e}, - {0xf3131, 0xf318e}, {0xf3190, 0xf31ba}, {0xf31c0, 0xf31e3}, {0xf31f0, 0xf321e}, - {0xf3220, 0xf32fe}, {0xf3300, 0xf4db5}, {0xf4dc0, 0xf9fea}, {0xfa000, 0xfa48c}, - {0xfa490, 0xfa4c6}, {0xfa4d0, 0xfa62b}, {0xfa640, 0xfa6f7}, {0xfa700, 0xfa7ae}, - {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa82b}, {0xfa830, 0xfa839}, {0xfa840, 0xfa877}, - {0xfa880, 0xfa8c5}, {0xfa8ce, 0xfa8d9}, {0xfa8e0, 0xfa8fd}, {0xfa900, 0xfa953}, - {0xfa95f, 0xfa97c}, {0xfa980, 0xfa9cd}, {0xfa9cf, 0xfa9d9}, {0xfa9de, 0xfa9fe}, - {0xfaa00, 0xfaa36}, {0xfaa40, 0xfaa4d}, {0xfaa50, 0xfaa59}, {0xfaa5c, 0xfaac2}, - {0xfaadb, 0xfaaf6}, {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, - {0xfab20, 0xfab26}, {0xfab28, 0xfab2e}, {0xfab30, 0xfab65}, {0xfab70, 0xfabed}, - {0xfabf0, 0xfabf9}, {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, - {0xff900, 0xffa6d}, {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, - {0xffb1d, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbc1}, {0xffbd3, 0xffd3f}, - {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfd}, {0xffe00, 0xffe19}, - {0xffe20, 0xffe52}, {0xffe54, 0xffe66}, {0xffe68, 0xffe6b}, {0xffe70, 0xffe74}, - {0xffe76, 0xffefc}, {0xfff01, 0xfffbe}, {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, - {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, {0xfffe0, 0xfffe6}, {0xfffe8, 0xfffee}, - {0x100021, 0x10007e}, {0x1000a1, 0x1000ac}, {0x1000ae, 0x100377}, {0x10037a, 0x10037f}, - {0x100384, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x10052f}, {0x100531, 0x100556}, - {0x100559, 0x10055f}, {0x100561, 0x100587}, {0x10058d, 0x10058f}, {0x100591, 0x1005c7}, - {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f4}, {0x100606, 0x10061b}, {0x10061e, 0x1006dc}, - {0x1006de, 0x10070d}, {0x100710, 0x10074a}, {0x10074d, 0x1007b1}, {0x1007c0, 0x1007fa}, - {0x100800, 0x10082d}, {0x100830, 0x10083e}, {0x100840, 0x10085b}, {0x100860, 0x10086a}, - {0x1008a0, 0x1008b4}, {0x1008b6, 0x1008bd}, {0x1008d4, 0x1008e1}, {0x1008e3, 0x100983}, - {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, - {0x1009bc, 0x1009c4}, {0x1009cb, 0x1009ce}, {0x1009df, 0x1009e3}, {0x1009e6, 0x1009fd}, - {0x100a01, 0x100a03}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, - {0x100a3e, 0x100a42}, {0x100a4b, 0x100a4d}, {0x100a59, 0x100a5c}, {0x100a66, 0x100a75}, - {0x100a81, 0x100a83}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, {0x100a93, 0x100aa8}, - {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100abc, 0x100ac5}, {0x100ac7, 0x100ac9}, - {0x100acb, 0x100acd}, {0x100ae0, 0x100ae3}, {0x100ae6, 0x100af1}, {0x100af9, 0x100aff}, - {0x100b01, 0x100b03}, {0x100b05, 0x100b0c}, {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, - {0x100b35, 0x100b39}, {0x100b3c, 0x100b44}, {0x100b4b, 0x100b4d}, {0x100b5f, 0x100b63}, - {0x100b66, 0x100b77}, {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, - {0x100ba8, 0x100baa}, {0x100bae, 0x100bb9}, {0x100bbe, 0x100bc2}, {0x100bc6, 0x100bc8}, - {0x100bca, 0x100bcd}, {0x100be6, 0x100bfa}, {0x100c00, 0x100c03}, {0x100c05, 0x100c0c}, - {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, {0x100c2a, 0x100c39}, {0x100c3d, 0x100c44}, - {0x100c46, 0x100c48}, {0x100c4a, 0x100c4d}, {0x100c58, 0x100c5a}, {0x100c60, 0x100c63}, - {0x100c66, 0x100c6f}, {0x100c78, 0x100c83}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, - {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100cbc, 0x100cc4}, - {0x100cc6, 0x100cc8}, {0x100cca, 0x100ccd}, {0x100ce0, 0x100ce3}, {0x100ce6, 0x100cef}, - {0x100d00, 0x100d03}, {0x100d05, 0x100d0c}, {0x100d0e, 0x100d10}, {0x100d12, 0x100d44}, - {0x100d46, 0x100d48}, {0x100d4a, 0x100d4f}, {0x100d54, 0x100d63}, {0x100d66, 0x100d7f}, - {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, {0x100dc0, 0x100dc6}, - {0x100dcf, 0x100dd4}, {0x100dd8, 0x100ddf}, {0x100de6, 0x100def}, {0x100df2, 0x100df4}, - {0x100e01, 0x100e3a}, {0x100e3f, 0x100e5b}, {0x100e94, 0x100e97}, {0x100e99, 0x100e9f}, - {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb9}, {0x100ebb, 0x100ebd}, {0x100ec0, 0x100ec4}, - {0x100ec8, 0x100ecd}, {0x100ed0, 0x100ed9}, {0x100edc, 0x100edf}, {0x100f00, 0x100f47}, - {0x100f49, 0x100f6c}, {0x100f71, 0x100f97}, {0x100f99, 0x100fbc}, {0x100fbe, 0x100fcc}, - {0x100fce, 0x100fda}, {0x101000, 0x1010c5}, {0x1010d0, 0x101248}, {0x10124a, 0x10124d}, - {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, {0x10128a, 0x10128d}, - {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, {0x1012c2, 0x1012c5}, - {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, {0x101318, 0x10135a}, - {0x10135d, 0x10137c}, {0x101380, 0x101399}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, - {0x101400, 0x10167f}, {0x101681, 0x10169c}, {0x1016a0, 0x1016f8}, {0x101700, 0x10170c}, - {0x10170e, 0x101714}, {0x101720, 0x101736}, {0x101740, 0x101753}, {0x101760, 0x10176c}, - {0x10176e, 0x101770}, {0x101780, 0x1017dd}, {0x1017e0, 0x1017e9}, {0x1017f0, 0x1017f9}, - {0x101800, 0x10180d}, {0x101810, 0x101819}, {0x101820, 0x101877}, {0x101880, 0x1018aa}, - {0x1018b0, 0x1018f5}, {0x101900, 0x10191e}, {0x101920, 0x10192b}, {0x101930, 0x10193b}, - {0x101944, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, {0x1019b0, 0x1019c9}, - {0x1019d0, 0x1019da}, {0x1019de, 0x101a1b}, {0x101a1e, 0x101a5e}, {0x101a60, 0x101a7c}, - {0x101a7f, 0x101a89}, {0x101a90, 0x101a99}, {0x101aa0, 0x101aad}, {0x101ab0, 0x101abe}, - {0x101b00, 0x101b4b}, {0x101b50, 0x101b7c}, {0x101b80, 0x101bf3}, {0x101bfc, 0x101c37}, - {0x101c3b, 0x101c49}, {0x101c4d, 0x101c88}, {0x101cc0, 0x101cc7}, {0x101cd0, 0x101cf9}, - {0x101d00, 0x101df9}, {0x101dfb, 0x101f15}, {0x101f18, 0x101f1d}, {0x101f20, 0x101f45}, - {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, {0x101f80, 0x101fb4}, - {0x101fb6, 0x101fc4}, {0x101fc6, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fdd, 0x101fef}, - {0x101ff2, 0x101ff4}, {0x101ff6, 0x101ffe}, {0x102010, 0x102027}, {0x102030, 0x10205e}, - {0x102074, 0x10208e}, {0x102090, 0x10209c}, {0x1020a0, 0x1020bf}, {0x1020d0, 0x1020f0}, - {0x102100, 0x10218b}, {0x102190, 0x102426}, {0x102440, 0x10244a}, {0x102460, 0x102b73}, - {0x102b76, 0x102b95}, {0x102b98, 0x102bb9}, {0x102bbd, 0x102bc8}, {0x102bca, 0x102bd2}, - {0x102bec, 0x102bef}, {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102cf3}, - {0x102cf9, 0x102d25}, {0x102d30, 0x102d67}, {0x102d7f, 0x102d96}, {0x102da0, 0x102da6}, - {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, - {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x102de0, 0x102e49}, - {0x102e80, 0x102e99}, {0x102e9b, 0x102ef3}, {0x102f00, 0x102fd5}, {0x102ff0, 0x102ffb}, - {0x103001, 0x10303f}, {0x103041, 0x103096}, {0x103099, 0x1030ff}, {0x103105, 0x10312e}, - {0x103131, 0x10318e}, {0x103190, 0x1031ba}, {0x1031c0, 0x1031e3}, {0x1031f0, 0x10321e}, - {0x103220, 0x1032fe}, {0x103300, 0x104db5}, {0x104dc0, 0x109fea}, {0x10a000, 0x10a48c}, - {0x10a490, 0x10a4c6}, {0x10a4d0, 0x10a62b}, {0x10a640, 0x10a6f7}, {0x10a700, 0x10a7ae}, - {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a82b}, {0x10a830, 0x10a839}, {0x10a840, 0x10a877}, - {0x10a880, 0x10a8c5}, {0x10a8ce, 0x10a8d9}, {0x10a8e0, 0x10a8fd}, {0x10a900, 0x10a953}, - {0x10a95f, 0x10a97c}, {0x10a980, 0x10a9cd}, {0x10a9cf, 0x10a9d9}, {0x10a9de, 0x10a9fe}, - {0x10aa00, 0x10aa36}, {0x10aa40, 0x10aa4d}, {0x10aa50, 0x10aa59}, {0x10aa5c, 0x10aac2}, - {0x10aadb, 0x10aaf6}, {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, - {0x10ab20, 0x10ab26}, {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab65}, {0x10ab70, 0x10abed}, - {0x10abf0, 0x10abf9}, {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, - {0x10f900, 0x10fa6d}, {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, - {0x10fb1d, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbc1}, {0x10fbd3, 0x10fd3f}, - {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfd}, {0x10fe00, 0x10fe19}, - {0x10fe20, 0x10fe52}, {0x10fe54, 0x10fe66}, {0x10fe68, 0x10fe6b}, {0x10fe70, 0x10fe74}, - {0x10fe76, 0x10fefc}, {0x10ff01, 0x10ffbe}, {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, - {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc}, {0x10ffe0, 0x10ffe6}, {0x10ffe8, 0x10ffee} + ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, + {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133}, + {0x10137, 0x1018e}, {0x10190, 0x1019b}, {0x101d0, 0x101fd}, {0x10280, 0x1029c}, + {0x102a0, 0x102d0}, {0x102e0, 0x102fb}, {0x10300, 0x10323}, {0x1032d, 0x1034a}, + {0x10350, 0x1037a}, {0x10380, 0x1039d}, {0x1039f, 0x103c3}, {0x103c8, 0x103d5}, + {0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, + {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755}, + {0x10760, 0x10767}, {0x10800, 0x10805}, {0x1080a, 0x10835}, {0x1083f, 0x10855}, + {0x10857, 0x1089e}, {0x108a7, 0x108af}, {0x108e0, 0x108f2}, {0x108fb, 0x1091b}, + {0x1091f, 0x10939}, {0x10980, 0x109b7}, {0x109bc, 0x109cf}, {0x109d2, 0x10a03}, + {0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a38, 0x10a3a}, + {0x10a3f, 0x10a47}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6}, + {0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72}, + {0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48}, + {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10cfa, 0x10cff}, {0x10e60, 0x10e7e}, + {0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1}, + {0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11143}, + {0x11150, 0x11176}, {0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4}, + {0x11200, 0x11211}, {0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, + {0x1128f, 0x1129d}, {0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9}, + {0x11300, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, + {0x11335, 0x11339}, {0x1133c, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363}, + {0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11400, 0x11459}, {0x11480, 0x114c7}, + {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644}, + {0x11650, 0x11659}, {0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, + {0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2}, + {0x11a00, 0x11a47}, {0x11a50, 0x11a83}, {0x11a86, 0x11a9c}, {0x11a9e, 0x11aa2}, + {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45}, + {0x11c50, 0x11c6c}, {0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6}, + {0x11d00, 0x11d06}, {0x11d0b, 0x11d36}, {0x11d3f, 0x11d47}, {0x11d50, 0x11d59}, + {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474}, {0x12480, 0x12543}, + {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, + {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45}, + {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, + {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x17000, 0x187ec}, + {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb}, {0x1bc00, 0x1bc6a}, + {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, + {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172}, {0x1d17b, 0x1d1e8}, + {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, + {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, + {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, + {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, + {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, + {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006}, {0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, + {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, + {0x1e950, 0x1e959}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, + {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, + {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, + {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, + {0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, + {0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, + {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202}, {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, + {0x1f260, 0x1f265}, {0x1f300, 0x1f6d4}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f8}, + {0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847}, + {0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x1f900, 0x1f90b}, + {0x1f910, 0x1f93e}, {0x1f940, 0x1f94c}, {0x1f950, 0x1f96b}, {0x1f980, 0x1f997}, + {0x1f9d0, 0x1f9e6}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, + {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef} #endif }; @@ -6185,177 +771,14 @@ static const chr graphCharTable[] = { 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd #if TCL_UTF_MAX > 4 - ,0x1038c, 0x10589, 0x1058a, 0x1085e, 0x1098f, 0x10990, 0x109b2, 0x109c7, 0x109c8, - 0x109d7, 0x109dc, 0x109dd, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, - 0x10a38, 0x10a39, 0x10a3c, 0x10a47, 0x10a48, 0x10a51, 0x10a5e, 0x10ab2, 0x10ab3, - 0x10ad0, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b47, 0x10b48, 0x10b56, 0x10b57, - 0x10b5c, 0x10b5d, 0x10b82, 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, - 0x10ba3, 0x10ba4, 0x10bd0, 0x10bd7, 0x10c55, 0x10c56, 0x10cd5, 0x10cd6, 0x10cde, - 0x10cf1, 0x10cf2, 0x10d82, 0x10d83, 0x10dbd, 0x10dca, 0x10dd6, 0x10e81, 0x10e82, - 0x10e84, 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, - 0x10ec6, 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x11772, 0x11773, 0x11940, 0x11f59, - 0x11f5b, 0x11f5d, 0x12070, 0x12071, 0x12d27, 0x12d2d, 0x12d6f, 0x12d70, 0x1fb3e, - 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, 0x1fffc, 0x1fffd, 0x2038c, 0x20589, 0x2058a, - 0x2085e, 0x2098f, 0x20990, 0x209b2, 0x209c7, 0x209c8, 0x209d7, 0x209dc, 0x209dd, - 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, 0x20a38, 0x20a39, 0x20a3c, - 0x20a47, 0x20a48, 0x20a51, 0x20a5e, 0x20ab2, 0x20ab3, 0x20ad0, 0x20b0f, 0x20b10, - 0x20b32, 0x20b33, 0x20b47, 0x20b48, 0x20b56, 0x20b57, 0x20b5c, 0x20b5d, 0x20b82, - 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, - 0x20bd7, 0x20c55, 0x20c56, 0x20cd5, 0x20cd6, 0x20cde, 0x20cf1, 0x20cf2, 0x20d82, - 0x20d83, 0x20dbd, 0x20dca, 0x20dd6, 0x20e81, 0x20e82, 0x20e84, 0x20e87, 0x20e88, - 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20ec6, 0x210c7, 0x210cd, - 0x21258, 0x212c0, 0x21772, 0x21773, 0x21940, 0x21f59, 0x21f5b, 0x21f5d, 0x22070, - 0x22071, 0x22d27, 0x22d2d, 0x22d6f, 0x22d70, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, - 0x2fb44, 0x2fffc, 0x2fffd, 0x3038c, 0x30589, 0x3058a, 0x3085e, 0x3098f, 0x30990, - 0x309b2, 0x309c7, 0x309c8, 0x309d7, 0x309dc, 0x309dd, 0x30a0f, 0x30a10, 0x30a32, - 0x30a33, 0x30a35, 0x30a36, 0x30a38, 0x30a39, 0x30a3c, 0x30a47, 0x30a48, 0x30a51, - 0x30a5e, 0x30ab2, 0x30ab3, 0x30ad0, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b47, - 0x30b48, 0x30b56, 0x30b57, 0x30b5c, 0x30b5d, 0x30b82, 0x30b83, 0x30b99, 0x30b9a, - 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, 0x30bd7, 0x30c55, 0x30c56, - 0x30cd5, 0x30cd6, 0x30cde, 0x30cf1, 0x30cf2, 0x30d82, 0x30d83, 0x30dbd, 0x30dca, - 0x30dd6, 0x30e81, 0x30e82, 0x30e84, 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, - 0x30ea7, 0x30eaa, 0x30eab, 0x30ec6, 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x31772, - 0x31773, 0x31940, 0x31f59, 0x31f5b, 0x31f5d, 0x32070, 0x32071, 0x32d27, 0x32d2d, - 0x32d6f, 0x32d70, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, 0x3fffc, 0x3fffd, - 0x4038c, 0x40589, 0x4058a, 0x4085e, 0x4098f, 0x40990, 0x409b2, 0x409c7, 0x409c8, - 0x409d7, 0x409dc, 0x409dd, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, - 0x40a38, 0x40a39, 0x40a3c, 0x40a47, 0x40a48, 0x40a51, 0x40a5e, 0x40ab2, 0x40ab3, - 0x40ad0, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b47, 0x40b48, 0x40b56, 0x40b57, - 0x40b5c, 0x40b5d, 0x40b82, 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, - 0x40ba3, 0x40ba4, 0x40bd0, 0x40bd7, 0x40c55, 0x40c56, 0x40cd5, 0x40cd6, 0x40cde, - 0x40cf1, 0x40cf2, 0x40d82, 0x40d83, 0x40dbd, 0x40dca, 0x40dd6, 0x40e81, 0x40e82, - 0x40e84, 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, - 0x40ec6, 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x41772, 0x41773, 0x41940, 0x41f59, - 0x41f5b, 0x41f5d, 0x42070, 0x42071, 0x42d27, 0x42d2d, 0x42d6f, 0x42d70, 0x4fb3e, - 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, 0x4fffc, 0x4fffd, 0x5038c, 0x50589, 0x5058a, - 0x5085e, 0x5098f, 0x50990, 0x509b2, 0x509c7, 0x509c8, 0x509d7, 0x509dc, 0x509dd, - 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, 0x50a38, 0x50a39, 0x50a3c, - 0x50a47, 0x50a48, 0x50a51, 0x50a5e, 0x50ab2, 0x50ab3, 0x50ad0, 0x50b0f, 0x50b10, - 0x50b32, 0x50b33, 0x50b47, 0x50b48, 0x50b56, 0x50b57, 0x50b5c, 0x50b5d, 0x50b82, - 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, - 0x50bd7, 0x50c55, 0x50c56, 0x50cd5, 0x50cd6, 0x50cde, 0x50cf1, 0x50cf2, 0x50d82, - 0x50d83, 0x50dbd, 0x50dca, 0x50dd6, 0x50e81, 0x50e82, 0x50e84, 0x50e87, 0x50e88, - 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50ec6, 0x510c7, 0x510cd, - 0x51258, 0x512c0, 0x51772, 0x51773, 0x51940, 0x51f59, 0x51f5b, 0x51f5d, 0x52070, - 0x52071, 0x52d27, 0x52d2d, 0x52d6f, 0x52d70, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, - 0x5fb44, 0x5fffc, 0x5fffd, 0x6038c, 0x60589, 0x6058a, 0x6085e, 0x6098f, 0x60990, - 0x609b2, 0x609c7, 0x609c8, 0x609d7, 0x609dc, 0x609dd, 0x60a0f, 0x60a10, 0x60a32, - 0x60a33, 0x60a35, 0x60a36, 0x60a38, 0x60a39, 0x60a3c, 0x60a47, 0x60a48, 0x60a51, - 0x60a5e, 0x60ab2, 0x60ab3, 0x60ad0, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b47, - 0x60b48, 0x60b56, 0x60b57, 0x60b5c, 0x60b5d, 0x60b82, 0x60b83, 0x60b99, 0x60b9a, - 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, 0x60bd7, 0x60c55, 0x60c56, - 0x60cd5, 0x60cd6, 0x60cde, 0x60cf1, 0x60cf2, 0x60d82, 0x60d83, 0x60dbd, 0x60dca, - 0x60dd6, 0x60e81, 0x60e82, 0x60e84, 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, - 0x60ea7, 0x60eaa, 0x60eab, 0x60ec6, 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x61772, - 0x61773, 0x61940, 0x61f59, 0x61f5b, 0x61f5d, 0x62070, 0x62071, 0x62d27, 0x62d2d, - 0x62d6f, 0x62d70, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, 0x6fffc, 0x6fffd, - 0x7038c, 0x70589, 0x7058a, 0x7085e, 0x7098f, 0x70990, 0x709b2, 0x709c7, 0x709c8, - 0x709d7, 0x709dc, 0x709dd, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, - 0x70a38, 0x70a39, 0x70a3c, 0x70a47, 0x70a48, 0x70a51, 0x70a5e, 0x70ab2, 0x70ab3, - 0x70ad0, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b47, 0x70b48, 0x70b56, 0x70b57, - 0x70b5c, 0x70b5d, 0x70b82, 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, - 0x70ba3, 0x70ba4, 0x70bd0, 0x70bd7, 0x70c55, 0x70c56, 0x70cd5, 0x70cd6, 0x70cde, - 0x70cf1, 0x70cf2, 0x70d82, 0x70d83, 0x70dbd, 0x70dca, 0x70dd6, 0x70e81, 0x70e82, - 0x70e84, 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, - 0x70ec6, 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x71772, 0x71773, 0x71940, 0x71f59, - 0x71f5b, 0x71f5d, 0x72070, 0x72071, 0x72d27, 0x72d2d, 0x72d6f, 0x72d70, 0x7fb3e, - 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, 0x7fffc, 0x7fffd, 0x8038c, 0x80589, 0x8058a, - 0x8085e, 0x8098f, 0x80990, 0x809b2, 0x809c7, 0x809c8, 0x809d7, 0x809dc, 0x809dd, - 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, 0x80a38, 0x80a39, 0x80a3c, - 0x80a47, 0x80a48, 0x80a51, 0x80a5e, 0x80ab2, 0x80ab3, 0x80ad0, 0x80b0f, 0x80b10, - 0x80b32, 0x80b33, 0x80b47, 0x80b48, 0x80b56, 0x80b57, 0x80b5c, 0x80b5d, 0x80b82, - 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, - 0x80bd7, 0x80c55, 0x80c56, 0x80cd5, 0x80cd6, 0x80cde, 0x80cf1, 0x80cf2, 0x80d82, - 0x80d83, 0x80dbd, 0x80dca, 0x80dd6, 0x80e81, 0x80e82, 0x80e84, 0x80e87, 0x80e88, - 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80ec6, 0x810c7, 0x810cd, - 0x81258, 0x812c0, 0x81772, 0x81773, 0x81940, 0x81f59, 0x81f5b, 0x81f5d, 0x82070, - 0x82071, 0x82d27, 0x82d2d, 0x82d6f, 0x82d70, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, - 0x8fb44, 0x8fffc, 0x8fffd, 0x9038c, 0x90589, 0x9058a, 0x9085e, 0x9098f, 0x90990, - 0x909b2, 0x909c7, 0x909c8, 0x909d7, 0x909dc, 0x909dd, 0x90a0f, 0x90a10, 0x90a32, - 0x90a33, 0x90a35, 0x90a36, 0x90a38, 0x90a39, 0x90a3c, 0x90a47, 0x90a48, 0x90a51, - 0x90a5e, 0x90ab2, 0x90ab3, 0x90ad0, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b47, - 0x90b48, 0x90b56, 0x90b57, 0x90b5c, 0x90b5d, 0x90b82, 0x90b83, 0x90b99, 0x90b9a, - 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, 0x90bd7, 0x90c55, 0x90c56, - 0x90cd5, 0x90cd6, 0x90cde, 0x90cf1, 0x90cf2, 0x90d82, 0x90d83, 0x90dbd, 0x90dca, - 0x90dd6, 0x90e81, 0x90e82, 0x90e84, 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, - 0x90ea7, 0x90eaa, 0x90eab, 0x90ec6, 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x91772, - 0x91773, 0x91940, 0x91f59, 0x91f5b, 0x91f5d, 0x92070, 0x92071, 0x92d27, 0x92d2d, - 0x92d6f, 0x92d70, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, 0x9fffc, 0x9fffd, - 0xa038c, 0xa0589, 0xa058a, 0xa085e, 0xa098f, 0xa0990, 0xa09b2, 0xa09c7, 0xa09c8, - 0xa09d7, 0xa09dc, 0xa09dd, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, - 0xa0a38, 0xa0a39, 0xa0a3c, 0xa0a47, 0xa0a48, 0xa0a51, 0xa0a5e, 0xa0ab2, 0xa0ab3, - 0xa0ad0, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b47, 0xa0b48, 0xa0b56, 0xa0b57, - 0xa0b5c, 0xa0b5d, 0xa0b82, 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, - 0xa0ba3, 0xa0ba4, 0xa0bd0, 0xa0bd7, 0xa0c55, 0xa0c56, 0xa0cd5, 0xa0cd6, 0xa0cde, - 0xa0cf1, 0xa0cf2, 0xa0d82, 0xa0d83, 0xa0dbd, 0xa0dca, 0xa0dd6, 0xa0e81, 0xa0e82, - 0xa0e84, 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, - 0xa0ec6, 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa1772, 0xa1773, 0xa1940, 0xa1f59, - 0xa1f5b, 0xa1f5d, 0xa2070, 0xa2071, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2d70, 0xafb3e, - 0xafb40, 0xafb41, 0xafb43, 0xafb44, 0xafffc, 0xafffd, 0xb038c, 0xb0589, 0xb058a, - 0xb085e, 0xb098f, 0xb0990, 0xb09b2, 0xb09c7, 0xb09c8, 0xb09d7, 0xb09dc, 0xb09dd, - 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, 0xb0a38, 0xb0a39, 0xb0a3c, - 0xb0a47, 0xb0a48, 0xb0a51, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0ad0, 0xb0b0f, 0xb0b10, - 0xb0b32, 0xb0b33, 0xb0b47, 0xb0b48, 0xb0b56, 0xb0b57, 0xb0b5c, 0xb0b5d, 0xb0b82, - 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, - 0xb0bd7, 0xb0c55, 0xb0c56, 0xb0cd5, 0xb0cd6, 0xb0cde, 0xb0cf1, 0xb0cf2, 0xb0d82, - 0xb0d83, 0xb0dbd, 0xb0dca, 0xb0dd6, 0xb0e81, 0xb0e82, 0xb0e84, 0xb0e87, 0xb0e88, - 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0ec6, 0xb10c7, 0xb10cd, - 0xb1258, 0xb12c0, 0xb1772, 0xb1773, 0xb1940, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb2070, - 0xb2071, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2d70, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, - 0xbfb44, 0xbfffc, 0xbfffd, 0xc038c, 0xc0589, 0xc058a, 0xc085e, 0xc098f, 0xc0990, - 0xc09b2, 0xc09c7, 0xc09c8, 0xc09d7, 0xc09dc, 0xc09dd, 0xc0a0f, 0xc0a10, 0xc0a32, - 0xc0a33, 0xc0a35, 0xc0a36, 0xc0a38, 0xc0a39, 0xc0a3c, 0xc0a47, 0xc0a48, 0xc0a51, - 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0ad0, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b47, - 0xc0b48, 0xc0b56, 0xc0b57, 0xc0b5c, 0xc0b5d, 0xc0b82, 0xc0b83, 0xc0b99, 0xc0b9a, - 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, 0xc0bd7, 0xc0c55, 0xc0c56, - 0xc0cd5, 0xc0cd6, 0xc0cde, 0xc0cf1, 0xc0cf2, 0xc0d82, 0xc0d83, 0xc0dbd, 0xc0dca, - 0xc0dd6, 0xc0e81, 0xc0e82, 0xc0e84, 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, - 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0ec6, 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc1772, - 0xc1773, 0xc1940, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc2070, 0xc2071, 0xc2d27, 0xc2d2d, - 0xc2d6f, 0xc2d70, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, 0xcfffc, 0xcfffd, - 0xd038c, 0xd0589, 0xd058a, 0xd085e, 0xd098f, 0xd0990, 0xd09b2, 0xd09c7, 0xd09c8, - 0xd09d7, 0xd09dc, 0xd09dd, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, - 0xd0a38, 0xd0a39, 0xd0a3c, 0xd0a47, 0xd0a48, 0xd0a51, 0xd0a5e, 0xd0ab2, 0xd0ab3, - 0xd0ad0, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b47, 0xd0b48, 0xd0b56, 0xd0b57, - 0xd0b5c, 0xd0b5d, 0xd0b82, 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, - 0xd0ba3, 0xd0ba4, 0xd0bd0, 0xd0bd7, 0xd0c55, 0xd0c56, 0xd0cd5, 0xd0cd6, 0xd0cde, - 0xd0cf1, 0xd0cf2, 0xd0d82, 0xd0d83, 0xd0dbd, 0xd0dca, 0xd0dd6, 0xd0e81, 0xd0e82, - 0xd0e84, 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, - 0xd0ec6, 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd1772, 0xd1773, 0xd1940, 0xd1f59, - 0xd1f5b, 0xd1f5d, 0xd2070, 0xd2071, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2d70, 0xdfb3e, - 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, 0xdfffc, 0xdfffd, 0xe038c, 0xe0589, 0xe058a, - 0xe085e, 0xe098f, 0xe0990, 0xe09b2, 0xe09c7, 0xe09c8, 0xe09d7, 0xe09dc, 0xe09dd, - 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, 0xe0a38, 0xe0a39, 0xe0a3c, - 0xe0a47, 0xe0a48, 0xe0a51, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0ad0, 0xe0b0f, 0xe0b10, - 0xe0b32, 0xe0b33, 0xe0b47, 0xe0b48, 0xe0b56, 0xe0b57, 0xe0b5c, 0xe0b5d, 0xe0b82, - 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, - 0xe0bd7, 0xe0c55, 0xe0c56, 0xe0cd5, 0xe0cd6, 0xe0cde, 0xe0cf1, 0xe0cf2, 0xe0d82, - 0xe0d83, 0xe0dbd, 0xe0dca, 0xe0dd6, 0xe0e81, 0xe0e82, 0xe0e84, 0xe0e87, 0xe0e88, - 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0ec6, 0xe10c7, 0xe10cd, - 0xe1258, 0xe12c0, 0xe1772, 0xe1773, 0xe1940, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe2070, - 0xe2071, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2d70, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, - 0xefb44, 0xefffc, 0xefffd, 0xf038c, 0xf0589, 0xf058a, 0xf085e, 0xf098f, 0xf0990, - 0xf09b2, 0xf09c7, 0xf09c8, 0xf09d7, 0xf09dc, 0xf09dd, 0xf0a0f, 0xf0a10, 0xf0a32, - 0xf0a33, 0xf0a35, 0xf0a36, 0xf0a38, 0xf0a39, 0xf0a3c, 0xf0a47, 0xf0a48, 0xf0a51, - 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0ad0, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b47, - 0xf0b48, 0xf0b56, 0xf0b57, 0xf0b5c, 0xf0b5d, 0xf0b82, 0xf0b83, 0xf0b99, 0xf0b9a, - 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, 0xf0bd7, 0xf0c55, 0xf0c56, - 0xf0cd5, 0xf0cd6, 0xf0cde, 0xf0cf1, 0xf0cf2, 0xf0d82, 0xf0d83, 0xf0dbd, 0xf0dca, - 0xf0dd6, 0xf0e81, 0xf0e82, 0xf0e84, 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, - 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0ec6, 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf1772, - 0xf1773, 0xf1940, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf2070, 0xf2071, 0xf2d27, 0xf2d2d, - 0xf2d6f, 0xf2d70, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, 0xffffc, 0xffffd, - 0x10038c, 0x100589, 0x10058a, 0x10085e, 0x10098f, 0x100990, 0x1009b2, 0x1009c7, 0x1009c8, - 0x1009d7, 0x1009dc, 0x1009dd, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, - 0x100a38, 0x100a39, 0x100a3c, 0x100a47, 0x100a48, 0x100a51, 0x100a5e, 0x100ab2, 0x100ab3, - 0x100ad0, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b47, 0x100b48, 0x100b56, 0x100b57, - 0x100b5c, 0x100b5d, 0x100b82, 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, - 0x100ba3, 0x100ba4, 0x100bd0, 0x100bd7, 0x100c55, 0x100c56, 0x100cd5, 0x100cd6, 0x100cde, - 0x100cf1, 0x100cf2, 0x100d82, 0x100d83, 0x100dbd, 0x100dca, 0x100dd6, 0x100e81, 0x100e82, - 0x100e84, 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, - 0x100ec6, 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x101772, 0x101773, 0x101940, 0x101f59, - 0x101f5b, 0x101f5d, 0x102070, 0x102071, 0x102d27, 0x102d2d, 0x102d6f, 0x102d70, 0x10fb3e, - 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44, 0x10fffc, 0x10fffd + ,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, + 0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333, + 0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x118ff, 0x11d08, 0x11d09, + 0x11d3a, 0x11d3c, 0x11d3d, 0x16a6e, 0x16a6f, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f, + 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, + 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, + 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, + 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f9c0 #endif }; diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 5ed5d5d..088f314 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -21,7 +21,9 @@ #include #include #include +#ifdef HAVE_EVENTFD #include +#endif /* HAVE_EVENTFD */ #include #include -- cgit v0.12 From 5c4bb0f4e9e073df2b65f086dd9660cd344dcb26 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Jun 2017 17:57:33 +0000 Subject: Revert performance optimization as first step to providing a refactored one. --- generic/tclExecute.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 30ef536..cfcdd26 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2685,34 +2685,11 @@ TEBCresume( opnd = TclGetUInt1AtPtr(pc+1); - objv = &OBJ_AT_DEPTH(opnd-1); - /* minor optimization in simplest cases */ - switch (opnd) { - case 1: /* only one object */ - objResultPtr = *objv; - goto endINST_STR_CONCAT1; - case 2: /* two objects - check empty */ - if (objv[0]->bytes == &tclEmptyString) { - objResultPtr = objv[1]; - goto endINST_STR_CONCAT1; - } - else - if (objv[1]->bytes == &tclEmptyString) { - objResultPtr = objv[0]; - goto endINST_STR_CONCAT1; - } - break; - case 0: /* no objects - use new empty */ - TclNewObj(objResultPtr); - goto endINST_STR_CONCAT1; - } - /* do concat */ if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - opnd, objv, &objResultPtr)) { + opnd, &OBJ_AT_DEPTH(opnd-1), &objResultPtr)) { TRACE_ERROR(interp); goto gotError; } - endINST_STR_CONCAT1: TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(2, opnd, 1); -- cgit v0.12 From cb68061d12f2680e86ea13986fd98eabbe706537 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Jun 2017 20:03:19 +0000 Subject: Optimize TclStringCatObjv() for case when only one argument is non-empty. --- generic/tclStringObj.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 3478cbb..a4c242a 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2848,7 +2848,7 @@ TclStringCatObjv( Tcl_Obj **objPtrPtr) { Tcl_Obj *objPtr, *objResultPtr, * const *ov; - int oc, length = 0, binary = 1, first = 0; + int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; /* assert (objc >= 2) */ @@ -2904,8 +2904,11 @@ TclStringCatObjv( int numBytes; Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */ - if (length == 0) { - first = objc - oc - 1; + if (numBytes) { + last = objc - oc - 1; + if (length == 0) { + first = last; + } } length += numBytes; } @@ -2920,8 +2923,11 @@ TclStringCatObjv( int numChars; Tcl_GetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ - if (length == 0) { - first = objc - oc - 1; + if (numChars) { + last = objc - oc - 1; + if (length == 0) { + first = last; + } } length += numChars; } @@ -2935,8 +2941,11 @@ TclStringCatObjv( objPtr = *ov++; Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if ((length == 0) && numBytes) { - first = objc - oc - 1; + if (numBytes) { + last = objc - oc - 1; + if (length == 0) { + first = last; + } } length += numBytes; } @@ -2956,8 +2965,13 @@ TclStringCatObjv( *objPtrPtr = objv[0]; return TCL_OK; } + if (last == first) { + /* Only one non-empty value; return it */ + *objPtrPtr = objv[first]; + return TCL_OK; + } - objv += first; objc -= first; + objv += first; objc = (last - first + 1); if (binary) { /* Efficiently produce a pure byte array result */ -- cgit v0.12 From 3d8a0152affb0feac24a3e9b6272e7c2badb050f Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 6 Jun 2017 08:34:00 +0000 Subject: small code review: don't need to check length if unchanged + the same case if 0 length --- generic/tclStringObj.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index a4c242a..c1c15f2 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2897,7 +2897,7 @@ TclStringCatObjv( if (binary) { /* Result will be pure byte array. Pre-size it */ ov = objv; oc = objc; - while (oc-- && (length >= 0)) { + while (oc--) { objPtr = *ov++; if (objPtr->bytes == NULL) { @@ -2909,14 +2909,16 @@ TclStringCatObjv( if (length == 0) { first = last; } + if ((length += numBytes) < 0) { + break; /* overflow */ + } } - length += numBytes; } } } else if (allowUniChar && requestUniChar) { /* Result will be pure Tcl_UniChar array. Pre-size it. */ ov = objv; oc = objc; - while (oc-- && (length >= 0)) { + while (oc--) { objPtr = *ov++; if ((objPtr->bytes == NULL) || (objPtr->length)) { @@ -2929,13 +2931,15 @@ TclStringCatObjv( first = last; } } - length += numChars; + if ((length += numChars) < 0) { + break; /* overflow */ + } } } } else { /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; - while (oc-- && (length >= 0)) { + while (oc--) { int numBytes; objPtr = *ov++; @@ -2946,11 +2950,19 @@ TclStringCatObjv( if (length == 0) { first = last; } + if ((length += numBytes) < 0) { + break; /* overflow */ + } } - length += numBytes; } } + if (last == first || length == 0) { + /* Only one non-empty value or zero length; return first */ + *objPtrPtr = objv[first]; + return TCL_OK; + } + if (length < 0) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2960,17 +2972,6 @@ TclStringCatObjv( return TCL_ERROR; } - if (length == 0) { - /* Total length of zero means every value has length zero */ - *objPtrPtr = objv[0]; - return TCL_OK; - } - if (last == first) { - /* Only one non-empty value; return it */ - *objPtrPtr = objv[first]; - return TCL_OK; - } - objv += first; objc = (last - first + 1); if (binary) { -- cgit v0.12 From 7edce7686e817824758808dfba651a68c00558dd Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 6 Jun 2017 09:01:18 +0000 Subject: amend to [eac4656f1e8cf793] (moved to scope where numChars != 0 in Unicode case) --- generic/tclStringObj.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c1c15f2..6332e9f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2930,9 +2930,9 @@ TclStringCatObjv( if (length == 0) { first = last; } - } - if ((length += numChars) < 0) { - break; /* overflow */ + if ((length += numChars) < 0) { + break; /* overflow */ + } } } } -- cgit v0.12 From 615771f0b6f577cc8f23a668314bdf5cd8309a59 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 6 Jun 2017 09:25:00 +0000 Subject: makes TclStringCatObjv safe accepting objc = 0 (or 1), then fast exits with new object / first; check-cycles rewritten to be still more faster. --- generic/tclStringObj.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6332e9f..b78394e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2851,7 +2851,11 @@ TclStringCatObjv( int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; - /* assert (objc >= 2) */ + if (objc <= 1) { + /* Only one or no objects; return first or empty */ + *objPtrPtr = objc ? objv[0] : Tcl_NewObj(); + return TCL_OK; + } /* * Analyze to determine what representation result should be. @@ -2861,7 +2865,7 @@ TclStringCatObjv( */ ov = objv, oc = objc; - while (oc-- && (binary || allowUniChar)) { + do { objPtr = *ov++; if (objPtr->bytes) { @@ -2892,12 +2896,12 @@ TclStringCatObjv( } } } - } + } while (--oc && (binary || allowUniChar)); if (binary) { /* Result will be pure byte array. Pre-size it */ ov = objv; oc = objc; - while (oc--) { + do { objPtr = *ov++; if (objPtr->bytes == NULL) { @@ -2905,7 +2909,7 @@ TclStringCatObjv( Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes) { - last = objc - oc - 1; + last = objc - oc; if (length == 0) { first = last; } @@ -2914,11 +2918,11 @@ TclStringCatObjv( } } } - } + } while (--oc); } else if (allowUniChar && requestUniChar) { /* Result will be pure Tcl_UniChar array. Pre-size it. */ ov = objv; oc = objc; - while (oc--) { + do { objPtr = *ov++; if ((objPtr->bytes == NULL) || (objPtr->length)) { @@ -2926,7 +2930,7 @@ TclStringCatObjv( Tcl_GetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ if (numChars) { - last = objc - oc - 1; + last = objc - oc; if (length == 0) { first = last; } @@ -2935,18 +2939,18 @@ TclStringCatObjv( } } } - } + } while (--oc); } else { /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; - while (oc--) { + do { int numBytes; objPtr = *ov++; Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes) { - last = objc - oc - 1; + last = objc - oc; if (length == 0) { first = last; } @@ -2954,7 +2958,7 @@ TclStringCatObjv( break; /* overflow */ } } - } + } while (--oc); } if (last == first || length == 0) { -- cgit v0.12 From b0146fbd504c02b6561813c75835ac8333f22805 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Jun 2017 12:56:37 +0000 Subject: A few more tweaks to streamline and clarify. --- generic/tclStringObj.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index b78394e..aae52ba 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2851,12 +2851,16 @@ TclStringCatObjv( int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; + /* assert ( objc >= 0 ) */ + if (objc <= 1) { /* Only one or no objects; return first or empty */ *objPtrPtr = objc ? objv[0] : Tcl_NewObj(); return TCL_OK; } + /* assert ( objc >= 2 ) */ + /* * Analyze to determine what representation result should be. * GOALS: Avoid shimmering & string rep generation. @@ -2914,7 +2918,7 @@ TclStringCatObjv( first = last; } if ((length += numBytes) < 0) { - break; /* overflow */ + goto overflow; } } } @@ -2935,7 +2939,7 @@ TclStringCatObjv( first = last; } if ((length += numChars) < 0) { - break; /* overflow */ + goto overflow; } } } @@ -2955,27 +2959,19 @@ TclStringCatObjv( first = last; } if ((length += numBytes) < 0) { - break; /* overflow */ + goto overflow; } } } while (--oc); } - if (last == first || length == 0) { + if (last == first /*|| length == 0 */) { /* Only one non-empty value or zero length; return first */ + /* NOTE: (length == 0) implies (last == first) */ *objPtrPtr = objv[first]; return TCL_OK; } - if (length < 0) { - if (interp) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "max size for a Tcl value (%d bytes) exceeded", INT_MAX)); - Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); - } - return TCL_ERROR; - } - objv += first; objc = (last - first + 1); if (binary) { @@ -3106,6 +3102,14 @@ TclStringCatObjv( } *objPtrPtr = objResultPtr; return TCL_OK; + + overflow: + if (interp) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "max size for a Tcl value (%d bytes) exceeded", INT_MAX)); + Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); + } + return TCL_ERROR; } /* -- cgit v0.12 From b796f3dee76ec3094af593f2ac16b321c4bdb720 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 16:44:51 +0000 Subject: When possible delay string rep generation until necessary. --- generic/tclStringObj.c | 56 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index aae52ba..be71109 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2847,7 +2847,7 @@ TclStringCatObjv( Tcl_Obj * const objv[], Tcl_Obj **objPtrPtr) { - Tcl_Obj *objPtr, *objResultPtr, * const *ov; + Tcl_Obj *objPtr, *objResultPtr, * const *ov, *pendingPtr = NULL; int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; @@ -2952,14 +2952,37 @@ TclStringCatObjv( objPtr = *ov++; - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if (numBytes) { + if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { + /* No string rep; Take the chance we can avoid making it */ + last = objc - oc; - if (length == 0) { - first = last; - } - if ((length += numBytes) < 0) { - goto overflow; + first = last; + pendingPtr = objPtr; + } else { + + Tcl_GetStringFromObj(objPtr, &numBytes);/* PANIC? */ + if (numBytes) { + last = objc - oc; + if (length == 0) { + if (pendingPtr) { + int pendingNumBytes; + + Tcl_GetStringFromObj(pendingPtr, &pendingNumBytes); /* PANIC? */ + if (pendingNumBytes) { + if ((length += pendingNumBytes) < 0) { + goto overflow; + } + } else { + first = last; + } + pendingPtr = NULL; + } else { + first = last; + } + } + if ((length += numBytes) < 0) { + goto overflow; + } } } } while (--oc); @@ -3056,13 +3079,18 @@ TclStringCatObjv( } else { /* Efficiently concatenate string reps */ char *dst; + int start; if (inPlace && !Tcl_IsShared(*objv)) { - int start; - objResultPtr = *objv++; objc--; Tcl_GetStringFromObj(objResultPtr, &start); + if (pendingPtr) { + /* assert ( pendingPtr == objResultPtr ) */ + if ((length += start) < 0) { + goto overflow; + } + } if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3075,8 +3103,16 @@ TclStringCatObjv( dst = Tcl_GetString(objResultPtr) + start; if (length > start) { TclFreeIntRep(objResultPtr); + } else { + /* Can't happen ? */ } } else { + if (pendingPtr) { + Tcl_GetStringFromObj(pendingPtr, &start); + if ((length += start) < 0) { + goto overflow; + } + } objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { -- cgit v0.12 From c3483863885b717816b97ace4638bdbd508fe6f6 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 19:35:05 +0000 Subject: Tests for string rep generation suppression --- tests/string.test | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/string.test b/tests/string.test index fa7f8fb..9c43f29 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1994,6 +1994,36 @@ test string-29.4 {string cat, many args} { set r2 [string compare $xx [eval "string cat $vvs"]] list $r1 $r2 } {0 0} +test string-29.5 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list x] [list]] +} -match glob -result {*no string representation} +test string-29.6 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list] [list x]] +} -match glob -result {*no string representation} +test string-29.7 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list x] [list] [list]] +} -match glob -result {*no string representation} +test string-29.8 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list] [list x] [list]] +} -match glob -result {*no string representation} +test string-29.9 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list] [list] [list x]] +} -match glob -result {*no string representation} +test string-29.10 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list x] [list x]] +} -match glob -result {*, string representation "xx"} +test string-29.11 {string cat, efficiency} -body { + tcl::unsupported::representation \ + [string cat [list x] [encoding convertto utf-8 {}]] +} -match glob -result {*no string representation} +test string-29.12 {string cat, efficiency} -body { + tcl::unsupported::representation \ + [string cat [encoding convertto utf-8 {}] [list x]] +} -match glob -result {*, string representation "x"} +test string-29.13 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat \ + [encoding convertto utf-8 {}] [encoding convertto utf-8 {}] [list x]] +} -match glob -result {*, string representation "x"} -- cgit v0.12 From 7673d614a9fe445baae517d64bb8a751970024c9 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 20:31:47 +0000 Subject: pendingPtr == NULL implies (last == first) implies early out --- generic/tclStringObj.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index be71109..847182d 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2847,7 +2847,7 @@ TclStringCatObjv( Tcl_Obj * const objv[], Tcl_Obj **objPtrPtr) { - Tcl_Obj *objPtr, *objResultPtr, * const *ov, *pendingPtr = NULL; + Tcl_Obj *objPtr, *objResultPtr, * const *ov; int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; @@ -2945,6 +2945,8 @@ TclStringCatObjv( } } while (--oc); } else { + Tcl_Obj *pendingPtr = NULL; + /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { @@ -2975,7 +2977,6 @@ TclStringCatObjv( } else { first = last; } - pendingPtr = NULL; } else { first = last; } @@ -3085,12 +3086,6 @@ TclStringCatObjv( objResultPtr = *objv++; objc--; Tcl_GetStringFromObj(objResultPtr, &start); - if (pendingPtr) { - /* assert ( pendingPtr == objResultPtr ) */ - if ((length += start) < 0) { - goto overflow; - } - } if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3107,12 +3102,6 @@ TclStringCatObjv( /* Can't happen ? */ } } else { - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &start); - if ((length += start) < 0) { - goto overflow; - } - } objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { -- cgit v0.12 From 36d9205d974a58b5030d7c1b1ddfb27ff04d7f7c Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 20:40:45 +0000 Subject: More streamlining. --- generic/tclStringObj.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 847182d..c4d07e0 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2967,17 +2967,9 @@ TclStringCatObjv( last = objc - oc; if (length == 0) { if (pendingPtr) { - int pendingNumBytes; - - Tcl_GetStringFromObj(pendingPtr, &pendingNumBytes); /* PANIC? */ - if (pendingNumBytes) { - if ((length += pendingNumBytes) < 0) { - goto overflow; - } - } else { - first = last; - } - } else { + Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ + } + if (length == 0) { first = last; } } @@ -3080,9 +3072,10 @@ TclStringCatObjv( } else { /* Efficiently concatenate string reps */ char *dst; - int start; if (inPlace && !Tcl_IsShared(*objv)) { + int start; + objResultPtr = *objv++; objc--; Tcl_GetStringFromObj(objResultPtr, &start); -- cgit v0.12 From de1c1f0f476262cad9b20a69be5d8c15fd3a9be6 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 20:57:06 +0000 Subject: More streamlining --- generic/tclStringObj.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c4d07e0..31a6b26 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2962,20 +2962,20 @@ TclStringCatObjv( pendingPtr = objPtr; } else { - Tcl_GetStringFromObj(objPtr, &numBytes);/* PANIC? */ - if (numBytes) { - last = objc - oc; - if (length == 0) { - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ - } - if (length == 0) { - first = last; - } - } - if ((length += numBytes) < 0) { - goto overflow; - } + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + if (numBytes == 0) { + continue; + } + last = objc - oc; + if (pendingPtr) { + Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ + pendingPtr = NULL; + } + if (length == 0) { + first = last; + } + if ((length += numBytes) < 0) { + goto overflow; } } } while (--oc); -- cgit v0.12 From cc72d116bdbf58771070b191dc48c28de07462b1 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 21:05:22 +0000 Subject: Modernize overflow checks. --- generic/tclStringObj.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 31a6b26..43f8016 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2916,10 +2916,10 @@ TclStringCatObjv( last = objc - oc; if (length == 0) { first = last; - } - if ((length += numBytes) < 0) { + } else if (numBytes > INT_MAX - length) { goto overflow; } + length += numBytes; } } } while (--oc); @@ -2937,10 +2937,10 @@ TclStringCatObjv( last = objc - oc; if (length == 0) { first = last; - } - if ((length += numChars) < 0) { + } else if (numChars > INT_MAX - length) { goto overflow; } + length += numChars; } } } while (--oc); @@ -2973,10 +2973,10 @@ TclStringCatObjv( } if (length == 0) { first = last; - } - if ((length += numBytes) < 0) { + } else if (numBytes > INT_MAX - length) { goto overflow; } + length += numBytes; } } while (--oc); } -- cgit v0.12 From 4b81f6ff43bff6569658b4b34f03c40ca72b4df7 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 21:10:01 +0000 Subject: Don't test the impossible. --- generic/tclStringObj.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 43f8016..aa99545 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3089,11 +3089,9 @@ TclStringCatObjv( return TCL_ERROR; } dst = Tcl_GetString(objResultPtr) + start; - if (length > start) { - TclFreeIntRep(objResultPtr); - } else { - /* Can't happen ? */ - } + + /* assert ( length > start ) */ + TclFreeIntRep(objResultPtr); } else { objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { -- cgit v0.12 From 2712a556fb87afc34f52a435a6b39ad81aa20a16 Mon Sep 17 00:00:00 2001 From: griffin Date: Mon, 12 Jun 2017 14:04:29 +0000 Subject: Add support of 0d in the format %# conversion flag. Add tests for same. --- doc/format.n | 16 +++++++++------- generic/tclStringObj.c | 4 ++++ tests/format.test | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/doc/format.n b/doc/format.n index ba044f2..a386464 100644 --- a/doc/format.n +++ b/doc/format.n @@ -83,14 +83,16 @@ Specifies that the number should be padded on the left with zeroes instead of spaces. .TP 10 \fB#\fR -Requests an alternate output form. For \fBo\fR and \fBO\fR -conversions it guarantees that the first digit is always \fB0\fR. -For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) -will be added to the beginning of the result unless it is zero. +Requests an alternate output form. For \fBo\fR and \fBO\fR +conversions it guarantees that the first digit is always \fB0\fR. +For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) +will be added to the beginning of the result unless it is zero. For \fBb\fR conversions, \fB0b\fR -will be added to the beginning of the result unless it is zero. -For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR, -\fBg\fR, and \fBG\fR) it guarantees that the result always +will be added to the beginning of the result unless it is zero. +For \fBd\fR conversions, \fB0d\fR will be added to the beginning +of the result unless it is zero. +For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR, +\fBg\fR, and \fBG\fR) it guarantees that the result always has a decimal point. For \fBg\fR and \fBG\fR conversions it specifies that trailing zeroes should not be removed. diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7c898b7..3a6e60e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2039,6 +2039,10 @@ Tcl_AppendFormatToObj( Tcl_AppendToObj(segment, "0b", 2); segmentLimit -= 2; break; + case 'd': + Tcl_AppendToObj(segment, "0d", 2); + segmentLimit -= 2; + break; } } diff --git a/tests/format.test b/tests/format.test index 722ad21..577365b 100644 --- a/tests/format.test +++ b/tests/format.test @@ -79,6 +79,25 @@ test format-1.11.1 {integer formatting} longIs64bit { test format-1.12 {integer formatting} { format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] } {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} +test format-1.13 {integer formatting} longIs32bit { + format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12} +test format-1.13.1 {integer formatting} longIs64bit { + format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12} +test format-1.14 {integer formatting} longIs32bit { + format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} { 0d0 0d6 0d34 0d16923 -0d12} +test format-1.14.1 {integer formatting} longIs64bit { + format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} { 0d0 0d6 0d34 0d16923 -0d12} +test format-1.15 {integer formatting} longIs32bit { + format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12 } +test format-1.15.1 {integer formatting} longIs64bit { + format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12 } + test format-2.1 {string formatting} { format "%s %s %c %s" abcd {This is a very long test string.} 120 x -- cgit v0.12 From ad34457a54e73f30298e2452226cf979662ef8a8 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 13 Jun 2017 11:10:11 +0000 Subject: Add tests and docs. --- doc/define.n | 15 ++++++++ tests/oo.test | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/doc/define.n b/doc/define.n index 7599ec0..1692c94 100644 --- a/doc/define.n +++ b/doc/define.n @@ -142,6 +142,8 @@ be afterwards. \fBself\fI subcommand arg ...\fR .TP \fBself\fI script\fR +.TP +\fBself\fR . This command is equivalent to calling \fBoo::objdefine\fR on the class being defined (see \fBCONFIGURING OBJECTS\fR below for a description of the @@ -151,6 +153,13 @@ and .QW "\fBoo::define \fIcls \fBself \fIsubcommand ...\fR" operates identically to .QW "\fBoo::objdefine \fIcls subcommand ...\fR" . +.RS +.PP +.VS TIP470 +If no arguments at all are used, this gives the name of the class currently +being configured. +.VE TIP470 +.RE .TP \fBsuperclass\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR? .VS @@ -265,6 +274,12 @@ not previously refer to a method in that object. Does not affect the classes that the object is an instance of. Does not change the export status of the method; if it was exported before, it will be afterwards. .TP +\fBself \fR +. +.VS TIP470 +This gives the name of the object currently being configured. +.VE TIP470 +.TP \fBunexport\fI name \fR?\fIname ...\fR? . This arranges for each of the named methods, \fIname\fR, to be not exported diff --git a/tests/oo.test b/tests/oo.test index e03911b..ae36f87 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -3766,6 +3766,113 @@ test oo-35.4 {Bug 593baa032c: mixins list teardown} { namespace eval [info object namespace D] [list [namespace which B] destroy] } {} +test oo-36.1 {TIP #470: introspection within oo::define} { + oo::define oo::object self +} ::oo::object +test oo-36.2 {TIP #470: introspection within oo::define} -setup { + oo::class create Cls +} -body { + oo::define Cls self +} -cleanup { + Cls destroy +} -result ::Cls +test oo-36.3 {TIP #470: introspection within oo::define} -setup { + oo::class create Super + set result uncalled +} -body { + oo::class create Sub { + superclass Super + ::set ::result [self] + } + return $result +} -cleanup { + Super destroy +} -result ::Sub +test oo-36.4 {TIP #470: introspection within oo::define} -setup { + oo::class create Super + set result uncalled +} -body { + oo::class create Sub { + superclass Super + ::set ::result [self {}] + } + return $result +} -cleanup { + Super destroy +} -result {} +test oo-36.5 {TIP #470: introspection within oo::define} -setup { + oo::class create Super + set result uncalled +} -body { + oo::class create Sub { + superclass Super + ::set ::result [self self] + } +} -cleanup { + Super destroy +} -result ::Sub +test oo-36.6 {TIP #470: introspection within oo::objdefine} -setup { + oo::class create Cls + set result uncalled +} -body { + Cls create obj + oo::objdefine obj { + ::set ::result [self] + } +} -cleanup { + Cls destroy +} -result ::obj +test oo-36.7 {TIP #470: introspection within oo::objdefine} -setup { + oo::class create Cls +} -body { + Cls create obj + oo::objdefine obj { + self + } +} -cleanup { + Cls destroy +} -result ::obj +test oo-36.8 {TIP #470: introspection within oo::objdefine} -setup { + oo::class create Cls +} -body { + Cls create obj + oo::objdefine obj { + self anything + } +} -returnCodes error -cleanup { + Cls destroy +} -result {wrong # args: should be "self"} +test oo-36.9 {TIP #470: introspection within oo::define} -setup { + oo::class create Cls + set result uncalled +} -body { + proc oo::define::testself {} { + global result + set result [list [catch {self} msg] $msg \ + [catch {uplevel 1 self} msg] $msg] + return + } + list [oo::define Cls testself] $result +} -cleanup { + Cls destroy + catch {rename oo::define::testself {}} +} -result {{} {1 {this command may only be called from within the context of an ::oo::define or ::oo::objdefine command} 0 ::Cls}} +test oo-36.10 {TIP #470: introspection within oo::define} -setup { + oo::class create Cls + set result uncalled +} -body { + proc oo::objdefine::testself {} { + global result + set result [list [catch {self} msg] $msg \ + [catch {uplevel 1 self} msg] $msg] + return + } + Cls create obj + list [oo::objdefine obj testself] $result +} -cleanup { + Cls destroy + catch {rename oo::objdefine::testself {}} +} -result {{} {1 {this command may only be called from within the context of an ::oo::define or ::oo::objdefine command} 0 ::obj}} cleanupTests return -- cgit v0.12 From d453cdacec7e2a1f623fda752e0b4bf163d33ed9 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 14 Jun 2017 21:42:38 +0000 Subject: [f2336c116b] Move pragmas to make gcc happy; it is pickier than clang. --- unix/tclUnixSock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 2353f94..c0df035 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -730,6 +730,8 @@ TcpClose2Proc( */ #ifndef NEED_FAKE_RFC2553 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" static inline int IPv6AddressNeedsNumericRendering( struct in6_addr addr) @@ -743,16 +745,14 @@ IPv6AddressNeedsNumericRendering( * at least some versions of OSX. */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" if (!IN6_IS_ADDR_V4MAPPED(&addr)) { -#pragma GCC diagnostic pop return 0; } return (addr.s6_addr[12] == 0 && addr.s6_addr[13] == 0 && addr.s6_addr[14] == 0 && addr.s6_addr[15] == 0); } +#pragma GCC diagnostic pop #endif /* NEED_FAKE_RFC2553 */ static void -- cgit v0.12 From 6123ba004cf246d014231b6030560c8b9cae3934 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 11:47:46 +0000 Subject: Better define the meaning of "first" and "last". --- generic/tclStringObj.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index aa99545..0a38836 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2848,8 +2848,10 @@ TclStringCatObjv( Tcl_Obj **objPtrPtr) { Tcl_Obj *objPtr, *objResultPtr, * const *ov; - int oc, length = 0, binary = 1, first = 0, last = 0; + int oc, length = 0, binary = 1; int allowUniChar = 1, requestUniChar = 0; + int first = objc - 1; /* Index of first value possibly not empty */ + int last = 0; /* Index of last value possibly not empty */ /* assert ( objc >= 0 ) */ @@ -2981,9 +2983,9 @@ TclStringCatObjv( } while (--oc); } - if (last == first /*|| length == 0 */) { + if (last <= first /*|| length == 0 */) { /* Only one non-empty value or zero length; return first */ - /* NOTE: (length == 0) implies (last == first) */ + /* NOTE: (length == 0) implies (last <= first) */ *objPtrPtr = objv[first]; return TCL_OK; } -- cgit v0.12 From 9ddb31d52221fb3db41becc2bd840658338f73e6 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 12:56:03 +0000 Subject: Extend cases where string rep generation can be prevented. --- generic/tclStringObj.c | 16 ++++++++++++++++ tests/string.test | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 0a38836..261e01f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2966,9 +2966,25 @@ TclStringCatObjv( Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes == 0) { + if (pendingPtr && pendingPtr->bytes) { + /* + * Generating string rep of objPtr also + * generated string rep of pendingPtr. + */ + if (pendingPtr->length) { + /* Can this happen? */ + goto foo; + } else { + /* string-29.14 */ + first = objc - 1; + last = 0; + pendingPtr = NULL; + } + } continue; } last = objc - oc; +foo: if (pendingPtr) { Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ pendingPtr = NULL; diff --git a/tests/string.test b/tests/string.test index 9c43f29..7b02928 100644 --- a/tests/string.test +++ b/tests/string.test @@ -2024,6 +2024,21 @@ test string-29.13 {string cat, efficiency} -body { tcl::unsupported::representation [string cat \ [encoding convertto utf-8 {}] [encoding convertto utf-8 {}] [list x]] } -match glob -result {*, string representation "x"} +test string-29.14 {string cat, efficiency} -setup { + set e [encoding convertto utf-8 {}] +} -cleanup { + unset e +} -body { + tcl::unsupported::representation [string cat $e $e [list x]] +} -match glob -result {*no string representation} +test string-29.15 {string cat, efficiency} -setup { + set e [encoding convertto utf-8 {}] + set f [encoding convertto utf-8 {}] +} -cleanup { + unset e f +} -body { + tcl::unsupported::representation [string cat $e $f $e $f [list x]] +} -match glob -result {*no string representation} -- cgit v0.12 From aca86a46ffe59bb150f404efaf410cadc401a6f1 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 14:43:16 +0000 Subject: Rework the logic. Equivalent function. --- generic/tclStringObj.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 261e01f..587ba76 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2965,32 +2965,22 @@ TclStringCatObjv( } else { Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if (numBytes == 0) { - if (pendingPtr && pendingPtr->bytes) { - /* - * Generating string rep of objPtr also - * generated string rep of pendingPtr. - */ - if (pendingPtr->length) { - /* Can this happen? */ - goto foo; - } else { - /* string-29.14 */ - first = objc - 1; - last = 0; - pendingPtr = NULL; - } - } + if (numBytes) { + last = objc - oc; + } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { continue; } - last = objc - oc; -foo: if (pendingPtr) { Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ pendingPtr = NULL; } if (length == 0) { - first = last; + if (numBytes) { + first = last; + } else { + first = objc - 1; + last = 0; + } } else if (numBytes > INT_MAX - length) { goto overflow; } -- cgit v0.12 From e1b4ae0798c13600df17340c7c8bc049ad335e18 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 14:46:56 +0000 Subject: Use local variables. --- generic/tclStringObj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 587ba76..8155711 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2847,7 +2847,7 @@ TclStringCatObjv( Tcl_Obj * const objv[], Tcl_Obj **objPtrPtr) { - Tcl_Obj *objPtr, *objResultPtr, * const *ov; + Tcl_Obj *objResultPtr, * const *ov; int oc, length = 0, binary = 1; int allowUniChar = 1, requestUniChar = 0; int first = objc - 1; /* Index of first value possibly not empty */ @@ -2872,7 +2872,7 @@ TclStringCatObjv( ov = objv, oc = objc; do { - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if (objPtr->bytes) { /* Value has a string rep. */ @@ -2908,7 +2908,7 @@ TclStringCatObjv( /* Result will be pure byte array. Pre-size it */ ov = objv; oc = objc; do { - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if (objPtr->bytes == NULL) { int numBytes; @@ -2929,7 +2929,7 @@ TclStringCatObjv( /* Result will be pure Tcl_UniChar array. Pre-size it. */ ov = objv; oc = objc; do { - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if ((objPtr->bytes == NULL) || (objPtr->length)) { int numChars; @@ -2954,7 +2954,7 @@ TclStringCatObjv( do { int numBytes; - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { /* No string rep; Take the chance we can avoid making it */ -- cgit v0.12 From b3bda726c14c1beb8bd4e5340aa4fb68af4116f0 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 15:51:12 +0000 Subject: Factor out and simplify loop scanning leading known empty values. --- generic/tclStringObj.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 8155711..870696e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2952,6 +2952,26 @@ TclStringCatObjv( /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { + /* assert ( pendingPtr == NULL ) */ + /* assert ( length == 0 ) */ + + Tcl_Obj *objPtr = *ov++; + + if (objPtr->bytes == NULL) { + /* No string rep; Take the chance we can avoid making it */ + pendingPtr = objPtr; + } else { + Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ + } + } while (--oc && (length == 0) && (pendingPtr == NULL)); + + if (oc) { + + /* assert ( length > 0 || pendingPtr != NULL ) */ + + first = last = objc - oc - 1; + + do { int numBytes; Tcl_Obj *objPtr = *ov++; @@ -2987,6 +3007,7 @@ TclStringCatObjv( length += numBytes; } } while (--oc); + } } if (last <= first /*|| length == 0 */) { -- cgit v0.12 From 17711009b61fdbb4a568a630b7b71a035795fdde Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 16:07:48 +0000 Subject: Split loop into two cases for further simplification. --- generic/tclStringObj.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 870696e..be686cf 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2965,11 +2965,52 @@ TclStringCatObjv( } } while (--oc && (length == 0) && (pendingPtr == NULL)); + first = last = objc - oc - 1; + + while (oc && (length == 0)) { + int numBytes; + Tcl_Obj *objPtr = *ov++; + + /* assert ( pendingPtr != NULL ) <-- aiming for */ + + if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { + /* No string rep; Take the chance we can avoid making it */ + + last = objc - oc; + first = last; + pendingPtr = objPtr; + } else { + + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + if (numBytes) { + last = objc - oc; + } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { + --oc; + continue; + } + if (pendingPtr) { + Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ + pendingPtr = NULL; + } + if (length == 0) { + if (numBytes) { + first = last; + } else { + first = objc - 1; + last = 0; + } + } else if (numBytes > INT_MAX - length) { + goto overflow; + } + length += numBytes; + } + --oc; + } + if (oc) { - /* assert ( length > 0 || pendingPtr != NULL ) */ + /* assert ( length > 0 ) */ - first = last = objc - oc - 1; do { int numBytes; -- cgit v0.12 From 3923106cf72e37db80a261151293cbe16ebd9773 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 16:23:22 +0000 Subject: Simplify the final loop when we know we're generating strings for all. --- generic/tclStringObj.c | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index be686cf..51d6c13 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3007,48 +3007,22 @@ TclStringCatObjv( --oc; } - if (oc) { - - /* assert ( length > 0 ) */ - - - do { + while (oc) { int numBytes; - Tcl_Obj *objPtr = *ov++; - if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { - /* No string rep; Take the chance we can avoid making it */ + /* assert ( length > 0 && pendingPtr == NULL ) */ + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + if (numBytes) { last = objc - oc; - first = last; - pendingPtr = objPtr; - } else { - - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if (numBytes) { - last = objc - oc; - } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { - continue; - } - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ - pendingPtr = NULL; - } - if (length == 0) { - if (numBytes) { - first = last; - } else { - first = objc - 1; - last = 0; - } - } else if (numBytes > INT_MAX - length) { + if (numBytes > INT_MAX - length) { goto overflow; } length += numBytes; } - } while (--oc); - } + --oc; + } } if (last <= first /*|| length == 0 */) { -- cgit v0.12 From 73f548527aa3d3852c86c86fba701c277e43e40f Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 19:54:57 +0000 Subject: Another reworking, now with comments. --- generic/tclStringObj.c | 79 +++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 51d6c13..41dad65 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2947,65 +2947,72 @@ TclStringCatObjv( } } while (--oc); } else { - Tcl_Obj *pendingPtr = NULL; - /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { - /* assert ( pendingPtr == NULL ) */ - /* assert ( length == 0 ) */ + Tcl_Obj *pendingPtr = NULL; - Tcl_Obj *objPtr = *ov++; + /* + * Loop until a possibly non-empty value is reached. + * Keep string rep generation pending when possible. + */ - if (objPtr->bytes == NULL) { - /* No string rep; Take the chance we can avoid making it */ - pendingPtr = objPtr; - } else { - Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ - } - } while (--oc && (length == 0) && (pendingPtr == NULL)); + do { + /* assert ( pendingPtr == NULL ) */ + /* assert ( length == 0 ) */ - first = last = objc - oc - 1; + Tcl_Obj *objPtr = *ov++; - while (oc && (length == 0)) { - int numBytes; - Tcl_Obj *objPtr = *ov++; + if (objPtr->bytes == NULL) { + /* No string rep; Take the chance we can avoid making it */ + pendingPtr = objPtr; + } else { + Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ + } + } while (--oc && (length == 0) && (pendingPtr == NULL)); + + /* + * Either we found a possibly non-empty value, and we + * remember this index as the first and last such value so + * far seen, or (oc == 0) and all values are known empty, + * so first = last = objc - 1 signals the right quick return. + */ - /* assert ( pendingPtr != NULL ) <-- aiming for */ + first = last = objc - oc - 1; - if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { - /* No string rep; Take the chance we can avoid making it */ + if (oc && (length == 0)) { + int numBytes; - last = objc - oc; - first = last; - pendingPtr = objPtr; - } else { + /* assert ( pendingPtr != NULL ) */ + + /* + * There's a pending value followed by more values. + * Loop over remaining values generating strings until + * a non-empty value is found, or the pending value gets + * its string generated. + */ + + do { + Tcl_Obj *objPtr = *ov++; + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + } while (--oc && numBytes == 0 && pendingPtr->bytes == NULL); - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes) { - last = objc - oc; - } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { - --oc; - continue; + last = objc -oc -1; } - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ - pendingPtr = NULL; + if (oc || numBytes) { + Tcl_GetStringFromObj(pendingPtr, &length); } if (length == 0) { if (numBytes) { first = last; - } else { - first = objc - 1; - last = 0; } } else if (numBytes > INT_MAX - length) { goto overflow; } length += numBytes; } - --oc; - } + } while (oc && (length == 0)); while (oc) { int numBytes; -- cgit v0.12 From a9c238476a0aa2d6f10765f010b99944d3a7a9c3 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 22 Jun 2017 22:54:32 +0000 Subject: Add [regsub -command] case that wasn't actively tested for. --- tests/regexp.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/regexp.test b/tests/regexp.test index 2686526..7367af7 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1184,6 +1184,10 @@ test regexp-27.10 {regsub -command error cases} -returnCodes error -body { test regexp-27.11 {regsub -command error cases} -returnCodes error -body { regsub -command . abc {} } -result {command prefix must be a list of at least one element} +test regexp-27.12 {regsub -command representation smash} { + set s {list (.+)} + regsub -command $s {list list} $s +} {(.+) {list list} list} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 70d12096d5549c1f98c154834b51d64a6a88b14b Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 12:28:57 +0000 Subject: Repair compiler warning about uninitialized value. --- generic/tclCmdMZ.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 2c6b7bb..ad3ee8e 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -487,11 +487,10 @@ Tcl_RegsubObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int idx, result, cflags, all, wlen, wsublen, numMatches, offset; - int start, end, subStart, subEnd, match, command, numParts, numArgs; + int start, end, subStart, subEnd, match, command, numParts; Tcl_RegExp regExpr; Tcl_RegExpInfo info; Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; - Tcl_Obj **args = NULL, **parts; Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend; static const char *const options[] = { @@ -773,12 +772,13 @@ Tcl_RegsubObjCmd( */ if (command) { - if (args == NULL) { - Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts); - numArgs = numParts + info.nsubs + 1; - args = ckalloc(sizeof(Tcl_Obj*) * numArgs); - memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); - } + Tcl_Obj **args = NULL, **parts; + int numArgs; + + Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts); + numArgs = numParts + info.nsubs + 1; + args = ckalloc(sizeof(Tcl_Obj*) * numArgs); + memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); for (idx = 0 ; idx <= info.nsubs ; idx++) { subStart = info.matches[idx].start; @@ -807,6 +807,7 @@ Tcl_RegsubObjCmd( for (idx = 0 ; idx <= info.nsubs ; idx++) { TclDecrRefCount(args[idx + numParts]); } + ckfree(args); if (result != TCL_OK) { if (result == TCL_ERROR) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( @@ -975,9 +976,6 @@ Tcl_RegsubObjCmd( if (subPtr && (objv[2] == objv[0])) { Tcl_DecrRefCount(subPtr); } - if (args) { - ckfree(args); - } if (resultPtr) { Tcl_DecrRefCount(resultPtr); } -- cgit v0.12 From ba387de8cd303673f81a5e5870c91f830786a147 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 12:39:13 +0000 Subject: repair broken tests --- tests/format.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/format.test b/tests/format.test index 577365b..1c20d0f 100644 --- a/tests/format.test +++ b/tests/format.test @@ -90,13 +90,13 @@ test format-1.14 {integer formatting} longIs32bit { } { 0d0 0d6 0d34 0d16923 -0d12} test format-1.14.1 {integer formatting} longIs64bit { format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 -} { 0d0 0d6 0d34 0d16923 -0d12} +} { 0d0 0d6 0d34 0d16923 -0d12} test format-1.15 {integer formatting} longIs32bit { format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 } {0d0 0d6 0d34 0d16923 -0d12 } test format-1.15.1 {integer formatting} longIs64bit { format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12 } +} {0d0 0d6 0d34 0d16923 -0d12 } test format-2.1 {string formatting} { -- cgit v0.12 From 5d68b7ef564929c5e9cf6b2af3bd12ec9db81cd2 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 13:09:23 +0000 Subject: Rewrite the documentation of [regsub -command] so it's not quite such a mess. --- doc/regsub.n | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/doc/regsub.n b/doc/regsub.n index 23bbff9..29c118a 100644 --- a/doc/regsub.n +++ b/doc/regsub.n @@ -70,18 +70,20 @@ from the corresponding match. .TP \fB\-command\fR .VS 8.7 -Changes the handling of the substitution string so that it no longer treats +Changes the handling of \fIsubSpec\fR so that it is not treated +as a template for a substitution string and the substrings .QW & and -.QW \e -as special characters, but instead uses them as a non-empty list of words. -Each time a substitution is processed, another complete Tcl word is appended -to that list for each substitution value (the first such argument represents -the overall matched substring, the subsequent arguments will be one per -capturing sub-RE, much as are returned from \fBregexp\fR \fB\-inline\fR) and -the overall list is then evaluated as a Tcl command call. If the command -finishes successfully, the result of command call is substituted into the -resulting string. +.QW \e\fIn\fR +no longer have special meaning. Instead \fIsubSpec\fR must be a +command prefix, that is, a non-empty list. The substring of \fIstring\fR +that matches \fIexp\fR, and then each substring that matches each +capturing sub-RE within \fIexp\fR are appended as additional elements +to that list. (The items appended to the list are much like what +\fBregexp\fR \fB-inline\fR would return). The completed list is then +evaluated as a Tcl command, and the result of that command is the +substitution string. Any error or exception from command evaluation +becomes an error or exception from the \fBregsub\fR command. .RS .PP If \fB\-all\fR is not also given, the command callback will be invoked at most -- cgit v0.12 From 400f9d27f5859d3f81bba4b5f1bd52e436d52275 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 13:11:37 +0000 Subject: typo fix --- generic/tclCmdMZ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ad3ee8e..83382a7 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -800,7 +800,7 @@ Tcl_RegsubObjCmd( * because Tcl_EvalObjv is "hairy monster" in terms of refcount * handling, being able to optionally add references to any of its * argument words. We'll drop the local refs immediately - * afterwarsds; subPtr is handled in the main exit stanza. + * afterwards; subPtr is handled in the main exit stanza. */ result = Tcl_EvalObjv(interp, numArgs, args, 0); -- cgit v0.12 From 2bd7095b873e14982c860118b27caeeb0af6085e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Jun 2017 15:04:44 +0000 Subject: No longer split tests for longIs32bit/longIs64bit, since the results should be identical --- tests/format.test | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/format.test b/tests/format.test index 1c20d0f..094b7b3 100644 --- a/tests/format.test +++ b/tests/format.test @@ -79,22 +79,13 @@ test format-1.11.1 {integer formatting} longIs64bit { test format-1.12 {integer formatting} { format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] } {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} -test format-1.13 {integer formatting} longIs32bit { +test format-1.13 {integer formatting} { format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 } {0d0 0d6 0d34 0d16923 -0d12} -test format-1.13.1 {integer formatting} longIs64bit { - format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12} -test format-1.14 {integer formatting} longIs32bit { - format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 -} { 0d0 0d6 0d34 0d16923 -0d12} -test format-1.14.1 {integer formatting} longIs64bit { +test format-1.14 {integer formatting} { format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 } { 0d0 0d6 0d34 0d16923 -0d12} -test format-1.15 {integer formatting} longIs32bit { - format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12 } -test format-1.15.1 {integer formatting} longIs64bit { +test format-1.15 {integer formatting} { format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 } {0d0 0d6 0d34 0d16923 -0d12 } -- cgit v0.12 From 664774bec4189d84722d2e34193bee298a883264 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 7 Aug 2017 01:16:39 +0000 Subject: [5bfe3de008]: Modify [source] to set input EOF character but not output EOF character. This avoids having ^Z being appended to the sourced file when it is an always-writable [tcl::chan::variable] in a custom VFS. Tested by adding this same change as a patch to Tcl 8.6.6 in KitCreator because that seems to be the easiest way to get custom VFS capability exposed as script commands. Original problem introduced by [03cdfc3a86] 2000-05-11 00:16:52. --- generic/tclIOUtil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index ea407ab..2c389c6 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1764,7 +1764,7 @@ Tcl_FSEvalFileEx( * this cross-platform to allow for scripted documents. [Bug: 2040] */ - Tcl_SetChannelOption(interp, chan, "-eofchar", "\32"); + Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}"); /* * If the encoding is specified, set it for the channel. Else don't touch @@ -1899,7 +1899,7 @@ TclNREvalFile( * this cross-platform to allow for scripted documents. [Bug: 2040] */ - Tcl_SetChannelOption(interp, chan, "-eofchar", "\32"); + Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}"); /* * If the encoding is specified, set it for the channel. Else don't touch -- cgit v0.12 From 4056a4dc4bbe87b4b26e7d049093363a9926eddf Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 14:29:11 +0000 Subject: Release candidate branch for Tcl 8.7a1. --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.ac | 2 +- win/configure | 2 +- win/configure.ac | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README b/README index aab0db5..59de34d 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.7a0 source distribution. + This is the Tcl 8.7a1 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 6fa26f9..2e9d60a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 7 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TCL_RELEASE_SERIAL 0 +#define TCL_RELEASE_SERIAL 1 #define TCL_VERSION "8.7" -#define TCL_PATCH_LEVEL "8.7a0" +#define TCL_PATCH_LEVEL "8.7a1" #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* diff --git a/library/init.tcl b/library/init.tcl index ece1e44..b6e6e8b 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.7a0 +package require -exact Tcl 8.7a1 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index a9132b57..0b22a43 100755 --- a/unix/configure +++ b/unix/configure @@ -2325,7 +2325,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.ac b/unix/configure.ac index b43da6d..d7aa50f 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/win/configure b/win/configure index d0431cb..a47ff23 100755 --- a/win/configure +++ b/win/configure @@ -2102,7 +2102,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.ac b/win/configure.ac index 2821bc3..e32dadc 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From aedd652645c9955f187e0781742cb1d779143b7a Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 14:56:23 +0000 Subject: Bring changes up to the 8.6.7 release. --- changes | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/changes b/changes index 1e24269..f98eafc 100644 --- a/changes +++ b/changes @@ -8624,3 +8624,174 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-02-22 (bug)[9b4702] [info exists env(missing)] kills trace (nijtmans) --- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tcl/ for details + +2016-03-01 (bug)[803042] mem leak due to reference cycle (porter) + +2016-03-08 (bug)[bbc304] reflected watch race condition (porter) + +2016-03-17 (bug)[fadc99] compile-5.3 (rodriguez,porter) + +2016-03-17 (enhancement)[1a25fd] compile [variable ${ns}::v] (porter) + +2016-03-20 (bug)[1af8de] crash in compiled [string replace] (harder,fellows) + +2016-03-21 (bug)[d30718] segv in notifier finalize (hirofumi,nijtmans) + +2016-03-23 (enhancement)[7d0db7] parallel make (yarda,nijtmans) + +2016-03-23 [f12535] enable test bindings customization (vogel,nijtmans) + +2016-04-04 (bug)[47ac84] compiled [lreplace] fixes (aspect,ferrieux,fellows) + *** POTENTIAL INCOMPATIBILITY *** + +2016-04-08 (bug)[866368] RE \w includes 'Punctuation Connector' (nijtmans) + +2016-04-08 (bug)[2538f3] Win crash Tcl_OpenTcpServer() (griffin) + +2016-04-10 [07d13d] Restore TclBlend support lost in 8.6.1 (buratti) + +2016-05-13 (bug)[3154ea] Mem corruption in assembler exceptions (tkob,kenny) + +2016-05-13 (bug) registry package support any Unicode env (nijtmans) +=> registry 1.3.2 + +2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows) + +2016-06-02 (TIP 447) execution time verbosity option (cerutti) +=> tcltest 2.4.0 + +2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter) + +2016-06-16 (enhancement)[4b61af] good [info frame] from more cases (beric) + +2016-06-21 (bug)[c383eb] crash in [glob -path a] (oehlmann,porter) + +2016-06-21 (update) Update Unicode data to 9.0 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-06-22 (bug)[16896d] Tcl_DString tolerate append to self. (dah,porter) + +2016-06-23 (bug)[d55322] crash in [dict update] (yorick,fellows) + +2016-06-27 (bug)[dd260a] crash in [chan configure -dictionary] (madden,aspect) + +2016-07-02 (bug)[f961d7] usage message with parameters with spaces (porter) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-02 (enhancement)[09fabc] Sort order of -relateddir (lanam) + +2016-07-07 (bug)[5d7ca0] Win: [file executable] for .cmd and .ps1 (nadkarni) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-08 (bug)[a47641] [file normalize] & Windows junctions (nadkarni) + +2016-07-09 [ae61a6] [file] handling of Win hardcoded names (CON) (nadkarni) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-09 [3613671] [file owned] (more) useful on Win (nadkarni) + +2016-07-09 (bug)[1493a4] [namespace upvar] use of resolvers (beric,fellows) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-10 (bug)[da340d] integer division in clock math (nadkarni) + +2016-07-20 tzdata updated to Olson's tzdata2016f (venkat) + +--- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tcl/ for details + +2016-09-07 (bug)[c09edf] Bad caching with custom resolver (neumann,nijtmans) + +2016-09-07 (bug)[4dbdd9] Memleak in test var-8.3 (mr_calvin,porter) + +2016-10-03 (bug)[2bf561] Allow empty command as alias target (yorick,nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-10-04 (bug)[4d5ae7] Crash in async connects host no address (gahr,fellows) + +2016-10-08 (bug)[838e99] treat application/xml as text (gahr,fellows) +=> http 2.8.10 + +2016-10-11 (bug)[3cc1d9] Thread finalization crash in zippy (neumann) + +2016-10-12 (bug)[be003d] Fix [scan 0x1 %b], [scan 0x1 %o] (porter) + +2016-10-14 (bug)[eb6b68] Fix stringComp-14.5 (porter) + +2016-10-30 (bug)[b26e38] Fix zlib-7.8 (fellows) + +2016-10-30 (bug)[1ae129] Fix memleak in [history] destruction (fellows) + +2016-11-04 (feature) Provisional Tcl 9 support in msgcat and tcltest (nijtmans) +=> msgcat 1.6.1 +=> tcltest 2.4.1 + +2016-11-04 (bug)[824752] Crash in Tcl_ListObjReplace() (gahr,porter) + +2016-11-11 (bug)[79614f] invalidate VFS mounts on sytem encoding change (yorick) + +2016-11-14 OSX: End panic() as legacy support macro; system conflicts (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-11-15 (bug) TclOO fix stops crash mixing Itcl and snit (fellows) + +2016-11-17 (update) Reconcile libtommath updates; purge unused files (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-01-09 (bug)[b87ad7] Repair drifts in timer clock (sebres) + +2017-01-17 (update) => zlib 1.2.11 (nijtmans) + +2017-01-31 (bug)[39f630] Revise Tcl_LinkVar to tolerate some prefixes (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-02-01 (bug)[d0f7ba] Improper NAN optimization. expr-22.1[01] (aspect) + +2017-02-26 (bug)[25842c] zlib stream finalization (aspect) + +2017-03-07 (deprecate) Remove unmaintained makefile.bc file (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-03-14 (enhancement) [clock] and [encoding] are now ensembles (kenny) + +2017-03-15 (enhancement) several [clock] subcommands bytecoded (kenny) + +2017-03-23 tzdata updated to Olson's tzdata2017b (jima) + +2017-03-29 (bug)[900cb0] Fix OO unexport introspection (napier) + +2017-04-12 (bug)[42202b] Nesting imbalance in coro injection (nadkarni,sebres) + +2017-04-18 (bug)[bc4322] http package support for safe interps (nash,nijtmans) + +2017-04-28 (bug)[f34cf8] [file join a //b] => /b (neumann,porter) + +2017-05-01 (bug)[8bd13f] Windows threads and pipes (sebres,nijtmans) + +2017-05-01 (bug)[f9fe90] [file join //a b] EIAS violation (aspect,porter) + +2017-05-04 (bug) Make test filesystem-1.52 pass on Windows (nijtmans) + +2017-05-05 (bug)[601522] [binary] field spec overflow -> segfault (porter) + +2017-05-08 (bug)[6ca52a] http memleak handling keep-alive (aspect,nijtmans) +=> http 2.8.11 + +2017-05-29 (bug)[a3fb33] crash in [lsort] on long lists (sebres) + +2017-06-05 (bug)[67aa9a] Tcl_UtfToUniChar() revised handling invalid UTF-8 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-06-08 (bug)[2738427] Tcl_NumUtfChars() corner case utf-4.9 (nijtmans) + +2017-06-22 (update) Update Unicode data to 10.0 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-06-22 (TIP 473) Let [oo::copy] specify target namespace (fellows) + +2017-06-26 (bug)[46f801] Repair autoloader fragility (porter) + +2017-07-06 (bug)[adb198] Plug memleak in TclJoinPath (sebres,porter) + +2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) + +--- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 0079285837943ef6dba9184388378b2e3987a0d8 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 17:34:31 +0000 Subject: Update outdated comment. --- generic/tclPkg.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 3b0554a..eb4dc9b 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -331,8 +331,8 @@ Tcl_PkgRequireEx( * * Second, how does this work? If we reach this point, then the global * variable tclEmptyStringRep has the value NULL. Compare that with - * the definition of tclEmptyStringRep near the top of the file - * generic/tclObj.c. It clearly should not have the value NULL; it + * the definition of tclEmptyStringRep near the top of this file. + * It clearly should not have the value NULL; it * should point to the char tclEmptyString. If we see it having the * value NULL, then somehow we are seeing a Tcl library that isn't * completely initialized, and that's an indicator for the error @@ -348,18 +348,11 @@ Tcl_PkgRequireEx( * After all, two Tcl libraries can't be a good thing!) * * Trouble is that's going to be tricky. We're now using a Tcl library - * that's not fully initialized. In particular, it doesn't have a - * proper value for tclEmptyStringRep. The Tcl_Obj system heavily - * depends on the value of tclEmptyStringRep and all of Tcl depends - * (increasingly) on the Tcl_Obj system, we need to correct that flaw - * before making the calls to set the interpreter result to the error - * message. That's the only flaw corrected; other problems with - * initialization of the Tcl library are not remedied, so be very - * careful about adding any other calls here without checking how they - * behave when initialization is incomplete. + * that's not fully initialized. Functions in it may not work + * reliably, so be very careful about adding any other calls here + * without checking how they behave when initialization is incomplete. */ - tclEmptyStringRep = &tclEmptyString; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Cannot load package \"%s\" in standalone executable:" " This package is not compiled with stub support", name)); -- cgit v0.12 From ad9bc7297d7fbdfb62825ee3d15a4197d45e3581 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 19:14:15 +0000 Subject: Add 8.7 -only changes to the changes file. --- changes | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/changes b/changes index f98eafc..7b035fb 100644 --- a/changes +++ b/changes @@ -8795,3 +8795,44 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details + +2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter) + +2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans) + +2016-07-19 (bug)[0363f0] Partial array search ID reform (porter) + +2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter) + *** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") *** + +2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max) + +2016-11-25 [array named -regexp] supports backrefs (goth) + +2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy) + +2017-01-04 (TIP 459) New subcommand [package files] (nijtmans) + +2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans) + +2017-01-30 Add to Win shell builtins: assoc ftype move (ashok) + +2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans) + +2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) + +2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz) + +2017-05-31 Purge build support for SunOS-4.* (stu) + +2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows) + +2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows) +=> TclOO 1.2.0 + +2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin) + +--- Released 8.7a1, August ??, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 89ce4defb5b763401e065965a4ac97af98fd778f Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 12 Aug 2017 19:45:04 +0000 Subject: Correct longstanding typo in continue man page --- doc/continue.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/continue.n b/doc/continue.n index 92ff3b4..5eca861 100644 --- a/doc/continue.n +++ b/doc/continue.n @@ -23,7 +23,7 @@ exception to occur. The exception causes the current script to be aborted out to the innermost containing loop command, which then continues with the next iteration of the loop. -Catch exceptions are also handled in a few other situations, such +Continue exceptions are also handled in a few other situations, such as the \fBcatch\fR command and the outermost scripts of procedure bodies. .SH EXAMPLE -- cgit v0.12 From 2e9194366ab14876eaf9f689fe0808fc68477701 Mon Sep 17 00:00:00 2001 From: ferrieux Date: Thu, 24 Aug 2017 16:56:51 +0000 Subject: Fix [b50fb214] : add to 2>> the same O_APPEND that was added to >> back in 2005. --- generic/tclPipe.c | 8 +++++++- tests/exec.test | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/generic/tclPipe.c b/generic/tclPipe.c index d6cd188..b679ec4 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -668,7 +668,13 @@ TclCreatePipeline( if (*p == '>') { p++; atOK = 0; - flags = O_WRONLY | O_CREAT; + + /* + * Note that the O_APPEND flag only has an effect on POSIX + * platforms. On Windows, we just have to carry on regardless. + */ + + flags = O_WRONLY | O_CREAT | O_APPEND; } if (errorClose != 0) { errorClose = 0; diff --git a/tests/exec.test b/tests/exec.test index 2a4b31e..dffd960 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -671,8 +671,12 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup { exec /bin/sh -c \ {for a in 1 2 3; do sleep 1; echo $a; done} >>$tmpfile & exec /bin/sh -c \ + {for a in 4 5 6; do sleep 1; echo $a >&2; done} 2>>$tmpfile & + exec /bin/sh -c \ {for a in a b c; do sleep 1; echo $a; done} >>$tmpfile & - # The above two shell invokations take about 3 seconds to finish, so allow + exec /bin/sh -c \ + {for a in d e f; do sleep 1; echo $a >&2; done} 2>>$tmpfile & + # The above four shell invokations take about 3 seconds to finish, so allow # 5s (in case the machine is busy) after 5000 # Check that no bytes have got lost through mixups with overlapping @@ -681,7 +685,7 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup { file size $tmpfile } -cleanup { removeFile $tmpfile -} -result 14 +} -result 26 # Tests to ensure batch files and .CMD (Bug 9ece99d58b) # can be executed on Windows -- cgit v0.12 From 92265d56a363a605b8a68d54cf49aa9a11448a1f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 19:52:35 +0000 Subject: libtommath 1.0.1 rc 2 --- libtommath/bn_error.c | 6 ++-- libtommath/bn_fast_mp_invmod.c | 6 ++-- libtommath/bn_fast_mp_montgomery_reduce.c | 6 ++-- libtommath/bn_fast_s_mp_mul_digs.c | 6 ++-- libtommath/bn_fast_s_mp_mul_high_digs.c | 6 ++-- libtommath/bn_fast_s_mp_sqr.c | 6 ++-- libtommath/bn_mp_2expt.c | 6 ++-- libtommath/bn_mp_abs.c | 6 ++-- libtommath/bn_mp_add.c | 6 ++-- libtommath/bn_mp_add_d.c | 12 +++---- libtommath/bn_mp_addmod.c | 6 ++-- libtommath/bn_mp_and.c | 6 ++-- libtommath/bn_mp_clamp.c | 6 ++-- libtommath/bn_mp_clear.c | 6 ++-- libtommath/bn_mp_clear_multi.c | 6 ++-- libtommath/bn_mp_cmp.c | 6 ++-- libtommath/bn_mp_cmp_d.c | 6 ++-- libtommath/bn_mp_cmp_mag.c | 6 ++-- libtommath/bn_mp_cnt_lsb.c | 6 ++-- libtommath/bn_mp_copy.c | 6 ++-- libtommath/bn_mp_count_bits.c | 6 ++-- libtommath/bn_mp_div.c | 6 ++-- libtommath/bn_mp_div_2.c | 6 ++-- libtommath/bn_mp_div_2d.c | 25 ++++--------- libtommath/bn_mp_div_3.c | 6 ++-- libtommath/bn_mp_div_d.c | 6 ++-- libtommath/bn_mp_dr_is_modulus.c | 6 ++-- libtommath/bn_mp_dr_reduce.c | 6 ++-- libtommath/bn_mp_dr_setup.c | 6 ++-- libtommath/bn_mp_exch.c | 6 ++-- libtommath/bn_mp_export.c | 16 ++++----- libtommath/bn_mp_expt_d.c | 6 ++-- libtommath/bn_mp_expt_d_ex.c | 6 ++-- libtommath/bn_mp_exptmod.c | 6 ++-- libtommath/bn_mp_exptmod_fast.c | 20 +++++------ libtommath/bn_mp_exteuclid.c | 45 ++++++++++++------------ libtommath/bn_mp_fread.c | 8 +++-- libtommath/bn_mp_fwrite.c | 8 +++-- libtommath/bn_mp_gcd.c | 6 ++-- libtommath/bn_mp_get_int.c | 6 ++-- libtommath/bn_mp_grow.c | 6 ++-- libtommath/bn_mp_import.c | 16 ++++----- libtommath/bn_mp_init.c | 6 ++-- libtommath/bn_mp_init_copy.c | 13 ++++--- libtommath/bn_mp_init_multi.c | 9 ++--- libtommath/bn_mp_init_set.c | 6 ++-- libtommath/bn_mp_init_set_int.c | 6 ++-- libtommath/bn_mp_init_size.c | 6 ++-- libtommath/bn_mp_invmod.c | 8 ++--- libtommath/bn_mp_invmod_slow.c | 6 ++-- libtommath/bn_mp_is_square.c | 6 ++-- libtommath/bn_mp_jacobi.c | 6 ++-- libtommath/bn_mp_karatsuba_mul.c | 6 ++-- libtommath/bn_mp_karatsuba_sqr.c | 6 ++-- libtommath/bn_mp_lcm.c | 6 ++-- libtommath/bn_mp_lshd.c | 6 ++-- libtommath/bn_mp_mod.c | 8 ++--- libtommath/bn_mp_mod_2d.c | 6 ++-- libtommath/bn_mp_mod_d.c | 6 ++-- libtommath/bn_mp_montgomery_calc_normalization.c | 6 ++-- libtommath/bn_mp_montgomery_reduce.c | 6 ++-- libtommath/bn_mp_montgomery_setup.c | 6 ++-- libtommath/bn_mp_mul.c | 6 ++-- libtommath/bn_mp_mul_2.c | 6 ++-- libtommath/bn_mp_mul_2d.c | 6 ++-- libtommath/bn_mp_mul_d.c | 6 ++-- libtommath/bn_mp_mulmod.c | 8 ++--- libtommath/bn_mp_n_root.c | 6 ++-- libtommath/bn_mp_n_root_ex.c | 6 ++-- libtommath/bn_mp_neg.c | 6 ++-- libtommath/bn_mp_or.c | 6 ++-- libtommath/bn_mp_prime_fermat.c | 6 ++-- libtommath/bn_mp_prime_is_divisible.c | 6 ++-- libtommath/bn_mp_prime_is_prime.c | 6 ++-- libtommath/bn_mp_prime_miller_rabin.c | 6 ++-- libtommath/bn_mp_prime_next_prime.c | 6 ++-- libtommath/bn_mp_prime_rabin_miller_trials.c | 6 ++-- libtommath/bn_mp_prime_random_ex.c | 6 ++-- libtommath/bn_mp_radix_size.c | 6 ++-- libtommath/bn_mp_radix_smap.c | 6 ++-- libtommath/bn_mp_rand.c | 35 +++++++++++++++--- libtommath/bn_mp_read_radix.c | 6 ++-- libtommath/bn_mp_read_signed_bin.c | 6 ++-- libtommath/bn_mp_read_unsigned_bin.c | 6 ++-- libtommath/bn_mp_reduce.c | 6 ++-- libtommath/bn_mp_reduce_2k.c | 6 ++-- libtommath/bn_mp_reduce_2k_l.c | 6 ++-- libtommath/bn_mp_reduce_2k_setup.c | 6 ++-- libtommath/bn_mp_reduce_2k_setup_l.c | 6 ++-- libtommath/bn_mp_reduce_is_2k.c | 6 ++-- libtommath/bn_mp_reduce_is_2k_l.c | 6 ++-- libtommath/bn_mp_reduce_setup.c | 6 ++-- libtommath/bn_mp_rshd.c | 6 ++-- libtommath/bn_mp_set.c | 6 ++-- libtommath/bn_mp_set_int.c | 6 ++-- libtommath/bn_mp_set_long.c | 6 ++-- libtommath/bn_mp_set_long_long.c | 6 ++-- libtommath/bn_mp_shrink.c | 6 ++-- libtommath/bn_mp_signed_bin_size.c | 6 ++-- libtommath/bn_mp_sqr.c | 6 ++-- libtommath/bn_mp_sqrmod.c | 6 ++-- libtommath/bn_mp_sqrt.c | 6 ++-- libtommath/bn_mp_sub.c | 6 ++-- libtommath/bn_mp_sub_d.c | 6 ++-- libtommath/bn_mp_submod.c | 6 ++-- libtommath/bn_mp_to_signed_bin.c | 6 ++-- libtommath/bn_mp_to_signed_bin_n.c | 6 ++-- libtommath/bn_mp_to_unsigned_bin.c | 6 ++-- libtommath/bn_mp_to_unsigned_bin_n.c | 6 ++-- libtommath/bn_mp_toom_mul.c | 6 ++-- libtommath/bn_mp_toom_sqr.c | 6 ++-- libtommath/bn_mp_toradix.c | 6 ++-- libtommath/bn_mp_toradix_n.c | 6 ++-- libtommath/bn_mp_unsigned_bin_size.c | 6 ++-- libtommath/bn_mp_xor.c | 6 ++-- libtommath/bn_mp_zero.c | 6 ++-- libtommath/bn_prime_tab.c | 6 ++-- libtommath/bn_reverse.c | 6 ++-- libtommath/bn_s_mp_add.c | 6 ++-- libtommath/bn_s_mp_exptmod.c | 6 ++-- libtommath/bn_s_mp_mul_digs.c | 6 ++-- libtommath/bn_s_mp_mul_high_digs.c | 6 ++-- libtommath/bn_s_mp_sqr.c | 6 ++-- libtommath/bn_s_mp_sub.c | 6 ++-- libtommath/bncore.c | 6 ++-- libtommath/tommath.h | 35 ++++++++---------- libtommath/tommath_class.h | 12 +++---- libtommath/tommath_private.h | 14 +++++--- libtommath/tommath_superclass.h | 6 ++-- 129 files changed, 492 insertions(+), 472 deletions(-) diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 3abf1a7..397f834 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -42,6 +42,6 @@ const char *mp_error_to_string(int code) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index aa41098..fa31853 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -143,6 +143,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index a63839d..d13452d 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -167,6 +167,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index acd13b4..18bea3f 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -102,6 +102,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index b96cf60..8fd5117 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -93,6 +93,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index 775c76f..293c54a 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -109,6 +109,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index 2845814..eb5e664 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -43,6 +43,6 @@ mp_2expt (mp_int * a, int b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index cc9c3db..16662c0 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -38,6 +38,6 @@ mp_abs (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 236fc75..0d91d24 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -48,6 +48,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 4d4e1df..6b9dbef 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -49,9 +49,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) /* old number of used digits in c */ oldused = c->used; - /* sign always positive */ - c->sign = MP_ZPOS; - /* source alias */ tmpa = a->dp; @@ -96,6 +93,9 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) ix = 1; } + /* sign always positive */ + c->sign = MP_ZPOS; + /* now zero to oldused */ while (ix++ < oldused) { *tmpc++ = 0; @@ -107,6 +107,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 825c928..800e10a 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -36,6 +36,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 3b6b03e..6a18639 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -52,6 +52,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index d4fb70d..b392c10 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -39,6 +39,6 @@ mp_clamp (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index 17ef9d5..bf0873a 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -39,6 +39,6 @@ mp_clear (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index 441a200..e659cf8 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -29,6 +29,6 @@ void mp_clear_multi(mp_int *mp, ...) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 74a98fe..6266a7e 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -38,6 +38,6 @@ mp_cmp (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index 28a53ce..a1cdaa1 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -39,6 +39,6 @@ int mp_cmp_d(mp_int * a, mp_digit b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index f72830f..b3839f0 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -50,6 +50,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 9d7eef8..42d2219 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -48,6 +48,6 @@ int mp_cnt_lsb(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 69e9464..6f2ee59 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -63,6 +63,6 @@ mp_copy (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index 74b59b6..e2db126 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -40,6 +40,6 @@ mp_count_bits (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 3ca5d7f..81d30eb 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -290,6 +290,6 @@ LBL_Q:mp_clear (&q); #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index d2a213f..2004da7 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -63,6 +63,6 @@ int mp_div_2(mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index 5b9fb48..a5b8494 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -20,8 +20,6 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) { mp_digit D, r, rr; int x, res; - mp_int t; - /* if the shift count is <= 0 then we do no work */ if (b <= 0) { @@ -32,24 +30,19 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) return res; } - if ((res = mp_init (&t)) != MP_OKAY) { + /* copy */ + if ((res = mp_copy (a, c)) != MP_OKAY) { return res; } + /* 'a' should not be used after here - it might be the same as d */ /* get the remainder */ if (d != NULL) { - if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { - mp_clear (&t); + if ((res = mp_mod_2d (a, b, d)) != MP_OKAY) { return res; } } - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - mp_clear (&t); - return res; - } - /* shift by as many digits in the bit count */ if (b >= (int)DIGIT_BIT) { mp_rshd (c, b / DIGIT_BIT); @@ -84,14 +77,10 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) } } mp_clamp (c); - if (d != NULL) { - mp_exch (&t, d); - } - mp_clear (&t); return MP_OKAY; } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index c2b76fb..6c79332 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -74,6 +74,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 4df1d36..aab298a 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -110,6 +110,6 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index 599d929..d4dbec6 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -38,6 +38,6 @@ int mp_dr_is_modulus(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 2273c79..2005f3c 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -91,6 +91,6 @@ top: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 1bccb2b..7f60c67 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -27,6 +27,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index 634193b..8dd5180 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -29,6 +29,6 @@ mp_exch (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index ac4c2f9..6477dd9 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -31,12 +31,12 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, } if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } @@ -83,6 +83,6 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index 61c5a1d..0a4b90b 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -23,6 +23,6 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index 649d224..3bef24a 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -78,6 +78,6 @@ int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 0973e44..697ef52 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -107,6 +107,6 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 8d280bd..312305e 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -67,13 +67,13 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode /* init M array */ /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { + if ((err = mp_init_size(&M[1], P->alloc)) != MP_OKAY) { return err; } /* now init the second half of the array */ for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { + if ((err = mp_init_size(&M[x], P->alloc)) != MP_OKAY) { for (y = 1<<(winsize-1); y < x; y++) { mp_clear (&M[y]); } @@ -133,7 +133,7 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode } /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { + if ((err = mp_init_size (&res, P->alloc)) != MP_OKAY) { goto LBL_M; } @@ -150,15 +150,15 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) { goto LBL_RES; } -#else - err = MP_VAL; - goto LBL_RES; -#endif /* now set M[1] to G * R mod m */ if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) { goto LBL_RES; } +#else + err = MP_VAL; + goto LBL_RES; +#endif } else { mp_set(&res, 1); if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { @@ -316,6 +316,6 @@ LBL_M: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index fbbd92c..f941385 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -29,41 +29,41 @@ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) /* initialize, (u1,u2,u3) = (1,0,a) */ mp_set(&u1, 1); - if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto LBL_ERR; } /* initialize, (v1,v2,v3) = (0,1,b) */ mp_set(&v2, 1); - if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto LBL_ERR; } /* loop while v3 != 0 */ while (mp_iszero(&v3) == MP_NO) { /* q = u3/v3 */ - if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto _ERR; } + if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto LBL_ERR; } /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ - if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto LBL_ERR; } /* (u1,u2,u3) = (v1,v2,v3) */ - if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto LBL_ERR; } /* (v1,v2,v3) = (t1,t2,t3) */ - if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto LBL_ERR; } } /* make sure U3 >= 0 */ if (u3.sign == MP_NEG) { - if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { goto LBL_ERR; } } /* copy result out */ @@ -72,11 +72,12 @@ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) if (U3 != NULL) { mp_exch(U3, &u3); } err = MP_OKAY; -_ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL); +LBL_ERR: + mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL); return err; } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index a4fa8c9..6792437 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -15,6 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ +#ifndef LTM_NO_FILE /* read a bigint from a file stream in ASCII */ int mp_fread(mp_int *a, int radix, FILE *stream) { @@ -59,9 +60,10 @@ int mp_fread(mp_int *a, int radix, FILE *stream) return MP_OKAY; } +#endif #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 90f1fc5..44812d5 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -15,6 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ +#ifndef LTM_NO_FILE int mp_fwrite(mp_int *a, int radix, FILE *stream) { char *buf; @@ -44,9 +45,10 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) XFREE (buf); return MP_OKAY; } +#endif #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 16acfd9..fdefc1b 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -100,6 +100,6 @@ LBL_U:mp_clear (&v); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 99fb850..4d8ecd2 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -40,6 +40,6 @@ unsigned long mp_get_int(mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index cbdcfed..7fbc5a2 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -52,6 +52,6 @@ int mp_grow (mp_int * a, int size) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index dd4b8e6..c615a84 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -27,12 +27,12 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, mp_zero(rop); if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } @@ -68,6 +68,6 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index 7a57730..8a26f09 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -41,6 +41,6 @@ int mp_init (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index 9e15f36..ab0e130 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -23,10 +23,15 @@ int mp_init_copy (mp_int * a, mp_int * b) if ((res = mp_init_size (a, b->used)) != MP_OKAY) { return res; } - return mp_copy (b, a); + + if((res = mp_copy (b, a)) != MP_OKAY) { + mp_clear(a); + } + + return res; } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index 52220a3..78ed62d 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -31,9 +31,6 @@ int mp_init_multi(mp_int *mp, ...) */ va_list clean_args; - /* end the current list */ - va_end(args); - /* now start cleaning up */ cur_arg = mp; va_start(clean_args, mp); @@ -54,6 +51,6 @@ int mp_init_multi(mp_int *mp, ...) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index c337e50..0b5cf36 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -27,6 +27,6 @@ int mp_init_set (mp_int * a, mp_digit b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index c88f14e..a9bf232 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -26,6 +26,6 @@ int mp_init_set_int (mp_int * a, unsigned long b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index e1d1b51..44b875f 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -43,6 +43,6 @@ int mp_init_size (mp_int * a, int size) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index 44951e5..c374fd2 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -25,7 +25,7 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) #ifdef BN_FAST_MP_INVMOD_C /* if the modulus is odd we can use a faster routine instead */ - if (mp_isodd (b) == MP_YES) { + if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { return fast_mp_invmod (a, b, c); } #endif @@ -38,6 +38,6 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index a21f947..879e971 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -170,6 +170,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 9f065ef..15e632e 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -104,6 +104,6 @@ ERR:mp_clear(&t); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 3c114e3..4e6c474 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -112,6 +112,6 @@ LBL_A1:mp_clear (&a1); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index d65e37e..307a0d9 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -162,6 +162,6 @@ ERR: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 739840d..3993cd9 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -116,6 +116,6 @@ ERR: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index 3bff571..b6a0ec1 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -55,6 +55,6 @@ LBL_T: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index f6f800f..b6cb111 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -62,6 +62,6 @@ int mp_lshd (mp_int * a, int b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index b67467d..0c9bc3e 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -22,7 +22,7 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) mp_int t; int res; - if ((res = mp_init (&t)) != MP_OKAY) { + if ((res = mp_init_size (&t, b->used)) != MP_OKAY) { return res; } @@ -43,6 +43,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 926f810..1f2c47c 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -50,6 +50,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index d8722f0..4553cba 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -22,6 +22,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index ea87cbd..2b11749 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -54,6 +54,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index af2cc58..d3746a6 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -113,6 +113,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 264a2bd..c71d362 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -54,6 +54,6 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index ea53d5e..d81f68b 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -62,6 +62,6 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index 9c72c7f..20fb9d6 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -77,6 +77,6 @@ int mp_mul_2(mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index 9967e46..b5d3cae 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -80,6 +80,6 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index e77da5d..c0c24cd 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -74,6 +74,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index 5ea88ef..375674f 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -21,7 +21,7 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) int res; mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { + if ((res = mp_init_size (&t, c->used)) != MP_OKAY) { return res; } @@ -35,6 +35,6 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index a14ee67..b7a4817 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -25,6 +25,6 @@ int mp_n_root (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 79d1dfb..c163c1d 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -127,6 +127,6 @@ LBL_T1:mp_clear (&t1); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index ea32e46..b8a014a 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -35,6 +35,6 @@ int mp_neg (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index b7f2e4f..fc303d2 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -45,6 +45,6 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 9dc9e85..1b1300c 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -57,6 +57,6 @@ LBL_T:mp_clear (&t); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index 5854f08..b97390e 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -45,6 +45,6 @@ int mp_prime_is_divisible (mp_int * a, int *result) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index be5ebe4..4a36047 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -78,6 +78,6 @@ LBL_B:mp_clear (&b); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 7b5c8d2..569d78a 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -98,6 +98,6 @@ LBL_N1:mp_clear (&n1); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index 9951dc3..c0b7895 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -165,6 +165,6 @@ LBL_ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index bca4229..ad954cc 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -47,6 +47,6 @@ int mp_prime_rabin_miller_trials(int size) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index 1efc4fc..655e8ae 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -119,6 +119,6 @@ error: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index e5d7772..e9cb55a 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -73,6 +73,6 @@ int mp_radix_size (mp_int * a, int radix, int *size) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c index d1c75ad..425e0e6 100644 --- a/libtommath/bn_mp_radix_smap.c +++ b/libtommath/bn_mp_radix_smap.c @@ -19,6 +19,6 @@ const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 4c9610d..7c8f106 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -15,7 +15,32 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ +#if MP_GEN_RANDOM_MAX == 0xffffffff + #define MP_GEN_RANDOM_SHIFT 32 +#elif MP_GEN_RANDOM_MAX == 32767 + /* SHRT_MAX */ + #define MP_GEN_RANDOM_SHIFT 15 +#elif MP_GEN_RANDOM_MAX == 2147483647 + /* INT_MAX */ + #define MP_GEN_RANDOM_SHIFT 31 +#elif !defined(MP_GEN_RANDOM_SHIFT) +#error Thou shalt define their own valid MP_GEN_RANDOM_SHIFT +#endif + /* makes a pseudo-random int of a given size */ +static mp_digit s_gen_random(void) +{ + mp_digit d = 0, msk = 0; + do { + d <<= MP_GEN_RANDOM_SHIFT; + d |= ((mp_digit) MP_GEN_RANDOM()); + msk <<= MP_GEN_RANDOM_SHIFT; + msk |= (MP_MASK & MP_GEN_RANDOM_MAX); + } while ((MP_MASK & msk) != MP_MASK); + d &= MP_MASK; + return d; +} + int mp_rand (mp_int * a, int digits) { @@ -29,7 +54,7 @@ mp_rand (mp_int * a, int digits) /* first place a random non-zero digit */ do { - d = ((mp_digit) abs (MP_GEN_RANDOM())) & MP_MASK; + d = s_gen_random(); } while (d == 0); if ((res = mp_add_d (a, d, a)) != MP_OKAY) { @@ -41,7 +66,7 @@ mp_rand (mp_int * a, int digits) return res; } - if ((res = mp_add_d (a, ((mp_digit) abs (MP_GEN_RANDOM())), a)) != MP_OKAY) { + if ((res = mp_add_d (a, s_gen_random(), a)) != MP_OKAY) { return res; } } @@ -50,6 +75,6 @@ mp_rand (mp_int * a, int digits) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 5c9eb5e..6f2cc04 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -80,6 +80,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index a4d4760..1448d21 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -36,6 +36,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index e8e5df8..b2e399d 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -50,6 +50,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index e2c3a58..c15b54e 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -95,6 +95,6 @@ CLEANUP: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 2876a75..daea5e7 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -58,6 +58,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index 3225214..d6c2aa4 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -59,6 +59,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index 545051e..f4650b4 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -42,6 +42,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 59132dd..7945d6a 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -39,6 +39,6 @@ ERR: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index 784947b..e68d704 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -47,6 +47,6 @@ int mp_reduce_is_2k(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index c193f39..5426352 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -39,6 +39,6 @@ int mp_reduce_is_2k_l(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index f97eed5..d3ed42f 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -29,6 +29,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index 77b0f6c..6ea4f2f 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -67,6 +67,6 @@ void mp_rshd (mp_int * a, int b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index cac48ea..c10850d 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -24,6 +24,6 @@ void mp_set (mp_int * a, mp_digit b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index 5aa59d5..3e9ae87 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -43,6 +43,6 @@ int mp_set_int (mp_int * a, unsigned long b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set_long.c b/libtommath/bn_mp_set_long.c index 281fce7..680781b 100644 --- a/libtommath/bn_mp_set_long.c +++ b/libtommath/bn_mp_set_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long, unsigned long) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 3c4b01a..7fde01a 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long_long, unsigned long long) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index 1ad2ede..ef71874 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -36,6 +36,6 @@ int mp_shrink (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 0e760a6..261f036 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -22,6 +22,6 @@ int mp_signed_bin_size (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index ad2099b..e0c2e85 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -55,6 +55,6 @@ mp_sqr (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 2f9463d..25ca55e 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -36,6 +36,6 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 4a52f5e..77078e8 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -76,6 +76,6 @@ E2: mp_clear(&t1); #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 0d616c2..cf7d58e 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -54,6 +54,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index f5a932f..482de39 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -88,6 +88,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 87e0889..f6098b3 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -37,6 +37,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index e9289ea..077b0bf 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -28,6 +28,6 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index d4fe6e6..2edb8e0 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -26,6 +26,6 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index d3ef46f..203bf75 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -43,6 +43,6 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index 2da13cc..d28d7f4 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -26,6 +26,6 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 4731f8f..dc4f0a9 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -281,6 +281,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 69b69d4..06a568e 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -223,6 +223,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index f04352d..5bd9165 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -70,6 +70,6 @@ int mp_toradix (mp_int * a, char *str, int radix) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 19b61d7..d1587a3 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -83,6 +83,6 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index 0312625..e81cd82 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -23,6 +23,6 @@ int mp_unsigned_bin_size (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 3c2ba9e..1fc8bdf 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -46,6 +46,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index 21365ed..f607ce6 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -31,6 +31,6 @@ void mp_zero (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index ae727a4..4354a48 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -56,6 +56,6 @@ const mp_digit ltm_prime_tab[] = { }; #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index fc6eb2d..9811a81 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -34,6 +34,6 @@ bn_reverse (unsigned char *s, int len) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index c2ad649..5d886e7 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -104,6 +104,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index 63e1b1e..617b56c 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -247,6 +247,6 @@ LBL_M: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index bd8553d..cf2f50c 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -85,6 +85,6 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 153cea44..1d5b2f0 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -76,6 +76,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index 68c95bc..b85f1b8 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -79,6 +79,6 @@ int s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index c0ea556..ac3f785 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -84,6 +84,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bncore.c b/libtommath/bncore.c index 9552714..8bd4681 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -31,6 +31,6 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub TOOM_SQR_CUTOFF = 400; #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 4c66e15..0a065f6 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -27,7 +27,12 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \ + defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \ + defined(__s390x__) || defined(__arch64__) || defined(__aarch64__) || \ + defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \ + defined(__ia64) || defined(__ia64__) || defined(__itanium__) || defined(_M_IA64) || \ + defined(__LP64__) || defined(_LP64) || defined(__64BIT__) #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif @@ -57,11 +62,6 @@ extern "C" { #endif #elif defined(MP_64BIT) /* for GCC only on supported platforms */ -#ifndef CRYPT - typedef unsigned long long ulong64; - typedef signed long long long64; -#endif - typedef uint64_t mp_digit; #if defined(_WIN32) typedef unsigned __int128 mp_word; @@ -78,11 +78,6 @@ extern "C" { /* this is the default case, 28-bit digits */ /* this is to make porting into LibTomCrypt easier :-) */ -#ifndef CRYPT - typedef unsigned long long ulong64; - typedef signed long long long64; -#endif - typedef uint32_t mp_digit; typedef uint64_t mp_word; @@ -104,16 +99,16 @@ extern "C" { typedef mp_digit mp_min_u32; #endif -/* platforms that can use a better rand function */ +/* use arc4random on platforms that support it */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) - #define MP_USE_ALT_RAND 1 + #define MP_GEN_RANDOM() arc4random() + #define MP_GEN_RANDOM_MAX 0xffffffff #endif -/* use arc4random on platforms that support it */ -#ifdef MP_USE_ALT_RAND - #define MP_GEN_RANDOM() arc4random() -#else +/* use rand() as fall-back if there's no better rand function */ +#ifndef MP_GEN_RANDOM #define MP_GEN_RANDOM() rand() + #define MP_GEN_RANDOM_MAX RAND_MAX #endif #define MP_DIGIT_BIT DIGIT_BIT @@ -570,6 +565,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/tommath_class.h b/libtommath/tommath_class.h index 2085521..e860613 100644 --- a/libtommath/tommath_class.h +++ b/libtommath/tommath_class.h @@ -282,12 +282,9 @@ #if defined(BN_MP_DIV_2D_C) #define BN_MP_COPY_C #define BN_MP_ZERO_C - #define BN_MP_INIT_C #define BN_MP_MOD_2D_C - #define BN_MP_CLEAR_C #define BN_MP_RSHD_C #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C #endif #if defined(BN_MP_DIV_3_C) @@ -359,7 +356,7 @@ #if defined(BN_MP_EXPTMOD_FAST_C) #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_C + #define BN_MP_INIT_SIZE_C #define BN_MP_CLEAR_C #define BN_MP_MONTGOMERY_SETUP_C #define BN_FAST_MP_MONTGOMERY_REDUCE_C @@ -441,6 +438,7 @@ #if defined(BN_MP_INIT_COPY_C) #define BN_MP_INIT_SIZE_C #define BN_MP_COPY_C + #define BN_MP_CLEAR_C #endif #if defined(BN_MP_INIT_MULTI_C) @@ -466,6 +464,7 @@ #if defined(BN_MP_INVMOD_C) #define BN_MP_ISZERO_C #define BN_MP_ISODD_C + #define BN_MP_CMP_D_C #define BN_FAST_MP_INVMOD_C #define BN_MP_INVMOD_SLOW_C #endif @@ -500,6 +499,7 @@ #endif #if defined(BN_MP_JACOBI_C) + #define BN_MP_ISNEG_C #define BN_MP_CMP_D_C #define BN_MP_ISZERO_C #define BN_MP_INIT_COPY_C @@ -546,7 +546,7 @@ #endif #if defined(BN_MP_MOD_C) - #define BN_MP_INIT_C + #define BN_MP_INIT_SIZE_C #define BN_MP_DIV_C #define BN_MP_CLEAR_C #define BN_MP_ISZERO_C @@ -610,7 +610,7 @@ #endif #if defined(BN_MP_MULMOD_C) - #define BN_MP_INIT_C + #define BN_MP_INIT_SIZE_C #define BN_MP_MUL_C #define BN_MP_CLEAR_C #define BN_MP_MOD_C diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index bc7cd35..407ebd5 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -18,9 +18,13 @@ #include #include -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#ifndef MIN + #define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#endif -#define MAX(x,y) (((x) > (y)) ? (x) : (y)) +#ifndef MAX + #define MAX(x,y) (((x) > (y)) ? (x) : (y)) +#endif #ifdef __cplusplus extern "C" { @@ -114,6 +118,6 @@ int func_name (mp_int * a, type b) \ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index 1b26841..8f6ef03 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -71,6 +71,6 @@ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ -- cgit v0.12 From 1ef0babc38bf484a63c5bdcb56bed55f2df1bbab Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 19:55:52 +0000 Subject: Fix eol-style (fossil warning: mixed line endings) --- libtommath/bn_mp_export.c | 10 +++++----- libtommath/bn_mp_import.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 6477dd9..58d71d5 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -31,12 +31,12 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, } if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index c615a84..d9248fd 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -27,12 +27,12 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, mp_zero(rop); if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } -- cgit v0.12 From 2d65cb751401d640fd8a1d1aebc90f96c9bb8019 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 20:39:15 +0000 Subject: libtommath 1.0.1 --- libtommath/bn_error.c | 6 +++--- libtommath/bn_fast_mp_invmod.c | 6 +++--- libtommath/bn_fast_mp_montgomery_reduce.c | 6 +++--- libtommath/bn_fast_s_mp_mul_digs.c | 6 +++--- libtommath/bn_fast_s_mp_mul_high_digs.c | 6 +++--- libtommath/bn_fast_s_mp_sqr.c | 6 +++--- libtommath/bn_mp_2expt.c | 6 +++--- libtommath/bn_mp_abs.c | 6 +++--- libtommath/bn_mp_add.c | 6 +++--- libtommath/bn_mp_add_d.c | 6 +++--- libtommath/bn_mp_addmod.c | 6 +++--- libtommath/bn_mp_and.c | 6 +++--- libtommath/bn_mp_clamp.c | 6 +++--- libtommath/bn_mp_clear.c | 6 +++--- libtommath/bn_mp_clear_multi.c | 6 +++--- libtommath/bn_mp_cmp.c | 6 +++--- libtommath/bn_mp_cmp_d.c | 6 +++--- libtommath/bn_mp_cmp_mag.c | 6 +++--- libtommath/bn_mp_cnt_lsb.c | 6 +++--- libtommath/bn_mp_copy.c | 6 +++--- libtommath/bn_mp_count_bits.c | 6 +++--- libtommath/bn_mp_div.c | 6 +++--- libtommath/bn_mp_div_2.c | 6 +++--- libtommath/bn_mp_div_2d.c | 6 +++--- libtommath/bn_mp_div_3.c | 6 +++--- libtommath/bn_mp_div_d.c | 6 +++--- libtommath/bn_mp_dr_is_modulus.c | 6 +++--- libtommath/bn_mp_dr_reduce.c | 6 +++--- libtommath/bn_mp_dr_setup.c | 6 +++--- libtommath/bn_mp_exch.c | 6 +++--- libtommath/bn_mp_export.c | 6 +++--- libtommath/bn_mp_expt_d.c | 6 +++--- libtommath/bn_mp_expt_d_ex.c | 6 +++--- libtommath/bn_mp_exptmod.c | 6 +++--- libtommath/bn_mp_exptmod_fast.c | 6 +++--- libtommath/bn_mp_exteuclid.c | 6 +++--- libtommath/bn_mp_fread.c | 6 +++--- libtommath/bn_mp_fwrite.c | 6 +++--- libtommath/bn_mp_gcd.c | 6 +++--- libtommath/bn_mp_get_int.c | 6 +++--- libtommath/bn_mp_grow.c | 6 +++--- libtommath/bn_mp_import.c | 6 +++--- libtommath/bn_mp_init.c | 6 +++--- libtommath/bn_mp_init_copy.c | 6 +++--- libtommath/bn_mp_init_multi.c | 6 +++--- libtommath/bn_mp_init_set.c | 6 +++--- libtommath/bn_mp_init_set_int.c | 6 +++--- libtommath/bn_mp_init_size.c | 6 +++--- libtommath/bn_mp_invmod.c | 6 +++--- libtommath/bn_mp_invmod_slow.c | 6 +++--- libtommath/bn_mp_is_square.c | 6 +++--- libtommath/bn_mp_jacobi.c | 6 +++--- libtommath/bn_mp_karatsuba_mul.c | 6 +++--- libtommath/bn_mp_karatsuba_sqr.c | 6 +++--- libtommath/bn_mp_lcm.c | 6 +++--- libtommath/bn_mp_lshd.c | 6 +++--- libtommath/bn_mp_mod.c | 6 +++--- libtommath/bn_mp_mod_2d.c | 6 +++--- libtommath/bn_mp_mod_d.c | 6 +++--- libtommath/bn_mp_montgomery_calc_normalization.c | 6 +++--- libtommath/bn_mp_montgomery_reduce.c | 6 +++--- libtommath/bn_mp_montgomery_setup.c | 6 +++--- libtommath/bn_mp_mul.c | 6 +++--- libtommath/bn_mp_mul_2.c | 6 +++--- libtommath/bn_mp_mul_2d.c | 6 +++--- libtommath/bn_mp_mul_d.c | 6 +++--- libtommath/bn_mp_mulmod.c | 6 +++--- libtommath/bn_mp_n_root.c | 6 +++--- libtommath/bn_mp_n_root_ex.c | 6 +++--- libtommath/bn_mp_neg.c | 6 +++--- libtommath/bn_mp_or.c | 6 +++--- libtommath/bn_mp_prime_fermat.c | 6 +++--- libtommath/bn_mp_prime_is_divisible.c | 6 +++--- libtommath/bn_mp_prime_is_prime.c | 6 +++--- libtommath/bn_mp_prime_miller_rabin.c | 6 +++--- libtommath/bn_mp_prime_next_prime.c | 6 +++--- libtommath/bn_mp_prime_rabin_miller_trials.c | 6 +++--- libtommath/bn_mp_prime_random_ex.c | 6 +++--- libtommath/bn_mp_radix_size.c | 6 +++--- libtommath/bn_mp_radix_smap.c | 6 +++--- libtommath/bn_mp_rand.c | 6 +++--- libtommath/bn_mp_read_radix.c | 6 +++--- libtommath/bn_mp_read_signed_bin.c | 6 +++--- libtommath/bn_mp_read_unsigned_bin.c | 6 +++--- libtommath/bn_mp_reduce.c | 6 +++--- libtommath/bn_mp_reduce_2k.c | 6 +++--- libtommath/bn_mp_reduce_2k_l.c | 6 +++--- libtommath/bn_mp_reduce_2k_setup.c | 6 +++--- libtommath/bn_mp_reduce_2k_setup_l.c | 6 +++--- libtommath/bn_mp_reduce_is_2k.c | 6 +++--- libtommath/bn_mp_reduce_is_2k_l.c | 6 +++--- libtommath/bn_mp_reduce_setup.c | 6 +++--- libtommath/bn_mp_rshd.c | 6 +++--- libtommath/bn_mp_set.c | 6 +++--- libtommath/bn_mp_set_int.c | 6 +++--- libtommath/bn_mp_set_long.c | 6 +++--- libtommath/bn_mp_set_long_long.c | 6 +++--- libtommath/bn_mp_shrink.c | 6 +++--- libtommath/bn_mp_signed_bin_size.c | 6 +++--- libtommath/bn_mp_sqr.c | 6 +++--- libtommath/bn_mp_sqrmod.c | 6 +++--- libtommath/bn_mp_sqrt.c | 6 +++--- libtommath/bn_mp_sub.c | 6 +++--- libtommath/bn_mp_sub_d.c | 6 +++--- libtommath/bn_mp_submod.c | 6 +++--- libtommath/bn_mp_to_signed_bin.c | 6 +++--- libtommath/bn_mp_to_signed_bin_n.c | 6 +++--- libtommath/bn_mp_to_unsigned_bin.c | 6 +++--- libtommath/bn_mp_to_unsigned_bin_n.c | 6 +++--- libtommath/bn_mp_toom_mul.c | 6 +++--- libtommath/bn_mp_toom_sqr.c | 6 +++--- libtommath/bn_mp_toradix.c | 6 +++--- libtommath/bn_mp_toradix_n.c | 6 +++--- libtommath/bn_mp_unsigned_bin_size.c | 6 +++--- libtommath/bn_mp_xor.c | 6 +++--- libtommath/bn_mp_zero.c | 6 +++--- libtommath/bn_prime_tab.c | 6 +++--- libtommath/bn_reverse.c | 6 +++--- libtommath/bn_s_mp_add.c | 6 +++--- libtommath/bn_s_mp_exptmod.c | 6 +++--- libtommath/bn_s_mp_mul_digs.c | 6 +++--- libtommath/bn_s_mp_mul_high_digs.c | 6 +++--- libtommath/bn_s_mp_sqr.c | 6 +++--- libtommath/bn_s_mp_sub.c | 6 +++--- libtommath/bncore.c | 6 +++--- libtommath/tommath.h | 6 +++--- libtommath/tommath_private.h | 6 +++--- libtommath/tommath_superclass.h | 6 +++--- 128 files changed, 384 insertions(+), 384 deletions(-) diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 397f834..380f46a 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -42,6 +42,6 @@ const char *mp_error_to_string(int code) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index fa31853..c1d6271 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -143,6 +143,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index d13452d..4d74630 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -167,6 +167,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index 18bea3f..59cfa38 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -102,6 +102,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 8fd5117..16f056c 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -93,6 +93,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index 293c54a..8fa8958 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -109,6 +109,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index eb5e664..36915bb 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -43,6 +43,6 @@ mp_2expt (mp_int * a, int b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index 16662c0..f3ec518 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -38,6 +38,6 @@ mp_abs (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 0d91d24..2487aba 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -48,6 +48,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 6b9dbef..b7c8ea8 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -107,6 +107,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 800e10a..706e739 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -36,6 +36,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 6a18639..46c41a2 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -52,6 +52,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index b392c10..149f1a8 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -39,6 +39,6 @@ mp_clamp (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index bf0873a..37ce1e1 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -39,6 +39,6 @@ mp_clear (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index e659cf8..583b1da 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -29,6 +29,6 @@ void mp_clear_multi(mp_int *mp, ...) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 6266a7e..538ba34 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -38,6 +38,6 @@ mp_cmp (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index a1cdaa1..e66b1e4 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -39,6 +39,6 @@ int mp_cmp_d(mp_int * a, mp_digit b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index b3839f0..d46a1be 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -50,6 +50,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 42d2219..1cf6159 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -48,6 +48,6 @@ int mp_cnt_lsb(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 6f2ee59..1ba7381 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -63,6 +63,6 @@ mp_copy (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index e2db126..bd12a87 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -40,6 +40,6 @@ mp_count_bits (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 81d30eb..73f8779 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -290,6 +290,6 @@ LBL_Q:mp_clear (&q); #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index 2004da7..a428869 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -63,6 +63,6 @@ int mp_div_2(mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index a5b8494..b8e27ba 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -81,6 +81,6 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index 6c79332..b716b22 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -74,6 +74,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index aab298a..a2022ad 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -110,6 +110,6 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index d4dbec6..f6d39c1 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -38,6 +38,6 @@ int mp_dr_is_modulus(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 2005f3c..920b52e 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -91,6 +91,6 @@ top: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 7f60c67..3aac30f 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -27,6 +27,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index 8dd5180..5b5b359 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -29,6 +29,6 @@ mp_exch (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 58d71d5..2e71a27 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -83,6 +83,6 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index 0a4b90b..d5ca456 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -23,6 +23,6 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index 3bef24a..dced5a1 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -78,6 +78,6 @@ int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 697ef52..0998ce7 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -107,6 +107,6 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 312305e..3322544 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -316,6 +316,6 @@ LBL_M: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index f941385..d9951ec 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -78,6 +78,6 @@ LBL_ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index 6792437..4e38c6f 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -64,6 +64,6 @@ int mp_fread(mp_int *a, int radix, FILE *stream) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 44812d5..daa15db 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -49,6 +49,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index fdefc1b..40e7034 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -100,6 +100,6 @@ LBL_U:mp_clear (&v); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 4d8ecd2..f99ffb2 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -40,6 +40,6 @@ unsigned long mp_get_int(mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index 7fbc5a2..3d47822 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -52,6 +52,6 @@ int mp_grow (mp_int * a, int size) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index d9248fd..22e2342 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -68,6 +68,6 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index 8a26f09..0f628df 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -41,6 +41,6 @@ int mp_init (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index ab0e130..c918d46 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -32,6 +32,6 @@ int mp_init_copy (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index 78ed62d..c121188 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -51,6 +51,6 @@ int mp_init_multi(mp_int *mp, ...) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index 0b5cf36..24dc8bb 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -27,6 +27,6 @@ int mp_init_set (mp_int * a, mp_digit b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index a9bf232..5a75e3e 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -26,6 +26,6 @@ int mp_init_set_int (mp_int * a, unsigned long b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index 44b875f..4e30a2b 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -43,6 +43,6 @@ int mp_init_size (mp_int * a, int size) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index c374fd2..75763ab 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -38,6 +38,6 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index 879e971..cb7233d 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -170,6 +170,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 15e632e..56d19c0 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -104,6 +104,6 @@ ERR:mp_clear(&t); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 4e6c474..8d147e0 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -112,6 +112,6 @@ LBL_A1:mp_clear (&a1); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 307a0d9..31ed2e3 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -162,6 +162,6 @@ ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 3993cd9..33a2bee 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -116,6 +116,6 @@ ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index b6a0ec1..d4bb1b6 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -55,6 +55,6 @@ LBL_T: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index b6cb111..e4f9abc 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -62,6 +62,6 @@ int mp_lshd (mp_int * a, int b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 0c9bc3e..0bc9530 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -43,6 +43,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 1f2c47c..472aa58 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -50,6 +50,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 4553cba..6fbc2c3 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -22,6 +22,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 2b11749..3e66d3f 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -54,6 +54,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index d3746a6..b64c80a 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -113,6 +113,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index c71d362..b15bafd 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -54,6 +54,6 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index d81f68b..3819c0a 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -62,6 +62,6 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index 20fb9d6..eba1450 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -77,6 +77,6 @@ int mp_mul_2(mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index b5d3cae..798a1da 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -80,6 +80,6 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index c0c24cd..fa918da 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -74,6 +74,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index 375674f..3c7e41b 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -35,6 +35,6 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index b7a4817..f8f9d13 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -25,6 +25,6 @@ int mp_n_root (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index c163c1d..28d6b18 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -127,6 +127,6 @@ LBL_T1:mp_clear (&t1); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index b8a014a..f488b57 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -35,6 +35,6 @@ int mp_neg (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index fc303d2..aee9734 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -45,6 +45,6 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 1b1300c..5b992b5 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -57,6 +57,6 @@ LBL_T:mp_clear (&t); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index b97390e..f97498f 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -45,6 +45,6 @@ int mp_prime_is_divisible (mp_int * a, int *result) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 4a36047..29571ba 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -78,6 +78,6 @@ LBL_B:mp_clear (&b); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 569d78a..b168f01 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -98,6 +98,6 @@ LBL_N1:mp_clear (&n1); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index c0b7895..6515b1c 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -165,6 +165,6 @@ LBL_ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index ad954cc..c98de6e 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -47,6 +47,6 @@ int mp_prime_rabin_miller_trials(int size) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index 655e8ae..04a7cf7 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -119,6 +119,6 @@ error: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index e9cb55a..4a58e41 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -73,6 +73,6 @@ int mp_radix_size (mp_int * a, int radix, int *size) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c index 425e0e6..e351146 100644 --- a/libtommath/bn_mp_radix_smap.c +++ b/libtommath/bn_mp_radix_smap.c @@ -19,6 +19,6 @@ const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 7c8f106..d5967c2 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -75,6 +75,6 @@ mp_rand (mp_int * a, int digits) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 6f2cc04..03384e3 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -80,6 +80,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index 1448d21..a034fbd 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -36,6 +36,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index b2e399d..27af256 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -50,6 +50,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index c15b54e..a87fc30 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -95,6 +95,6 @@ CLEANUP: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index daea5e7..4f13b07 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -58,6 +58,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index d6c2aa4..b41677a 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -59,6 +59,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index f4650b4..a0c507f 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -42,6 +42,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 7945d6a..7083533 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -39,6 +39,6 @@ ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index e68d704..2e61839 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -47,6 +47,6 @@ int mp_reduce_is_2k(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index 5426352..65ae46e 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -39,6 +39,6 @@ int mp_reduce_is_2k_l(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index d3ed42f..ffddbce 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -29,6 +29,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index 6ea4f2f..f412d93 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -67,6 +67,6 @@ void mp_rshd (mp_int * a, int b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index c10850d..8eec001 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -24,6 +24,6 @@ void mp_set (mp_int * a, mp_digit b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index 3e9ae87..f456a3a 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -43,6 +43,6 @@ int mp_set_int (mp_int * a, unsigned long b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set_long.c b/libtommath/bn_mp_set_long.c index 680781b..fbf9f82 100644 --- a/libtommath/bn_mp_set_long.c +++ b/libtommath/bn_mp_set_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long, unsigned long) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 7fde01a..0a688c8 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long_long, unsigned long long) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index ef71874..9422a54 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -36,6 +36,6 @@ int mp_shrink (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 261f036..bb63407 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -22,6 +22,6 @@ int mp_signed_bin_size (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index e0c2e85..299308d 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -55,6 +55,6 @@ mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 25ca55e..05ea9e0 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -36,6 +36,6 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 77078e8..72d98f0 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -76,6 +76,6 @@ E2: mp_clear(&t1); #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index cf7d58e..67da8da 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -54,6 +54,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 482de39..a4e1b1c 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -88,6 +88,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index f6098b3..ec7885c 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -37,6 +37,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index 077b0bf..109d8f7 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -28,6 +28,6 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index 2edb8e0..bcbdf79 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -26,6 +26,6 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index 203bf75..0ac9887 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -43,6 +43,6 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index d28d7f4..19fe1e4 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -26,6 +26,6 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index dc4f0a9..9a347fa 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -281,6 +281,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 06a568e..327a85f 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -223,6 +223,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 5bd9165..baf0e3b 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -70,6 +70,6 @@ int mp_toradix (mp_int * a, char *str, int radix) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index d1587a3..881cb52 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -83,6 +83,6 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index e81cd82..74f6ed0 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -23,6 +23,6 @@ int mp_unsigned_bin_size (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 1fc8bdf..9c83126 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -46,6 +46,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index f607ce6..a76c2a9 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -31,6 +31,6 @@ void mp_zero (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index 4354a48..77535c7 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -56,6 +56,6 @@ const mp_digit ltm_prime_tab[] = { }; #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index 9811a81..9c00f2b 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -34,6 +34,6 @@ bn_reverse (unsigned char *s, int len) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 5d886e7..2069d88 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -104,6 +104,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index 617b56c..8b10003 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -247,6 +247,6 @@ LBL_M: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index cf2f50c..41bca7b 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -85,6 +85,6 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 1d5b2f0..7e18680 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -76,6 +76,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index b85f1b8..3bcc7c9 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -79,6 +79,6 @@ int s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index ac3f785..260a95f 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -84,6 +84,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bncore.c b/libtommath/bncore.c index 8bd4681..b07c629 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -31,6 +31,6 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub TOOM_SQR_CUTOFF = 400; #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 0a065f6..4547488 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -565,6 +565,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 407ebd5..4c5389c 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -118,6 +118,6 @@ int func_name (mp_int * a, type b) \ #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index 8f6ef03..2489a07 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -71,6 +71,6 @@ #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ -- cgit v0.12 From 97d25d790293019ab4bbb60c7973037f9d815e25 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 21:16:54 +0000 Subject: Forgot a few files from libtommath 1.0.1 --- libtommath/callgraph.txt | 21404 +++++++++++++++++++++---------------------- libtommath/changes.txt | 18 +- libtommath/makefile | 124 +- libtommath/makefile.shared | 25 +- 4 files changed, 10698 insertions(+), 10873 deletions(-) diff --git a/libtommath/callgraph.txt b/libtommath/callgraph.txt index e98a910..52007c0 100644 --- a/libtommath/callgraph.txt +++ b/libtommath/callgraph.txt @@ -1,139 +1,156 @@ -BN_MP_KARATSUBA_MUL_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C +BNCORE_C + + +BN_ERROR_C + + +BN_FAST_MP_INVMOD_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_CMP_D_C +--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_MAG_C | +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -+--->BN_MP_CLEAR_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C -BN_MP_ZERO_C +BN_FAST_MP_MONTGOMERY_REDUCE_C ++--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C -BN_MP_SET_C -+--->BN_MP_ZERO_C +BN_FAST_S_MP_MUL_DIGS_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C -BN_MP_TO_SIGNED_BIN_C -+--->BN_MP_TO_UNSIGNED_BIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C +BN_FAST_S_MP_MUL_HIGH_DIGS_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C -BN_S_MP_SUB_C +BN_FAST_S_MP_SQR_C +--->BN_MP_GROW_C +--->BN_MP_CLAMP_C -BN_MP_JACOBI_C -+--->BN_MP_CMP_D_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C +BN_MP_2EXPT_C ++--->BN_MP_ZERO_C ++--->BN_MP_GROW_C + + +BN_MP_ABS_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C + + +BN_MP_ADDMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C -+--->BN_MP_CNT_LSB_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C +--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C | +--->BN_MP_DIV_C | | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_SET_C | | +--->BN_MP_COUNT_BITS_C | | +--->BN_MP_ABS_C @@ -150,17 +167,14 @@ BN_MP_JACOBI_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_COPY_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C @@ -169,701 +183,934 @@ BN_MP_JACOBI_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C | +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -BN_MP_INIT_COPY_C -+--->BN_MP_INIT_SIZE_C -+--->BN_MP_COPY_C +BN_MP_ADD_C ++--->BN_S_MP_ADD_C | +--->BN_MP_GROW_C - - -BN_MP_ABS_C -+--->BN_MP_COPY_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C -BN_MP_RADIX_SMAP_C - - -BN_MP_EXCH_C +BN_MP_ADD_D_C ++--->BN_MP_GROW_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C -BN_MP_EXPORT_C +BN_MP_AND_C +--->BN_MP_INIT_COPY_C | +--->BN_MP_INIT_SIZE_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C +--->BN_MP_CLEAR_C -BN_MP_TO_UNSIGNED_BIN_N_C -+--->BN_MP_UNSIGNED_BIN_SIZE_C -| +--->BN_MP_COUNT_BITS_C -+--->BN_MP_TO_UNSIGNED_BIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C +BN_MP_CLAMP_C -BN_MP_TO_SIGNED_BIN_N_C -+--->BN_MP_SIGNED_BIN_SIZE_C -| +--->BN_MP_UNSIGNED_BIN_SIZE_C -| | +--->BN_MP_COUNT_BITS_C -+--->BN_MP_TO_SIGNED_BIN_C -| +--->BN_MP_TO_UNSIGNED_BIN_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C +BN_MP_CLEAR_C -BN_MP_LCM_C +BN_MP_CLEAR_MULTI_C ++--->BN_MP_CLEAR_C + + +BN_MP_CMP_C ++--->BN_MP_CMP_MAG_C + + +BN_MP_CMP_D_C + + +BN_MP_CMP_MAG_C + + +BN_MP_CNT_LSB_C + + +BN_MP_COPY_C ++--->BN_MP_GROW_C + + +BN_MP_COUNT_BITS_C + + +BN_MP_DIV_2D_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_ZERO_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_RSHD_C ++--->BN_MP_CLAMP_C + + +BN_MP_DIV_2_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_MP_DIV_3_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_DIV_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_ZERO_C +--->BN_MP_INIT_MULTI_C | +--->BN_MP_INIT_C | +--->BN_MP_CLEAR_C -+--->BN_MP_GCD_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C ++--->BN_MP_SET_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_ABS_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C | | +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_EXCH_C | +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_DIV_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_SET_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C +| +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_INIT_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C ++--->BN_MP_RSHD_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_DIV_D_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_3_C | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SIZE_C | +--->BN_MP_INIT_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_DR_IS_MODULUS_C + + +BN_MP_DR_REDUCE_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C + + +BN_MP_DR_SETUP_C + + +BN_MP_EXCH_C + + +BN_MP_EXPORT_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C ++--->BN_MP_CLEAR_C + + +BN_MP_EXPTMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_INVMOD_C +| +--->BN_MP_CMP_D_C +| +--->BN_FAST_MP_INVMOD_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_INVMOD_SLOW_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_DIV_2_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_CMP_MAG_C - - -BN_MP_PRIME_RABIN_MILLER_TRIALS_C - - -BN_MP_MUL_2D_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_GROW_C -+--->BN_MP_LSHD_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -+--->BN_MP_CLAMP_C - - -BN_MP_MUL_C -+--->BN_MP_TOOM_MUL_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C ++--->BN_MP_ABS_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C ++--->BN_MP_CLEAR_MULTI_C ++--->BN_MP_REDUCE_IS_2K_L_C ++--->BN_S_MP_EXPTMOD_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_REDUCE_SETUP_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_KARATSUBA_MUL_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C +| +--->BN_MP_REDUCE_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| +--->BN_MP_CLEAR_C -+--->BN_FAST_S_MP_MUL_DIGS_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_MUL_DIGS_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C - - -BN_MP_SQR_C -+--->BN_MP_TOOM_SQR_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_D_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C +| +--->BN_MP_REDUCE_2K_SETUP_L_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_KARATSUBA_SQR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C +| +--->BN_MP_REDUCE_2K_L_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_ZERO_C -| +--->BN_MP_ADD_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_CLEAR_C -+--->BN_FAST_S_MP_SQR_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_SQR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C - - -BN_MP_INIT_C - - -BN_MP_2EXPT_C -+--->BN_MP_ZERO_C -+--->BN_MP_GROW_C - - -BN_MP_SIGNED_BIN_SIZE_C -+--->BN_MP_UNSIGNED_BIN_SIZE_C -| +--->BN_MP_COUNT_BITS_C - - -BN_MP_OR_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_MOD_C -+--->BN_MP_INIT_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_SET_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_MOD_2D_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_EXCH_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C - - -BN_MP_DIV_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_ZERO_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SET_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_ABS_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SUB_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_INIT_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_INIT_C -+--->BN_MP_INIT_COPY_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -+--->BN_MP_RSHD_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_INIT_SET_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C - - -BN_MP_PRIME_IS_PRIME_C -+--->BN_MP_CMP_D_C -+--->BN_MP_PRIME_IS_DIVISIBLE_C -| +--->BN_MP_MOD_D_C -| | +--->BN_MP_DIV_D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_2D_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_C -| | | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_DIV_3_C | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_PRIME_MILLER_RABIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_EXCH_C ++--->BN_MP_DR_IS_MODULUS_C ++--->BN_MP_REDUCE_IS_2K_C +| +--->BN_MP_REDUCE_2K_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_COUNT_BITS_C ++--->BN_MP_EXPTMOD_FAST_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_MONTGOMERY_SETUP_C +| +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXPTMOD_C -| | +--->BN_MP_INVMOD_C -| | | +--->BN_FAST_MP_INVMOD_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| +--->BN_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| +--->BN_MP_DR_SETUP_C +| +--->BN_MP_DR_REDUCE_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| +--->BN_MP_REDUCE_2K_SETUP_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_REDUCE_2K_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_MULMOD_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -871,9 +1118,7 @@ BN_MP_PRIME_IS_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -881,326 +1126,159 @@ BN_MP_PRIME_IS_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INVMOD_SLOW_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_ABS_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_REDUCE_IS_2K_L_C -| | +--->BN_S_MP_EXPTMOD_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_REDUCE_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_L_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1208,188 +1286,7 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DR_IS_MODULUS_C -| | +--->BN_MP_REDUCE_IS_2K_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1397,41 +1294,58 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_EXPTMOD_FAST_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_MONTGOMERY_SETUP_C -| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_DIV_2_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_DR_SETUP_C -| | | +--->BN_MP_DR_REDUCE_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_REDUCE_2K_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1439,423 +1353,453 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MULMOD_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_EXCH_C + + +BN_MP_EXPTMOD_FAST_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLEAR_C ++--->BN_MP_MONTGOMERY_SETUP_C ++--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_MONTGOMERY_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_DR_SETUP_C ++--->BN_MP_DR_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_REDUCE_2K_SETUP_C +| +--->BN_MP_INIT_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_2K_C +| +--->BN_MP_INIT_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MULMOD_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_SQRMOD_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_MOD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_EXCH_C + + +BN_MP_EXPT_D_C ++--->BN_MP_EXPT_D_EX_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1863,316 +1807,224 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C - - -BN_FAST_S_MP_SQR_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_UNSIGNED_BIN_SIZE_C -+--->BN_MP_COUNT_BITS_C - - -BN_MP_INIT_SIZE_C -+--->BN_MP_INIT_C - - -BN_FAST_S_MP_MUL_DIGS_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_REDUCE_IS_2K_L_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C -BN_MP_REDUCE_IS_2K_C -+--->BN_MP_REDUCE_2K_C -| +--->BN_MP_INIT_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C +BN_MP_EXPT_D_EX_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_COUNT_BITS_C - - -BN_MP_SUB_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_REDUCE_2K_SETUP_C -+--->BN_MP_INIT_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_DIV_2D_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_ZERO_C -+--->BN_MP_INIT_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +--->BN_MP_CLEAR_C -+--->BN_MP_RSHD_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C - - -BN_MP_DR_REDUCE_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C - - -BN_MP_SQRT_C -+--->BN_MP_N_ROOT_C -| +--->BN_MP_N_ROOT_EX_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_SET_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_EXPT_D_EX_C -| | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C | | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C @@ -2181,74 +2033,62 @@ BN_MP_SQRT_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_SUB_D_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_ZERO_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| +--->BN_FAST_S_MP_SQR_C | | +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C + + +BN_MP_EXTEUCLID_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C +--->BN_MP_DIV_C | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_SET_C +| +--->BN_MP_ZERO_C | +--->BN_MP_COUNT_BITS_C | +--->BN_MP_ABS_C | +--->BN_MP_MUL_2D_C | | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_C | +--->BN_MP_SUB_C @@ -2268,49 +2108,30 @@ BN_MP_SQRT_C | +--->BN_MP_DIV_2D_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C | +--->BN_MP_EXCH_C | +--->BN_MP_CLEAR_MULTI_C | | +--->BN_MP_CLEAR_C | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C | +--->BN_MP_LSHD_C | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C | +--->BN_MP_MUL_D_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C | +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_MULMOD_C -+--->BN_MP_INIT_C +--->BN_MP_MUL_C | +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C | | +--->BN_MP_MUL_2_C @@ -2343,6 +2164,7 @@ BN_MP_MULMOD_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C @@ -2352,6 +2174,7 @@ BN_MP_MULMOD_C | | | +--->BN_MP_CLEAR_C | +--->BN_MP_KARATSUBA_MUL_C | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -2371,84 +2194,205 @@ BN_MP_MULMOD_C | | +--->BN_MP_CLAMP_C | +--->BN_S_MP_MUL_DIGS_C | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_NEG_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_FREAD_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_D_C + + +BN_MP_FWRITE_C ++--->BN_MP_RADIX_SIZE_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_TORADIX_C +| +--->BN_MP_INIT_COPY_C | | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C -BN_MP_INVMOD_C -+--->BN_FAST_MP_INVMOD_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C +BN_MP_GCD_C ++--->BN_MP_ABS_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CNT_LSB_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_EXCH_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_GET_INT_C + + +BN_MP_GET_LONG_C + + +BN_MP_GET_LONG_LONG_C + + +BN_MP_GROW_C + + +BN_MP_IMPORT_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C + + +BN_MP_INIT_C + + +BN_MP_INIT_COPY_C ++--->BN_MP_INIT_SIZE_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_C + + +BN_MP_INIT_MULTI_C ++--->BN_MP_INIT_C ++--->BN_MP_CLEAR_C + + +BN_MP_INIT_SET_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C + + +BN_MP_INIT_SET_INT_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_INT_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C + + +BN_MP_INIT_SIZE_C ++--->BN_MP_INIT_C + + +BN_MP_INVMOD_C ++--->BN_MP_CMP_D_C ++--->BN_FAST_MP_INVMOD_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C | | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C @@ -2472,15 +2416,14 @@ BN_MP_INVMOD_C | | | +--->BN_MP_DIV_2D_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C @@ -2515,7 +2458,6 @@ BN_MP_INVMOD_C | | | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_C | | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_CMP_D_C | +--->BN_MP_ADD_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -2532,7 +2474,8 @@ BN_MP_INVMOD_C | | +--->BN_MP_INIT_C | | +--->BN_MP_CLEAR_C | +--->BN_MP_MOD_C -| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_DIV_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_MP_COPY_C @@ -2564,15 +2507,14 @@ BN_MP_INVMOD_C | | | +--->BN_MP_DIV_2D_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C @@ -2617,264 +2559,363 @@ BN_MP_INVMOD_C | | | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_C | | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_CMP_D_C | +--->BN_MP_CMP_MAG_C | +--->BN_MP_EXCH_C | +--->BN_MP_CLEAR_MULTI_C | | +--->BN_MP_CLEAR_C -BN_MP_PRIME_MILLER_RABIN_C -+--->BN_MP_CMP_D_C -+--->BN_MP_INIT_COPY_C +BN_MP_INVMOD_SLOW_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_C | +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C -+--->BN_MP_CNT_LSB_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_CMP_D_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C | +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_EXPTMOD_C -| +--->BN_MP_INVMOD_C -| | +--->BN_FAST_MP_INVMOD_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C + + +BN_MP_IS_SQUARE_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SET_INT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SET_INT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_GET_INT_C ++--->BN_MP_SQRT_C +| +--->BN_MP_N_ROOT_C +| | +--->BN_MP_N_ROOT_EX_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_EXPT_D_EX_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INVMOD_SLOW_C -| | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_SQR_C +| | | | | +--->BN_MP_TOOM_SQR_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_REDUCE_IS_2K_L_C -| +--->BN_S_MP_EXPTMOD_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_REDUCE_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_FAST_S_MP_SQR_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_MUL_C | | | | +--->BN_MP_TOOM_MUL_C | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C @@ -2907,8 +2948,11 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C @@ -2922,6 +2966,9 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -2929,28 +2976,7 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C @@ -2959,333 +2985,144 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_L_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_C | | | +--->BN_MP_DIV_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C | | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CMP_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_SUB_D_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_ADD_D_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DR_IS_MODULUS_C -| +--->BN_MP_REDUCE_IS_2K_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_EXPTMOD_FAST_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_MONTGOMERY_SETUP_C -| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_DR_SETUP_C -| | +--->BN_MP_DR_REDUCE_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_REDUCE_2K_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C +| +--->BN_MP_DIV_2_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C @@ -3293,734 +3130,575 @@ BN_MP_PRIME_MILLER_RABIN_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C | | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_CLEAR_C + + +BN_MP_JACOBI_C ++--->BN_MP_CMP_D_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CNT_LSB_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MULMOD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C | | +--->BN_MP_EXCH_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_SQRMOD_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_KARATSUBA_MUL_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C ++--->BN_MP_CLEAR_C + + +BN_MP_KARATSUBA_SQR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C ++--->BN_MP_ADD_C +| +--->BN_MP_CMP_MAG_C +--->BN_MP_CLEAR_C -BN_MP_READ_UNSIGNED_BIN_C -+--->BN_MP_GROW_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_N_ROOT_C -+--->BN_MP_N_ROOT_EX_C +BN_MP_LCM_C ++--->BN_MP_INIT_MULTI_C | +--->BN_MP_INIT_C -| +--->BN_MP_SET_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_GCD_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_EXCH_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_DIV_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_EXPT_D_EX_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_SET_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_CLEAR_MULTI_C | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C | | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_SUB_D_C +| +--->BN_FAST_S_MP_MUL_DIGS_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_D_C -| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_MULTI_C | +--->BN_MP_CLEAR_C -BN_MP_EXPT_D_EX_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C +BN_MP_LSHD_C ++--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C + + +BN_MP_MOD_2D_C ++--->BN_MP_ZERO_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_MP_MOD_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_SET_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C ++--->BN_MP_EXCH_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C + + +BN_MP_MOD_D_C ++--->BN_MP_DIV_D_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_MONTGOMERY_CALC_NORMALIZATION_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_2EXPT_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_GROW_C +--->BN_MP_SET_C | +--->BN_MP_ZERO_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C + + +BN_MP_MONTGOMERY_REDUCE_C ++--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C + + +BN_MP_MONTGOMERY_SETUP_C + + +BN_MP_MULMOD_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C +--->BN_MP_MUL_C | +--->BN_MP_TOOM_MUL_C | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C @@ -4060,7 +3738,6 @@ BN_MP_EXPT_D_EX_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C @@ -4069,7 +3746,6 @@ BN_MP_EXPT_D_EX_C | | +--->BN_MP_CLEAR_MULTI_C | | | +--->BN_MP_CLEAR_C | +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -4088,99 +3764,325 @@ BN_MP_EXPT_D_EX_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C | +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C +--->BN_MP_CLEAR_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLAMP_C -BN_MP_EXPT_D_C -+--->BN_MP_EXPT_D_EX_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C +BN_MP_MUL_2D_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_GROW_C ++--->BN_MP_LSHD_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C ++--->BN_MP_CLAMP_C + + +BN_MP_MUL_2_C ++--->BN_MP_GROW_C + + +BN_MP_MUL_C ++--->BN_MP_TOOM_MUL_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_ZERO_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| +--->BN_MP_SET_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C | | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C +| +--->BN_MP_MUL_2_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_KARATSUBA_MUL_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| +--->BN_MP_CLEAR_C ++--->BN_FAST_S_MP_MUL_DIGS_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_MUL_DIGS_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_MUL_D_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_MP_NEG_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C + + +BN_MP_N_ROOT_C ++--->BN_MP_N_ROOT_EX_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_EXPT_D_EX_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_ZERO_C | | | +--->BN_MP_MUL_2_C @@ -4244,34 +4146,169 @@ BN_MP_EXPT_D_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_N_ROOT_EX_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_EXPT_D_EX_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -4312,451 +4349,534 @@ BN_MP_EXPT_D_C | | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C - - -BN_MP_XOR_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_REDUCE_SETUP_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_GROW_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_SET_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_INIT_C -| +--->BN_MP_INIT_COPY_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C | +--->BN_MP_LSHD_C | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C | +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C | +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C - - -BN_MP_RSHD_C -+--->BN_MP_ZERO_C - - -BN_MP_NEG_C -+--->BN_MP_COPY_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_SUB_D_C | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C -BN_MP_SHRINK_C +BN_MP_OR_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C -BN_MP_PRIME_RANDOM_EX_C -+--->BN_MP_READ_UNSIGNED_BIN_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_PRIME_IS_PRIME_C -| +--->BN_MP_CMP_D_C -| +--->BN_MP_PRIME_IS_DIVISIBLE_C -| | +--->BN_MP_MOD_D_C -| | | +--->BN_MP_DIV_D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_INIT_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C +BN_MP_PRIME_FERMAT_C ++--->BN_MP_CMP_D_C ++--->BN_MP_INIT_C ++--->BN_MP_EXPTMOD_C +| +--->BN_MP_INVMOD_C +| | +--->BN_FAST_MP_INVMOD_C +| | | +--->BN_MP_INIT_MULTI_C | | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_PRIME_MILLER_RABIN_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SUB_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CNT_LSB_C -| | +--->BN_MP_DIV_2D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXPTMOD_C -| | | +--->BN_MP_INVMOD_C -| | | | +--->BN_FAST_MP_INVMOD_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_COPY_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_MOD_C -| | | | | | +--->BN_MP_DIV_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | | +--->BN_MP_ABS_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | | +--->BN_MP_CLEAR_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C | | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_CLEAR_MULTI_C | | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INVMOD_SLOW_C -| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_INIT_COPY_C | | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_MOD_C -| | | | | | +--->BN_MP_DIV_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | | +--->BN_MP_ABS_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | | +--->BN_MP_CLEAR_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INVMOD_SLOW_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_CLEAR_MULTI_C | | | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_REDUCE_IS_2K_L_C -| | | +--->BN_S_MP_EXPTMOD_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_REDUCE_SETUP_C -| | | | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_REDUCE_IS_2K_L_C +| +--->BN_S_MP_EXPTMOD_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_REDUCE_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_C -| | | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | | +--->BN_MP_COPY_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_MUL_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_3_C -| | | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_L_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C @@ -4764,9 +4884,7 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C @@ -4774,318 +4892,179 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | | | +--->BN_MP_2EXPT_C -| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_2K_L_C -| | | | | +--->BN_MP_MUL_C -| | | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | | +--->BN_MP_COPY_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_MUL_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_3_C -| | | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SQR_C -| | | | | +--->BN_MP_TOOM_SQR_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_DR_IS_MODULUS_C -| | | +--->BN_MP_REDUCE_IS_2K_C -| | | | +--->BN_MP_REDUCE_2K_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_EXPTMOD_FAST_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_MONTGOMERY_SETUP_C -| | | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_DR_SETUP_C -| | | | +--->BN_MP_DR_REDUCE_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_REDUCE_2K_SETUP_C -| | | | | +--->BN_MP_2EXPT_C -| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_2K_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -5093,423 +5072,332 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | | | +--->BN_MP_2EXPT_C -| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_EXCH_C +| +--->BN_MP_DR_IS_MODULUS_C +| +--->BN_MP_REDUCE_IS_2K_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_EXPTMOD_FAST_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_MONTGOMERY_SETUP_C +| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_DR_SETUP_C +| | +--->BN_MP_DR_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_REDUCE_2K_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MULMOD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MULMOD_C -| | | | | +--->BN_MP_MUL_C -| | | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | | +--->BN_MP_COPY_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_MUL_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_3_C -| | | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_MOD_C -| | | | | | +--->BN_MP_DIV_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SQR_C -| | | | | +--->BN_MP_TOOM_SQR_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_SQRMOD_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -5517,2686 +5405,941 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_CMP_D_C - - -BN_MP_DR_IS_MODULUS_C - - -BN_MP_IMPORT_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_COUNT_BITS_C - - -BN_MP_FREAD_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_D_C - - -BN_MP_REDUCE_2K_L_C -+--->BN_MP_INIT_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SQR_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_CLEAR_C + + +BN_MP_PRIME_IS_DIVISIBLE_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -BN_MP_AND_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_SQRMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C +BN_MP_PRIME_IS_PRIME_C ++--->BN_MP_CMP_D_C ++--->BN_MP_PRIME_IS_DIVISIBLE_C +| +--->BN_MP_MOD_D_C +| | +--->BN_MP_DIV_D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_INIT_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_PRIME_MILLER_RABIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C +| +--->BN_MP_SUB_D_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_D_C | | | +--->BN_MP_CLAMP_C - - -BN_MP_DIV_D_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_C -| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_DIV_3_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_INIT_MULTI_C -+--->BN_MP_INIT_C -+--->BN_MP_CLEAR_C - - -BN_S_MP_EXPTMOD_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_INIT_C -+--->BN_MP_CLEAR_C -+--->BN_MP_REDUCE_SETUP_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C | | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C +| +--->BN_MP_EXPTMOD_C +| | +--->BN_MP_INVMOD_C +| | | +--->BN_FAST_MP_INVMOD_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_S_MP_MUL_HIGH_DIGS_C -| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_D_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_2K_SETUP_L_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_2K_L_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INVMOD_SLOW_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_ABS_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_REDUCE_IS_2K_L_C +| | +--->BN_S_MP_EXPTMOD_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_REDUCE_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C +| | | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_2K_L_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_DR_IS_MODULUS_C +| | +--->BN_MP_REDUCE_IS_2K_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_EXPTMOD_FAST_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_MONTGOMERY_SETUP_C +| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_DR_SETUP_C +| | | +--->BN_MP_DR_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_EXCH_C - - -BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_GROW_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_MONTGOMERY_SETUP_C - - -BN_FAST_MP_INVMOD_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_MOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CMP_D_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_TO_UNSIGNED_BIN_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_CLEAR_MULTI_C -+--->BN_MP_CLEAR_C - - -BNCORE_C - - -BN_MP_TORADIX_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C - - -BN_MP_EXPTMOD_FAST_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_INIT_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MONTGOMERY_SETUP_C -+--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_MONTGOMERY_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_DR_SETUP_C -+--->BN_MP_DR_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_REDUCE_2K_SETUP_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_2K_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MULMOD_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_EXCH_C - - -BN_MP_MUL_D_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_SET_LONG_LONG_C - - -BN_MP_DIV_2_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_ERROR_C - - -BN_MP_RAND_C -+--->BN_MP_ZERO_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C - - -BN_S_MP_SQR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_CMP_C -+--->BN_MP_CMP_MAG_C - - -BN_MP_N_ROOT_EX_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_EXPT_D_EX_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_FAST_S_MP_SQR_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_PRIME_IS_DIVISIBLE_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C - - -BN_MP_INIT_SET_INT_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_INT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C - - -BN_MP_DIV_3_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_MONTGOMERY_REDUCE_C -+--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C - - -BN_MP_INVMOD_SLOW_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CMP_D_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_S_MP_ADD_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_READ_SIGNED_BIN_C -+--->BN_MP_READ_UNSIGNED_BIN_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C - - -BN_MP_MOD_D_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C - - -BN_MP_SQRTMOD_PRIME_C -+--->BN_MP_CMP_D_C -+--->BN_MP_ZERO_C -+--->BN_MP_JACOBI_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_EXPTMOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_INVMOD_C -| | +--->BN_FAST_MP_INVMOD_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INVMOD_SLOW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_REDUCE_IS_2K_L_C -| +--->BN_S_MP_EXPTMOD_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_REDUCE_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_C -| | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_L_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_REDUCE_2K_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DR_IS_MODULUS_C -| +--->BN_MP_REDUCE_IS_2K_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_EXPTMOD_FAST_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_MONTGOMERY_SETUP_C -| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_MONTGOMERY_REDUCE_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_DR_SETUP_C -| | +--->BN_MP_DR_REDUCE_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_REDUCE_2K_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MULMOD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MULMOD_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_DIV_C | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_MOD_C | | | | +--->BN_MP_DIV_C | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C @@ -8217,15 +6360,7 @@ BN_MP_SQRTMOD_PRIME_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C @@ -8243,545 +6378,328 @@ BN_MP_SQRTMOD_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_S_MP_SQR_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_SET_INT_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_SQRMOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_SQR_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SQRMOD_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -+--->BN_MP_MULMOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C +| | | +--->BN_S_MP_SQR_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_C | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C +| | | +--->BN_MP_DIV_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -+--->BN_MP_SET_C -+--->BN_MP_CLEAR_MULTI_C | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C -BN_FAST_S_MP_MUL_HIGH_DIGS_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_REVERSE_C - - -BN_MP_PRIME_NEXT_PRIME_C +BN_MP_PRIME_MILLER_RABIN_C +--->BN_MP_CMP_D_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_C -+--->BN_MP_ADD_D_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SUB_D_C | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C | +--->BN_MP_CLAMP_C -+--->BN_MP_PRIME_MILLER_RABIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C ++--->BN_MP_CNT_LSB_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXPTMOD_C -| | +--->BN_MP_INVMOD_C -| | | +--->BN_FAST_MP_INVMOD_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXPTMOD_C +| +--->BN_MP_INVMOD_C +| | +--->BN_FAST_MP_INVMOD_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -8789,237 +6707,429 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INVMOD_SLOW_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INVMOD_SLOW_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_REDUCE_IS_2K_L_C +| +--->BN_S_MP_EXPTMOD_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_REDUCE_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_ABS_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_REDUCE_IS_2K_L_C -| | +--->BN_S_MP_EXPTMOD_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_REDUCE_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_L_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C @@ -9028,8 +7138,52 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C @@ -9038,94 +7192,190 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_L_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_EXCH_C +| +--->BN_MP_DR_IS_MODULUS_C +| +--->BN_MP_REDUCE_IS_2K_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_EXPTMOD_FAST_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_MONTGOMERY_SETUP_C +| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_DR_SETUP_C +| | +--->BN_MP_DR_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_REDUCE_2K_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MULMOD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_MOD_C | | | | +--->BN_MP_DIV_C | | | | | +--->BN_MP_CMP_MAG_C @@ -9133,6 +7383,7 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_SET_C | | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C @@ -9154,7 +7405,6 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C @@ -9172,142 +7422,203 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_3_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_3_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DR_IS_MODULUS_C -| | +--->BN_MP_REDUCE_IS_2K_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_SQRMOD_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -9315,134 +7626,241 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_EXPTMOD_FAST_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_MONTGOMERY_SETUP_C -| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_DIV_2_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_DR_SETUP_C -| | | +--->BN_MP_DR_REDUCE_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_REDUCE_2K_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_PRIME_NEXT_PRIME_C ++--->BN_MP_CMP_D_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_PRIME_MILLER_RABIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXPTMOD_C +| | +--->BN_MP_INVMOD_C +| | | +--->BN_FAST_MP_INVMOD_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MULMOD_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C | | | | | | | +--->BN_S_MP_ADD_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | | +--->BN_S_MP_SUB_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_MP_ADD_C | | | | | | | +--->BN_S_MP_ADD_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | | +--->BN_S_MP_SUB_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INVMOD_SLOW_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_DIV_C | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C | | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_LSHD_C @@ -9464,7 +7882,8 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_RSHD_C @@ -9473,6 +7892,8 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C @@ -9482,45 +7903,20 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -9528,154 +7924,150 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_ABS_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_REDUCE_IS_2K_L_C +| | +--->BN_S_MP_EXPTMOD_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_REDUCE_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C +| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_SQRMOD_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -9683,7 +8075,9 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -9691,519 +8085,699 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_2K_L_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_C | | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C - - -BN_MP_TOOM_MUL_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MUL_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_3_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_CNT_LSB_C - - -BN_MP_CLAMP_C - - -BN_MP_SUB_D_C -+--->BN_MP_GROW_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_ADD_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_REDUCE_2K_C -+--->BN_MP_INIT_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_REDUCE_C -+--->BN_MP_REDUCE_SETUP_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_DR_IS_MODULUS_C +| | +--->BN_MP_REDUCE_IS_2K_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_EXPTMOD_FAST_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_MONTGOMERY_SETUP_C +| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_DR_SETUP_C +| | | +--->BN_MP_DR_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_REDUCE_2K_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MULMOD_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_S_MP_MUL_HIGH_DIGS_C -| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_MUL_DIGS_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_D_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_EXPTMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_INVMOD_C -| +--->BN_FAST_MP_INVMOD_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SQRMOD_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CMP_D_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_INVMOD_SLOW_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_DIV_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_INIT_MULTI_C | | | | +--->BN_MP_COUNT_BITS_C | | | | +--->BN_MP_ABS_C | | | | +--->BN_MP_MUL_2D_C @@ -10211,7 +8785,6 @@ BN_MP_EXPTMOD_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C | | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C @@ -10226,18 +8799,8 @@ BN_MP_EXPTMOD_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C @@ -10246,755 +8809,1273 @@ BN_MP_EXPTMOD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CMP_D_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_ABS_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_MULTI_C -+--->BN_MP_REDUCE_IS_2K_L_C -+--->BN_S_MP_EXPTMOD_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_REDUCE_SETUP_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_PRIME_RABIN_MILLER_TRIALS_C + + +BN_MP_PRIME_RANDOM_EX_C ++--->BN_MP_READ_UNSIGNED_BIN_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_PRIME_IS_PRIME_C +| +--->BN_MP_CMP_D_C +| +--->BN_MP_PRIME_IS_DIVISIBLE_C +| | +--->BN_MP_MOD_D_C +| | | +--->BN_MP_DIV_D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_INIT_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_INIT_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_PRIME_MILLER_RABIN_C +| | +--->BN_MP_INIT_COPY_C | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SUB_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_D_C | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CNT_LSB_C +| | +--->BN_MP_DIV_2D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXPTMOD_C +| | | +--->BN_MP_INVMOD_C +| | | | +--->BN_FAST_MP_INVMOD_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MOD_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_DIV_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | | +--->BN_MP_ABS_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | | +--->BN_MP_CLEAR_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INVMOD_SLOW_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_MOD_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_DIV_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | | +--->BN_MP_ABS_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | | +--->BN_MP_CLEAR_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_ABS_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_REDUCE_IS_2K_L_C +| | | +--->BN_S_MP_EXPTMOD_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_REDUCE_SETUP_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_REDUCE_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_C +| | | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | | +--->BN_MP_COPY_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_MUL_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_3_C +| | | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_D_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_2K_SETUP_L_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_2K_L_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_FAST_S_MP_SQR_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_REDUCE_2K_L_C +| | | | | +--->BN_MP_MUL_C +| | | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | | +--->BN_MP_COPY_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_MUL_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_3_C +| | | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_EXCH_C -+--->BN_MP_DR_IS_MODULUS_C -+--->BN_MP_REDUCE_IS_2K_C -| +--->BN_MP_REDUCE_2K_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_COUNT_BITS_C -+--->BN_MP_EXPTMOD_FAST_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_MONTGOMERY_SETUP_C -| +--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| +--->BN_MP_MONTGOMERY_REDUCE_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| +--->BN_MP_DR_SETUP_C -| +--->BN_MP_DR_REDUCE_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| +--->BN_MP_REDUCE_2K_SETUP_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_2K_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MULMOD_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_SQR_C +| | | | | +--->BN_MP_TOOM_SQR_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DR_IS_MODULUS_C +| | | +--->BN_MP_REDUCE_IS_2K_C +| | | | +--->BN_MP_REDUCE_2K_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_EXPTMOD_FAST_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_MONTGOMERY_SETUP_C +| | | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_DR_SETUP_C +| | | | +--->BN_MP_DR_REDUCE_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_REDUCE_2K_SETUP_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_REDUCE_2K_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MULMOD_C +| | | | | +--->BN_MP_MUL_C +| | | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | | +--->BN_MP_COPY_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_MUL_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_3_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_MOD_C +| | | | | | +--->BN_MP_DIV_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_SQR_C +| | | | | +--->BN_MP_TOOM_SQR_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_FAST_S_MP_SQR_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_SQRMOD_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_KARATSUBA_SQR_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_SET_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C + + +BN_MP_RADIX_SIZE_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C | | +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_RADIX_SMAP_C + + +BN_MP_RAND_C ++--->BN_MP_ZERO_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C + + +BN_MP_READ_RADIX_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C + + +BN_MP_READ_SIGNED_BIN_C ++--->BN_MP_READ_UNSIGNED_BIN_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C + + +BN_MP_READ_UNSIGNED_BIN_C ++--->BN_MP_GROW_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C + + +BN_MP_REDUCE_2K_C ++--->BN_MP_INIT_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_REDUCE_2K_L_C ++--->BN_MP_INIT_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C @@ -11003,223 +10084,167 @@ BN_MP_EXPTMOD_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C -BN_MP_LSHD_C -+--->BN_MP_GROW_C -+--->BN_MP_RSHD_C +BN_MP_REDUCE_2K_SETUP_C ++--->BN_MP_INIT_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_2EXPT_C | +--->BN_MP_ZERO_C - - -BN_MP_ADD_D_C -+--->BN_MP_GROW_C -+--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_GET_LONG_C - - -BN_MP_GET_LONG_LONG_C -BN_MP_CLEAR_C - - -BN_MP_EXTEUCLID_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SET_C +BN_MP_REDUCE_2K_SETUP_L_C ++--->BN_MP_INIT_C ++--->BN_MP_2EXPT_C | +--->BN_MP_ZERO_C -+--->BN_MP_COPY_C | +--->BN_MP_GROW_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C ++--->BN_MP_COUNT_BITS_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_REDUCE_C ++--->BN_MP_REDUCE_SETUP_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C | | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_COPY_C | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_INIT_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C +--->BN_MP_MUL_C | +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_MUL_2_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ADD_C @@ -11250,7 +10275,6 @@ BN_MP_EXTEUCLID_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C @@ -11260,7 +10284,6 @@ BN_MP_EXTEUCLID_C | | | +--->BN_MP_CLEAR_C | +--->BN_MP_KARATSUBA_MUL_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -11272,18 +10295,39 @@ BN_MP_EXTEUCLID_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLEAR_C | +--->BN_FAST_S_MP_MUL_DIGS_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C | +--->BN_S_MP_MUL_DIGS_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C ++--->BN_S_MP_MUL_HIGH_DIGS_C +| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_MUL_DIGS_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C +--->BN_MP_SUB_C | +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C @@ -11292,230 +10336,232 @@ BN_MP_EXTEUCLID_C | +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -+--->BN_MP_NEG_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_TORADIX_N_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C ++--->BN_MP_CMP_D_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C +--->BN_MP_CLEAR_C -BN_MP_RADIX_SIZE_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C +BN_MP_REDUCE_IS_2K_C ++--->BN_MP_REDUCE_2K_C +| +--->BN_MP_INIT_C +| +--->BN_MP_COUNT_BITS_C | +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C | | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C ++--->BN_MP_COUNT_BITS_C -BN_S_MP_MUL_HIGH_DIGS_C -+--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C +BN_MP_REDUCE_IS_2K_L_C -BN_MP_SET_INT_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_2D_C +BN_MP_REDUCE_SETUP_C ++--->BN_MP_2EXPT_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_GROW_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_DR_SETUP_C - - -BN_MP_MUL_2_C -+--->BN_MP_GROW_C - - -BN_MP_FWRITE_C -+--->BN_MP_RADIX_SIZE_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_SET_C | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_TORADIX_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C | | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C -BN_MP_GROW_C +BN_MP_RSHD_C ++--->BN_MP_ZERO_C -BN_MP_READ_RADIX_C +BN_MP_SET_C +--->BN_MP_ZERO_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -BN_S_MP_MUL_DIGS_C -+--->BN_FAST_S_MP_MUL_DIGS_C +BN_MP_SET_INT_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C | +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C | +--->BN_MP_CLAMP_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C +--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C -BN_PRIME_TAB_C +BN_MP_SET_LONG_C -BN_MP_IS_SQUARE_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C +BN_MP_SET_LONG_LONG_C + + +BN_MP_SHRINK_C + + +BN_MP_SIGNED_BIN_SIZE_C ++--->BN_MP_UNSIGNED_BIN_SIZE_C +| +--->BN_MP_COUNT_BITS_C + + +BN_MP_SQRMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C +| | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_SQR_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SET_INT_C -| +--->BN_MP_INIT_C -| +--->BN_MP_SET_INT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C +--->BN_MP_MOD_C -| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_SIZE_C | +--->BN_MP_DIV_C | | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_SET_C | | +--->BN_MP_COUNT_BITS_C | | +--->BN_MP_ABS_C @@ -11542,14 +10588,10 @@ BN_MP_IS_SQUARE_C | | +--->BN_MP_DIV_2D_C | | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_INIT_COPY_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C @@ -11559,8 +10601,6 @@ BN_MP_IS_SQUARE_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C | +--->BN_MP_EXCH_C | +--->BN_MP_ADD_C | | +--->BN_S_MP_ADD_C @@ -11570,161 +10610,463 @@ BN_MP_IS_SQUARE_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -+--->BN_MP_GET_INT_C -+--->BN_MP_SQRT_C -| +--->BN_MP_N_ROOT_C -| | +--->BN_MP_N_ROOT_EX_C -| | | +--->BN_MP_INIT_C + + +BN_MP_SQRTMOD_PRIME_C ++--->BN_MP_CMP_D_C ++--->BN_MP_ZERO_C ++--->BN_MP_JACOBI_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXPTMOD_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INVMOD_C +| | +--->BN_FAST_MP_INVMOD_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_EXPT_D_EX_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INVMOD_SLOW_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C | | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_SQR_C -| | | | | +--->BN_MP_TOOM_SQR_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_REDUCE_IS_2K_L_C +| +--->BN_S_MP_EXPTMOD_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_REDUCE_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_L_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_MUL_C | | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C @@ -11743,829 +11085,898 @@ BN_MP_IS_SQUARE_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_DIV_3_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C | | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_SUB_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SET_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| +--->BN_MP_DR_IS_MODULUS_C +| +--->BN_MP_REDUCE_IS_2K_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_EXPTMOD_FAST_C +| | +--->BN_MP_COUNT_BITS_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C +| | +--->BN_MP_MONTGOMERY_SETUP_C +| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_CLEAR_C - - -BN_MP_COPY_C -+--->BN_MP_GROW_C - - -BN_MP_TOOM_SQR_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_SQR_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MONTGOMERY_REDUCE_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_DR_SETUP_C +| | +--->BN_MP_DR_REDUCE_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_3_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_KARATSUBA_SQR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_REDUCE_2K_SETUP_C +| | | +--->BN_MP_2EXPT_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_MUL_2_C | | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MULMOD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -+--->BN_MP_ADD_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CLEAR_C - - -BN_MP_GCD_C -+--->BN_MP_ABS_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CNT_LSB_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_EXCH_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_MOD_2D_C -+--->BN_MP_ZERO_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_FAST_MP_MONTGOMERY_REDUCE_C -+--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C - - -BN_MP_SUBMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C +| | | +--->BN_S_MP_MUL_DIGS_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_SET_INT_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C - - -BN_MP_GET_INT_C - - -BN_MP_SET_LONG_C - - -BN_MP_ADDMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_SQRMOD_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_C | | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C - - -BN_MP_PRIME_FERMAT_C -+--->BN_MP_CMP_D_C -+--->BN_MP_INIT_C -+--->BN_MP_EXPTMOD_C -| +--->BN_MP_INVMOD_C -| | +--->BN_FAST_MP_INVMOD_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_COPY_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_MULMOD_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C | | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_SET_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_SQRT_C ++--->BN_MP_N_ROOT_C +| +--->BN_MP_N_ROOT_EX_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_EXPT_D_EX_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INVMOD_SLOW_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_REDUCE_IS_2K_L_C -| +--->BN_S_MP_EXPTMOD_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_REDUCE_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_C -| | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C | | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C @@ -12600,606 +12011,763 @@ BN_MP_PRIME_FERMAT_C | | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_KARATSUBA_SQR_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_S_MP_SQR_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_MUL_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_SUB_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_ZERO_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_RSHD_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_SET_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_SQR_C ++--->BN_MP_TOOM_SQR_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_KARATSUBA_SQR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| +--->BN_MP_ADD_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_CLEAR_C ++--->BN_FAST_S_MP_SQR_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_SQR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_SUBMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_L_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C + + +BN_MP_SUB_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C + + +BN_MP_SUB_D_C ++--->BN_MP_GROW_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C + + +BN_MP_TOOM_MUL_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_MUL_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_3_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_TOOM_SQR_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_SQR_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_3_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_TORADIX_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_TORADIX_N_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_TO_SIGNED_BIN_C ++--->BN_MP_TO_UNSIGNED_BIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C + + +BN_MP_TO_SIGNED_BIN_N_C ++--->BN_MP_SIGNED_BIN_SIZE_C +| +--->BN_MP_UNSIGNED_BIN_SIZE_C +| | +--->BN_MP_COUNT_BITS_C ++--->BN_MP_TO_SIGNED_BIN_C +| +--->BN_MP_TO_UNSIGNED_BIN_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SET_C | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DR_IS_MODULUS_C -| +--->BN_MP_REDUCE_IS_2K_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C + + +BN_MP_TO_UNSIGNED_BIN_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_TO_UNSIGNED_BIN_N_C ++--->BN_MP_UNSIGNED_BIN_SIZE_C +| +--->BN_MP_COUNT_BITS_C ++--->BN_MP_TO_UNSIGNED_BIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C + + +BN_MP_UNSIGNED_BIN_SIZE_C ++--->BN_MP_COUNT_BITS_C + + +BN_MP_XOR_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_ZERO_C + + +BN_PRIME_TAB_C + + +BN_REVERSE_C + + +BN_S_MP_ADD_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_S_MP_EXPTMOD_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_INIT_C ++--->BN_MP_CLEAR_C ++--->BN_MP_REDUCE_SETUP_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_EXPTMOD_FAST_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_MONTGOMERY_SETUP_C -| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_DR_SETUP_C -| | +--->BN_MP_DR_REDUCE_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_REDUCE_2K_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MULMOD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C @@ -13208,149 +12776,413 @@ BN_MP_PRIME_FERMAT_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_ZERO_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_D_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_2K_SETUP_L_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_2K_L_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CLEAR_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_EXCH_C -BN_MP_REDUCE_2K_SETUP_L_C -+--->BN_MP_INIT_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C +BN_S_MP_MUL_DIGS_C ++--->BN_FAST_S_MP_MUL_DIGS_C | +--->BN_MP_GROW_C -+--->BN_MP_COUNT_BITS_C -+--->BN_S_MP_SUB_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_S_MP_MUL_HIGH_DIGS_C ++--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_S_MP_SQR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C +--->BN_MP_CLEAR_C +BN_S_MP_SUB_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + diff --git a/libtommath/changes.txt b/libtommath/changes.txt index d70d589..3379f71 100644 --- a/libtommath/changes.txt +++ b/libtommath/changes.txt @@ -1,6 +1,20 @@ +XXX, 2017 +v1.0.1 + -- Dmitry Kovalenko provided fixes to mp_add_d() and mp_init_copy() + -- Matt Johnston contributed some improvements to mp_div_2d(), + mp_exptmod_fast(), mp_mod() and mp_mulmod() + -- Julien Nabet provided a fix to the error handling in mp_init_multi() + -- Ben Gardner provided a fix regarding usage of reserved keywords + -- Fixed mp_rand() to fill the correct number of bits + -- Fixed mp_invmod() + -- Use the same 64-bit detection code as in libtomcrypt + -- Correct usage of DESTDIR, PREFIX, etc. when installing the library + -- Francois Perrad updated all the perl scripts to an actual perl version + + Feb 5th, 2016 -v1.0.0 - -- Bump to 1.0.0 +v1.0 + -- Bump to 1.0 -- Dirkjan Bussink provided a faster version of mp_expt_d() -- Moritz Lenz contributed a fix to mp_mod() and provided mp_get_long() and mp_set_long() diff --git a/libtommath/makefile b/libtommath/makefile index f90971c..fdd2435 100644 --- a/libtommath/makefile +++ b/libtommath/makefile @@ -8,12 +8,6 @@ else silent=@ endif -%.o: %.c -ifneq ($V,1) - @echo " * ${CC} $@" -endif - ${silent} ${CC} -c ${CFLAGS} $^ -o $@ - #default files to install ifndef LIBNAME LIBNAME=libtommath.a @@ -21,7 +15,13 @@ endif coverage: LIBNAME:=-Wl,--whole-archive $(LIBNAME) -Wl,--no-whole-archive -include makefile.include +include makefile_include.mk + +%.o: %.c +ifneq ($V,1) + @echo " * ${CC} $@" +endif + ${silent} ${CC} -c ${CFLAGS} $< -o $@ LCOV_ARGS=--directory . @@ -53,6 +53,8 @@ bn_s_mp_sqr.o bn_s_mp_sub.o #END_INS +$(OBJECTS): $(HEADERS) + $(LIBNAME): $(OBJECTS) $(AR) $(ARFLAGS) $@ $(OBJECTS) $(RANLIB) $@ @@ -86,6 +88,10 @@ install: $(LIBNAME) install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH) install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH) +uninstall: + rm $(DESTDIR)$(LIBPATH)/$(LIBNAME) + rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%) + test: $(LIBNAME) demo/demo.o $(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test @@ -96,94 +102,50 @@ test_standalone: $(LIBNAME) demo/demo.o mtest: cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest +travis_mtest: test mtest + @ for i in `seq 1 10` ; do sleep 500 && echo alive; done & + ./mtest/mtest 666666 | ./test > test.log + timing: $(LIBNAME) $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest -coveralls: coverage - cpp-coveralls - -# makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think] -docdvi: tommath.src - cd pics ; MAKE=${MAKE} ${MAKE} - echo "hello" > tommath.ind - perl booker.pl - latex tommath > /dev/null - latex tommath > /dev/null - makeindex tommath - latex tommath > /dev/null - -# poster, makes the single page PDF poster -poster: poster.tex - cp poster.tex poster.bak - touch --reference=poster.tex poster.bak - (printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y poster.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > poster-deterministic.tex - printf "%s\n" "\pdfinfo{" >> poster-deterministic.tex - printf "%s\n" " /CreationDate (\fixedpdfdate)" >> poster-deterministic.tex - printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> poster-deterministic.tex - cat poster.tex >> poster-deterministic.tex - mv poster-deterministic.tex poster.tex - touch --reference=poster.bak poster.tex - pdflatex poster - sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' poster.pdf - mv poster.bak poster.tex - rm -f poster.aux poster.log poster.out - -# makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files -docs: docdvi - dvipdf tommath - rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg - cd pics ; MAKE=${MAKE} ${MAKE} clean - -#LTM user manual -mandvi: bn.tex - cp bn.tex bn.bak - touch --reference=bn.tex bn.bak - (printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y bn.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > bn-deterministic.tex - printf "%s\n" "\pdfinfo{" >> bn-deterministic.tex - printf "%s\n" " /CreationDate (\fixedpdfdate)" >> bn-deterministic.tex - printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> bn-deterministic.tex - cat bn.tex >> bn-deterministic.tex - mv bn-deterministic.tex bn.tex - touch --reference=bn.bak bn.tex - echo "hello" > bn.ind - latex bn > /dev/null - latex bn > /dev/null - makeindex bn - latex bn > /dev/null - -#LTM user manual [pdf] -manual: mandvi - pdflatex bn >/dev/null - sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' bn.pdf - mv bn.bak bn.tex - rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc +# You have to create a file .coveralls.yml with the content "repo_token: " +# in the base folder to be able to submit to coveralls +coveralls: lcov + coveralls-lcov + +docdvi poster docs mandvi manual: + $(MAKE) -C doc/ $@ V=$(V) pretty: perl pretty.build -#\zipup the project (take that!) -no_oops: clean - cd .. ; cvs commit - echo Scanning for scratch/dirty files - find . -type f | grep -v CVS | xargs -n 1 bash mess.sh - .PHONY: pre_gen pre_gen: perl gen.pl sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c rm mpi.c -zipup: - rm -rf ../libtommath-$(VERSION) \ - && rm -f ../ltm-$(VERSION).zip ../ltm-$(VERSION).zip.asc ../ltm-$(VERSION).tar.xz ../ltm-$(VERSION).tar.xz.asc - git archive HEAD --prefix=libtommath-$(VERSION)/ > ../libtommath-$(VERSION).tar - cd .. ; tar xf libtommath-$(VERSION).tar - MAKE=${MAKE} ${MAKE} -C ../libtommath-$(VERSION) clean manual poster docs - tar -c ../libtommath-$(VERSION)/* | xz -9 > ../ltm-$(VERSION).tar.xz - find ../libtommath-$(VERSION)/ -type f -exec unix2dos -q {} \; - cd .. ; zip -9r ltm-$(VERSION).zip libtommath-$(VERSION) - gpg -b -a ../ltm-$(VERSION).tar.xz && gpg -b -a ../ltm-$(VERSION).zip +zipup: clean pre_gen new_file manual poster docs + @# Update the index, so diff-index won't fail in case the pdf has been created. + @# As the pdf creation modifies the tex files, git sometimes detects the + @# modified files, but misses that it's put back to its original version. + @git update-index --refresh + @git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 ) + rm -rf libtommath-$(VERSION) ltm-$(VERSION).* + @# files/dirs excluded from "git archive" are defined in .gitattributes + git archive --format=tar --prefix=libtommath-$(VERSION)/ HEAD | tar x + mkdir -p libtommath-$(VERSION)/doc + cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/ + tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz + zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION) + rm -rf libtommath-$(VERSION) + gpg -b -a ltm-$(VERSION).tar.xz + gpg -b -a ltm-$(VERSION).zip new_file: bash updatemakes.sh perl dep.pl + +perlcritic: + perlcritic *.pl diff --git a/libtommath/makefile.shared b/libtommath/makefile.shared index 559720e..67213a2 100644 --- a/libtommath/makefile.shared +++ b/libtommath/makefile.shared @@ -7,9 +7,16 @@ ifndef LIBNAME LIBNAME=libtommath.la endif -include makefile.include +include makefile_include.mk -LT ?= libtool + +ifndef LT + ifeq ($(PLATFORM), Darwin) + LT:=glibtool + else + LT:=libtool + endif +endif LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC) LCOV_ARGS=--directory .libs --directory . @@ -47,14 +54,24 @@ objs: $(OBJECTS) .c.o: $(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $< +LOBJECTS = $(OBJECTS:.o=.lo) + $(LIBNAME): $(OBJECTS) - $(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) + $(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) install: $(LIBNAME) install -d $(DESTDIR)$(LIBPATH) install -d $(DESTDIR)$(INCPATH) - $(LT) --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME) + $(LT) --mode=install install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME) install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH) + sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' libtommath.pc.in > libtommath.pc + install -d $(DESTDIR)$(LIBPATH)/pkgconfig + install -m 644 libtommath.pc $(DESTDIR)$(LIBPATH)/pkgconfig/ + +uninstall: + $(LT) --mode=uninstall rm $(DESTDIR)$(LIBPATH)/$(LIBNAME) + rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%) + rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtommath.pc test: $(LIBNAME) demo/demo.o $(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o -- cgit v0.12 From 07bcf919d67411b26009a3e03fb41edfe9a75bc1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Aug 2017 11:20:19 +0000 Subject: Cherry-pick [https://github.com/libtom/libtommath/commit/a0a86c696a7182f8be4b10bb79a1c5c971dc9561]: Merge branch 'tcl-fixes' into develop Remove many files, which are not used in Tcl. Modify "changelog.txt", with real release-date of 1.0.1 version --- libtommath/bn.ilg | 6 - libtommath/bn.ind | 88 - libtommath/bn.pdf | Bin 383770 -> 0 bytes libtommath/bn.tex | 1913 ------ libtommath/bn_mp_read_radix.c | 8 +- libtommath/booker.pl | 267 - libtommath/changes.txt | 2 +- libtommath/demo/demo.c | 986 ---- libtommath/demo/timing.c | 339 -- libtommath/dep.pl | 123 - libtommath/etc/2kprime.1 | 2 - libtommath/etc/2kprime.c | 84 - libtommath/etc/drprime.c | 64 - libtommath/etc/drprimes.28 | 25 - libtommath/etc/drprimes.txt | 9 - libtommath/etc/makefile | 50 - libtommath/etc/makefile.icc | 67 - libtommath/etc/makefile.msvc | 23 - libtommath/etc/mersenne.c | 144 - libtommath/etc/mont.c | 50 - libtommath/etc/pprime.c | 400 -- libtommath/etc/prime.1024 | 414 -- libtommath/etc/prime.512 | 205 - libtommath/etc/timer.asm | 37 - libtommath/etc/tune.c | 145 - libtommath/filter.pl | 34 - libtommath/gen.pl | 19 - libtommath/genlist.sh | 8 - libtommath/libtommath.dsp | 572 -- libtommath/libtommath_VS2005.sln | 20 - libtommath/libtommath_VS2005.vcproj | 2847 --------- libtommath/libtommath_VS2008.sln | 20 - libtommath/libtommath_VS2008.vcproj | 2813 --------- libtommath/logs/README | 13 - libtommath/logs/add.log | 16 - libtommath/logs/addsub.png | Bin 6254 -> 0 bytes libtommath/logs/expt.log | 7 - libtommath/logs/expt.png | Bin 6605 -> 0 bytes libtommath/logs/expt_2k.log | 5 - libtommath/logs/expt_2kl.log | 4 - libtommath/logs/expt_dr.log | 7 - libtommath/logs/graphs.dem | 17 - libtommath/logs/index.html | 27 - libtommath/logs/invmod.log | 0 libtommath/logs/invmod.png | Bin 4918 -> 0 bytes libtommath/logs/mult.log | 84 - libtommath/logs/mult.png | Bin 6770 -> 0 bytes libtommath/logs/mult_kara.log | 84 - libtommath/logs/sqr.log | 84 - libtommath/logs/sqr_kara.log | 84 - libtommath/logs/sub.log | 16 - libtommath/makefile_include.mk | 117 + libtommath/mess.sh | 4 - libtommath/mtest/logtab.h | 24 - libtommath/mtest/mpi-config.h | 90 - libtommath/mtest/mpi-types.h | 20 - libtommath/mtest/mpi.c | 3985 ------------- libtommath/mtest/mpi.h | 231 - libtommath/mtest/mtest.c | 374 -- libtommath/parsenames.pl | 25 - libtommath/pics/design_process.sxd | Bin 6950 -> 0 bytes libtommath/pics/design_process.tif | Bin 79042 -> 0 bytes libtommath/pics/expt_state.sxd | Bin 6869 -> 0 bytes libtommath/pics/expt_state.tif | Bin 87542 -> 0 bytes libtommath/pics/makefile | 35 - libtommath/pics/primality.tif | Bin 85514 -> 0 bytes libtommath/pics/radix.sxd | Bin 6181 -> 0 bytes libtommath/pics/sliding_window.sxd | Bin 6787 -> 0 bytes libtommath/pics/sliding_window.tif | Bin 53880 -> 0 bytes libtommath/poster.out | 0 libtommath/poster.pdf | Bin 73388 -> 0 bytes libtommath/poster.tex | 35 - libtommath/pre_gen/mpi.c | 9524 ------------------------------ libtommath/pretty.build | 66 - libtommath/testme.sh | 174 - libtommath/tombc/grammar.txt | 35 - libtommath/tommath.h | 2 +- libtommath/tommath.out | 139 - libtommath/tommath.pdf | Bin 1526291 -> 0 bytes libtommath/tommath.src | 6339 -------------------- libtommath/tommath.tex | 10816 ---------------------------------- 81 files changed, 126 insertions(+), 44141 deletions(-) delete mode 100644 libtommath/bn.ilg delete mode 100644 libtommath/bn.ind delete mode 100644 libtommath/bn.pdf delete mode 100644 libtommath/bn.tex delete mode 100644 libtommath/booker.pl delete mode 100644 libtommath/demo/demo.c delete mode 100644 libtommath/demo/timing.c delete mode 100644 libtommath/dep.pl delete mode 100644 libtommath/etc/2kprime.1 delete mode 100644 libtommath/etc/2kprime.c delete mode 100644 libtommath/etc/drprime.c delete mode 100644 libtommath/etc/drprimes.28 delete mode 100644 libtommath/etc/drprimes.txt delete mode 100644 libtommath/etc/makefile delete mode 100644 libtommath/etc/makefile.icc delete mode 100644 libtommath/etc/makefile.msvc delete mode 100644 libtommath/etc/mersenne.c delete mode 100644 libtommath/etc/mont.c delete mode 100644 libtommath/etc/pprime.c delete mode 100644 libtommath/etc/prime.1024 delete mode 100644 libtommath/etc/prime.512 delete mode 100644 libtommath/etc/timer.asm delete mode 100644 libtommath/etc/tune.c delete mode 100755 libtommath/filter.pl delete mode 100644 libtommath/gen.pl delete mode 100755 libtommath/genlist.sh delete mode 100644 libtommath/libtommath.dsp delete mode 100644 libtommath/libtommath_VS2005.sln delete mode 100644 libtommath/libtommath_VS2005.vcproj delete mode 100644 libtommath/libtommath_VS2008.sln delete mode 100644 libtommath/libtommath_VS2008.vcproj delete mode 100644 libtommath/logs/README delete mode 100644 libtommath/logs/add.log delete mode 100644 libtommath/logs/addsub.png delete mode 100644 libtommath/logs/expt.log delete mode 100644 libtommath/logs/expt.png delete mode 100644 libtommath/logs/expt_2k.log delete mode 100644 libtommath/logs/expt_2kl.log delete mode 100644 libtommath/logs/expt_dr.log delete mode 100644 libtommath/logs/graphs.dem delete mode 100644 libtommath/logs/index.html delete mode 100644 libtommath/logs/invmod.log delete mode 100644 libtommath/logs/invmod.png delete mode 100644 libtommath/logs/mult.log delete mode 100644 libtommath/logs/mult.png delete mode 100644 libtommath/logs/mult_kara.log delete mode 100644 libtommath/logs/sqr.log delete mode 100644 libtommath/logs/sqr_kara.log delete mode 100644 libtommath/logs/sub.log create mode 100644 libtommath/makefile_include.mk delete mode 100644 libtommath/mess.sh delete mode 100644 libtommath/mtest/logtab.h delete mode 100644 libtommath/mtest/mpi-config.h delete mode 100644 libtommath/mtest/mpi-types.h delete mode 100644 libtommath/mtest/mpi.c delete mode 100644 libtommath/mtest/mpi.h delete mode 100644 libtommath/mtest/mtest.c delete mode 100755 libtommath/parsenames.pl delete mode 100644 libtommath/pics/design_process.sxd delete mode 100644 libtommath/pics/design_process.tif delete mode 100644 libtommath/pics/expt_state.sxd delete mode 100644 libtommath/pics/expt_state.tif delete mode 100644 libtommath/pics/makefile delete mode 100644 libtommath/pics/primality.tif delete mode 100644 libtommath/pics/radix.sxd delete mode 100644 libtommath/pics/sliding_window.sxd delete mode 100644 libtommath/pics/sliding_window.tif delete mode 100644 libtommath/poster.out delete mode 100644 libtommath/poster.pdf delete mode 100644 libtommath/poster.tex delete mode 100644 libtommath/pre_gen/mpi.c delete mode 100644 libtommath/pretty.build delete mode 100755 libtommath/testme.sh delete mode 100644 libtommath/tombc/grammar.txt delete mode 100644 libtommath/tommath.out delete mode 100644 libtommath/tommath.pdf delete mode 100644 libtommath/tommath.src delete mode 100644 libtommath/tommath.tex diff --git a/libtommath/bn.ilg b/libtommath/bn.ilg deleted file mode 100644 index 2a14624..0000000 --- a/libtommath/bn.ilg +++ /dev/null @@ -1,6 +0,0 @@ -This is makeindex, version 2.15 [TeX Live 2013] (kpathsea + Thai support). -Scanning input file bn.idx....done (85 entries accepted, 0 rejected). -Sorting entries....done (554 comparisons). -Generating output file bn.ind....done (88 lines written, 0 warnings). -Output written in bn.ind. -Transcript written in bn.ilg. diff --git a/libtommath/bn.ind b/libtommath/bn.ind deleted file mode 100644 index 01cff1a..0000000 --- a/libtommath/bn.ind +++ /dev/null @@ -1,88 +0,0 @@ -\begin{theindex} - - \item mp\_add, \hyperpage{24} - \item mp\_add\_d, \hyperpage{44} - \item mp\_and, \hyperpage{24} - \item mp\_clear, \hyperpage{9} - \item mp\_clear\_multi, \hyperpage{10} - \item mp\_cmp, \hyperpage{19} - \item mp\_cmp\_d, \hyperpage{20} - \item mp\_cmp\_mag, \hyperpage{18} - \item mp\_div, \hyperpage{24} - \item mp\_div\_2, \hyperpage{22} - \item mp\_div\_2d, \hyperpage{23} - \item mp\_div\_d, \hyperpage{44} - \item mp\_dr\_reduce, \hyperpage{33} - \item mp\_dr\_setup, \hyperpage{33} - \item MP\_EQ, \hyperpage{18} - \item mp\_error\_to\_string, \hyperpage{7} - \item mp\_expt\_d, \hyperpage{35} - \item mp\_expt\_d\_ex, \hyperpage{35} - \item mp\_exptmod, \hyperpage{35} - \item mp\_exteuclid, \hyperpage{43} - \item mp\_gcd, \hyperpage{43} - \item mp\_get\_int, \hyperpage{16} - \item mp\_get\_long, \hyperpage{17} - \item mp\_get\_long\_long, \hyperpage{17} - \item mp\_grow, \hyperpage{13} - \item MP\_GT, \hyperpage{18} - \item mp\_init, \hyperpage{8} - \item mp\_init\_copy, \hyperpage{10} - \item mp\_init\_multi, \hyperpage{10} - \item mp\_init\_set, \hyperpage{17} - \item mp\_init\_set\_int, \hyperpage{17} - \item mp\_init\_size, \hyperpage{11} - \item mp\_int, \hyperpage{8} - \item mp\_invmod, \hyperpage{44} - \item mp\_jacobi, \hyperpage{43} - \item mp\_lcm, \hyperpage{43} - \item mp\_lshd, \hyperpage{23} - \item MP\_LT, \hyperpage{18} - \item MP\_MEM, \hyperpage{7} - \item mp\_mod, \hyperpage{29} - \item mp\_mod\_d, \hyperpage{44} - \item mp\_montgomery\_calc\_normalization, \hyperpage{31} - \item mp\_montgomery\_reduce, \hyperpage{31} - \item mp\_montgomery\_setup, \hyperpage{31} - \item mp\_mul, \hyperpage{25} - \item mp\_mul\_2, \hyperpage{22} - \item mp\_mul\_2d, \hyperpage{23} - \item mp\_mul\_d, \hyperpage{44} - \item mp\_n\_root, \hyperpage{36} - \item mp\_neg, \hyperpage{24} - \item MP\_NO, \hyperpage{7} - \item MP\_OKAY, \hyperpage{7} - \item mp\_or, \hyperpage{24} - \item mp\_prime\_fermat, \hyperpage{37} - \item mp\_prime\_is\_divisible, \hyperpage{37} - \item mp\_prime\_is\_prime, \hyperpage{38} - \item mp\_prime\_miller\_rabin, \hyperpage{37} - \item mp\_prime\_next\_prime, \hyperpage{38} - \item mp\_prime\_rabin\_miller\_trials, \hyperpage{38} - \item mp\_prime\_random, \hyperpage{38} - \item mp\_prime\_random\_ex, \hyperpage{39} - \item mp\_radix\_size, \hyperpage{41} - \item mp\_read\_radix, \hyperpage{41} - \item mp\_read\_unsigned\_bin, \hyperpage{42} - \item mp\_reduce, \hyperpage{30} - \item mp\_reduce\_2k, \hyperpage{34} - \item mp\_reduce\_2k\_setup, \hyperpage{34} - \item mp\_reduce\_setup, \hyperpage{29} - \item mp\_rshd, \hyperpage{23} - \item mp\_set, \hyperpage{15} - \item mp\_set\_int, \hyperpage{16} - \item mp\_set\_long, \hyperpage{17} - \item mp\_set\_long\_long, \hyperpage{17} - \item mp\_shrink, \hyperpage{12} - \item mp\_sqr, \hyperpage{26} - \item mp\_sqrtmod\_prime, \hyperpage{44} - \item mp\_sub, \hyperpage{24} - \item mp\_sub\_d, \hyperpage{44} - \item mp\_to\_unsigned\_bin, \hyperpage{42} - \item mp\_toradix, \hyperpage{41} - \item mp\_unsigned\_bin\_size, \hyperpage{41} - \item MP\_VAL, \hyperpage{7} - \item mp\_xor, \hyperpage{24} - \item MP\_YES, \hyperpage{7} - -\end{theindex} diff --git a/libtommath/bn.pdf b/libtommath/bn.pdf deleted file mode 100644 index a1f40ef..0000000 Binary files a/libtommath/bn.pdf and /dev/null differ diff --git a/libtommath/bn.tex b/libtommath/bn.tex deleted file mode 100644 index d975471..0000000 --- a/libtommath/bn.tex +++ /dev/null @@ -1,1913 +0,0 @@ -\documentclass[synpaper]{book} -\usepackage{hyperref} -\usepackage{makeidx} -\usepackage{amssymb} -\usepackage{color} -\usepackage{alltt} -\usepackage{graphicx} -\usepackage{layout} -\def\union{\cup} -\def\intersect{\cap} -\def\getsrandom{\stackrel{\rm R}{\gets}} -\def\cross{\times} -\def\cat{\hspace{0.5em} \| \hspace{0.5em}} -\def\catn{$\|$} -\def\divides{\hspace{0.3em} | \hspace{0.3em}} -\def\nequiv{\not\equiv} -\def\approx{\raisebox{0.2ex}{\mbox{\small $\sim$}}} -\def\lcm{{\rm lcm}} -\def\gcd{{\rm gcd}} -\def\log{{\rm log}} -\def\ord{{\rm ord}} -\def\abs{{\mathit abs}} -\def\rep{{\mathit rep}} -\def\mod{{\mathit\ mod\ }} -\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})} -\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} -\newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} -\def\Or{{\rm\ or\ }} -\def\And{{\rm\ and\ }} -\def\iff{\hspace{1em}\Longleftrightarrow\hspace{1em}} -\def\implies{\Rightarrow} -\def\undefined{{\rm ``undefined"}} -\def\Proof{\vspace{1ex}\noindent {\bf Proof:}\hspace{1em}} -\let\oldphi\phi -\def\phi{\varphi} -\def\Pr{{\rm Pr}} -\newcommand{\str}[1]{{\mathbf{#1}}} -\def\F{{\mathbb F}} -\def\N{{\mathbb N}} -\def\Z{{\mathbb Z}} -\def\R{{\mathbb R}} -\def\C{{\mathbb C}} -\def\Q{{\mathbb Q}} -\definecolor{DGray}{gray}{0.5} -\newcommand{\emailaddr}[1]{\mbox{$<${#1}$>$}} -\def\twiddle{\raisebox{0.3ex}{\mbox{\tiny $\sim$}}} -\def\gap{\vspace{0.5ex}} -\makeindex -\begin{document} -\frontmatter -\pagestyle{empty} -\title{LibTomMath User Manual \\ v1.0.0} -\author{Tom St Denis \\ tstdenis82@gmail.com} -\maketitle -This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been -formatted for B5 [176x250] paper using the \LaTeX{} {\em book} macro package. - -\vspace{10cm} - -\begin{flushright}Open Source. Open Academia. Open Minds. - -\mbox{ } - -Tom St Denis, - -Ontario, Canada -\end{flushright} - -\tableofcontents -\listoffigures -\mainmatter -\pagestyle{headings} -\chapter{Introduction} -\section{What is LibTomMath?} -LibTomMath is a library of source code which provides a series of efficient and carefully written functions for manipulating -large integer numbers. It was written in portable ISO C source code so that it will build on any platform with a conforming -C compiler. - -In a nutshell the library was written from scratch with verbose comments to help instruct computer science students how -to implement ``bignum'' math. However, the resulting code has proven to be very useful. It has been used by numerous -universities, commercial and open source software developers. It has been used on a variety of platforms ranging from -Linux and Windows based x86 to ARM based Gameboys and PPC based MacOS machines. - -\section{License} -As of the v0.25 the library source code has been placed in the public domain with every new release. As of the v0.28 -release the textbook ``Implementing Multiple Precision Arithmetic'' has been placed in the public domain with every new -release as well. This textbook is meant to compliment the project by providing a more solid walkthrough of the development -algorithms used in the library. - -Since both\footnote{Note that the MPI files under mtest/ are copyrighted by Michael Fromberger. They are not required to use LibTomMath.} are in the -public domain everyone is entitled to do with them as they see fit. - -\section{Building LibTomMath} - -LibTomMath is meant to be very ``GCC friendly'' as it comes with a makefile well suited for GCC. However, the library will -also build in MSVC, Borland C out of the box. For any other ISO C compiler a makefile will have to be made by the end -developer. - -\subsection{Static Libraries} -To build as a static library for GCC issue the following -\begin{alltt} -make -\end{alltt} - -command. This will build the library and archive the object files in ``libtommath.a''. Now you link against -that and include ``tommath.h'' within your programs. Alternatively to build with MSVC issue the following -\begin{alltt} -nmake -f makefile.msvc -\end{alltt} - -This will build the library and archive the object files in ``tommath.lib''. This has been tested with MSVC -version 6.00 with service pack 5. - -\subsection{Shared Libraries} -To build as a shared library for GCC issue the following -\begin{alltt} -make -f makefile.shared -\end{alltt} -This requires the ``libtool'' package (common on most Linux/BSD systems). It will build LibTomMath as both shared -and static then install (by default) into /usr/lib as well as install the header files in /usr/include. The shared -library (resource) will be called ``libtommath.la'' while the static library called ``libtommath.a''. Generally -you use libtool to link your application against the shared object. - -There is limited support for making a ``DLL'' in windows via the ``makefile.cygwin\_dll'' makefile. It requires -Cygwin to work with since it requires the auto-export/import functionality. The resulting DLL and import library -``libtommath.dll.a'' can be used to link LibTomMath dynamically to any Windows program using Cygwin. - -\subsection{Testing} -To build the library and the test harness type - -\begin{alltt} -make test -\end{alltt} - -This will build the library, ``test'' and ``mtest/mtest''. The ``test'' program will accept test vectors and verify the -results. ``mtest/mtest'' will generate test vectors using the MPI library by Michael Fromberger\footnote{A copy of MPI -is included in the package}. Simply pipe mtest into test using - -\begin{alltt} -mtest/mtest | test -\end{alltt} - -If you do not have a ``/dev/urandom'' style RNG source you will have to write your own PRNG and simply pipe that into -mtest. For example, if your PRNG program is called ``myprng'' simply invoke - -\begin{alltt} -myprng | mtest/mtest | test -\end{alltt} - -This will output a row of numbers that are increasing. Each column is a different test (such as addition, multiplication, etc) -that is being performed. The numbers represent how many times the test was invoked. If an error is detected the program -will exit with a dump of the relevent numbers it was working with. - -\section{Build Configuration} -LibTomMath can configured at build time in three phases we shall call ``depends'', ``tweaks'' and ``trims''. -Each phase changes how the library is built and they are applied one after another respectively. - -To make the system more powerful you can tweak the build process. Classes are defined in the file -``tommath\_superclass.h''. By default, the symbol ``LTM\_ALL'' shall be defined which simply -instructs the system to build all of the functions. This is how LibTomMath used to be packaged. This will give you -access to every function LibTomMath offers. - -However, there are cases where such a build is not optional. For instance, you want to perform RSA operations. You -don't need the vast majority of the library to perform these operations. Aside from LTM\_ALL there is -another pre--defined class ``SC\_RSA\_1'' which works in conjunction with the RSA from LibTomCrypt. Additional -classes can be defined base on the need of the user. - -\subsection{Build Depends} -In the file tommath\_class.h you will see a large list of C ``defines'' followed by a series of ``ifdefs'' -which further define symbols. All of the symbols (technically they're macros $\ldots$) represent a given C source -file. For instance, BN\_MP\_ADD\_C represents the file ``bn\_mp\_add.c''. When a define has been enabled the -function in the respective file will be compiled and linked into the library. Accordingly when the define -is absent the file will not be compiled and not contribute any size to the library. - -You will also note that the header tommath\_class.h is actually recursively included (it includes itself twice). -This is to help resolve as many dependencies as possible. In the last pass the symbol LTM\_LAST will be defined. -This is useful for ``trims''. - -\subsection{Build Tweaks} -A tweak is an algorithm ``alternative''. For example, to provide tradeoffs (usually between size and space). -They can be enabled at any pass of the configuration phase. - -\begin{small} -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Define} & \textbf{Purpose} \\ -\hline BN\_MP\_DIV\_SMALL & Enables a slower, smaller and equally \\ - & functional mp\_div() function \\ -\hline -\end{tabular} -\end{center} -\end{small} - -\subsection{Build Trims} -A trim is a manner of removing functionality from a function that is not required. For instance, to perform -RSA cryptography you only require exponentiation with odd moduli so even moduli support can be safely removed. -Build trims are meant to be defined on the last pass of the configuration which means they are to be defined -only if LTM\_LAST has been defined. - -\subsubsection{Moduli Related} -\begin{small} -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Restriction} & \textbf{Undefine} \\ -\hline Exponentiation with odd moduli only & BN\_S\_MP\_EXPTMOD\_C \\ - & BN\_MP\_REDUCE\_C \\ - & BN\_MP\_REDUCE\_SETUP\_C \\ - & BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ - & BN\_FAST\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ -\hline Exponentiation with random odd moduli & (The above plus the following) \\ - & BN\_MP\_REDUCE\_2K\_C \\ - & BN\_MP\_REDUCE\_2K\_SETUP\_C \\ - & BN\_MP\_REDUCE\_IS\_2K\_C \\ - & BN\_MP\_DR\_IS\_MODULUS\_C \\ - & BN\_MP\_DR\_REDUCE\_C \\ - & BN\_MP\_DR\_SETUP\_C \\ -\hline Modular inverse odd moduli only & BN\_MP\_INVMOD\_SLOW\_C \\ -\hline Modular inverse (both, smaller/slower) & BN\_FAST\_MP\_INVMOD\_C \\ -\hline -\end{tabular} -\end{center} -\end{small} - -\subsubsection{Operand Size Related} -\begin{small} -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Restriction} & \textbf{Undefine} \\ -\hline Moduli $\le 2560$ bits & BN\_MP\_MONTGOMERY\_REDUCE\_C \\ - & BN\_S\_MP\_MUL\_DIGS\_C \\ - & BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ - & BN\_S\_MP\_SQR\_C \\ -\hline Polynomial Schmolynomial & BN\_MP\_KARATSUBA\_MUL\_C \\ - & BN\_MP\_KARATSUBA\_SQR\_C \\ - & BN\_MP\_TOOM\_MUL\_C \\ - & BN\_MP\_TOOM\_SQR\_C \\ - -\hline -\end{tabular} -\end{center} -\end{small} - - -\section{Purpose of LibTomMath} -Unlike GNU MP (GMP) Library, LIP, OpenSSL or various other commercial kits (Miracl), LibTomMath was not written with -bleeding edge performance in mind. First and foremost LibTomMath was written to be entirely open. Not only is the -source code public domain (unlike various other GPL/etc licensed code), not only is the code freely downloadable but the -source code is also accessible for computer science students attempting to learn ``BigNum'' or multiple precision -arithmetic techniques. - -LibTomMath was written to be an instructive collection of source code. This is why there are many comments, only one -function per source file and often I use a ``middle-road'' approach where I don't cut corners for an extra 2\% speed -increase. - -Source code alone cannot really teach how the algorithms work which is why I also wrote a textbook that accompanies -the library (beat that!). - -So you may be thinking ``should I use LibTomMath?'' and the answer is a definite maybe. Let me tabulate what I think -are the pros and cons of LibTomMath by comparing it to the math routines from GnuPG\footnote{GnuPG v1.2.3 versus LibTomMath v0.28}. - -\newpage\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|l|c|c|l|} -\hline \textbf{Criteria} & \textbf{Pro} & \textbf{Con} & \textbf{Notes} \\ -\hline Few lines of code per file & X & & GnuPG $ = 300.9$, LibTomMath $ = 71.97$ \\ -\hline Commented function prototypes & X && GnuPG function names are cryptic. \\ -\hline Speed && X & LibTomMath is slower. \\ -\hline Totally free & X & & GPL has unfavourable restrictions.\\ -\hline Large function base & X & & GnuPG is barebones. \\ -\hline Five modular reduction algorithms & X & & Faster modular exponentiation for a variety of moduli. \\ -\hline Portable & X & & GnuPG requires configuration to build. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{LibTomMath Valuation} -\end{figure} - -It may seem odd to compare LibTomMath to GnuPG since the math in GnuPG is only a small portion of the entire application. -However, LibTomMath was written with cryptography in mind. It provides essentially all of the functions a cryptosystem -would require when working with large integers. - -So it may feel tempting to just rip the math code out of GnuPG (or GnuMP where it was taken from originally) in your -own application but I think there are reasons not to. While LibTomMath is slower than libraries such as GnuMP it is -not normally significantly slower. On x86 machines the difference is normally a factor of two when performing modular -exponentiations. It depends largely on the processor, compiler and the moduli being used. - -Essentially the only time you wouldn't use LibTomMath is when blazing speed is the primary concern. However, -on the other side of the coin LibTomMath offers you a totally free (public domain) well structured math library -that is very flexible, complete and performs well in resource contrained environments. Fast RSA for example can -be performed with as little as 8KB of ram for data (again depending on build options). - -\chapter{Getting Started with LibTomMath} -\section{Building Programs} -In order to use LibTomMath you must include ``tommath.h'' and link against the appropriate library file (typically -libtommath.a). There is no library initialization required and the entire library is thread safe. - -\section{Return Codes} -There are three possible return codes a function may return. - -\index{MP\_OKAY}\index{MP\_YES}\index{MP\_NO}\index{MP\_VAL}\index{MP\_MEM} -\begin{figure}[here!] -\begin{center} -\begin{small} -\begin{tabular}{|l|l|} -\hline \textbf{Code} & \textbf{Meaning} \\ -\hline MP\_OKAY & The function succeeded. \\ -\hline MP\_VAL & The function input was invalid. \\ -\hline MP\_MEM & Heap memory exhausted. \\ -\hline &\\ -\hline MP\_YES & Response is yes. \\ -\hline MP\_NO & Response is no. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Return Codes} -\end{figure} - -The last two codes listed are not actually ``return'ed'' by a function. They are placed in an integer (the caller must -provide the address of an integer it can store to) which the caller can access. To convert one of the three return codes -to a string use the following function. - -\index{mp\_error\_to\_string} -\begin{alltt} -char *mp_error_to_string(int code); -\end{alltt} - -This will return a pointer to a string which describes the given error code. It will not work for the return codes -MP\_YES and MP\_NO. - -\section{Data Types} -The basic ``multiple precision integer'' type is known as the ``mp\_int'' within LibTomMath. This data type is used to -organize all of the data required to manipulate the integer it represents. Within LibTomMath it has been prototyped -as the following. - -\index{mp\_int} -\begin{alltt} -typedef struct \{ - int used, alloc, sign; - mp_digit *dp; -\} mp_int; -\end{alltt} - -Where ``mp\_digit'' is a data type that represents individual digits of the integer. By default, an mp\_digit is the -ISO C ``unsigned long'' data type and each digit is $28-$bits long. The mp\_digit type can be configured to suit other -platforms by defining the appropriate macros. - -All LTM functions that use the mp\_int type will expect a pointer to mp\_int structure. You must allocate memory to -hold the structure itself by yourself (whether off stack or heap it doesn't matter). The very first thing that must be -done to use an mp\_int is that it must be initialized. - -\section{Function Organization} - -The arithmetic functions of the library are all organized to have the same style prototype. That is source operands -are passed on the left and the destination is on the right. For instance, - -\begin{alltt} -mp_add(&a, &b, &c); /* c = a + b */ -mp_mul(&a, &a, &c); /* c = a * a */ -mp_div(&a, &b, &c, &d); /* c = [a/b], d = a mod b */ -\end{alltt} - -Another feature of the way the functions have been implemented is that source operands can be destination operands as well. -For instance, - -\begin{alltt} -mp_add(&a, &b, &b); /* b = a + b */ -mp_div(&a, &b, &a, &c); /* a = [a/b], c = a mod b */ -\end{alltt} - -This allows operands to be re-used which can make programming simpler. - -\section{Initialization} -\subsection{Single Initialization} -A single mp\_int can be initialized with the ``mp\_init'' function. - -\index{mp\_init} -\begin{alltt} -int mp_init (mp_int * a); -\end{alltt} - -This function expects a pointer to an mp\_int structure and will initialize the members of the structure so the mp\_int -represents the default integer which is zero. If the functions returns MP\_OKAY then the mp\_int is ready to be used -by the other LibTomMath functions. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Single Free} -When you are finished with an mp\_int it is ideal to return the heap it used back to the system. The following function -provides this functionality. - -\index{mp\_clear} -\begin{alltt} -void mp_clear (mp_int * a); -\end{alltt} - -The function expects a pointer to a previously initialized mp\_int structure and frees the heap it uses. It sets the -pointer\footnote{The ``dp'' member.} within the mp\_int to \textbf{NULL} which is used to prevent double free situations. -Is is legal to call mp\_clear() twice on the same mp\_int in a row. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - /* We're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Multiple Initializations} -Certain algorithms require more than one large integer. In these instances it is ideal to initialize all of the mp\_int -variables in an ``all or nothing'' fashion. That is, they are either all initialized successfully or they are all -not initialized. - -The mp\_init\_multi() function provides this functionality. - -\index{mp\_init\_multi} \index{mp\_clear\_multi} -\begin{alltt} -int mp_init_multi(mp_int *mp, ...); -\end{alltt} - -It accepts a \textbf{NULL} terminated list of pointers to mp\_int structures. It will attempt to initialize them all -at once. If the function returns MP\_OKAY then all of the mp\_int variables are ready to use, otherwise none of them -are available for use. A complementary mp\_clear\_multi() function allows multiple mp\_int variables to be free'd -from the heap at the same time. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int num1, num2, num3; - int result; - - if ((result = mp_init_multi(&num1, - &num2, - &num3, NULL)) != MP\_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the numbers */ - - /* We're done with them. */ - mp_clear_multi(&num1, &num2, &num3, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Other Initializers} -To initialized and make a copy of an mp\_int the mp\_init\_copy() function has been provided. - -\index{mp\_init\_copy} -\begin{alltt} -int mp_init_copy (mp_int * a, mp_int * b); -\end{alltt} - -This function will initialize $a$ and make it a copy of $b$ if all goes well. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int num1, num2; - int result; - - /* initialize and do work on num1 ... */ - - /* We want a copy of num1 in num2 now */ - if ((result = mp_init_copy(&num2, &num1)) != MP_OKAY) \{ - printf("Error initializing the copy. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now num2 is ready and contains a copy of num1 */ - - /* We're done with them. */ - mp_clear_multi(&num1, &num2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -Another less common initializer is mp\_init\_size() which allows the user to initialize an mp\_int with a given -default number of digits. By default, all initializers allocate \textbf{MP\_PREC} digits. This function lets -you override this behaviour. - -\index{mp\_init\_size} -\begin{alltt} -int mp_init_size (mp_int * a, int size); -\end{alltt} - -The $size$ parameter must be greater than zero. If the function succeeds the mp\_int $a$ will be initialized -to have $size$ digits (which are all initially zero). - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - /* we need a 60-digit number */ - if ((result = mp_init_size(&number, 60)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\section{Maintenance Functions} - -\subsection{Reducing Memory Usage} -When an mp\_int is in a state where it won't be changed again\footnote{A Diffie-Hellman modulus for instance.} excess -digits can be removed to return memory to the heap with the mp\_shrink() function. - -\index{mp\_shrink} -\begin{alltt} -int mp_shrink (mp_int * a); -\end{alltt} - -This will remove excess digits of the mp\_int $a$. If the operation fails the mp\_int should be intact without the -excess digits being removed. Note that you can use a shrunk mp\_int in further computations, however, such operations -will require heap operations which can be slow. It is not ideal to shrink mp\_int variables that you will further -modify in the system (unless you are seriously low on memory). - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number [e.g. pre-computation] */ - - /* We're done with it for now. */ - if ((result = mp_shrink(&number)) != MP_OKAY) \{ - printf("Error shrinking the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use it .... */ - - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Adding additional digits} - -Within the mp\_int structure are two parameters which control the limitations of the array of digits that represent -the integer the mp\_int is meant to equal. The \textit{used} parameter dictates how many digits are significant, that is, -contribute to the value of the mp\_int. The \textit{alloc} parameter dictates how many digits are currently available in -the array. If you need to perform an operation that requires more digits you will have to mp\_grow() the mp\_int to -your desired size. - -\index{mp\_grow} -\begin{alltt} -int mp_grow (mp_int * a, int size); -\end{alltt} - -This will grow the array of digits of $a$ to $size$. If the \textit{alloc} parameter is already bigger than -$size$ the function will not do anything. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - /* We need to add 20 digits to the number */ - if ((result = mp_grow(&number, number.alloc + 20)) != MP_OKAY) \{ - printf("Error growing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - - /* use the number */ - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\chapter{Basic Operations} -\section{Small Constants} -Setting mp\_ints to small constants is a relatively common operation. To accomodate these instances there are two -small constant assignment functions. The first function is used to set a single digit constant while the second sets -an ISO C style ``unsigned long'' constant. The reason for both functions is efficiency. Setting a single digit is quick but the -domain of a digit can change (it's always at least $0 \ldots 127$). - -\subsection{Single Digit} - -Setting a single digit can be accomplished with the following function. - -\index{mp\_set} -\begin{alltt} -void mp_set (mp_int * a, mp_digit b); -\end{alltt} - -This will zero the contents of $a$ and make it represent an integer equal to the value of $b$. Note that this -function has a return type of \textbf{void}. It cannot cause an error so it is safe to assume the function -succeeded. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 5 */ - mp_set(&number, 5); - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Long Constants} - -To set a constant that is the size of an ISO C ``unsigned long'' and larger than a single digit the following function -can be used. - -\index{mp\_set\_int} -\begin{alltt} -int mp_set_int (mp_int * a, unsigned long b); -\end{alltt} - -This will assign the value of the 32-bit variable $b$ to the mp\_int $a$. Unlike mp\_set() this function will always -accept a 32-bit input regardless of the size of a single digit. However, since the value may span several digits -this function can fail if it runs out of heap memory. - -To get the ``unsigned long'' copy of an mp\_int the following function can be used. - -\index{mp\_get\_int} -\begin{alltt} -unsigned long mp_get_int (mp_int * a); -\end{alltt} - -This will return the 32 least significant bits of the mp\_int $a$. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 654321 (note this is bigger than 127) */ - if ((result = mp_set_int(&number, 654321)) != MP_OKAY) \{ - printf("Error setting the value of the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - printf("number == \%lu", mp_get_int(&number)); - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -This should output the following if the program succeeds. - -\begin{alltt} -number == 654321 -\end{alltt} - -\subsection{Long Constants - platform dependant} - -\index{mp\_set\_long} -\begin{alltt} -int mp_set_long (mp_int * a, unsigned long b); -\end{alltt} - -This will assign the value of the platform-dependant sized variable $b$ to the mp\_int $a$. - -To get the ``unsigned long'' copy of an mp\_int the following function can be used. - -\index{mp\_get\_long} -\begin{alltt} -unsigned long mp_get_long (mp_int * a); -\end{alltt} - -This will return the least significant bits of the mp\_int $a$ that fit into an ``unsigned long''. - -\subsection{Long Long Constants} - -\index{mp\_set\_long\_long} -\begin{alltt} -int mp_set_long_long (mp_int * a, unsigned long long b); -\end{alltt} - -This will assign the value of the 64-bit variable $b$ to the mp\_int $a$. - -To get the ``unsigned long long'' copy of an mp\_int the following function can be used. - -\index{mp\_get\_long\_long} -\begin{alltt} -unsigned long long mp_get_long_long (mp_int * a); -\end{alltt} - -This will return the 64 least significant bits of the mp\_int $a$. - -\subsection{Initialize and Setting Constants} -To both initialize and set small constants the following two functions are available. -\index{mp\_init\_set} \index{mp\_init\_set\_int} -\begin{alltt} -int mp_init_set (mp_int * a, mp_digit b); -int mp_init_set_int (mp_int * a, unsigned long b); -\end{alltt} - -Both functions work like the previous counterparts except they first mp\_init $a$ before setting the values. - -\begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - /* initialize and set a single digit */ - if ((result = mp_init_set(&number1, 100)) != MP_OKAY) \{ - printf("Error setting number1: \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* initialize and set a long */ - if ((result = mp_init_set_int(&number2, 1023)) != MP_OKAY) \{ - printf("Error setting number2: \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* display */ - printf("Number1, Number2 == \%lu, \%lu", - mp_get_int(&number1), mp_get_int(&number2)); - - /* clear */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} - -If this program succeeds it shall output. -\begin{alltt} -Number1, Number2 == 100, 1023 -\end{alltt} - -\section{Comparisons} - -Comparisons in LibTomMath are always performed in a ``left to right'' fashion. There are three possible return codes -for any comparison. - -\index{MP\_GT} \index{MP\_EQ} \index{MP\_LT} -\begin{figure}[here] -\begin{center} -\begin{tabular}{|c|c|} -\hline \textbf{Result Code} & \textbf{Meaning} \\ -\hline MP\_GT & $a > b$ \\ -\hline MP\_EQ & $a = b$ \\ -\hline MP\_LT & $a < b$ \\ -\hline -\end{tabular} -\end{center} -\caption{Comparison Codes for $a, b$} -\label{fig:CMP} -\end{figure} - -In figure \ref{fig:CMP} two integers $a$ and $b$ are being compared. In this case $a$ is said to be ``to the left'' of -$b$. - -\subsection{Unsigned comparison} - -An unsigned comparison considers only the digits themselves and not the associated \textit{sign} flag of the -mp\_int structures. This is analogous to an absolute comparison. The function mp\_cmp\_mag() will compare two -mp\_int variables based on their digits only. - -\index{mp\_cmp\_mag} -\begin{alltt} -int mp_cmp_mag(mp_int * a, mp_int * b); -\end{alltt} -This will compare $a$ to $b$ placing $a$ to the left of $b$. This function cannot fail and will return one of the -three compare codes listed in figure \ref{fig:CMP}. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - if ((result = mp_init_multi(&number1, &number2, NULL)) != MP_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number1 to 5 */ - mp_set(&number1, 5); - - /* set the number2 to -6 */ - mp_set(&number2, 6); - if ((result = mp_neg(&number2, &number2)) != MP_OKAY) \{ - printf("Error negating number2. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - switch(mp_cmp_mag(&number1, &number2)) \{ - case MP_GT: printf("|number1| > |number2|"); break; - case MP_EQ: printf("|number1| = |number2|"); break; - case MP_LT: printf("|number1| < |number2|"); break; - \} - - /* we're done with it. */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program\footnote{This function uses the mp\_neg() function which is discussed in section \ref{sec:NEG}.} completes -successfully it should print the following. - -\begin{alltt} -|number1| < |number2| -\end{alltt} - -This is because $\vert -6 \vert = 6$ and obviously $5 < 6$. - -\subsection{Signed comparison} - -To compare two mp\_int variables based on their signed value the mp\_cmp() function is provided. - -\index{mp\_cmp} -\begin{alltt} -int mp_cmp(mp_int * a, mp_int * b); -\end{alltt} - -This will compare $a$ to the left of $b$. It will first compare the signs of the two mp\_int variables. If they -differ it will return immediately based on their signs. If the signs are equal then it will compare the digits -individually. This function will return one of the compare conditions codes listed in figure \ref{fig:CMP}. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - if ((result = mp_init_multi(&number1, &number2, NULL)) != MP_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number1 to 5 */ - mp_set(&number1, 5); - - /* set the number2 to -6 */ - mp_set(&number2, 6); - if ((result = mp_neg(&number2, &number2)) != MP_OKAY) \{ - printf("Error negating number2. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - switch(mp_cmp(&number1, &number2)) \{ - case MP_GT: printf("number1 > number2"); break; - case MP_EQ: printf("number1 = number2"); break; - case MP_LT: printf("number1 < number2"); break; - \} - - /* we're done with it. */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program\footnote{This function uses the mp\_neg() function which is discussed in section \ref{sec:NEG}.} completes -successfully it should print the following. - -\begin{alltt} -number1 > number2 -\end{alltt} - -\subsection{Single Digit} - -To compare a single digit against an mp\_int the following function has been provided. - -\index{mp\_cmp\_d} -\begin{alltt} -int mp_cmp_d(mp_int * a, mp_digit b); -\end{alltt} - -This will compare $a$ to the left of $b$ using a signed comparison. Note that it will always treat $b$ as -positive. This function is rather handy when you have to compare against small values such as $1$ (which often -comes up in cryptography). The function cannot fail and will return one of the tree compare condition codes -listed in figure \ref{fig:CMP}. - - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 5 */ - mp_set(&number, 5); - - switch(mp_cmp_d(&number, 7)) \{ - case MP_GT: printf("number > 7"); break; - case MP_EQ: printf("number = 7"); break; - case MP_LT: printf("number < 7"); break; - \} - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program functions properly it will print out the following. - -\begin{alltt} -number < 7 -\end{alltt} - -\section{Logical Operations} - -Logical operations are operations that can be performed either with simple shifts or boolean operators such as -AND, XOR and OR directly. These operations are very quick. - -\subsection{Multiplication by two} - -Multiplications and divisions by any power of two can be performed with quick logical shifts either left or -right depending on the operation. - -When multiplying or dividing by two a special case routine can be used which are as follows. -\index{mp\_mul\_2} \index{mp\_div\_2} -\begin{alltt} -int mp_mul_2(mp_int * a, mp_int * b); -int mp_div_2(mp_int * a, mp_int * b); -\end{alltt} - -The former will assign twice $a$ to $b$ while the latter will assign half $a$ to $b$. These functions are fast -since the shift counts and maskes are hardcoded into the routines. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 5 */ - mp_set(&number, 5); - - /* multiply by two */ - if ((result = mp\_mul\_2(&number, &number)) != MP_OKAY) \{ - printf("Error multiplying the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - switch(mp_cmp_d(&number, 7)) \{ - case MP_GT: printf("2*number > 7"); break; - case MP_EQ: printf("2*number = 7"); break; - case MP_LT: printf("2*number < 7"); break; - \} - - /* now divide by two */ - if ((result = mp\_div\_2(&number, &number)) != MP_OKAY) \{ - printf("Error dividing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - switch(mp_cmp_d(&number, 7)) \{ - case MP_GT: printf("2*number/2 > 7"); break; - case MP_EQ: printf("2*number/2 = 7"); break; - case MP_LT: printf("2*number/2 < 7"); break; - \} - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program is successful it will print out the following text. - -\begin{alltt} -2*number > 7 -2*number/2 < 7 -\end{alltt} - -Since $10 > 7$ and $5 < 7$. - -To multiply by a power of two the following function can be used. - -\index{mp\_mul\_2d} -\begin{alltt} -int mp_mul_2d(mp_int * a, int b, mp_int * c); -\end{alltt} - -This will multiply $a$ by $2^b$ and store the result in ``c''. If the value of $b$ is less than or equal to -zero the function will copy $a$ to ``c'' without performing any further actions. The multiplication itself -is implemented as a right-shift operation of $a$ by $b$ bits. - -To divide by a power of two use the following. - -\index{mp\_div\_2d} -\begin{alltt} -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d); -\end{alltt} -Which will divide $a$ by $2^b$, store the quotient in ``c'' and the remainder in ``d'. If $b \le 0$ then the -function simply copies $a$ over to ``c'' and zeroes $d$. The variable $d$ may be passed as a \textbf{NULL} -value to signal that the remainder is not desired. The division itself is implemented as a left-shift -operation of $a$ by $b$ bits. - -\subsection{Polynomial Basis Operations} - -Strictly speaking the organization of the integers within the mp\_int structures is what is known as a -``polynomial basis''. This simply means a field element is stored by divisions of a radix. For example, if -$f(x) = \sum_{i=0}^{k} y_ix^k$ for any vector $\vec y$ then the array of digits in $\vec y$ are said to be -the polynomial basis representation of $z$ if $f(\beta) = z$ for a given radix $\beta$. - -To multiply by the polynomial $g(x) = x$ all you have todo is shift the digits of the basis left one place. The -following function provides this operation. - -\index{mp\_lshd} -\begin{alltt} -int mp_lshd (mp_int * a, int b); -\end{alltt} - -This will multiply $a$ in place by $x^b$ which is equivalent to shifting the digits left $b$ places and inserting zeroes -in the least significant digits. Similarly to divide by a power of $x$ the following function is provided. - -\index{mp\_rshd} -\begin{alltt} -void mp_rshd (mp_int * a, int b) -\end{alltt} -This will divide $a$ in place by $x^b$ and discard the remainder. This function cannot fail as it performs the operations -in place and no new digits are required to complete it. - -\subsection{AND, OR and XOR Operations} - -While AND, OR and XOR operations are not typical ``bignum functions'' they can be useful in several instances. The -three functions are prototyped as follows. - -\index{mp\_or} \index{mp\_and} \index{mp\_xor} -\begin{alltt} -int mp_or (mp_int * a, mp_int * b, mp_int * c); -int mp_and (mp_int * a, mp_int * b, mp_int * c); -int mp_xor (mp_int * a, mp_int * b, mp_int * c); -\end{alltt} - -Which compute $c = a \odot b$ where $\odot$ is one of OR, AND or XOR. - -\section{Addition and Subtraction} - -To compute an addition or subtraction the following two functions can be used. - -\index{mp\_add} \index{mp\_sub} -\begin{alltt} -int mp_add (mp_int * a, mp_int * b, mp_int * c); -int mp_sub (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} - -Which perform $c = a \odot b$ where $\odot$ is one of signed addition or subtraction. The operations are fully sign -aware. - -\section{Sign Manipulation} -\subsection{Negation} -\label{sec:NEG} -Simple integer negation can be performed with the following. - -\index{mp\_neg} -\begin{alltt} -int mp_neg (mp_int * a, mp_int * b); -\end{alltt} - -Which assigns $-a$ to $b$. - -\subsection{Absolute} -Simple integer absolutes can be performed with the following. - -\index{mp\_neg} -\begin{alltt} -int mp_abs (mp_int * a, mp_int * b); -\end{alltt} - -Which assigns $\vert a \vert$ to $b$. - -\section{Integer Division and Remainder} -To perform a complete and general integer division with remainder use the following function. - -\index{mp\_div} -\begin{alltt} -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d); -\end{alltt} - -This divides $a$ by $b$ and stores the quotient in $c$ and $d$. The signed quotient is computed such that -$bc + d = a$. Note that either of $c$ or $d$ can be set to \textbf{NULL} if their value is not required. If -$b$ is zero the function returns \textbf{MP\_VAL}. - - -\chapter{Multiplication and Squaring} -\section{Multiplication} -A full signed integer multiplication can be performed with the following. -\index{mp\_mul} -\begin{alltt} -int mp_mul (mp_int * a, mp_int * b, mp_int * c); -\end{alltt} -Which assigns the full signed product $ab$ to $c$. This function actually breaks into one of four cases which are -specific multiplication routines optimized for given parameters. First there are the Toom-Cook multiplications which -should only be used with very large inputs. This is followed by the Karatsuba multiplications which are for moderate -sized inputs. Then followed by the Comba and baseline multipliers. - -Fortunately for the developer you don't really need to know this unless you really want to fine tune the system. mp\_mul() -will determine on its own\footnote{Some tweaking may be required.} what routine to use automatically when it is called. - -\begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - /* Initialize the numbers */ - if ((result = mp_init_multi(&number1, - &number2, NULL)) != MP_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the terms */ - if ((result = mp_set_int(&number, 257)) != MP_OKAY) \{ - printf("Error setting number1. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - if ((result = mp_set_int(&number2, 1023)) != MP_OKAY) \{ - printf("Error setting number2. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* multiply them */ - if ((result = mp_mul(&number1, &number2, - &number1)) != MP_OKAY) \{ - printf("Error multiplying terms. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* display */ - printf("number1 * number2 == \%lu", mp_get_int(&number1)); - - /* free terms and return */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} - -If this program succeeds it shall output the following. - -\begin{alltt} -number1 * number2 == 262911 -\end{alltt} - -\section{Squaring} -Since squaring can be performed faster than multiplication it is performed it's own function instead of just using -mp\_mul(). - -\index{mp\_sqr} -\begin{alltt} -int mp_sqr (mp_int * a, mp_int * b); -\end{alltt} - -Will square $a$ and store it in $b$. Like the case of multiplication there are four different squaring -algorithms all which can be called from mp\_sqr(). It is ideal to use mp\_sqr over mp\_mul when squaring terms because -of the speed difference. - -\section{Tuning Polynomial Basis Routines} - -Both of the Toom-Cook and Karatsuba multiplication algorithms are faster than the traditional $O(n^2)$ approach that -the Comba and baseline algorithms use. At $O(n^{1.464973})$ and $O(n^{1.584962})$ running times respectively they require -considerably less work. For example, a 10000-digit multiplication would take roughly 724,000 single precision -multiplications with Toom-Cook or 100,000,000 single precision multiplications with the standard Comba (a factor -of 138). - -So why not always use Karatsuba or Toom-Cook? The simple answer is that they have so much overhead that they're not -actually faster than Comba until you hit distinct ``cutoff'' points. For Karatsuba with the default configuration, -GCC 3.3.1 and an Athlon XP processor the cutoff point is roughly 110 digits (about 70 for the Intel P4). That is, at -110 digits Karatsuba and Comba multiplications just about break even and for 110+ digits Karatsuba is faster. - -Toom-Cook has incredible overhead and is probably only useful for very large inputs. So far no known cutoff points -exist and for the most part I just set the cutoff points very high to make sure they're not called. - -A demo program in the ``etc/'' directory of the project called ``tune.c'' can be used to find the cutoff points. This -can be built with GCC as follows - -\begin{alltt} -make XXX -\end{alltt} -Where ``XXX'' is one of the following entries from the table \ref{fig:tuning}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|l|l|} -\hline \textbf{Value of XXX} & \textbf{Meaning} \\ -\hline tune & Builds portable tuning application \\ -\hline tune86 & Builds x86 (pentium and up) program for COFF \\ -\hline tune86c & Builds x86 program for Cygwin \\ -\hline tune86l & Builds x86 program for Linux (ELF format) \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Build Names for Tuning Programs} -\label{fig:tuning} -\end{figure} - -When the program is running it will output a series of measurements for different cutoff points. It will first find -good Karatsuba squaring and multiplication points. Then it proceeds to find Toom-Cook points. Note that the Toom-Cook -tuning takes a very long time as the cutoff points are likely to be very high. - -\chapter{Modular Reduction} - -Modular reduction is process of taking the remainder of one quantity divided by another. Expressed -as (\ref{eqn:mod}) the modular reduction is equivalent to the remainder of $b$ divided by $c$. - -\begin{equation} -a \equiv b \mbox{ (mod }c\mbox{)} -\label{eqn:mod} -\end{equation} - -Of particular interest to cryptography are reductions where $b$ is limited to the range $0 \le b < c^2$ since particularly -fast reduction algorithms can be written for the limited range. - -Note that one of the four optimized reduction algorithms are automatically chosen in the modular exponentiation -algorithm mp\_exptmod when an appropriate modulus is detected. - -\section{Straight Division} -In order to effect an arbitrary modular reduction the following algorithm is provided. - -\index{mp\_mod} -\begin{alltt} -int mp_mod(mp_int *a, mp_int *b, mp_int *c); -\end{alltt} - -This reduces $a$ modulo $b$ and stores the result in $c$. The sign of $c$ shall agree with the sign -of $b$. This algorithm accepts an input $a$ of any range and is not limited by $0 \le a < b^2$. - -\section{Barrett Reduction} - -Barrett reduction is a generic optimized reduction algorithm that requires pre--computation to achieve -a decent speedup over straight division. First a $\mu$ value must be precomputed with the following function. - -\index{mp\_reduce\_setup} -\begin{alltt} -int mp_reduce_setup(mp_int *a, mp_int *b); -\end{alltt} - -Given a modulus in $b$ this produces the required $\mu$ value in $a$. For any given modulus this only has to -be computed once. Modular reduction can now be performed with the following. - -\index{mp\_reduce} -\begin{alltt} -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); -\end{alltt} - -This will reduce $a$ in place modulo $b$ with the precomputed $\mu$ value in $c$. $a$ must be in the range -$0 \le a < b^2$. - -\begin{alltt} -int main(void) -\{ - mp_int a, b, c, mu; - int result; - - /* initialize a,b to desired values, mp_init mu, - * c and set c to 1...we want to compute a^3 mod b - */ - - /* get mu value */ - if ((result = mp_reduce_setup(&mu, b)) != MP_OKAY) \{ - printf("Error getting mu. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* square a to get c = a^2 */ - if ((result = mp_sqr(&a, &c)) != MP_OKAY) \{ - printf("Error squaring. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' modulo b */ - if ((result = mp_reduce(&c, &b, &mu)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* multiply a to get c = a^3 */ - if ((result = mp_mul(&a, &c, &c)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' modulo b */ - if ((result = mp_reduce(&c, &b, &mu)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* c now equals a^3 mod b */ - - return EXIT_SUCCESS; -\} -\end{alltt} - -This program will calculate $a^3 \mbox{ mod }b$ if all the functions succeed. - -\section{Montgomery Reduction} - -Montgomery is a specialized reduction algorithm for any odd moduli. Like Barrett reduction a pre--computation -step is required. This is accomplished with the following. - -\index{mp\_montgomery\_setup} -\begin{alltt} -int mp_montgomery_setup(mp_int *a, mp_digit *mp); -\end{alltt} - -For the given odd moduli $a$ the precomputation value is placed in $mp$. The reduction is computed with the -following. - -\index{mp\_montgomery\_reduce} -\begin{alltt} -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); -\end{alltt} -This reduces $a$ in place modulo $m$ with the pre--computed value $mp$. $a$ must be in the range -$0 \le a < b^2$. - -Montgomery reduction is faster than Barrett reduction for moduli smaller than the ``comba'' limit. With the default -setup for instance, the limit is $127$ digits ($3556$--bits). Note that this function is not limited to -$127$ digits just that it falls back to a baseline algorithm after that point. - -An important observation is that this reduction does not return $a \mbox{ mod }m$ but $aR^{-1} \mbox{ mod }m$ -where $R = \beta^n$, $n$ is the n number of digits in $m$ and $\beta$ is radix used (default is $2^{28}$). - -To quickly calculate $R$ the following function was provided. - -\index{mp\_montgomery\_calc\_normalization} -\begin{alltt} -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); -\end{alltt} -Which calculates $a = R$ for the odd moduli $b$ without using multiplication or division. - -The normal modus operandi for Montgomery reductions is to normalize the integers before entering the system. For -example, to calculate $a^3 \mbox { mod }b$ using Montgomery reduction the value of $a$ can be normalized by -multiplying it by $R$. Consider the following code snippet. - -\begin{alltt} -int main(void) -\{ - mp_int a, b, c, R; - mp_digit mp; - int result; - - /* initialize a,b to desired values, - * mp_init R, c and set c to 1.... - */ - - /* get normalization */ - if ((result = mp_montgomery_calc_normalization(&R, b)) != MP_OKAY) \{ - printf("Error getting norm. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* get mp value */ - if ((result = mp_montgomery_setup(&c, &mp)) != MP_OKAY) \{ - printf("Error setting up montgomery. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* normalize `a' so now a is equal to aR */ - if ((result = mp_mulmod(&a, &R, &b, &a)) != MP_OKAY) \{ - printf("Error computing aR. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* square a to get c = a^2R^2 */ - if ((result = mp_sqr(&a, &c)) != MP_OKAY) \{ - printf("Error squaring. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' back down to c = a^2R^2 * R^-1 == a^2R */ - if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* multiply a to get c = a^3R^2 */ - if ((result = mp_mul(&a, &c, &c)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' back down to c = a^3R^2 * R^-1 == a^3R */ - if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce (again) `c' back down to c = a^3R * R^-1 == a^3 */ - if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* c now equals a^3 mod b */ - - return EXIT_SUCCESS; -\} -\end{alltt} - -This particular example does not look too efficient but it demonstrates the point of the algorithm. By -normalizing the inputs the reduced results are always of the form $aR$ for some variable $a$. This allows -a single final reduction to correct for the normalization and the fast reduction used within the algorithm. - -For more details consider examining the file \textit{bn\_mp\_exptmod\_fast.c}. - -\section{Restricted Dimminished Radix} - -``Dimminished Radix'' reduction refers to reduction with respect to moduli that are ameniable to simple -digit shifting and small multiplications. In this case the ``restricted'' variant refers to moduli of the -form $\beta^k - p$ for some $k \ge 0$ and $0 < p < \beta$ where $\beta$ is the radix (default to $2^{28}$). - -As in the case of Montgomery reduction there is a pre--computation phase required for a given modulus. - -\index{mp\_dr\_setup} -\begin{alltt} -void mp_dr_setup(mp_int *a, mp_digit *d); -\end{alltt} - -This computes the value required for the modulus $a$ and stores it in $d$. This function cannot fail -and does not return any error codes. After the pre--computation a reduction can be performed with the -following. - -\index{mp\_dr\_reduce} -\begin{alltt} -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); -\end{alltt} - -This reduces $a$ in place modulo $b$ with the pre--computed value $mp$. $b$ must be of a restricted -dimminished radix form and $a$ must be in the range $0 \le a < b^2$. Dimminished radix reductions are -much faster than both Barrett and Montgomery reductions as they have a much lower asymtotic running time. - -Since the moduli are restricted this algorithm is not particularly useful for something like Rabin, RSA or -BBS cryptographic purposes. This reduction algorithm is useful for Diffie-Hellman and ECC where fixed -primes are acceptable. - -Note that unlike Montgomery reduction there is no normalization process. The result of this function is -equal to the correct residue. - -\section{Unrestricted Dimminshed Radix} - -Unrestricted reductions work much like the restricted counterparts except in this case the moduli is of the -form $2^k - p$ for $0 < p < \beta$. In this sense the unrestricted reductions are more flexible as they -can be applied to a wider range of numbers. - -\index{mp\_reduce\_2k\_setup} -\begin{alltt} -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); -\end{alltt} - -This will compute the required $d$ value for the given moduli $a$. - -\index{mp\_reduce\_2k} -\begin{alltt} -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); -\end{alltt} - -This will reduce $a$ in place modulo $n$ with the pre--computed value $d$. From my experience this routine is -slower than mp\_dr\_reduce but faster for most moduli sizes than the Montgomery reduction. - -\chapter{Exponentiation} -\section{Single Digit Exponentiation} -\index{mp\_expt\_d\_ex} -\begin{alltt} -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) -\end{alltt} -This function computes $c = a^b$. - -With parameter \textit{fast} set to $0$ the old version of the algorithm is used, -when \textit{fast} is $1$, a faster but not statically timed version of the algorithm is used. - -The old version uses a simple binary left-to-right algorithm. -It is faster than repeated multiplications by $a$ for all values of $b$ greater than three. - -The new version uses a binary right-to-left algorithm. - -The difference between the old and the new version is that the old version always -executes $DIGIT\_BIT$ iterations. The new algorithm executes only $n$ iterations -where $n$ is equal to the position of the highest bit that is set in $b$. - -\index{mp\_expt\_d} -\begin{alltt} -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) -\end{alltt} -mp\_expt\_d(a, b, c) is a wrapper function to mp\_expt\_d\_ex(a, b, c, 0). - -\section{Modular Exponentiation} -\index{mp\_exptmod} -\begin{alltt} -int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) -\end{alltt} -This computes $Y \equiv G^X \mbox{ (mod }P\mbox{)}$ using a variable width sliding window algorithm. This function -will automatically detect the fastest modular reduction technique to use during the operation. For negative values of -$X$ the operation is performed as $Y \equiv (G^{-1} \mbox{ mod }P)^{\vert X \vert} \mbox{ (mod }P\mbox{)}$ provided that -$gcd(G, P) = 1$. - -This function is actually a shell around the two internal exponentiation functions. This routine will automatically -detect when Barrett, Montgomery, Restricted and Unrestricted Dimminished Radix based exponentiation can be used. Generally -moduli of the a ``restricted dimminished radix'' form lead to the fastest modular exponentiations. Followed by Montgomery -and the other two algorithms. - -\section{Root Finding} -\index{mp\_n\_root} -\begin{alltt} -int mp_n_root (mp_int * a, mp_digit b, mp_int * c) -\end{alltt} -This computes $c = a^{1/b}$ such that $c^b \le a$ and $(c+1)^b > a$. The implementation of this function is not -ideal for values of $b$ greater than three. It will work but become very slow. So unless you are working with very small -numbers (less than 1000 bits) I'd avoid $b > 3$ situations. Will return a positive root only for even roots and return -a root with the sign of the input for odd roots. For example, performing $4^{1/2}$ will return $2$ whereas $(-8)^{1/3}$ -will return $-2$. - -This algorithm uses the ``Newton Approximation'' method and will converge on the correct root fairly quickly. Since -the algorithm requires raising $a$ to the power of $b$ it is not ideal to attempt to find roots for large -values of $b$. If particularly large roots are required then a factor method could be used instead. For example, -$a^{1/16}$ is equivalent to $\left (a^{1/4} \right)^{1/4}$ or simply -$\left ( \left ( \left ( a^{1/2} \right )^{1/2} \right )^{1/2} \right )^{1/2}$ - -\chapter{Prime Numbers} -\section{Trial Division} -\index{mp\_prime\_is\_divisible} -\begin{alltt} -int mp_prime_is_divisible (mp_int * a, int *result) -\end{alltt} -This will attempt to evenly divide $a$ by a list of primes\footnote{Default is the first 256 primes.} and store the -outcome in ``result''. That is if $result = 0$ then $a$ is not divisible by the primes, otherwise it is. Note that -if the function does not return \textbf{MP\_OKAY} the value in ``result'' should be considered undefined\footnote{Currently -the default is to set it to zero first.}. - -\section{Fermat Test} -\index{mp\_prime\_fermat} -\begin{alltt} -int mp_prime_fermat (mp_int * a, mp_int * b, int *result) -\end{alltt} -Performs a Fermat primality test to the base $b$. That is it computes $b^a \mbox{ mod }a$ and tests whether the value is -equal to $b$ or not. If the values are equal then $a$ is probably prime and $result$ is set to one. Otherwise $result$ -is set to zero. - -\section{Miller-Rabin Test} -\index{mp\_prime\_miller\_rabin} -\begin{alltt} -int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) -\end{alltt} -Performs a Miller-Rabin test to the base $b$ of $a$. This test is much stronger than the Fermat test and is very hard to -fool (besides with Carmichael numbers). If $a$ passes the test (therefore is probably prime) $result$ is set to one. -Otherwise $result$ is set to zero. - -Note that is suggested that you use the Miller-Rabin test instead of the Fermat test since all of the failures of -Miller-Rabin are a subset of the failures of the Fermat test. - -\subsection{Required Number of Tests} -Generally to ensure a number is very likely to be prime you have to perform the Miller-Rabin with at least a half-dozen -or so unique bases. However, it has been proven that the probability of failure goes down as the size of the input goes up. -This is why a simple function has been provided to help out. - -\index{mp\_prime\_rabin\_miller\_trials} -\begin{alltt} -int mp_prime_rabin_miller_trials(int size) -\end{alltt} -This returns the number of trials required for a $2^{-96}$ (or lower) probability of failure for a given ``size'' expressed -in bits. This comes in handy specially since larger numbers are slower to test. For example, a 512-bit number would -require ten tests whereas a 1024-bit number would only require four tests. - -You should always still perform a trial division before a Miller-Rabin test though. - -\section{Primality Testing} -\index{mp\_prime\_is\_prime} -\begin{alltt} -int mp_prime_is_prime (mp_int * a, int t, int *result) -\end{alltt} -This will perform a trial division followed by $t$ rounds of Miller-Rabin tests on $a$ and store the result in $result$. -If $a$ passes all of the tests $result$ is set to one, otherwise it is set to zero. Note that $t$ is bounded by -$1 \le t < PRIME\_SIZE$ where $PRIME\_SIZE$ is the number of primes in the prime number table (by default this is $256$). - -\section{Next Prime} -\index{mp\_prime\_next\_prime} -\begin{alltt} -int mp_prime_next_prime(mp_int *a, int t, int bbs_style) -\end{alltt} -This finds the next prime after $a$ that passes mp\_prime\_is\_prime() with $t$ tests. Set $bbs\_style$ to one if you -want only the next prime congruent to $3 \mbox{ mod } 4$, otherwise set it to zero to find any next prime. - -\section{Random Primes} -\index{mp\_prime\_random} -\begin{alltt} -int mp_prime_random(mp_int *a, int t, int size, int bbs, - ltm_prime_callback cb, void *dat) -\end{alltt} -This will find a prime greater than $256^{size}$ which can be ``bbs\_style'' or not depending on $bbs$ and must pass -$t$ rounds of tests. The ``ltm\_prime\_callback'' is a typedef for - -\begin{alltt} -typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat); -\end{alltt} - -Which is a function that must read $len$ bytes (and return the amount stored) into $dst$. The $dat$ variable is simply -copied from the original input. It can be used to pass RNG context data to the callback. The function -mp\_prime\_random() is more suitable for generating primes which must be secret (as in the case of RSA) since there -is no skew on the least significant bits. - -\textit{Note:} As of v0.30 of the LibTomMath library this function has been deprecated. It is still available -but users are encouraged to use the new mp\_prime\_random\_ex() function instead. - -\subsection{Extended Generation} -\index{mp\_prime\_random\_ex} -\begin{alltt} -int mp_prime_random_ex(mp_int *a, int t, - int size, int flags, - ltm_prime_callback cb, void *dat); -\end{alltt} -This will generate a prime in $a$ using $t$ tests of the primality testing algorithms. The variable $size$ -specifies the bit length of the prime desired. The variable $flags$ specifies one of several options available -(see fig. \ref{fig:primeopts}) which can be OR'ed together. The callback parameters are used as in -mp\_prime\_random(). - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|r|l|} -\hline \textbf{Flag} & \textbf{Meaning} \\ -\hline LTM\_PRIME\_BBS & Make the prime congruent to $3$ modulo $4$ \\ -\hline LTM\_PRIME\_SAFE & Make a prime $p$ such that $(p - 1)/2$ is also prime. \\ - & This option implies LTM\_PRIME\_BBS as well. \\ -\hline LTM\_PRIME\_2MSB\_OFF & Makes sure that the bit adjacent to the most significant bit \\ - & Is forced to zero. \\ -\hline LTM\_PRIME\_2MSB\_ON & Makes sure that the bit adjacent to the most significant bit \\ - & Is forced to one. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Primality Generation Options} -\label{fig:primeopts} -\end{figure} - -\chapter{Input and Output} -\section{ASCII Conversions} -\subsection{To ASCII} -\index{mp\_toradix} -\begin{alltt} -int mp_toradix (mp_int * a, char *str, int radix); -\end{alltt} -This still store $a$ in ``str'' as a base-``radix'' string of ASCII chars. This function appends a NUL character -to terminate the string. Valid values of ``radix'' line in the range $[2, 64]$. To determine the size (exact) required -by the conversion before storing any data use the following function. - -\index{mp\_radix\_size} -\begin{alltt} -int mp_radix_size (mp_int * a, int radix, int *size) -\end{alltt} -This stores in ``size'' the number of characters (including space for the NUL terminator) required. Upon error this -function returns an error code and ``size'' will be zero. - -\subsection{From ASCII} -\index{mp\_read\_radix} -\begin{alltt} -int mp_read_radix (mp_int * a, char *str, int radix); -\end{alltt} -This will read the base-``radix'' NUL terminated string from ``str'' into $a$. It will stop reading when it reads a -character it does not recognize (which happens to include th NUL char... imagine that...). A single leading $-$ sign -can be used to denote a negative number. - -\section{Binary Conversions} - -Converting an mp\_int to and from binary is another keen idea. - -\index{mp\_unsigned\_bin\_size} -\begin{alltt} -int mp_unsigned_bin_size(mp_int *a); -\end{alltt} - -This will return the number of bytes (octets) required to store the unsigned copy of the integer $a$. - -\index{mp\_to\_unsigned\_bin} -\begin{alltt} -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -\end{alltt} -This will store $a$ into the buffer $b$ in big--endian format. Fortunately this is exactly what DER (or is it ASN?) -requires. It does not store the sign of the integer. - -\index{mp\_read\_unsigned\_bin} -\begin{alltt} -int mp_read_unsigned_bin(mp_int *a, unsigned char *b, int c); -\end{alltt} -This will read in an unsigned big--endian array of bytes (octets) from $b$ of length $c$ into $a$. The resulting -integer $a$ will always be positive. - -For those who acknowledge the existence of negative numbers (heretic!) there are ``signed'' versions of the -previous functions. - -\begin{alltt} -int mp_signed_bin_size(mp_int *a); -int mp_read_signed_bin(mp_int *a, unsigned char *b, int c); -int mp_to_signed_bin(mp_int *a, unsigned char *b); -\end{alltt} -They operate essentially the same as the unsigned copies except they prefix the data with zero or non--zero -byte depending on the sign. If the sign is zpos (e.g. not negative) the prefix is zero, otherwise the prefix -is non--zero. - -\chapter{Algebraic Functions} -\section{Extended Euclidean Algorithm} -\index{mp\_exteuclid} -\begin{alltt} -int mp_exteuclid(mp_int *a, mp_int *b, - mp_int *U1, mp_int *U2, mp_int *U3); -\end{alltt} - -This finds the triple U1/U2/U3 using the Extended Euclidean algorithm such that the following equation holds. - -\begin{equation} -a \cdot U1 + b \cdot U2 = U3 -\end{equation} - -Any of the U1/U2/U3 paramters can be set to \textbf{NULL} if they are not desired. - -\section{Greatest Common Divisor} -\index{mp\_gcd} -\begin{alltt} -int mp_gcd (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} -This will compute the greatest common divisor of $a$ and $b$ and store it in $c$. - -\section{Least Common Multiple} -\index{mp\_lcm} -\begin{alltt} -int mp_lcm (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} -This will compute the least common multiple of $a$ and $b$ and store it in $c$. - -\section{Jacobi Symbol} -\index{mp\_jacobi} -\begin{alltt} -int mp_jacobi (mp_int * a, mp_int * p, int *c) -\end{alltt} -This will compute the Jacobi symbol for $a$ with respect to $p$. If $p$ is prime this essentially computes the Legendre -symbol. The result is stored in $c$ and can take on one of three values $\lbrace -1, 0, 1 \rbrace$. If $p$ is prime -then the result will be $-1$ when $a$ is not a quadratic residue modulo $p$. The result will be $0$ if $a$ divides $p$ -and the result will be $1$ if $a$ is a quadratic residue modulo $p$. - -\section{Modular square root} -\index{mp\_sqrtmod\_prime} -\begin{alltt} -int mp_sqrtmod_prime(mp_int *n, mp_int *p, mp_int *r) -\end{alltt} - -This will solve the modular equatioon $r^2 = n \mod p$ where $p$ is a prime number greater than 2 (odd prime). -The result is returned in the third argument $r$, the function returns \textbf{MP\_OKAY} on success, -other return values indicate failure. - -The implementation is split for two different cases: - -1. if $p \mod 4 == 3$ we apply \href{http://cacr.uwaterloo.ca/hac/}{Handbook of Applied Cryptography algorithm 3.36} and compute $r$ directly as -$r = n^{(p+1)/4} \mod p$ - -2. otherwise we use \href{https://en.wikipedia.org/wiki/Tonelli-Shanks_algorithm}{Tonelli-Shanks algorithm} - -The function does not check the primality of parameter $p$ thus it is up to the caller to assure that this parameter -is a prime number. When $p$ is a composite the function behaviour is undefined, it may even return a false-positive -\textbf{MP\_OKAY}. - -\section{Modular Inverse} -\index{mp\_invmod} -\begin{alltt} -int mp_invmod (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} -Computes the multiplicative inverse of $a$ modulo $b$ and stores the result in $c$ such that $ac \equiv 1 \mbox{ (mod }b\mbox{)}$. - -\section{Single Digit Functions} - -For those using small numbers (\textit{snicker snicker}) there are several ``helper'' functions - -\index{mp\_add\_d} \index{mp\_sub\_d} \index{mp\_mul\_d} \index{mp\_div\_d} \index{mp\_mod\_d} -\begin{alltt} -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); -\end{alltt} - -These work like the full mp\_int capable variants except the second parameter $b$ is a mp\_digit. These -functions fairly handy if you have to work with relatively small numbers since you will not have to allocate -an entire mp\_int to store a number like $1$ or $2$. - -\input{bn.ind} - -\end{document} diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 03384e3..a4d1c8a 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -71,7 +71,13 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } ++str; } - + + /* if an illegal character was found, fail. */ + if (!(*str == '\0' || *str == '\r' || *str == '\n')) { + mp_zero(a); + return MP_VAL; + } + /* set the sign only if a != 0 */ if (mp_iszero(a) != MP_YES) { a->sign = neg; diff --git a/libtommath/booker.pl b/libtommath/booker.pl deleted file mode 100644 index c2abae6..0000000 --- a/libtommath/booker.pl +++ /dev/null @@ -1,267 +0,0 @@ -#!/bin/perl -# -#Used to prepare the book "tommath.src" for LaTeX by pre-processing it into a .tex file -# -#Essentially you write the "tommath.src" as normal LaTex except where you want code snippets you put -# -#EXAM,file -# -#This preprocessor will then open "file" and insert it as a verbatim copy. -# -#Tom St Denis - -#get graphics type -if (shift =~ /PDF/) { - $graph = ""; -} else { - $graph = ".ps"; -} - -open(IN,"tommath.tex") or die "Can't open destination file"; - -print "Scanning for sections\n"; -$chapter = $section = $subsection = 0; -$x = 0; -while () { - print "."; - if (!(++$x % 80)) { print "\n"; } - #update the headings - if (~($_ =~ /\*/)) { - if ($_ =~ /\\chapter\{.+}/) { - ++$chapter; - $section = $subsection = 0; - } elsif ($_ =~ /\\section\{.+}/) { - ++$section; - $subsection = 0; - } elsif ($_ =~ /\\subsection\{.+}/) { - ++$subsection; - } - } - - if ($_ =~ m/MARK/) { - @m = split(",",$_); - chomp(@m[1]); - $index1{@m[1]} = $chapter; - $index2{@m[1]} = $section; - $index3{@m[1]} = $subsection; - } -} -close(IN); - -open(IN,") { - ++$readline; - ++$srcline; - - if ($_ =~ m/MARK/) { - } elsif ($_ =~ m/EXAM/ || $_ =~ m/LIST/) { - if ($_ =~ m/EXAM/) { - $skipheader = 1; - } else { - $skipheader = 0; - } - - # EXAM,file - chomp($_); - @m = split(",",$_); - open(SRC,"<$m[1]") or die "Error:$srcline:Can't open source file $m[1]"; - - print "$srcline:Inserting $m[1]:"; - - $line = 0; - $tmp = $m[1]; - $tmp =~ s/_/"\\_"/ge; - print OUT "\\vspace{+3mm}\\begin{small}\n\\hspace{-5.1mm}{\\bf File}: $tmp\n\\vspace{-3mm}\n\\begin{alltt}\n"; - $wroteline += 5; - - if ($skipheader == 1) { - # scan till next end of comment, e.g. skip license - while () { - $text[$line++] = $_; - last if ($_ =~ /libtom\.org/); - } - ; - } - - $inline = 0; - while () { - next if ($_ =~ /\$Source/); - next if ($_ =~ /\$Revision/); - next if ($_ =~ /\$Date/); - $text[$line++] = $_; - ++$inline; - chomp($_); - $_ =~ s/\t/" "/ge; - $_ =~ s/{/"^{"/ge; - $_ =~ s/}/"^}"/ge; - $_ =~ s/\\/'\symbol{92}'/ge; - $_ =~ s/\^/"\\"/ge; - - printf OUT ("%03d ", $line); - for ($x = 0; $x < length($_); $x++) { - print OUT chr(vec($_, $x, 8)); - if ($x == 75) { - print OUT "\n "; - ++$wroteline; - } - } - print OUT "\n"; - ++$wroteline; - } - $totlines = $line; - print OUT "\\end{alltt}\n\\end{small}\n"; - close(SRC); - print "$inline lines\n"; - $wroteline += 2; - } elsif ($_ =~ m/@\d+,.+@/) { - # line contains [number,text] - # e.g. @14,for (ix = 0)@ - $txt = $_; - while ($txt =~ m/@\d+,.+@/) { - @m = split("@",$txt); # splits into text, one, two - @parms = split(",",$m[1]); # splits one,two into two elements - - # now search from $parms[0] down for $parms[1] - $found1 = 0; - $found2 = 0; - for ($i = $parms[0]; $i < $totlines && $found1 == 0; $i++) { - if ($text[$i] =~ m/\Q$parms[1]\E/) { - $foundline1 = $i + 1; - $found1 = 1; - } - } - - # now search backwards - for ($i = $parms[0] - 1; $i >= 0 && $found2 == 0; $i--) { - if ($text[$i] =~ m/\Q$parms[1]\E/) { - $foundline2 = $i + 1; - $found2 = 1; - } - } - - # now use the closest match or the first if tied - if ($found1 == 1 && $found2 == 0) { - $found = 1; - $foundline = $foundline1; - } elsif ($found1 == 0 && $found2 == 1) { - $found = 1; - $foundline = $foundline2; - } elsif ($found1 == 1 && $found2 == 1) { - $found = 1; - if (($foundline1 - $parms[0]) <= ($parms[0] - $foundline2)) { - $foundline = $foundline1; - } else { - $foundline = $foundline2; - } - } else { - $found = 0; - } - - # if found replace - if ($found == 1) { - $delta = $parms[0] - $foundline; - print "Found replacement tag for \"$parms[1]\" on line $srcline which refers to line $foundline (delta $delta)\n"; - $_ =~ s/@\Q$m[1]\E@/$foundline/; - } else { - print "ERROR: The tag \"$parms[1]\" on line $srcline was not found in the most recently parsed source!\n"; - } - - # remake the rest of the line - $cnt = @m; - $txt = ""; - for ($i = 2; $i < $cnt; $i++) { - $txt = $txt . $m[$i] . "@"; - } - } - print OUT $_; - ++$wroteline; - } elsif ($_ =~ /~.+~/) { - # line contains a ~text~ pair used to refer to indexing :-) - $txt = $_; - while ($txt =~ /~.+~/) { - @m = split("~", $txt); - - # word is the second position - $word = @m[1]; - $a = $index1{$word}; - $b = $index2{$word}; - $c = $index3{$word}; - - # if chapter (a) is zero it wasn't found - if ($a == 0) { - print "ERROR: the tag \"$word\" on line $srcline was not found previously marked.\n"; - } else { - # format the tag as x, x.y or x.y.z depending on the values - $str = $a; - $str = $str . ".$b" if ($b != 0); - $str = $str . ".$c" if ($c != 0); - - if ($b == 0 && $c == 0) { - # its a chapter - if ($a <= 10) { - if ($a == 1) { - $str = "chapter one"; - } elsif ($a == 2) { - $str = "chapter two"; - } elsif ($a == 3) { - $str = "chapter three"; - } elsif ($a == 4) { - $str = "chapter four"; - } elsif ($a == 5) { - $str = "chapter five"; - } elsif ($a == 6) { - $str = "chapter six"; - } elsif ($a == 7) { - $str = "chapter seven"; - } elsif ($a == 8) { - $str = "chapter eight"; - } elsif ($a == 9) { - $str = "chapter nine"; - } elsif ($a == 10) { - $str = "chapter ten"; - } - } else { - $str = "chapter " . $str; - } - } else { - $str = "section " . $str if ($b != 0 && $c == 0); - $str = "sub-section " . $str if ($b != 0 && $c != 0); - } - - #substitute - $_ =~ s/~\Q$word\E~/$str/; - - print "Found replacement tag for marker \"$word\" on line $srcline which refers to $str\n"; - } - - # remake rest of the line - $cnt = @m; - $txt = ""; - for ($i = 2; $i < $cnt; $i++) { - $txt = $txt . $m[$i] . "~"; - } - } - print OUT $_; - ++$wroteline; - } elsif ($_ =~ m/FIGU/) { - # FIGU,file,caption - chomp($_); - @m = split(",", $_); - print OUT "\\begin{center}\n\\begin{figure}[here]\n\\includegraphics{pics/$m[1]$graph}\n"; - print OUT "\\caption{$m[2]}\n\\label{pic:$m[1]}\n\\end{figure}\n\\end{center}\n"; - $wroteline += 4; - } else { - print OUT $_; - ++$wroteline; - } -} -print "Read $readline lines, wrote $wroteline lines\n"; - -close (OUT); -close (IN); - -system('perl -pli -e "s/\s*$//" tommath.tex'); diff --git a/libtommath/changes.txt b/libtommath/changes.txt index 3379f71..51da801 100644 --- a/libtommath/changes.txt +++ b/libtommath/changes.txt @@ -1,4 +1,4 @@ -XXX, 2017 +Aug 29th, 2017 v1.0.1 -- Dmitry Kovalenko provided fixes to mp_add_d() and mp_init_copy() -- Matt Johnston contributed some improvements to mp_div_2d(), diff --git a/libtommath/demo/demo.c b/libtommath/demo/demo.c deleted file mode 100644 index b46b7f8..0000000 --- a/libtommath/demo/demo.c +++ /dev/null @@ -1,986 +0,0 @@ -#include -#include - -#ifdef IOWNANATHLON -#include -#define SLEEP sleep(4) -#else -#define SLEEP -#endif - -/* - * Configuration - */ -#ifndef LTM_DEMO_TEST_VS_MTEST -#define LTM_DEMO_TEST_VS_MTEST 1 -#endif - -#ifndef LTM_DEMO_TEST_REDUCE_2K_L -/* This test takes a moment so we disable it by default, but it can be: - * 0 to disable testing - * 1 to make the test with P = 2^1024 - 0x2A434 B9FDEC95 D8F9D550 FFFFFFFF FFFFFFFF - * 2 to make the test with P = 2^2048 - 0x1 00000000 00000000 00000000 00000000 4945DDBF 8EA2A91D 5776399B B83E188F - */ -#define LTM_DEMO_TEST_REDUCE_2K_L 0 -#endif - -#ifdef LTM_DEMO_REAL_RAND -#define LTM_DEMO_RAND_SEED time(NULL) -#else -#define LTM_DEMO_RAND_SEED 23 -#endif - -#include "tommath.h" - -void ndraw(mp_int * a, char *name) -{ - char buf[16000]; - - printf("%s: ", name); - mp_toradix(a, buf, 10); - printf("%s\n", buf); - mp_toradix(a, buf, 16); - printf("0x%s\n", buf); -} - -#if LTM_DEMO_TEST_VS_MTEST -static void draw(mp_int * a) -{ - ndraw(a, ""); -} -#endif - - -unsigned long lfsr = 0xAAAAAAAAUL; - -int lbit(void) -{ - if (lfsr & 0x80000000UL) { - lfsr = ((lfsr << 1) ^ 0x8000001BUL) & 0xFFFFFFFFUL; - return 1; - } else { - lfsr <<= 1; - return 0; - } -} - -#if defined(LTM_DEMO_REAL_RAND) && !defined(_WIN32) -static FILE* fd_urandom; -#endif -int myrng(unsigned char *dst, int len, void *dat) -{ - int x; - (void)dat; -#if defined(LTM_DEMO_REAL_RAND) - if (!fd_urandom) { -#if !defined(_WIN32) - fprintf(stderr, "\nno /dev/urandom\n"); -#endif - } - else { - return fread(dst, 1, len, fd_urandom); - } -#endif - for (x = 0; x < len; ) { - unsigned int r = (unsigned int)rand(); - do { - dst[x++] = r & 0xFF; - r >>= 8; - } while((r != 0) && (x < len)); - } - return len; -} - -#if LTM_DEMO_TEST_VS_MTEST != 0 -static void _panic(int l) -{ - fprintf(stderr, "\n%d: fgets failed\n", l); - exit(EXIT_FAILURE); -} -#endif - -mp_int a, b, c, d, e, f; - -static void _cleanup(void) -{ - mp_clear_multi(&a, &b, &c, &d, &e, &f, NULL); - printf("\n"); - -#ifdef LTM_DEMO_REAL_RAND - if(fd_urandom) - fclose(fd_urandom); -#endif -} -struct mp_sqrtmod_prime_st { - unsigned long p; - unsigned long n; - mp_digit r; -}; -struct mp_sqrtmod_prime_st sqrtmod_prime[] = { - { 5, 14, 3 }, - { 7, 9, 4 }, - { 113, 2, 62 } -}; -struct mp_jacobi_st { - unsigned long n; - int c[16]; -}; -struct mp_jacobi_st jacobi[] = { - { 3, { 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1 } }, - { 5, { 0, 1, -1, -1, 1, 0, 1, -1, -1, 1, 0, 1, -1, -1, 1, 0 } }, - { 7, { 1, -1, 1, -1, -1, 0, 1, 1, -1, 1, -1, -1, 0, 1, 1, -1 } }, - { 9, { -1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1 } }, -}; - -char cmd[4096], buf[4096]; -int main(void) -{ - unsigned rr; - int cnt, ix; -#if LTM_DEMO_TEST_VS_MTEST - unsigned long expt_n, add_n, sub_n, mul_n, div_n, sqr_n, mul2d_n, div2d_n, - gcd_n, lcm_n, inv_n, div2_n, mul2_n, add_d_n, sub_d_n; - char* ret; -#else - unsigned long s, t; - unsigned long long q, r; - mp_digit mp; - int i, n, err, should; -#endif - - if (mp_init_multi(&a, &b, &c, &d, &e, &f, NULL)!= MP_OKAY) - return EXIT_FAILURE; - - atexit(_cleanup); - -#if defined(LTM_DEMO_REAL_RAND) - if (!fd_urandom) { - fd_urandom = fopen("/dev/urandom", "r"); - if (!fd_urandom) { -#if !defined(_WIN32) - fprintf(stderr, "\ncould not open /dev/urandom\n"); -#endif - } - } -#endif - srand(LTM_DEMO_RAND_SEED); - -#ifdef MP_8BIT - printf("Digit size 8 Bit \n"); -#endif -#ifdef MP_16BIT - printf("Digit size 16 Bit \n"); -#endif -#ifdef MP_32BIT - printf("Digit size 32 Bit \n"); -#endif -#ifdef MP_64BIT - printf("Digit size 64 Bit \n"); -#endif - printf("Size of mp_digit: %u\n", (unsigned int)sizeof(mp_digit)); - printf("Size of mp_word: %u\n", (unsigned int)sizeof(mp_word)); - printf("DIGIT_BIT: %d\n", DIGIT_BIT); - printf("MP_PREC: %d\n", MP_PREC); - -#if LTM_DEMO_TEST_VS_MTEST == 0 - // trivial stuff - mp_set_int(&a, 5); - mp_neg(&a, &b); - if (mp_cmp(&a, &b) != MP_GT) { - return EXIT_FAILURE; - } - if (mp_cmp(&b, &a) != MP_LT) { - return EXIT_FAILURE; - } - mp_neg(&a, &a); - if (mp_cmp(&b, &a) != MP_EQ) { - return EXIT_FAILURE; - } - mp_abs(&a, &b); - if (mp_isneg(&b) != MP_NO) { - return EXIT_FAILURE; - } - mp_add_d(&a, 1, &b); - mp_add_d(&a, 6, &b); - - - mp_set_int(&a, 0); - mp_set_int(&b, 1); - if ((err = mp_jacobi(&a, &b, &i)) != MP_OKAY) { - printf("Failed executing mp_jacobi(0 | 1) %s.\n", mp_error_to_string(err)); - return EXIT_FAILURE; - } - if (i != 1) { - printf("Failed trivial mp_jacobi(0 | 1) %d != 1\n", i); - return EXIT_FAILURE; - } - for (cnt = 0; cnt < (int)(sizeof(jacobi)/sizeof(jacobi[0])); ++cnt) { - mp_set_int(&b, jacobi[cnt].n); - /* only test positive values of a */ - for (n = -5; n <= 10; ++n) { - mp_set_int(&a, abs(n)); - should = MP_OKAY; - if (n < 0) { - mp_neg(&a, &a); - /* Until #44 is fixed the negative a's must fail */ - should = MP_VAL; - } - if ((err = mp_jacobi(&a, &b, &i)) != should) { - printf("Failed executing mp_jacobi(%d | %lu) %s.\n", n, jacobi[cnt].n, mp_error_to_string(err)); - return EXIT_FAILURE; - } - if (err == MP_OKAY && i != jacobi[cnt].c[n + 5]) { - printf("Failed trivial mp_jacobi(%d | %lu) %d != %d\n", n, jacobi[cnt].n, i, jacobi[cnt].c[n + 5]); - return EXIT_FAILURE; - } - } - } - - // test mp_get_int - printf("\n\nTesting: mp_get_int"); - for (i = 0; i < 1000; ++i) { - t = ((unsigned long) rand () * rand () + 1) & 0xFFFFFFFF; - mp_set_int (&a, t); - if (t != mp_get_int (&a)) { - printf ("\nmp_get_int() bad result!"); - return EXIT_FAILURE; - } - } - mp_set_int(&a, 0); - if (mp_get_int(&a) != 0) { - printf("\nmp_get_int() bad result!"); - return EXIT_FAILURE; - } - mp_set_int(&a, 0xffffffff); - if (mp_get_int(&a) != 0xffffffff) { - printf("\nmp_get_int() bad result!"); - return EXIT_FAILURE; - } - - printf("\n\nTesting: mp_get_long\n"); - for (i = 0; i < (int)(sizeof(unsigned long)*CHAR_BIT) - 1; ++i) { - t = (1ULL << (i+1)) - 1; - if (!t) - t = -1; - printf(" t = 0x%lx i = %d\r", t, i); - do { - if (mp_set_long(&a, t) != MP_OKAY) { - printf("\nmp_set_long() error!"); - return EXIT_FAILURE; - } - s = mp_get_long(&a); - if (s != t) { - printf("\nmp_get_long() bad result! 0x%lx != 0x%lx", s, t); - return EXIT_FAILURE; - } - t <<= 1; - } while(t); - } - - printf("\n\nTesting: mp_get_long_long\n"); - for (i = 0; i < (int)(sizeof(unsigned long long)*CHAR_BIT) - 1; ++i) { - r = (1ULL << (i+1)) - 1; - if (!r) - r = -1; - printf(" r = 0x%llx i = %d\r", r, i); - do { - if (mp_set_long_long(&a, r) != MP_OKAY) { - printf("\nmp_set_long_long() error!"); - return EXIT_FAILURE; - } - q = mp_get_long_long(&a); - if (q != r) { - printf("\nmp_get_long_long() bad result! 0x%llx != 0x%llx", q, r); - return EXIT_FAILURE; - } - r <<= 1; - } while(r); - } - - // test mp_sqrt - printf("\n\nTesting: mp_sqrt\n"); - for (i = 0; i < 1000; ++i) { - printf ("%6d\r", i); - fflush (stdout); - n = (rand () & 15) + 1; - mp_rand (&a, n); - if (mp_sqrt (&a, &b) != MP_OKAY) { - printf ("\nmp_sqrt() error!"); - return EXIT_FAILURE; - } - mp_n_root_ex (&a, 2, &c, 0); - mp_n_root_ex (&a, 2, &d, 1); - if (mp_cmp_mag (&c, &d) != MP_EQ) { - printf ("\nmp_n_root_ex() bad result!"); - return EXIT_FAILURE; - } - if (mp_cmp_mag (&b, &c) != MP_EQ) { - printf ("mp_sqrt() bad result!\n"); - return EXIT_FAILURE; - } - } - - printf("\n\nTesting: mp_is_square\n"); - for (i = 0; i < 1000; ++i) { - printf ("%6d\r", i); - fflush (stdout); - - /* test mp_is_square false negatives */ - n = (rand () & 7) + 1; - mp_rand (&a, n); - mp_sqr (&a, &a); - if (mp_is_square (&a, &n) != MP_OKAY) { - printf ("\nfn:mp_is_square() error!"); - return EXIT_FAILURE; - } - if (n == 0) { - printf ("\nfn:mp_is_square() bad result!"); - return EXIT_FAILURE; - } - - /* test for false positives */ - mp_add_d (&a, 1, &a); - if (mp_is_square (&a, &n) != MP_OKAY) { - printf ("\nfp:mp_is_square() error!"); - return EXIT_FAILURE; - } - if (n == 1) { - printf ("\nfp:mp_is_square() bad result!"); - return EXIT_FAILURE; - } - - } - printf("\n\n"); - - // r^2 = n (mod p) - for (i = 0; i < (int)(sizeof(sqrtmod_prime)/sizeof(sqrtmod_prime[0])); ++i) { - mp_set_int(&a, sqrtmod_prime[i].p); - mp_set_int(&b, sqrtmod_prime[i].n); - if (mp_sqrtmod_prime(&b, &a, &c) != MP_OKAY) { - printf("Failed executing %d. mp_sqrtmod_prime\n", (i+1)); - return EXIT_FAILURE; - } - if (mp_cmp_d(&c, sqrtmod_prime[i].r) != MP_EQ) { - printf("Failed %d. trivial mp_sqrtmod_prime\n", (i+1)); - ndraw(&c, "r"); - return EXIT_FAILURE; - } - } - - /* test for size */ - for (ix = 10; ix < 128; ix++) { - printf ("Testing (not safe-prime): %9d bits \r", ix); - fflush (stdout); - err = mp_prime_random_ex (&a, 8, ix, - (rand () & 1) ? 0 : LTM_PRIME_2MSB_ON, myrng, - NULL); - if (err != MP_OKAY) { - printf ("failed with err code %d\n", err); - return EXIT_FAILURE; - } - if (mp_count_bits (&a) != ix) { - printf ("Prime is %d not %d bits!!!\n", mp_count_bits (&a), ix); - return EXIT_FAILURE; - } - } - printf("\n"); - - for (ix = 16; ix < 128; ix++) { - printf ("Testing ( safe-prime): %9d bits \r", ix); - fflush (stdout); - err = mp_prime_random_ex ( - &a, 8, ix, ((rand () & 1) ? 0 : LTM_PRIME_2MSB_ON) | LTM_PRIME_SAFE, - myrng, NULL); - if (err != MP_OKAY) { - printf ("failed with err code %d\n", err); - return EXIT_FAILURE; - } - if (mp_count_bits (&a) != ix) { - printf ("Prime is %d not %d bits!!!\n", mp_count_bits (&a), ix); - return EXIT_FAILURE; - } - /* let's see if it's really a safe prime */ - mp_sub_d (&a, 1, &a); - mp_div_2 (&a, &a); - mp_prime_is_prime (&a, 8, &cnt); - if (cnt != MP_YES) { - printf ("sub is not prime!\n"); - return EXIT_FAILURE; - } - } - - printf("\n\n"); - - // test montgomery - printf("Testing: montgomery...\n"); - for (i = 1; i <= 10; i++) { - if (i == 10) - i = 1000; - printf(" digit size: %2d\r", i); - fflush(stdout); - for (n = 0; n < 1000; n++) { - mp_rand(&a, i); - a.dp[0] |= 1; - - // let's see if R is right - mp_montgomery_calc_normalization(&b, &a); - mp_montgomery_setup(&a, &mp); - - // now test a random reduction - for (ix = 0; ix < 100; ix++) { - mp_rand(&c, 1 + abs(rand()) % (2*i)); - mp_copy(&c, &d); - mp_copy(&c, &e); - - mp_mod(&d, &a, &d); - mp_montgomery_reduce(&c, &a, mp); - mp_mulmod(&c, &b, &a, &c); - - if (mp_cmp(&c, &d) != MP_EQ) { -printf("d = e mod a, c = e MOD a\n"); -mp_todecimal(&a, buf); printf("a = %s\n", buf); -mp_todecimal(&e, buf); printf("e = %s\n", buf); -mp_todecimal(&d, buf); printf("d = %s\n", buf); -mp_todecimal(&c, buf); printf("c = %s\n", buf); -printf("compare no compare!\n"); return EXIT_FAILURE; } - /* only one big montgomery reduction */ - if (i > 10) - { - n = 1000; - ix = 100; - } - } - } - } - - printf("\n\n"); - - mp_read_radix(&a, "123456", 10); - mp_toradix_n(&a, buf, 10, 3); - printf("a == %s\n", buf); - mp_toradix_n(&a, buf, 10, 4); - printf("a == %s\n", buf); - mp_toradix_n(&a, buf, 10, 30); - printf("a == %s\n", buf); - - -#if 0 - for (;;) { - fgets(buf, sizeof(buf), stdin); - mp_read_radix(&a, buf, 10); - mp_prime_next_prime(&a, 5, 1); - mp_toradix(&a, buf, 10); - printf("%s, %lu\n", buf, a.dp[0] & 3); - } -#endif - - /* test mp_cnt_lsb */ - printf("\n\nTesting: mp_cnt_lsb"); - mp_set(&a, 1); - for (ix = 0; ix < 1024; ix++) { - if (mp_cnt_lsb (&a) != ix) { - printf ("Failed at %d, %d\n", ix, mp_cnt_lsb (&a)); - return EXIT_FAILURE; - } - mp_mul_2 (&a, &a); - } - -/* test mp_reduce_2k */ - printf("\n\nTesting: mp_reduce_2k\n"); - for (cnt = 3; cnt <= 128; ++cnt) { - mp_digit tmp; - - mp_2expt (&a, cnt); - mp_sub_d (&a, 2, &a); /* a = 2**cnt - 2 */ - - printf ("\r %4d bits", cnt); - printf ("(%d)", mp_reduce_is_2k (&a)); - mp_reduce_2k_setup (&a, &tmp); - printf ("(%lu)", (unsigned long) tmp); - for (ix = 0; ix < 1000; ix++) { - if (!(ix & 127)) { - printf ("."); - fflush (stdout); - } - mp_rand (&b, (cnt / DIGIT_BIT + 1) * 2); - mp_copy (&c, &b); - mp_mod (&c, &a, &c); - mp_reduce_2k (&b, &a, 2); - if (mp_cmp (&c, &b)) { - printf ("FAILED\n"); - return EXIT_FAILURE; - } - } - } - -/* test mp_div_3 */ - printf("\n\nTesting: mp_div_3...\n"); - mp_set(&d, 3); - for (cnt = 0; cnt < 10000;) { - mp_digit r2; - - if (!(++cnt & 127)) - { - printf("%9d\r", cnt); - fflush(stdout); - } - mp_rand(&a, abs(rand()) % 128 + 1); - mp_div(&a, &d, &b, &e); - mp_div_3(&a, &c, &r2); - - if (mp_cmp(&b, &c) || mp_cmp_d(&e, r2)) { - printf("\nmp_div_3 => Failure\n"); - } - } - printf("\nPassed div_3 testing"); - -/* test the DR reduction */ - printf("\n\nTesting: mp_dr_reduce...\n"); - for (cnt = 2; cnt < 32; cnt++) { - printf ("\r%d digit modulus", cnt); - mp_grow (&a, cnt); - mp_zero (&a); - for (ix = 1; ix < cnt; ix++) { - a.dp[ix] = MP_MASK; - } - a.used = cnt; - a.dp[0] = 3; - - mp_rand (&b, cnt - 1); - mp_copy (&b, &c); - - rr = 0; - do { - if (!(rr & 127)) { - printf ("."); - fflush (stdout); - } - mp_sqr (&b, &b); - mp_add_d (&b, 1, &b); - mp_copy (&b, &c); - - mp_mod (&b, &a, &b); - mp_dr_setup(&a, &mp), - mp_dr_reduce (&c, &a, mp); - - if (mp_cmp (&b, &c) != MP_EQ) { - printf ("Failed on trial %u\n", rr); - return EXIT_FAILURE; - } - } while (++rr < 500); - printf (" passed"); - fflush (stdout); - } - -#if LTM_DEMO_TEST_REDUCE_2K_L -/* test the mp_reduce_2k_l code */ -#if LTM_DEMO_TEST_REDUCE_2K_L == 1 -/* first load P with 2^1024 - 0x2A434 B9FDEC95 D8F9D550 FFFFFFFF FFFFFFFF */ - mp_2expt(&a, 1024); - mp_read_radix(&b, "2A434B9FDEC95D8F9D550FFFFFFFFFFFFFFFF", 16); - mp_sub(&a, &b, &a); -#elif LTM_DEMO_TEST_REDUCE_2K_L == 2 -/* p = 2^2048 - 0x1 00000000 00000000 00000000 00000000 4945DDBF 8EA2A91D 5776399B B83E188F */ - mp_2expt(&a, 2048); - mp_read_radix(&b, - "1000000000000000000000000000000004945DDBF8EA2A91D5776399BB83E188F", - 16); - mp_sub(&a, &b, &a); -#else -#error oops -#endif - - mp_todecimal(&a, buf); - printf("\n\np==%s\n", buf); -/* now mp_reduce_is_2k_l() should return */ - if (mp_reduce_is_2k_l(&a) != 1) { - printf("mp_reduce_is_2k_l() return 0, should be 1\n"); - return EXIT_FAILURE; - } - mp_reduce_2k_setup_l(&a, &d); - /* now do a million square+1 to see if it varies */ - mp_rand(&b, 64); - mp_mod(&b, &a, &b); - mp_copy(&b, &c); - printf("Testing: mp_reduce_2k_l..."); - fflush(stdout); - for (cnt = 0; cnt < (int)(1UL << 20); cnt++) { - mp_sqr(&b, &b); - mp_add_d(&b, 1, &b); - mp_reduce_2k_l(&b, &a, &d); - mp_sqr(&c, &c); - mp_add_d(&c, 1, &c); - mp_mod(&c, &a, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("mp_reduce_2k_l() failed at step %d\n", cnt); - mp_tohex(&b, buf); - printf("b == %s\n", buf); - mp_tohex(&c, buf); - printf("c == %s\n", buf); - return EXIT_FAILURE; - } - } - printf("...Passed\n"); -#endif /* LTM_DEMO_TEST_REDUCE_2K_L */ - -#else - - div2_n = mul2_n = inv_n = expt_n = lcm_n = gcd_n = add_n = - sub_n = mul_n = div_n = sqr_n = mul2d_n = div2d_n = cnt = add_d_n = - sub_d_n = 0; - - /* force KARA and TOOM to enable despite cutoffs */ - KARATSUBA_SQR_CUTOFF = KARATSUBA_MUL_CUTOFF = 8; - TOOM_SQR_CUTOFF = TOOM_MUL_CUTOFF = 16; - - for (;;) { - /* randomly clear and re-init one variable, this has the affect of triming the alloc space */ - switch (abs(rand()) % 7) { - case 0: - mp_clear(&a); - mp_init(&a); - break; - case 1: - mp_clear(&b); - mp_init(&b); - break; - case 2: - mp_clear(&c); - mp_init(&c); - break; - case 3: - mp_clear(&d); - mp_init(&d); - break; - case 4: - mp_clear(&e); - mp_init(&e); - break; - case 5: - mp_clear(&f); - mp_init(&f); - break; - case 6: - break; /* don't clear any */ - } - - - printf - ("%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu ", - add_n, sub_n, mul_n, div_n, sqr_n, mul2d_n, div2d_n, gcd_n, lcm_n, - expt_n, inv_n, div2_n, mul2_n, add_d_n, sub_d_n); - ret=fgets(cmd, 4095, stdin); if(!ret){_panic(__LINE__);} - cmd[strlen(cmd) - 1] = 0; - printf("%-6s ]\r", cmd); - fflush(stdout); - if (!strcmp(cmd, "mul2d")) { - ++mul2d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &rr); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - - mp_mul_2d(&a, rr, &a); - a.sign = b.sign; - if (mp_cmp(&a, &b) != MP_EQ) { - printf("mul2d failed, rr == %d\n", rr); - draw(&a); - draw(&b); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "div2d")) { - ++div2d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &rr); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - - mp_div_2d(&a, rr, &a, &e); - a.sign = b.sign; - if (a.used == b.used && a.used == 0) { - a.sign = b.sign = MP_ZPOS; - } - if (mp_cmp(&a, &b) != MP_EQ) { - printf("div2d failed, rr == %d\n", rr); - draw(&a); - draw(&b); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "add")) { - ++add_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_add(&d, &b, &d); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("add %lu failure!\n", add_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - - /* test the sign/unsigned storage functions */ - - rr = mp_signed_bin_size(&c); - mp_to_signed_bin(&c, (unsigned char *) cmd); - memset(cmd + rr, rand() & 255, sizeof(cmd) - rr); - mp_read_signed_bin(&d, (unsigned char *) cmd, rr); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("mp_signed_bin failure!\n"); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - - - rr = mp_unsigned_bin_size(&c); - mp_to_unsigned_bin(&c, (unsigned char *) cmd); - memset(cmd + rr, rand() & 255, sizeof(cmd) - rr); - mp_read_unsigned_bin(&d, (unsigned char *) cmd, rr); - if (mp_cmp_mag(&c, &d) != MP_EQ) { - printf("mp_unsigned_bin failure!\n"); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - - } else if (!strcmp(cmd, "sub")) { - ++sub_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_sub(&d, &b, &d); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("sub %lu failure!\n", sub_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "mul")) { - ++mul_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_mul(&d, &b, &d); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("mul %lu failure!\n", mul_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "div")) { - ++div_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&d, buf, 64); - - mp_div(&a, &b, &e, &f); - if (mp_cmp(&c, &e) != MP_EQ || mp_cmp(&d, &f) != MP_EQ) { - printf("div %lu %d, %d, failure!\n", div_n, mp_cmp(&c, &e), - mp_cmp(&d, &f)); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - draw(&e); - draw(&f); - return EXIT_FAILURE; - } - - } else if (!strcmp(cmd, "sqr")) { - ++sqr_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_copy(&a, &c); - mp_sqr(&c, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("sqr %lu failure!\n", sqr_n); - draw(&a); - draw(&b); - draw(&c); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "gcd")) { - ++gcd_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_gcd(&d, &b, &d); - d.sign = c.sign; - if (mp_cmp(&c, &d) != MP_EQ) { - printf("gcd %lu failure!\n", gcd_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "lcm")) { - ++lcm_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_lcm(&d, &b, &d); - d.sign = c.sign; - if (mp_cmp(&c, &d) != MP_EQ) { - printf("lcm %lu failure!\n", lcm_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "expt")) { - ++expt_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&d, buf, 64); - mp_copy(&a, &e); - mp_exptmod(&e, &b, &c, &e); - if (mp_cmp(&d, &e) != MP_EQ) { - printf("expt %lu failure!\n", expt_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - draw(&e); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "invmod")) { - ++inv_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_invmod(&a, &b, &d); - mp_mulmod(&d, &a, &b, &e); - if (mp_cmp_d(&e, 1) != MP_EQ) { - printf("inv [wrong value from MPI?!] failure\n"); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - draw(&e); - mp_gcd(&a, &b, &e); - draw(&e); - return EXIT_FAILURE; - } - - } else if (!strcmp(cmd, "div2")) { - ++div2_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_div_2(&a, &c); - if (mp_cmp(&c, &b) != MP_EQ) { - printf("div_2 %lu failure\n", div2_n); - draw(&a); - draw(&b); - draw(&c); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "mul2")) { - ++mul2_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_mul_2(&a, &c); - if (mp_cmp(&c, &b) != MP_EQ) { - printf("mul_2 %lu failure\n", mul2_n); - draw(&a); - draw(&b); - draw(&c); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "add_d")) { - ++add_d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &ix); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_add_d(&a, ix, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("add_d %lu failure\n", add_d_n); - draw(&a); - draw(&b); - draw(&c); - printf("d == %d\n", ix); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "sub_d")) { - ++sub_d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &ix); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_sub_d(&a, ix, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("sub_d %lu failure\n", sub_d_n); - draw(&a); - draw(&b); - draw(&c); - printf("d == %d\n", ix); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "exit")) { - printf("\nokay, exiting now\n"); - break; - } - } -#endif - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/demo/timing.c b/libtommath/demo/timing.c deleted file mode 100644 index 1bd8489..0000000 --- a/libtommath/demo/timing.c +++ /dev/null @@ -1,339 +0,0 @@ -#include -#include -#include - -ulong64 _tt; - -#ifdef IOWNANATHLON -#include -#define SLEEP sleep(4) -#else -#define SLEEP -#endif - -#ifdef LTM_TIMING_REAL_RAND -#define LTM_TIMING_RAND_SEED time(NULL) -#else -#define LTM_TIMING_RAND_SEED 23 -#endif - - -void ndraw(mp_int * a, char *name) -{ - char buf[4096]; - - printf("%s: ", name); - mp_toradix(a, buf, 64); - printf("%s\n", buf); -} - -static void draw(mp_int * a) -{ - ndraw(a, ""); -} - - -unsigned long lfsr = 0xAAAAAAAAUL; - -int lbit(void) -{ - if (lfsr & 0x80000000UL) { - lfsr = ((lfsr << 1) ^ 0x8000001BUL) & 0xFFFFFFFFUL; - return 1; - } else { - lfsr <<= 1; - return 0; - } -} - -/* RDTSC from Scott Duplichan */ -static ulong64 TIMFUNC(void) -{ -#if defined __GNUC__ -#if defined(__i386__) || defined(__x86_64__) - /* version from http://www.mcs.anl.gov/~kazutomo/rdtsc.html - * the old code always got a warning issued by gcc, clang did not complain... - */ - unsigned hi, lo; - __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); - return ((ulong64)lo)|( ((ulong64)hi)<<32); -#else /* gcc-IA64 version */ - unsigned long result; - __asm__ __volatile__("mov %0=ar.itc":"=r"(result)::"memory"); - - while (__builtin_expect((int) result == -1, 0)) - __asm__ __volatile__("mov %0=ar.itc":"=r"(result)::"memory"); - - return result; -#endif - - // Microsoft and Intel Windows compilers -#elif defined _M_IX86 - __asm rdtsc -#elif defined _M_AMD64 - return __rdtsc(); -#elif defined _M_IA64 -#if defined __INTEL_COMPILER -#include -#endif - return __getReg(3116); -#else -#error need rdtsc function for this build -#endif -} - -#define DO(x) x; x; -//#define DO4(x) DO2(x); DO2(x); -//#define DO8(x) DO4(x); DO4(x); -//#define DO(x) DO8(x); DO8(x); - -#ifdef TIMING_NO_LOGS -#define FOPEN(a, b) NULL -#define FPRINTF(a,b,c,d) -#define FFLUSH(a) -#define FCLOSE(a) (void)(a) -#else -#define FOPEN(a,b) fopen(a,b) -#define FPRINTF(a,b,c,d) fprintf(a,b,c,d) -#define FFLUSH(a) fflush(a) -#define FCLOSE(a) fclose(a) -#endif - -int main(void) -{ - ulong64 tt, gg, CLK_PER_SEC; - FILE *log, *logb, *logc, *logd; - mp_int a, b, c, d, e, f; - int n, cnt, ix, old_kara_m, old_kara_s, old_toom_m, old_toom_s; - unsigned rr; - - mp_init(&a); - mp_init(&b); - mp_init(&c); - mp_init(&d); - mp_init(&e); - mp_init(&f); - - srand(LTM_TIMING_RAND_SEED); - - - CLK_PER_SEC = TIMFUNC(); - sleep(1); - CLK_PER_SEC = TIMFUNC() - CLK_PER_SEC; - - printf("CLK_PER_SEC == %llu\n", CLK_PER_SEC); - log = FOPEN("logs/add.log", "w"); - for (cnt = 8; cnt <= 128; cnt += 8) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_add(&a, &b, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100000); - printf("Adding\t\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", cnt * DIGIT_BIT, tt); - FFLUSH(log); - } - FCLOSE(log); - - log = FOPEN("logs/sub.log", "w"); - for (cnt = 8; cnt <= 128; cnt += 8) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_sub(&a, &b, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100000); - - printf("Subtracting\t\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", cnt * DIGIT_BIT, tt); - FFLUSH(log); - } - FCLOSE(log); - - /* do mult/square twice, first without karatsuba and second with */ - old_kara_m = KARATSUBA_MUL_CUTOFF; - old_kara_s = KARATSUBA_SQR_CUTOFF; - /* currently toom-cook cut-off is too high to kick in, so we just use the karatsuba values */ - old_toom_m = old_kara_m; - old_toom_s = old_kara_m; - for (ix = 0; ix < 3; ix++) { - printf("With%s Karatsuba, With%s Toom\n", (ix == 0) ? "out" : "", (ix == 1) ? "out" : ""); - - KARATSUBA_MUL_CUTOFF = (ix == 1) ? old_kara_m : 9999; - KARATSUBA_SQR_CUTOFF = (ix == 1) ? old_kara_s : 9999; - TOOM_MUL_CUTOFF = (ix == 2) ? old_toom_m : 9999; - TOOM_SQR_CUTOFF = (ix == 2) ? old_toom_s : 9999; - - log = FOPEN((ix == 0) ? "logs/mult.log" : (ix == 1) ? "logs/mult_kara.log" : "logs/mult_toom.log", "w"); - for (cnt = 4; cnt <= 10240 / DIGIT_BIT; cnt += 2) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_mul(&a, &b, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100); - printf("Multiplying\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", mp_count_bits(&a), tt); - FFLUSH(log); - } - FCLOSE(log); - - log = FOPEN((ix == 0) ? "logs/sqr.log" : (ix == 1) ? "logs/sqr_kara.log" : "logs/sqr_toom.log", "w"); - for (cnt = 4; cnt <= 10240 / DIGIT_BIT; cnt += 2) { - SLEEP; - mp_rand(&a, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_sqr(&a, &b)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100); - printf("Squaring\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", mp_count_bits(&a), tt); - FFLUSH(log); - } - FCLOSE(log); - - } - - { - char *primes[] = { - /* 2K large moduli */ - "179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586239334100047359817950870678242457666208137217", - "32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638099733077152121140120031150424541696791951097529546801429027668869927491725169", - "1044388881413152506691752710716624382579964249047383780384233483283953907971557456848826811934997558340890106714439262837987573438185793607263236087851365277945956976543709998340361590134383718314428070011855946226376318839397712745672334684344586617496807908705803704071284048740118609114467977783598029006686938976881787785946905630190260940599579453432823469303026696443059025015972399867714215541693835559885291486318237914434496734087811872639496475100189041349008417061675093668333850551032972088269550769983616369411933015213796825837188091833656751221318492846368125550225998300412344784862595674492194617023806505913245610825731835380087608622102834270197698202313169017678006675195485079921636419370285375124784014907159135459982790513399611551794271106831134090584272884279791554849782954323534517065223269061394905987693002122963395687782878948440616007412945674919823050571642377154816321380631045902916136926708342856440730447899971901781465763473223850267253059899795996090799469201774624817718449867455659250178329070473119433165550807568221846571746373296884912819520317457002440926616910874148385078411929804522981857338977648103126085902995208257421855249796721729039744118165938433694823325696642096892124547425283", - /* 2K moduli mersenne primes */ - "6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151", - "531137992816767098689588206552468627329593117727031923199444138200403559860852242739162502265229285668889329486246501015346579337652707239409519978766587351943831270835393219031728127", - "10407932194664399081925240327364085538615262247266704805319112350403608059673360298012239441732324184842421613954281007791383566248323464908139906605677320762924129509389220345773183349661583550472959420547689811211693677147548478866962501384438260291732348885311160828538416585028255604666224831890918801847068222203140521026698435488732958028878050869736186900714720710555703168729087", - "1475979915214180235084898622737381736312066145333169775147771216478570297878078949377407337049389289382748507531496480477281264838760259191814463365330269540496961201113430156902396093989090226259326935025281409614983499388222831448598601834318536230923772641390209490231836446899608210795482963763094236630945410832793769905399982457186322944729636418890623372171723742105636440368218459649632948538696905872650486914434637457507280441823676813517852099348660847172579408422316678097670224011990280170474894487426924742108823536808485072502240519452587542875349976558572670229633962575212637477897785501552646522609988869914013540483809865681250419497686697771007", - "259117086013202627776246767922441530941818887553125427303974923161874019266586362086201209516800483406550695241733194177441689509238807017410377709597512042313066624082916353517952311186154862265604547691127595848775610568757931191017711408826252153849035830401185072116424747461823031471398340229288074545677907941037288235820705892351068433882986888616658650280927692080339605869308790500409503709875902119018371991620994002568935113136548829739112656797303241986517250116412703509705427773477972349821676443446668383119322540099648994051790241624056519054483690809616061625743042361721863339415852426431208737266591962061753535748892894599629195183082621860853400937932839420261866586142503251450773096274235376822938649407127700846077124211823080804139298087057504713825264571448379371125032081826126566649084251699453951887789613650248405739378594599444335231188280123660406262468609212150349937584782292237144339628858485938215738821232393687046160677362909315071", - "190797007524439073807468042969529173669356994749940177394741882673528979787005053706368049835514900244303495954950709725762186311224148828811920216904542206960744666169364221195289538436845390250168663932838805192055137154390912666527533007309292687539092257043362517857366624699975402375462954490293259233303137330643531556539739921926201438606439020075174723029056838272505051571967594608350063404495977660656269020823960825567012344189908927956646011998057988548630107637380993519826582389781888135705408653045219655801758081251164080554609057468028203308718724654081055323215860189611391296030471108443146745671967766308925858547271507311563765171008318248647110097614890313562856541784154881743146033909602737947385055355960331855614540900081456378659068370317267696980001187750995491090350108417050917991562167972281070161305972518044872048331306383715094854938415738549894606070722584737978176686422134354526989443028353644037187375385397838259511833166416134323695660367676897722287918773420968982326089026150031515424165462111337527431154890666327374921446276833564519776797633875503548665093914556482031482248883127023777039667707976559857333357013727342079099064400455741830654320379350833236245819348824064783585692924881021978332974949906122664421376034687815350484991", - - /* DR moduli */ - "14059105607947488696282932836518693308967803494693489478439861164411992439598399594747002144074658928593502845729752797260025831423419686528151609940203368612079", - "101745825697019260773923519755878567461315282017759829107608914364075275235254395622580447400994175578963163918967182013639660669771108475957692810857098847138903161308502419410142185759152435680068435915159402496058513611411688900243039", - "736335108039604595805923406147184530889923370574768772191969612422073040099331944991573923112581267542507986451953227192970402893063850485730703075899286013451337291468249027691733891486704001513279827771740183629161065194874727962517148100775228363421083691764065477590823919364012917984605619526140821797602431", - "38564998830736521417281865696453025806593491967131023221754800625044118265468851210705360385717536794615180260494208076605798671660719333199513807806252394423283413430106003596332513246682903994829528690198205120921557533726473585751382193953592127439965050261476810842071573684505878854588706623484573925925903505747545471088867712185004135201289273405614415899438276535626346098904241020877974002916168099951885406379295536200413493190419727789712076165162175783", - "542189391331696172661670440619180536749994166415993334151601745392193484590296600979602378676624808129613777993466242203025054573692562689251250471628358318743978285860720148446448885701001277560572526947619392551574490839286458454994488665744991822837769918095117129546414124448777033941223565831420390846864429504774477949153794689948747680362212954278693335653935890352619041936727463717926744868338358149568368643403037768649616778526013610493696186055899318268339432671541328195724261329606699831016666359440874843103020666106568222401047720269951530296879490444224546654729111504346660859907296364097126834834235287147", - "1487259134814709264092032648525971038895865645148901180585340454985524155135260217788758027400478312256339496385275012465661575576202252063145698732079880294664220579764848767704076761853197216563262660046602703973050798218246170835962005598561669706844469447435461092542265792444947706769615695252256130901271870341005768912974433684521436211263358097522726462083917939091760026658925757076733484173202927141441492573799914240222628795405623953109131594523623353044898339481494120112723445689647986475279242446083151413667587008191682564376412347964146113898565886683139407005941383669325997475076910488086663256335689181157957571445067490187939553165903773554290260531009121879044170766615232300936675369451260747671432073394867530820527479172464106442450727640226503746586340279816318821395210726268291535648506190714616083163403189943334431056876038286530365757187367147446004855912033137386225053275419626102417236133948503", - "1095121115716677802856811290392395128588168592409109494900178008967955253005183831872715423151551999734857184538199864469605657805519106717529655044054833197687459782636297255219742994736751541815269727940751860670268774903340296040006114013971309257028332849679096824800250742691718610670812374272414086863715763724622797509437062518082383056050144624962776302147890521249477060215148275163688301275847155316042279405557632639366066847442861422164832655874655824221577849928863023018366835675399949740429332468186340518172487073360822220449055340582568461568645259954873303616953776393853174845132081121976327462740354930744487429617202585015510744298530101547706821590188733515880733527449780963163909830077616357506845523215289297624086914545378511082534229620116563260168494523906566709418166011112754529766183554579321224940951177394088465596712620076240067370589036924024728375076210477267488679008016579588696191194060127319035195370137160936882402244399699172017835144537488486396906144217720028992863941288217185353914991583400421682751000603596655790990815525126154394344641336397793791497068253936771017031980867706707490224041075826337383538651825493679503771934836094655802776331664261631740148281763487765852746577808019633679", - - /* generic unrestricted moduli */ - "17933601194860113372237070562165128350027320072176844226673287945873370751245439587792371960615073855669274087805055507977323024886880985062002853331424203", - "2893527720709661239493896562339544088620375736490408468011883030469939904368086092336458298221245707898933583190713188177399401852627749210994595974791782790253946539043962213027074922559572312141181787434278708783207966459019479487", - "347743159439876626079252796797422223177535447388206607607181663903045907591201940478223621722118173270898487582987137708656414344685816179420855160986340457973820182883508387588163122354089264395604796675278966117567294812714812796820596564876450716066283126720010859041484786529056457896367683122960411136319", - "47266428956356393164697365098120418976400602706072312735924071745438532218237979333351774907308168340693326687317443721193266215155735814510792148768576498491199122744351399489453533553203833318691678263241941706256996197460424029012419012634671862283532342656309677173602509498417976091509154360039893165037637034737020327399910409885798185771003505320583967737293415979917317338985837385734747478364242020380416892056650841470869294527543597349250299539682430605173321029026555546832473048600327036845781970289288898317888427517364945316709081173840186150794397479045034008257793436817683392375274635794835245695887", - "436463808505957768574894870394349739623346440601945961161254440072143298152040105676491048248110146278752857839930515766167441407021501229924721335644557342265864606569000117714935185566842453630868849121480179691838399545644365571106757731317371758557990781880691336695584799313313687287468894148823761785582982549586183756806449017542622267874275103877481475534991201849912222670102069951687572917937634467778042874315463238062009202992087620963771759666448266532858079402669920025224220613419441069718482837399612644978839925207109870840278194042158748845445131729137117098529028886770063736487420613144045836803985635654192482395882603511950547826439092832800532152534003936926017612446606135655146445620623395788978726744728503058670046885876251527122350275750995227", - "11424167473351836398078306042624362277956429440521137061889702611766348760692206243140413411077394583180726863277012016602279290144126785129569474909173584789822341986742719230331946072730319555984484911716797058875905400999504305877245849119687509023232790273637466821052576859232452982061831009770786031785669030271542286603956118755585683996118896215213488875253101894663403069677745948305893849505434201763745232895780711972432011344857521691017896316861403206449421332243658855453435784006517202894181640562433575390821384210960117518650374602256601091379644034244332285065935413233557998331562749140202965844219336298970011513882564935538704289446968322281451907487362046511461221329799897350993370560697505809686438782036235372137015731304779072430260986460269894522159103008260495503005267165927542949439526272736586626709581721032189532726389643625590680105784844246152702670169304203783072275089194754889511973916207", - "1214855636816562637502584060163403830270705000634713483015101384881871978446801224798536155406895823305035467591632531067547890948695117172076954220727075688048751022421198712032848890056357845974246560748347918630050853933697792254955890439720297560693579400297062396904306270145886830719309296352765295712183040773146419022875165382778007040109957609739589875590885701126197906063620133954893216612678838507540777138437797705602453719559017633986486649523611975865005712371194067612263330335590526176087004421363598470302731349138773205901447704682181517904064735636518462452242791676541725292378925568296858010151852326316777511935037531017413910506921922450666933202278489024521263798482237150056835746454842662048692127173834433089016107854491097456725016327709663199738238442164843147132789153725513257167915555162094970853584447993125488607696008169807374736711297007473812256272245489405898470297178738029484459690836250560495461579533254473316340608217876781986188705928270735695752830825527963838355419762516246028680280988020401914551825487349990306976304093109384451438813251211051597392127491464898797406789175453067960072008590614886532333015881171367104445044718144312416815712216611576221546455968770801413440778423979", - NULL - }; - log = FOPEN("logs/expt.log", "w"); - logb = FOPEN("logs/expt_dr.log", "w"); - logc = FOPEN("logs/expt_2k.log", "w"); - logd = FOPEN("logs/expt_2kl.log", "w"); - for (n = 0; primes[n]; n++) { - SLEEP; - mp_read_radix(&a, primes[n], 10); - mp_zero(&b); - for (rr = 0; rr < (unsigned) mp_count_bits(&a); rr++) { - mp_mul_2(&b, &b); - b.dp[0] |= lbit(); - b.used += 1; - } - mp_sub_d(&a, 1, &c); - mp_mod(&b, &c, &b); - mp_set(&c, 3); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_exptmod(&c, &b, &a, &d)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 10); - mp_sub_d(&a, 1, &e); - mp_sub(&e, &b, &b); - mp_exptmod(&c, &b, &a, &e); /* c^(p-1-b) mod a */ - mp_mulmod(&e, &d, &a, &d); /* c^b * c^(p-1-b) == c^p-1 == 1 */ - if (mp_cmp_d(&d, 1)) { - printf("Different (%d)!!!\n", mp_count_bits(&a)); - draw(&d); - exit(0); - } - printf("Exponentiating\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(n < 4 ? logd : (n < 9) ? logc : (n < 16) ? logb : log, - "%d %9llu\n", mp_count_bits(&a), tt); - } - } - FCLOSE(log); - FCLOSE(logb); - FCLOSE(logc); - FCLOSE(logd); - - log = FOPEN("logs/invmod.log", "w"); - for (cnt = 4; cnt <= 32; cnt += 4) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - - do { - mp_add_d(&b, 1, &b); - mp_gcd(&a, &b, &c); - } while (mp_cmp_d(&c, 1) != MP_EQ); - - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_invmod(&b, &a, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 1000); - mp_mulmod(&b, &c, &a, &d); - if (mp_cmp_d(&d, 1) != MP_EQ) { - printf("Failed to invert\n"); - return 0; - } - printf("Inverting mod\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", cnt * DIGIT_BIT, tt); - } - FCLOSE(log); - - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/dep.pl b/libtommath/dep.pl deleted file mode 100644 index 0a5d19a..0000000 --- a/libtommath/dep.pl +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/perl -# -# Walk through source, add labels and make classes -# -#use strict; - -my %deplist; - -#open class file and write preamble -open(CLASS, ">tommath_class.h") or die "Couldn't open tommath_class.h for writing\n"; -print CLASS "#if !(defined(LTM1) && defined(LTM2) && defined(LTM3))\n#if defined(LTM2)\n#define LTM3\n#endif\n#if defined(LTM1)\n#define LTM2\n#endif\n#define LTM1\n\n#if defined(LTM_ALL)\n"; - -foreach my $filename (glob "bn*.c") { - my $define = $filename; - -print "Processing $filename\n"; - - # convert filename to upper case so we can use it as a define - $define =~ tr/[a-z]/[A-Z]/; - $define =~ tr/\./_/; - print CLASS "#define $define\n"; - - # now copy text and apply #ifdef as required - my $apply = 0; - open(SRC, "<$filename"); - open(OUT, ">tmp"); - - # first line will be the #ifdef - my $line = ; - if ($line =~ /include/) { - print OUT $line; - } else { - print OUT "#include \n#ifdef $define\n$line"; - $apply = 1; - } - while () { - if (!($_ =~ /tommath\.h/)) { - print OUT $_; - } - } - if ($apply == 1) { - print OUT "#endif\n"; - } - close SRC; - close OUT; - - unlink($filename); - rename("tmp", $filename); -} -print CLASS "#endif\n\n"; - -# now do classes - -foreach my $filename (glob "bn*.c") { - open(SRC, "<$filename") or die "Can't open source file!\n"; - - # convert filename to upper case so we can use it as a define - $filename =~ tr/[a-z]/[A-Z]/; - $filename =~ tr/\./_/; - - print CLASS "#if defined($filename)\n"; - my $list = $filename; - - # scan for mp_* and make classes - while () { - my $line = $_; - while ($line =~ m/(fast_)*(s_)*mp\_[a-z_0-9]*/) { - $line = $'; - # now $& is the match, we want to skip over LTM keywords like - # mp_int, mp_word, mp_digit - if (!($& eq "mp_digit") && !($& eq "mp_word") && !($& eq "mp_int") && !($& eq "mp_min_u32")) { - my $a = $&; - $a =~ tr/[a-z]/[A-Z]/; - $a = "BN_" . $a . "_C"; - if (!($list =~ /$a/)) { - print CLASS " #define $a\n"; - } - $list = $list . "," . $a; - } - } - } - @deplist{$filename} = $list; - - print CLASS "#endif\n\n"; - close SRC; -} - -print CLASS "#ifdef LTM3\n#define LTM_LAST\n#endif\n#include \n#include \n#else\n#define LTM_LAST\n#endif\n"; -close CLASS; - -#now let's make a cool call graph... - -open(OUT,">callgraph.txt"); -$indent = 0; -foreach (keys %deplist) { - $list = ""; - draw_func(@deplist{$_}); - print OUT "\n\n"; -} -close(OUT); - -sub draw_func() -{ - my @funcs = split(",", $_[0]); - if ($list =~ /@funcs[0]/) { - return; - } else { - $list = $list . @funcs[0]; - } - if ($indent == 0) { } - elsif ($indent >= 1) { print OUT "| " x ($indent - 1) . "+--->"; } - print OUT @funcs[0] . "\n"; - shift @funcs; - my $temp = $list; - foreach my $i (@funcs) { - ++$indent; - draw_func(@deplist{$i}); - --$indent; - } - $list = $temp; -} - - diff --git a/libtommath/etc/2kprime.1 b/libtommath/etc/2kprime.1 deleted file mode 100644 index c41ded1..0000000 --- a/libtommath/etc/2kprime.1 +++ /dev/null @@ -1,2 +0,0 @@ -256-bits (k = 36113) = 115792089237316195423570985008687907853269984665640564039457584007913129603823 -512-bits (k = 38117) = 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006045979 diff --git a/libtommath/etc/2kprime.c b/libtommath/etc/2kprime.c deleted file mode 100644 index 9450283..0000000 --- a/libtommath/etc/2kprime.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Makes safe primes of a 2k nature */ -#include -#include - -int sizes[] = {256, 512, 768, 1024, 1536, 2048, 3072, 4096}; - -int main(void) -{ - char buf[2000]; - int x, y; - mp_int q, p; - FILE *out; - clock_t t1; - mp_digit z; - - mp_init_multi(&q, &p, NULL); - - out = fopen("2kprime.1", "w"); - for (x = 0; x < (int)(sizeof(sizes) / sizeof(sizes[0])); x++) { - top: - mp_2expt(&q, sizes[x]); - mp_add_d(&q, 3, &q); - z = -3; - - t1 = clock(); - for(;;) { - mp_sub_d(&q, 4, &q); - z += 4; - - if (z > MP_MASK) { - printf("No primes of size %d found\n", sizes[x]); - break; - } - - if (clock() - t1 > CLOCKS_PER_SEC) { - printf("."); fflush(stdout); -// sleep((clock() - t1 + CLOCKS_PER_SEC/2)/CLOCKS_PER_SEC); - t1 = clock(); - } - - /* quick test on q */ - mp_prime_is_prime(&q, 1, &y); - if (y == 0) { - continue; - } - - /* find (q-1)/2 */ - mp_sub_d(&q, 1, &p); - mp_div_2(&p, &p); - mp_prime_is_prime(&p, 3, &y); - if (y == 0) { - continue; - } - - /* test on q */ - mp_prime_is_prime(&q, 3, &y); - if (y == 0) { - continue; - } - - break; - } - - if (y == 0) { - ++sizes[x]; - goto top; - } - - mp_toradix(&q, buf, 10); - printf("\n\n%d-bits (k = %lu) = %s\n", sizes[x], z, buf); - fprintf(out, "%d-bits (k = %lu) = %s\n", sizes[x], z, buf); fflush(out); - } - - return 0; -} - - - - - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/drprime.c b/libtommath/etc/drprime.c deleted file mode 100644 index c7d253f..0000000 --- a/libtommath/etc/drprime.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Makes safe primes of a DR nature */ -#include - -int sizes[] = { 1+256/DIGIT_BIT, 1+512/DIGIT_BIT, 1+768/DIGIT_BIT, 1+1024/DIGIT_BIT, 1+2048/DIGIT_BIT, 1+4096/DIGIT_BIT }; -int main(void) -{ - int res, x, y; - char buf[4096]; - FILE *out; - mp_int a, b; - - mp_init(&a); - mp_init(&b); - - out = fopen("drprimes.txt", "w"); - for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) { - top: - printf("Seeking a %d-bit safe prime\n", sizes[x] * DIGIT_BIT); - mp_grow(&a, sizes[x]); - mp_zero(&a); - for (y = 1; y < sizes[x]; y++) { - a.dp[y] = MP_MASK; - } - - /* make a DR modulus */ - a.dp[0] = -1; - a.used = sizes[x]; - - /* now loop */ - res = 0; - for (;;) { - a.dp[0] += 4; - if (a.dp[0] >= MP_MASK) break; - mp_prime_is_prime(&a, 1, &res); - if (res == 0) continue; - printf("."); fflush(stdout); - mp_sub_d(&a, 1, &b); - mp_div_2(&b, &b); - mp_prime_is_prime(&b, 3, &res); - if (res == 0) continue; - mp_prime_is_prime(&a, 3, &res); - if (res == 1) break; - } - - if (res != 1) { - printf("Error not DR modulus\n"); sizes[x] += 1; goto top; - } else { - mp_toradix(&a, buf, 10); - printf("\n\np == %s\n\n", buf); - fprintf(out, "%d-bit prime:\np == %s\n\n", mp_count_bits(&a), buf); fflush(out); - } - } - fclose(out); - - mp_clear(&a); - mp_clear(&b); - - return 0; -} - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/drprimes.28 b/libtommath/etc/drprimes.28 deleted file mode 100644 index 9d438ad..0000000 --- a/libtommath/etc/drprimes.28 +++ /dev/null @@ -1,25 +0,0 @@ -DR safe primes for 28-bit digits. - -224-bit prime: -p == 26959946667150639794667015087019630673637144422540572481103341844143 - -532-bit prime: -p == 14059105607947488696282932836518693308967803494693489478439861164411992439598399594747002144074658928593502845729752797260025831423419686528151609940203368691747 - -784-bit prime: -p == 101745825697019260773923519755878567461315282017759829107608914364075275235254395622580447400994175578963163918967182013639660669771108475957692810857098847138903161308502419410142185759152435680068435915159402496058513611411688900243039 - -1036-bit prime: -p == 736335108039604595805923406147184530889923370574768772191969612422073040099331944991573923112581267542507986451953227192970402893063850485730703075899286013451337291468249027691733891486704001513279827771740183629161065194874727962517148100775228363421083691764065477590823919364012917984605619526140821798437127 - -1540-bit prime: -p == 38564998830736521417281865696453025806593491967131023221754800625044118265468851210705360385717536794615180260494208076605798671660719333199513807806252394423283413430106003596332513246682903994829528690198205120921557533726473585751382193953592127439965050261476810842071573684505878854588706623484573925925903505747545471088867712185004135201289273405614415899438276535626346098904241020877974002916168099951885406379295536200413493190419727789712076165162175783 - -2072-bit prime: -p == 542189391331696172661670440619180536749994166415993334151601745392193484590296600979602378676624808129613777993466242203025054573692562689251250471628358318743978285860720148446448885701001277560572526947619392551574490839286458454994488665744991822837769918095117129546414124448777033941223565831420390846864429504774477949153794689948747680362212954278693335653935890352619041936727463717926744868338358149568368643403037768649616778526013610493696186055899318268339432671541328195724261329606699831016666359440874843103020666106568222401047720269951530296879490444224546654729111504346660859907296364097126834834235287147 - -3080-bit prime: -p == 1487259134814709264092032648525971038895865645148901180585340454985524155135260217788758027400478312256339496385275012465661575576202252063145698732079880294664220579764848767704076761853197216563262660046602703973050798218246170835962005598561669706844469447435461092542265792444947706769615695252256130901271870341005768912974433684521436211263358097522726462083917939091760026658925757076733484173202927141441492573799914240222628795405623953109131594523623353044898339481494120112723445689647986475279242446083151413667587008191682564376412347964146113898565886683139407005941383669325997475076910488086663256335689181157957571445067490187939553165903773554290260531009121879044170766615232300936675369451260747671432073394867530820527479172464106442450727640226503746586340279816318821395210726268291535648506190714616083163403189943334431056876038286530365757187367147446004855912033137386225053275419626102417236133948503 - -4116-bit prime: -p == 1095121115716677802856811290392395128588168592409109494900178008967955253005183831872715423151551999734857184538199864469605657805519106717529655044054833197687459782636297255219742994736751541815269727940751860670268774903340296040006114013971309257028332849679096824800250742691718610670812374272414086863715763724622797509437062518082383056050144624962776302147890521249477060215148275163688301275847155316042279405557632639366066847442861422164832655874655824221577849928863023018366835675399949740429332468186340518172487073360822220449055340582568461568645259954873303616953776393853174845132081121976327462740354930744487429617202585015510744298530101547706821590188733515880733527449780963163909830077616357506845523215289297624086914545378511082534229620116563260168494523906566709418166011112754529766183554579321224940951177394088465596712620076240067370589036924024728375076210477267488679008016579588696191194060127319035195370137160936882402244399699172017835144537488486396906144217720028992863941288217185353914991583400421682751000603596655790990815525126154394344641336397793791497068253936771017031980867706707490224041075826337383538651825493679503771934836094655802776331664261631740148281763487765852746577808019633679 diff --git a/libtommath/etc/drprimes.txt b/libtommath/etc/drprimes.txt deleted file mode 100644 index 7c97f67..0000000 --- a/libtommath/etc/drprimes.txt +++ /dev/null @@ -1,9 +0,0 @@ -300-bit prime: -p == 2037035976334486086268445688409378161051468393665936250636140449354381298610415201576637819 - -540-bit prime: -p == 3599131035634557106248430806148785487095757694641533306480604458089470064537190296255232548883112685719936728506816716098566612844395439751206810991770626477344739 - -780-bit prime: -p == 6359114106063703798370219984742410466332205126109989319225557147754704702203399726411277962562135973685197744935448875852478791860694279747355800678568677946181447581781401213133886609947027230004277244697462656003655947791725966271167 - diff --git a/libtommath/etc/makefile b/libtommath/etc/makefile deleted file mode 100644 index 99154d8..0000000 --- a/libtommath/etc/makefile +++ /dev/null @@ -1,50 +0,0 @@ -CFLAGS += -Wall -W -Wshadow -O3 -fomit-frame-pointer -funroll-loops -I../ - -# default lib name (requires install with root) -# LIBNAME=-ltommath - -# libname when you can't install the lib with install -LIBNAME=../libtommath.a - -#provable primes -pprime: pprime.o - $(CC) pprime.o $(LIBNAME) -o pprime - -# portable [well requires clock()] tuning app -tune: tune.o - $(CC) tune.o $(LIBNAME) -o tune - -# same app but using RDTSC for higher precision [requires 80586+], coff based gcc installs [e.g. ming, cygwin, djgpp] -tune86: tune.c - nasm -f coff timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -# for cygwin -tune86c: tune.c - nasm -f gnuwin32 timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -#make tune86 for linux or any ELF format -tune86l: tune.c - nasm -f elf -DUSE_ELF timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86l - -# spits out mersenne primes -mersenne: mersenne.o - $(CC) mersenne.o $(LIBNAME) -o mersenne - -# fines DR safe primes for the given config -drprime: drprime.o - $(CC) drprime.o $(LIBNAME) -o drprime - -# fines 2k safe primes for the given config -2kprime: 2kprime.o - $(CC) 2kprime.o $(LIBNAME) -o 2kprime - -mont: mont.o - $(CC) mont.o $(LIBNAME) -o mont - - -clean: - rm -f *.log *.o *.obj *.exe pprime tune mersenne drprime tune86 tune86l mont 2kprime pprime.dat \ - *.da *.dyn *.dpi *~ diff --git a/libtommath/etc/makefile.icc b/libtommath/etc/makefile.icc deleted file mode 100644 index 8a1ffff..0000000 --- a/libtommath/etc/makefile.icc +++ /dev/null @@ -1,67 +0,0 @@ -CC = icc - -CFLAGS += -I../ - -# optimize for SPEED -# -# -mcpu= can be pentium, pentiumpro (covers PII through PIII) or pentium4 -# -ax? specifies make code specifically for ? but compatible with IA-32 -# -x? specifies compile solely for ? [not specifically IA-32 compatible] -# -# where ? is -# K - PIII -# W - first P4 [Williamette] -# N - P4 Northwood -# P - P4 Prescott -# B - Blend of P4 and PM [mobile] -# -# Default to just generic max opts -CFLAGS += -O3 -xP -ip - -# default lib name (requires install with root) -# LIBNAME=-ltommath - -# libname when you can't install the lib with install -LIBNAME=../libtommath.a - -#provable primes -pprime: pprime.o - $(CC) pprime.o $(LIBNAME) -o pprime - -# portable [well requires clock()] tuning app -tune: tune.o - $(CC) tune.o $(LIBNAME) -o tune - -# same app but using RDTSC for higher precision [requires 80586+], coff based gcc installs [e.g. ming, cygwin, djgpp] -tune86: tune.c - nasm -f coff timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -# for cygwin -tune86c: tune.c - nasm -f gnuwin32 timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -#make tune86 for linux or any ELF format -tune86l: tune.c - nasm -f elf -DUSE_ELF timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86l - -# spits out mersenne primes -mersenne: mersenne.o - $(CC) mersenne.o $(LIBNAME) -o mersenne - -# fines DR safe primes for the given config -drprime: drprime.o - $(CC) drprime.o $(LIBNAME) -o drprime - -# fines 2k safe primes for the given config -2kprime: 2kprime.o - $(CC) 2kprime.o $(LIBNAME) -o 2kprime - -mont: mont.o - $(CC) mont.o $(LIBNAME) -o mont - - -clean: - rm -f *.log *.o *.obj *.exe pprime tune mersenne drprime tune86 tune86l mont 2kprime pprime.dat *.il diff --git a/libtommath/etc/makefile.msvc b/libtommath/etc/makefile.msvc deleted file mode 100644 index 2833372..0000000 --- a/libtommath/etc/makefile.msvc +++ /dev/null @@ -1,23 +0,0 @@ -#MSVC Makefile -# -#Tom St Denis - -CFLAGS = /I../ /Ox /DWIN32 /W3 - -pprime: pprime.obj - cl pprime.obj ../tommath.lib - -mersenne: mersenne.obj - cl mersenne.obj ../tommath.lib - -tune: tune.obj - cl tune.obj ../tommath.lib - -mont: mont.obj - cl mont.obj ../tommath.lib - -drprime: drprime.obj - cl drprime.obj ../tommath.lib - -2kprime: 2kprime.obj - cl 2kprime.obj ../tommath.lib diff --git a/libtommath/etc/mersenne.c b/libtommath/etc/mersenne.c deleted file mode 100644 index ae6725a..0000000 --- a/libtommath/etc/mersenne.c +++ /dev/null @@ -1,144 +0,0 @@ -/* Finds Mersenne primes using the Lucas-Lehmer test - * - * Tom St Denis, tomstdenis@gmail.com - */ -#include -#include - -int -is_mersenne (long s, int *pp) -{ - mp_int n, u; - int res, k; - - *pp = 0; - - if ((res = mp_init (&n)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&u)) != MP_OKAY) { - goto LBL_N; - } - - /* n = 2^s - 1 */ - if ((res = mp_2expt(&n, s)) != MP_OKAY) { - goto LBL_MU; - } - if ((res = mp_sub_d (&n, 1, &n)) != MP_OKAY) { - goto LBL_MU; - } - - /* set u=4 */ - mp_set (&u, 4); - - /* for k=1 to s-2 do */ - for (k = 1; k <= s - 2; k++) { - /* u = u^2 - 2 mod n */ - if ((res = mp_sqr (&u, &u)) != MP_OKAY) { - goto LBL_MU; - } - if ((res = mp_sub_d (&u, 2, &u)) != MP_OKAY) { - goto LBL_MU; - } - - /* make sure u is positive */ - while (u.sign == MP_NEG) { - if ((res = mp_add (&u, &n, &u)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* reduce */ - if ((res = mp_reduce_2k (&u, &n, 1)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* if u == 0 then its prime */ - if (mp_iszero (&u) == 1) { - mp_prime_is_prime(&n, 8, pp); - if (*pp != 1) printf("FAILURE\n"); - } - - res = MP_OKAY; -LBL_MU:mp_clear (&u); -LBL_N:mp_clear (&n); - return res; -} - -/* square root of a long < 65536 */ -long -i_sqrt (long x) -{ - long x1, x2; - - x2 = 16; - do { - x1 = x2; - x2 = x1 - ((x1 * x1) - x) / (2 * x1); - } while (x1 != x2); - - if (x1 * x1 > x) { - --x1; - } - - return x1; -} - -/* is the long prime by brute force */ -int -isprime (long k) -{ - long y, z; - - y = i_sqrt (k); - for (z = 2; z <= y; z++) { - if ((k % z) == 0) - return 0; - } - return 1; -} - - -int -main (void) -{ - int pp; - long k; - clock_t tt; - - k = 3; - - for (;;) { - /* start time */ - tt = clock (); - - /* test if 2^k - 1 is prime */ - if (is_mersenne (k, &pp) != MP_OKAY) { - printf ("Whoa error\n"); - return -1; - } - - if (pp == 1) { - /* count time */ - tt = clock () - tt; - - /* display if prime */ - printf ("2^%-5ld - 1 is prime, test took %ld ticks\n", k, tt); - } - - /* goto next odd exponent */ - k += 2; - - /* but make sure its prime */ - while (isprime (k) == 0) { - k += 2; - } - } - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/mont.c b/libtommath/etc/mont.c deleted file mode 100644 index 45cf3fd..0000000 --- a/libtommath/etc/mont.c +++ /dev/null @@ -1,50 +0,0 @@ -/* tests the montgomery routines */ -#include - -int main(void) -{ - mp_int modulus, R, p, pp; - mp_digit mp; - long x, y; - - srand(time(NULL)); - mp_init_multi(&modulus, &R, &p, &pp, NULL); - - /* loop through various sizes */ - for (x = 4; x < 256; x++) { - printf("DIGITS == %3ld...", x); fflush(stdout); - - /* make up the odd modulus */ - mp_rand(&modulus, x); - modulus.dp[0] |= 1; - - /* now find the R value */ - mp_montgomery_calc_normalization(&R, &modulus); - mp_montgomery_setup(&modulus, &mp); - - /* now run through a bunch tests */ - for (y = 0; y < 1000; y++) { - mp_rand(&p, x/2); /* p = random */ - mp_mul(&p, &R, &pp); /* pp = R * p */ - mp_montgomery_reduce(&pp, &modulus, mp); - - /* should be equal to p */ - if (mp_cmp(&pp, &p) != MP_EQ) { - printf("FAILURE!\n"); - exit(-1); - } - } - printf("PASSED\n"); - } - - return 0; -} - - - - - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/pprime.c b/libtommath/etc/pprime.c deleted file mode 100644 index 9f94423..0000000 --- a/libtommath/etc/pprime.c +++ /dev/null @@ -1,400 +0,0 @@ -/* Generates provable primes - * - * See http://gmail.com:8080/papers/pp.pdf for more info. - * - * Tom St Denis, tomstdenis@gmail.com, http://tom.gmail.com - */ -#include -#include "tommath.h" - -int n_prime; -FILE *primes; - -/* fast square root */ -static mp_digit -i_sqrt (mp_word x) -{ - mp_word x1, x2; - - x2 = x; - do { - x1 = x2; - x2 = x1 - ((x1 * x1) - x) / (2 * x1); - } while (x1 != x2); - - if (x1 * x1 > x) { - --x1; - } - - return x1; -} - - -/* generates a prime digit */ -static void gen_prime (void) -{ - mp_digit r, x, y, next; - FILE *out; - - out = fopen("pprime.dat", "wb"); - - /* write first set of primes */ - r = 3; fwrite(&r, 1, sizeof(mp_digit), out); - r = 5; fwrite(&r, 1, sizeof(mp_digit), out); - r = 7; fwrite(&r, 1, sizeof(mp_digit), out); - r = 11; fwrite(&r, 1, sizeof(mp_digit), out); - r = 13; fwrite(&r, 1, sizeof(mp_digit), out); - r = 17; fwrite(&r, 1, sizeof(mp_digit), out); - r = 19; fwrite(&r, 1, sizeof(mp_digit), out); - r = 23; fwrite(&r, 1, sizeof(mp_digit), out); - r = 29; fwrite(&r, 1, sizeof(mp_digit), out); - r = 31; fwrite(&r, 1, sizeof(mp_digit), out); - - /* get square root, since if 'r' is composite its factors must be < than this */ - y = i_sqrt (r); - next = (y + 1) * (y + 1); - - for (;;) { - do { - r += 2; /* next candidate */ - r &= MP_MASK; - if (r < 31) break; - - /* update sqrt ? */ - if (next <= r) { - ++y; - next = (y + 1) * (y + 1); - } - - /* loop if divisible by 3,5,7,11,13,17,19,23,29 */ - if ((r % 3) == 0) { - x = 0; - continue; - } - if ((r % 5) == 0) { - x = 0; - continue; - } - if ((r % 7) == 0) { - x = 0; - continue; - } - if ((r % 11) == 0) { - x = 0; - continue; - } - if ((r % 13) == 0) { - x = 0; - continue; - } - if ((r % 17) == 0) { - x = 0; - continue; - } - if ((r % 19) == 0) { - x = 0; - continue; - } - if ((r % 23) == 0) { - x = 0; - continue; - } - if ((r % 29) == 0) { - x = 0; - continue; - } - - /* now check if r is divisible by x + k={1,7,11,13,17,19,23,29} */ - for (x = 30; x <= y; x += 30) { - if ((r % (x + 1)) == 0) { - x = 0; - break; - } - if ((r % (x + 7)) == 0) { - x = 0; - break; - } - if ((r % (x + 11)) == 0) { - x = 0; - break; - } - if ((r % (x + 13)) == 0) { - x = 0; - break; - } - if ((r % (x + 17)) == 0) { - x = 0; - break; - } - if ((r % (x + 19)) == 0) { - x = 0; - break; - } - if ((r % (x + 23)) == 0) { - x = 0; - break; - } - if ((r % (x + 29)) == 0) { - x = 0; - break; - } - } - } while (x == 0); - if (r > 31) { fwrite(&r, 1, sizeof(mp_digit), out); printf("%9d\r", r); fflush(stdout); } - if (r < 31) break; - } - - fclose(out); -} - -void load_tab(void) -{ - primes = fopen("pprime.dat", "rb"); - if (primes == NULL) { - gen_prime(); - primes = fopen("pprime.dat", "rb"); - } - fseek(primes, 0, SEEK_END); - n_prime = ftell(primes) / sizeof(mp_digit); -} - -mp_digit prime_digit(void) -{ - int n; - mp_digit d; - - n = abs(rand()) % n_prime; - fseek(primes, n * sizeof(mp_digit), SEEK_SET); - fread(&d, 1, sizeof(mp_digit), primes); - return d; -} - - -/* makes a prime of at least k bits */ -int -pprime (int k, int li, mp_int * p, mp_int * q) -{ - mp_int a, b, c, n, x, y, z, v; - int res, ii; - static const mp_digit bases[] = { 2, 3, 5, 7, 11, 13, 17, 19 }; - - /* single digit ? */ - if (k <= (int) DIGIT_BIT) { - mp_set (p, prime_digit ()); - return MP_OKAY; - } - - if ((res = mp_init (&c)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&v)) != MP_OKAY) { - goto LBL_C; - } - - /* product of first 50 primes */ - if ((res = - mp_read_radix (&v, - "19078266889580195013601891820992757757219839668357012055907516904309700014933909014729740190", - 10)) != MP_OKAY) { - goto LBL_V; - } - - if ((res = mp_init (&a)) != MP_OKAY) { - goto LBL_V; - } - - /* set the prime */ - mp_set (&a, prime_digit ()); - - if ((res = mp_init (&b)) != MP_OKAY) { - goto LBL_A; - } - - if ((res = mp_init (&n)) != MP_OKAY) { - goto LBL_B; - } - - if ((res = mp_init (&x)) != MP_OKAY) { - goto LBL_N; - } - - if ((res = mp_init (&y)) != MP_OKAY) { - goto LBL_X; - } - - if ((res = mp_init (&z)) != MP_OKAY) { - goto LBL_Y; - } - - /* now loop making the single digit */ - while (mp_count_bits (&a) < k) { - fprintf (stderr, "prime has %4d bits left\r", k - mp_count_bits (&a)); - fflush (stderr); - top: - mp_set (&b, prime_digit ()); - - /* now compute z = a * b * 2 */ - if ((res = mp_mul (&a, &b, &z)) != MP_OKAY) { /* z = a * b */ - goto LBL_Z; - } - - if ((res = mp_copy (&z, &c)) != MP_OKAY) { /* c = a * b */ - goto LBL_Z; - } - - if ((res = mp_mul_2 (&z, &z)) != MP_OKAY) { /* z = 2 * a * b */ - goto LBL_Z; - } - - /* n = z + 1 */ - if ((res = mp_add_d (&z, 1, &n)) != MP_OKAY) { /* n = z + 1 */ - goto LBL_Z; - } - - /* check (n, v) == 1 */ - if ((res = mp_gcd (&n, &v, &y)) != MP_OKAY) { /* y = (n, v) */ - goto LBL_Z; - } - - if (mp_cmp_d (&y, 1) != MP_EQ) - goto top; - - /* now try base x=bases[ii] */ - for (ii = 0; ii < li; ii++) { - mp_set (&x, bases[ii]); - - /* compute x^a mod n */ - if ((res = mp_exptmod (&x, &a, &n, &y)) != MP_OKAY) { /* y = x^a mod n */ - goto LBL_Z; - } - - /* if y == 1 loop */ - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* now x^2a mod n */ - if ((res = mp_sqrmod (&y, &n, &y)) != MP_OKAY) { /* y = x^2a mod n */ - goto LBL_Z; - } - - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* compute x^b mod n */ - if ((res = mp_exptmod (&x, &b, &n, &y)) != MP_OKAY) { /* y = x^b mod n */ - goto LBL_Z; - } - - /* if y == 1 loop */ - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* now x^2b mod n */ - if ((res = mp_sqrmod (&y, &n, &y)) != MP_OKAY) { /* y = x^2b mod n */ - goto LBL_Z; - } - - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* compute x^c mod n == x^ab mod n */ - if ((res = mp_exptmod (&x, &c, &n, &y)) != MP_OKAY) { /* y = x^ab mod n */ - goto LBL_Z; - } - - /* if y == 1 loop */ - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* now compute (x^c mod n)^2 */ - if ((res = mp_sqrmod (&y, &n, &y)) != MP_OKAY) { /* y = x^2ab mod n */ - goto LBL_Z; - } - - /* y should be 1 */ - if (mp_cmp_d (&y, 1) != MP_EQ) - continue; - break; - } - - /* no bases worked? */ - if (ii == li) - goto top; - -{ - char buf[4096]; - - mp_toradix(&n, buf, 10); - printf("Certificate of primality for:\n%s\n\n", buf); - mp_toradix(&a, buf, 10); - printf("A == \n%s\n\n", buf); - mp_toradix(&b, buf, 10); - printf("B == \n%s\n\nG == %d\n", buf, bases[ii]); - printf("----------------------------------------------------------------\n"); -} - - /* a = n */ - mp_copy (&n, &a); - } - - /* get q to be the order of the large prime subgroup */ - mp_sub_d (&n, 1, q); - mp_div_2 (q, q); - mp_div (q, &b, q, NULL); - - mp_exch (&n, p); - - res = MP_OKAY; -LBL_Z:mp_clear (&z); -LBL_Y:mp_clear (&y); -LBL_X:mp_clear (&x); -LBL_N:mp_clear (&n); -LBL_B:mp_clear (&b); -LBL_A:mp_clear (&a); -LBL_V:mp_clear (&v); -LBL_C:mp_clear (&c); - return res; -} - - -int -main (void) -{ - mp_int p, q; - char buf[4096]; - int k, li; - clock_t t1; - - srand (time (NULL)); - load_tab(); - - printf ("Enter # of bits: \n"); - fgets (buf, sizeof (buf), stdin); - sscanf (buf, "%d", &k); - - printf ("Enter number of bases to try (1 to 8):\n"); - fgets (buf, sizeof (buf), stdin); - sscanf (buf, "%d", &li); - - - mp_init (&p); - mp_init (&q); - - t1 = clock (); - pprime (k, li, &p, &q); - t1 = clock () - t1; - - printf ("\n\nTook %ld ticks, %d bits\n", t1, mp_count_bits (&p)); - - mp_toradix (&p, buf, 10); - printf ("P == %s\n", buf); - mp_toradix (&q, buf, 10); - printf ("Q == %s\n", buf); - - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/prime.1024 b/libtommath/etc/prime.1024 deleted file mode 100644 index 5636e2d..0000000 --- a/libtommath/etc/prime.1024 +++ /dev/null @@ -1,414 +0,0 @@ -Enter # of bits: -Enter number of bases to try (1 to 8): -Certificate of primality for: -36360080703173363 - -A == -89963569 - -B == -202082249 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -4851595597739856136987139 - -A == -36360080703173363 - -B == -66715963 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -19550639734462621430325731591027 - -A == -4851595597739856136987139 - -B == -2014867 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -10409036141344317165691858509923818734539 - -A == -19550639734462621430325731591027 - -B == -266207047 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1049829549988285012736475602118094726647504414203 - -A == -10409036141344317165691858509923818734539 - -B == -50428759 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -77194737385528288387712399596835459931920358844586615003 - -A == -1049829549988285012736475602118094726647504414203 - -B == -36765367 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -35663756695365208574443215955488689578374232732893628896541201763 - -A == -77194737385528288387712399596835459931920358844586615003 - -B == -230998627 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -16711831463502165169495622246023119698415848120292671294127567620396469803 - -A == -35663756695365208574443215955488689578374232732893628896541201763 - -B == -234297127 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -6163534781560285962890718925972249753147470953579266394395432475622345597103528739 - -A == -16711831463502165169495622246023119698415848120292671294127567620396469803 - -B == -184406323 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -814258256205243497704094951432575867360065658372158511036259934640748088306764553488803787 - -A == -6163534781560285962890718925972249753147470953579266394395432475622345597103528739 - -B == -66054487 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -176469695533271657902814176811660357049007467856432383037590673407330246967781451723764079581998187 - -A == -814258256205243497704094951432575867360065658372158511036259934640748088306764553488803787 - -B == -108362239 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -44924492859445516541759485198544012102424796403707253610035148063863073596051272171194806669756971406400419 - -A == -176469695533271657902814176811660357049007467856432383037590673407330246967781451723764079581998187 - -B == -127286707 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -20600996927219343383225424320134474929609459588323857796871086845924186191561749519858600696159932468024710985371059 - -A == -44924492859445516541759485198544012102424796403707253610035148063863073596051272171194806669756971406400419 - -B == -229284691 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -6295696427695493110141186605837397185848992307978456138112526915330347715236378041486547994708748840844217371233735072572979 - -A == -20600996927219343383225424320134474929609459588323857796871086845924186191561749519858600696159932468024710985371059 - -B == -152800771 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -3104984078042317488749073016454213579257792635142218294052134804187631661145261015102617582090263808696699966840735333252107678792123 - -A == -6295696427695493110141186605837397185848992307978456138112526915330347715236378041486547994708748840844217371233735072572979 - -B == -246595759 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -26405175827665701256325699315126705508919255051121452292124404943796947287968603975320562847910946802396632302209435206627913466015741799499 - -A == -3104984078042317488749073016454213579257792635142218294052134804187631661145261015102617582090263808696699966840735333252107678792123 - -B == -4252063 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -11122146237908413610034600609460545703591095894418599759742741406628055069007082998134905595800236452010905900391505454890446585211975124558601770163 - -A == -26405175827665701256325699315126705508919255051121452292124404943796947287968603975320562847910946802396632302209435206627913466015741799499 - -B == -210605419 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1649861642047798890580354082088712649911849362201343649289384923147797960364736011515757482030049342943790127685185806092659832129486307035500638595572396187 - -A == -11122146237908413610034600609460545703591095894418599759742741406628055069007082998134905595800236452010905900391505454890446585211975124558601770163 - -B == -74170111 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -857983367126266717607389719637086684134462613006415859877666235955788392464081914127715967940968197765042399904117392707518175220864852816390004264107201177394565363 - -A == -1649861642047798890580354082088712649911849362201343649289384923147797960364736011515757482030049342943790127685185806092659832129486307035500638595572396187 - -B == -260016763 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -175995909353623703257072120479340610010337144085688850745292031336724691277374210929188442230237711063783727092685448718515661641054886101716698390145283196296702450566161283 - -A == -857983367126266717607389719637086684134462613006415859877666235955788392464081914127715967940968197765042399904117392707518175220864852816390004264107201177394565363 - -B == -102563707 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -48486002551155667224487059713350447239190772068092630563272168418880661006593537218144160068395218642353495339720640699721703003648144463556291315694787862009052641640656933232794283 - -A == -175995909353623703257072120479340610010337144085688850745292031336724691277374210929188442230237711063783727092685448718515661641054886101716698390145283196296702450566161283 - -B == -137747527 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -13156468011529105025061495011938518171328604045212410096476697450506055664012861932372156505805788068791146986282263016790631108386790291275939575123375304599622623328517354163964228279867403 - -A == -48486002551155667224487059713350447239190772068092630563272168418880661006593537218144160068395218642353495339720640699721703003648144463556291315694787862009052641640656933232794283 - -B == -135672847 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -6355194692790533601105154341731997464407930009404822926832136060319955058388106456084549316415200519472481147942263916585428906582726749131479465958107142228236909665306781538860053107680830113869123 - -A == -13156468011529105025061495011938518171328604045212410096476697450506055664012861932372156505805788068791146986282263016790631108386790291275939575123375304599622623328517354163964228279867403 - -B == -241523587 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -3157116676535430302794438027544146642863331358530722860333745617571010460905857862561870488000265751138954271040017454405707755458702044884023184574412221802502351503929935224995314581932097706874819348858083 - -A == -6355194692790533601105154341731997464407930009404822926832136060319955058388106456084549316415200519472481147942263916585428906582726749131479465958107142228236909665306781538860053107680830113869123 - -B == -248388667 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -390533129219992506725320633489467713907837370444962163378727819939092929448752905310115311180032249230394348337568973177802874166228132778126338883671958897238722734394783244237133367055422297736215754829839364158067 - -A == -3157116676535430302794438027544146642863331358530722860333745617571010460905857862561870488000265751138954271040017454405707755458702044884023184574412221802502351503929935224995314581932097706874819348858083 - -B == -61849651 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -48583654555070224891047847050732516652910250240135992225139515777200432486685999462997073444468380434359929499498804723793106565291183220444221080449740542884172281158126259373095216435009661050109711341419005972852770440739 - -A == -390533129219992506725320633489467713907837370444962163378727819939092929448752905310115311180032249230394348337568973177802874166228132778126338883671958897238722734394783244237133367055422297736215754829839364158067 - -B == -62201707 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -25733035251905120039135866524384525138869748427727001128764704499071378939227862068500633813538831598776578372709963673670934388213622433800015759585470542686333039614931682098922935087822950084908715298627996115185849260703525317419 - -A == -48583654555070224891047847050732516652910250240135992225139515777200432486685999462997073444468380434359929499498804723793106565291183220444221080449740542884172281158126259373095216435009661050109711341419005972852770440739 - -B == -264832231 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -2804594464939948901906623499531073917980499195397462605359913717827014360538186518540781517129548650937632008683280555602633122170458773895504894807182664540529077836857897972175530148107545939211339044386106111633510166695386323426241809387 - -A == -25733035251905120039135866524384525138869748427727001128764704499071378939227862068500633813538831598776578372709963673670934388213622433800015759585470542686333039614931682098922935087822950084908715298627996115185849260703525317419 - -B == -54494047 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -738136612083433720096707308165797114449914259256979340471077690416567237592465306112484843530074782721390528773594351482384711900456440808251196845265132086486672447136822046628407467459921823150600138073268385534588238548865012638209515923513516547 - -A == -2804594464939948901906623499531073917980499195397462605359913717827014360538186518540781517129548650937632008683280555602633122170458773895504894807182664540529077836857897972175530148107545939211339044386106111633510166695386323426241809387 - -B == -131594179 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -392847529056126766528615419937165193421166694172790666626558750047057558168124866940509180171236517681470100877687445134633784815352076138790217228749332398026714192707447855731679485746120589851992221508292976900578299504461333767437280988393026452846013683 - -A == -738136612083433720096707308165797114449914259256979340471077690416567237592465306112484843530074782721390528773594351482384711900456440808251196845265132086486672447136822046628407467459921823150600138073268385534588238548865012638209515923513516547 - -B == -266107603 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -168459393231883505975876919268398655632763956627405508859662408056221544310200546265681845397346956580604208064328814319465940958080244889692368602591598503944015835190587740756859842792554282496742843600573336023639256008687581291233481455395123454655488735304365627 - -A == -392847529056126766528615419937165193421166694172790666626558750047057558168124866940509180171236517681470100877687445134633784815352076138790217228749332398026714192707447855731679485746120589851992221508292976900578299504461333767437280988393026452846013683 - -B == -214408111 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -14865774288636941404884923981945833072113667565310054952177860608355263252462409554658728941191929400198053290113492910272458441655458514080123870132092365833472436407455910185221474386718838138135065780840839893113912689594815485706154461164071775481134379794909690501684643 - -A == -168459393231883505975876919268398655632763956627405508859662408056221544310200546265681845397346956580604208064328814319465940958080244889692368602591598503944015835190587740756859842792554282496742843600573336023639256008687581291233481455395123454655488735304365627 - -B == -44122723 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1213301773203241614897109856134894783021668292000023984098824423682568173639394290886185366993108292039068940333907505157813934962357206131450244004178619265868614859794316361031904412926604138893775068853175215502104744339658944443630407632290152772487455298652998368296998719996019 - -A == -14865774288636941404884923981945833072113667565310054952177860608355263252462409554658728941191929400198053290113492910272458441655458514080123870132092365833472436407455910185221474386718838138135065780840839893113912689594815485706154461164071775481134379794909690501684643 - -B == -40808563 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -186935245989515158127969129347464851990429060640910951266513740972248428651109062997368144722015290092846666943896556191257222521203647606911446635194198213436423080005867489516421559330500722264446765608763224572386410155413161172707802334865729654109050873820610813855041667633843601286843 - -A == -1213301773203241614897109856134894783021668292000023984098824423682568173639394290886185366993108292039068940333907505157813934962357206131450244004178619265868614859794316361031904412926604138893775068853175215502104744339658944443630407632290152772487455298652998368296998719996019 - -B == -77035759 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -83142661079751490510739960019112406284111408348732592580459037404394946037094409915127399165633756159385609671956087845517678367844901424617866988187132480585966721962585586730693443536100138246516868613250009028187662080828012497191775172228832247706080044971423654632146928165751885302331924491683 - -A == -186935245989515158127969129347464851990429060640910951266513740972248428651109062997368144722015290092846666943896556191257222521203647606911446635194198213436423080005867489516421559330500722264446765608763224572386410155413161172707802334865729654109050873820610813855041667633843601286843 - -B == -222383587 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -3892354773803809855317742245039794448230625839512638747643814927766738642436392673485997449586432241626440927010641564064764336402368634186618250134234189066179771240232458249806850838490410473462391401438160528157981942499581634732706904411807195259620779379274017704050790865030808501633772117217899534443 - -A == -83142661079751490510739960019112406284111408348732592580459037404394946037094409915127399165633756159385609671956087845517678367844901424617866988187132480585966721962585586730693443536100138246516868613250009028187662080828012497191775172228832247706080044971423654632146928165751885302331924491683 - -B == -23407687 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1663606652988091811284014366560171522582683318514519379924950390627250155440313691226744227787921928894551755219495501365555370027257568506349958010457682898612082048959464465369892842603765280317696116552850664773291371490339084156052244256635115997453399761029567033971998617303988376172539172702246575225837054723 - -A == -3892354773803809855317742245039794448230625839512638747643814927766738642436392673485997449586432241626440927010641564064764336402368634186618250134234189066179771240232458249806850838490410473462391401438160528157981942499581634732706904411807195259620779379274017704050790865030808501633772117217899534443 - -B == -213701827 - -G == 2 ----------------------------------------------------------------- - - -Took 33057 ticks, 1048 bits -P == 1663606652988091811284014366560171522582683318514519379924950390627250155440313691226744227787921928894551755219495501365555370027257568506349958010457682898612082048959464465369892842603765280317696116552850664773291371490339084156052244256635115997453399761029567033971998617303988376172539172702246575225837054723 -Q == 3892354773803809855317742245039794448230625839512638747643814927766738642436392673485997449586432241626440927010641564064764336402368634186618250134234189066179771240232458249806850838490410473462391401438160528157981942499581634732706904411807195259620779379274017704050790865030808501633772117217899534443 diff --git a/libtommath/etc/prime.512 b/libtommath/etc/prime.512 deleted file mode 100644 index cb6ec30..0000000 --- a/libtommath/etc/prime.512 +++ /dev/null @@ -1,205 +0,0 @@ -Enter # of bits: -Enter number of bases to try (1 to 8): -Certificate of primality for: -85933926807634727 - -A == -253758023 - -B == -169322581 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -23930198825086241462113799 - -A == -85933926807634727 - -B == -139236037 - -G == 11 ----------------------------------------------------------------- -Certificate of primality for: -6401844647261612602378676572510019 - -A == -23930198825086241462113799 - -B == -133760791 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -269731366027728777712034888684015329354259 - -A == -6401844647261612602378676572510019 - -B == -21066691 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -37942338209025571690075025099189467992329684223707 - -A == -269731366027728777712034888684015329354259 - -B == -70333567 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -15306904714258982484473490774101705363308327436988160248323 - -A == -37942338209025571690075025099189467992329684223707 - -B == -201712723 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1616744757018513392810355191503853040357155275733333124624513530099 - -A == -15306904714258982484473490774101705363308327436988160248323 - -B == -52810963 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -464222094814208047161771036072622485188658077940154689939306386289983787983 - -A == -1616744757018513392810355191503853040357155275733333124624513530099 - -B == -143566909 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -187429931674053784626487560729643601208757374994177258429930699354770049369025096447 - -A == -464222094814208047161771036072622485188658077940154689939306386289983787983 - -B == -201875281 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -100579220846502621074093727119851331775052664444339632682598589456666938521976625305832917563 - -A == -187429931674053784626487560729643601208757374994177258429930699354770049369025096447 - -B == -268311523 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1173616081309758475197022137833792133815753368965945885089720153370737965497134878651384030219765163 - -A == -100579220846502621074093727119851331775052664444339632682598589456666938521976625305832917563 - -B == -5834287 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -191456913489905913185935197655672585713573070349044195411728114905691721186574907738081340754373032735283623 - -A == -1173616081309758475197022137833792133815753368965945885089720153370737965497134878651384030219765163 - -B == -81567097 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -57856530489201750164178576399448868489243874083056587683743345599898489554401618943240901541005080049321706789987519 - -A == -191456913489905913185935197655672585713573070349044195411728114905691721186574907738081340754373032735283623 - -B == -151095433 - -G == 7 ----------------------------------------------------------------- -Certificate of primality for: -13790529750452576698109671710773784949185621244122040804792403407272729038377767162233653248852099545134831722512085881814803 - -A == -57856530489201750164178576399448868489243874083056587683743345599898489554401618943240901541005080049321706789987519 - -B == -119178679 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -7075985989000817742677547821106534174334812111605018857703825637170140040509067704269696198231266351631132464035671858077052876058979 - -A == -13790529750452576698109671710773784949185621244122040804792403407272729038377767162233653248852099545134831722512085881814803 - -B == -256552363 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1227273006232588072907488910282307435921226646895131225407452056677899411162892829564455154080310937471747140942360789623819327234258162420463 - -A == -7075985989000817742677547821106534174334812111605018857703825637170140040509067704269696198231266351631132464035671858077052876058979 - -B == -86720989 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -446764896913554613686067036908702877942872355053329937790398156069936255759889884246832779737114032666318220500106499161852193765380831330106375235763 - -A == -1227273006232588072907488910282307435921226646895131225407452056677899411162892829564455154080310937471747140942360789623819327234258162420463 - -B == -182015287 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -5290203010849586596974953717018896543907195901082056939587768479377028575911127944611236020459652034082251335583308070846379514569838984811187823420951275243 - -A == -446764896913554613686067036908702877942872355053329937790398156069936255759889884246832779737114032666318220500106499161852193765380831330106375235763 - -B == -5920567 - -G == 2 ----------------------------------------------------------------- - - -Took 3454 ticks, 521 bits -P == 5290203010849586596974953717018896543907195901082056939587768479377028575911127944611236020459652034082251335583308070846379514569838984811187823420951275243 -Q == 446764896913554613686067036908702877942872355053329937790398156069936255759889884246832779737114032666318220500106499161852193765380831330106375235763 diff --git a/libtommath/etc/timer.asm b/libtommath/etc/timer.asm deleted file mode 100644 index 326a947..0000000 --- a/libtommath/etc/timer.asm +++ /dev/null @@ -1,37 +0,0 @@ -; x86 timer in NASM -; -; Tom St Denis, tomstdenis@iahu.ca -[bits 32] -[section .data] -time dd 0, 0 - -[section .text] - -%ifdef USE_ELF -[global t_start] -t_start: -%else -[global _t_start] -_t_start: -%endif - push edx - push eax - rdtsc - mov [time+0],edx - mov [time+4],eax - pop eax - pop edx - ret - -%ifdef USE_ELF -[global t_read] -t_read: -%else -[global _t_read] -_t_read: -%endif - rdtsc - sub eax,[time+4] - sbb edx,[time+0] - ret - \ No newline at end of file diff --git a/libtommath/etc/tune.c b/libtommath/etc/tune.c deleted file mode 100644 index c2ac998..0000000 --- a/libtommath/etc/tune.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Tune the Karatsuba parameters - * - * Tom St Denis, tomstdenis@gmail.com - */ -#include -#include - -/* how many times todo each size mult. Depends on your computer. For slow computers - * this can be low like 5 or 10. For fast [re: Athlon] should be 25 - 50 or so - */ -#define TIMES (1UL<<14UL) - -#ifndef X86_TIMER - -/* RDTSC from Scott Duplichan */ -static ulong64 TIMFUNC (void) - { - #if defined __GNUC__ - #if defined(__i386__) || defined(__x86_64__) - /* version from http://www.mcs.anl.gov/~kazutomo/rdtsc.html - * the old code always got a warning issued by gcc, clang did not complain... - */ - unsigned hi, lo; - __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); - return ((ulong64)lo)|( ((ulong64)hi)<<32); - #else /* gcc-IA64 version */ - unsigned long result; - __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); - while (__builtin_expect ((int) result == -1, 0)) - __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); - return result; - #endif - - // Microsoft and Intel Windows compilers - #elif defined _M_IX86 - __asm rdtsc - #elif defined _M_AMD64 - return __rdtsc (); - #elif defined _M_IA64 - #if defined __INTEL_COMPILER - #include - #endif - return __getReg (3116); - #else - #error need rdtsc function for this build - #endif - } - - -/* generic ISO C timer */ -ulong64 LBL_T; -void t_start(void) { LBL_T = TIMFUNC(); } -ulong64 t_read(void) { return TIMFUNC() - LBL_T; } - -#else -extern void t_start(void); -extern ulong64 t_read(void); -#endif - -ulong64 time_mult(int size, int s) -{ - unsigned long x; - mp_int a, b, c; - ulong64 t1; - - mp_init (&a); - mp_init (&b); - mp_init (&c); - - mp_rand (&a, size); - mp_rand (&b, size); - - if (s == 1) { - KARATSUBA_MUL_CUTOFF = size; - } else { - KARATSUBA_MUL_CUTOFF = 100000; - } - - t_start(); - for (x = 0; x < TIMES; x++) { - mp_mul(&a,&b,&c); - } - t1 = t_read(); - mp_clear (&a); - mp_clear (&b); - mp_clear (&c); - return t1; -} - -ulong64 time_sqr(int size, int s) -{ - unsigned long x; - mp_int a, b; - ulong64 t1; - - mp_init (&a); - mp_init (&b); - - mp_rand (&a, size); - - if (s == 1) { - KARATSUBA_SQR_CUTOFF = size; - } else { - KARATSUBA_SQR_CUTOFF = 100000; - } - - t_start(); - for (x = 0; x < TIMES; x++) { - mp_sqr(&a,&b); - } - t1 = t_read(); - mp_clear (&a); - mp_clear (&b); - return t1; -} - -int -main (void) -{ - ulong64 t1, t2; - int x, y; - - for (x = 8; ; x += 2) { - t1 = time_mult(x, 0); - t2 = time_mult(x, 1); - printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1); - if (t2 < t1) break; - } - y = x; - - for (x = 8; ; x += 2) { - t1 = time_sqr(x, 0); - t2 = time_sqr(x, 1); - printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1); - if (t2 < t1) break; - } - printf("KARATSUBA_MUL_CUTOFF = %d\n", y); - printf("KARATSUBA_SQR_CUTOFF = %d\n", x); - - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/filter.pl b/libtommath/filter.pl deleted file mode 100755 index a8a50c7..0000000 --- a/libtommath/filter.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/perl - -# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun) - -$dst = shift; -$ins = shift; - -open(SRC,"<$dst"); -open(INS,"<$ins"); -open(TMP,">tmp.delme"); - -$l = 0; -while () { - if ($_ =~ /START_INS/) { - print TMP $_; - $l = 1; - while () { - print TMP $_; - } - close INS; - } elsif ($_ =~ /END_INS/) { - print TMP $_; - $l = 0; - } elsif ($l == 0) { - print TMP $_; - } -} - -close TMP; -close SRC; - -# $Source$ -# $Revision$ -# $Date$ diff --git a/libtommath/gen.pl b/libtommath/gen.pl deleted file mode 100644 index 57f65ac..0000000 --- a/libtommath/gen.pl +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl -w -# -# Generates a "single file" you can use to quickly -# add the whole source without any makefile troubles -# -use strict; - -open( OUT, ">mpi.c" ) or die "Couldn't open mpi.c for writing: $!"; -foreach my $filename (glob "bn*.c") { - open( SRC, "<$filename" ) or die "Couldn't open $filename for reading: $!"; - print OUT "/* Start: $filename */\n"; - print OUT while ; - print OUT "\n/* End: $filename */\n\n"; - close SRC or die "Error closing $filename after reading: $!"; -} -print OUT "\n/* EOF */\n"; -close OUT or die "Error closing mpi.c after writing: $!"; - -system('perl -pli -e "s/\s*$//" mpi.c'); diff --git a/libtommath/genlist.sh b/libtommath/genlist.sh deleted file mode 100755 index 1f53b66..0000000 --- a/libtommath/genlist.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -export a=`find . -maxdepth 1 -type f -name '*.c' | sort | sed -e 'sE\./EE' | sed -e 's/\.c/\.o/' | xargs` -perl ./parsenames.pl OBJECTS "$a" - -# $Source$ -# $Revision$ -# $Date$ diff --git a/libtommath/libtommath.dsp b/libtommath/libtommath.dsp deleted file mode 100644 index 71ac243..0000000 --- a/libtommath/libtommath.dsp +++ /dev/null @@ -1,572 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libtommath" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=libtommath - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libtommath.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libtommath.mak" CFG="libtommath - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libtommath - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libtommath - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "libtommath" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libtommath - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Release\tommath.lib" - -!ELSEIF "$(CFG)" == "libtommath - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Debug\tommath.lib" - -!ENDIF - -# Begin Target - -# Name "libtommath - Win32 Release" -# Name "libtommath - Win32 Debug" -# Begin Source File - -SOURCE=.\bn_error.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_mp_invmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_mp_montgomery_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_s_mp_mul_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_s_mp_mul_high_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_s_mp_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_2expt.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_abs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_add.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_add_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_addmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_and.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_clamp.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_clear.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_clear_multi.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cmp.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cmp_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cmp_mag.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cnt_lsb.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_copy.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_count_bits.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_2.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_2d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_3.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_dr_is_modulus.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_dr_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_dr_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exch.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_expt_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exptmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exptmod_fast.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exteuclid.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_fread.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_fwrite.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_gcd.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_get_int.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_grow.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_copy.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_multi.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_set.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_set_int.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_invmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_invmod_slow.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_is_square.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_jacobi.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_karatsuba_mul.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_karatsuba_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_lcm.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_lshd.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mod_2d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mod_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_montgomery_calc_normalization.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_montgomery_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_montgomery_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul_2.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul_2d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mulmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_n_root.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_neg.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_or.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_fermat.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_is_divisible.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_is_prime.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_miller_rabin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_next_prime.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_rabin_miller_trials.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_random_ex.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_radix_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_radix_smap.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_rand.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_read_radix.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_read_signed_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_read_unsigned_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k_l.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k_setup_l.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_is_2k.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_is_2k_l.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_rshd.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_set.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_set_int.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_shrink.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_signed_bin_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sqrmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sqrt.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sub.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sub_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_submod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_signed_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_signed_bin_n.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_unsigned_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_unsigned_bin_n.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toom_mul.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toom_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toradix.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toradix_n.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_unsigned_bin_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_xor.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_zero.c -# End Source File -# Begin Source File - -SOURCE=.\bn_prime_tab.c -# End Source File -# Begin Source File - -SOURCE=.\bn_reverse.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_add.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_exptmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_mul_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_mul_high_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_sub.c -# End Source File -# Begin Source File - -SOURCE=.\bncore.c -# End Source File -# Begin Source File - -SOURCE=.\tommath.h -# End Source File -# Begin Source File - -SOURCE=.\tommath_class.h -# End Source File -# Begin Source File - -SOURCE=.\tommath_superclass.h -# End Source File -# End Target -# End Project diff --git a/libtommath/libtommath_VS2005.sln b/libtommath/libtommath_VS2005.sln deleted file mode 100644 index 21bc915..0000000 --- a/libtommath/libtommath_VS2005.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2005.vcproj", "{0272C9B2-D68B-4F24-B32D-C1FD552F7E51}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.ActiveCfg = Debug|Win32 - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.Build.0 = Debug|Win32 - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.ActiveCfg = Release|Win32 - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libtommath/libtommath_VS2005.vcproj b/libtommath/libtommath_VS2005.vcproj deleted file mode 100644 index e92c7be..0000000 --- a/libtommath/libtommath_VS2005.vcproj +++ /dev/null @@ -1,2847 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libtommath/libtommath_VS2008.sln b/libtommath/libtommath_VS2008.sln deleted file mode 100644 index 1327ccf..0000000 --- a/libtommath/libtommath_VS2008.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2008.vcproj", "{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.ActiveCfg = Debug|Win32 - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.Build.0 = Debug|Win32 - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.ActiveCfg = Release|Win32 - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libtommath/libtommath_VS2008.vcproj b/libtommath/libtommath_VS2008.vcproj deleted file mode 100644 index 7503d22..0000000 --- a/libtommath/libtommath_VS2008.vcproj +++ /dev/null @@ -1,2813 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libtommath/logs/README b/libtommath/logs/README deleted file mode 100644 index 965e7c8..0000000 --- a/libtommath/logs/README +++ /dev/null @@ -1,13 +0,0 @@ -To use the pretty graphs you have to first build/run the ltmtest from the root directory of the package. -Todo this type - -make timing ; ltmtest - -in the root. It will run for a while [about ten minutes on most PCs] and produce a series of .log files in logs/. - -After doing that run "gnuplot graphs.dem" to make the PNGs. If you managed todo that all so far just open index.html to view -them all :-) - -Have fun - -Tom \ No newline at end of file diff --git a/libtommath/logs/add.log b/libtommath/logs/add.log deleted file mode 100644 index 43503ac..0000000 --- a/libtommath/logs/add.log +++ /dev/null @@ -1,16 +0,0 @@ -480 87 -960 111 -1440 135 -1920 159 -2400 200 -2880 224 -3360 248 -3840 272 -4320 296 -4800 320 -5280 344 -5760 368 -6240 392 -6720 416 -7200 440 -7680 464 diff --git a/libtommath/logs/addsub.png b/libtommath/logs/addsub.png deleted file mode 100644 index a5679ac..0000000 Binary files a/libtommath/logs/addsub.png and /dev/null differ diff --git a/libtommath/logs/expt.log b/libtommath/logs/expt.log deleted file mode 100644 index 70932ab..0000000 --- a/libtommath/logs/expt.log +++ /dev/null @@ -1,7 +0,0 @@ -513 1435869 -769 3544970 -1025 7791638 -2049 46902238 -2561 85334899 -3073 141451412 -4097 308770310 diff --git a/libtommath/logs/expt.png b/libtommath/logs/expt.png deleted file mode 100644 index 9ee8bb7..0000000 Binary files a/libtommath/logs/expt.png and /dev/null differ diff --git a/libtommath/logs/expt_2k.log b/libtommath/logs/expt_2k.log deleted file mode 100644 index 97d325f..0000000 --- a/libtommath/logs/expt_2k.log +++ /dev/null @@ -1,5 +0,0 @@ -607 2109225 -1279 10148314 -2203 34126877 -3217 82716424 -4253 161569606 diff --git a/libtommath/logs/expt_2kl.log b/libtommath/logs/expt_2kl.log deleted file mode 100644 index d9ad4be..0000000 --- a/libtommath/logs/expt_2kl.log +++ /dev/null @@ -1,4 +0,0 @@ -1024 7705271 -2048 34286851 -4096 165207491 -521 1618631 diff --git a/libtommath/logs/expt_dr.log b/libtommath/logs/expt_dr.log deleted file mode 100644 index c6bbe07..0000000 --- a/libtommath/logs/expt_dr.log +++ /dev/null @@ -1,7 +0,0 @@ -532 1928550 -784 3763908 -1036 7564221 -1540 16566059 -2072 32283784 -3080 79851565 -4116 157843530 diff --git a/libtommath/logs/graphs.dem b/libtommath/logs/graphs.dem deleted file mode 100644 index dfaf613..0000000 --- a/libtommath/logs/graphs.dem +++ /dev/null @@ -1,17 +0,0 @@ -set terminal png -set size 1.75 -set ylabel "Cycles per Operation" -set xlabel "Operand size (bits)" - -set output "addsub.png" -plot 'add.log' smooth bezier title "Addition", 'sub.log' smooth bezier title "Subtraction" - -set output "mult.png" -plot 'sqr.log' smooth bezier title "Squaring (without Karatsuba)", 'sqr_kara.log' smooth bezier title "Squaring (Karatsuba)", 'mult.log' smooth bezier title "Multiplication (without Karatsuba)", 'mult_kara.log' smooth bezier title "Multiplication (Karatsuba)" - -set output "expt.png" -plot 'expt.log' smooth bezier title "Exptmod (Montgomery)", 'expt_dr.log' smooth bezier title "Exptmod (Dimminished Radix)", 'expt_2k.log' smooth bezier title "Exptmod (2k Reduction)" - -set output "invmod.png" -plot 'invmod.log' smooth bezier title "Modular Inverse" - diff --git a/libtommath/logs/index.html b/libtommath/logs/index.html deleted file mode 100644 index 4b68c25..0000000 --- a/libtommath/logs/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - -LibTomMath Log Plots - - - -

Addition and Subtraction

-
-
- -

Multipliers

-
-
- -

Exptmod

-
-
- -

Modular Inverse

-
-
- - - -/* $Source: /cvs/libtom/libtommath/logs/index.html,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2005/05/05 14:38:47 $ */ diff --git a/libtommath/logs/invmod.log b/libtommath/logs/invmod.log deleted file mode 100644 index e69de29..0000000 diff --git a/libtommath/logs/invmod.png b/libtommath/logs/invmod.png deleted file mode 100644 index 0a8a4ad..0000000 Binary files a/libtommath/logs/invmod.png and /dev/null differ diff --git a/libtommath/logs/mult.log b/libtommath/logs/mult.log deleted file mode 100644 index 33563fc..0000000 --- a/libtommath/logs/mult.log +++ /dev/null @@ -1,84 +0,0 @@ -271 555 -390 855 -508 1161 -631 1605 -749 2117 -871 2687 -991 3329 -1108 4084 -1231 4786 -1351 5624 -1470 6392 -1586 7364 -1710 8218 -1830 9255 -1951 10217 -2067 11461 -2191 12463 -2308 13677 -2430 14800 -2551 16232 -2671 17460 -2791 18899 -2902 20247 -3028 21902 -3151 23240 -3267 24927 -3391 26441 -3511 28277 -3631 29838 -3749 31751 -3869 33673 -3989 35431 -4111 37518 -4231 39426 -4349 41504 -4471 43567 -4591 45786 -4711 47876 -4831 50299 -4951 52427 -5071 54785 -5189 57241 -5307 59730 -5431 62194 -5551 64761 -5670 67322 -5789 70073 -5907 72663 -6030 75437 -6151 78242 -6268 81202 -6389 83948 -6509 86985 -6631 89903 -6747 93184 -6869 96044 -6991 99286 -7109 102395 -7229 105917 -7351 108940 -7470 112490 -7589 115702 -7711 119508 -7831 122632 -7951 126410 -8071 129808 -8190 133895 -8311 137146 -8431 141218 -8549 144732 -8667 149131 -8790 152462 -8911 156754 -9030 160479 -9149 165138 -9271 168601 -9391 173185 -9511 176988 -9627 181976 -9751 185539 -9870 190388 -9991 194335 -10110 199605 -10228 203298 diff --git a/libtommath/logs/mult.png b/libtommath/logs/mult.png deleted file mode 100644 index 4f7a4ee..0000000 Binary files a/libtommath/logs/mult.png and /dev/null differ diff --git a/libtommath/logs/mult_kara.log b/libtommath/logs/mult_kara.log deleted file mode 100644 index 7136c79..0000000 --- a/libtommath/logs/mult_kara.log +++ /dev/null @@ -1,84 +0,0 @@ -271 560 -391 870 -511 1159 -631 1605 -750 2111 -871 2737 -991 3361 -1111 4054 -1231 4778 -1351 5600 -1471 6404 -1591 7323 -1710 8255 -1831 9239 -1948 10257 -2070 11397 -2190 12531 -2308 13665 -2429 14870 -2550 16175 -2671 17539 -2787 18879 -2911 20350 -3031 21807 -3150 23415 -3270 24897 -3388 26567 -3511 28205 -3627 30076 -3751 31744 -3869 33657 -3991 35425 -4111 37522 -4229 39363 -4351 41503 -4470 43491 -4590 45827 -4711 47795 -4828 50166 -4951 52318 -5070 54911 -5191 57036 -5308 58237 -5431 60248 -5551 62678 -5671 64786 -5791 67294 -5908 69343 -6031 71607 -6151 74166 -6271 76590 -6391 78734 -6511 81175 -6631 83742 -6750 86403 -6868 88873 -6990 91150 -7110 94211 -7228 96922 -7351 99445 -7469 102216 -7589 104968 -7711 108113 -7827 110758 -7950 113714 -8071 116511 -8186 119643 -8310 122679 -8425 125581 -8551 128715 -8669 131778 -8788 135116 -8910 138138 -9031 141628 -9148 144754 -9268 148367 -9391 151551 -9511 155033 -9631 158652 -9751 162125 -9871 165248 -9988 168627 -10111 172427 -10231 176412 diff --git a/libtommath/logs/sqr.log b/libtommath/logs/sqr.log deleted file mode 100644 index cd29fc5..0000000 --- a/libtommath/logs/sqr.log +++ /dev/null @@ -1,84 +0,0 @@ -265 562 -389 882 -509 1207 -631 1572 -750 1990 -859 2433 -991 2894 -1109 3555 -1230 4228 -1350 5018 -1471 5805 -1591 6579 -1709 7415 -1829 8329 -1949 9225 -2071 10139 -2188 11239 -2309 12178 -2431 13212 -2551 14294 -2671 15551 -2791 16512 -2911 17718 -3030 18876 -3150 20259 -3270 21374 -3391 22650 -3511 23948 -3631 25493 -3750 26756 -3870 28225 -3989 29705 -4110 31409 -4230 32834 -4351 34327 -4471 35818 -4591 37636 -4711 39228 -4830 40868 -4949 42393 -5070 44541 -5191 46269 -5310 48162 -5429 49728 -5548 51985 -5671 53948 -5791 55885 -5910 57584 -6031 60082 -6150 62239 -6270 64309 -6390 66014 -6511 68766 -6631 71012 -6750 73172 -6871 74952 -6991 77909 -7111 80371 -7231 82666 -7351 84531 -7469 87698 -7589 90318 -7711 225384 -7830 232428 -7950 240009 -8070 246522 -8190 253662 -8310 260961 -8431 269253 -8549 275743 -8671 283769 -8789 290811 -8911 300034 -9030 306873 -9149 315085 -9270 323944 -9390 332390 -9508 337519 -9631 348986 -9749 356904 -9871 367013 -9989 373831 -10108 381033 -10230 393475 diff --git a/libtommath/logs/sqr_kara.log b/libtommath/logs/sqr_kara.log deleted file mode 100644 index 06355a7..0000000 --- a/libtommath/logs/sqr_kara.log +++ /dev/null @@ -1,84 +0,0 @@ -271 560 -388 878 -511 1179 -629 1625 -751 1988 -871 2423 -989 2896 -1111 3561 -1231 4209 -1350 5015 -1470 5804 -1591 6556 -1709 7420 -1831 8263 -1951 9173 -2070 10153 -2191 11229 -2310 12167 -2431 13211 -2550 14309 -2671 15524 -2788 16525 -2910 17712 -3028 18822 -3148 20220 -3271 21343 -3391 22652 -3511 23944 -3630 25485 -3750 26778 -3868 28201 -3990 29653 -4111 31393 -4225 32841 -4350 34328 -4471 35786 -4590 37652 -4711 39245 -4830 40876 -4951 42433 -5068 44547 -5191 46321 -5311 48140 -5430 49727 -5550 52034 -5671 53954 -5791 55921 -5908 57597 -6031 60084 -6148 62226 -6270 64295 -6390 66045 -6511 68779 -6629 71003 -6751 73169 -6871 74992 -6991 77895 -7110 80376 -7231 82628 -7351 84468 -7470 87664 -7591 90284 -7711 91352 -7828 93995 -7950 96276 -8071 98691 -8190 101256 -8308 103631 -8431 105222 -8550 108343 -8671 110281 -8787 112764 -8911 115397 -9031 117690 -9151 120266 -9271 122715 -9391 124624 -9510 127937 -9630 130313 -9750 132914 -9871 136129 -9991 138517 -10108 141525 -10231 144225 diff --git a/libtommath/logs/sub.log b/libtommath/logs/sub.log deleted file mode 100644 index 9f84fa2..0000000 --- a/libtommath/logs/sub.log +++ /dev/null @@ -1,16 +0,0 @@ -480 94 -960 116 -1440 140 -1920 164 -2400 205 -2880 229 -3360 253 -3840 277 -4320 299 -4800 321 -5280 345 -5760 371 -6240 395 -6720 419 -7200 441 -7680 465 diff --git a/libtommath/makefile_include.mk b/libtommath/makefile_include.mk new file mode 100644 index 0000000..3a599e8 --- /dev/null +++ b/libtommath/makefile_include.mk @@ -0,0 +1,117 @@ +# +# Include makefile for libtommath +# + +#version of library +VERSION=1.0.1 +VERSION_PC=1.0.1 +VERSION_SO=1:1 + +PLATFORM := $(shell uname | sed -e 's/_.*//') + +# default make target +default: ${LIBNAME} + +# Compiler and Linker Names +ifndef CROSS_COMPILE + CROSS_COMPILE= +endif + +ifeq ($(CC),cc) + CC = $(CROSS_COMPILE)gcc +endif +LD=$(CROSS_COMPILE)ld +AR=$(CROSS_COMPILE)ar +RANLIB=$(CROSS_COMPILE)ranlib + +ifndef MAKE + MAKE=make +endif + +CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow + +ifndef NO_ADDTL_WARNINGS +# additional warnings +CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align +CFLAGS += -Wstrict-prototypes -Wpointer-arith +endif + +ifdef COMPILE_DEBUG +#debug +CFLAGS += -g3 +else + +ifdef COMPILE_SIZE +#for size +CFLAGS += -Os +else + +ifndef IGNORE_SPEED +#for speed +CFLAGS += -O3 -funroll-loops + +#x86 optimizations [should be valid for any GCC install though] +CFLAGS += -fomit-frame-pointer +endif + +endif # COMPILE_SIZE +endif # COMPILE_DEBUG + +ifneq ($(findstring clang,$(CC)),) +CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header +endif +ifeq ($(PLATFORM), Darwin) +CFLAGS += -Wno-nullability-completeness +endif + +# adjust coverage set +ifneq ($(filter $(shell arch), i386 i686 x86_64 amd64 ia64),) + COVERAGE = test_standalone timing + COVERAGE_APP = ./test && ./ltmtest +else + COVERAGE = test_standalone + COVERAGE_APP = ./test +endif + +HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h +HEADERS=tommath_private.h $(HEADERS_PUB) + +test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0 + +#LIBPATH The directory for libtommath to be installed to. +#INCPATH The directory to install the header files for libtommath. +#DATAPATH The directory to install the pdf docs. +DESTDIR ?= +PREFIX ?= /usr/local +LIBPATH ?= $(PREFIX)/lib +INCPATH ?= $(PREFIX)/include +DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf + +#make the code coverage of the library +# +coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS +coverage: LFLAGS += -lgcov +coverage: LDFLAGS += -lgcov + +coverage: $(COVERAGE) + $(COVERAGE_APP) + +lcov: coverage + rm -f coverage.info + lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q + genhtml coverage.info --output-directory coverage -q + +# target that removes all coverage output +cleancov-clean: + rm -f `find . -type f -name "*.info" | xargs` + rm -rf coverage/ + +# cleans everything - coverage output and standard 'clean' +cleancov: cleancov-clean clean + +clean: + rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \ + *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la + rm -rf .libs/ + ${MAKE} -C etc/ clean MAKE=${MAKE} + ${MAKE} -C doc/ clean MAKE=${MAKE} diff --git a/libtommath/mess.sh b/libtommath/mess.sh deleted file mode 100644 index bf639ce..0000000 --- a/libtommath/mess.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -if cvs log $1 >/dev/null 2>/dev/null; then exit 0; else echo "$1 shouldn't be here" ; exit 1; fi - - diff --git a/libtommath/mtest/logtab.h b/libtommath/mtest/logtab.h deleted file mode 100644 index 751111e..0000000 --- a/libtommath/mtest/logtab.h +++ /dev/null @@ -1,24 +0,0 @@ -const float s_logv_2[] = { - 0.000000000, 0.000000000, 1.000000000, 0.630929754, /* 0 1 2 3 */ - 0.500000000, 0.430676558, 0.386852807, 0.356207187, /* 4 5 6 7 */ - 0.333333333, 0.315464877, 0.301029996, 0.289064826, /* 8 9 10 11 */ - 0.278942946, 0.270238154, 0.262649535, 0.255958025, /* 12 13 14 15 */ - 0.250000000, 0.244650542, 0.239812467, 0.235408913, /* 16 17 18 19 */ - 0.231378213, 0.227670249, 0.224243824, 0.221064729, /* 20 21 22 23 */ - 0.218104292, 0.215338279, 0.212746054, 0.210309918, /* 24 25 26 27 */ - 0.208014598, 0.205846832, 0.203795047, 0.201849087, /* 28 29 30 31 */ - 0.200000000, 0.198239863, 0.196561632, 0.194959022, /* 32 33 34 35 */ - 0.193426404, 0.191958720, 0.190551412, 0.189200360, /* 36 37 38 39 */ - 0.187901825, 0.186652411, 0.185449023, 0.184288833, /* 40 41 42 43 */ - 0.183169251, 0.182087900, 0.181042597, 0.180031327, /* 44 45 46 47 */ - 0.179052232, 0.178103594, 0.177183820, 0.176291434, /* 48 49 50 51 */ - 0.175425064, 0.174583430, 0.173765343, 0.172969690, /* 52 53 54 55 */ - 0.172195434, 0.171441601, 0.170707280, 0.169991616, /* 56 57 58 59 */ - 0.169293808, 0.168613099, 0.167948779, 0.167300179, /* 60 61 62 63 */ - 0.166666667 -}; - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi-config.h b/libtommath/mtest/mpi-config.h deleted file mode 100644 index fc2a885..0000000 --- a/libtommath/mtest/mpi-config.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Default configuration for MPI library */ -/* $Id$ */ - -#ifndef MPI_CONFIG_H_ -#define MPI_CONFIG_H_ - -/* - For boolean options, - 0 = no - 1 = yes - - Other options are documented individually. - - */ - -#ifndef MP_IOFUNC -#define MP_IOFUNC 0 /* include mp_print() ? */ -#endif - -#ifndef MP_MODARITH -#define MP_MODARITH 1 /* include modular arithmetic ? */ -#endif - -#ifndef MP_NUMTH -#define MP_NUMTH 1 /* include number theoretic functions? */ -#endif - -#ifndef MP_LOGTAB -#define MP_LOGTAB 1 /* use table of logs instead of log()? */ -#endif - -#ifndef MP_MEMSET -#define MP_MEMSET 1 /* use memset() to zero buffers? */ -#endif - -#ifndef MP_MEMCPY -#define MP_MEMCPY 1 /* use memcpy() to copy buffers? */ -#endif - -#ifndef MP_CRYPTO -#define MP_CRYPTO 1 /* erase memory on free? */ -#endif - -#ifndef MP_ARGCHK -/* - 0 = no parameter checks - 1 = runtime checks, continue execution and return an error to caller - 2 = assertions; dump core on parameter errors - */ -#define MP_ARGCHK 2 /* how to check input arguments */ -#endif - -#ifndef MP_DEBUG -#define MP_DEBUG 0 /* print diagnostic output? */ -#endif - -#ifndef MP_DEFPREC -#define MP_DEFPREC 64 /* default precision, in digits */ -#endif - -#ifndef MP_MACRO -#define MP_MACRO 1 /* use macros for frequent calls? */ -#endif - -#ifndef MP_SQUARE -#define MP_SQUARE 1 /* use separate squaring code? */ -#endif - -#ifndef MP_PTAB_SIZE -/* - When building mpprime.c, we build in a table of small prime - values to use for primality testing. The more you include, - the more space they take up. See primes.c for the possible - values (currently 16, 32, 64, 128, 256, and 6542) - */ -#define MP_PTAB_SIZE 128 /* how many built-in primes? */ -#endif - -#ifndef MP_COMPAT_MACROS -#define MP_COMPAT_MACROS 1 /* define compatibility macros? */ -#endif - -#endif /* ifndef MPI_CONFIG_H_ */ - - -/* crc==3287762869, version==2, Sat Feb 02 06:43:53 2002 */ - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi-types.h b/libtommath/mtest/mpi-types.h deleted file mode 100644 index f99d7ee..0000000 --- a/libtommath/mtest/mpi-types.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Type definitions generated by 'types.pl' */ -typedef char mp_sign; -typedef unsigned short mp_digit; /* 2 byte type */ -typedef unsigned int mp_word; /* 4 byte type */ -typedef unsigned int mp_size; -typedef int mp_err; - -#define MP_DIGIT_BIT (CHAR_BIT*sizeof(mp_digit)) -#define MP_DIGIT_MAX USHRT_MAX -#define MP_WORD_BIT (CHAR_BIT*sizeof(mp_word)) -#define MP_WORD_MAX UINT_MAX - -#define MP_DIGIT_SIZE 2 -#define DIGIT_FMT "%04X" -#define RADIX (MP_DIGIT_MAX+1) - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi.c b/libtommath/mtest/mpi.c deleted file mode 100644 index 48dbe27..0000000 --- a/libtommath/mtest/mpi.c +++ /dev/null @@ -1,3985 +0,0 @@ -/* - mpi.c - - by Michael J. Fromberger - Copyright (C) 1998 Michael J. Fromberger, All Rights Reserved - - Arbitrary precision integer arithmetic library - - $Id$ - */ - -#include "mpi.h" -#include -#include -#include - -#if MP_DEBUG -#include - -#define DIAG(T,V) {fprintf(stderr,T);mp_print(V,stderr);fputc('\n',stderr);} -#else -#define DIAG(T,V) -#endif - -/* - If MP_LOGTAB is not defined, use the math library to compute the - logarithms on the fly. Otherwise, use the static table below. - Pick which works best for your system. - */ -#if MP_LOGTAB - -/* {{{ s_logv_2[] - log table for 2 in various bases */ - -/* - A table of the logs of 2 for various bases (the 0 and 1 entries of - this table are meaningless and should not be referenced). - - This table is used to compute output lengths for the mp_toradix() - function. Since a number n in radix r takes up about log_r(n) - digits, we estimate the output size by taking the least integer - greater than log_r(n), where: - - log_r(n) = log_2(n) * log_r(2) - - This table, therefore, is a table of log_r(2) for 2 <= r <= 36, - which are the output bases supported. - */ - -#include "logtab.h" - -/* }}} */ -#define LOG_V_2(R) s_logv_2[(R)] - -#else - -#include -#define LOG_V_2(R) (log(2.0)/log(R)) - -#endif - -/* Default precision for newly created mp_int's */ -static unsigned int s_mp_defprec = MP_DEFPREC; - -/* {{{ Digit arithmetic macros */ - -/* - When adding and multiplying digits, the results can be larger than - can be contained in an mp_digit. Thus, an mp_word is used. These - macros mask off the upper and lower digits of the mp_word (the - mp_word may be more than 2 mp_digits wide, but we only concern - ourselves with the low-order 2 mp_digits) - - If your mp_word DOES have more than 2 mp_digits, you need to - uncomment the first line, and comment out the second. - */ - -/* #define CARRYOUT(W) (((W)>>DIGIT_BIT)&MP_DIGIT_MAX) */ -#define CARRYOUT(W) ((W)>>DIGIT_BIT) -#define ACCUM(W) ((W)&MP_DIGIT_MAX) - -/* }}} */ - -/* {{{ Comparison constants */ - -#define MP_LT -1 -#define MP_EQ 0 -#define MP_GT 1 - -/* }}} */ - -/* {{{ Constant strings */ - -/* Constant strings returned by mp_strerror() */ -static const char *mp_err_string[] = { - "unknown result code", /* say what? */ - "boolean true", /* MP_OKAY, MP_YES */ - "boolean false", /* MP_NO */ - "out of memory", /* MP_MEM */ - "argument out of range", /* MP_RANGE */ - "invalid input parameter", /* MP_BADARG */ - "result is undefined" /* MP_UNDEF */ -}; - -/* Value to digit maps for radix conversion */ - -/* s_dmap_1 - standard digits and letters */ -static const char *s_dmap_1 = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; - -#if 0 -/* s_dmap_2 - base64 ordering for digits */ -static const char *s_dmap_2 = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -#endif - -/* }}} */ - -/* {{{ Static function declarations */ - -/* - If MP_MACRO is false, these will be defined as actual functions; - otherwise, suitable macro definitions will be used. This works - around the fact that ANSI C89 doesn't support an 'inline' keyword - (although I hear C9x will ... about bloody time). At present, the - macro definitions are identical to the function bodies, but they'll - expand in place, instead of generating a function call. - - I chose these particular functions to be made into macros because - some profiling showed they are called a lot on a typical workload, - and yet they are primarily housekeeping. - */ -#if MP_MACRO == 0 - void s_mp_setz(mp_digit *dp, mp_size count); /* zero digits */ - void s_mp_copy(mp_digit *sp, mp_digit *dp, mp_size count); /* copy */ - void *s_mp_alloc(size_t nb, size_t ni); /* general allocator */ - void s_mp_free(void *ptr); /* general free function */ -#else - - /* Even if these are defined as macros, we need to respect the settings - of the MP_MEMSET and MP_MEMCPY configuration options... - */ - #if MP_MEMSET == 0 - #define s_mp_setz(dp, count) \ - {int ix;for(ix=0;ix<(count);ix++)(dp)[ix]=0;} - #else - #define s_mp_setz(dp, count) memset(dp, 0, (count) * sizeof(mp_digit)) - #endif /* MP_MEMSET */ - - #if MP_MEMCPY == 0 - #define s_mp_copy(sp, dp, count) \ - {int ix;for(ix=0;ix<(count);ix++)(dp)[ix]=(sp)[ix];} - #else - #define s_mp_copy(sp, dp, count) memcpy(dp, sp, (count) * sizeof(mp_digit)) - #endif /* MP_MEMCPY */ - - #define s_mp_alloc(nb, ni) calloc(nb, ni) - #define s_mp_free(ptr) {if(ptr) free(ptr);} -#endif /* MP_MACRO */ - -mp_err s_mp_grow(mp_int *mp, mp_size min); /* increase allocated size */ -mp_err s_mp_pad(mp_int *mp, mp_size min); /* left pad with zeroes */ - -void s_mp_clamp(mp_int *mp); /* clip leading zeroes */ - -void s_mp_exch(mp_int *a, mp_int *b); /* swap a and b in place */ - -mp_err s_mp_lshd(mp_int *mp, mp_size p); /* left-shift by p digits */ -void s_mp_rshd(mp_int *mp, mp_size p); /* right-shift by p digits */ -void s_mp_div_2d(mp_int *mp, mp_digit d); /* divide by 2^d in place */ -void s_mp_mod_2d(mp_int *mp, mp_digit d); /* modulo 2^d in place */ -mp_err s_mp_mul_2d(mp_int *mp, mp_digit d); /* multiply by 2^d in place*/ -void s_mp_div_2(mp_int *mp); /* divide by 2 in place */ -mp_err s_mp_mul_2(mp_int *mp); /* multiply by 2 in place */ -mp_digit s_mp_norm(mp_int *a, mp_int *b); /* normalize for division */ -mp_err s_mp_add_d(mp_int *mp, mp_digit d); /* unsigned digit addition */ -mp_err s_mp_sub_d(mp_int *mp, mp_digit d); /* unsigned digit subtract */ -mp_err s_mp_mul_d(mp_int *mp, mp_digit d); /* unsigned digit multiply */ -mp_err s_mp_div_d(mp_int *mp, mp_digit d, mp_digit *r); - /* unsigned digit divide */ -mp_err s_mp_reduce(mp_int *x, mp_int *m, mp_int *mu); - /* Barrett reduction */ -mp_err s_mp_add(mp_int *a, mp_int *b); /* magnitude addition */ -mp_err s_mp_sub(mp_int *a, mp_int *b); /* magnitude subtract */ -mp_err s_mp_mul(mp_int *a, mp_int *b); /* magnitude multiply */ -#if 0 -void s_mp_kmul(mp_digit *a, mp_digit *b, mp_digit *out, mp_size len); - /* multiply buffers in place */ -#endif -#if MP_SQUARE -mp_err s_mp_sqr(mp_int *a); /* magnitude square */ -#else -#define s_mp_sqr(a) s_mp_mul(a, a) -#endif -mp_err s_mp_div(mp_int *a, mp_int *b); /* magnitude divide */ -mp_err s_mp_2expt(mp_int *a, mp_digit k); /* a = 2^k */ -int s_mp_cmp(mp_int *a, mp_int *b); /* magnitude comparison */ -int s_mp_cmp_d(mp_int *a, mp_digit d); /* magnitude digit compare */ -int s_mp_ispow2(mp_int *v); /* is v a power of 2? */ -int s_mp_ispow2d(mp_digit d); /* is d a power of 2? */ - -int s_mp_tovalue(char ch, int r); /* convert ch to value */ -char s_mp_todigit(int val, int r, int low); /* convert val to digit */ -int s_mp_outlen(int bits, int r); /* output length in bytes */ - -/* }}} */ - -/* {{{ Default precision manipulation */ - -unsigned int mp_get_prec(void) -{ - return s_mp_defprec; - -} /* end mp_get_prec() */ - -void mp_set_prec(unsigned int prec) -{ - if(prec == 0) - s_mp_defprec = MP_DEFPREC; - else - s_mp_defprec = prec; - -} /* end mp_set_prec() */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ mp_init(mp) */ - -/* - mp_init(mp) - - Initialize a new zero-valued mp_int. Returns MP_OKAY if successful, - MP_MEM if memory could not be allocated for the structure. - */ - -mp_err mp_init(mp_int *mp) -{ - return mp_init_size(mp, s_mp_defprec); - -} /* end mp_init() */ - -/* }}} */ - -/* {{{ mp_init_array(mp[], count) */ - -mp_err mp_init_array(mp_int mp[], int count) -{ - mp_err res; - int pos; - - ARGCHK(mp !=NULL && count > 0, MP_BADARG); - - for(pos = 0; pos < count; ++pos) { - if((res = mp_init(&mp[pos])) != MP_OKAY) - goto CLEANUP; - } - - return MP_OKAY; - - CLEANUP: - while(--pos >= 0) - mp_clear(&mp[pos]); - - return res; - -} /* end mp_init_array() */ - -/* }}} */ - -/* {{{ mp_init_size(mp, prec) */ - -/* - mp_init_size(mp, prec) - - Initialize a new zero-valued mp_int with at least the given - precision; returns MP_OKAY if successful, or MP_MEM if memory could - not be allocated for the structure. - */ - -mp_err mp_init_size(mp_int *mp, mp_size prec) -{ - ARGCHK(mp != NULL && prec > 0, MP_BADARG); - - if((DIGITS(mp) = s_mp_alloc(prec, sizeof(mp_digit))) == NULL) - return MP_MEM; - - SIGN(mp) = MP_ZPOS; - USED(mp) = 1; - ALLOC(mp) = prec; - - return MP_OKAY; - -} /* end mp_init_size() */ - -/* }}} */ - -/* {{{ mp_init_copy(mp, from) */ - -/* - mp_init_copy(mp, from) - - Initialize mp as an exact copy of from. Returns MP_OKAY if - successful, MP_MEM if memory could not be allocated for the new - structure. - */ - -mp_err mp_init_copy(mp_int *mp, mp_int *from) -{ - ARGCHK(mp != NULL && from != NULL, MP_BADARG); - - if(mp == from) - return MP_OKAY; - - if((DIGITS(mp) = s_mp_alloc(USED(from), sizeof(mp_digit))) == NULL) - return MP_MEM; - - s_mp_copy(DIGITS(from), DIGITS(mp), USED(from)); - USED(mp) = USED(from); - ALLOC(mp) = USED(from); - SIGN(mp) = SIGN(from); - - return MP_OKAY; - -} /* end mp_init_copy() */ - -/* }}} */ - -/* {{{ mp_copy(from, to) */ - -/* - mp_copy(from, to) - - Copies the mp_int 'from' to the mp_int 'to'. It is presumed that - 'to' has already been initialized (if not, use mp_init_copy() - instead). If 'from' and 'to' are identical, nothing happens. - */ - -mp_err mp_copy(mp_int *from, mp_int *to) -{ - ARGCHK(from != NULL && to != NULL, MP_BADARG); - - if(from == to) - return MP_OKAY; - - { /* copy */ - mp_digit *tmp; - - /* - If the allocated buffer in 'to' already has enough space to hold - all the used digits of 'from', we'll re-use it to avoid hitting - the memory allocater more than necessary; otherwise, we'd have - to grow anyway, so we just allocate a hunk and make the copy as - usual - */ - if(ALLOC(to) >= USED(from)) { - s_mp_setz(DIGITS(to) + USED(from), ALLOC(to) - USED(from)); - s_mp_copy(DIGITS(from), DIGITS(to), USED(from)); - - } else { - if((tmp = s_mp_alloc(USED(from), sizeof(mp_digit))) == NULL) - return MP_MEM; - - s_mp_copy(DIGITS(from), tmp, USED(from)); - - if(DIGITS(to) != NULL) { -#if MP_CRYPTO - s_mp_setz(DIGITS(to), ALLOC(to)); -#endif - s_mp_free(DIGITS(to)); - } - - DIGITS(to) = tmp; - ALLOC(to) = USED(from); - } - - /* Copy the precision and sign from the original */ - USED(to) = USED(from); - SIGN(to) = SIGN(from); - } /* end copy */ - - return MP_OKAY; - -} /* end mp_copy() */ - -/* }}} */ - -/* {{{ mp_exch(mp1, mp2) */ - -/* - mp_exch(mp1, mp2) - - Exchange mp1 and mp2 without allocating any intermediate memory - (well, unless you count the stack space needed for this call and the - locals it creates...). This cannot fail. - */ - -void mp_exch(mp_int *mp1, mp_int *mp2) -{ -#if MP_ARGCHK == 2 - assert(mp1 != NULL && mp2 != NULL); -#else - if(mp1 == NULL || mp2 == NULL) - return; -#endif - - s_mp_exch(mp1, mp2); - -} /* end mp_exch() */ - -/* }}} */ - -/* {{{ mp_clear(mp) */ - -/* - mp_clear(mp) - - Release the storage used by an mp_int, and void its fields so that - if someone calls mp_clear() again for the same int later, we won't - get tollchocked. - */ - -void mp_clear(mp_int *mp) -{ - if(mp == NULL) - return; - - if(DIGITS(mp) != NULL) { -#if MP_CRYPTO - s_mp_setz(DIGITS(mp), ALLOC(mp)); -#endif - s_mp_free(DIGITS(mp)); - DIGITS(mp) = NULL; - } - - USED(mp) = 0; - ALLOC(mp) = 0; - -} /* end mp_clear() */ - -/* }}} */ - -/* {{{ mp_clear_array(mp[], count) */ - -void mp_clear_array(mp_int mp[], int count) -{ - ARGCHK(mp != NULL && count > 0, MP_BADARG); - - while(--count >= 0) - mp_clear(&mp[count]); - -} /* end mp_clear_array() */ - -/* }}} */ - -/* {{{ mp_zero(mp) */ - -/* - mp_zero(mp) - - Set mp to zero. Does not change the allocated size of the structure, - and therefore cannot fail (except on a bad argument, which we ignore) - */ -void mp_zero(mp_int *mp) -{ - if(mp == NULL) - return; - - s_mp_setz(DIGITS(mp), ALLOC(mp)); - USED(mp) = 1; - SIGN(mp) = MP_ZPOS; - -} /* end mp_zero() */ - -/* }}} */ - -/* {{{ mp_set(mp, d) */ - -void mp_set(mp_int *mp, mp_digit d) -{ - if(mp == NULL) - return; - - mp_zero(mp); - DIGIT(mp, 0) = d; - -} /* end mp_set() */ - -/* }}} */ - -/* {{{ mp_set_int(mp, z) */ - -mp_err mp_set_int(mp_int *mp, long z) -{ - int ix; - unsigned long v = abs(z); - mp_err res; - - ARGCHK(mp != NULL, MP_BADARG); - - mp_zero(mp); - if(z == 0) - return MP_OKAY; /* shortcut for zero */ - - for(ix = sizeof(long) - 1; ix >= 0; ix--) { - - if((res = s_mp_mul_2d(mp, CHAR_BIT)) != MP_OKAY) - return res; - - res = s_mp_add_d(mp, - (mp_digit)((v >> (ix * CHAR_BIT)) & UCHAR_MAX)); - if(res != MP_OKAY) - return res; - - } - - if(z < 0) - SIGN(mp) = MP_NEG; - - return MP_OKAY; - -} /* end mp_set_int() */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Digit arithmetic */ - -/* {{{ mp_add_d(a, d, b) */ - -/* - mp_add_d(a, d, b) - - Compute the sum b = a + d, for a single digit d. Respects the sign of - its primary addend (single digits are unsigned anyway). - */ - -mp_err mp_add_d(mp_int *a, mp_digit d, mp_int *b) -{ - mp_err res = MP_OKAY; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if(SIGN(b) == MP_ZPOS) { - res = s_mp_add_d(b, d); - } else if(s_mp_cmp_d(b, d) >= 0) { - res = s_mp_sub_d(b, d); - } else { - SIGN(b) = MP_ZPOS; - - DIGIT(b, 0) = d - DIGIT(b, 0); - } - - return res; - -} /* end mp_add_d() */ - -/* }}} */ - -/* {{{ mp_sub_d(a, d, b) */ - -/* - mp_sub_d(a, d, b) - - Compute the difference b = a - d, for a single digit d. Respects the - sign of its subtrahend (single digits are unsigned anyway). - */ - -mp_err mp_sub_d(mp_int *a, mp_digit d, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if(SIGN(b) == MP_NEG) { - if((res = s_mp_add_d(b, d)) != MP_OKAY) - return res; - - } else if(s_mp_cmp_d(b, d) >= 0) { - if((res = s_mp_sub_d(b, d)) != MP_OKAY) - return res; - - } else { - mp_neg(b, b); - - DIGIT(b, 0) = d - DIGIT(b, 0); - SIGN(b) = MP_NEG; - } - - if(s_mp_cmp_d(b, 0) == 0) - SIGN(b) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_sub_d() */ - -/* }}} */ - -/* {{{ mp_mul_d(a, d, b) */ - -/* - mp_mul_d(a, d, b) - - Compute the product b = a * d, for a single digit d. Respects the sign - of its multiplicand (single digits are unsigned anyway) - */ - -mp_err mp_mul_d(mp_int *a, mp_digit d, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if(d == 0) { - mp_zero(b); - return MP_OKAY; - } - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - res = s_mp_mul_d(b, d); - - return res; - -} /* end mp_mul_d() */ - -/* }}} */ - -/* {{{ mp_mul_2(a, c) */ - -mp_err mp_mul_2(mp_int *a, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - return s_mp_mul_2(c); - -} /* end mp_mul_2() */ - -/* }}} */ - -/* {{{ mp_div_d(a, d, q, r) */ - -/* - mp_div_d(a, d, q, r) - - Compute the quotient q = a / d and remainder r = a mod d, for a - single digit d. Respects the sign of its divisor (single digits are - unsigned anyway). - */ - -mp_err mp_div_d(mp_int *a, mp_digit d, mp_int *q, mp_digit *r) -{ - mp_err res; - mp_digit rem; - int pow; - - ARGCHK(a != NULL, MP_BADARG); - - if(d == 0) - return MP_RANGE; - - /* Shortcut for powers of two ... */ - if((pow = s_mp_ispow2d(d)) >= 0) { - mp_digit mask; - - mask = (1 << pow) - 1; - rem = DIGIT(a, 0) & mask; - - if(q) { - mp_copy(a, q); - s_mp_div_2d(q, pow); - } - - if(r) - *r = rem; - - return MP_OKAY; - } - - /* - If the quotient is actually going to be returned, we'll try to - avoid hitting the memory allocator by copying the dividend into it - and doing the division there. This can't be any _worse_ than - always copying, and will sometimes be better (since it won't make - another copy) - - If it's not going to be returned, we need to allocate a temporary - to hold the quotient, which will just be discarded. - */ - if(q) { - if((res = mp_copy(a, q)) != MP_OKAY) - return res; - - res = s_mp_div_d(q, d, &rem); - if(s_mp_cmp_d(q, 0) == MP_EQ) - SIGN(q) = MP_ZPOS; - - } else { - mp_int qp; - - if((res = mp_init_copy(&qp, a)) != MP_OKAY) - return res; - - res = s_mp_div_d(&qp, d, &rem); - if(s_mp_cmp_d(&qp, 0) == 0) - SIGN(&qp) = MP_ZPOS; - - mp_clear(&qp); - } - - if(r) - *r = rem; - - return res; - -} /* end mp_div_d() */ - -/* }}} */ - -/* {{{ mp_div_2(a, c) */ - -/* - mp_div_2(a, c) - - Compute c = a / 2, disregarding the remainder. - */ - -mp_err mp_div_2(mp_int *a, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - s_mp_div_2(c); - - return MP_OKAY; - -} /* end mp_div_2() */ - -/* }}} */ - -/* {{{ mp_expt_d(a, d, b) */ - -mp_err mp_expt_d(mp_int *a, mp_digit d, mp_int *c) -{ - mp_int s, x; - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_init(&s)) != MP_OKAY) - return res; - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - - DIGIT(&s, 0) = 1; - - while(d != 0) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - } - - s_mp_exch(&s, c); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&s); - - return res; - -} /* end mp_expt_d() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Full arithmetic */ - -/* {{{ mp_abs(a, b) */ - -/* - mp_abs(a, b) - - Compute b = |a|. 'a' and 'b' may be identical. - */ - -mp_err mp_abs(mp_int *a, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - SIGN(b) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_abs() */ - -/* }}} */ - -/* {{{ mp_neg(a, b) */ - -/* - mp_neg(a, b) - - Compute b = -a. 'a' and 'b' may be identical. - */ - -mp_err mp_neg(mp_int *a, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if(s_mp_cmp_d(b, 0) == MP_EQ) - SIGN(b) = MP_ZPOS; - else - SIGN(b) = (SIGN(b) == MP_NEG) ? MP_ZPOS : MP_NEG; - - return MP_OKAY; - -} /* end mp_neg() */ - -/* }}} */ - -/* {{{ mp_add(a, b, c) */ - -/* - mp_add(a, b, c) - - Compute c = a + b. All parameters may be identical. - */ - -mp_err mp_add(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - int cmp; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(SIGN(a) == SIGN(b)) { /* same sign: add values, keep sign */ - - /* Commutativity of addition lets us do this in either order, - so we avoid having to use a temporary even if the result - is supposed to replace the output - */ - if(c == b) { - if((res = s_mp_add(c, a)) != MP_OKAY) - return res; - } else { - if(c != a && (res = mp_copy(a, c)) != MP_OKAY) - return res; - - if((res = s_mp_add(c, b)) != MP_OKAY) - return res; - } - - } else if((cmp = s_mp_cmp(a, b)) > 0) { /* different sign: a > b */ - - /* If the output is going to be clobbered, we will use a temporary - variable; otherwise, we'll do it without touching the memory - allocator at all, if possible - */ - if(c == b) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, a)) != MP_OKAY) - return res; - if((res = s_mp_sub(&tmp, b)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - - if(c != a && (res = mp_copy(a, c)) != MP_OKAY) - return res; - if((res = s_mp_sub(c, b)) != MP_OKAY) - return res; - - } - - } else if(cmp == 0) { /* different sign, a == b */ - - mp_zero(c); - return MP_OKAY; - - } else { /* different sign: a < b */ - - /* See above... */ - if(c == a) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, b)) != MP_OKAY) - return res; - if((res = s_mp_sub(&tmp, a)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - - if(c != b && (res = mp_copy(b, c)) != MP_OKAY) - return res; - if((res = s_mp_sub(c, a)) != MP_OKAY) - return res; - - } - } - - if(USED(c) == 1 && DIGIT(c, 0) == 0) - SIGN(c) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_add() */ - -/* }}} */ - -/* {{{ mp_sub(a, b, c) */ - -/* - mp_sub(a, b, c) - - Compute c = a - b. All parameters may be identical. - */ - -mp_err mp_sub(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - int cmp; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(SIGN(a) != SIGN(b)) { - if(c == a) { - if((res = s_mp_add(c, b)) != MP_OKAY) - return res; - } else { - if(c != b && ((res = mp_copy(b, c)) != MP_OKAY)) - return res; - if((res = s_mp_add(c, a)) != MP_OKAY) - return res; - SIGN(c) = SIGN(a); - } - - } else if((cmp = s_mp_cmp(a, b)) > 0) { /* Same sign, a > b */ - if(c == b) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, a)) != MP_OKAY) - return res; - if((res = s_mp_sub(&tmp, b)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - if(c != a && ((res = mp_copy(a, c)) != MP_OKAY)) - return res; - - if((res = s_mp_sub(c, b)) != MP_OKAY) - return res; - } - - } else if(cmp == 0) { /* Same sign, equal magnitude */ - mp_zero(c); - return MP_OKAY; - - } else { /* Same sign, b > a */ - if(c == a) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, b)) != MP_OKAY) - return res; - - if((res = s_mp_sub(&tmp, a)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - if(c != b && ((res = mp_copy(b, c)) != MP_OKAY)) - return res; - - if((res = s_mp_sub(c, a)) != MP_OKAY) - return res; - } - - SIGN(c) = !SIGN(b); - } - - if(USED(c) == 1 && DIGIT(c, 0) == 0) - SIGN(c) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_sub() */ - -/* }}} */ - -/* {{{ mp_mul(a, b, c) */ - -/* - mp_mul(a, b, c) - - Compute c = a * b. All parameters may be identical. - */ - -mp_err mp_mul(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - mp_sign sgn; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - sgn = (SIGN(a) == SIGN(b)) ? MP_ZPOS : MP_NEG; - - if(c == b) { - if((res = s_mp_mul(c, a)) != MP_OKAY) - return res; - - } else { - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - if((res = s_mp_mul(c, b)) != MP_OKAY) - return res; - } - - if(sgn == MP_ZPOS || s_mp_cmp_d(c, 0) == MP_EQ) - SIGN(c) = MP_ZPOS; - else - SIGN(c) = sgn; - - return MP_OKAY; - -} /* end mp_mul() */ - -/* }}} */ - -/* {{{ mp_mul_2d(a, d, c) */ - -/* - mp_mul_2d(a, d, c) - - Compute c = a * 2^d. a may be the same as c. - */ - -mp_err mp_mul_2d(mp_int *a, mp_digit d, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - if(d == 0) - return MP_OKAY; - - return s_mp_mul_2d(c, d); - -} /* end mp_mul() */ - -/* }}} */ - -/* {{{ mp_sqr(a, b) */ - -#if MP_SQUARE -mp_err mp_sqr(mp_int *a, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if((res = s_mp_sqr(b)) != MP_OKAY) - return res; - - SIGN(b) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_sqr() */ -#endif - -/* }}} */ - -/* {{{ mp_div(a, b, q, r) */ - -/* - mp_div(a, b, q, r) - - Compute q = a / b and r = a mod b. Input parameters may be re-used - as output parameters. If q or r is NULL, that portion of the - computation will be discarded (although it will still be computed) - - Pay no attention to the hacker behind the curtain. - */ - -mp_err mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r) -{ - mp_err res; - mp_int qtmp, rtmp; - int cmp; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if(mp_cmp_z(b) == MP_EQ) - return MP_RANGE; - - /* If a <= b, we can compute the solution without division, and - avoid any memory allocation - */ - if((cmp = s_mp_cmp(a, b)) < 0) { - if(r) { - if((res = mp_copy(a, r)) != MP_OKAY) - return res; - } - - if(q) - mp_zero(q); - - return MP_OKAY; - - } else if(cmp == 0) { - - /* Set quotient to 1, with appropriate sign */ - if(q) { - int qneg = (SIGN(a) != SIGN(b)); - - mp_set(q, 1); - if(qneg) - SIGN(q) = MP_NEG; - } - - if(r) - mp_zero(r); - - return MP_OKAY; - } - - /* If we get here, it means we actually have to do some division */ - - /* Set up some temporaries... */ - if((res = mp_init_copy(&qtmp, a)) != MP_OKAY) - return res; - if((res = mp_init_copy(&rtmp, b)) != MP_OKAY) - goto CLEANUP; - - if((res = s_mp_div(&qtmp, &rtmp)) != MP_OKAY) - goto CLEANUP; - - /* Compute the signs for the output */ - SIGN(&rtmp) = SIGN(a); /* Sr = Sa */ - if(SIGN(a) == SIGN(b)) - SIGN(&qtmp) = MP_ZPOS; /* Sq = MP_ZPOS if Sa = Sb */ - else - SIGN(&qtmp) = MP_NEG; /* Sq = MP_NEG if Sa != Sb */ - - if(s_mp_cmp_d(&qtmp, 0) == MP_EQ) - SIGN(&qtmp) = MP_ZPOS; - if(s_mp_cmp_d(&rtmp, 0) == MP_EQ) - SIGN(&rtmp) = MP_ZPOS; - - /* Copy output, if it is needed */ - if(q) - s_mp_exch(&qtmp, q); - - if(r) - s_mp_exch(&rtmp, r); - -CLEANUP: - mp_clear(&rtmp); - mp_clear(&qtmp); - - return res; - -} /* end mp_div() */ - -/* }}} */ - -/* {{{ mp_div_2d(a, d, q, r) */ - -mp_err mp_div_2d(mp_int *a, mp_digit d, mp_int *q, mp_int *r) -{ - mp_err res; - - ARGCHK(a != NULL, MP_BADARG); - - if(q) { - if((res = mp_copy(a, q)) != MP_OKAY) - return res; - - s_mp_div_2d(q, d); - } - - if(r) { - if((res = mp_copy(a, r)) != MP_OKAY) - return res; - - s_mp_mod_2d(r, d); - } - - return MP_OKAY; - -} /* end mp_div_2d() */ - -/* }}} */ - -/* {{{ mp_expt(a, b, c) */ - -/* - mp_expt(a, b, c) - - Compute c = a ** b, that is, raise a to the b power. Uses a - standard iterative square-and-multiply technique. - */ - -mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c) -{ - mp_int s, x; - mp_err res; - mp_digit d; - unsigned int bit, dig; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(mp_cmp_z(b) < 0) - return MP_RANGE; - - if((res = mp_init(&s)) != MP_OKAY) - return res; - - mp_set(&s, 1); - - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - - /* Loop over low-order digits in ascending order */ - for(dig = 0; dig < (USED(b) - 1); dig++) { - d = DIGIT(b, dig); - - /* Loop over bits of each non-maximal digit */ - for(bit = 0; bit < DIGIT_BIT; bit++) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - } - } - - /* Consider now the last digit... */ - d = DIGIT(b, dig); - - while(d) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - } - - if(mp_iseven(b)) - SIGN(&s) = SIGN(a); - - res = mp_copy(&s, c); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&s); - - return res; - -} /* end mp_expt() */ - -/* }}} */ - -/* {{{ mp_2expt(a, k) */ - -/* Compute a = 2^k */ - -mp_err mp_2expt(mp_int *a, mp_digit k) -{ - ARGCHK(a != NULL, MP_BADARG); - - return s_mp_2expt(a, k); - -} /* end mp_2expt() */ - -/* }}} */ - -/* {{{ mp_mod(a, m, c) */ - -/* - mp_mod(a, m, c) - - Compute c = a (mod m). Result will always be 0 <= c < m. - */ - -mp_err mp_mod(mp_int *a, mp_int *m, mp_int *c) -{ - mp_err res; - int mag; - - ARGCHK(a != NULL && m != NULL && c != NULL, MP_BADARG); - - if(SIGN(m) == MP_NEG) - return MP_RANGE; - - /* - If |a| > m, we need to divide to get the remainder and take the - absolute value. - - If |a| < m, we don't need to do any division, just copy and adjust - the sign (if a is negative). - - If |a| == m, we can simply set the result to zero. - - This order is intended to minimize the average path length of the - comparison chain on common workloads -- the most frequent cases are - that |a| != m, so we do those first. - */ - if((mag = s_mp_cmp(a, m)) > 0) { - if((res = mp_div(a, m, NULL, c)) != MP_OKAY) - return res; - - if(SIGN(c) == MP_NEG) { - if((res = mp_add(c, m, c)) != MP_OKAY) - return res; - } - - } else if(mag < 0) { - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - if(mp_cmp_z(a) < 0) { - if((res = mp_add(c, m, c)) != MP_OKAY) - return res; - - } - - } else { - mp_zero(c); - - } - - return MP_OKAY; - -} /* end mp_mod() */ - -/* }}} */ - -/* {{{ mp_mod_d(a, d, c) */ - -/* - mp_mod_d(a, d, c) - - Compute c = a (mod d). Result will always be 0 <= c < d - */ -mp_err mp_mod_d(mp_int *a, mp_digit d, mp_digit *c) -{ - mp_err res; - mp_digit rem; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if(s_mp_cmp_d(a, d) > 0) { - if((res = mp_div_d(a, d, NULL, &rem)) != MP_OKAY) - return res; - - } else { - if(SIGN(a) == MP_NEG) - rem = d - DIGIT(a, 0); - else - rem = DIGIT(a, 0); - } - - if(c) - *c = rem; - - return MP_OKAY; - -} /* end mp_mod_d() */ - -/* }}} */ - -/* {{{ mp_sqrt(a, b) */ - -/* - mp_sqrt(a, b) - - Compute the integer square root of a, and store the result in b. - Uses an integer-arithmetic version of Newton's iterative linear - approximation technique to determine this value; the result has the - following two properties: - - b^2 <= a - (b+1)^2 >= a - - It is a range error to pass a negative value. - */ -mp_err mp_sqrt(mp_int *a, mp_int *b) -{ - mp_int x, t; - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - /* Cannot take square root of a negative value */ - if(SIGN(a) == MP_NEG) - return MP_RANGE; - - /* Special cases for zero and one, trivial */ - if(mp_cmp_d(a, 0) == MP_EQ || mp_cmp_d(a, 1) == MP_EQ) - return mp_copy(a, b); - - /* Initialize the temporaries we'll use below */ - if((res = mp_init_size(&t, USED(a))) != MP_OKAY) - return res; - - /* Compute an initial guess for the iteration as a itself */ - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - -s_mp_rshd(&x, (USED(&x)/2)+1); -mp_add_d(&x, 1, &x); - - for(;;) { - /* t = (x * x) - a */ - mp_copy(&x, &t); /* can't fail, t is big enough for original x */ - if((res = mp_sqr(&t, &t)) != MP_OKAY || - (res = mp_sub(&t, a, &t)) != MP_OKAY) - goto CLEANUP; - - /* t = t / 2x */ - s_mp_mul_2(&x); - if((res = mp_div(&t, &x, &t, NULL)) != MP_OKAY) - goto CLEANUP; - s_mp_div_2(&x); - - /* Terminate the loop, if the quotient is zero */ - if(mp_cmp_z(&t) == MP_EQ) - break; - - /* x = x - t */ - if((res = mp_sub(&x, &t, &x)) != MP_OKAY) - goto CLEANUP; - - } - - /* Copy result to output parameter */ - mp_sub_d(&x, 1, &x); - s_mp_exch(&x, b); - - CLEANUP: - mp_clear(&x); - X: - mp_clear(&t); - - return res; - -} /* end mp_sqrt() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Modular arithmetic */ - -#if MP_MODARITH -/* {{{ mp_addmod(a, b, m, c) */ - -/* - mp_addmod(a, b, m, c) - - Compute c = (a + b) mod m - */ - -mp_err mp_addmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_add(a, b, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} - -/* }}} */ - -/* {{{ mp_submod(a, b, m, c) */ - -/* - mp_submod(a, b, m, c) - - Compute c = (a - b) mod m - */ - -mp_err mp_submod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_sub(a, b, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} - -/* }}} */ - -/* {{{ mp_mulmod(a, b, m, c) */ - -/* - mp_mulmod(a, b, m, c) - - Compute c = (a * b) mod m - */ - -mp_err mp_mulmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_mul(a, b, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} - -/* }}} */ - -/* {{{ mp_sqrmod(a, m, c) */ - -#if MP_SQUARE -mp_err mp_sqrmod(mp_int *a, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_sqr(a, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} /* end mp_sqrmod() */ -#endif - -/* }}} */ - -/* {{{ mp_exptmod(a, b, m, c) */ - -/* - mp_exptmod(a, b, m, c) - - Compute c = (a ** b) mod m. Uses a standard square-and-multiply - method with modular reductions at each step. (This is basically the - same code as mp_expt(), except for the addition of the reductions) - - The modular reductions are done using Barrett's algorithm (see - s_mp_reduce() below for details) - */ - -mp_err mp_exptmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_int s, x, mu; - mp_err res; - mp_digit d, *db = DIGITS(b); - mp_size ub = USED(b); - unsigned int bit, dig; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(mp_cmp_z(b) < 0 || mp_cmp_z(m) <= 0) - return MP_RANGE; - - if((res = mp_init(&s)) != MP_OKAY) - return res; - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - if((res = mp_mod(&x, m, &x)) != MP_OKAY || - (res = mp_init(&mu)) != MP_OKAY) - goto MU; - - mp_set(&s, 1); - - /* mu = b^2k / m */ - s_mp_add_d(&mu, 1); - s_mp_lshd(&mu, 2 * USED(m)); - if((res = mp_div(&mu, m, &mu, NULL)) != MP_OKAY) - goto CLEANUP; - - /* Loop over digits of b in ascending order, except highest order */ - for(dig = 0; dig < (ub - 1); dig++) { - d = *db++; - - /* Loop over the bits of the lower-order digits */ - for(bit = 0; bit < DIGIT_BIT; bit++) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&s, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&x, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - } - - /* Now do the last digit... */ - d = *db; - - while(d) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&s, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&x, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - - s_mp_exch(&s, c); - - CLEANUP: - mp_clear(&mu); - MU: - mp_clear(&x); - X: - mp_clear(&s); - - return res; - -} /* end mp_exptmod() */ - -/* }}} */ - -/* {{{ mp_exptmod_d(a, d, m, c) */ - -mp_err mp_exptmod_d(mp_int *a, mp_digit d, mp_int *m, mp_int *c) -{ - mp_int s, x; - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_init(&s)) != MP_OKAY) - return res; - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - - mp_set(&s, 1); - - while(d != 0) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY || - (res = mp_mod(&s, m, &s)) != MP_OKAY) - goto CLEANUP; - } - - d /= 2; - - if((res = s_mp_sqr(&x)) != MP_OKAY || - (res = mp_mod(&x, m, &x)) != MP_OKAY) - goto CLEANUP; - } - - s_mp_exch(&s, c); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&s); - - return res; - -} /* end mp_exptmod_d() */ - -/* }}} */ -#endif /* if MP_MODARITH */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Comparison functions */ - -/* {{{ mp_cmp_z(a) */ - -/* - mp_cmp_z(a) - - Compare a <=> 0. Returns <0 if a<0, 0 if a=0, >0 if a>0. - */ - -int mp_cmp_z(mp_int *a) -{ - if(SIGN(a) == MP_NEG) - return MP_LT; - else if(USED(a) == 1 && DIGIT(a, 0) == 0) - return MP_EQ; - else - return MP_GT; - -} /* end mp_cmp_z() */ - -/* }}} */ - -/* {{{ mp_cmp_d(a, d) */ - -/* - mp_cmp_d(a, d) - - Compare a <=> d. Returns <0 if a0 if a>d - */ - -int mp_cmp_d(mp_int *a, mp_digit d) -{ - ARGCHK(a != NULL, MP_EQ); - - if(SIGN(a) == MP_NEG) - return MP_LT; - - return s_mp_cmp_d(a, d); - -} /* end mp_cmp_d() */ - -/* }}} */ - -/* {{{ mp_cmp(a, b) */ - -int mp_cmp(mp_int *a, mp_int *b) -{ - ARGCHK(a != NULL && b != NULL, MP_EQ); - - if(SIGN(a) == SIGN(b)) { - int mag; - - if((mag = s_mp_cmp(a, b)) == MP_EQ) - return MP_EQ; - - if(SIGN(a) == MP_ZPOS) - return mag; - else - return -mag; - - } else if(SIGN(a) == MP_ZPOS) { - return MP_GT; - } else { - return MP_LT; - } - -} /* end mp_cmp() */ - -/* }}} */ - -/* {{{ mp_cmp_mag(a, b) */ - -/* - mp_cmp_mag(a, b) - - Compares |a| <=> |b|, and returns an appropriate comparison result - */ - -int mp_cmp_mag(mp_int *a, mp_int *b) -{ - ARGCHK(a != NULL && b != NULL, MP_EQ); - - return s_mp_cmp(a, b); - -} /* end mp_cmp_mag() */ - -/* }}} */ - -/* {{{ mp_cmp_int(a, z) */ - -/* - This just converts z to an mp_int, and uses the existing comparison - routines. This is sort of inefficient, but it's not clear to me how - frequently this wil get used anyway. For small positive constants, - you can always use mp_cmp_d(), and for zero, there is mp_cmp_z(). - */ -int mp_cmp_int(mp_int *a, long z) -{ - mp_int tmp; - int out; - - ARGCHK(a != NULL, MP_EQ); - - mp_init(&tmp); mp_set_int(&tmp, z); - out = mp_cmp(a, &tmp); - mp_clear(&tmp); - - return out; - -} /* end mp_cmp_int() */ - -/* }}} */ - -/* {{{ mp_isodd(a) */ - -/* - mp_isodd(a) - - Returns a true (non-zero) value if a is odd, false (zero) otherwise. - */ -int mp_isodd(mp_int *a) -{ - ARGCHK(a != NULL, 0); - - return (DIGIT(a, 0) & 1); - -} /* end mp_isodd() */ - -/* }}} */ - -/* {{{ mp_iseven(a) */ - -int mp_iseven(mp_int *a) -{ - return !mp_isodd(a); - -} /* end mp_iseven() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Number theoretic functions */ - -#if MP_NUMTH -/* {{{ mp_gcd(a, b, c) */ - -/* - Like the old mp_gcd() function, except computes the GCD using the - binary algorithm due to Josef Stein in 1961 (via Knuth). - */ -mp_err mp_gcd(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - mp_int u, v, t; - mp_size k = 0; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(mp_cmp_z(a) == MP_EQ && mp_cmp_z(b) == MP_EQ) - return MP_RANGE; - if(mp_cmp_z(a) == MP_EQ) { - return mp_copy(b, c); - } else if(mp_cmp_z(b) == MP_EQ) { - return mp_copy(a, c); - } - - if((res = mp_init(&t)) != MP_OKAY) - return res; - if((res = mp_init_copy(&u, a)) != MP_OKAY) - goto U; - if((res = mp_init_copy(&v, b)) != MP_OKAY) - goto V; - - SIGN(&u) = MP_ZPOS; - SIGN(&v) = MP_ZPOS; - - /* Divide out common factors of 2 until at least 1 of a, b is even */ - while(mp_iseven(&u) && mp_iseven(&v)) { - s_mp_div_2(&u); - s_mp_div_2(&v); - ++k; - } - - /* Initialize t */ - if(mp_isodd(&u)) { - if((res = mp_copy(&v, &t)) != MP_OKAY) - goto CLEANUP; - - /* t = -v */ - if(SIGN(&v) == MP_ZPOS) - SIGN(&t) = MP_NEG; - else - SIGN(&t) = MP_ZPOS; - - } else { - if((res = mp_copy(&u, &t)) != MP_OKAY) - goto CLEANUP; - - } - - for(;;) { - while(mp_iseven(&t)) { - s_mp_div_2(&t); - } - - if(mp_cmp_z(&t) == MP_GT) { - if((res = mp_copy(&t, &u)) != MP_OKAY) - goto CLEANUP; - - } else { - if((res = mp_copy(&t, &v)) != MP_OKAY) - goto CLEANUP; - - /* v = -t */ - if(SIGN(&t) == MP_ZPOS) - SIGN(&v) = MP_NEG; - else - SIGN(&v) = MP_ZPOS; - } - - if((res = mp_sub(&u, &v, &t)) != MP_OKAY) - goto CLEANUP; - - if(s_mp_cmp_d(&t, 0) == MP_EQ) - break; - } - - s_mp_2expt(&v, k); /* v = 2^k */ - res = mp_mul(&u, &v, c); /* c = u * v */ - - CLEANUP: - mp_clear(&v); - V: - mp_clear(&u); - U: - mp_clear(&t); - - return res; - -} /* end mp_bgcd() */ - -/* }}} */ - -/* {{{ mp_lcm(a, b, c) */ - -/* We compute the least common multiple using the rule: - - ab = [a, b](a, b) - - ... by computing the product, and dividing out the gcd. - */ - -mp_err mp_lcm(mp_int *a, mp_int *b, mp_int *c) -{ - mp_int gcd, prod; - mp_err res; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - /* Set up temporaries */ - if((res = mp_init(&gcd)) != MP_OKAY) - return res; - if((res = mp_init(&prod)) != MP_OKAY) - goto GCD; - - if((res = mp_mul(a, b, &prod)) != MP_OKAY) - goto CLEANUP; - if((res = mp_gcd(a, b, &gcd)) != MP_OKAY) - goto CLEANUP; - - res = mp_div(&prod, &gcd, c, NULL); - - CLEANUP: - mp_clear(&prod); - GCD: - mp_clear(&gcd); - - return res; - -} /* end mp_lcm() */ - -/* }}} */ - -/* {{{ mp_xgcd(a, b, g, x, y) */ - -/* - mp_xgcd(a, b, g, x, y) - - Compute g = (a, b) and values x and y satisfying Bezout's identity - (that is, ax + by = g). This uses the extended binary GCD algorithm - based on the Stein algorithm used for mp_gcd() - */ - -mp_err mp_xgcd(mp_int *a, mp_int *b, mp_int *g, mp_int *x, mp_int *y) -{ - mp_int gx, xc, yc, u, v, A, B, C, D; - mp_int *clean[9]; - mp_err res; - int last = -1; - - if(mp_cmp_z(b) == 0) - return MP_RANGE; - - /* Initialize all these variables we need */ - if((res = mp_init(&u)) != MP_OKAY) goto CLEANUP; - clean[++last] = &u; - if((res = mp_init(&v)) != MP_OKAY) goto CLEANUP; - clean[++last] = &v; - if((res = mp_init(&gx)) != MP_OKAY) goto CLEANUP; - clean[++last] = &gx; - if((res = mp_init(&A)) != MP_OKAY) goto CLEANUP; - clean[++last] = &A; - if((res = mp_init(&B)) != MP_OKAY) goto CLEANUP; - clean[++last] = &B; - if((res = mp_init(&C)) != MP_OKAY) goto CLEANUP; - clean[++last] = &C; - if((res = mp_init(&D)) != MP_OKAY) goto CLEANUP; - clean[++last] = &D; - if((res = mp_init_copy(&xc, a)) != MP_OKAY) goto CLEANUP; - clean[++last] = &xc; - mp_abs(&xc, &xc); - if((res = mp_init_copy(&yc, b)) != MP_OKAY) goto CLEANUP; - clean[++last] = &yc; - mp_abs(&yc, &yc); - - mp_set(&gx, 1); - - /* Divide by two until at least one of them is even */ - while(mp_iseven(&xc) && mp_iseven(&yc)) { - s_mp_div_2(&xc); - s_mp_div_2(&yc); - if((res = s_mp_mul_2(&gx)) != MP_OKAY) - goto CLEANUP; - } - - mp_copy(&xc, &u); - mp_copy(&yc, &v); - mp_set(&A, 1); mp_set(&D, 1); - - /* Loop through binary GCD algorithm */ - for(;;) { - while(mp_iseven(&u)) { - s_mp_div_2(&u); - - if(mp_iseven(&A) && mp_iseven(&B)) { - s_mp_div_2(&A); s_mp_div_2(&B); - } else { - if((res = mp_add(&A, &yc, &A)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&A); - if((res = mp_sub(&B, &xc, &B)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&B); - } - } - - while(mp_iseven(&v)) { - s_mp_div_2(&v); - - if(mp_iseven(&C) && mp_iseven(&D)) { - s_mp_div_2(&C); s_mp_div_2(&D); - } else { - if((res = mp_add(&C, &yc, &C)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&C); - if((res = mp_sub(&D, &xc, &D)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&D); - } - } - - if(mp_cmp(&u, &v) >= 0) { - if((res = mp_sub(&u, &v, &u)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&A, &C, &A)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&B, &D, &B)) != MP_OKAY) goto CLEANUP; - - } else { - if((res = mp_sub(&v, &u, &v)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&C, &A, &C)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&D, &B, &D)) != MP_OKAY) goto CLEANUP; - - } - - /* If we're done, copy results to output */ - if(mp_cmp_z(&u) == 0) { - if(x) - if((res = mp_copy(&C, x)) != MP_OKAY) goto CLEANUP; - - if(y) - if((res = mp_copy(&D, y)) != MP_OKAY) goto CLEANUP; - - if(g) - if((res = mp_mul(&gx, &v, g)) != MP_OKAY) goto CLEANUP; - - break; - } - } - - CLEANUP: - while(last >= 0) - mp_clear(clean[last--]); - - return res; - -} /* end mp_xgcd() */ - -/* }}} */ - -/* {{{ mp_invmod(a, m, c) */ - -/* - mp_invmod(a, m, c) - - Compute c = a^-1 (mod m), if there is an inverse for a (mod m). - This is equivalent to the question of whether (a, m) = 1. If not, - MP_UNDEF is returned, and there is no inverse. - */ - -mp_err mp_invmod(mp_int *a, mp_int *m, mp_int *c) -{ - mp_int g, x; - mp_err res; - - ARGCHK(a && m && c, MP_BADARG); - - if(mp_cmp_z(a) == 0 || mp_cmp_z(m) == 0) - return MP_RANGE; - - if((res = mp_init(&g)) != MP_OKAY) - return res; - if((res = mp_init(&x)) != MP_OKAY) - goto X; - - if((res = mp_xgcd(a, m, &g, &x, NULL)) != MP_OKAY) - goto CLEANUP; - - if(mp_cmp_d(&g, 1) != MP_EQ) { - res = MP_UNDEF; - goto CLEANUP; - } - - res = mp_mod(&x, m, c); - SIGN(c) = SIGN(a); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&g); - - return res; - -} /* end mp_invmod() */ - -/* }}} */ -#endif /* if MP_NUMTH */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ mp_print(mp, ofp) */ - -#if MP_IOFUNC -/* - mp_print(mp, ofp) - - Print a textual representation of the given mp_int on the output - stream 'ofp'. Output is generated using the internal radix. - */ - -void mp_print(mp_int *mp, FILE *ofp) -{ - int ix; - - if(mp == NULL || ofp == NULL) - return; - - fputc((SIGN(mp) == MP_NEG) ? '-' : '+', ofp); - - for(ix = USED(mp) - 1; ix >= 0; ix--) { - fprintf(ofp, DIGIT_FMT, DIGIT(mp, ix)); - } - -} /* end mp_print() */ - -#endif /* if MP_IOFUNC */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ More I/O Functions */ - -/* {{{ mp_read_signed_bin(mp, str, len) */ - -/* - mp_read_signed_bin(mp, str, len) - - Read in a raw value (base 256) into the given mp_int - */ - -mp_err mp_read_signed_bin(mp_int *mp, unsigned char *str, int len) -{ - mp_err res; - - ARGCHK(mp != NULL && str != NULL && len > 0, MP_BADARG); - - if((res = mp_read_unsigned_bin(mp, str + 1, len - 1)) == MP_OKAY) { - /* Get sign from first byte */ - if(str[0]) - SIGN(mp) = MP_NEG; - else - SIGN(mp) = MP_ZPOS; - } - - return res; - -} /* end mp_read_signed_bin() */ - -/* }}} */ - -/* {{{ mp_signed_bin_size(mp) */ - -int mp_signed_bin_size(mp_int *mp) -{ - ARGCHK(mp != NULL, 0); - - return mp_unsigned_bin_size(mp) + 1; - -} /* end mp_signed_bin_size() */ - -/* }}} */ - -/* {{{ mp_to_signed_bin(mp, str) */ - -mp_err mp_to_signed_bin(mp_int *mp, unsigned char *str) -{ - ARGCHK(mp != NULL && str != NULL, MP_BADARG); - - /* Caller responsible for allocating enough memory (use mp_raw_size(mp)) */ - str[0] = (char)SIGN(mp); - - return mp_to_unsigned_bin(mp, str + 1); - -} /* end mp_to_signed_bin() */ - -/* }}} */ - -/* {{{ mp_read_unsigned_bin(mp, str, len) */ - -/* - mp_read_unsigned_bin(mp, str, len) - - Read in an unsigned value (base 256) into the given mp_int - */ - -mp_err mp_read_unsigned_bin(mp_int *mp, unsigned char *str, int len) -{ - int ix; - mp_err res; - - ARGCHK(mp != NULL && str != NULL && len > 0, MP_BADARG); - - mp_zero(mp); - - for(ix = 0; ix < len; ix++) { - if((res = s_mp_mul_2d(mp, CHAR_BIT)) != MP_OKAY) - return res; - - if((res = mp_add_d(mp, str[ix], mp)) != MP_OKAY) - return res; - } - - return MP_OKAY; - -} /* end mp_read_unsigned_bin() */ - -/* }}} */ - -/* {{{ mp_unsigned_bin_size(mp) */ - -int mp_unsigned_bin_size(mp_int *mp) -{ - mp_digit topdig; - int count; - - ARGCHK(mp != NULL, 0); - - /* Special case for the value zero */ - if(USED(mp) == 1 && DIGIT(mp, 0) == 0) - return 1; - - count = (USED(mp) - 1) * sizeof(mp_digit); - topdig = DIGIT(mp, USED(mp) - 1); - - while(topdig != 0) { - ++count; - topdig >>= CHAR_BIT; - } - - return count; - -} /* end mp_unsigned_bin_size() */ - -/* }}} */ - -/* {{{ mp_to_unsigned_bin(mp, str) */ - -mp_err mp_to_unsigned_bin(mp_int *mp, unsigned char *str) -{ - mp_digit *dp, *end, d; - unsigned char *spos; - - ARGCHK(mp != NULL && str != NULL, MP_BADARG); - - dp = DIGITS(mp); - end = dp + USED(mp) - 1; - spos = str; - - /* Special case for zero, quick test */ - if(dp == end && *dp == 0) { - *str = '\0'; - return MP_OKAY; - } - - /* Generate digits in reverse order */ - while(dp < end) { - unsigned int ix; - - d = *dp; - for(ix = 0; ix < sizeof(mp_digit); ++ix) { - *spos = d & UCHAR_MAX; - d >>= CHAR_BIT; - ++spos; - } - - ++dp; - } - - /* Now handle last digit specially, high order zeroes are not written */ - d = *end; - while(d != 0) { - *spos = d & UCHAR_MAX; - d >>= CHAR_BIT; - ++spos; - } - - /* Reverse everything to get digits in the correct order */ - while(--spos > str) { - unsigned char t = *str; - *str = *spos; - *spos = t; - - ++str; - } - - return MP_OKAY; - -} /* end mp_to_unsigned_bin() */ - -/* }}} */ - -/* {{{ mp_count_bits(mp) */ - -int mp_count_bits(mp_int *mp) -{ - int len; - mp_digit d; - - ARGCHK(mp != NULL, MP_BADARG); - - len = DIGIT_BIT * (USED(mp) - 1); - d = DIGIT(mp, USED(mp) - 1); - - while(d != 0) { - ++len; - d >>= 1; - } - - return len; - -} /* end mp_count_bits() */ - -/* }}} */ - -/* {{{ mp_read_radix(mp, str, radix) */ - -/* - mp_read_radix(mp, str, radix) - - Read an integer from the given string, and set mp to the resulting - value. The input is presumed to be in base 10. Leading non-digit - characters are ignored, and the function reads until a non-digit - character or the end of the string. - */ - -mp_err mp_read_radix(mp_int *mp, unsigned char *str, int radix) -{ - int ix = 0, val = 0; - mp_err res; - mp_sign sig = MP_ZPOS; - - ARGCHK(mp != NULL && str != NULL && radix >= 2 && radix <= MAX_RADIX, - MP_BADARG); - - mp_zero(mp); - - /* Skip leading non-digit characters until a digit or '-' or '+' */ - while(str[ix] && - (s_mp_tovalue(str[ix], radix) < 0) && - str[ix] != '-' && - str[ix] != '+') { - ++ix; - } - - if(str[ix] == '-') { - sig = MP_NEG; - ++ix; - } else if(str[ix] == '+') { - sig = MP_ZPOS; /* this is the default anyway... */ - ++ix; - } - - while((val = s_mp_tovalue(str[ix], radix)) >= 0) { - if((res = s_mp_mul_d(mp, radix)) != MP_OKAY) - return res; - if((res = s_mp_add_d(mp, val)) != MP_OKAY) - return res; - ++ix; - } - - if(s_mp_cmp_d(mp, 0) == MP_EQ) - SIGN(mp) = MP_ZPOS; - else - SIGN(mp) = sig; - - return MP_OKAY; - -} /* end mp_read_radix() */ - -/* }}} */ - -/* {{{ mp_radix_size(mp, radix) */ - -int mp_radix_size(mp_int *mp, int radix) -{ - int len; - ARGCHK(mp != NULL, 0); - - len = s_mp_outlen(mp_count_bits(mp), radix) + 1; /* for NUL terminator */ - - if(mp_cmp_z(mp) < 0) - ++len; /* for sign */ - - return len; - -} /* end mp_radix_size() */ - -/* }}} */ - -/* {{{ mp_value_radix_size(num, qty, radix) */ - -/* num = number of digits - qty = number of bits per digit - radix = target base - - Return the number of digits in the specified radix that would be - needed to express 'num' digits of 'qty' bits each. - */ -int mp_value_radix_size(int num, int qty, int radix) -{ - ARGCHK(num >= 0 && qty > 0 && radix >= 2 && radix <= MAX_RADIX, 0); - - return s_mp_outlen(num * qty, radix); - -} /* end mp_value_radix_size() */ - -/* }}} */ - -/* {{{ mp_toradix(mp, str, radix) */ - -mp_err mp_toradix(mp_int *mp, char *str, int radix) -{ - int ix, pos = 0; - - ARGCHK(mp != NULL && str != NULL, MP_BADARG); - ARGCHK(radix > 1 && radix <= MAX_RADIX, MP_RANGE); - - if(mp_cmp_z(mp) == MP_EQ) { - str[0] = '0'; - str[1] = '\0'; - } else { - mp_err res; - mp_int tmp; - mp_sign sgn; - mp_digit rem, rdx = (mp_digit)radix; - char ch; - - if((res = mp_init_copy(&tmp, mp)) != MP_OKAY) - return res; - - /* Save sign for later, and take absolute value */ - sgn = SIGN(&tmp); SIGN(&tmp) = MP_ZPOS; - - /* Generate output digits in reverse order */ - while(mp_cmp_z(&tmp) != 0) { - if((res = s_mp_div_d(&tmp, rdx, &rem)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - /* Generate digits, use capital letters */ - ch = s_mp_todigit(rem, radix, 0); - - str[pos++] = ch; - } - - /* Add - sign if original value was negative */ - if(sgn == MP_NEG) - str[pos++] = '-'; - - /* Add trailing NUL to end the string */ - str[pos--] = '\0'; - - /* Reverse the digits and sign indicator */ - ix = 0; - while(ix < pos) { - char _tmp = str[ix]; - - str[ix] = str[pos]; - str[pos] = _tmp; - ++ix; - --pos; - } - - mp_clear(&tmp); - } - - return MP_OKAY; - -} /* end mp_toradix() */ - -/* }}} */ - -/* {{{ mp_char2value(ch, r) */ - -int mp_char2value(char ch, int r) -{ - return s_mp_tovalue(ch, r); - -} /* end mp_tovalue() */ - -/* }}} */ - -/* }}} */ - -/* {{{ mp_strerror(ec) */ - -/* - mp_strerror(ec) - - Return a string describing the meaning of error code 'ec'. The - string returned is allocated in static memory, so the caller should - not attempt to modify or free the memory associated with this - string. - */ -const char *mp_strerror(mp_err ec) -{ - int aec = (ec < 0) ? -ec : ec; - - /* Code values are negative, so the senses of these comparisons - are accurate */ - if(ec < MP_LAST_CODE || ec > MP_OKAY) { - return mp_err_string[0]; /* unknown error code */ - } else { - return mp_err_string[aec + 1]; - } - -} /* end mp_strerror() */ - -/* }}} */ - -/*========================================================================*/ -/*------------------------------------------------------------------------*/ -/* Static function definitions (internal use only) */ - -/* {{{ Memory management */ - -/* {{{ s_mp_grow(mp, min) */ - -/* Make sure there are at least 'min' digits allocated to mp */ -mp_err s_mp_grow(mp_int *mp, mp_size min) -{ - if(min > ALLOC(mp)) { - mp_digit *tmp; - - /* Set min to next nearest default precision block size */ - min = ((min + (s_mp_defprec - 1)) / s_mp_defprec) * s_mp_defprec; - - if((tmp = s_mp_alloc(min, sizeof(mp_digit))) == NULL) - return MP_MEM; - - s_mp_copy(DIGITS(mp), tmp, USED(mp)); - -#if MP_CRYPTO - s_mp_setz(DIGITS(mp), ALLOC(mp)); -#endif - s_mp_free(DIGITS(mp)); - DIGITS(mp) = tmp; - ALLOC(mp) = min; - } - - return MP_OKAY; - -} /* end s_mp_grow() */ - -/* }}} */ - -/* {{{ s_mp_pad(mp, min) */ - -/* Make sure the used size of mp is at least 'min', growing if needed */ -mp_err s_mp_pad(mp_int *mp, mp_size min) -{ - if(min > USED(mp)) { - mp_err res; - - /* Make sure there is room to increase precision */ - if(min > ALLOC(mp) && (res = s_mp_grow(mp, min)) != MP_OKAY) - return res; - - /* Increase precision; should already be 0-filled */ - USED(mp) = min; - } - - return MP_OKAY; - -} /* end s_mp_pad() */ - -/* }}} */ - -/* {{{ s_mp_setz(dp, count) */ - -#if MP_MACRO == 0 -/* Set 'count' digits pointed to by dp to be zeroes */ -void s_mp_setz(mp_digit *dp, mp_size count) -{ -#if MP_MEMSET == 0 - int ix; - - for(ix = 0; ix < count; ix++) - dp[ix] = 0; -#else - memset(dp, 0, count * sizeof(mp_digit)); -#endif - -} /* end s_mp_setz() */ -#endif - -/* }}} */ - -/* {{{ s_mp_copy(sp, dp, count) */ - -#if MP_MACRO == 0 -/* Copy 'count' digits from sp to dp */ -void s_mp_copy(mp_digit *sp, mp_digit *dp, mp_size count) -{ -#if MP_MEMCPY == 0 - int ix; - - for(ix = 0; ix < count; ix++) - dp[ix] = sp[ix]; -#else - memcpy(dp, sp, count * sizeof(mp_digit)); -#endif - -} /* end s_mp_copy() */ -#endif - -/* }}} */ - -/* {{{ s_mp_alloc(nb, ni) */ - -#if MP_MACRO == 0 -/* Allocate ni records of nb bytes each, and return a pointer to that */ -void *s_mp_alloc(size_t nb, size_t ni) -{ - return calloc(nb, ni); - -} /* end s_mp_alloc() */ -#endif - -/* }}} */ - -/* {{{ s_mp_free(ptr) */ - -#if MP_MACRO == 0 -/* Free the memory pointed to by ptr */ -void s_mp_free(void *ptr) -{ - if(ptr) - free(ptr); - -} /* end s_mp_free() */ -#endif - -/* }}} */ - -/* {{{ s_mp_clamp(mp) */ - -/* Remove leading zeroes from the given value */ -void s_mp_clamp(mp_int *mp) -{ - mp_size du = USED(mp); - mp_digit *zp = DIGITS(mp) + du - 1; - - while(du > 1 && !*zp--) - --du; - - USED(mp) = du; - -} /* end s_mp_clamp() */ - - -/* }}} */ - -/* {{{ s_mp_exch(a, b) */ - -/* Exchange the data for a and b; (b, a) = (a, b) */ -void s_mp_exch(mp_int *a, mp_int *b) -{ - mp_int tmp; - - tmp = *a; - *a = *b; - *b = tmp; - -} /* end s_mp_exch() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Arithmetic helpers */ - -/* {{{ s_mp_lshd(mp, p) */ - -/* - Shift mp leftward by p digits, growing if needed, and zero-filling - the in-shifted digits at the right end. This is a convenient - alternative to multiplication by powers of the radix - */ - -mp_err s_mp_lshd(mp_int *mp, mp_size p) -{ - mp_err res; - mp_size pos; - mp_digit *dp; - int ix; - - if(p == 0) - return MP_OKAY; - - if((res = s_mp_pad(mp, USED(mp) + p)) != MP_OKAY) - return res; - - pos = USED(mp) - 1; - dp = DIGITS(mp); - - /* Shift all the significant figures over as needed */ - for(ix = pos - p; ix >= 0; ix--) - dp[ix + p] = dp[ix]; - - /* Fill the bottom digits with zeroes */ - for(ix = 0; (unsigned)ix < p; ix++) - dp[ix] = 0; - - return MP_OKAY; - -} /* end s_mp_lshd() */ - -/* }}} */ - -/* {{{ s_mp_rshd(mp, p) */ - -/* - Shift mp rightward by p digits. Maintains the invariant that - digits above the precision are all zero. Digits shifted off the - end are lost. Cannot fail. - */ - -void s_mp_rshd(mp_int *mp, mp_size p) -{ - mp_size ix; - mp_digit *dp; - - if(p == 0) - return; - - /* Shortcut when all digits are to be shifted off */ - if(p >= USED(mp)) { - s_mp_setz(DIGITS(mp), ALLOC(mp)); - USED(mp) = 1; - SIGN(mp) = MP_ZPOS; - return; - } - - /* Shift all the significant figures over as needed */ - dp = DIGITS(mp); - for(ix = p; ix < USED(mp); ix++) - dp[ix - p] = dp[ix]; - - /* Fill the top digits with zeroes */ - ix -= p; - while(ix < USED(mp)) - dp[ix++] = 0; - - /* Strip off any leading zeroes */ - s_mp_clamp(mp); - -} /* end s_mp_rshd() */ - -/* }}} */ - -/* {{{ s_mp_div_2(mp) */ - -/* Divide by two -- take advantage of radix properties to do it fast */ -void s_mp_div_2(mp_int *mp) -{ - s_mp_div_2d(mp, 1); - -} /* end s_mp_div_2() */ - -/* }}} */ - -/* {{{ s_mp_mul_2(mp) */ - -mp_err s_mp_mul_2(mp_int *mp) -{ - unsigned int ix; - mp_digit kin = 0, kout, *dp = DIGITS(mp); - mp_err res; - - /* Shift digits leftward by 1 bit */ - for(ix = 0; ix < USED(mp); ix++) { - kout = (dp[ix] >> (DIGIT_BIT - 1)) & 1; - dp[ix] = (dp[ix] << 1) | kin; - - kin = kout; - } - - /* Deal with rollover from last digit */ - if(kin) { - if(ix >= ALLOC(mp)) { - if((res = s_mp_grow(mp, ALLOC(mp) + 1)) != MP_OKAY) - return res; - dp = DIGITS(mp); - } - - dp[ix] = kin; - USED(mp) += 1; - } - - return MP_OKAY; - -} /* end s_mp_mul_2() */ - -/* }}} */ - -/* {{{ s_mp_mod_2d(mp, d) */ - -/* - Remainder the integer by 2^d, where d is a number of bits. This - amounts to a bitwise AND of the value, and does not require the full - division code - */ -void s_mp_mod_2d(mp_int *mp, mp_digit d) -{ - unsigned int ndig = (d / DIGIT_BIT), nbit = (d % DIGIT_BIT); - unsigned int ix; - mp_digit dmask, *dp = DIGITS(mp); - - if(ndig >= USED(mp)) - return; - - /* Flush all the bits above 2^d in its digit */ - dmask = (1 << nbit) - 1; - dp[ndig] &= dmask; - - /* Flush all digits above the one with 2^d in it */ - for(ix = ndig + 1; ix < USED(mp); ix++) - dp[ix] = 0; - - s_mp_clamp(mp); - -} /* end s_mp_mod_2d() */ - -/* }}} */ - -/* {{{ s_mp_mul_2d(mp, d) */ - -/* - Multiply by the integer 2^d, where d is a number of bits. This - amounts to a bitwise shift of the value, and does not require the - full multiplication code. - */ -mp_err s_mp_mul_2d(mp_int *mp, mp_digit d) -{ - mp_err res; - mp_digit save, next, mask, *dp; - mp_size used; - unsigned int ix; - - if((res = s_mp_lshd(mp, d / DIGIT_BIT)) != MP_OKAY) - return res; - - dp = DIGITS(mp); used = USED(mp); - d %= DIGIT_BIT; - - mask = (1 << d) - 1; - - /* If the shift requires another digit, make sure we've got one to - work with */ - if((dp[used - 1] >> (DIGIT_BIT - d)) & mask) { - if((res = s_mp_grow(mp, used + 1)) != MP_OKAY) - return res; - dp = DIGITS(mp); - } - - /* Do the shifting... */ - save = 0; - for(ix = 0; ix < used; ix++) { - next = (dp[ix] >> (DIGIT_BIT - d)) & mask; - dp[ix] = (dp[ix] << d) | save; - save = next; - } - - /* If, at this point, we have a nonzero carryout into the next - digit, we'll increase the size by one digit, and store it... - */ - if(save) { - dp[used] = save; - USED(mp) += 1; - } - - s_mp_clamp(mp); - return MP_OKAY; - -} /* end s_mp_mul_2d() */ - -/* }}} */ - -/* {{{ s_mp_div_2d(mp, d) */ - -/* - Divide the integer by 2^d, where d is a number of bits. This - amounts to a bitwise shift of the value, and does not require the - full division code (used in Barrett reduction, see below) - */ -void s_mp_div_2d(mp_int *mp, mp_digit d) -{ - int ix; - mp_digit save, next, mask, *dp = DIGITS(mp); - - s_mp_rshd(mp, d / DIGIT_BIT); - d %= DIGIT_BIT; - - mask = (1 << d) - 1; - - save = 0; - for(ix = USED(mp) - 1; ix >= 0; ix--) { - next = dp[ix] & mask; - dp[ix] = (dp[ix] >> d) | (save << (DIGIT_BIT - d)); - save = next; - } - - s_mp_clamp(mp); - -} /* end s_mp_div_2d() */ - -/* }}} */ - -/* {{{ s_mp_norm(a, b) */ - -/* - s_mp_norm(a, b) - - Normalize a and b for division, where b is the divisor. In order - that we might make good guesses for quotient digits, we want the - leading digit of b to be at least half the radix, which we - accomplish by multiplying a and b by a constant. This constant is - returned (so that it can be divided back out of the remainder at the - end of the division process). - - We multiply by the smallest power of 2 that gives us a leading digit - at least half the radix. By choosing a power of 2, we simplify the - multiplication and division steps to simple shifts. - */ -mp_digit s_mp_norm(mp_int *a, mp_int *b) -{ - mp_digit t, d = 0; - - t = DIGIT(b, USED(b) - 1); - while(t < (RADIX / 2)) { - t <<= 1; - ++d; - } - - if(d != 0) { - s_mp_mul_2d(a, d); - s_mp_mul_2d(b, d); - } - - return d; - -} /* end s_mp_norm() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive digit arithmetic */ - -/* {{{ s_mp_add_d(mp, d) */ - -/* Add d to |mp| in place */ -mp_err s_mp_add_d(mp_int *mp, mp_digit d) /* unsigned digit addition */ -{ - mp_word w, k = 0; - mp_size ix = 1, used = USED(mp); - mp_digit *dp = DIGITS(mp); - - w = dp[0] + d; - dp[0] = ACCUM(w); - k = CARRYOUT(w); - - while(ix < used && k) { - w = dp[ix] + k; - dp[ix] = ACCUM(w); - k = CARRYOUT(w); - ++ix; - } - - if(k != 0) { - mp_err res; - - if((res = s_mp_pad(mp, USED(mp) + 1)) != MP_OKAY) - return res; - - DIGIT(mp, ix) = k; - } - - return MP_OKAY; - -} /* end s_mp_add_d() */ - -/* }}} */ - -/* {{{ s_mp_sub_d(mp, d) */ - -/* Subtract d from |mp| in place, assumes |mp| > d */ -mp_err s_mp_sub_d(mp_int *mp, mp_digit d) /* unsigned digit subtract */ -{ - mp_word w, b = 0; - mp_size ix = 1, used = USED(mp); - mp_digit *dp = DIGITS(mp); - - /* Compute initial subtraction */ - w = (RADIX + dp[0]) - d; - b = CARRYOUT(w) ? 0 : 1; - dp[0] = ACCUM(w); - - /* Propagate borrows leftward */ - while(b && ix < used) { - w = (RADIX + dp[ix]) - b; - b = CARRYOUT(w) ? 0 : 1; - dp[ix] = ACCUM(w); - ++ix; - } - - /* Remove leading zeroes */ - s_mp_clamp(mp); - - /* If we have a borrow out, it's a violation of the input invariant */ - if(b) - return MP_RANGE; - else - return MP_OKAY; - -} /* end s_mp_sub_d() */ - -/* }}} */ - -/* {{{ s_mp_mul_d(a, d) */ - -/* Compute a = a * d, single digit multiplication */ -mp_err s_mp_mul_d(mp_int *a, mp_digit d) -{ - mp_word w, k = 0; - mp_size ix, max; - mp_err res; - mp_digit *dp = DIGITS(a); - - /* - Single-digit multiplication will increase the precision of the - output by at most one digit. However, we can detect when this - will happen -- if the high-order digit of a, times d, gives a - two-digit result, then the precision of the result will increase; - otherwise it won't. We use this fact to avoid calling s_mp_pad() - unless absolutely necessary. - */ - max = USED(a); - w = dp[max - 1] * d; - if(CARRYOUT(w) != 0) { - if((res = s_mp_pad(a, max + 1)) != MP_OKAY) - return res; - dp = DIGITS(a); - } - - for(ix = 0; ix < max; ix++) { - w = (dp[ix] * d) + k; - dp[ix] = ACCUM(w); - k = CARRYOUT(w); - } - - /* If there is a precision increase, take care of it here; the above - test guarantees we have enough storage to do this safely. - */ - if(k) { - dp[max] = k; - USED(a) = max + 1; - } - - s_mp_clamp(a); - - return MP_OKAY; - -} /* end s_mp_mul_d() */ - -/* }}} */ - -/* {{{ s_mp_div_d(mp, d, r) */ - -/* - s_mp_div_d(mp, d, r) - - Compute the quotient mp = mp / d and remainder r = mp mod d, for a - single digit d. If r is null, the remainder will be discarded. - */ - -mp_err s_mp_div_d(mp_int *mp, mp_digit d, mp_digit *r) -{ - mp_word w = 0, t; - mp_int quot; - mp_err res; - mp_digit *dp = DIGITS(mp), *qp; - int ix; - - if(d == 0) - return MP_RANGE; - - /* Make room for the quotient */ - if((res = mp_init_size(", USED(mp))) != MP_OKAY) - return res; - - USED(") = USED(mp); /* so clamping will work below */ - qp = DIGITS("); - - /* Divide without subtraction */ - for(ix = USED(mp) - 1; ix >= 0; ix--) { - w = (w << DIGIT_BIT) | dp[ix]; - - if(w >= d) { - t = w / d; - w = w % d; - } else { - t = 0; - } - - qp[ix] = t; - } - - /* Deliver the remainder, if desired */ - if(r) - *r = w; - - s_mp_clamp("); - mp_exch(", mp); - mp_clear("); - - return MP_OKAY; - -} /* end s_mp_div_d() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive full arithmetic */ - -/* {{{ s_mp_add(a, b) */ - -/* Compute a = |a| + |b| */ -mp_err s_mp_add(mp_int *a, mp_int *b) /* magnitude addition */ -{ - mp_word w = 0; - mp_digit *pa, *pb; - mp_size ix, used = USED(b); - mp_err res; - - /* Make sure a has enough precision for the output value */ - if((used > USED(a)) && (res = s_mp_pad(a, used)) != MP_OKAY) - return res; - - /* - Add up all digits up to the precision of b. If b had initially - the same precision as a, or greater, we took care of it by the - padding step above, so there is no problem. If b had initially - less precision, we'll have to make sure the carry out is duly - propagated upward among the higher-order digits of the sum. - */ - pa = DIGITS(a); - pb = DIGITS(b); - for(ix = 0; ix < used; ++ix) { - w += *pa + *pb++; - *pa++ = ACCUM(w); - w = CARRYOUT(w); - } - - /* If we run out of 'b' digits before we're actually done, make - sure the carries get propagated upward... - */ - used = USED(a); - while(w && ix < used) { - w += *pa; - *pa++ = ACCUM(w); - w = CARRYOUT(w); - ++ix; - } - - /* If there's an overall carry out, increase precision and include - it. We could have done this initially, but why touch the memory - allocator unless we're sure we have to? - */ - if(w) { - if((res = s_mp_pad(a, used + 1)) != MP_OKAY) - return res; - - DIGIT(a, ix) = w; /* pa may not be valid after s_mp_pad() call */ - } - - return MP_OKAY; - -} /* end s_mp_add() */ - -/* }}} */ - -/* {{{ s_mp_sub(a, b) */ - -/* Compute a = |a| - |b|, assumes |a| >= |b| */ -mp_err s_mp_sub(mp_int *a, mp_int *b) /* magnitude subtract */ -{ - mp_word w = 0; - mp_digit *pa, *pb; - mp_size ix, used = USED(b); - - /* - Subtract and propagate borrow. Up to the precision of b, this - accounts for the digits of b; after that, we just make sure the - carries get to the right place. This saves having to pad b out to - the precision of a just to make the loops work right... - */ - pa = DIGITS(a); - pb = DIGITS(b); - - for(ix = 0; ix < used; ++ix) { - w = (RADIX + *pa) - w - *pb++; - *pa++ = ACCUM(w); - w = CARRYOUT(w) ? 0 : 1; - } - - used = USED(a); - while(ix < used) { - w = RADIX + *pa - w; - *pa++ = ACCUM(w); - w = CARRYOUT(w) ? 0 : 1; - ++ix; - } - - /* Clobber any leading zeroes we created */ - s_mp_clamp(a); - - /* - If there was a borrow out, then |b| > |a| in violation - of our input invariant. We've already done the work, - but we'll at least complain about it... - */ - if(w) - return MP_RANGE; - else - return MP_OKAY; - -} /* end s_mp_sub() */ - -/* }}} */ - -mp_err s_mp_reduce(mp_int *x, mp_int *m, mp_int *mu) -{ - mp_int q; - mp_err res; - mp_size um = USED(m); - - if((res = mp_init_copy(&q, x)) != MP_OKAY) - return res; - - s_mp_rshd(&q, um - 1); /* q1 = x / b^(k-1) */ - s_mp_mul(&q, mu); /* q2 = q1 * mu */ - s_mp_rshd(&q, um + 1); /* q3 = q2 / b^(k+1) */ - - /* x = x mod b^(k+1), quick (no division) */ - s_mp_mod_2d(x, (mp_digit)(DIGIT_BIT * (um + 1))); - - /* q = q * m mod b^(k+1), quick (no division), uses the short multiplier */ -#ifndef SHRT_MUL - s_mp_mul(&q, m); - s_mp_mod_2d(&q, (mp_digit)(DIGIT_BIT * (um + 1))); -#else - s_mp_mul_dig(&q, m, um + 1); -#endif - - /* x = x - q */ - if((res = mp_sub(x, &q, x)) != MP_OKAY) - goto CLEANUP; - - /* If x < 0, add b^(k+1) to it */ - if(mp_cmp_z(x) < 0) { - mp_set(&q, 1); - if((res = s_mp_lshd(&q, um + 1)) != MP_OKAY) - goto CLEANUP; - if((res = mp_add(x, &q, x)) != MP_OKAY) - goto CLEANUP; - } - - /* Back off if it's too big */ - while(mp_cmp(x, m) >= 0) { - if((res = s_mp_sub(x, m)) != MP_OKAY) - break; - } - - CLEANUP: - mp_clear(&q); - - return res; - -} /* end s_mp_reduce() */ - - - -/* {{{ s_mp_mul(a, b) */ - -/* Compute a = |a| * |b| */ -mp_err s_mp_mul(mp_int *a, mp_int *b) -{ - mp_word w, k = 0; - mp_int tmp; - mp_err res; - mp_size ix, jx, ua = USED(a), ub = USED(b); - mp_digit *pa, *pb, *pt, *pbt; - - if((res = mp_init_size(&tmp, ua + ub)) != MP_OKAY) - return res; - - /* This has the effect of left-padding with zeroes... */ - USED(&tmp) = ua + ub; - - /* We're going to need the base value each iteration */ - pbt = DIGITS(&tmp); - - /* Outer loop: Digits of b */ - - pb = DIGITS(b); - for(ix = 0; ix < ub; ++ix, ++pb) { - if(*pb == 0) - continue; - - /* Inner product: Digits of a */ - pa = DIGITS(a); - for(jx = 0; jx < ua; ++jx, ++pa) { - pt = pbt + ix + jx; - w = *pb * *pa + k + *pt; - *pt = ACCUM(w); - k = CARRYOUT(w); - } - - pbt[ix + jx] = k; - k = 0; - } - - s_mp_clamp(&tmp); - s_mp_exch(&tmp, a); - - mp_clear(&tmp); - - return MP_OKAY; - -} /* end s_mp_mul() */ - -/* }}} */ - -/* {{{ s_mp_kmul(a, b, out, len) */ - -#if 0 -void s_mp_kmul(mp_digit *a, mp_digit *b, mp_digit *out, mp_size len) -{ - mp_word w, k = 0; - mp_size ix, jx; - mp_digit *pa, *pt; - - for(ix = 0; ix < len; ++ix, ++b) { - if(*b == 0) - continue; - - pa = a; - for(jx = 0; jx < len; ++jx, ++pa) { - pt = out + ix + jx; - w = *b * *pa + k + *pt; - *pt = ACCUM(w); - k = CARRYOUT(w); - } - - out[ix + jx] = k; - k = 0; - } - -} /* end s_mp_kmul() */ -#endif - -/* }}} */ - -/* {{{ s_mp_sqr(a) */ - -/* - Computes the square of a, in place. This can be done more - efficiently than a general multiplication, because many of the - computation steps are redundant when squaring. The inner product - step is a bit more complicated, but we save a fair number of - iterations of the multiplication loop. - */ -#if MP_SQUARE -mp_err s_mp_sqr(mp_int *a) -{ - mp_word w, k = 0; - mp_int tmp; - mp_err res; - mp_size ix, jx, kx, used = USED(a); - mp_digit *pa1, *pa2, *pt, *pbt; - - if((res = mp_init_size(&tmp, 2 * used)) != MP_OKAY) - return res; - - /* Left-pad with zeroes */ - USED(&tmp) = 2 * used; - - /* We need the base value each time through the loop */ - pbt = DIGITS(&tmp); - - pa1 = DIGITS(a); - for(ix = 0; ix < used; ++ix, ++pa1) { - if(*pa1 == 0) - continue; - - w = DIGIT(&tmp, ix + ix) + (*pa1 * *pa1); - - pbt[ix + ix] = ACCUM(w); - k = CARRYOUT(w); - - /* - The inner product is computed as: - - (C, S) = t[i,j] + 2 a[i] a[j] + C - - This can overflow what can be represented in an mp_word, and - since C arithmetic does not provide any way to check for - overflow, we have to check explicitly for overflow conditions - before they happen. - */ - for(jx = ix + 1, pa2 = DIGITS(a) + jx; jx < used; ++jx, ++pa2) { - mp_word u = 0, v; - - /* Store this in a temporary to avoid indirections later */ - pt = pbt + ix + jx; - - /* Compute the multiplicative step */ - w = *pa1 * *pa2; - - /* If w is more than half MP_WORD_MAX, the doubling will - overflow, and we need to record a carry out into the next - word */ - u = (w >> (MP_WORD_BIT - 1)) & 1; - - /* Double what we've got, overflow will be ignored as defined - for C arithmetic (we've already noted if it is to occur) - */ - w *= 2; - - /* Compute the additive step */ - v = *pt + k; - - /* If we do not already have an overflow carry, check to see - if the addition will cause one, and set the carry out if so - */ - u |= ((MP_WORD_MAX - v) < w); - - /* Add in the rest, again ignoring overflow */ - w += v; - - /* Set the i,j digit of the output */ - *pt = ACCUM(w); - - /* Save carry information for the next iteration of the loop. - This is why k must be an mp_word, instead of an mp_digit */ - k = CARRYOUT(w) | (u << DIGIT_BIT); - - } /* for(jx ...) */ - - /* Set the last digit in the cycle and reset the carry */ - k = DIGIT(&tmp, ix + jx) + k; - pbt[ix + jx] = ACCUM(k); - k = CARRYOUT(k); - - /* If we are carrying out, propagate the carry to the next digit - in the output. This may cascade, so we have to be somewhat - circumspect -- but we will have enough precision in the output - that we won't overflow - */ - kx = 1; - while(k) { - k = pbt[ix + jx + kx] + 1; - pbt[ix + jx + kx] = ACCUM(k); - k = CARRYOUT(k); - ++kx; - } - } /* for(ix ...) */ - - s_mp_clamp(&tmp); - s_mp_exch(&tmp, a); - - mp_clear(&tmp); - - return MP_OKAY; - -} /* end s_mp_sqr() */ -#endif - -/* }}} */ - -/* {{{ s_mp_div(a, b) */ - -/* - s_mp_div(a, b) - - Compute a = a / b and b = a mod b. Assumes b > a. - */ - -mp_err s_mp_div(mp_int *a, mp_int *b) -{ - mp_int quot, rem, t; - mp_word q; - mp_err res; - mp_digit d; - int ix; - - if(mp_cmp_z(b) == 0) - return MP_RANGE; - - /* Shortcut if b is power of two */ - if((ix = s_mp_ispow2(b)) >= 0) { - mp_copy(a, b); /* need this for remainder */ - s_mp_div_2d(a, (mp_digit)ix); - s_mp_mod_2d(b, (mp_digit)ix); - - return MP_OKAY; - } - - /* Allocate space to store the quotient */ - if((res = mp_init_size(", USED(a))) != MP_OKAY) - return res; - - /* A working temporary for division */ - if((res = mp_init_size(&t, USED(a))) != MP_OKAY) - goto T; - - /* Allocate space for the remainder */ - if((res = mp_init_size(&rem, USED(a))) != MP_OKAY) - goto REM; - - /* Normalize to optimize guessing */ - d = s_mp_norm(a, b); - - /* Perform the division itself...woo! */ - ix = USED(a) - 1; - - while(ix >= 0) { - /* Find a partial substring of a which is at least b */ - while(s_mp_cmp(&rem, b) < 0 && ix >= 0) { - if((res = s_mp_lshd(&rem, 1)) != MP_OKAY) - goto CLEANUP; - - if((res = s_mp_lshd(", 1)) != MP_OKAY) - goto CLEANUP; - - DIGIT(&rem, 0) = DIGIT(a, ix); - s_mp_clamp(&rem); - --ix; - } - - /* If we didn't find one, we're finished dividing */ - if(s_mp_cmp(&rem, b) < 0) - break; - - /* Compute a guess for the next quotient digit */ - q = DIGIT(&rem, USED(&rem) - 1); - if(q <= DIGIT(b, USED(b) - 1) && USED(&rem) > 1) - q = (q << DIGIT_BIT) | DIGIT(&rem, USED(&rem) - 2); - - q /= DIGIT(b, USED(b) - 1); - - /* The guess can be as much as RADIX + 1 */ - if(q >= RADIX) - q = RADIX - 1; - - /* See what that multiplies out to */ - mp_copy(b, &t); - if((res = s_mp_mul_d(&t, q)) != MP_OKAY) - goto CLEANUP; - - /* - If it's too big, back it off. We should not have to do this - more than once, or, in rare cases, twice. Knuth describes a - method by which this could be reduced to a maximum of once, but - I didn't implement that here. - */ - while(s_mp_cmp(&t, &rem) > 0) { - --q; - s_mp_sub(&t, b); - } - - /* At this point, q should be the right next digit */ - if((res = s_mp_sub(&rem, &t)) != MP_OKAY) - goto CLEANUP; - - /* - Include the digit in the quotient. We allocated enough memory - for any quotient we could ever possibly get, so we should not - have to check for failures here - */ - DIGIT(", 0) = q; - } - - /* Denormalize remainder */ - if(d != 0) - s_mp_div_2d(&rem, d); - - s_mp_clamp("); - s_mp_clamp(&rem); - - /* Copy quotient back to output */ - s_mp_exch(", a); - - /* Copy remainder back to output */ - s_mp_exch(&rem, b); - -CLEANUP: - mp_clear(&rem); -REM: - mp_clear(&t); -T: - mp_clear("); - - return res; - -} /* end s_mp_div() */ - -/* }}} */ - -/* {{{ s_mp_2expt(a, k) */ - -mp_err s_mp_2expt(mp_int *a, mp_digit k) -{ - mp_err res; - mp_size dig, bit; - - dig = k / DIGIT_BIT; - bit = k % DIGIT_BIT; - - mp_zero(a); - if((res = s_mp_pad(a, dig + 1)) != MP_OKAY) - return res; - - DIGIT(a, dig) |= (1 << bit); - - return MP_OKAY; - -} /* end s_mp_2expt() */ - -/* }}} */ - - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive comparisons */ - -/* {{{ s_mp_cmp(a, b) */ - -/* Compare |a| <=> |b|, return 0 if equal, <0 if a0 if a>b */ -int s_mp_cmp(mp_int *a, mp_int *b) -{ - mp_size ua = USED(a), ub = USED(b); - - if(ua > ub) - return MP_GT; - else if(ua < ub) - return MP_LT; - else { - int ix = ua - 1; - mp_digit *ap = DIGITS(a) + ix, *bp = DIGITS(b) + ix; - - while(ix >= 0) { - if(*ap > *bp) - return MP_GT; - else if(*ap < *bp) - return MP_LT; - - --ap; --bp; --ix; - } - - return MP_EQ; - } - -} /* end s_mp_cmp() */ - -/* }}} */ - -/* {{{ s_mp_cmp_d(a, d) */ - -/* Compare |a| <=> d, return 0 if equal, <0 if a0 if a>d */ -int s_mp_cmp_d(mp_int *a, mp_digit d) -{ - mp_size ua = USED(a); - mp_digit *ap = DIGITS(a); - - if(ua > 1) - return MP_GT; - - if(*ap < d) - return MP_LT; - else if(*ap > d) - return MP_GT; - else - return MP_EQ; - -} /* end s_mp_cmp_d() */ - -/* }}} */ - -/* {{{ s_mp_ispow2(v) */ - -/* - Returns -1 if the value is not a power of two; otherwise, it returns - k such that v = 2^k, i.e. lg(v). - */ -int s_mp_ispow2(mp_int *v) -{ - mp_digit d, *dp; - mp_size uv = USED(v); - int extra = 0, ix; - - d = DIGIT(v, uv - 1); /* most significant digit of v */ - - while(d && ((d & 1) == 0)) { - d >>= 1; - ++extra; - } - - if(d == 1) { - ix = uv - 2; - dp = DIGITS(v) + ix; - - while(ix >= 0) { - if(*dp) - return -1; /* not a power of two */ - - --dp; --ix; - } - - return ((uv - 1) * DIGIT_BIT) + extra; - } - - return -1; - -} /* end s_mp_ispow2() */ - -/* }}} */ - -/* {{{ s_mp_ispow2d(d) */ - -int s_mp_ispow2d(mp_digit d) -{ - int pow = 0; - - while((d & 1) == 0) { - ++pow; d >>= 1; - } - - if(d == 1) - return pow; - - return -1; - -} /* end s_mp_ispow2d() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive I/O helpers */ - -/* {{{ s_mp_tovalue(ch, r) */ - -/* - Convert the given character to its digit value, in the given radix. - If the given character is not understood in the given radix, -1 is - returned. Otherwise the digit's numeric value is returned. - - The results will be odd if you use a radix < 2 or > 62, you are - expected to know what you're up to. - */ -int s_mp_tovalue(char ch, int r) -{ - int val, xch; - - if(r > 36) - xch = ch; - else - xch = toupper(ch); - - if(isdigit(xch)) - val = xch - '0'; - else if(isupper(xch)) - val = xch - 'A' + 10; - else if(islower(xch)) - val = xch - 'a' + 36; - else if(xch == '+') - val = 62; - else if(xch == '/') - val = 63; - else - return -1; - - if(val < 0 || val >= r) - return -1; - - return val; - -} /* end s_mp_tovalue() */ - -/* }}} */ - -/* {{{ s_mp_todigit(val, r, low) */ - -/* - Convert val to a radix-r digit, if possible. If val is out of range - for r, returns zero. Otherwise, returns an ASCII character denoting - the value in the given radix. - - The results may be odd if you use a radix < 2 or > 64, you are - expected to know what you're doing. - */ - -char s_mp_todigit(int val, int r, int low) -{ - char ch; - - if(val < 0 || val >= r) - return 0; - - ch = s_dmap_1[val]; - - if(r <= 36 && low) - ch = tolower(ch); - - return ch; - -} /* end s_mp_todigit() */ - -/* }}} */ - -/* {{{ s_mp_outlen(bits, radix) */ - -/* - Return an estimate for how long a string is needed to hold a radix - r representation of a number with 'bits' significant bits. - - Does not include space for a sign or a NUL terminator. - */ -int s_mp_outlen(int bits, int r) -{ - return (int)((double)bits * LOG_V_2(r)); - -} /* end s_mp_outlen() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* HERE THERE BE DRAGONS */ -/* crc==4242132123, version==2, Sat Feb 02 06:43:52 2002 */ - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi.h b/libtommath/mtest/mpi.h deleted file mode 100644 index 5accb52..0000000 --- a/libtommath/mtest/mpi.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - mpi.h - - by Michael J. Fromberger - Copyright (C) 1998 Michael J. Fromberger, All Rights Reserved - - Arbitrary precision integer arithmetic library - - $Id$ - */ - -#ifndef _H_MPI_ -#define _H_MPI_ - -#include "mpi-config.h" - -#define MP_LT -1 -#define MP_EQ 0 -#define MP_GT 1 - -#if MP_DEBUG -#undef MP_IOFUNC -#define MP_IOFUNC 1 -#endif - -#if MP_IOFUNC -#include -#include -#endif - -#include - -#define MP_NEG 1 -#define MP_ZPOS 0 - -/* Included for compatibility... */ -#define NEG MP_NEG -#define ZPOS MP_ZPOS - -#define MP_OKAY 0 /* no error, all is well */ -#define MP_YES 0 /* yes (boolean result) */ -#define MP_NO -1 /* no (boolean result) */ -#define MP_MEM -2 /* out of memory */ -#define MP_RANGE -3 /* argument out of range */ -#define MP_BADARG -4 /* invalid parameter */ -#define MP_UNDEF -5 /* answer is undefined */ -#define MP_LAST_CODE MP_UNDEF - -#include "mpi-types.h" - -/* Included for compatibility... */ -#define DIGIT_BIT MP_DIGIT_BIT -#define DIGIT_MAX MP_DIGIT_MAX - -/* Macros for accessing the mp_int internals */ -#define SIGN(MP) ((MP)->sign) -#define USED(MP) ((MP)->used) -#define ALLOC(MP) ((MP)->alloc) -#define DIGITS(MP) ((MP)->dp) -#define DIGIT(MP,N) (MP)->dp[(N)] - -#if MP_ARGCHK == 1 -#define ARGCHK(X,Y) {if(!(X)){return (Y);}} -#elif MP_ARGCHK == 2 -#include -#define ARGCHK(X,Y) assert(X) -#else -#define ARGCHK(X,Y) /* */ -#endif - -/* This defines the maximum I/O base (minimum is 2) */ -#define MAX_RADIX 64 - -typedef struct { - mp_sign sign; /* sign of this quantity */ - mp_size alloc; /* how many digits allocated */ - mp_size used; /* how many digits used */ - mp_digit *dp; /* the digits themselves */ -} mp_int; - -/*------------------------------------------------------------------------*/ -/* Default precision */ - -unsigned int mp_get_prec(void); -void mp_set_prec(unsigned int prec); - -/*------------------------------------------------------------------------*/ -/* Memory management */ - -mp_err mp_init(mp_int *mp); -mp_err mp_init_array(mp_int mp[], int count); -mp_err mp_init_size(mp_int *mp, mp_size prec); -mp_err mp_init_copy(mp_int *mp, mp_int *from); -mp_err mp_copy(mp_int *from, mp_int *to); -void mp_exch(mp_int *mp1, mp_int *mp2); -void mp_clear(mp_int *mp); -void mp_clear_array(mp_int mp[], int count); -void mp_zero(mp_int *mp); -void mp_set(mp_int *mp, mp_digit d); -mp_err mp_set_int(mp_int *mp, long z); -mp_err mp_shrink(mp_int *a); - - -/*------------------------------------------------------------------------*/ -/* Single digit arithmetic */ - -mp_err mp_add_d(mp_int *a, mp_digit d, mp_int *b); -mp_err mp_sub_d(mp_int *a, mp_digit d, mp_int *b); -mp_err mp_mul_d(mp_int *a, mp_digit d, mp_int *b); -mp_err mp_mul_2(mp_int *a, mp_int *c); -mp_err mp_div_d(mp_int *a, mp_digit d, mp_int *q, mp_digit *r); -mp_err mp_div_2(mp_int *a, mp_int *c); -mp_err mp_expt_d(mp_int *a, mp_digit d, mp_int *c); - -/*------------------------------------------------------------------------*/ -/* Sign manipulations */ - -mp_err mp_abs(mp_int *a, mp_int *b); -mp_err mp_neg(mp_int *a, mp_int *b); - -/*------------------------------------------------------------------------*/ -/* Full arithmetic */ - -mp_err mp_add(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_sub(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_mul(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_mul_2d(mp_int *a, mp_digit d, mp_int *c); -#if MP_SQUARE -mp_err mp_sqr(mp_int *a, mp_int *b); -#else -#define mp_sqr(a, b) mp_mul(a, a, b) -#endif -mp_err mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r); -mp_err mp_div_2d(mp_int *a, mp_digit d, mp_int *q, mp_int *r); -mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_2expt(mp_int *a, mp_digit k); -mp_err mp_sqrt(mp_int *a, mp_int *b); - -/*------------------------------------------------------------------------*/ -/* Modular arithmetic */ - -#if MP_MODARITH -mp_err mp_mod(mp_int *a, mp_int *m, mp_int *c); -mp_err mp_mod_d(mp_int *a, mp_digit d, mp_digit *c); -mp_err mp_addmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -mp_err mp_submod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -mp_err mp_mulmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -#if MP_SQUARE -mp_err mp_sqrmod(mp_int *a, mp_int *m, mp_int *c); -#else -#define mp_sqrmod(a, m, c) mp_mulmod(a, a, m, c) -#endif -mp_err mp_exptmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -mp_err mp_exptmod_d(mp_int *a, mp_digit d, mp_int *m, mp_int *c); -#endif /* MP_MODARITH */ - -/*------------------------------------------------------------------------*/ -/* Comparisons */ - -int mp_cmp_z(mp_int *a); -int mp_cmp_d(mp_int *a, mp_digit d); -int mp_cmp(mp_int *a, mp_int *b); -int mp_cmp_mag(mp_int *a, mp_int *b); -int mp_cmp_int(mp_int *a, long z); -int mp_isodd(mp_int *a); -int mp_iseven(mp_int *a); - -/*------------------------------------------------------------------------*/ -/* Number theoretic */ - -#if MP_NUMTH -mp_err mp_gcd(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_lcm(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_xgcd(mp_int *a, mp_int *b, mp_int *g, mp_int *x, mp_int *y); -mp_err mp_invmod(mp_int *a, mp_int *m, mp_int *c); -#endif /* end MP_NUMTH */ - -/*------------------------------------------------------------------------*/ -/* Input and output */ - -#if MP_IOFUNC -void mp_print(mp_int *mp, FILE *ofp); -#endif /* end MP_IOFUNC */ - -/*------------------------------------------------------------------------*/ -/* Base conversion */ - -#define BITS 1 -#define BYTES CHAR_BIT - -mp_err mp_read_signed_bin(mp_int *mp, unsigned char *str, int len); -int mp_signed_bin_size(mp_int *mp); -mp_err mp_to_signed_bin(mp_int *mp, unsigned char *str); - -mp_err mp_read_unsigned_bin(mp_int *mp, unsigned char *str, int len); -int mp_unsigned_bin_size(mp_int *mp); -mp_err mp_to_unsigned_bin(mp_int *mp, unsigned char *str); - -int mp_count_bits(mp_int *mp); - -#if MP_COMPAT_MACROS -#define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) -#define mp_raw_size(mp) mp_signed_bin_size(mp) -#define mp_toraw(mp, str) mp_to_signed_bin((mp), (str)) -#define mp_read_mag(mp, str, len) mp_read_unsigned_bin((mp), (str), (len)) -#define mp_mag_size(mp) mp_unsigned_bin_size(mp) -#define mp_tomag(mp, str) mp_to_unsigned_bin((mp), (str)) -#endif - -mp_err mp_read_radix(mp_int *mp, unsigned char *str, int radix); -int mp_radix_size(mp_int *mp, int radix); -int mp_value_radix_size(int num, int qty, int radix); -mp_err mp_toradix(mp_int *mp, char *str, int radix); - -int mp_char2value(char ch, int r); - -#define mp_tobinary(M, S) mp_toradix((M), (S), 2) -#define mp_tooctal(M, S) mp_toradix((M), (S), 8) -#define mp_todecimal(M, S) mp_toradix((M), (S), 10) -#define mp_tohex(M, S) mp_toradix((M), (S), 16) - -/*------------------------------------------------------------------------*/ -/* Error strings */ - -const char *mp_strerror(mp_err ec); - -#endif /* end _H_MPI_ */ - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mtest.c b/libtommath/mtest/mtest.c deleted file mode 100644 index 56b5a90..0000000 --- a/libtommath/mtest/mtest.c +++ /dev/null @@ -1,374 +0,0 @@ -/* makes a bignum test harness with NUM tests per operation - * - * the output is made in the following format [one parameter per line] - -operation -operand1 -operand2 -[... operandN] -result1 -result2 -[... resultN] - -So for example "a * b mod n" would be - -mulmod -a -b -n -a*b mod n - -e.g. if a=3, b=4 n=11 then - -mulmod -3 -4 -11 -1 - - */ - -#ifdef MP_8BIT -#define THE_MASK 127 -#else -#define THE_MASK 32767 -#endif - -#include -#include -#include -#include "mpi.c" - -#ifdef LTM_MTEST_REAL_RAND -#define getRandChar() fgetc(rng) -FILE *rng; -#else -#define getRandChar() (rand()&0xFF) -#endif - -void rand_num(mp_int *a) -{ - int size; - unsigned char buf[2048]; - size_t sz; - - size = 1 + ((getRandChar()<<8) + getRandChar()) % 101; - buf[0] = (getRandChar()&1)?1:0; -#ifdef LTM_MTEST_REAL_RAND - sz = fread(buf+1, 1, size, rng); -#else - sz = 1; - while (sz < (unsigned)size) { - buf[sz] = getRandChar(); - ++sz; - } -#endif - if (sz != (unsigned)size) { - fprintf(stderr, "\nWarning: fread failed\n\n"); - } - while (buf[1] == 0) buf[1] = getRandChar(); - mp_read_raw(a, buf, 1+size); -} - -void rand_num2(mp_int *a) -{ - int size; - unsigned char buf[2048]; - size_t sz; - - size = 10 + ((getRandChar()<<8) + getRandChar()) % 101; - buf[0] = (getRandChar()&1)?1:0; -#ifdef LTM_MTEST_REAL_RAND - sz = fread(buf+1, 1, size, rng); -#else - sz = 1; - while (sz < (unsigned)size) { - buf[sz] = getRandChar(); - ++sz; - } -#endif - if (sz != (unsigned)size) { - fprintf(stderr, "\nWarning: fread failed\n\n"); - } - while (buf[1] == 0) buf[1] = getRandChar(); - mp_read_raw(a, buf, 1+size); -} - -#define mp_to64(a, b) mp_toradix(a, b, 64) - -int main(int argc, char *argv[]) -{ - int n, tmp; - long long max; - mp_int a, b, c, d, e; -#ifdef MTEST_NO_FULLSPEED - clock_t t1; -#endif - char buf[4096]; - - mp_init(&a); - mp_init(&b); - mp_init(&c); - mp_init(&d); - mp_init(&e); - - if (argc > 1) { - max = strtol(argv[1], NULL, 0); - if (max < 0) { - if (max > -64) { - max = (1 << -(max)) + 1; - } else { - max = 1; - } - } else if (max == 0) { - max = 1; - } - } - else { - max = 0; - } - - - /* initial (2^n - 1)^2 testing, makes sure the comba multiplier works [it has the new carry code] */ -/* - mp_set(&a, 1); - for (n = 1; n < 8192; n++) { - mp_mul(&a, &a, &c); - printf("mul\n"); - mp_to64(&a, buf); - printf("%s\n%s\n", buf, buf); - mp_to64(&c, buf); - printf("%s\n", buf); - - mp_add_d(&a, 1, &a); - mp_mul_2(&a, &a); - mp_sub_d(&a, 1, &a); - } -*/ - -#ifdef LTM_MTEST_REAL_RAND - rng = fopen("/dev/urandom", "rb"); - if (rng == NULL) { - rng = fopen("/dev/random", "rb"); - if (rng == NULL) { - fprintf(stderr, "\nWarning: stdin used as random source\n\n"); - rng = stdin; - } - } -#else - srand(23); -#endif - -#ifdef MTEST_NO_FULLSPEED - t1 = clock(); -#endif - for (;;) { -#ifdef MTEST_NO_FULLSPEED - if (clock() - t1 > CLOCKS_PER_SEC) { - sleep(2); - t1 = clock(); - } -#endif - n = getRandChar() % 15; - - if (max != 0) { - --max; - if (max == 0) - n = 255; - } - - if (n == 0) { - /* add tests */ - rand_num(&a); - rand_num(&b); - mp_add(&a, &b, &c); - printf("add\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 1) { - /* sub tests */ - rand_num(&a); - rand_num(&b); - mp_sub(&a, &b, &c); - printf("sub\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 2) { - /* mul tests */ - rand_num(&a); - rand_num(&b); - mp_mul(&a, &b, &c); - printf("mul\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 3) { - /* div tests */ - rand_num(&a); - rand_num(&b); - mp_div(&a, &b, &c, &d); - printf("div\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - mp_to64(&d, buf); - printf("%s\n", buf); - } else if (n == 4) { - /* sqr tests */ - rand_num(&a); - mp_sqr(&a, &b); - printf("sqr\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 5) { - /* mul_2d test */ - rand_num(&a); - mp_copy(&a, &b); - n = getRandChar() & 63; - mp_mul_2d(&b, n, &b); - mp_to64(&a, buf); - printf("mul2d\n"); - printf("%s\n", buf); - printf("%d\n", n); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 6) { - /* div_2d test */ - rand_num(&a); - mp_copy(&a, &b); - n = getRandChar() & 63; - mp_div_2d(&b, n, &b, NULL); - mp_to64(&a, buf); - printf("div2d\n"); - printf("%s\n", buf); - printf("%d\n", n); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 7) { - /* gcd test */ - rand_num(&a); - rand_num(&b); - a.sign = MP_ZPOS; - b.sign = MP_ZPOS; - mp_gcd(&a, &b, &c); - printf("gcd\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 8) { - /* lcm test */ - rand_num(&a); - rand_num(&b); - a.sign = MP_ZPOS; - b.sign = MP_ZPOS; - mp_lcm(&a, &b, &c); - printf("lcm\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 9) { - /* exptmod test */ - rand_num2(&a); - rand_num2(&b); - rand_num2(&c); -// if (c.dp[0]&1) mp_add_d(&c, 1, &c); - a.sign = b.sign = c.sign = 0; - mp_exptmod(&a, &b, &c, &d); - printf("expt\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - mp_to64(&d, buf); - printf("%s\n", buf); - } else if (n == 10) { - /* invmod test */ - rand_num2(&a); - rand_num2(&b); - b.sign = MP_ZPOS; - a.sign = MP_ZPOS; - mp_gcd(&a, &b, &c); - if (mp_cmp_d(&c, 1) != 0) continue; - if (mp_cmp_d(&b, 1) == 0) continue; - mp_invmod(&a, &b, &c); - printf("invmod\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 11) { - rand_num(&a); - mp_mul_2(&a, &a); - mp_div_2(&a, &b); - printf("div2\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 12) { - rand_num2(&a); - mp_mul_2(&a, &b); - printf("mul2\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 13) { - rand_num2(&a); - tmp = abs(rand()) & THE_MASK; - mp_add_d(&a, tmp, &b); - printf("add_d\n"); - mp_to64(&a, buf); - printf("%s\n%d\n", buf, tmp); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 14) { - rand_num2(&a); - tmp = abs(rand()) & THE_MASK; - mp_sub_d(&a, tmp, &b); - printf("sub_d\n"); - mp_to64(&a, buf); - printf("%s\n%d\n", buf, tmp); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 255) { - printf("exit\n"); - break; - } - - } -#ifdef LTM_MTEST_REAL_RAND - fclose(rng); -#endif - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/parsenames.pl b/libtommath/parsenames.pl deleted file mode 100755 index cc57673..0000000 --- a/libtommath/parsenames.pl +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl -# -# Splits the list of files and outputs for makefile type files -# wrapped at 80 chars -# -# Tom St Denis -@a = split(" ", $ARGV[1]); -$b = "$ARGV[0]="; -$len = length($b); -print $b; -foreach my $obj (@a) { - $len = $len + length($obj); - $obj =~ s/\*/\$/; - if ($len > 100) { - printf "\\\n"; - $len = length($obj); - } - print "$obj "; -} - -print "\n\n"; - -# $Source$ -# $Revision$ -# $Date$ diff --git a/libtommath/pics/design_process.sxd b/libtommath/pics/design_process.sxd deleted file mode 100644 index 7414dbb..0000000 Binary files a/libtommath/pics/design_process.sxd and /dev/null differ diff --git a/libtommath/pics/design_process.tif b/libtommath/pics/design_process.tif deleted file mode 100644 index 4a0c012..0000000 Binary files a/libtommath/pics/design_process.tif and /dev/null differ diff --git a/libtommath/pics/expt_state.sxd b/libtommath/pics/expt_state.sxd deleted file mode 100644 index 6518404..0000000 Binary files a/libtommath/pics/expt_state.sxd and /dev/null differ diff --git a/libtommath/pics/expt_state.tif b/libtommath/pics/expt_state.tif deleted file mode 100644 index cb06e8e..0000000 Binary files a/libtommath/pics/expt_state.tif and /dev/null differ diff --git a/libtommath/pics/makefile b/libtommath/pics/makefile deleted file mode 100644 index 3ecb02f..0000000 --- a/libtommath/pics/makefile +++ /dev/null @@ -1,35 +0,0 @@ -# makes the images... yeah - -default: pses - -design_process.ps: design_process.tif - tiff2ps -s -e design_process.tif > design_process.ps - -sliding_window.ps: sliding_window.tif - tiff2ps -s -e sliding_window.tif > sliding_window.ps - -expt_state.ps: expt_state.tif - tiff2ps -s -e expt_state.tif > expt_state.ps - -primality.ps: primality.tif - tiff2ps -s -e primality.tif > primality.ps - -design_process.pdf: design_process.ps - epstopdf design_process.ps - -sliding_window.pdf: sliding_window.ps - epstopdf sliding_window.ps - -expt_state.pdf: expt_state.ps - epstopdf expt_state.ps - -primality.pdf: primality.ps - epstopdf primality.ps - - -pses: sliding_window.ps expt_state.ps primality.ps design_process.ps -pdfes: sliding_window.pdf expt_state.pdf primality.pdf design_process.pdf - -clean: - rm -rf *.ps *.pdf .xvpics - \ No newline at end of file diff --git a/libtommath/pics/primality.tif b/libtommath/pics/primality.tif deleted file mode 100644 index 76d6be3..0000000 Binary files a/libtommath/pics/primality.tif and /dev/null differ diff --git a/libtommath/pics/radix.sxd b/libtommath/pics/radix.sxd deleted file mode 100644 index b9eb9a0..0000000 Binary files a/libtommath/pics/radix.sxd and /dev/null differ diff --git a/libtommath/pics/sliding_window.sxd b/libtommath/pics/sliding_window.sxd deleted file mode 100644 index 91e7c0d..0000000 Binary files a/libtommath/pics/sliding_window.sxd and /dev/null differ diff --git a/libtommath/pics/sliding_window.tif b/libtommath/pics/sliding_window.tif deleted file mode 100644 index bb4cb96..0000000 Binary files a/libtommath/pics/sliding_window.tif and /dev/null differ diff --git a/libtommath/poster.out b/libtommath/poster.out deleted file mode 100644 index e69de29..0000000 diff --git a/libtommath/poster.pdf b/libtommath/poster.pdf deleted file mode 100644 index f212c3e..0000000 Binary files a/libtommath/poster.pdf and /dev/null differ diff --git a/libtommath/poster.tex b/libtommath/poster.tex deleted file mode 100644 index e7388f4..0000000 --- a/libtommath/poster.tex +++ /dev/null @@ -1,35 +0,0 @@ -\documentclass[landscape,11pt]{article} -\usepackage{amsmath, amssymb} -\usepackage{hyperref} -\begin{document} -\hspace*{-3in} -\begin{tabular}{llllll} -$c = a + b$ & {\tt mp\_add(\&a, \&b, \&c)} & $b = 2a$ & {\tt mp\_mul\_2(\&a, \&b)} & \\ -$c = a - b$ & {\tt mp\_sub(\&a, \&b, \&c)} & $b = a/2$ & {\tt mp\_div\_2(\&a, \&b)} & \\ -$c = ab $ & {\tt mp\_mul(\&a, \&b, \&c)} & $c = 2^ba$ & {\tt mp\_mul\_2d(\&a, b, \&c)} \\ -$b = a^2 $ & {\tt mp\_sqr(\&a, \&b)} & $c = a/2^b, d = a \mod 2^b$ & {\tt mp\_div\_2d(\&a, b, \&c, \&d)} \\ -$c = \lfloor a/b \rfloor, d = a \mod b$ & {\tt mp\_div(\&a, \&b, \&c, \&d)} & $c = a \mod 2^b $ & {\tt mp\_mod\_2d(\&a, b, \&c)} \\ - && \\ -$a = b $ & {\tt mp\_set\_int(\&a, b)} & $c = a \vee b$ & {\tt mp\_or(\&a, \&b, \&c)} \\ -$b = a $ & {\tt mp\_copy(\&a, \&b)} & $c = a \wedge b$ & {\tt mp\_and(\&a, \&b, \&c)} \\ - && $c = a \oplus b$ & {\tt mp\_xor(\&a, \&b, \&c)} \\ - & \\ -$b = -a $ & {\tt mp\_neg(\&a, \&b)} & $d = a + b \mod c$ & {\tt mp\_addmod(\&a, \&b, \&c, \&d)} \\ -$b = |a| $ & {\tt mp\_abs(\&a, \&b)} & $d = a - b \mod c$ & {\tt mp\_submod(\&a, \&b, \&c, \&d)} \\ - && $d = ab \mod c$ & {\tt mp\_mulmod(\&a, \&b, \&c, \&d)} \\ -Compare $a$ and $b$ & {\tt mp\_cmp(\&a, \&b)} & $c = a^2 \mod b$ & {\tt mp\_sqrmod(\&a, \&b, \&c)} \\ -Is Zero? & {\tt mp\_iszero(\&a)} & $c = a^{-1} \mod b$ & {\tt mp\_invmod(\&a, \&b, \&c)} \\ -Is Even? & {\tt mp\_iseven(\&a)} & $d = a^b \mod c$ & {\tt mp\_exptmod(\&a, \&b, \&c, \&d)} \\ -Is Odd ? & {\tt mp\_isodd(\&a)} \\ -&\\ -$\vert \vert a \vert \vert$ & {\tt mp\_unsigned\_bin\_size(\&a)} & $res$ = 1 if $a$ prime to $t$ rounds? & {\tt mp\_prime\_is\_prime(\&a, t, \&res)} \\ -$buf \leftarrow a$ & {\tt mp\_to\_unsigned\_bin(\&a, buf)} & Next prime after $a$ to $t$ rounds. & {\tt mp\_prime\_next\_prime(\&a, t, bbs\_style)} \\ -$a \leftarrow buf[0..len-1]$ & {\tt mp\_read\_unsigned\_bin(\&a, buf, len)} \\ -&\\ -$b = \sqrt{a}$ & {\tt mp\_sqrt(\&a, \&b)} & $c = \mbox{gcd}(a, b)$ & {\tt mp\_gcd(\&a, \&b, \&c)} \\ -$c = a^{1/b}$ & {\tt mp\_n\_root(\&a, b, \&c)} & $c = \mbox{lcm}(a, b)$ & {\tt mp\_lcm(\&a, \&b, \&c)} \\ -&\\ -Greater Than & MP\_GT & Equal To & MP\_EQ \\ -Less Than & MP\_LT & Bits per digit & DIGIT\_BIT \\ -\end{tabular} -\end{document} diff --git a/libtommath/pre_gen/mpi.c b/libtommath/pre_gen/mpi.c deleted file mode 100644 index 0d55d73..0000000 --- a/libtommath/pre_gen/mpi.c +++ /dev/null @@ -1,9524 +0,0 @@ -/* Start: bn_error.c */ -#include -#ifdef BN_ERROR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -static const struct { - int code; - char *msg; -} msgs[] = { - { MP_OKAY, "Successful" }, - { MP_MEM, "Out of heap" }, - { MP_VAL, "Value out of range" } -}; - -/* return a char * string for a given code */ -char *mp_error_to_string(int code) -{ - int x; - - /* scan the lookup table for the given message */ - for (x = 0; x < (int)(sizeof(msgs) / sizeof(msgs[0])); x++) { - if (msgs[x].code == code) { - return msgs[x].msg; - } - } - - /* generic reply for invalid code */ - return "Invalid error code"; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_error.c */ - -/* Start: bn_fast_mp_invmod.c */ -#include -#ifdef BN_FAST_MP_INVMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes the modular inverse via binary extended euclidean algorithm, - * that is c = 1/a mod b - * - * Based on slow invmod except this is optimized for the case where b is - * odd as per HAC Note 14.64 on pp. 610 - */ -int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int x, y, u, v, B, D; - int res, neg; - - /* 2. [modified] b must be odd */ - if (mp_iseven (b) == 1) { - return MP_VAL; - } - - /* init all our temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x == modulus, y == value to invert */ - if ((res = mp_copy (b, &x)) != MP_OKAY) { - goto LBL_ERR; - } - - /* we need y = |a| */ - if ((res = mp_mod (a, b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&D, 1); - -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == 1) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { - goto LBL_ERR; - } - /* 4.2 if B is odd then */ - if (mp_isodd (&B) == 1) { - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* B = B/2 */ - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 5. while v is even do */ - while (mp_iseven (&v) == 1) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if D is odd then */ - if (mp_isodd (&D) == 1) { - /* D = (D-x)/2 */ - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* D = D/2 */ - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } else { - /* v - v - u, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* if not zero goto step 4 */ - if (mp_iszero (&u) == 0) { - goto top; - } - - /* now a = C, b = D, gcd == g*v */ - - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } - - /* b is now the inverse */ - neg = a->sign; - while (D.sign == MP_NEG) { - if ((res = mp_add (&D, b, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - mp_exch (&D, c); - c->sign = neg; - res = MP_OKAY; - -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_mp_invmod.c */ - -/* Start: bn_fast_mp_montgomery_reduce.c */ -#include -#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes xR**-1 == x (mod N) via Montgomery Reduction - * - * This is an optimized implementation of montgomery_reduce - * which uses the comba method to quickly calculate the columns of the - * reduction. - * - * Based on Algorithm 14.32 on pp.601 of HAC. -*/ -int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -{ - int ix, res, olduse; - mp_word W[MP_WARRAY]; - - /* get old used count */ - olduse = x->used; - - /* grow a as required */ - if (x->alloc < n->used + 1) { - if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { - return res; - } - } - - /* first we have to get the digits of the input into - * an array of double precision words W[...] - */ - { - register mp_word *_W; - register mp_digit *tmpx; - - /* alias for the W[] array */ - _W = W; - - /* alias for the digits of x*/ - tmpx = x->dp; - - /* copy the digits of a into W[0..a->used-1] */ - for (ix = 0; ix < x->used; ix++) { - *_W++ = *tmpx++; - } - - /* zero the high words of W[a->used..m->used*2] */ - for (; ix < n->used * 2 + 1; ix++) { - *_W++ = 0; - } - } - - /* now we proceed to zero successive digits - * from the least significant upwards - */ - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * m' mod b - * - * We avoid a double precision multiplication (which isn't required) - * by casting the value down to a mp_digit. Note this requires - * that W[ix-1] have the carry cleared (see after the inner loop) - */ - register mp_digit mu; - mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); - - /* a = a + mu * m * b**i - * - * This is computed in place and on the fly. The multiplication - * by b**i is handled by offseting which columns the results - * are added to. - * - * Note the comba method normally doesn't handle carries in the - * inner loop In this case we fix the carry from the previous - * column since the Montgomery reduction requires digits of the - * result (so far) [see above] to work. This is - * handled by fixing up one carry after the inner loop. The - * carry fixups are done in order so after these loops the - * first m->used words of W[] have the carries fixed - */ - { - register int iy; - register mp_digit *tmpn; - register mp_word *_W; - - /* alias for the digits of the modulus */ - tmpn = n->dp; - - /* Alias for the columns set by an offset of ix */ - _W = W + ix; - - /* inner loop */ - for (iy = 0; iy < n->used; iy++) { - *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); - } - } - - /* now fix carry for next digit, W[ix+1] */ - W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); - } - - /* now we have to propagate the carries and - * shift the words downward [all those least - * significant digits we zeroed]. - */ - { - register mp_digit *tmpx; - register mp_word *_W, *_W1; - - /* nox fix rest of carries */ - - /* alias for current word */ - _W1 = W + ix; - - /* alias for next word, where the carry goes */ - _W = W + ++ix; - - for (; ix <= n->used * 2 + 1; ix++) { - *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); - } - - /* copy out, A = A/b**n - * - * The result is A/b**n but instead of converting from an - * array of mp_word to mp_digit than calling mp_rshd - * we just copy them in the right order - */ - - /* alias for destination word */ - tmpx = x->dp; - - /* alias for shifted double precision result */ - _W = W + n->used; - - for (ix = 0; ix < n->used + 1; ix++) { - *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); - } - - /* zero oldused digits, if the input a was larger than - * m->used+1 we'll have to clear the digits - */ - for (; ix < olduse; ix++) { - *tmpx++ = 0; - } - } - - /* set the max used and clamp */ - x->used = n->used + 1; - mp_clamp (x); - - /* if A >= m then A = A - m */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_mp_montgomery_reduce.c */ - -/* Start: bn_fast_s_mp_mul_digs.c */ -#include -#ifdef BN_FAST_S_MP_MUL_DIGS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* Fast (comba) multiplier - * - * This is the fast column-array [comba] multiplier. It is - * designed to compute the columns of the product first - * then handle the carries afterwards. This has the effect - * of making the nested loops that compute the columns very - * simple and schedulable on super-scalar processors. - * - * This has been modified to produce a variable number of - * digits of output so if say only a half-product is required - * you don't have to compute the upper half (a feature - * required for fast Barrett reduction). - * - * Based on Algorithm 14.12 on pp.595 of HAC. - * - */ -int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - register mp_word _W; - - /* grow the destination as required */ - if (c->alloc < digs) { - if ((res = mp_grow (c, digs)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - pa = MIN(digs, a->used + b->used); - - /* clear the carry */ - _W = 0; - for (ix = 0; ix < pa; ix++) { - int tx, ty; - int iy; - mp_digit *tmpx, *tmpy; - - /* get offsets into the two bignums */ - ty = MIN(b->used-1, ix); - tx = ix - ty; - - /* setup temp aliases */ - tmpx = a->dp + tx; - tmpy = b->dp + ty; - - /* this is the number of times the loop will iterrate, essentially - while (tx++ < a->used && ty-- >= 0) { ... } - */ - iy = MIN(a->used-tx, ty+1); - - /* execute loop */ - for (iz = 0; iz < iy; ++iz) { - _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); - - } - - /* store term */ - W[ix] = ((mp_digit)_W) & MP_MASK; - - /* make next carry */ - _W = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = c->used; - c->used = pa; - - { - register mp_digit *tmpc; - tmpc = c->dp; - for (ix = 0; ix < pa+1; ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_s_mp_mul_digs.c */ - -/* Start: bn_fast_s_mp_mul_high_digs.c */ -#include -#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* this is a modified version of fast_s_mul_digs that only produces - * output digits *above* digs. See the comments for fast_s_mul_digs - * to see how it works. - * - * This is used in the Barrett reduction since for one of the multiplications - * only the higher digits were needed. This essentially halves the work. - * - * Based on Algorithm 14.12 on pp.595 of HAC. - */ -int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - mp_word _W; - - /* grow the destination as required */ - pa = a->used + b->used; - if (c->alloc < pa) { - if ((res = mp_grow (c, pa)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - pa = a->used + b->used; - _W = 0; - for (ix = digs; ix < pa; ix++) { - int tx, ty, iy; - mp_digit *tmpx, *tmpy; - - /* get offsets into the two bignums */ - ty = MIN(b->used-1, ix); - tx = ix - ty; - - /* setup temp aliases */ - tmpx = a->dp + tx; - tmpy = b->dp + ty; - - /* this is the number of times the loop will iterrate, essentially its - while (tx++ < a->used && ty-- >= 0) { ... } - */ - iy = MIN(a->used-tx, ty+1); - - /* execute loop */ - for (iz = 0; iz < iy; iz++) { - _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); - } - - /* store term */ - W[ix] = ((mp_digit)_W) & MP_MASK; - - /* make next carry */ - _W = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = c->used; - c->used = pa; - - { - register mp_digit *tmpc; - - tmpc = c->dp + digs; - for (ix = digs; ix < pa; ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_s_mp_mul_high_digs.c */ - -/* Start: bn_fast_s_mp_sqr.c */ -#include -#ifdef BN_FAST_S_MP_SQR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* the jist of squaring... - * you do like mult except the offset of the tmpx [one that - * starts closer to zero] can't equal the offset of tmpy. - * So basically you set up iy like before then you min it with - * (ty-tx) so that it never happens. You double all those - * you add in the inner loop - -After that loop you do the squares and add them in. -*/ - -int fast_s_mp_sqr (mp_int * a, mp_int * b) -{ - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY], *tmpx; - mp_word W1; - - /* grow the destination as required */ - pa = a->used + a->used; - if (b->alloc < pa) { - if ((res = mp_grow (b, pa)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - W1 = 0; - for (ix = 0; ix < pa; ix++) { - int tx, ty, iy; - mp_word _W; - mp_digit *tmpy; - - /* clear counter */ - _W = 0; - - /* get offsets into the two bignums */ - ty = MIN(a->used-1, ix); - tx = ix - ty; - - /* setup temp aliases */ - tmpx = a->dp + tx; - tmpy = a->dp + ty; - - /* this is the number of times the loop will iterrate, essentially - while (tx++ < a->used && ty-- >= 0) { ... } - */ - iy = MIN(a->used-tx, ty+1); - - /* now for squaring tx can never equal ty - * we halve the distance since they approach at a rate of 2x - * and we have to round because odd cases need to be executed - */ - iy = MIN(iy, (ty-tx+1)>>1); - - /* execute loop */ - for (iz = 0; iz < iy; iz++) { - _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); - } - - /* double the inner product and add carry */ - _W = _W + _W + W1; - - /* even columns have the square term in them */ - if ((ix&1) == 0) { - _W += ((mp_word)a->dp[ix>>1])*((mp_word)a->dp[ix>>1]); - } - - /* store it */ - W[ix] = (mp_digit)(_W & MP_MASK); - - /* make next carry */ - W1 = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = b->used; - b->used = a->used+a->used; - - { - mp_digit *tmpb; - tmpb = b->dp; - for (ix = 0; ix < pa; ix++) { - *tmpb++ = W[ix] & MP_MASK; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpb++ = 0; - } - } - mp_clamp (b); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_s_mp_sqr.c */ - -/* Start: bn_mp_2expt.c */ -#include -#ifdef BN_MP_2EXPT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes a = 2**b - * - * Simple algorithm which zeroes the int, grows it then just sets one bit - * as required. - */ -int -mp_2expt (mp_int * a, int b) -{ - int res; - - /* zero a as per default */ - mp_zero (a); - - /* grow a to accomodate the single bit */ - if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) { - return res; - } - - /* set the used count of where the bit will go */ - a->used = b / DIGIT_BIT + 1; - - /* put the single bit in its place */ - a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_2expt.c */ - -/* Start: bn_mp_abs.c */ -#include -#ifdef BN_MP_ABS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* b = |a| - * - * Simple function copies the input and fixes the sign to positive - */ -int -mp_abs (mp_int * a, mp_int * b) -{ - int res; - - /* copy a to b */ - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } - - /* force the sign of b to positive */ - b->sign = MP_ZPOS; - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_abs.c */ - -/* Start: bn_mp_add.c */ -#include -#ifdef BN_MP_ADD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* high level addition (handles signs) */ -int mp_add (mp_int * a, mp_int * b, mp_int * c) -{ - int sa, sb, res; - - /* get sign of both inputs */ - sa = a->sign; - sb = b->sign; - - /* handle two cases, not four */ - if (sa == sb) { - /* both positive or both negative */ - /* add their magnitudes, copy the sign */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* one positive, the other negative */ - /* subtract the one with the greater magnitude from */ - /* the one of the lesser magnitude. The result gets */ - /* the sign of the one with the greater magnitude. */ - if (mp_cmp_mag (a, b) == MP_LT) { - c->sign = sb; - res = s_mp_sub (b, a, c); - } else { - c->sign = sa; - res = s_mp_sub (a, b, c); - } - } - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_add.c */ - -/* Start: bn_mp_add_d.c */ -#include -#ifdef BN_MP_ADD_D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* single digit addition */ -int -mp_add_d (mp_int * a, mp_digit b, mp_int * c) -{ - int res, ix, oldused; - mp_digit *tmpa, *tmpc, mu; - - /* grow c as required */ - if (c->alloc < a->used + 1) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* if a is negative and |a| >= b, call c = |a| - b */ - if (a->sign == MP_NEG && (a->used > 1 || a->dp[0] >= b)) { - /* temporarily fix sign of a */ - a->sign = MP_ZPOS; - - /* c = |a| - b */ - res = mp_sub_d(a, b, c); - - /* fix sign */ - a->sign = c->sign = MP_NEG; - - /* clamp */ - mp_clamp(c); - - return res; - } - - /* old number of used digits in c */ - oldused = c->used; - - /* sign always positive */ - c->sign = MP_ZPOS; - - /* source alias */ - tmpa = a->dp; - - /* destination alias */ - tmpc = c->dp; - - /* if a is positive */ - if (a->sign == MP_ZPOS) { - /* add digit, after this we're propagating - * the carry. - */ - *tmpc = *tmpa++ + b; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - - /* now handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ + mu; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - } - /* set final carry */ - ix++; - *tmpc++ = mu; - - /* setup size */ - c->used = a->used + 1; - } else { - /* a was negative and |a| < b */ - c->used = 1; - - /* the result is a single digit */ - if (a->used == 1) { - *tmpc++ = b - a->dp[0]; - } else { - *tmpc++ = b; - } - - /* setup count so the clearing of oldused - * can fall through correctly - */ - ix = 1; - } - - /* now zero to oldused */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_add_d.c */ - -/* Start: bn_mp_addmod.c */ -#include -#ifdef BN_MP_ADDMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* d = a + b (mod c) */ -int -mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - int res; - mp_int t; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_add (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_addmod.c */ - -/* Start: bn_mp_and.c */ -#include -#ifdef BN_MP_AND_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* AND two ints together */ -int -mp_and (mp_int * a, mp_int * b, mp_int * c) -{ - int res, ix, px; - mp_int t, *x; - - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } - - for (ix = 0; ix < px; ix++) { - t.dp[ix] &= x->dp[ix]; - } - - /* zero digits above the last from the smallest mp_int */ - for (; ix < t.used; ix++) { - t.dp[ix] = 0; - } - - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_and.c */ - -/* Start: bn_mp_clamp.c */ -#include -#ifdef BN_MP_CLAMP_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* trim unused digits - * - * This is used to ensure that leading zero digits are - * trimed and the leading "used" digit will be non-zero - * Typically very fast. Also fixes the sign if there - * are no more leading digits - */ -void -mp_clamp (mp_int * a) -{ - /* decrease used while the most significant digit is - * zero. - */ - while (a->used > 0 && a->dp[a->used - 1] == 0) { - --(a->used); - } - - /* reset the sign flag if used == 0 */ - if (a->used == 0) { - a->sign = MP_ZPOS; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_clamp.c */ - -/* Start: bn_mp_clear.c */ -#include -#ifdef BN_MP_CLEAR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* clear one (frees) */ -void -mp_clear (mp_int * a) -{ - int i; - - /* only do anything if a hasn't been freed previously */ - if (a->dp != NULL) { - /* first zero the digits */ - for (i = 0; i < a->used; i++) { - a->dp[i] = 0; - } - - /* free ram */ - XFREE(a->dp); - - /* reset members to make debugging easier */ - a->dp = NULL; - a->alloc = a->used = 0; - a->sign = MP_ZPOS; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_clear.c */ - -/* Start: bn_mp_clear_multi.c */ -#include -#ifdef BN_MP_CLEAR_MULTI_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include - -void mp_clear_multi(mp_int *mp, ...) -{ - mp_int* next_mp = mp; - va_list args; - va_start(args, mp); - while (next_mp != NULL) { - mp_clear(next_mp); - next_mp = va_arg(args, mp_int*); - } - va_end(args); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_clear_multi.c */ - -/* Start: bn_mp_cmp.c */ -#include -#ifdef BN_MP_CMP_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* compare two ints (signed)*/ -int -mp_cmp (mp_int * a, mp_int * b) -{ - /* compare based on sign */ - if (a->sign != b->sign) { - if (a->sign == MP_NEG) { - return MP_LT; - } else { - return MP_GT; - } - } - - /* compare digits */ - if (a->sign == MP_NEG) { - /* if negative compare opposite direction */ - return mp_cmp_mag(b, a); - } else { - return mp_cmp_mag(a, b); - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cmp.c */ - -/* Start: bn_mp_cmp_d.c */ -#include -#ifdef BN_MP_CMP_D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* compare a digit */ -int mp_cmp_d(mp_int * a, mp_digit b) -{ - /* compare based on sign */ - if (a->sign == MP_NEG) { - return MP_LT; - } - - /* compare based on magnitude */ - if (a->used > 1) { - return MP_GT; - } - - /* compare the only digit of a to b */ - if (a->dp[0] > b) { - return MP_GT; - } else if (a->dp[0] < b) { - return MP_LT; - } else { - return MP_EQ; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cmp_d.c */ - -/* Start: bn_mp_cmp_mag.c */ -#include -#ifdef BN_MP_CMP_MAG_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag (mp_int * a, mp_int * b) -{ - int n; - mp_digit *tmpa, *tmpb; - - /* compare based on # of non-zero digits */ - if (a->used > b->used) { - return MP_GT; - } - - if (a->used < b->used) { - return MP_LT; - } - - /* alias for a */ - tmpa = a->dp + (a->used - 1); - - /* alias for b */ - tmpb = b->dp + (a->used - 1); - - /* compare based on digits */ - for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { - if (*tmpa > *tmpb) { - return MP_GT; - } - - if (*tmpa < *tmpb) { - return MP_LT; - } - } - return MP_EQ; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cmp_mag.c */ - -/* Start: bn_mp_cnt_lsb.c */ -#include -#ifdef BN_MP_CNT_LSB_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -static const int lnz[16] = { - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 -}; - -/* Counts the number of lsbs which are zero before the first zero bit */ -int mp_cnt_lsb(mp_int *a) -{ - int x; - mp_digit q, qq; - - /* easy out */ - if (mp_iszero(a) == 1) { - return 0; - } - - /* scan lower digits until non-zero */ - for (x = 0; x < a->used && a->dp[x] == 0; x++); - q = a->dp[x]; - x *= DIGIT_BIT; - - /* now scan this digit until a 1 is found */ - if ((q & 1) == 0) { - do { - qq = q & 15; - x += lnz[qq]; - q >>= 4; - } while (qq == 0); - } - return x; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cnt_lsb.c */ - -/* Start: bn_mp_copy.c */ -#include -#ifdef BN_MP_COPY_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* copy, b = a */ -int -mp_copy (mp_int * a, mp_int * b) -{ - int res, n; - - /* if dst == src do nothing */ - if (a == b) { - return MP_OKAY; - } - - /* grow dest */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } - - /* zero b and copy the parameters over */ - { - register mp_digit *tmpa, *tmpb; - - /* pointer aliases */ - - /* source */ - tmpa = a->dp; - - /* destination */ - tmpb = b->dp; - - /* copy all the digits */ - for (n = 0; n < a->used; n++) { - *tmpb++ = *tmpa++; - } - - /* clear high digits */ - for (; n < b->used; n++) { - *tmpb++ = 0; - } - } - - /* copy used count and sign */ - b->used = a->used; - b->sign = a->sign; - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_copy.c */ - -/* Start: bn_mp_count_bits.c */ -#include -#ifdef BN_MP_COUNT_BITS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* returns the number of bits in an int */ -int -mp_count_bits (mp_int * a) -{ - int r; - mp_digit q; - - /* shortcut */ - if (a->used == 0) { - return 0; - } - - /* get number of digits and add that */ - r = (a->used - 1) * DIGIT_BIT; - - /* take the last digit and count the bits in it */ - q = a->dp[a->used - 1]; - while (q > ((mp_digit) 0)) { - ++r; - q >>= ((mp_digit) 1); - } - return r; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_count_bits.c */ - -/* Start: bn_mp_div.c */ -#include -#ifdef BN_MP_DIV_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -#ifdef BN_MP_DIV_SMALL - -/* slower bit-bang division... also smaller */ -int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - mp_int ta, tb, tq, q; - int res, n, n2; - - /* is divisor zero ? */ - if (mp_iszero (b) == 1) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - /* init our temps */ - if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL) != MP_OKAY)) { - return res; - } - - - mp_set(&tq, 1); - n = mp_count_bits(a) - mp_count_bits(b); - if (((res = mp_abs(a, &ta)) != MP_OKAY) || - ((res = mp_abs(b, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) { - goto LBL_ERR; - } - - while (n-- >= 0) { - if (mp_cmp(&tb, &ta) != MP_GT) { - if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || - ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) { - goto LBL_ERR; - } - } - if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || - ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) { - goto LBL_ERR; - } - } - - /* now q == quotient and ta == remainder */ - n = a->sign; - n2 = (a->sign == b->sign ? MP_ZPOS : MP_NEG); - if (c != NULL) { - mp_exch(c, &q); - c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; - } - if (d != NULL) { - mp_exch(d, &ta); - d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; - } -LBL_ERR: - mp_clear_multi(&ta, &tb, &tq, &q, NULL); - return res; -} - -#else - -/* integer signed division. - * c*b + d == a [e.g. a/b, c=quotient, d=remainder] - * HAC pp.598 Algorithm 14.20 - * - * Note that the description in HAC is horribly - * incomplete. For example, it doesn't consider - * the case where digits are removed from 'x' in - * the inner loop. It also doesn't consider the - * case that y has fewer than three digits, etc.. - * - * The overall algorithm is as described as - * 14.20 from HAC but fixed to treat these cases. -*/ -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - mp_int q, x, y, t1, t2; - int res, n, t, i, norm, neg; - - /* is divisor zero ? */ - if (mp_iszero (b) == 1) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) { - return res; - } - q.used = a->used + 2; - - if ((res = mp_init (&t1)) != MP_OKAY) { - goto LBL_Q; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init_copy (&x, a)) != MP_OKAY) { - goto LBL_T2; - } - - if ((res = mp_init_copy (&y, b)) != MP_OKAY) { - goto LBL_X; - } - - /* fix the sign */ - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - x.sign = y.sign = MP_ZPOS; - - /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ - norm = mp_count_bits(&y) % DIGIT_BIT; - if (norm < (int)(DIGIT_BIT-1)) { - norm = (DIGIT_BIT-1) - norm; - if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) { - goto LBL_Y; - } - } else { - norm = 0; - } - - /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ - n = x.used - 1; - t = y.used - 1; - - /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ - if ((res = mp_lshd (&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ - goto LBL_Y; - } - - while (mp_cmp (&x, &y) != MP_LT) { - ++(q.dp[n - t]); - if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) { - goto LBL_Y; - } - } - - /* reset y by shifting it back down */ - mp_rshd (&y, n - t); - - /* step 3. for i from n down to (t + 1) */ - for (i = n; i >= (t + 1); i--) { - if (i > x.used) { - continue; - } - - /* step 3.1 if xi == yt then set q{i-t-1} to b-1, - * otherwise set q{i-t-1} to (xi*b + x{i-1})/yt */ - if (x.dp[i] == y.dp[t]) { - q.dp[i - t - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); - } else { - mp_word tmp; - tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); - tmp |= ((mp_word) x.dp[i - 1]); - tmp /= ((mp_word) y.dp[t]); - if (tmp > (mp_word) MP_MASK) - tmp = MP_MASK; - q.dp[i - t - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK)); - } - - /* while (q{i-t-1} * (yt * b + y{t-1})) > - xi * b**2 + xi-1 * b + xi-2 - - do q{i-t-1} -= 1; - */ - q.dp[i - t - 1] = (q.dp[i - t - 1] + 1) & MP_MASK; - do { - q.dp[i - t - 1] = (q.dp[i - t - 1] - 1) & MP_MASK; - - /* find left hand */ - mp_zero (&t1); - t1.dp[0] = (t - 1 < 0) ? 0 : y.dp[t - 1]; - t1.dp[1] = y.dp[t]; - t1.used = 2; - if ((res = mp_mul_d (&t1, q.dp[i - t - 1], &t1)) != MP_OKAY) { - goto LBL_Y; - } - - /* find right hand */ - t2.dp[0] = (i - 2 < 0) ? 0 : x.dp[i - 2]; - t2.dp[1] = (i - 1 < 0) ? 0 : x.dp[i - 1]; - t2.dp[2] = x.dp[i]; - t2.used = 3; - } while (mp_cmp_mag(&t1, &t2) == MP_GT); - - /* step 3.3 x = x - q{i-t-1} * y * b**{i-t-1} */ - if ((res = mp_mul_d (&y, q.dp[i - t - 1], &t1)) != MP_OKAY) { - goto LBL_Y; - } - - if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) { - goto LBL_Y; - } - - if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; - } - - /* if x < 0 then { x = x + y*b**{i-t-1}; q{i-t-1} -= 1; } */ - if (x.sign == MP_NEG) { - if ((res = mp_copy (&y, &t1)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; - } - - q.dp[i - t - 1] = (q.dp[i - t - 1] - 1UL) & MP_MASK; - } - } - - /* now q is the quotient and x is the remainder - * [which we have to normalize] - */ - - /* get sign before writing to c */ - x.sign = x.used == 0 ? MP_ZPOS : a->sign; - - if (c != NULL) { - mp_clamp (&q); - mp_exch (&q, c); - c->sign = neg; - } - - if (d != NULL) { - mp_div_2d (&x, norm, &x, NULL); - mp_exch (&x, d); - } - - res = MP_OKAY; - -LBL_Y:mp_clear (&y); -LBL_X:mp_clear (&x); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); -LBL_Q:mp_clear (&q); - return res; -} - -#endif - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div.c */ - -/* Start: bn_mp_div_2.c */ -#include -#ifdef BN_MP_DIV_2_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* b = a/2 */ -int mp_div_2(mp_int * a, mp_int * b) -{ - int x, res, oldused; - - /* copy */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } - - oldused = b->used; - b->used = a->used; - { - register mp_digit r, rr, *tmpa, *tmpb; - - /* source alias */ - tmpa = a->dp + b->used - 1; - - /* dest alias */ - tmpb = b->dp + b->used - 1; - - /* carry */ - r = 0; - for (x = b->used - 1; x >= 0; x--) { - /* get the carry for the next iteration */ - rr = *tmpa & 1; - - /* shift the current digit, add in carry and store */ - *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); - - /* forward carry to next iteration */ - r = rr; - } - - /* zero excess digits */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - mp_clamp (b); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_2.c */ - -/* Start: bn_mp_div_2d.c */ -#include -#ifdef BN_MP_DIV_2D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) -{ - mp_digit D, r, rr; - int x, res; - mp_int t; - - - /* if the shift count is <= 0 then we do no work */ - if (b <= 0) { - res = mp_copy (a, c); - if (d != NULL) { - mp_zero (d); - } - return res; - } - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - /* get the remainder */ - if (d != NULL) { - if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - mp_clear (&t); - return res; - } - - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - mp_rshd (c, b / DIGIT_BIT); - } - - /* shift any bit count < DIGIT_BIT */ - D = (mp_digit) (b % DIGIT_BIT); - if (D != 0) { - register mp_digit *tmpc, mask, shift; - - /* mask */ - mask = (((mp_digit)1) << D) - 1; - - /* shift for lsb */ - shift = DIGIT_BIT - D; - - /* alias */ - tmpc = c->dp + (c->used - 1); - - /* carry */ - r = 0; - for (x = c->used - 1; x >= 0; x--) { - /* get the lower bits of this word in a temp */ - rr = *tmpc & mask; - - /* shift the current word and mix in the carry bits from the previous word */ - *tmpc = (*tmpc >> D) | (r << shift); - --tmpc; - - /* set the carry to the carry bits of the current word found above */ - r = rr; - } - } - mp_clamp (c); - if (d != NULL) { - mp_exch (&t, d); - } - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_2d.c */ - -/* Start: bn_mp_div_3.c */ -#include -#ifdef BN_MP_DIV_3_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* divide by three (based on routine from MPI and the GMP manual) */ -int -mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) -{ - mp_int q; - mp_word w, t; - mp_digit b; - int res, ix; - - /* b = 2**DIGIT_BIT / 3 */ - b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3); - - if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - - if (w >= 3) { - /* multiply w by [1/3] */ - t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT); - - /* now subtract 3 * [w/3] from w, to get the remainder */ - w -= t+t+t; - - /* fixup the remainder as required since - * the optimization is not exact. - */ - while (w >= 3) { - t += 1; - w -= 3; - } - } else { - t = 0; - } - q.dp[ix] = (mp_digit)t; - } - - /* [optional] store the remainder */ - if (d != NULL) { - *d = (mp_digit)w; - } - - /* [optional] store the quotient */ - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_3.c */ - -/* Start: bn_mp_div_d.c */ -#include -#ifdef BN_MP_DIV_D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -static int s_is_power_of_two(mp_digit b, int *p) -{ - int x; - - /* fast return if no power of two */ - if ((b==0) || (b & (b-1))) { - return 0; - } - - for (x = 0; x < DIGIT_BIT; x++) { - if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)<used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - - if (w >= b) { - t = (mp_digit)(w / b); - w -= ((mp_word)t) * ((mp_word)b); - } else { - t = 0; - } - q.dp[ix] = (mp_digit)t; - } - - if (d != NULL) { - *d = (mp_digit)w; - } - - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_d.c */ - -/* Start: bn_mp_dr_is_modulus.c */ -#include -#ifdef BN_MP_DR_IS_MODULUS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* determines if a number is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a) -{ - int ix; - - /* must be at least two digits */ - if (a->used < 2) { - return 0; - } - - /* must be of the form b**k - a [a <= b] so all - * but the first digit must be equal to -1 (mod b). - */ - for (ix = 1; ix < a->used; ix++) { - if (a->dp[ix] != MP_MASK) { - return 0; - } - } - return 1; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_dr_is_modulus.c */ - -/* Start: bn_mp_dr_reduce.c */ -#include -#ifdef BN_MP_DR_REDUCE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* reduce "x" in place modulo "n" using the Diminished Radix algorithm. - * - * Based on algorithm from the paper - * - * "Generating Efficient Primes for Discrete Log Cryptosystems" - * Chae Hoon Lim, Pil Joong Lee, - * POSTECH Information Research Laboratories - * - * The modulus must be of a special format [see manual] - * - * Has been modified to use algorithm 7.10 from the LTM book instead - * - * Input x must be in the range 0 <= x <= (n-1)**2 - */ -int -mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k) -{ - int err, i, m; - mp_word r; - mp_digit mu, *tmpx1, *tmpx2; - - /* m = digits in modulus */ - m = n->used; - - /* ensure that "x" has at least 2m digits */ - if (x->alloc < m + m) { - if ((err = mp_grow (x, m + m)) != MP_OKAY) { - return err; - } - } - -/* top of loop, this is where the code resumes if - * another reduction pass is required. - */ -top: - /* aliases for digits */ - /* alias for lower half of x */ - tmpx1 = x->dp; - - /* alias for upper half of x, or x/B**m */ - tmpx2 = x->dp + m; - - /* set carry to zero */ - mu = 0; - - /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ - for (i = 0; i < m; i++) { - r = ((mp_word)*tmpx2++) * ((mp_word)k) + *tmpx1 + mu; - *tmpx1++ = (mp_digit)(r & MP_MASK); - mu = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); - } - - /* set final carry */ - *tmpx1++ = mu; - - /* zero words above m */ - for (i = m + 1; i < x->used; i++) { - *tmpx1++ = 0; - } - - /* clamp, sub and return */ - mp_clamp (x); - - /* if x >= n then subtract and reduce again - * Each successive "recursion" makes the input smaller and smaller. - */ - if (mp_cmp_mag (x, n) != MP_LT) { - s_mp_sub(x, n, x); - goto top; - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_dr_reduce.c */ - -/* Start: bn_mp_dr_setup.c */ -#include -#ifdef BN_MP_DR_SETUP_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* determines the setup value */ -void mp_dr_setup(mp_int *a, mp_digit *d) -{ - /* the casts are required if DIGIT_BIT is one less than - * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] - */ - *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - - ((mp_word)a->dp[0])); -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_dr_setup.c */ - -/* Start: bn_mp_exch.c */ -#include -#ifdef BN_MP_EXCH_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* swap the elements of two integers, for cases where you can't simply swap the - * mp_int pointers around - */ -void -mp_exch (mp_int * a, mp_int * b) -{ - mp_int t; - - t = *a; - *a = *b; - *b = t; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exch.c */ - -/* Start: bn_mp_expt_d.c */ -#include -#ifdef BN_MP_EXPT_D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) -{ - int res, x; - mp_int g; - - if ((res = mp_init_copy (&g, a)) != MP_OKAY) { - return res; - } - - /* set initial result */ - mp_set (c, 1); - - for (x = 0; x < (int) DIGIT_BIT; x++) { - /* square */ - if ((res = mp_sqr (c, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - - /* if the bit is set multiply */ - if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) { - if ((res = mp_mul (c, &g, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } - - /* shift to next bit */ - b <<= 1; - } - - mp_clear (&g); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_expt_d.c */ - -/* Start: bn_mp_exptmod.c */ -#include -#ifdef BN_MP_EXPTMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - - -/* this is a shell function that calls either the normal or Montgomery - * exptmod functions. Originally the call to the montgomery code was - * embedded in the normal function but that wasted alot of stack space - * for nothing (since 99% of the time the Montgomery code would be called) - */ -int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) -{ - int dr; - - /* modulus P must be positive */ - if (P->sign == MP_NEG) { - return MP_VAL; - } - - /* if exponent X is negative we have to recurse */ - if (X->sign == MP_NEG) { -#ifdef BN_MP_INVMOD_C - mp_int tmpG, tmpX; - int err; - - /* first compute 1/G mod P */ - if ((err = mp_init(&tmpG)) != MP_OKAY) { - return err; - } - if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } - - /* now get |X| */ - if ((err = mp_init(&tmpX)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } - if ((err = mp_abs(X, &tmpX)) != MP_OKAY) { - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; - } - - /* and now compute (1/G)**|X| instead of G**X [X < 0] */ - err = mp_exptmod(&tmpG, &tmpX, P, Y); - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; -#else - /* no invmod */ - return MP_VAL; -#endif - } - -/* modified diminished radix reduction */ -#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C) - if (mp_reduce_is_2k_l(P) == MP_YES) { - return s_mp_exptmod(G, X, P, Y, 1); - } -#endif - -#ifdef BN_MP_DR_IS_MODULUS_C - /* is it a DR modulus? */ - dr = mp_dr_is_modulus(P); -#else - /* default to no */ - dr = 0; -#endif - -#ifdef BN_MP_REDUCE_IS_2K_C - /* if not, is it a unrestricted DR modulus? */ - if (dr == 0) { - dr = mp_reduce_is_2k(P) << 1; - } -#endif - - /* if the modulus is odd or dr != 0 use the montgomery method */ -#ifdef BN_MP_EXPTMOD_FAST_C - if (mp_isodd (P) == 1 || dr != 0) { - return mp_exptmod_fast (G, X, P, Y, dr); - } else { -#endif -#ifdef BN_S_MP_EXPTMOD_C - /* otherwise use the generic Barrett reduction technique */ - return s_mp_exptmod (G, X, P, Y, 0); -#else - /* no exptmod for evens */ - return MP_VAL; -#endif -#ifdef BN_MP_EXPTMOD_FAST_C - } -#endif -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exptmod.c */ - -/* Start: bn_mp_exptmod_fast.c */ -#include -#ifdef BN_MP_EXPTMOD_FAST_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85 - * - * Uses a left-to-right k-ary sliding window to compute the modular exponentiation. - * The value of k changes based on the size of the exponent. - * - * Uses Montgomery or Diminished Radix reduction [whichever appropriate] - */ - -#ifdef MP_LOW_MEM - #define TAB_SIZE 32 -#else - #define TAB_SIZE 256 -#endif - -int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) -{ - mp_int M[TAB_SIZE], res; - mp_digit buf, mp; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - - /* use a pointer to the reduction algorithm. This allows us to use - * one of many reduction algorithms without modding the guts of - * the code with if statements everywhere. - */ - int (*redux)(mp_int*,mp_int*,mp_digit); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } - -#ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } -#endif - - /* init M array */ - /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); - return err; - } - } - - /* determine and setup reduction code */ - if (redmode == 0) { -#ifdef BN_MP_MONTGOMERY_SETUP_C - /* now setup montgomery */ - if ((err = mp_montgomery_setup (P, &mp)) != MP_OKAY) { - goto LBL_M; - } -#else - err = MP_VAL; - goto LBL_M; -#endif - - /* automatically pick the comba one if available (saves quite a few calls/ifs) */ -#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C - if (((P->used * 2 + 1) < MP_WARRAY) && - P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - redux = fast_mp_montgomery_reduce; - } else -#endif - { -#ifdef BN_MP_MONTGOMERY_REDUCE_C - /* use slower baseline Montgomery method */ - redux = mp_montgomery_reduce; -#else - err = MP_VAL; - goto LBL_M; -#endif - } - } else if (redmode == 1) { -#if defined(BN_MP_DR_SETUP_C) && defined(BN_MP_DR_REDUCE_C) - /* setup DR reduction for moduli of the form B**k - b */ - mp_dr_setup(P, &mp); - redux = mp_dr_reduce; -#else - err = MP_VAL; - goto LBL_M; -#endif - } else { -#if defined(BN_MP_REDUCE_2K_SETUP_C) && defined(BN_MP_REDUCE_2K_C) - /* setup DR reduction for moduli of the form 2**k - b */ - if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) { - goto LBL_M; - } - redux = mp_reduce_2k; -#else - err = MP_VAL; - goto LBL_M; -#endif - } - - /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { - goto LBL_M; - } - - /* create M table - * - - * - * The first half of the table is not computed though accept for M[0] and M[1] - */ - - if (redmode == 0) { -#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C - /* now we need R mod m */ - if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) { - goto LBL_RES; - } -#else - err = MP_VAL; - goto LBL_RES; -#endif - - /* now set M[1] to G * R mod m */ - if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } - } else { - mp_set(&res, 1); - if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } - } - - /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - - for (x = 0; x < (winsize - 1); x++) { - if ((err = mp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* create upper table */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[x], P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits so break */ - if (digidx == -1) { - break; - } - /* read next digit and reset bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int)DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if (mode == 0 && y == 0) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if (mode == 1 && y == 0) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if (mode == 2 && bitcpy > 0) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - - /* get next bit of the window */ - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - } - } - - if (redmode == 0) { - /* fixup result if Montgomery reduction is used - * recall that any value in a Montgomery system is - * actually multiplied by R mod n. So we have - * to reduce one more time to cancel out the factor - * of R. - */ - if ((err = redux(&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* swap res with Y */ - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); -LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; -} -#endif - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exptmod_fast.c */ - -/* Start: bn_mp_exteuclid.c */ -#include -#ifdef BN_MP_EXTEUCLID_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* Extended euclidean algorithm of (a, b) produces - a*u1 + b*u2 = u3 - */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) -{ - mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; - int err; - - if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { - return err; - } - - /* initialize, (u1,u2,u3) = (1,0,a) */ - mp_set(&u1, 1); - if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto _ERR; } - - /* initialize, (v1,v2,v3) = (0,1,b) */ - mp_set(&v2, 1); - if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto _ERR; } - - /* loop while v3 != 0 */ - while (mp_iszero(&v3) == MP_NO) { - /* q = u3/v3 */ - if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto _ERR; } - - /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ - if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto _ERR; } - - /* (u1,u2,u3) = (v1,v2,v3) */ - if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto _ERR; } - - /* (v1,v2,v3) = (t1,t2,t3) */ - if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto _ERR; } - } - - /* make sure U3 >= 0 */ - if (u3.sign == MP_NEG) { - mp_neg(&u1, &u1); - mp_neg(&u2, &u2); - mp_neg(&u3, &u3); - } - - /* copy result out */ - if (U1 != NULL) { mp_exch(U1, &u1); } - if (U2 != NULL) { mp_exch(U2, &u2); } - if (U3 != NULL) { mp_exch(U3, &u3); } - - err = MP_OKAY; -_ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exteuclid.c */ - -/* Start: bn_mp_fread.c */ -#include -#ifdef BN_MP_FREAD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* read a bigint from a file stream in ASCII */ -int mp_fread(mp_int *a, int radix, FILE *stream) -{ - int err, ch, neg, y; - - /* clear a */ - mp_zero(a); - - /* if first digit is - then set negative */ - ch = fgetc(stream); - if (ch == '-') { - neg = MP_NEG; - ch = fgetc(stream); - } else { - neg = MP_ZPOS; - } - - for (;;) { - /* find y in the radix map */ - for (y = 0; y < radix; y++) { - if (mp_s_rmap[y] == ch) { - break; - } - } - if (y == radix) { - break; - } - - /* shift up and add */ - if ((err = mp_mul_d(a, radix, a)) != MP_OKAY) { - return err; - } - if ((err = mp_add_d(a, y, a)) != MP_OKAY) { - return err; - } - - ch = fgetc(stream); - } - if (mp_cmp_d(a, 0) != MP_EQ) { - a->sign = neg; - } - - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_fread.c */ - -/* Start: bn_mp_fwrite.c */ -#include -#ifdef BN_MP_FWRITE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -int mp_fwrite(mp_int *a, int radix, FILE *stream) -{ - char *buf; - int err, len, x; - - if ((err = mp_radix_size(a, radix, &len)) != MP_OKAY) { - return err; - } - - buf = OPT_CAST(char) XMALLOC (len); - if (buf == NULL) { - return MP_MEM; - } - - if ((err = mp_toradix(a, buf, radix)) != MP_OKAY) { - XFREE (buf); - return err; - } - - for (x = 0; x < len; x++) { - if (fputc(buf[x], stream) == EOF) { - XFREE (buf); - return MP_VAL; - } - } - - XFREE (buf); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_fwrite.c */ - -/* Start: bn_mp_gcd.c */ -#include -#ifdef BN_MP_GCD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* Greatest Common Divisor using the binary method */ -int mp_gcd (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int u, v; - int k, u_lsb, v_lsb, res; - - /* either zero than gcd is the largest */ - if (mp_iszero (a) == MP_YES) { - return mp_abs (b, c); - } - if (mp_iszero (b) == MP_YES) { - return mp_abs (a, c); - } - - /* get copies of a and b we can modify */ - if ((res = mp_init_copy (&u, a)) != MP_OKAY) { - return res; - } - - if ((res = mp_init_copy (&v, b)) != MP_OKAY) { - goto LBL_U; - } - - /* must be positive for the remainder of the algorithm */ - u.sign = v.sign = MP_ZPOS; - - /* B1. Find the common power of two for u and v */ - u_lsb = mp_cnt_lsb(&u); - v_lsb = mp_cnt_lsb(&v); - k = MIN(u_lsb, v_lsb); - - if (k > 0) { - /* divide the power of two out */ - if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } - - if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - /* divide any remaining factors of two out */ - if (u_lsb != k) { - if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - if (v_lsb != k) { - if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - while (mp_iszero(&v) == 0) { - /* make sure v is the largest */ - if (mp_cmp_mag(&u, &v) == MP_GT) { - /* swap u and v to make sure v is >= u */ - mp_exch(&u, &v); - } - - /* subtract smallest from largest */ - if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) { - goto LBL_V; - } - - /* Divide out all factors of two */ - if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - /* multiply by 2**k which we divided out at the beginning */ - if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) { - goto LBL_V; - } - c->sign = MP_ZPOS; - res = MP_OKAY; -LBL_V:mp_clear (&u); -LBL_U:mp_clear (&v); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_gcd.c */ - -/* Start: bn_mp_get_int.c */ -#include -#ifdef BN_MP_GET_INT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int * a) -{ - int i; - unsigned long res; - - if (a->used == 0) { - return 0; - } - - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)((sizeof(unsigned long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1; - - /* get most significant digit of result */ - res = DIGIT(a,i); - - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } - - /* force result to 32-bits always so it is consistent on non 32-bit platforms */ - return res & 0xFFFFFFFFUL; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_get_int.c */ - -/* Start: bn_mp_grow.c */ -#include -#ifdef BN_MP_GROW_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* grow as required */ -int mp_grow (mp_int * a, int size) -{ - int i; - mp_digit *tmp; - - /* if the alloc size is smaller alloc more ram */ - if (a->alloc < size) { - /* ensure there are always at least MP_PREC digits extra on top */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* reallocate the array a->dp - * - * We store the return in a temporary variable - * in case the operation failed we don't want - * to overwrite the dp member of a. - */ - tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size); - if (tmp == NULL) { - /* reallocation failed but "a" is still valid [can be freed] */ - return MP_MEM; - } - - /* reallocation succeeded so set a->dp */ - a->dp = tmp; - - /* zero excess digits */ - i = a->alloc; - a->alloc = size; - for (; i < a->alloc; i++) { - a->dp[i] = 0; - } - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_grow.c */ - -/* Start: bn_mp_init.c */ -#include -#ifdef BN_MP_INIT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* init a new mp_int */ -int mp_init (mp_int * a) -{ - int i; - - /* allocate memory required and clear it */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC); - if (a->dp == NULL) { - return MP_MEM; - } - - /* set the digits to zero */ - for (i = 0; i < MP_PREC; i++) { - a->dp[i] = 0; - } - - /* set the used to zero, allocated digits to the default precision - * and sign to positive */ - a->used = 0; - a->alloc = MP_PREC; - a->sign = MP_ZPOS; - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init.c */ - -/* Start: bn_mp_init_copy.c */ -#include -#ifdef BN_MP_INIT_COPY_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* creates "a" then copies b into it */ -int mp_init_copy (mp_int * a, mp_int * b) -{ - int res; - - if ((res = mp_init (a)) != MP_OKAY) { - return res; - } - return mp_copy (b, a); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_copy.c */ - -/* Start: bn_mp_init_multi.c */ -#include -#ifdef BN_MP_INIT_MULTI_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#include - -int mp_init_multi(mp_int *mp, ...) -{ - mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ - int n = 0; /* Number of ok inits */ - mp_int* cur_arg = mp; - va_list args; - - va_start(args, mp); /* init args to next argument from caller */ - while (cur_arg != NULL) { - if (mp_init(cur_arg) != MP_OKAY) { - /* Oops - error! Back-track and mp_clear what we already - succeeded in init-ing, then return error. - */ - va_list clean_args; - - /* end the current list */ - va_end(args); - - /* now start cleaning up */ - cur_arg = mp; - va_start(clean_args, mp); - while (n--) { - mp_clear(cur_arg); - cur_arg = va_arg(clean_args, mp_int*); - } - va_end(clean_args); - res = MP_MEM; - break; - } - n++; - cur_arg = va_arg(args, mp_int*); - } - va_end(args); - return res; /* Assumed ok, if error flagged above. */ -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_multi.c */ - -/* Start: bn_mp_init_set.c */ -#include -#ifdef BN_MP_INIT_SET_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* initialize and set a digit */ -int mp_init_set (mp_int * a, mp_digit b) -{ - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - mp_set(a, b); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_set.c */ - -/* Start: bn_mp_init_set_int.c */ -#include -#ifdef BN_MP_INIT_SET_INT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* initialize and set a digit */ -int mp_init_set_int (mp_int * a, unsigned long b) -{ - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - return mp_set_int(a, b); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_set_int.c */ - -/* Start: bn_mp_init_size.c */ -#include -#ifdef BN_MP_INIT_SIZE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* init an mp_init for a given size */ -int mp_init_size (mp_int * a, int size) -{ - int x; - - /* pad size so there are always extra digits */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* alloc mem */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size); - if (a->dp == NULL) { - return MP_MEM; - } - - /* set the members */ - a->used = 0; - a->alloc = size; - a->sign = MP_ZPOS; - - /* zero the digits */ - for (x = 0; x < size; x++) { - a->dp[x] = 0; - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_size.c */ - -/* Start: bn_mp_invmod.c */ -#include -#ifdef BN_MP_INVMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* hac 14.61, pp608 */ -int mp_invmod (mp_int * a, mp_int * b, mp_int * c) -{ - /* b cannot be negative */ - if (b->sign == MP_NEG || mp_iszero(b) == 1) { - return MP_VAL; - } - -#ifdef BN_FAST_MP_INVMOD_C - /* if the modulus is odd we can use a faster routine instead */ - if (mp_isodd (b) == 1) { - return fast_mp_invmod (a, b, c); - } -#endif - -#ifdef BN_MP_INVMOD_SLOW_C - return mp_invmod_slow(a, b, c); -#endif - - return MP_VAL; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_invmod.c */ - -/* Start: bn_mp_invmod_slow.c */ -#include -#ifdef BN_MP_INVMOD_SLOW_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* hac 14.61, pp608 */ -int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int x, y, u, v, A, B, C, D; - int res; - - /* b cannot be negative */ - if (b->sign == MP_NEG || mp_iszero(b) == 1) { - return MP_VAL; - } - - /* init temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, - &A, &B, &C, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x = a, y = b */ - if ((res = mp_mod(a, b, &x)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 2. [modified] if x,y are both even then return an error! */ - if (mp_iseven (&x) == 1 && mp_iseven (&y) == 1) { - res = MP_VAL; - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&A, 1); - mp_set (&D, 1); - -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == 1) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { - goto LBL_ERR; - } - /* 4.2 if A or B is odd then */ - if (mp_isodd (&A) == 1 || mp_isodd (&B) == 1) { - /* A = (A+y)/2, B = (B-x)/2 */ - if ((res = mp_add (&A, &y, &A)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* A = A/2, B = B/2 */ - if ((res = mp_div_2 (&A, &A)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 5. while v is even do */ - while (mp_iseven (&v) == 1) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if C or D is odd then */ - if (mp_isodd (&C) == 1 || mp_isodd (&D) == 1) { - /* C = (C+y)/2, D = (D-x)/2 */ - if ((res = mp_add (&C, &y, &C)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* C = C/2, D = D/2 */ - if ((res = mp_div_2 (&C, &C)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, A = A - C, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&A, &C, &A)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } else { - /* v - v - u, C = C - A, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&C, &A, &C)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* if not zero goto step 4 */ - if (mp_iszero (&u) == 0) - goto top; - - /* now a = C, b = D, gcd == g*v */ - - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } - - /* if its too low */ - while (mp_cmp_d(&C, 0) == MP_LT) { - if ((res = mp_add(&C, b, &C)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* too big */ - while (mp_cmp_mag(&C, b) != MP_LT) { - if ((res = mp_sub(&C, b, &C)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* C is now the inverse */ - mp_exch (&C, c); - res = MP_OKAY; -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_invmod_slow.c */ - -/* Start: bn_mp_is_square.c */ -#include -#ifdef BN_MP_IS_SQUARE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* Check if remainders are possible squares - fast exclude non-squares */ -static const char rem_128[128] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 -}; - -static const char rem_105[105] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 -}; - -/* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg,int *ret) -{ - int res; - mp_digit c; - mp_int t; - unsigned long r; - - /* Default to Non-square :) */ - *ret = MP_NO; - - if (arg->sign == MP_NEG) { - return MP_VAL; - } - - /* digits used? (TSD) */ - if (arg->used == 0) { - return MP_OKAY; - } - - /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127 & DIGIT(arg,0)] == 1) { - return MP_OKAY; - } - - /* Next check mod 105 (3*5*7) */ - if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { - return res; - } - if (rem_105[c] == 1) { - return MP_OKAY; - } - - - if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { - return res; - } - if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { - goto ERR; - } - r = mp_get_int(&t); - /* Check for other prime modules, note it's not an ERROR but we must - * free "t" so the easiest way is to goto ERR. We know that res - * is already equal to MP_OKAY from the mp_mod call - */ - if ( (1L<<(r%11)) & 0x5C4L ) goto ERR; - if ( (1L<<(r%13)) & 0x9E4L ) goto ERR; - if ( (1L<<(r%17)) & 0x5CE8L ) goto ERR; - if ( (1L<<(r%19)) & 0x4F50CL ) goto ERR; - if ( (1L<<(r%23)) & 0x7ACCA0L ) goto ERR; - if ( (1L<<(r%29)) & 0xC2EDD0CL ) goto ERR; - if ( (1L<<(r%31)) & 0x6DE2B848L ) goto ERR; - - /* Final check - is sqr(sqrt(arg)) == arg ? */ - if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&t,&t)) != MP_OKAY) { - goto ERR; - } - - *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO; -ERR:mp_clear(&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_is_square.c */ - -/* Start: bn_mp_jacobi.c */ -#include -#ifdef BN_MP_JACOBI_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes the jacobi c = (a | n) (or Legendre if n is prime) - * HAC pp. 73 Algorithm 2.149 - */ -int mp_jacobi (mp_int * a, mp_int * p, int *c) -{ - mp_int a1, p1; - int k, s, r, res; - mp_digit residue; - - /* if p <= 0 return MP_VAL */ - if (mp_cmp_d(p, 0) != MP_GT) { - return MP_VAL; - } - - /* step 1. if a == 0, return 0 */ - if (mp_iszero (a) == 1) { - *c = 0; - return MP_OKAY; - } - - /* step 2. if a == 1, return 1 */ - if (mp_cmp_d (a, 1) == MP_EQ) { - *c = 1; - return MP_OKAY; - } - - /* default */ - s = 0; - - /* step 3. write a = a1 * 2**k */ - if ((res = mp_init_copy (&a1, a)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&p1)) != MP_OKAY) { - goto LBL_A1; - } - - /* divide out larger power of two */ - k = mp_cnt_lsb(&a1); - if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) { - goto LBL_P1; - } - - /* step 4. if e is even set s=1 */ - if ((k & 1) == 0) { - s = 1; - } else { - /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ - residue = p->dp[0] & 7; - - if (residue == 1 || residue == 7) { - s = 1; - } else if (residue == 3 || residue == 5) { - s = -1; - } - } - - /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ - if ( ((p->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) { - s = -s; - } - - /* if a1 == 1 we're done */ - if (mp_cmp_d (&a1, 1) == MP_EQ) { - *c = s; - } else { - /* n1 = n mod a1 */ - if ((res = mp_mod (p, &a1, &p1)) != MP_OKAY) { - goto LBL_P1; - } - if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) { - goto LBL_P1; - } - *c = s * r; - } - - /* done */ - res = MP_OKAY; -LBL_P1:mp_clear (&p1); -LBL_A1:mp_clear (&a1); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_jacobi.c */ - -/* Start: bn_mp_karatsuba_mul.c */ -#include -#ifdef BN_MP_KARATSUBA_MUL_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* c = |a| * |b| using Karatsuba Multiplication using - * three half size multiplications - * - * Let B represent the radix [e.g. 2**DIGIT_BIT] and - * let n represent half of the number of digits in - * the min(a,b) - * - * a = a1 * B**n + a0 - * b = b1 * B**n + b0 - * - * Then, a * b => - a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0 - * - * Note that a1b1 and a0b0 are used twice and only need to be - * computed once. So in total three half size (half # of - * digit) multiplications are performed, a0b0, a1b1 and - * (a1+b1)(a0+b0) - * - * Note that a multiplication of half the digits requires - * 1/4th the number of single precision multiplications so in - * total after one call 25% of the single precision multiplications - * are saved. Note also that the call to mp_mul can end up back - * in this function if the a0, a1, b0, or b1 are above the threshold. - * This is known as divide-and-conquer and leads to the famous - * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than - * the standard O(N**2) that the baseline/comba methods use. - * Generally though the overhead of this method doesn't pay off - * until a certain size (N ~ 80) is reached. - */ -int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int x0, x1, y0, y1, t1, x0y0, x1y1; - int B, err; - - /* default the return code to an error */ - err = MP_MEM; - - /* min # of digits */ - B = MIN (a->used, b->used); - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - if (mp_init_size (&y0, B) != MP_OKAY) - goto X1; - if (mp_init_size (&y1, b->used - B) != MP_OKAY) - goto Y0; - - /* init temps */ - if (mp_init_size (&t1, B * 2) != MP_OKAY) - goto Y1; - if (mp_init_size (&x0y0, B * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x1y1, B * 2) != MP_OKAY) - goto X0Y0; - - /* now shift the digits */ - x0.used = y0.used = B; - x1.used = a->used - B; - y1.used = b->used - B; - - { - register int x; - register mp_digit *tmpa, *tmpb, *tmpx, *tmpy; - - /* we copy the digits directly instead of using higher level functions - * since we also need to shift the digits - */ - tmpa = a->dp; - tmpb = b->dp; - - tmpx = x0.dp; - tmpy = y0.dp; - for (x = 0; x < B; x++) { - *tmpx++ = *tmpa++; - *tmpy++ = *tmpb++; - } - - tmpx = x1.dp; - for (x = B; x < a->used; x++) { - *tmpx++ = *tmpa++; - } - - tmpy = y1.dp; - for (x = B; x < b->used; x++) { - *tmpy++ = *tmpb++; - } - } - - /* only need to clamp the lower words since by definition the - * upper words x1/y1 must have a known number of digits - */ - mp_clamp (&x0); - mp_clamp (&y0); - - /* now calc the products x0y0 and x1y1 */ - /* after this x0 is no longer required, free temp [x0==t2]! */ - if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY) - goto X1Y1; /* x0y0 = x0*y0 */ - if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) - goto X1Y1; /* x1y1 = x1*y1 */ - - /* now calc x1+x0 and y1+y0 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = x1 - x0 */ - if (s_mp_add (&y1, &y0, &x0) != MP_OKAY) - goto X1Y1; /* t2 = y1 - y0 */ - if (mp_mul (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ - - /* add x0y0 */ - if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) - goto X1Y1; /* t2 = x0y0 + x1y1 */ - if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))< -#ifdef BN_MP_KARATSUBA_SQR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* Karatsuba squaring, computes b = a*a using three - * half size squarings - * - * See comments of karatsuba_mul for details. It - * is essentially the same algorithm but merely - * tuned to perform recursive squarings. - */ -int mp_karatsuba_sqr (mp_int * a, mp_int * b) -{ - mp_int x0, x1, t1, t2, x0x0, x1x1; - int B, err; - - err = MP_MEM; - - /* min # of digits */ - B = a->used; - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - - /* init temps */ - if (mp_init_size (&t1, a->used * 2) != MP_OKAY) - goto X1; - if (mp_init_size (&t2, a->used * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x0x0, B * 2) != MP_OKAY) - goto T2; - if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY) - goto X0X0; - - { - register int x; - register mp_digit *dst, *src; - - src = a->dp; - - /* now shift the digits */ - dst = x0.dp; - for (x = 0; x < B; x++) { - *dst++ = *src++; - } - - dst = x1.dp; - for (x = B; x < a->used; x++) { - *dst++ = *src++; - } - } - - x0.used = B; - x1.used = a->used - B; - - mp_clamp (&x0); - - /* now calc the products x0*x0 and x1*x1 */ - if (mp_sqr (&x0, &x0x0) != MP_OKAY) - goto X1X1; /* x0x0 = x0*x0 */ - if (mp_sqr (&x1, &x1x1) != MP_OKAY) - goto X1X1; /* x1x1 = x1*x1 */ - - /* now calc (x1+x0)**2 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1X1; /* t1 = x1 - x0 */ - if (mp_sqr (&t1, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ - - /* add x0y0 */ - if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) - goto X1X1; /* t2 = x0x0 + x1x1 */ - if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))< -#ifdef BN_MP_LCM_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes least common multiple as |a*b|/(a, b) */ -int mp_lcm (mp_int * a, mp_int * b, mp_int * c) -{ - int res; - mp_int t1, t2; - - - if ((res = mp_init_multi (&t1, &t2, NULL)) != MP_OKAY) { - return res; - } - - /* t1 = get the GCD of the two inputs */ - if ((res = mp_gcd (a, b, &t1)) != MP_OKAY) { - goto LBL_T; - } - - /* divide the smallest by the GCD */ - if (mp_cmp_mag(a, b) == MP_LT) { - /* store quotient in t2 such that t2 * b is the LCM */ - if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) { - goto LBL_T; - } - res = mp_mul(b, &t2, c); - } else { - /* store quotient in t2 such that t2 * a is the LCM */ - if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) { - goto LBL_T; - } - res = mp_mul(a, &t2, c); - } - - /* fix the sign to positive */ - c->sign = MP_ZPOS; - -LBL_T: - mp_clear_multi (&t1, &t2, NULL); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_lcm.c */ - -/* Start: bn_mp_lshd.c */ -#include -#ifdef BN_MP_LSHD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* shift left a certain amount of digits */ -int mp_lshd (mp_int * a, int b) -{ - int x, res; - - /* if its less than zero return */ - if (b <= 0) { - return MP_OKAY; - } - - /* grow to fit the new digits */ - if (a->alloc < a->used + b) { - if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { - return res; - } - } - - { - register mp_digit *top, *bottom; - - /* increment the used by the shift amount then copy upwards */ - a->used += b; - - /* top */ - top = a->dp + a->used - 1; - - /* base */ - bottom = a->dp + a->used - 1 - b; - - /* much like mp_rshd this is implemented using a sliding window - * except the window goes the otherway around. Copying from - * the bottom to the top. see bn_mp_rshd.c for more info. - */ - for (x = a->used - 1; x >= b; x--) { - *top-- = *bottom--; - } - - /* zero the lower digits */ - top = a->dp; - for (x = 0; x < b; x++) { - *top++ = 0; - } - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_lshd.c */ - -/* Start: bn_mp_mod.c */ -#include -#ifdef BN_MP_MOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* c = a mod b, 0 <= c < b */ -int -mp_mod (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int t; - int res; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - - if (t.sign != b->sign) { - res = mp_add (b, &t, c); - } else { - res = MP_OKAY; - mp_exch (&t, c); - } - - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mod.c */ - -/* Start: bn_mp_mod_2d.c */ -#include -#ifdef BN_MP_MOD_2D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* calc a value mod 2**b */ -int -mp_mod_2d (mp_int * a, int b, mp_int * c) -{ - int x, res; - - /* if b is <= 0 then zero the int */ - if (b <= 0) { - mp_zero (c); - return MP_OKAY; - } - - /* if the modulus is larger than the value than return */ - if (b >= (int) (a->used * DIGIT_BIT)) { - res = mp_copy (a, c); - return res; - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - - /* zero digits above the last digit of the modulus */ - for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { - c->dp[x] = 0; - } - /* clear the digit that is not completely outside/inside the modulus */ - c->dp[b / DIGIT_BIT] &= - (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1)); - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mod_2d.c */ - -/* Start: bn_mp_mod_d.c */ -#include -#ifdef BN_MP_MOD_D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -int -mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) -{ - return mp_div_d(a, b, NULL, c); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mod_d.c */ - -/* Start: bn_mp_montgomery_calc_normalization.c */ -#include -#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* - * shifts with subtractions when the result is greater than b. - * - * The method is slightly modified to shift B unconditionally upto just under - * the leading bit of b. This saves alot of multiple precision shifting. - */ -int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) -{ - int x, bits, res; - - /* how many bits of last digit does b use */ - bits = mp_count_bits (b) % DIGIT_BIT; - - if (b->used > 1) { - if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { - return res; - } - } else { - mp_set(a, 1); - bits = 1; - } - - - /* now compute C = A * B mod b */ - for (x = bits - 1; x < (int)DIGIT_BIT; x++) { - if ((res = mp_mul_2 (a, a)) != MP_OKAY) { - return res; - } - if (mp_cmp_mag (a, b) != MP_LT) { - if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { - return res; - } - } - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_montgomery_calc_normalization.c */ - -/* Start: bn_mp_montgomery_reduce.c */ -#include -#ifdef BN_MP_MONTGOMERY_REDUCE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int -mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -{ - int ix, res, digs; - mp_digit mu; - - /* can the fast reduction [comba] method be used? - * - * Note that unlike in mul you're safely allowed *less* - * than the available columns [255 per default] since carries - * are fixed up in the inner loop. - */ - digs = n->used * 2 + 1; - if ((digs < MP_WARRAY) && - n->used < - (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - return fast_mp_montgomery_reduce (x, n, rho); - } - - /* grow the input as required */ - if (x->alloc < digs) { - if ((res = mp_grow (x, digs)) != MP_OKAY) { - return res; - } - } - x->used = digs; - - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * rho mod b - * - * The value of rho must be precalculated via - * montgomery_setup() such that - * it equals -1/n0 mod b this allows the - * following inner loop to reduce the - * input one digit at a time - */ - mu = (mp_digit) (((mp_word)x->dp[ix]) * ((mp_word)rho) & MP_MASK); - - /* a = a + mu * m * b**i */ - { - register int iy; - register mp_digit *tmpn, *tmpx, u; - register mp_word r; - - /* alias for digits of the modulus */ - tmpn = n->dp; - - /* alias for the digits of x [the input] */ - tmpx = x->dp + ix; - - /* set the carry to zero */ - u = 0; - - /* Multiply and add in place */ - for (iy = 0; iy < n->used; iy++) { - /* compute product and sum */ - r = ((mp_word)mu) * ((mp_word)*tmpn++) + - ((mp_word) u) + ((mp_word) * tmpx); - - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - - /* fix digit */ - *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); - } - /* At this point the ix'th digit of x should be zero */ - - - /* propagate carries upwards as required*/ - while (u) { - *tmpx += u; - u = *tmpx >> DIGIT_BIT; - *tmpx++ &= MP_MASK; - } - } - } - - /* at this point the n.used'th least - * significant digits of x are all zero - * which means we can shift x to the - * right by n.used digits and the - * residue is unchanged. - */ - - /* x = x/b**n.used */ - mp_clamp(x); - mp_rshd (x, n->used); - - /* if x >= n then x = x - n */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_montgomery_reduce.c */ - -/* Start: bn_mp_montgomery_setup.c */ -#include -#ifdef BN_MP_MONTGOMERY_SETUP_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* setups the montgomery reduction stuff */ -int -mp_montgomery_setup (mp_int * n, mp_digit * rho) -{ - mp_digit x, b; - -/* fast inversion mod 2**k - * - * Based on the fact that - * - * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) - * => 2*X*A - X*X*A*A = 1 - * => 2*(1) - (1) = 1 - */ - b = n->dp[0]; - - if ((b & 1) == 0) { - return MP_VAL; - } - - x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ - x *= 2 - b * x; /* here x*a==1 mod 2**8 */ -#if !defined(MP_8BIT) - x *= 2 - b * x; /* here x*a==1 mod 2**16 */ -#endif -#if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) - x *= 2 - b * x; /* here x*a==1 mod 2**32 */ -#endif -#ifdef MP_64BIT - x *= 2 - b * x; /* here x*a==1 mod 2**64 */ -#endif - - /* rho = -1/m mod b */ - *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_montgomery_setup.c */ - -/* Start: bn_mp_mul.c */ -#include -#ifdef BN_MP_MUL_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* high level multiplication (handles sign) */ -int mp_mul (mp_int * a, mp_int * b, mp_int * c) -{ - int res, neg; - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - - /* use Toom-Cook? */ -#ifdef BN_MP_TOOM_MUL_C - if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) { - res = mp_toom_mul(a, b, c); - } else -#endif -#ifdef BN_MP_KARATSUBA_MUL_C - /* use Karatsuba? */ - if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { - res = mp_karatsuba_mul (a, b, c); - } else -#endif - { - /* can we use the fast multiplier? - * - * The fast multiplier can be used if the output will - * have less than MP_WARRAY digits and the number of - * digits won't affect carry propagation - */ - int digs = a->used + b->used + 1; - -#ifdef BN_FAST_S_MP_MUL_DIGS_C - if ((digs < MP_WARRAY) && - MIN(a->used, b->used) <= - (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - res = fast_s_mp_mul_digs (a, b, c, digs); - } else -#endif -#ifdef BN_S_MP_MUL_DIGS_C - res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ -#else - res = MP_VAL; -#endif - - } - c->sign = (c->used > 0) ? neg : MP_ZPOS; - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul.c */ - -/* Start: bn_mp_mul_2.c */ -#include -#ifdef BN_MP_MUL_2_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* b = a*2 */ -int mp_mul_2(mp_int * a, mp_int * b) -{ - int x, res, oldused; - - /* grow to accomodate result */ - if (b->alloc < a->used + 1) { - if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { - return res; - } - } - - oldused = b->used; - b->used = a->used; - - { - register mp_digit r, rr, *tmpa, *tmpb; - - /* alias for source */ - tmpa = a->dp; - - /* alias for dest */ - tmpb = b->dp; - - /* carry */ - r = 0; - for (x = 0; x < a->used; x++) { - - /* get what will be the *next* carry bit from the - * MSB of the current digit - */ - rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); - - /* now shift up this digit, add in the carry [from the previous] */ - *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; - - /* copy the carry that would be from the source - * digit into the next iteration - */ - r = rr; - } - - /* new leading digit? */ - if (r != 0) { - /* add a MSB which is always 1 at this point */ - *tmpb = 1; - ++(b->used); - } - - /* now zero any excess digits on the destination - * that we didn't write to - */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul_2.c */ - -/* Start: bn_mp_mul_2d.c */ -#include -#ifdef BN_MP_MUL_2D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* shift left by a certain bit count */ -int mp_mul_2d (mp_int * a, int b, mp_int * c) -{ - mp_digit d; - int res; - - /* copy */ - if (a != c) { - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - } - - if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) { - if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { - return res; - } - } - - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { - return res; - } - } - - /* shift any bit count < DIGIT_BIT */ - d = (mp_digit) (b % DIGIT_BIT); - if (d != 0) { - register mp_digit *tmpc, shift, mask, r, rr; - register int x; - - /* bitmask for carries */ - mask = (((mp_digit)1) << d) - 1; - - /* shift for msbs */ - shift = DIGIT_BIT - d; - - /* alias */ - tmpc = c->dp; - - /* carry */ - r = 0; - for (x = 0; x < c->used; x++) { - /* get the higher bits of the current word */ - rr = (*tmpc >> shift) & mask; - - /* shift the current word and OR in the carry */ - *tmpc = ((*tmpc << d) | r) & MP_MASK; - ++tmpc; - - /* set the carry to the carry bits of the current word */ - r = rr; - } - - /* set final carry */ - if (r != 0) { - c->dp[(c->used)++] = r; - } - } - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul_2d.c */ - -/* Start: bn_mp_mul_d.c */ -#include -#ifdef BN_MP_MUL_D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* multiply by a digit */ -int -mp_mul_d (mp_int * a, mp_digit b, mp_int * c) -{ - mp_digit u, *tmpa, *tmpc; - mp_word r; - int ix, res, olduse; - - /* make sure c is big enough to hold a*b */ - if (c->alloc < a->used + 1) { - if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* get the original destinations used count */ - olduse = c->used; - - /* set the sign */ - c->sign = a->sign; - - /* alias for a->dp [source] */ - tmpa = a->dp; - - /* alias for c->dp [dest] */ - tmpc = c->dp; - - /* zero carry */ - u = 0; - - /* compute columns */ - for (ix = 0; ix < a->used; ix++) { - /* compute product and carry sum for this term */ - r = ((mp_word) u) + ((mp_word)*tmpa++) * ((mp_word)b); - - /* mask off higher bits to get a single digit */ - *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* send carry into next iteration */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - - /* store final carry [if any] and increment ix offset */ - *tmpc++ = u; - ++ix; - - /* now zero digits above the top */ - while (ix++ < olduse) { - *tmpc++ = 0; - } - - /* set used count */ - c->used = a->used + 1; - mp_clamp(c); - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul_d.c */ - -/* Start: bn_mp_mulmod.c */ -#include -#ifdef BN_MP_MULMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* d = a * b (mod c) */ -int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - int res; - mp_int t; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_mul (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mulmod.c */ - -/* Start: bn_mp_n_root.c */ -#include -#ifdef BN_MP_N_ROOT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* find the n'th root of an integer - * - * Result found such that (c)**b <= a and (c+1)**b > a - * - * This algorithm uses Newton's approximation - * x[i+1] = x[i] - f(x[i])/f'(x[i]) - * which will find the root in log(N) time where - * each step involves a fair bit. This is not meant to - * find huge roots [square and cube, etc]. - */ -int mp_n_root (mp_int * a, mp_digit b, mp_int * c) -{ - mp_int t1, t2, t3; - int res, neg; - - /* input must be positive if b is even */ - if ((b & 1) == 0 && a->sign == MP_NEG) { - return MP_VAL; - } - - if ((res = mp_init (&t1)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init (&t3)) != MP_OKAY) { - goto LBL_T2; - } - - /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; - - /* t2 = 2 */ - mp_set (&t2, 2); - - do { - /* t1 = t2 */ - if ((res = mp_copy (&t2, &t1)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */ - - /* t3 = t1**(b-1) */ - if ((res = mp_expt_d (&t1, b - 1, &t3)) != MP_OKAY) { - goto LBL_T3; - } - - /* numerator */ - /* t2 = t1**b */ - if ((res = mp_mul (&t3, &t1, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1**b - a */ - if ((res = mp_sub (&t2, a, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* denominator */ - /* t3 = t1**(b-1) * b */ - if ((res = mp_mul_d (&t3, b, &t3)) != MP_OKAY) { - goto LBL_T3; - } - - /* t3 = (t1**b - a)/(b * t1**(b-1)) */ - if ((res = mp_div (&t2, &t3, &t3, NULL)) != MP_OKAY) { - goto LBL_T3; - } - - if ((res = mp_sub (&t1, &t3, &t2)) != MP_OKAY) { - goto LBL_T3; - } - } while (mp_cmp (&t1, &t2) != MP_EQ); - - /* result can be off by a few so check */ - for (;;) { - if ((res = mp_expt_d (&t1, b, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - if (mp_cmp (&t2, a) == MP_GT) { - if ((res = mp_sub_d (&t1, 1, &t1)) != MP_OKAY) { - goto LBL_T3; - } - } else { - break; - } - } - - /* reset the sign of a first */ - a->sign = neg; - - /* set the result */ - mp_exch (&t1, c); - - /* set the sign of the result */ - c->sign = neg; - - res = MP_OKAY; - -LBL_T3:mp_clear (&t3); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_n_root.c */ - -/* Start: bn_mp_neg.c */ -#include -#ifdef BN_MP_NEG_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* b = -a */ -int mp_neg (mp_int * a, mp_int * b) -{ - int res; - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } - - if (mp_iszero(b) != MP_YES) { - b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; - } else { - b->sign = MP_ZPOS; - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_neg.c */ - -/* Start: bn_mp_or.c */ -#include -#ifdef BN_MP_OR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* OR two ints together */ -int mp_or (mp_int * a, mp_int * b, mp_int * c) -{ - int res, ix, px; - mp_int t, *x; - - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } - - for (ix = 0; ix < px; ix++) { - t.dp[ix] |= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_or.c */ - -/* Start: bn_mp_prime_fermat.c */ -#include -#ifdef BN_MP_PRIME_FERMAT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* performs one Fermat test. - * - * If "a" were prime then b**a == b (mod a) since the order of - * the multiplicative sub-group would be phi(a) = a-1. That means - * it would be the same as b**(a mod (a-1)) == b**1 == b (mod a). - * - * Sets result to 1 if the congruence holds, or zero otherwise. - */ -int mp_prime_fermat (mp_int * a, mp_int * b, int *result) -{ - mp_int t; - int err; - - /* default to composite */ - *result = MP_NO; - - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } - - /* init t */ - if ((err = mp_init (&t)) != MP_OKAY) { - return err; - } - - /* compute t = b**a mod a */ - if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) { - goto LBL_T; - } - - /* is it equal to b? */ - if (mp_cmp (&t, b) == MP_EQ) { - *result = MP_YES; - } - - err = MP_OKAY; -LBL_T:mp_clear (&t); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_fermat.c */ - -/* Start: bn_mp_prime_is_divisible.c */ -#include -#ifdef BN_MP_PRIME_IS_DIVISIBLE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* determines if an integers is divisible by one - * of the first PRIME_SIZE primes or not - * - * sets result to 0 if not, 1 if yes - */ -int mp_prime_is_divisible (mp_int * a, int *result) -{ - int err, ix; - mp_digit res; - - /* default to not */ - *result = MP_NO; - - for (ix = 0; ix < PRIME_SIZE; ix++) { - /* what is a mod LBL_prime_tab[ix] */ - if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) { - return err; - } - - /* is the residue zero? */ - if (res == 0) { - *result = MP_YES; - return MP_OKAY; - } - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_is_divisible.c */ - -/* Start: bn_mp_prime_is_prime.c */ -#include -#ifdef BN_MP_PRIME_IS_PRIME_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* performs a variable number of rounds of Miller-Rabin - * - * Probability of error after t rounds is no more than - - * - * Sets result to 1 if probably prime, 0 otherwise - */ -int mp_prime_is_prime (mp_int * a, int t, int *result) -{ - mp_int b; - int ix, err, res; - - /* default to no */ - *result = MP_NO; - - /* valid value of t? */ - if (t <= 0 || t > PRIME_SIZE) { - return MP_VAL; - } - - /* is the input equal to one of the primes in the table? */ - for (ix = 0; ix < PRIME_SIZE; ix++) { - if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) { - *result = 1; - return MP_OKAY; - } - } - - /* first perform trial division */ - if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { - return err; - } - - /* return if it was trivially divisible */ - if (res == MP_YES) { - return MP_OKAY; - } - - /* now perform the miller-rabin rounds */ - if ((err = mp_init (&b)) != MP_OKAY) { - return err; - } - - for (ix = 0; ix < t; ix++) { - /* set the prime */ - mp_set (&b, ltm_prime_tab[ix]); - - if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { - goto LBL_B; - } - - if (res == MP_NO) { - goto LBL_B; - } - } - - /* passed the test */ - *result = MP_YES; -LBL_B:mp_clear (&b); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_is_prime.c */ - -/* Start: bn_mp_prime_miller_rabin.c */ -#include -#ifdef BN_MP_PRIME_MILLER_RABIN_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* Miller-Rabin test of "a" to the base of "b" as described in - * HAC pp. 139 Algorithm 4.24 - * - * Sets result to 0 if definitely composite or 1 if probably prime. - * Randomly the chance of error is no more than 1/4 and often - * very much lower. - */ -int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) -{ - mp_int n1, y, r; - int s, j, err; - - /* default */ - *result = MP_NO; - - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } - - /* get n1 = a - 1 */ - if ((err = mp_init_copy (&n1, a)) != MP_OKAY) { - return err; - } - if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) { - goto LBL_N1; - } - - /* set 2**s * r = n1 */ - if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) { - goto LBL_N1; - } - - /* count the number of least significant bits - * which are zero - */ - s = mp_cnt_lsb(&r); - - /* now divide n - 1 by 2**s */ - if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) { - goto LBL_R; - } - - /* compute y = b**r mod a */ - if ((err = mp_init (&y)) != MP_OKAY) { - goto LBL_R; - } - if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) { - goto LBL_Y; - } - - /* if y != 1 and y != n1 do */ - if (mp_cmp_d (&y, 1) != MP_EQ && mp_cmp (&y, &n1) != MP_EQ) { - j = 1; - /* while j <= s-1 and y != n1 */ - while ((j <= (s - 1)) && mp_cmp (&y, &n1) != MP_EQ) { - if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) { - goto LBL_Y; - } - - /* if y == 1 then composite */ - if (mp_cmp_d (&y, 1) == MP_EQ) { - goto LBL_Y; - } - - ++j; - } - - /* if y != n1 then composite */ - if (mp_cmp (&y, &n1) != MP_EQ) { - goto LBL_Y; - } - } - - /* probably prime now */ - *result = MP_YES; -LBL_Y:mp_clear (&y); -LBL_R:mp_clear (&r); -LBL_N1:mp_clear (&n1); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_miller_rabin.c */ - -/* Start: bn_mp_prime_next_prime.c */ -#include -#ifdef BN_MP_PRIME_NEXT_PRIME_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* finds the next prime after the number "a" using "t" trials - * of Miller-Rabin. - * - * bbs_style = 1 means the prime must be congruent to 3 mod 4 - */ -int mp_prime_next_prime(mp_int *a, int t, int bbs_style) -{ - int err, res, x, y; - mp_digit res_tab[PRIME_SIZE], step, kstep; - mp_int b; - - /* ensure t is valid */ - if (t <= 0 || t > PRIME_SIZE) { - return MP_VAL; - } - - /* force positive */ - a->sign = MP_ZPOS; - - /* simple algo if a is less than the largest prime in the table */ - if (mp_cmp_d(a, ltm_prime_tab[PRIME_SIZE-1]) == MP_LT) { - /* find which prime it is bigger than */ - for (x = PRIME_SIZE - 2; x >= 0; x--) { - if (mp_cmp_d(a, ltm_prime_tab[x]) != MP_LT) { - if (bbs_style == 1) { - /* ok we found a prime smaller or - * equal [so the next is larger] - * - * however, the prime must be - * congruent to 3 mod 4 - */ - if ((ltm_prime_tab[x + 1] & 3) != 3) { - /* scan upwards for a prime congruent to 3 mod 4 */ - for (y = x + 1; y < PRIME_SIZE; y++) { - if ((ltm_prime_tab[y] & 3) == 3) { - mp_set(a, ltm_prime_tab[y]); - return MP_OKAY; - } - } - } - } else { - mp_set(a, ltm_prime_tab[x + 1]); - return MP_OKAY; - } - } - } - /* at this point a maybe 1 */ - if (mp_cmp_d(a, 1) == MP_EQ) { - mp_set(a, 2); - return MP_OKAY; - } - /* fall through to the sieve */ - } - - /* generate a prime congruent to 3 mod 4 or 1/3 mod 4? */ - if (bbs_style == 1) { - kstep = 4; - } else { - kstep = 2; - } - - /* at this point we will use a combination of a sieve and Miller-Rabin */ - - if (bbs_style == 1) { - /* if a mod 4 != 3 subtract the correct value to make it so */ - if ((a->dp[0] & 3) != 3) { - if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { return err; }; - } - } else { - if (mp_iseven(a) == 1) { - /* force odd */ - if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { - return err; - } - } - } - - /* generate the restable */ - for (x = 1; x < PRIME_SIZE; x++) { - if ((err = mp_mod_d(a, ltm_prime_tab[x], res_tab + x)) != MP_OKAY) { - return err; - } - } - - /* init temp used for Miller-Rabin Testing */ - if ((err = mp_init(&b)) != MP_OKAY) { - return err; - } - - for (;;) { - /* skip to the next non-trivially divisible candidate */ - step = 0; - do { - /* y == 1 if any residue was zero [e.g. cannot be prime] */ - y = 0; - - /* increase step to next candidate */ - step += kstep; - - /* compute the new residue without using division */ - for (x = 1; x < PRIME_SIZE; x++) { - /* add the step to each residue */ - res_tab[x] += kstep; - - /* subtract the modulus [instead of using division] */ - if (res_tab[x] >= ltm_prime_tab[x]) { - res_tab[x] -= ltm_prime_tab[x]; - } - - /* set flag if zero */ - if (res_tab[x] == 0) { - y = 1; - } - } - } while (y == 1 && step < ((((mp_digit)1)<= ((((mp_digit)1)< -#ifdef BN_MP_PRIME_RABIN_MILLER_TRIALS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - - -static const struct { - int k, t; -} sizes[] = { -{ 128, 28 }, -{ 256, 16 }, -{ 384, 10 }, -{ 512, 7 }, -{ 640, 6 }, -{ 768, 5 }, -{ 896, 4 }, -{ 1024, 4 } -}; - -/* returns # of RM trials required for a given bit size */ -int mp_prime_rabin_miller_trials(int size) -{ - int x; - - for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) { - if (sizes[x].k == size) { - return sizes[x].t; - } else if (sizes[x].k > size) { - return (x == 0) ? sizes[0].t : sizes[x - 1].t; - } - } - return sizes[x-1].t + 1; -} - - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_rabin_miller_trials.c */ - -/* Start: bn_mp_prime_random_ex.c */ -#include -#ifdef BN_MP_PRIME_RANDOM_EX_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* makes a truly random prime of a given size (bits), - * - * Flags are as follows: - * - * LTM_PRIME_BBS - make prime congruent to 3 mod 4 - * LTM_PRIME_SAFE - make sure (p-1)/2 is prime as well (implies LTM_PRIME_BBS) - * LTM_PRIME_2MSB_OFF - make the 2nd highest bit zero - * LTM_PRIME_2MSB_ON - make the 2nd highest bit one - * - * You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can - * have passed to the callback (e.g. a state or something). This function doesn't use "dat" itself - * so it can be NULL - * - */ - -/* This is possibly the mother of all prime generation functions, muahahahahaha! */ -int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat) -{ - unsigned char *tmp, maskAND, maskOR_msb, maskOR_lsb; - int res, err, bsize, maskOR_msb_offset; - - /* sanity check the input */ - if (size <= 1 || t <= 0) { - return MP_VAL; - } - - /* LTM_PRIME_SAFE implies LTM_PRIME_BBS */ - if (flags & LTM_PRIME_SAFE) { - flags |= LTM_PRIME_BBS; - } - - /* calc the byte size */ - bsize = (size>>3) + ((size&7)?1:0); - - /* we need a buffer of bsize bytes */ - tmp = OPT_CAST(unsigned char) XMALLOC(bsize); - if (tmp == NULL) { - return MP_MEM; - } - - /* calc the maskAND value for the MSbyte*/ - maskAND = ((size&7) == 0) ? 0xFF : (0xFF >> (8 - (size & 7))); - - /* calc the maskOR_msb */ - maskOR_msb = 0; - maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0; - if (flags & LTM_PRIME_2MSB_ON) { - maskOR_msb |= 0x80 >> ((9 - size) & 7); - } - - /* get the maskOR_lsb */ - maskOR_lsb = 1; - if (flags & LTM_PRIME_BBS) { - maskOR_lsb |= 3; - } - - do { - /* read the bytes */ - if (cb(tmp, bsize, dat) != bsize) { - err = MP_VAL; - goto error; - } - - /* work over the MSbyte */ - tmp[0] &= maskAND; - tmp[0] |= 1 << ((size - 1) & 7); - - /* mix in the maskORs */ - tmp[maskOR_msb_offset] |= maskOR_msb; - tmp[bsize-1] |= maskOR_lsb; - - /* read it in */ - if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY) { goto error; } - - /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } - if (res == MP_NO) { - continue; - } - - if (flags & LTM_PRIME_SAFE) { - /* see if (a-1)/2 is prime */ - if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { goto error; } - if ((err = mp_div_2(a, a)) != MP_OKAY) { goto error; } - - /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } - } - } while (res == MP_NO); - - if (flags & LTM_PRIME_SAFE) { - /* restore a to the original value */ - if ((err = mp_mul_2(a, a)) != MP_OKAY) { goto error; } - if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { goto error; } - } - - err = MP_OKAY; -error: - XFREE(tmp); - return err; -} - - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_random_ex.c */ - -/* Start: bn_mp_radix_size.c */ -#include -#ifdef BN_MP_RADIX_SIZE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* returns size of ASCII reprensentation */ -int mp_radix_size (mp_int * a, int radix, int *size) -{ - int res, digs; - mp_int t; - mp_digit d; - - *size = 0; - - /* special case for binary */ - if (radix == 2) { - *size = mp_count_bits (a) + (a->sign == MP_NEG ? 1 : 0) + 1; - return MP_OKAY; - } - - /* make sure the radix is in range */ - if (radix < 2 || radix > 64) { - return MP_VAL; - } - - if (mp_iszero(a) == MP_YES) { - *size = 2; - return MP_OKAY; - } - - /* digs is the digit count */ - digs = 0; - - /* if it's negative add one for the sign */ - if (a->sign == MP_NEG) { - ++digs; - } - - /* init a copy of the input */ - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - /* force temp to positive */ - t.sign = MP_ZPOS; - - /* fetch out all of the digits */ - while (mp_iszero (&t) == MP_NO) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - ++digs; - } - mp_clear (&t); - - /* return digs + 1, the 1 is for the NULL byte that would be required. */ - *size = digs + 1; - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_radix_size.c */ - -/* Start: bn_mp_radix_smap.c */ -#include -#ifdef BN_MP_RADIX_SMAP_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* chars used in radix conversions */ -const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_radix_smap.c */ - -/* Start: bn_mp_rand.c */ -#include -#ifdef BN_MP_RAND_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* makes a pseudo-random int of a given size */ -int -mp_rand (mp_int * a, int digits) -{ - int res; - mp_digit d; - - mp_zero (a); - if (digits <= 0) { - return MP_OKAY; - } - - /* first place a random non-zero digit */ - do { - d = ((mp_digit) abs (rand ())) & MP_MASK; - } while (d == 0); - - if ((res = mp_add_d (a, d, a)) != MP_OKAY) { - return res; - } - - while (--digits > 0) { - if ((res = mp_lshd (a, 1)) != MP_OKAY) { - return res; - } - - if ((res = mp_add_d (a, ((mp_digit) abs (rand ())), a)) != MP_OKAY) { - return res; - } - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_rand.c */ - -/* Start: bn_mp_read_radix.c */ -#include -#ifdef BN_MP_READ_RADIX_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* read a string [ASCII] in a given radix */ -int mp_read_radix (mp_int * a, const char *str, int radix) -{ - int y, res, neg; - char ch; - - /* zero the digit bignum */ - mp_zero(a); - - /* make sure the radix is ok */ - if (radix < 2 || radix > 64) { - return MP_VAL; - } - - /* if the leading digit is a - * minus set the sign to negative. - */ - if (*str == '-') { - ++str; - neg = MP_NEG; - } else { - neg = MP_ZPOS; - } - - /* set the integer to the default of zero */ - mp_zero (a); - - /* process each digit of the string */ - while (*str) { - /* if the radix < 36 the conversion is case insensitive - * this allows numbers like 1AB and 1ab to represent the same value - * [e.g. in hex] - */ - ch = (char) ((radix < 36) ? toupper ((int)*str) : *str); - for (y = 0; y < 64; y++) { - if (ch == mp_s_rmap[y]) { - break; - } - } - - /* if the char was found in the map - * and is less than the given radix add it - * to the number, otherwise exit the loop. - */ - if (y < radix) { - if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) { - return res; - } - if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) { - return res; - } - } else { - break; - } - ++str; - } - - /* set the sign only if a != 0 */ - if (mp_iszero(a) != 1) { - a->sign = neg; - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_read_radix.c */ - -/* Start: bn_mp_read_signed_bin.c */ -#include -#ifdef BN_MP_READ_SIGNED_BIN_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* read signed bin, big endian, first byte is 0==positive or 1==negative */ -int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) -{ - int res; - - /* read magnitude */ - if ((res = mp_read_unsigned_bin (a, b + 1, c - 1)) != MP_OKAY) { - return res; - } - - /* first byte is 0 for positive, non-zero for negative */ - if (b[0] == 0) { - a->sign = MP_ZPOS; - } else { - a->sign = MP_NEG; - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_read_signed_bin.c */ - -/* Start: bn_mp_read_unsigned_bin.c */ -#include -#ifdef BN_MP_READ_UNSIGNED_BIN_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* reads a unsigned char array, assumes the msb is stored first [big endian] */ -int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) -{ - int res; - - /* make sure there are at least two digits */ - if (a->alloc < 2) { - if ((res = mp_grow(a, 2)) != MP_OKAY) { - return res; - } - } - - /* zero the int */ - mp_zero (a); - - /* read the bytes in */ - while (c-- > 0) { - if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) { - return res; - } - -#ifndef MP_8BIT - a->dp[0] |= *b++; - a->used += 1; -#else - a->dp[0] = (*b & MP_MASK); - a->dp[1] |= ((*b++ >> 7U) & 1); - a->used += 2; -#endif - } - mp_clamp (a); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_read_unsigned_bin.c */ - -/* Start: bn_mp_reduce.c */ -#include -#ifdef BN_MP_REDUCE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* reduces x mod m, assumes 0 < x < m**2, mu is - * precomputed via mp_reduce_setup. - * From HAC pp.604 Algorithm 14.42 - */ -int mp_reduce (mp_int * x, mp_int * m, mp_int * mu) -{ - mp_int q; - int res, um = m->used; - - /* q = x */ - if ((res = mp_init_copy (&q, x)) != MP_OKAY) { - return res; - } - - /* q1 = x / b**(k-1) */ - mp_rshd (&q, um - 1); - - /* according to HAC this optimization is ok */ - if (((unsigned long) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) { - if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) { - goto CLEANUP; - } - } else { -#ifdef BN_S_MP_MUL_HIGH_DIGS_C - if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } -#elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) - if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } -#else - { - res = MP_VAL; - goto CLEANUP; - } -#endif - } - - /* q3 = q2 / b**(k+1) */ - mp_rshd (&q, um + 1); - - /* x = x mod b**(k+1), quick (no division) */ - if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { - goto CLEANUP; - } - - /* q = q * m mod b**(k+1), quick (no division) */ - if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) { - goto CLEANUP; - } - - /* x = x - q */ - if ((res = mp_sub (x, &q, x)) != MP_OKAY) { - goto CLEANUP; - } - - /* If x < 0, add b**(k+1) to it */ - if (mp_cmp_d (x, 0) == MP_LT) { - mp_set (&q, 1); - if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) - goto CLEANUP; - if ((res = mp_add (x, &q, x)) != MP_OKAY) - goto CLEANUP; - } - - /* Back off if it's too big */ - while (mp_cmp (x, m) != MP_LT) { - if ((res = s_mp_sub (x, m, x)) != MP_OKAY) { - goto CLEANUP; - } - } - -CLEANUP: - mp_clear (&q); - - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce.c */ - -/* Start: bn_mp_reduce_2k.c */ -#include -#ifdef BN_MP_REDUCE_2K_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* reduces a modulo n where n is of the form 2**p - d */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) -{ - mp_int q; - int p, res; - - if ((res = mp_init(&q)) != MP_OKAY) { - return res; - } - - p = mp_count_bits(n); -top: - /* q = a/2**p, a = a mod 2**p */ - if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { - goto ERR; - } - - if (d != 1) { - /* q = q * d */ - if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) { - goto ERR; - } - } - - /* a = a + q */ - if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { - goto ERR; - } - - if (mp_cmp_mag(a, n) != MP_LT) { - s_mp_sub(a, n, a); - goto top; - } - -ERR: - mp_clear(&q); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k.c */ - -/* Start: bn_mp_reduce_2k_l.c */ -#include -#ifdef BN_MP_REDUCE_2K_L_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* reduces a modulo n where n is of the form 2**p - d - This differs from reduce_2k since "d" can be larger - than a single digit. -*/ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d) -{ - mp_int q; - int p, res; - - if ((res = mp_init(&q)) != MP_OKAY) { - return res; - } - - p = mp_count_bits(n); -top: - /* q = a/2**p, a = a mod 2**p */ - if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { - goto ERR; - } - - /* q = q * d */ - if ((res = mp_mul(&q, d, &q)) != MP_OKAY) { - goto ERR; - } - - /* a = a + q */ - if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { - goto ERR; - } - - if (mp_cmp_mag(a, n) != MP_LT) { - s_mp_sub(a, n, a); - goto top; - } - -ERR: - mp_clear(&q); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k_l.c */ - -/* Start: bn_mp_reduce_2k_setup.c */ -#include -#ifdef BN_MP_REDUCE_2K_SETUP_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* determines the setup value */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d) -{ - int res, p; - mp_int tmp; - - if ((res = mp_init(&tmp)) != MP_OKAY) { - return res; - } - - p = mp_count_bits(a); - if ((res = mp_2expt(&tmp, p)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - *d = tmp.dp[0]; - mp_clear(&tmp); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k_setup.c */ - -/* Start: bn_mp_reduce_2k_setup_l.c */ -#include -#ifdef BN_MP_REDUCE_2K_SETUP_L_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* determines the setup value */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) -{ - int res; - mp_int tmp; - - if ((res = mp_init(&tmp)) != MP_OKAY) { - return res; - } - - if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) { - goto ERR; - } - - if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) { - goto ERR; - } - -ERR: - mp_clear(&tmp); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k_setup_l.c */ - -/* Start: bn_mp_reduce_is_2k.c */ -#include -#ifdef BN_MP_REDUCE_IS_2K_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* determines if mp_reduce_2k can be used */ -int mp_reduce_is_2k(mp_int *a) -{ - int ix, iy, iw; - mp_digit iz; - - if (a->used == 0) { - return MP_NO; - } else if (a->used == 1) { - return MP_YES; - } else if (a->used > 1) { - iy = mp_count_bits(a); - iz = 1; - iw = 1; - - /* Test every bit from the second digit up, must be 1 */ - for (ix = DIGIT_BIT; ix < iy; ix++) { - if ((a->dp[iw] & iz) == 0) { - return MP_NO; - } - iz <<= 1; - if (iz > (mp_digit)MP_MASK) { - ++iw; - iz = 1; - } - } - } - return MP_YES; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_is_2k.c */ - -/* Start: bn_mp_reduce_is_2k_l.c */ -#include -#ifdef BN_MP_REDUCE_IS_2K_L_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* determines if reduce_2k_l can be used */ -int mp_reduce_is_2k_l(mp_int *a) -{ - int ix, iy; - - if (a->used == 0) { - return MP_NO; - } else if (a->used == 1) { - return MP_YES; - } else if (a->used > 1) { - /* if more than half of the digits are -1 we're sold */ - for (iy = ix = 0; ix < a->used; ix++) { - if (a->dp[ix] == MP_MASK) { - ++iy; - } - } - return (iy >= (a->used/2)) ? MP_YES : MP_NO; - - } - return MP_NO; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_is_2k_l.c */ - -/* Start: bn_mp_reduce_setup.c */ -#include -#ifdef BN_MP_REDUCE_SETUP_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* pre-calculate the value required for Barrett reduction - * For a given modulus "b" it calulates the value required in "a" - */ -int mp_reduce_setup (mp_int * a, mp_int * b) -{ - int res; - - if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { - return res; - } - return mp_div (a, b, a, NULL); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_setup.c */ - -/* Start: bn_mp_rshd.c */ -#include -#ifdef BN_MP_RSHD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* shift right a certain amount of digits */ -void mp_rshd (mp_int * a, int b) -{ - int x; - - /* if b <= 0 then ignore it */ - if (b <= 0) { - return; - } - - /* if b > used then simply zero it and return */ - if (a->used <= b) { - mp_zero (a); - return; - } - - { - register mp_digit *bottom, *top; - - /* shift the digits down */ - - /* bottom */ - bottom = a->dp; - - /* top [offset into digits] */ - top = a->dp + b; - - /* this is implemented as a sliding window where - * the window is b-digits long and digits from - * the top of the window are copied to the bottom - * - * e.g. - - b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> - /\ | ----> - \-------------------/ ----> - */ - for (x = 0; x < (a->used - b); x++) { - *bottom++ = *top++; - } - - /* zero the top digits */ - for (; x < a->used; x++) { - *bottom++ = 0; - } - } - - /* remove excess digits */ - a->used -= b; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_rshd.c */ - -/* Start: bn_mp_set.c */ -#include -#ifdef BN_MP_SET_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* set to a digit */ -void mp_set (mp_int * a, mp_digit b) -{ - mp_zero (a); - a->dp[0] = b & MP_MASK; - a->used = (a->dp[0] != 0) ? 1 : 0; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_set.c */ - -/* Start: bn_mp_set_int.c */ -#include -#ifdef BN_MP_SET_INT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* set a 32-bit const */ -int mp_set_int (mp_int * a, unsigned long b) -{ - int x, res; - - mp_zero (a); - - /* set four bits at a time */ - for (x = 0; x < 8; x++) { - /* shift the number up four bits */ - if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) { - return res; - } - - /* OR in the top four bits of the source */ - a->dp[0] |= (b >> 28) & 15; - - /* shift the source up to the next four bits */ - b <<= 4; - - /* ensure that digits are not clamped off */ - a->used += 1; - } - mp_clamp (a); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_set_int.c */ - -/* Start: bn_mp_shrink.c */ -#include -#ifdef BN_MP_SHRINK_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* shrink a bignum */ -int mp_shrink (mp_int * a) -{ - mp_digit *tmp; - int used = 1; - - if(a->used > 0) - used = a->used; - - if (a->alloc != used) { - if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) { - return MP_MEM; - } - a->dp = tmp; - a->alloc = used; - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_shrink.c */ - -/* Start: bn_mp_signed_bin_size.c */ -#include -#ifdef BN_MP_SIGNED_BIN_SIZE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* get the size for an signed equivalent */ -int mp_signed_bin_size (mp_int * a) -{ - return 1 + mp_unsigned_bin_size (a); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_signed_bin_size.c */ - -/* Start: bn_mp_sqr.c */ -#include -#ifdef BN_MP_SQR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* computes b = a*a */ -int -mp_sqr (mp_int * a, mp_int * b) -{ - int res; - -#ifdef BN_MP_TOOM_SQR_C - /* use Toom-Cook? */ - if (a->used >= TOOM_SQR_CUTOFF) { - res = mp_toom_sqr(a, b); - /* Karatsuba? */ - } else -#endif -#ifdef BN_MP_KARATSUBA_SQR_C -if (a->used >= KARATSUBA_SQR_CUTOFF) { - res = mp_karatsuba_sqr (a, b); - } else -#endif - { -#ifdef BN_FAST_S_MP_SQR_C - /* can we use the fast comba multiplier? */ - if ((a->used * 2 + 1) < MP_WARRAY && - a->used < - (1 << (sizeof(mp_word) * CHAR_BIT - 2*DIGIT_BIT - 1))) { - res = fast_s_mp_sqr (a, b); - } else -#endif -#ifdef BN_S_MP_SQR_C - res = s_mp_sqr (a, b); -#else - res = MP_VAL; -#endif - } - b->sign = MP_ZPOS; - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sqr.c */ - -/* Start: bn_mp_sqrmod.c */ -#include -#ifdef BN_MP_SQRMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* c = a * a (mod b) */ -int -mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) -{ - int res; - mp_int t; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_sqr (a, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, b, c); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sqrmod.c */ - -/* Start: bn_mp_sqrt.c */ -#include -#ifdef BN_MP_SQRT_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) -{ - int res; - mp_int t1,t2; - - /* must be positive */ - if (arg->sign == MP_NEG) { - return MP_VAL; - } - - /* easy out */ - if (mp_iszero(arg) == MP_YES) { - mp_zero(ret); - return MP_OKAY; - } - - if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) { - return res; - } - - if ((res = mp_init(&t2)) != MP_OKAY) { - goto E2; - } - - /* First approx. (not very bad for large arg) */ - mp_rshd (&t1,t1.used/2); - - /* t1 > 0 */ - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { - goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { - goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { - goto E1; - } - /* And now t1 > sqrt(arg) */ - do { - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { - goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { - goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { - goto E1; - } - /* t1 >= sqrt(arg) >= t2 at this point */ - } while (mp_cmp_mag(&t1,&t2) == MP_GT); - - mp_exch(&t1,ret); - -E1: mp_clear(&t2); -E2: mp_clear(&t1); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sqrt.c */ - -/* Start: bn_mp_sub.c */ -#include -#ifdef BN_MP_SUB_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* high level subtraction (handles signs) */ -int -mp_sub (mp_int * a, mp_int * b, mp_int * c) -{ - int sa, sb, res; - - sa = a->sign; - sb = b->sign; - - if (sa != sb) { - /* subtract a negative from a positive, OR */ - /* subtract a positive from a negative. */ - /* In either case, ADD their magnitudes, */ - /* and use the sign of the first number. */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* subtract a positive from a positive, OR */ - /* subtract a negative from a negative. */ - /* First, take the difference between their */ - /* magnitudes, then... */ - if (mp_cmp_mag (a, b) != MP_LT) { - /* Copy the sign from the first */ - c->sign = sa; - /* The first has a larger or equal magnitude */ - res = s_mp_sub (a, b, c); - } else { - /* The result has the *opposite* sign from */ - /* the first number. */ - c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; - /* The second has a larger magnitude */ - res = s_mp_sub (b, a, c); - } - } - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sub.c */ - -/* Start: bn_mp_sub_d.c */ -#include -#ifdef BN_MP_SUB_D_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* single digit subtraction */ -int -mp_sub_d (mp_int * a, mp_digit b, mp_int * c) -{ - mp_digit *tmpa, *tmpc, mu; - int res, ix, oldused; - - /* grow c as required */ - if (c->alloc < a->used + 1) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* if a is negative just do an unsigned - * addition [with fudged signs] - */ - if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; - - /* clamp */ - mp_clamp(c); - - return res; - } - - /* setup regs */ - oldused = c->used; - tmpa = a->dp; - tmpc = c->dp; - - /* if a <= b simply fix the single digit */ - if ((a->used == 1 && a->dp[0] <= b) || a->used == 0) { - if (a->used == 1) { - *tmpc++ = b - *tmpa; - } else { - *tmpc++ = b; - } - ix = 1; - - /* negative/1digit */ - c->sign = MP_NEG; - c->used = 1; - } else { - /* positive/size */ - c->sign = MP_ZPOS; - c->used = a->used; - - /* subtract first digit */ - *tmpc = *tmpa++ - b; - mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); - *tmpc++ &= MP_MASK; - - /* handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ - mu; - mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); - *tmpc++ &= MP_MASK; - } - } - - /* zero excess digits */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sub_d.c */ - -/* Start: bn_mp_submod.c */ -#include -#ifdef BN_MP_SUBMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* d = a - b (mod c) */ -int -mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - int res; - mp_int t; - - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_sub (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_submod.c */ - -/* Start: bn_mp_to_signed_bin.c */ -#include -#ifdef BN_MP_TO_SIGNED_BIN_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* store in signed [big endian] format */ -int mp_to_signed_bin (mp_int * a, unsigned char *b) -{ - int res; - - if ((res = mp_to_unsigned_bin (a, b + 1)) != MP_OKAY) { - return res; - } - b[0] = (unsigned char) ((a->sign == MP_ZPOS) ? 0 : 1); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_signed_bin.c */ - -/* Start: bn_mp_to_signed_bin_n.c */ -#include -#ifdef BN_MP_TO_SIGNED_BIN_N_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* store in signed [big endian] format */ -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) -{ - if (*outlen < (unsigned long)mp_signed_bin_size(a)) { - return MP_VAL; - } - *outlen = mp_signed_bin_size(a); - return mp_to_signed_bin(a, b); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_signed_bin_n.c */ - -/* Start: bn_mp_to_unsigned_bin.c */ -#include -#ifdef BN_MP_TO_UNSIGNED_BIN_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* store in unsigned [big endian] format */ -int mp_to_unsigned_bin (mp_int * a, unsigned char *b) -{ - int x, res; - mp_int t; - - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - x = 0; - while (mp_iszero (&t) == 0) { -#ifndef MP_8BIT - b[x++] = (unsigned char) (t.dp[0] & 255); -#else - b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7)); -#endif - if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) { - mp_clear (&t); - return res; - } - } - bn_reverse (b, x); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_unsigned_bin.c */ - -/* Start: bn_mp_to_unsigned_bin_n.c */ -#include -#ifdef BN_MP_TO_UNSIGNED_BIN_N_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) -{ - if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { - return MP_VAL; - } - *outlen = mp_unsigned_bin_size(a); - return mp_to_unsigned_bin(a, b); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_unsigned_bin_n.c */ - -/* Start: bn_mp_toom_mul.c */ -#include -#ifdef BN_MP_TOOM_MUL_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* multiplication using the Toom-Cook 3-way algorithm - * - * Much more complicated than Karatsuba but has a lower - * asymptotic running time of O(N**1.464). This algorithm is - * only particularly useful on VERY large inputs - * (we're talking 1000s of digits here...). -*/ -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) -{ - mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; - int res, B; - - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) { - return res; - } - - /* B */ - B = MIN(a->used, b->used) / 3; - - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - mp_mod_2d(&a1, DIGIT_BIT * B, &a1); - - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); - - /* b = b2 * B**2 + b1 * B + b0 */ - if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(b, &b1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b1, B); - mp_mod_2d(&b1, DIGIT_BIT * B, &b1); - - if ((res = mp_copy(b, &b2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b2, B*2); - - /* w0 = a0*b0 */ - if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) { - goto ERR; - } - - /* w4 = a2 * b2 */ - if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) { - goto ERR; - } - - /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) { - goto ERR; - } - - /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) { - goto ERR; - } - - - /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) { - goto ERR; - } - - /* now solve the matrix - - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 - - using 12 subtractions, 4 shifts, - 2 small divisions and 1 small multiplication - */ - - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } - - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) { - goto ERR; - } - -ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toom_mul.c */ - -/* Start: bn_mp_toom_sqr.c */ -#include -#ifdef BN_MP_TOOM_SQR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* squaring using Toom-Cook 3-way algorithm */ -int -mp_toom_sqr(mp_int *a, mp_int *b) -{ - mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; - int res, B; - - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) { - return res; - } - - /* B */ - B = a->used / 3; - - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - mp_mod_2d(&a1, DIGIT_BIT * B, &a1); - - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); - - /* w0 = a0*a0 */ - if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) { - goto ERR; - } - - /* w4 = a2 * a2 */ - if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) { - goto ERR; - } - - /* w1 = (a2 + 2(a1 + 2a0))**2 */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - - /* w3 = (a0 + 2(a1 + 2a2))**2 */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - - - /* w2 = (a2 + a1 + a0)**2 */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) { - goto ERR; - } - - /* now solve the matrix - - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 - - using 12 subtractions, 4 shifts, 2 small divisions and 1 small multiplication. - */ - - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } - - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) { - goto ERR; - } - -ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toom_sqr.c */ - -/* Start: bn_mp_toradix.c */ -#include -#ifdef BN_MP_TORADIX_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix (mp_int * a, char *str, int radix) -{ - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; - - /* check range of the radix */ - if (radix < 2 || radix > 64) { - return MP_VAL; - } - - /* quick out if its zero */ - if (mp_iszero(a) == 1) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } - - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - ++_s; - *str++ = '-'; - t.sign = MP_ZPOS; - } - - digs = 0; - while (mp_iszero (&t) == 0) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } - - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number] - */ - bn_reverse ((unsigned char *)_s, digs); - - /* append a NULL so the string is properly terminated */ - *str = '\0'; - - mp_clear (&t); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toradix.c */ - -/* Start: bn_mp_toradix_n.c */ -#include -#ifdef BN_MP_TORADIX_N_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* stores a bignum as a ASCII string in a given radix (2..64) - * - * Stores upto maxlen-1 chars and always a NULL byte - */ -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) -{ - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; - - /* check range of the maxlen, radix */ - if (maxlen < 2 || radix < 2 || radix > 64) { - return MP_VAL; - } - - /* quick out if its zero */ - if (mp_iszero(a) == MP_YES) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } - - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - /* we have to reverse our digits later... but not the - sign!! */ - ++_s; - - /* store the flag and mark the number as positive */ - *str++ = '-'; - t.sign = MP_ZPOS; - - /* subtract a char */ - --maxlen; - } - - digs = 0; - while (mp_iszero (&t) == 0) { - if (--maxlen < 1) { - /* no more room */ - break; - } - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } - - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number - */ - bn_reverse ((unsigned char *)_s, digs); - - /* append a NULL so the string is properly terminated */ - *str = '\0'; - - mp_clear (&t); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toradix_n.c */ - -/* Start: bn_mp_unsigned_bin_size.c */ -#include -#ifdef BN_MP_UNSIGNED_BIN_SIZE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size (mp_int * a) -{ - int size = mp_count_bits (a); - return (size / 8 + ((size & 7) != 0 ? 1 : 0)); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_unsigned_bin_size.c */ - -/* Start: bn_mp_xor.c */ -#include -#ifdef BN_MP_XOR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* XOR two ints together */ -int -mp_xor (mp_int * a, mp_int * b, mp_int * c) -{ - int res, ix, px; - mp_int t, *x; - - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } - - for (ix = 0; ix < px; ix++) { - t.dp[ix] ^= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_xor.c */ - -/* Start: bn_mp_zero.c */ -#include -#ifdef BN_MP_ZERO_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* set to zero */ -void mp_zero (mp_int * a) -{ - int n; - mp_digit *tmp; - - a->sign = MP_ZPOS; - a->used = 0; - - tmp = a->dp; - for (n = 0; n < a->alloc; n++) { - *tmp++ = 0; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_zero.c */ - -/* Start: bn_prime_tab.c */ -#include -#ifdef BN_PRIME_TAB_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -const mp_digit ltm_prime_tab[] = { - 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, - 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, - 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, - 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, -#ifndef MP_8BIT - 0x0083, - 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, - 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, - 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, - 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, - - 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, - 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, - 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, - 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, - 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, - 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, - 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, - 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, - - 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, - 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, - 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, - 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, - 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, - 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, - 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, - 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, - - 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, - 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, - 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, - 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, - 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, - 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, - 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, - 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 -#endif -}; -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_prime_tab.c */ - -/* Start: bn_reverse.c */ -#include -#ifdef BN_REVERSE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* reverse an array, used for radix code */ -void -bn_reverse (unsigned char *s, int len) -{ - int ix, iy; - unsigned char t; - - ix = 0; - iy = len - 1; - while (ix < iy) { - t = s[ix]; - s[ix] = s[iy]; - s[iy] = t; - ++ix; - --iy; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_reverse.c */ - -/* Start: bn_s_mp_add.c */ -#include -#ifdef BN_S_MP_ADD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int -s_mp_add (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int *x; - int olduse, res, min, max; - - /* find sizes, we let |a| <= |b| which means we have to sort - * them. "x" will point to the input with the most digits - */ - if (a->used > b->used) { - min = b->used; - max = a->used; - x = a; - } else { - min = a->used; - max = b->used; - x = b; - } - - /* init result */ - if (c->alloc < max + 1) { - if ((res = mp_grow (c, max + 1)) != MP_OKAY) { - return res; - } - } - - /* get old used digit count and set new one */ - olduse = c->used; - c->used = max + 1; - - { - register mp_digit u, *tmpa, *tmpb, *tmpc; - register int i; - - /* alias for digit pointers */ - - /* first input */ - tmpa = a->dp; - - /* second input */ - tmpb = b->dp; - - /* destination */ - tmpc = c->dp; - - /* zero the carry */ - u = 0; - for (i = 0; i < min; i++) { - /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ - *tmpc = *tmpa++ + *tmpb++ + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* now copy higher words if any, that is in A+B - * if A or B has more digits add those in - */ - if (min != max) { - for (; i < max; i++) { - /* T[i] = X[i] + U */ - *tmpc = x->dp[i] + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; - } - } - - /* add carry */ - *tmpc++ = u; - - /* clear digits above oldused */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } - - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_add.c */ - -/* Start: bn_s_mp_exptmod.c */ -#include -#ifdef BN_S_MP_EXPTMOD_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -#ifdef MP_LOW_MEM - #define TAB_SIZE 32 -#else - #define TAB_SIZE 256 -#endif - -int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) -{ - mp_int M[TAB_SIZE], res, mu; - mp_digit buf; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int*,mp_int*,mp_int*); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } - -#ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } -#endif - - /* init M array */ - /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); - return err; - } - } - - /* create mu, used for Barrett reduction */ - if ((err = mp_init (&mu)) != MP_OKAY) { - goto LBL_M; - } - - if (redmode == 0) { - if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce; - } else { - if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce_2k_l; - } - - /* create M table - * - * The M table contains powers of the base, - * e.g. M[x] = G**x mod P - * - * The first half of the table is not - * computed though accept for M[0] and M[1] - */ - if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) { - goto LBL_MU; - } - - /* compute the value at M[1<<(winsize-1)] by squaring - * M[1] (winsize-1) times - */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } - - for (x = 0; x < (winsize - 1); x++) { - /* square it */ - if ((err = mp_sqr (&M[1 << (winsize - 1)], - &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } - - /* reduce modulo P */ - if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) - * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) - */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { - goto LBL_MU; - } - if ((err = redux (&M[x], P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { - goto LBL_MU; - } - mp_set (&res, 1); - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits */ - if (digidx == -1) { - break; - } - /* read next digit and reset the bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int) DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if (mode == 0 && y == 0) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if (mode == 1 && y == 0) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if (mode == 2 && bitcpy > 0) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - } - } - } - - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); -LBL_MU:mp_clear (&mu); -LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_exptmod.c */ - -/* Start: bn_s_mp_mul_digs.c */ -#include -#ifdef BN_S_MP_MUL_DIGS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* multiplies |a| * |b| and only computes upto digs digits of result - * HAC pp. 595, Algorithm 14.12 Modified so you can control how - * many digits of output are created. - */ -int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - - /* can we use the fast multiplier? */ - if (((digs) < MP_WARRAY) && - MIN (a->used, b->used) < - (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - return fast_s_mp_mul_digs (a, b, c, digs); - } - - if ((res = mp_init_size (&t, digs)) != MP_OKAY) { - return res; - } - t.used = digs; - - /* compute the digits of the product directly */ - pa = a->used; - for (ix = 0; ix < pa; ix++) { - /* set the carry to zero */ - u = 0; - - /* limit ourselves to making digs digits of output */ - pb = MIN (b->used, digs - ix); - - /* setup some aliases */ - /* copy of the digit from a used within the nested loop */ - tmpx = a->dp[ix]; - - /* an alias for the destination shifted ix places */ - tmpt = t.dp + ix; - - /* an alias for the digits of b */ - tmpy = b->dp; - - /* compute the columns of the output and propagate the carry */ - for (iy = 0; iy < pb; iy++) { - /* compute the column as a mp_word */ - r = ((mp_word)*tmpt) + - ((mp_word)tmpx) * ((mp_word)*tmpy++) + - ((mp_word) u); - - /* the new column is the lower part of the result */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* get the carry word from the result */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - /* set carry if it is placed below digs */ - if (ix + iy < digs) { - *tmpt = u; - } - } - - mp_clamp (&t); - mp_exch (&t, c); - - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_mul_digs.c */ - -/* Start: bn_s_mp_mul_high_digs.c */ -#include -#ifdef BN_S_MP_MUL_HIGH_DIGS_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* multiplies |a| * |b| and does not compute the lower digs digits - * [meant to get the higher part of the product] - */ -int -s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - - /* can we use the fast multiplier? */ -#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C - if (((a->used + b->used + 1) < MP_WARRAY) - && MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - return fast_s_mp_mul_high_digs (a, b, c, digs); - } -#endif - - if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) { - return res; - } - t.used = a->used + b->used + 1; - - pa = a->used; - pb = b->used; - for (ix = 0; ix < pa; ix++) { - /* clear the carry */ - u = 0; - - /* left hand side of A[ix] * B[iy] */ - tmpx = a->dp[ix]; - - /* alias to the address of where the digits will be stored */ - tmpt = &(t.dp[digs]); - - /* alias for where to read the right hand side from */ - tmpy = b->dp + (digs - ix); - - for (iy = digs - ix; iy < pb; iy++) { - /* calculate the double precision result */ - r = ((mp_word)*tmpt) + - ((mp_word)tmpx) * ((mp_word)*tmpy++) + - ((mp_word) u); - - /* get the lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* carry the carry */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - *tmpt = u; - } - mp_clamp (&t); - mp_exch (&t, c); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_mul_high_digs.c */ - -/* Start: bn_s_mp_sqr.c */ -#include -#ifdef BN_S_MP_SQR_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr (mp_int * a, mp_int * b) -{ - mp_int t; - int res, ix, iy, pa; - mp_word r; - mp_digit u, tmpx, *tmpt; - - pa = a->used; - if ((res = mp_init_size (&t, 2*pa + 1)) != MP_OKAY) { - return res; - } - - /* default used is maximum possible size */ - t.used = 2*pa + 1; - - for (ix = 0; ix < pa; ix++) { - /* first calculate the digit at 2*ix */ - /* calculate double precision result */ - r = ((mp_word) t.dp[2*ix]) + - ((mp_word)a->dp[ix])*((mp_word)a->dp[ix]); - - /* store lower part in result */ - t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* get the carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - - /* left hand side of A[ix] * A[iy] */ - tmpx = a->dp[ix]; - - /* alias for where to store the results */ - tmpt = t.dp + (2*ix + 1); - - for (iy = ix + 1; iy < pa; iy++) { - /* first calculate the product */ - r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); - - /* now calculate the double precision result, note we use - * addition instead of *2 since it's easier to optimize - */ - r = ((mp_word) *tmpt) + r + r + ((mp_word) u); - - /* store lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - /* propagate upwards */ - while (u != ((mp_digit) 0)) { - r = ((mp_word) *tmpt) + ((mp_word) u); - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - } - - mp_clamp (&t); - mp_exch (&t, b); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_sqr.c */ - -/* Start: bn_s_mp_sub.c */ -#include -#ifdef BN_S_MP_SUB_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int -s_mp_sub (mp_int * a, mp_int * b, mp_int * c) -{ - int olduse, res, min, max; - - /* find sizes */ - min = b->used; - max = a->used; - - /* init result */ - if (c->alloc < max) { - if ((res = mp_grow (c, max)) != MP_OKAY) { - return res; - } - } - olduse = c->used; - c->used = max; - - { - register mp_digit u, *tmpa, *tmpb, *tmpc; - register int i; - - /* alias for digit pointers */ - tmpa = a->dp; - tmpb = b->dp; - tmpc = c->dp; - - /* set carry to zero */ - u = 0; - for (i = 0; i < min; i++) { - /* T[i] = A[i] - B[i] - U */ - *tmpc = *tmpa++ - *tmpb++ - u; - - /* U = carry bit of T[i] - * Note this saves performing an AND operation since - * if a carry does occur it will propagate all the way to the - * MSB. As a result a single shift is enough to get the carry - */ - u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); - - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* now copy higher words if any, e.g. if A has more digits than B */ - for (; i < max; i++) { - /* T[i] = A[i] - U */ - *tmpc = *tmpa++ - u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); - - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* clear digits above used (since we may not have grown result above) */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } - - mp_clamp (c); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_sub.c */ - -/* Start: bncore.c */ -#include -#ifdef BNCORE_C -/* LibTomMath, multiple-precision integer library -- Tom St Denis - * - * LibTomMath is a library that provides multiple-precision - * integer arithmetic as well as number theoretic functionality. - * - * The library was designed directly after the MPI library by - * Michael Fromberger but has been written from scratch with - * additional optimizations in place. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* Known optimal configurations - - CPU /Compiler /MUL CUTOFF/SQR CUTOFF -------------------------------------------------------------- - Intel P4 Northwood /GCC v3.4.1 / 88/ 128/LTM 0.32 ;-) - AMD Athlon64 /GCC v3.4.4 / 80/ 120/LTM 0.35 - -*/ - -int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsuba multiplication is used. */ - KARATSUBA_SQR_CUTOFF = 120, /* Min. number of digits before Karatsuba squaring is used. */ - - TOOM_MUL_CUTOFF = 350, /* no optimal values of these are known yet so set em high */ - TOOM_SQR_CUTOFF = 400; -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bncore.c */ - - -/* EOF */ diff --git a/libtommath/pretty.build b/libtommath/pretty.build deleted file mode 100644 index a708b8a..0000000 --- a/libtommath/pretty.build +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/perl -w -# -# Cute little builder for perl -# Total waste of development time... -# -# This will build all the object files and then the archive .a file -# requires GCC, GNU make and a sense of humour. -# -# Tom St Denis -use strict; - -my $count = 0; -my $starttime = time; -my $rate = 0; -print "Scanning for source files...\n"; -foreach my $filename (glob "*.c") { - ++$count; -} -print "Source files to build: $count\nBuilding...\n"; -my $i = 0; -my $lines = 0; -my $filesbuilt = 0; -foreach my $filename (glob "*.c") { - printf("Building %3.2f%%, ", (++$i/$count)*100.0); - if ($i % 4 == 0) { print "/, "; } - if ($i % 4 == 1) { print "-, "; } - if ($i % 4 == 2) { print "\\, "; } - if ($i % 4 == 3) { print "|, "; } - if ($rate > 0) { - my $tleft = ($count - $i) / $rate; - my $tsec = $tleft%60; - my $tmin = ($tleft/60)%60; - my $thour = ($tleft/3600)%60; - printf("%2d:%02d:%02d left, ", $thour, $tmin, $tsec); - } - my $cnt = ($i/$count)*30.0; - my $x = 0; - print "["; - for (; $x < $cnt; $x++) { print "#"; } - for (; $x < 30; $x++) { print " "; } - print "]\r"; - my $tmp = $filename; - $tmp =~ s/\.c/".o"/ge; - if (open(SRC, "<$tmp")) { - close SRC; - } else { - !system("make $tmp > /dev/null 2>/dev/null") or die "\nERROR: Failed to make $tmp!!!\n"; - open( SRC, "<$filename" ) or die "Couldn't open $filename for reading: $!"; - ++$lines while (); - close SRC or die "Error closing $filename after reading: $!"; - ++$filesbuilt; - } - - # update timer - if (time != $starttime) { - my $delay = time - $starttime; - $rate = $i/$delay; - } -} - -# finish building the library -printf("\nFinished building source (%d seconds, %3.2f files per second).\n", time - $starttime, $rate); -print "Compiled approximately $filesbuilt files and $lines lines of code.\n"; -print "Doing final make (building archive...)\n"; -!system("make > /dev/null 2>/dev/null") or die "\nERROR: Failed to perform last make command!!!\n"; -print "done.\n"; \ No newline at end of file diff --git a/libtommath/testme.sh b/libtommath/testme.sh deleted file mode 100755 index 6324525..0000000 --- a/libtommath/testme.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash -# -# return values of this script are: -# 0 success -# 128 a test failed -# >0 the number of timed-out tests - -set -e - -if [ -f /proc/cpuinfo ] -then - MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 )) -else - MAKE_JOBS=8 -fi - -ret=0 -TEST_CFLAGS="" - -_help() -{ - echo "Usage options for $(basename $0) [--with-cc=arg [other options]]" - echo - echo "Executing this script without any parameter will only run the default configuration" - echo "that has automatically been determined for the architecture you're running." - echo - echo " --with-cc=* The compiler(s) to use for the tests" - echo " This is an option that will be iterated." - echo - echo "To be able to specify options a compiler has to be given." - echo "All options will be tested with all MP_xBIT configurations." - echo - echo " --with-{m64,m32,mx32} The architecture(s) to build and test for," - echo " e.g. --with-mx32." - echo " This is an option that will be iterated, multiple selections are possible." - echo " The mx32 architecture is not supported by clang and will not be executed." - echo - echo " --cflags=* Give an option to the compiler," - echo " e.g. --cflags=-g" - echo " This is an option that will always be passed as parameter to CC." - echo - echo " --make-option=* Give an option to make," - echo " e.g. --make-option=\"-f makefile.shared\"" - echo " This is an option that will always be passed as parameter to make." - echo - echo "Godmode:" - echo - echo " --all Choose all architectures and gcc and clang as compilers" - echo - echo " --help This message" - exit 0 -} - -_die() -{ - echo "error $2 while $1" - if [ "$2" != "124" ] - then - exit 128 - else - echo "assuming timeout while running test - continue" - ret=$(( $ret + 1 )) - fi -} - -_runtest() -{ - echo -ne " Compile $1 $2" - make clean > /dev/null - CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS test_standalone $MAKE_OPTIONS > /dev/null 2>test_errors.txt - echo -e "\rRun test $1 $2" - timeout --foreground 90 ./test > test_$(echo ${1}${2} | tr ' ' '_').txt || _die "running tests" $? -} - -_banner() -{ - echo "uname="$(uname -a) - [[ "$#" != "0" ]] && (echo $1=$($1 -dumpversion)) || true -} - -_exit() -{ - if [ "$ret" == "0" ] - then - echo "Tests successful" - else - echo "$ret tests timed out" - fi - - exit $ret -} - -ARCHFLAGS="" -COMPILERS="" -CFLAGS="" - -while [ $# -gt 0 ]; -do - case $1 in - "--with-m64" | "--with-m32" | "--with-mx32") - ARCHFLAGS="$ARCHFLAGS ${1:6}" - ;; - --with-cc=*) - COMPILERS="$COMPILERS ${1#*=}" - ;; - --cflags=*) - CFLAGS="$CFLAGS ${1#*=}" - ;; - --make-option=*) - MAKE_OPTIONS="$MAKE_OPTIONS ${1#*=}" - ;; - --all) - COMPILERS="gcc clang" - ARCHFLAGS="-m64 -m32 -mx32" - ;; - --help) - _help - ;; - esac - shift -done - -# default to gcc if nothing is given -if [[ "$COMPILERS" == "" ]] -then - _banner gcc - _runtest "gcc" "" - _exit -fi - -archflags=( $ARCHFLAGS ) -compilers=( $COMPILERS ) - -# choosing a compiler without specifying an architecture will use the default architecture -if [ "${#archflags[@]}" == "0" ] -then - archflags[0]=" " -fi - -_banner - -for i in "${compilers[@]}" -do - if [ -z "$(which $i)" ] - then - echo "Skipped compiler $i, file not found" - continue - fi - compiler_version=$(echo "$i="$($i -dumpversion)) - if [ "$compiler_version" == "clang=4.2.1" ] - then - # one of my versions of clang complains about some stuff in stdio.h and stdarg.h ... - TEST_CFLAGS="-Wno-typedef-redefinition" - else - TEST_CFLAGS="" - fi - echo $compiler_version - - for a in "${archflags[@]}" - do - if [[ $(expr "$i" : "clang") && "$a" == "-mx32" ]] - then - echo "clang -mx32 tests skipped" - continue - fi - - _runtest "$i $a" "" - _runtest "$i $a" "-DMP_8BIT" - _runtest "$i $a" "-DMP_16BIT" - _runtest "$i $a" "-DMP_32BIT" - done -done - -_exit diff --git a/libtommath/tombc/grammar.txt b/libtommath/tombc/grammar.txt deleted file mode 100644 index a780e75..0000000 --- a/libtommath/tombc/grammar.txt +++ /dev/null @@ -1,35 +0,0 @@ -program := program statement | statement | empty -statement := { statement } | - identifier = numexpression; | - identifier[numexpression] = numexpression; | - function(expressionlist); | - for (identifer = numexpression; numexpression; identifier = numexpression) { statement } | - while (numexpression) { statement } | - if (numexpresion) { statement } elif | - break; | - continue; - -elif := else statement | empty -function := abs | countbits | exptmod | jacobi | print | isprime | nextprime | issquare | readinteger | exit -expressionlist := expressionlist, expression | expression - -// LR(1) !!!? -expression := string | numexpression -numexpression := cmpexpr && cmpexpr | cmpexpr \|\| cmpexpr | cmpexpr -cmpexpr := boolexpr < boolexpr | boolexpr > boolexpr | boolexpr == boolexpr | - boolexpr <= boolexpr | boolexpr >= boolexpr | boolexpr -boolexpr := shiftexpr & shiftexpr | shiftexpr ^ shiftexpr | shiftexpr \| shiftexpr | shiftexpr -shiftexpr := addsubexpr << addsubexpr | addsubexpr >> addsubexpr | addsubexpr -addsubexpr := mulexpr + mulexpr | mulexpr - mulexpr | mulexpr -mulexpr := expr * expr | expr / expr | expr % expr | expr -expr := -nexpr | nexpr -nexpr := integer | identifier | ( numexpression ) | identifier[numexpression] - -identifier := identifer digits | identifier alpha | alpha -alpha := a ... z | A ... Z -integer := hexnumber | digits -hexnumber := 0xhexdigits -hexdigits := hexdigits hexdigit | hexdigit -hexdigit := 0 ... 9 | a ... f | A ... F -digits := digits digit | digit -digit := 0 ... 9 diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 4547488..fc6b409 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -203,7 +203,7 @@ int mp_init_size(mp_int *a, int size); /* ---> Basic Manipulations <--- */ #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO) -#define mp_iseven(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO) +#define mp_iseven(a) ((((a)->used == 0) || (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO) #define mp_isodd(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO) #define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO) diff --git a/libtommath/tommath.out b/libtommath/tommath.out deleted file mode 100644 index de4aada..0000000 --- a/libtommath/tommath.out +++ /dev/null @@ -1,139 +0,0 @@ -\BOOKMARK [0][-]{chapter.1}{Introduction}{}% 1 -\BOOKMARK [1][-]{section.1.1}{Multiple Precision Arithmetic}{chapter.1}% 2 -\BOOKMARK [2][-]{subsection.1.1.1}{What is Multiple Precision Arithmetic?}{section.1.1}% 3 -\BOOKMARK [2][-]{subsection.1.1.2}{The Need for Multiple Precision Arithmetic}{section.1.1}% 4 -\BOOKMARK [2][-]{subsection.1.1.3}{Benefits of Multiple Precision Arithmetic}{section.1.1}% 5 -\BOOKMARK [1][-]{section.1.2}{Purpose of This Text}{chapter.1}% 6 -\BOOKMARK [1][-]{section.1.3}{Discussion and Notation}{chapter.1}% 7 -\BOOKMARK [2][-]{subsection.1.3.1}{Notation}{section.1.3}% 8 -\BOOKMARK [2][-]{subsection.1.3.2}{Precision Notation}{section.1.3}% 9 -\BOOKMARK [2][-]{subsection.1.3.3}{Algorithm Inputs and Outputs}{section.1.3}% 10 -\BOOKMARK [2][-]{subsection.1.3.4}{Mathematical Expressions}{section.1.3}% 11 -\BOOKMARK [2][-]{subsection.1.3.5}{Work Effort}{section.1.3}% 12 -\BOOKMARK [1][-]{section.1.4}{Exercises}{chapter.1}% 13 -\BOOKMARK [1][-]{section.1.5}{Introduction to LibTomMath}{chapter.1}% 14 -\BOOKMARK [2][-]{subsection.1.5.1}{What is LibTomMath?}{section.1.5}% 15 -\BOOKMARK [2][-]{subsection.1.5.2}{Goals of LibTomMath}{section.1.5}% 16 -\BOOKMARK [1][-]{section.1.6}{Choice of LibTomMath}{chapter.1}% 17 -\BOOKMARK [2][-]{subsection.1.6.1}{Code Base}{section.1.6}% 18 -\BOOKMARK [2][-]{subsection.1.6.2}{API Simplicity}{section.1.6}% 19 -\BOOKMARK [2][-]{subsection.1.6.3}{Optimizations}{section.1.6}% 20 -\BOOKMARK [2][-]{subsection.1.6.4}{Portability and Stability}{section.1.6}% 21 -\BOOKMARK [2][-]{subsection.1.6.5}{Choice}{section.1.6}% 22 -\BOOKMARK [0][-]{chapter.2}{Getting Started}{}% 23 -\BOOKMARK [1][-]{section.2.1}{Library Basics}{chapter.2}% 24 -\BOOKMARK [1][-]{section.2.2}{What is a Multiple Precision Integer?}{chapter.2}% 25 -\BOOKMARK [2][-]{subsection.2.2.1}{The mp\137int Structure}{section.2.2}% 26 -\BOOKMARK [1][-]{section.2.3}{Argument Passing}{chapter.2}% 27 -\BOOKMARK [1][-]{section.2.4}{Return Values}{chapter.2}% 28 -\BOOKMARK [1][-]{section.2.5}{Initialization and Clearing}{chapter.2}% 29 -\BOOKMARK [2][-]{subsection.2.5.1}{Initializing an mp\137int}{section.2.5}% 30 -\BOOKMARK [2][-]{subsection.2.5.2}{Clearing an mp\137int}{section.2.5}% 31 -\BOOKMARK [1][-]{section.2.6}{Maintenance Algorithms}{chapter.2}% 32 -\BOOKMARK [2][-]{subsection.2.6.1}{Augmenting an mp\137int's Precision}{section.2.6}% 33 -\BOOKMARK [2][-]{subsection.2.6.2}{Initializing Variable Precision mp\137ints}{section.2.6}% 34 -\BOOKMARK [2][-]{subsection.2.6.3}{Multiple Integer Initializations and Clearings}{section.2.6}% 35 -\BOOKMARK [2][-]{subsection.2.6.4}{Clamping Excess Digits}{section.2.6}% 36 -\BOOKMARK [0][-]{chapter.3}{Basic Operations}{}% 37 -\BOOKMARK [1][-]{section.3.1}{Introduction}{chapter.3}% 38 -\BOOKMARK [1][-]{section.3.2}{Assigning Values to mp\137int Structures}{chapter.3}% 39 -\BOOKMARK [2][-]{subsection.3.2.1}{Copying an mp\137int}{section.3.2}% 40 -\BOOKMARK [2][-]{subsection.3.2.2}{Creating a Clone}{section.3.2}% 41 -\BOOKMARK [1][-]{section.3.3}{Zeroing an Integer}{chapter.3}% 42 -\BOOKMARK [1][-]{section.3.4}{Sign Manipulation}{chapter.3}% 43 -\BOOKMARK [2][-]{subsection.3.4.1}{Absolute Value}{section.3.4}% 44 -\BOOKMARK [2][-]{subsection.3.4.2}{Integer Negation}{section.3.4}% 45 -\BOOKMARK [1][-]{section.3.5}{Small Constants}{chapter.3}% 46 -\BOOKMARK [2][-]{subsection.3.5.1}{Setting Small Constants}{section.3.5}% 47 -\BOOKMARK [2][-]{subsection.3.5.2}{Setting Large Constants}{section.3.5}% 48 -\BOOKMARK [1][-]{section.3.6}{Comparisons}{chapter.3}% 49 -\BOOKMARK [2][-]{subsection.3.6.1}{Unsigned Comparisions}{section.3.6}% 50 -\BOOKMARK [2][-]{subsection.3.6.2}{Signed Comparisons}{section.3.6}% 51 -\BOOKMARK [0][-]{chapter.4}{Basic Arithmetic}{}% 52 -\BOOKMARK [1][-]{section.4.1}{Introduction}{chapter.4}% 53 -\BOOKMARK [1][-]{section.4.2}{Addition and Subtraction}{chapter.4}% 54 -\BOOKMARK [2][-]{subsection.4.2.1}{Low Level Addition}{section.4.2}% 55 -\BOOKMARK [2][-]{subsection.4.2.2}{Low Level Subtraction}{section.4.2}% 56 -\BOOKMARK [2][-]{subsection.4.2.3}{High Level Addition}{section.4.2}% 57 -\BOOKMARK [2][-]{subsection.4.2.4}{High Level Subtraction}{section.4.2}% 58 -\BOOKMARK [1][-]{section.4.3}{Bit and Digit Shifting}{chapter.4}% 59 -\BOOKMARK [2][-]{subsection.4.3.1}{Multiplication by Two}{section.4.3}% 60 -\BOOKMARK [2][-]{subsection.4.3.2}{Division by Two}{section.4.3}% 61 -\BOOKMARK [1][-]{section.4.4}{Polynomial Basis Operations}{chapter.4}% 62 -\BOOKMARK [2][-]{subsection.4.4.1}{Multiplication by x}{section.4.4}% 63 -\BOOKMARK [2][-]{subsection.4.4.2}{Division by x}{section.4.4}% 64 -\BOOKMARK [1][-]{section.4.5}{Powers of Two}{chapter.4}% 65 -\BOOKMARK [2][-]{subsection.4.5.1}{Multiplication by Power of Two}{section.4.5}% 66 -\BOOKMARK [2][-]{subsection.4.5.2}{Division by Power of Two}{section.4.5}% 67 -\BOOKMARK [2][-]{subsection.4.5.3}{Remainder of Division by Power of Two}{section.4.5}% 68 -\BOOKMARK [0][-]{chapter.5}{Multiplication and Squaring}{}% 69 -\BOOKMARK [1][-]{section.5.1}{The Multipliers}{chapter.5}% 70 -\BOOKMARK [1][-]{section.5.2}{Multiplication}{chapter.5}% 71 -\BOOKMARK [2][-]{subsection.5.2.1}{The Baseline Multiplication}{section.5.2}% 72 -\BOOKMARK [2][-]{subsection.5.2.2}{Faster Multiplication by the ``Comba'' Method}{section.5.2}% 73 -\BOOKMARK [2][-]{subsection.5.2.3}{Polynomial Basis Multiplication}{section.5.2}% 74 -\BOOKMARK [2][-]{subsection.5.2.4}{Karatsuba Multiplication}{section.5.2}% 75 -\BOOKMARK [2][-]{subsection.5.2.5}{Toom-Cook 3-Way Multiplication}{section.5.2}% 76 -\BOOKMARK [2][-]{subsection.5.2.6}{Signed Multiplication}{section.5.2}% 77 -\BOOKMARK [1][-]{section.5.3}{Squaring}{chapter.5}% 78 -\BOOKMARK [2][-]{subsection.5.3.1}{The Baseline Squaring Algorithm}{section.5.3}% 79 -\BOOKMARK [2][-]{subsection.5.3.2}{Faster Squaring by the ``Comba'' Method}{section.5.3}% 80 -\BOOKMARK [2][-]{subsection.5.3.3}{Polynomial Basis Squaring}{section.5.3}% 81 -\BOOKMARK [2][-]{subsection.5.3.4}{Karatsuba Squaring}{section.5.3}% 82 -\BOOKMARK [2][-]{subsection.5.3.5}{Toom-Cook Squaring}{section.5.3}% 83 -\BOOKMARK [2][-]{subsection.5.3.6}{High Level Squaring}{section.5.3}% 84 -\BOOKMARK [0][-]{chapter.6}{Modular Reduction}{}% 85 -\BOOKMARK [1][-]{section.6.1}{Basics of Modular Reduction}{chapter.6}% 86 -\BOOKMARK [1][-]{section.6.2}{The Barrett Reduction}{chapter.6}% 87 -\BOOKMARK [2][-]{subsection.6.2.1}{Fixed Point Arithmetic}{section.6.2}% 88 -\BOOKMARK [2][-]{subsection.6.2.2}{Choosing a Radix Point}{section.6.2}% 89 -\BOOKMARK [2][-]{subsection.6.2.3}{Trimming the Quotient}{section.6.2}% 90 -\BOOKMARK [2][-]{subsection.6.2.4}{Trimming the Residue}{section.6.2}% 91 -\BOOKMARK [2][-]{subsection.6.2.5}{The Barrett Algorithm}{section.6.2}% 92 -\BOOKMARK [2][-]{subsection.6.2.6}{The Barrett Setup Algorithm}{section.6.2}% 93 -\BOOKMARK [1][-]{section.6.3}{The Montgomery Reduction}{chapter.6}% 94 -\BOOKMARK [2][-]{subsection.6.3.1}{Digit Based Montgomery Reduction}{section.6.3}% 95 -\BOOKMARK [2][-]{subsection.6.3.2}{Baseline Montgomery Reduction}{section.6.3}% 96 -\BOOKMARK [2][-]{subsection.6.3.3}{Faster ``Comba'' Montgomery Reduction}{section.6.3}% 97 -\BOOKMARK [2][-]{subsection.6.3.4}{Montgomery Setup}{section.6.3}% 98 -\BOOKMARK [1][-]{section.6.4}{The Diminished Radix Algorithm}{chapter.6}% 99 -\BOOKMARK [2][-]{subsection.6.4.1}{Choice of Moduli}{section.6.4}% 100 -\BOOKMARK [2][-]{subsection.6.4.2}{Choice of k}{section.6.4}% 101 -\BOOKMARK [2][-]{subsection.6.4.3}{Restricted Diminished Radix Reduction}{section.6.4}% 102 -\BOOKMARK [2][-]{subsection.6.4.4}{Unrestricted Diminished Radix Reduction}{section.6.4}% 103 -\BOOKMARK [1][-]{section.6.5}{Algorithm Comparison}{chapter.6}% 104 -\BOOKMARK [0][-]{chapter.7}{Exponentiation}{}% 105 -\BOOKMARK [1][-]{section.7.1}{Exponentiation Basics}{chapter.7}% 106 -\BOOKMARK [2][-]{subsection.7.1.1}{Single Digit Exponentiation}{section.7.1}% 107 -\BOOKMARK [1][-]{section.7.2}{k-ary Exponentiation}{chapter.7}% 108 -\BOOKMARK [2][-]{subsection.7.2.1}{Optimal Values of k}{section.7.2}% 109 -\BOOKMARK [2][-]{subsection.7.2.2}{Sliding-Window Exponentiation}{section.7.2}% 110 -\BOOKMARK [1][-]{section.7.3}{Modular Exponentiation}{chapter.7}% 111 -\BOOKMARK [2][-]{subsection.7.3.1}{Barrett Modular Exponentiation}{section.7.3}% 112 -\BOOKMARK [1][-]{section.7.4}{Quick Power of Two}{chapter.7}% 113 -\BOOKMARK [0][-]{chapter.8}{Higher Level Algorithms}{}% 114 -\BOOKMARK [1][-]{section.8.1}{Integer Division with Remainder}{chapter.8}% 115 -\BOOKMARK [2][-]{subsection.8.1.1}{Quotient Estimation}{section.8.1}% 116 -\BOOKMARK [2][-]{subsection.8.1.2}{Normalized Integers}{section.8.1}% 117 -\BOOKMARK [2][-]{subsection.8.1.3}{Radix- Division with Remainder}{section.8.1}% 118 -\BOOKMARK [1][-]{section.8.2}{Single Digit Helpers}{chapter.8}% 119 -\BOOKMARK [2][-]{subsection.8.2.1}{Single Digit Addition and Subtraction}{section.8.2}% 120 -\BOOKMARK [2][-]{subsection.8.2.2}{Single Digit Multiplication}{section.8.2}% 121 -\BOOKMARK [2][-]{subsection.8.2.3}{Single Digit Division}{section.8.2}% 122 -\BOOKMARK [2][-]{subsection.8.2.4}{Single Digit Root Extraction}{section.8.2}% 123 -\BOOKMARK [1][-]{section.8.3}{Random Number Generation}{chapter.8}% 124 -\BOOKMARK [1][-]{section.8.4}{Formatted Representations}{chapter.8}% 125 -\BOOKMARK [2][-]{subsection.8.4.1}{Reading Radix-n Input}{section.8.4}% 126 -\BOOKMARK [2][-]{subsection.8.4.2}{Generating Radix-n Output}{section.8.4}% 127 -\BOOKMARK [0][-]{chapter.9}{Number Theoretic Algorithms}{}% 128 -\BOOKMARK [1][-]{section.9.1}{Greatest Common Divisor}{chapter.9}% 129 -\BOOKMARK [2][-]{subsection.9.1.1}{Complete Greatest Common Divisor}{section.9.1}% 130 -\BOOKMARK [1][-]{section.9.2}{Least Common Multiple}{chapter.9}% 131 -\BOOKMARK [1][-]{section.9.3}{Jacobi Symbol Computation}{chapter.9}% 132 -\BOOKMARK [2][-]{subsection.9.3.1}{Jacobi Symbol}{section.9.3}% 133 -\BOOKMARK [1][-]{section.9.4}{Modular Inverse}{chapter.9}% 134 -\BOOKMARK [2][-]{subsection.9.4.1}{General Case}{section.9.4}% 135 -\BOOKMARK [1][-]{section.9.5}{Primality Tests}{chapter.9}% 136 -\BOOKMARK [2][-]{subsection.9.5.1}{Trial Division}{section.9.5}% 137 -\BOOKMARK [2][-]{subsection.9.5.2}{The Fermat Test}{section.9.5}% 138 -\BOOKMARK [2][-]{subsection.9.5.3}{The Miller-Rabin Test}{section.9.5}% 139 diff --git a/libtommath/tommath.pdf b/libtommath/tommath.pdf deleted file mode 100644 index 6a6787e..0000000 Binary files a/libtommath/tommath.pdf and /dev/null differ diff --git a/libtommath/tommath.src b/libtommath/tommath.src deleted file mode 100644 index 768ed10..0000000 --- a/libtommath/tommath.src +++ /dev/null @@ -1,6339 +0,0 @@ -\documentclass[b5paper]{book} -\usepackage{hyperref} -\usepackage{makeidx} -\usepackage{amssymb} -\usepackage{color} -\usepackage{alltt} -\usepackage{graphicx} -\usepackage{layout} -\def\union{\cup} -\def\intersect{\cap} -\def\getsrandom{\stackrel{\rm R}{\gets}} -\def\cross{\times} -\def\cat{\hspace{0.5em} \| \hspace{0.5em}} -\def\catn{$\|$} -\def\divides{\hspace{0.3em} | \hspace{0.3em}} -\def\nequiv{\not\equiv} -\def\approx{\raisebox{0.2ex}{\mbox{\small $\sim$}}} -\def\lcm{{\rm lcm}} -\def\gcd{{\rm gcd}} -\def\log{{\rm log}} -\def\ord{{\rm ord}} -\def\abs{{\mathit abs}} -\def\rep{{\mathit rep}} -\def\mod{{\mathit\ mod\ }} -\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})} -\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} -\newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} -\def\Or{{\rm\ or\ }} -\def\And{{\rm\ and\ }} -\def\iff{\hspace{1em}\Longleftrightarrow\hspace{1em}} -\def\implies{\Rightarrow} -\def\undefined{{\rm ``undefined"}} -\def\Proof{\vspace{1ex}\noindent {\bf Proof:}\hspace{1em}} -\let\oldphi\phi -\def\phi{\varphi} -\def\Pr{{\rm Pr}} -\newcommand{\str}[1]{{\mathbf{#1}}} -\def\F{{\mathbb F}} -\def\N{{\mathbb N}} -\def\Z{{\mathbb Z}} -\def\R{{\mathbb R}} -\def\C{{\mathbb C}} -\def\Q{{\mathbb Q}} -\definecolor{DGray}{gray}{0.5} -\newcommand{\emailaddr}[1]{\mbox{$<${#1}$>$}} -\def\twiddle{\raisebox{0.3ex}{\mbox{\tiny $\sim$}}} -\def\gap{\vspace{0.5ex}} -\makeindex -\begin{document} -\frontmatter -\pagestyle{empty} -\title{Multi--Precision Math} -\author{\mbox{ -%\begin{small} -\begin{tabular}{c} -Tom St Denis \\ -Algonquin College \\ -\\ -Mads Rasmussen \\ -Open Communications Security \\ -\\ -Greg Rose \\ -QUALCOMM Australia \\ -\end{tabular} -%\end{small} -} -} -\maketitle -This text has been placed in the public domain. This text corresponds to the v0.39 release of the -LibTomMath project. - -This text is formatted to the international B5 paper size of 176mm wide by 250mm tall using the \LaTeX{} -{\em book} macro package and the Perl {\em booker} package. - -\tableofcontents -\listoffigures -\chapter*{Prefaces} -When I tell people about my LibTom projects and that I release them as public domain they are often puzzled. -They ask why I did it and especially why I continue to work on them for free. The best I can explain it is ``Because I can.'' -Which seems odd and perhaps too terse for adult conversation. I often qualify it with ``I am able, I am willing.'' which -perhaps explains it better. I am the first to admit there is not anything that special with what I have done. Perhaps -others can see that too and then we would have a society to be proud of. My LibTom projects are what I am doing to give -back to society in the form of tools and knowledge that can help others in their endeavours. - -I started writing this book because it was the most logical task to further my goal of open academia. The LibTomMath source -code itself was written to be easy to follow and learn from. There are times, however, where pure C source code does not -explain the algorithms properly. Hence this book. The book literally starts with the foundation of the library and works -itself outwards to the more complicated algorithms. The use of both pseudo--code and verbatim source code provides a duality -of ``theory'' and ``practice'' that the computer science students of the world shall appreciate. I never deviate too far -from relatively straightforward algebra and I hope that this book can be a valuable learning asset. - -This book and indeed much of the LibTom projects would not exist in their current form if it was not for a plethora -of kind people donating their time, resources and kind words to help support my work. Writing a text of significant -length (along with the source code) is a tiresome and lengthy process. Currently the LibTom project is four years old, -comprises of literally thousands of users and over 100,000 lines of source code, TeX and other material. People like Mads and Greg -were there at the beginning to encourage me to work well. It is amazing how timely validation from others can boost morale to -continue the project. Definitely my parents were there for me by providing room and board during the many months of work in 2003. - -To my many friends whom I have met through the years I thank you for the good times and the words of encouragement. I hope I -honour your kind gestures with this project. - -Open Source. Open Academia. Open Minds. - -\begin{flushright} Tom St Denis \end{flushright} - -\newpage -I found the opportunity to work with Tom appealing for several reasons, not only could I broaden my own horizons, but also -contribute to educate others facing the problem of having to handle big number mathematical calculations. - -This book is Tom's child and he has been caring and fostering the project ever since the beginning with a clear mind of -how he wanted the project to turn out. I have helped by proofreading the text and we have had several discussions about -the layout and language used. - -I hold a masters degree in cryptography from the University of Southern Denmark and have always been interested in the -practical aspects of cryptography. - -Having worked in the security consultancy business for several years in S\~{a}o Paulo, Brazil, I have been in touch with a -great deal of work in which multiple precision mathematics was needed. Understanding the possibilities for speeding up -multiple precision calculations is often very important since we deal with outdated machine architecture where modular -reductions, for example, become painfully slow. - -This text is for people who stop and wonder when first examining algorithms such as RSA for the first time and asks -themselves, ``You tell me this is only secure for large numbers, fine; but how do you implement these numbers?'' - -\begin{flushright} -Mads Rasmussen - -S\~{a}o Paulo - SP - -Brazil -\end{flushright} - -\newpage -It's all because I broke my leg. That just happened to be at about the same time that Tom asked for someone to review the section of the book about -Karatsuba multiplication. I was laid up, alone and immobile, and thought ``Why not?'' I vaguely knew what Karatsuba multiplication was, but not -really, so I thought I could help, learn, and stop myself from watching daytime cable TV, all at once. - -At the time of writing this, I've still not met Tom or Mads in meatspace. I've been following Tom's progress since his first splash on the -sci.crypt Usenet news group. I watched him go from a clueless newbie, to the cryptographic equivalent of a reformed smoker, to a real -contributor to the field, over a period of about two years. I've been impressed with his obvious intelligence, and astounded by his productivity. -Of course, he's young enough to be my own child, so he doesn't have my problems with staying awake. - -When I reviewed that single section of the book, in its very earliest form, I was very pleasantly surprised. So I decided to collaborate more fully, -and at least review all of it, and perhaps write some bits too. There's still a long way to go with it, and I have watched a number of close -friends go through the mill of publication, so I think that the way to go is longer than Tom thinks it is. Nevertheless, it's a good effort, -and I'm pleased to be involved with it. - -\begin{flushright} -Greg Rose, Sydney, Australia, June 2003. -\end{flushright} - -\mainmatter -\pagestyle{headings} -\chapter{Introduction} -\section{Multiple Precision Arithmetic} - -\subsection{What is Multiple Precision Arithmetic?} -When we think of long-hand arithmetic such as addition or multiplication we rarely consider the fact that we instinctively -raise or lower the precision of the numbers we are dealing with. For example, in decimal we almost immediate can -reason that $7$ times $6$ is $42$. However, $42$ has two digits of precision as opposed to one digit we started with. -Further multiplications of say $3$ result in a larger precision result $126$. In these few examples we have multiple -precisions for the numbers we are working with. Despite the various levels of precision a single subset\footnote{With the occasional optimization.} - of algorithms can be designed to accomodate them. - -By way of comparison a fixed or single precision operation would lose precision on various operations. For example, in -the decimal system with fixed precision $6 \cdot 7 = 2$. - -Essentially at the heart of computer based multiple precision arithmetic are the same long-hand algorithms taught in -schools to manually add, subtract, multiply and divide. - -\subsection{The Need for Multiple Precision Arithmetic} -The most prevalent need for multiple precision arithmetic, often referred to as ``bignum'' math, is within the implementation -of public-key cryptography algorithms. Algorithms such as RSA \cite{RSAREF} and Diffie-Hellman \cite{DHREF} require -integers of significant magnitude to resist known cryptanalytic attacks. For example, at the time of this writing a -typical RSA modulus would be at least greater than $10^{309}$. However, modern programming languages such as ISO C \cite{ISOC} and -Java \cite{JAVA} only provide instrinsic support for integers which are relatively small and single precision. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{|r|c|} -\hline \textbf{Data Type} & \textbf{Range} \\ -\hline char & $-128 \ldots 127$ \\ -\hline short & $-32768 \ldots 32767$ \\ -\hline long & $-2147483648 \ldots 2147483647$ \\ -\hline long long & $-9223372036854775808 \ldots 9223372036854775807$ \\ -\hline -\end{tabular} -\end{center} -\caption{Typical Data Types for the C Programming Language} -\label{fig:ISOC} -\end{figure} - -The largest data type guaranteed to be provided by the ISO C programming -language\footnote{As per the ISO C standard. However, each compiler vendor is allowed to augment the precision as they -see fit.} can only represent values up to $10^{19}$ as shown in figure \ref{fig:ISOC}. On its own the C language is -insufficient to accomodate the magnitude required for the problem at hand. An RSA modulus of magnitude $10^{19}$ could be -trivially factored\footnote{A Pollard-Rho factoring would take only $2^{16}$ time.} on the average desktop computer, -rendering any protocol based on the algorithm insecure. Multiple precision algorithms solve this very problem by -extending the range of representable integers while using single precision data types. - -Most advancements in fast multiple precision arithmetic stem from the need for faster and more efficient cryptographic -primitives. Faster modular reduction and exponentiation algorithms such as Barrett's algorithm, which have appeared in -various cryptographic journals, can render algorithms such as RSA and Diffie-Hellman more efficient. In fact, several -major companies such as RSA Security, Certicom and Entrust have built entire product lines on the implementation and -deployment of efficient algorithms. - -However, cryptography is not the only field of study that can benefit from fast multiple precision integer routines. -Another auxiliary use of multiple precision integers is high precision floating point data types. -The basic IEEE \cite{IEEE} standard floating point type is made up of an integer mantissa $q$, an exponent $e$ and a sign bit $s$. -Numbers are given in the form $n = q \cdot b^e \cdot -1^s$ where $b = 2$ is the most common base for IEEE. Since IEEE -floating point is meant to be implemented in hardware the precision of the mantissa is often fairly small -(\textit{23, 48 and 64 bits}). The mantissa is merely an integer and a multiple precision integer could be used to create -a mantissa of much larger precision than hardware alone can efficiently support. This approach could be useful where -scientific applications must minimize the total output error over long calculations. - -Yet another use for large integers is within arithmetic on polynomials of large characteristic (i.e. $GF(p)[x]$ for large $p$). -In fact the library discussed within this text has already been used to form a polynomial basis library\footnote{See \url{http://poly.libtomcrypt.org} for more details.}. - -\subsection{Benefits of Multiple Precision Arithmetic} -\index{precision} -The benefit of multiple precision representations over single or fixed precision representations is that -no precision is lost while representing the result of an operation which requires excess precision. For example, -the product of two $n$-bit integers requires at least $2n$ bits of precision to be represented faithfully. A multiple -precision algorithm would augment the precision of the destination to accomodate the result while a single precision system -would truncate excess bits to maintain a fixed level of precision. - -It is possible to implement algorithms which require large integers with fixed precision algorithms. For example, elliptic -curve cryptography (\textit{ECC}) is often implemented on smartcards by fixing the precision of the integers to the maximum -size the system will ever need. Such an approach can lead to vastly simpler algorithms which can accomodate the -integers required even if the host platform cannot natively accomodate them\footnote{For example, the average smartcard -processor has an 8 bit accumulator.}. However, as efficient as such an approach may be, the resulting source code is not -normally very flexible. It cannot, at runtime, accomodate inputs of higher magnitude than the designer anticipated. - -Multiple precision algorithms have the most overhead of any style of arithmetic. For the the most part the -overhead can be kept to a minimum with careful planning, but overall, it is not well suited for most memory starved -platforms. However, multiple precision algorithms do offer the most flexibility in terms of the magnitude of the -inputs. That is, the same algorithms based on multiple precision integers can accomodate any reasonable size input -without the designer's explicit forethought. This leads to lower cost of ownership for the code as it only has to -be written and tested once. - -\section{Purpose of This Text} -The purpose of this text is to instruct the reader regarding how to implement efficient multiple precision algorithms. -That is to not only explain a limited subset of the core theory behind the algorithms but also the various ``house keeping'' -elements that are neglected by authors of other texts on the subject. Several well reknowned texts \cite{TAOCPV2,HAC} -give considerably detailed explanations of the theoretical aspects of algorithms and often very little information -regarding the practical implementation aspects. - -In most cases how an algorithm is explained and how it is actually implemented are two very different concepts. For -example, the Handbook of Applied Cryptography (\textit{HAC}), algorithm 14.7 on page 594, gives a relatively simple -algorithm for performing multiple precision integer addition. However, the description lacks any discussion concerning -the fact that the two integer inputs may be of differing magnitudes. As a result the implementation is not as simple -as the text would lead people to believe. Similarly the division routine (\textit{algorithm 14.20, pp. 598}) does not -discuss how to handle sign or handle the dividend's decreasing magnitude in the main loop (\textit{step \#3}). - -Both texts also do not discuss several key optimal algorithms required such as ``Comba'' and Karatsuba multipliers -and fast modular inversion, which we consider practical oversights. These optimal algorithms are vital to achieve -any form of useful performance in non-trivial applications. - -To solve this problem the focus of this text is on the practical aspects of implementing a multiple precision integer -package. As a case study the ``LibTomMath''\footnote{Available at \url{http://math.libtomcrypt.com}} package is used -to demonstrate algorithms with real implementations\footnote{In the ISO C programming language.} that have been field -tested and work very well. The LibTomMath library is freely available on the Internet for all uses and this text -discusses a very large portion of the inner workings of the library. - -The algorithms that are presented will always include at least one ``pseudo-code'' description followed -by the actual C source code that implements the algorithm. The pseudo-code can be used to implement the same -algorithm in other programming languages as the reader sees fit. - -This text shall also serve as a walkthrough of the creation of multiple precision algorithms from scratch. Showing -the reader how the algorithms fit together as well as where to start on various taskings. - -\section{Discussion and Notation} -\subsection{Notation} -A multiple precision integer of $n$-digits shall be denoted as $x = (x_{n-1}, \ldots, x_1, x_0)_{ \beta }$ and represent -the integer $x \equiv \sum_{i=0}^{n-1} x_i\beta^i$. The elements of the array $x$ are said to be the radix $\beta$ digits -of the integer. For example, $x = (1,2,3)_{10}$ would represent the integer -$1\cdot 10^2 + 2\cdot10^1 + 3\cdot10^0 = 123$. - -\index{mp\_int} -The term ``mp\_int'' shall refer to a composite structure which contains the digits of the integer it represents, as well -as auxilary data required to manipulate the data. These additional members are discussed further in section -\ref{sec:MPINT}. For the purposes of this text a ``multiple precision integer'' and an ``mp\_int'' are assumed to be -synonymous. When an algorithm is specified to accept an mp\_int variable it is assumed the various auxliary data members -are present as well. An expression of the type \textit{variablename.item} implies that it should evaluate to the -member named ``item'' of the variable. For example, a string of characters may have a member ``length'' which would -evaluate to the number of characters in the string. If the string $a$ equals ``hello'' then it follows that -$a.length = 5$. - -For certain discussions more generic algorithms are presented to help the reader understand the final algorithm used -to solve a given problem. When an algorithm is described as accepting an integer input it is assumed the input is -a plain integer with no additional multiple-precision members. That is, algorithms that use integers as opposed to -mp\_ints as inputs do not concern themselves with the housekeeping operations required such as memory management. These -algorithms will be used to establish the relevant theory which will subsequently be used to describe a multiple -precision algorithm to solve the same problem. - -\subsection{Precision Notation} -The variable $\beta$ represents the radix of a single digit of a multiple precision integer and -must be of the form $q^p$ for $q, p \in \Z^+$. A single precision variable must be able to represent integers in -the range $0 \le x < q \beta$ while a double precision variable must be able to represent integers in the range -$0 \le x < q \beta^2$. The extra radix-$q$ factor allows additions and subtractions to proceed without truncation of the -carry. Since all modern computers are binary, it is assumed that $q$ is two. - -\index{mp\_digit} \index{mp\_word} -Within the source code that will be presented for each algorithm, the data type \textbf{mp\_digit} will represent -a single precision integer type, while, the data type \textbf{mp\_word} will represent a double precision integer type. In -several algorithms (notably the Comba routines) temporary results will be stored in arrays of double precision mp\_words. -For the purposes of this text $x_j$ will refer to the $j$'th digit of a single precision array and $\hat x_j$ will refer to -the $j$'th digit of a double precision array. Whenever an expression is to be assigned to a double precision -variable it is assumed that all single precision variables are promoted to double precision during the evaluation. -Expressions that are assigned to a single precision variable are truncated to fit within the precision of a single -precision data type. - -For example, if $\beta = 10^2$ a single precision data type may represent a value in the -range $0 \le x < 10^3$, while a double precision data type may represent a value in the range $0 \le x < 10^5$. Let -$a = 23$ and $b = 49$ represent two single precision variables. The single precision product shall be written -as $c \leftarrow a \cdot b$ while the double precision product shall be written as $\hat c \leftarrow a \cdot b$. -In this particular case, $\hat c = 1127$ and $c = 127$. The most significant digit of the product would not fit -in a single precision data type and as a result $c \ne \hat c$. - -\subsection{Algorithm Inputs and Outputs} -Within the algorithm descriptions all variables are assumed to be scalars of either single or double precision -as indicated. The only exception to this rule is when variables have been indicated to be of type mp\_int. This -distinction is important as scalars are often used as array indicies and various other counters. - -\subsection{Mathematical Expressions} -The $\lfloor \mbox{ } \rfloor$ brackets imply an expression truncated to an integer not greater than the expression -itself. For example, $\lfloor 5.7 \rfloor = 5$. Similarly the $\lceil \mbox{ } \rceil$ brackets imply an expression -rounded to an integer not less than the expression itself. For example, $\lceil 5.1 \rceil = 6$. Typically when -the $/$ division symbol is used the intention is to perform an integer division with truncation. For example, -$5/2 = 2$ which will often be written as $\lfloor 5/2 \rfloor = 2$ for clarity. When an expression is written as a -fraction a real value division is implied, for example ${5 \over 2} = 2.5$. - -The norm of a multiple precision integer, for example $\vert \vert x \vert \vert$, will be used to represent the number of digits in the representation -of the integer. For example, $\vert \vert 123 \vert \vert = 3$ and $\vert \vert 79452 \vert \vert = 5$. - -\subsection{Work Effort} -\index{big-Oh} -To measure the efficiency of the specified algorithms, a modified big-Oh notation is used. In this system all -single precision operations are considered to have the same cost\footnote{Except where explicitly noted.}. -That is a single precision addition, multiplication and division are assumed to take the same time to -complete. While this is generally not true in practice, it will simplify the discussions considerably. - -Some algorithms have slight advantages over others which is why some constants will not be removed in -the notation. For example, a normal baseline multiplication (section \ref{sec:basemult}) requires $O(n^2)$ work while a -baseline squaring (section \ref{sec:basesquare}) requires $O({{n^2 + n}\over 2})$ work. In standard big-Oh notation these -would both be said to be equivalent to $O(n^2)$. However, -in the context of the this text this is not the case as the magnitude of the inputs will typically be rather small. As a -result small constant factors in the work effort will make an observable difference in algorithm efficiency. - -All of the algorithms presented in this text have a polynomial time work level. That is, of the form -$O(n^k)$ for $n, k \in \Z^{+}$. This will help make useful comparisons in terms of the speed of the algorithms and how -various optimizations will help pay off in the long run. - -\section{Exercises} -Within the more advanced chapters a section will be set aside to give the reader some challenging exercises related to -the discussion at hand. These exercises are not designed to be prize winning problems, but instead to be thought -provoking. Wherever possible the problems are forward minded, stating problems that will be answered in subsequent -chapters. The reader is encouraged to finish the exercises as they appear to get a better understanding of the -subject material. - -That being said, the problems are designed to affirm knowledge of a particular subject matter. Students in particular -are encouraged to verify they can answer the problems correctly before moving on. - -Similar to the exercises of \cite[pp. ix]{TAOCPV2} these exercises are given a scoring system based on the difficulty of -the problem. However, unlike \cite{TAOCPV2} the problems do not get nearly as hard. The scoring of these -exercises ranges from one (the easiest) to five (the hardest). The following table sumarizes the -scoring system used. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|l|} -\hline $\left [ 1 \right ]$ & An easy problem that should only take the reader a manner of \\ - & minutes to solve. Usually does not involve much computer time \\ - & to solve. \\ -\hline $\left [ 2 \right ]$ & An easy problem that involves a marginal amount of computer \\ - & time usage. Usually requires a program to be written to \\ - & solve the problem. \\ -\hline $\left [ 3 \right ]$ & A moderately hard problem that requires a non-trivial amount \\ - & of work. Usually involves trivial research and development of \\ - & new theory from the perspective of a student. \\ -\hline $\left [ 4 \right ]$ & A moderately hard problem that involves a non-trivial amount \\ - & of work and research, the solution to which will demonstrate \\ - & a higher mastery of the subject matter. \\ -\hline $\left [ 5 \right ]$ & A hard problem that involves concepts that are difficult for a \\ - & novice to solve. Solutions to these problems will demonstrate a \\ - & complete mastery of the given subject. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Exercise Scoring System} -\end{figure} - -Problems at the first level are meant to be simple questions that the reader can answer quickly without programming a solution or -devising new theory. These problems are quick tests to see if the material is understood. Problems at the second level -are also designed to be easy but will require a program or algorithm to be implemented to arrive at the answer. These -two levels are essentially entry level questions. - -Problems at the third level are meant to be a bit more difficult than the first two levels. The answer is often -fairly obvious but arriving at an exacting solution requires some thought and skill. These problems will almost always -involve devising a new algorithm or implementing a variation of another algorithm previously presented. Readers who can -answer these questions will feel comfortable with the concepts behind the topic at hand. - -Problems at the fourth level are meant to be similar to those of the level three questions except they will require -additional research to be completed. The reader will most likely not know the answer right away, nor will the text provide -the exact details of the answer until a subsequent chapter. - -Problems at the fifth level are meant to be the hardest -problems relative to all the other problems in the chapter. People who can correctly answer fifth level problems have a -mastery of the subject matter at hand. - -Often problems will be tied together. The purpose of this is to start a chain of thought that will be discussed in future chapters. The reader -is encouraged to answer the follow-up problems and try to draw the relevance of problems. - -\section{Introduction to LibTomMath} - -\subsection{What is LibTomMath?} -LibTomMath is a free and open source multiple precision integer library written entirely in portable ISO C. By portable it -is meant that the library does not contain any code that is computer platform dependent or otherwise problematic to use on -any given platform. - -The library has been successfully tested under numerous operating systems including Unix\footnote{All of these -trademarks belong to their respective rightful owners.}, MacOS, Windows, Linux, PalmOS and on standalone hardware such -as the Gameboy Advance. The library is designed to contain enough functionality to be able to develop applications such -as public key cryptosystems and still maintain a relatively small footprint. - -\subsection{Goals of LibTomMath} - -Libraries which obtain the most efficiency are rarely written in a high level programming language such as C. However, -even though this library is written entirely in ISO C, considerable care has been taken to optimize the algorithm implementations within the -library. Specifically the code has been written to work well with the GNU C Compiler (\textit{GCC}) on both x86 and ARM -processors. Wherever possible, highly efficient algorithms, such as Karatsuba multiplication, sliding window -exponentiation and Montgomery reduction have been provided to make the library more efficient. - -Even with the nearly optimal and specialized algorithms that have been included the Application Programing Interface -(\textit{API}) has been kept as simple as possible. Often generic place holder routines will make use of specialized -algorithms automatically without the developer's specific attention. One such example is the generic multiplication -algorithm \textbf{mp\_mul()} which will automatically use Toom--Cook, Karatsuba, Comba or baseline multiplication -based on the magnitude of the inputs and the configuration of the library. - -Making LibTomMath as efficient as possible is not the only goal of the LibTomMath project. Ideally the library should -be source compatible with another popular library which makes it more attractive for developers to use. In this case the -MPI library was used as a API template for all the basic functions. MPI was chosen because it is another library that fits -in the same niche as LibTomMath. Even though LibTomMath uses MPI as the template for the function names and argument -passing conventions, it has been written from scratch by Tom St Denis. - -The project is also meant to act as a learning tool for students, the logic being that no easy-to-follow ``bignum'' -library exists which can be used to teach computer science students how to perform fast and reliable multiple precision -integer arithmetic. To this end the source code has been given quite a few comments and algorithm discussion points. - -\section{Choice of LibTomMath} -LibTomMath was chosen as the case study of this text not only because the author of both projects is one and the same but -for more worthy reasons. Other libraries such as GMP \cite{GMP}, MPI \cite{MPI}, LIP \cite{LIP} and OpenSSL -\cite{OPENSSL} have multiple precision integer arithmetic routines but would not be ideal for this text for -reasons that will be explained in the following sub-sections. - -\subsection{Code Base} -The LibTomMath code base is all portable ISO C source code. This means that there are no platform dependent conditional -segments of code littered throughout the source. This clean and uncluttered approach to the library means that a -developer can more readily discern the true intent of a given section of source code without trying to keep track of -what conditional code will be used. - -The code base of LibTomMath is well organized. Each function is in its own separate source code file -which allows the reader to find a given function very quickly. On average there are $76$ lines of code per source -file which makes the source very easily to follow. By comparison MPI and LIP are single file projects making code tracing -very hard. GMP has many conditional code segments which also hinder tracing. - -When compiled with GCC for the x86 processor and optimized for speed the entire library is approximately $100$KiB\footnote{The notation ``KiB'' means $2^{10}$ octets, similarly ``MiB'' means $2^{20}$ octets.} - which is fairly small compared to GMP (over $250$KiB). LibTomMath is slightly larger than MPI (which compiles to about -$50$KiB) but LibTomMath is also much faster and more complete than MPI. - -\subsection{API Simplicity} -LibTomMath is designed after the MPI library and shares the API design. Quite often programs that use MPI will build -with LibTomMath without change. The function names correlate directly to the action they perform. Almost all of the -functions share the same parameter passing convention. The learning curve is fairly shallow with the API provided -which is an extremely valuable benefit for the student and developer alike. - -The LIP library is an example of a library with an API that is awkward to work with. LIP uses function names that are often ``compressed'' to -illegible short hand. LibTomMath does not share this characteristic. - -The GMP library also does not return error codes. Instead it uses a POSIX.1 \cite{POSIX1} signal system where errors -are signaled to the host application. This happens to be the fastest approach but definitely not the most versatile. In -effect a math error (i.e. invalid input, heap error, etc) can cause a program to stop functioning which is definitely -undersireable in many situations. - -\subsection{Optimizations} -While LibTomMath is certainly not the fastest library (GMP often beats LibTomMath by a factor of two) it does -feature a set of optimal algorithms for tasks such as modular reduction, exponentiation, multiplication and squaring. GMP -and LIP also feature such optimizations while MPI only uses baseline algorithms with no optimizations. GMP lacks a few -of the additional modular reduction optimizations that LibTomMath features\footnote{At the time of this writing GMP -only had Barrett and Montgomery modular reduction algorithms.}. - -LibTomMath is almost always an order of magnitude faster than the MPI library at computationally expensive tasks such as modular -exponentiation. In the grand scheme of ``bignum'' libraries LibTomMath is faster than the average library and usually -slower than the best libraries such as GMP and OpenSSL by only a small factor. - -\subsection{Portability and Stability} -LibTomMath will build ``out of the box'' on any platform equipped with a modern version of the GNU C Compiler -(\textit{GCC}). This means that without changes the library will build without configuration or setting up any -variables. LIP and MPI will build ``out of the box'' as well but have numerous known bugs. Most notably the author of -MPI has recently stopped working on his library and LIP has long since been discontinued. - -GMP requires a configuration script to run and will not build out of the box. GMP and LibTomMath are still in active -development and are very stable across a variety of platforms. - -\subsection{Choice} -LibTomMath is a relatively compact, well documented, highly optimized and portable library which seems only natural for -the case study of this text. Various source files from the LibTomMath project will be included within the text. However, -the reader is encouraged to download their own copy of the library to actually be able to work with the library. - -\chapter{Getting Started} -\section{Library Basics} -The trick to writing any useful library of source code is to build a solid foundation and work outwards from it. First, -a problem along with allowable solution parameters should be identified and analyzed. In this particular case the -inability to accomodate multiple precision integers is the problem. Futhermore, the solution must be written -as portable source code that is reasonably efficient across several different computer platforms. - -After a foundation is formed the remainder of the library can be designed and implemented in a hierarchical fashion. -That is, to implement the lowest level dependencies first and work towards the most abstract functions last. For example, -before implementing a modular exponentiation algorithm one would implement a modular reduction algorithm. -By building outwards from a base foundation instead of using a parallel design methodology the resulting project is -highly modular. Being highly modular is a desirable property of any project as it often means the resulting product -has a small footprint and updates are easy to perform. - -Usually when I start a project I will begin with the header files. I define the data types I think I will need and -prototype the initial functions that are not dependent on other functions (within the library). After I -implement these base functions I prototype more dependent functions and implement them. The process repeats until -I implement all of the functions I require. For example, in the case of LibTomMath I implemented functions such as -mp\_init() well before I implemented mp\_mul() and even further before I implemented mp\_exptmod(). As an example as to -why this design works note that the Karatsuba and Toom-Cook multipliers were written \textit{after} the -dependent function mp\_exptmod() was written. Adding the new multiplication algorithms did not require changes to the -mp\_exptmod() function itself and lowered the total cost of ownership (\textit{so to speak}) and of development -for new algorithms. This methodology allows new algorithms to be tested in a complete framework with relative ease. - -FIGU,design_process,Design Flow of the First Few Original LibTomMath Functions. - -Only after the majority of the functions were in place did I pursue a less hierarchical approach to auditing and optimizing -the source code. For example, one day I may audit the multipliers and the next day the polynomial basis functions. - -It only makes sense to begin the text with the preliminary data types and support algorithms required as well. -This chapter discusses the core algorithms of the library which are the dependents for every other algorithm. - -\section{What is a Multiple Precision Integer?} -Recall that most programming languages, in particular ISO C \cite{ISOC}, only have fixed precision data types that on their own cannot -be used to represent values larger than their precision will allow. The purpose of multiple precision algorithms is -to use fixed precision data types to create and manipulate multiple precision integers which may represent values -that are very large. - -As a well known analogy, school children are taught how to form numbers larger than nine by prepending more radix ten digits. In the decimal system -the largest single digit value is $9$. However, by concatenating digits together larger numbers may be represented. Newly prepended digits -(\textit{to the left}) are said to be in a different power of ten column. That is, the number $123$ can be described as having a $1$ in the hundreds -column, $2$ in the tens column and $3$ in the ones column. Or more formally $123 = 1 \cdot 10^2 + 2 \cdot 10^1 + 3 \cdot 10^0$. Computer based -multiple precision arithmetic is essentially the same concept. Larger integers are represented by adjoining fixed -precision computer words with the exception that a different radix is used. - -What most people probably do not think about explicitly are the various other attributes that describe a multiple precision -integer. For example, the integer $154_{10}$ has two immediately obvious properties. First, the integer is positive, -that is the sign of this particular integer is positive as opposed to negative. Second, the integer has three digits in -its representation. There is an additional property that the integer posesses that does not concern pencil-and-paper -arithmetic. The third property is how many digits placeholders are available to hold the integer. - -The human analogy of this third property is ensuring there is enough space on the paper to write the integer. For example, -if one starts writing a large number too far to the right on a piece of paper they will have to erase it and move left. -Similarly, computer algorithms must maintain strict control over memory usage to ensure that the digits of an integer -will not exceed the allowed boundaries. These three properties make up what is known as a multiple precision -integer or mp\_int for short. - -\subsection{The mp\_int Structure} -\label{sec:MPINT} -The mp\_int structure is the ISO C based manifestation of what represents a multiple precision integer. The ISO C standard does not provide for -any such data type but it does provide for making composite data types known as structures. The following is the structure definition -used within LibTomMath. - -\index{mp\_int} -\begin{figure}[here] -\begin{center} -\begin{small} -%\begin{verbatim} -\begin{tabular}{|l|} -\hline -typedef struct \{ \\ -\hspace{3mm}int used, alloc, sign;\\ -\hspace{3mm}mp\_digit *dp;\\ -\} \textbf{mp\_int}; \\ -\hline -\end{tabular} -%\end{verbatim} -\end{small} -\caption{The mp\_int Structure} -\label{fig:mpint} -\end{center} -\end{figure} - -The mp\_int structure (fig. \ref{fig:mpint}) can be broken down as follows. - -\begin{enumerate} -\item The \textbf{used} parameter denotes how many digits of the array \textbf{dp} contain the digits used to represent -a given integer. The \textbf{used} count must be positive (or zero) and may not exceed the \textbf{alloc} count. - -\item The \textbf{alloc} parameter denotes how -many digits are available in the array to use by functions before it has to increase in size. When the \textbf{used} count -of a result would exceed the \textbf{alloc} count all of the algorithms will automatically increase the size of the -array to accommodate the precision of the result. - -\item The pointer \textbf{dp} points to a dynamically allocated array of digits that represent the given multiple -precision integer. It is padded with $(\textbf{alloc} - \textbf{used})$ zero digits. The array is maintained in a least -significant digit order. As a pencil and paper analogy the array is organized such that the right most digits are stored -first starting at the location indexed by zero\footnote{In C all arrays begin at zero.} in the array. For example, -if \textbf{dp} contains $\lbrace a, b, c, \ldots \rbrace$ where \textbf{dp}$_0 = a$, \textbf{dp}$_1 = b$, \textbf{dp}$_2 = c$, $\ldots$ then -it would represent the integer $a + b\beta + c\beta^2 + \ldots$ - -\index{MP\_ZPOS} \index{MP\_NEG} -\item The \textbf{sign} parameter denotes the sign as either zero/positive (\textbf{MP\_ZPOS}) or negative (\textbf{MP\_NEG}). -\end{enumerate} - -\subsubsection{Valid mp\_int Structures} -Several rules are placed on the state of an mp\_int structure and are assumed to be followed for reasons of efficiency. -The only exceptions are when the structure is passed to initialization functions such as mp\_init() and mp\_init\_copy(). - -\begin{enumerate} -\item The value of \textbf{alloc} may not be less than one. That is \textbf{dp} always points to a previously allocated -array of digits. -\item The value of \textbf{used} may not exceed \textbf{alloc} and must be greater than or equal to zero. -\item The value of \textbf{used} implies the digit at index $(used - 1)$ of the \textbf{dp} array is non-zero. That is, -leading zero digits in the most significant positions must be trimmed. - \begin{enumerate} - \item Digits in the \textbf{dp} array at and above the \textbf{used} location must be zero. - \end{enumerate} -\item The value of \textbf{sign} must be \textbf{MP\_ZPOS} if \textbf{used} is zero; -this represents the mp\_int value of zero. -\end{enumerate} - -\section{Argument Passing} -A convention of argument passing must be adopted early on in the development of any library. Making the function -prototypes consistent will help eliminate many headaches in the future as the library grows to significant complexity. -In LibTomMath the multiple precision integer functions accept parameters from left to right as pointers to mp\_int -structures. That means that the source (input) operands are placed on the left and the destination (output) on the right. -Consider the following examples. - -\begin{verbatim} - mp_mul(&a, &b, &c); /* c = a * b */ - mp_add(&a, &b, &a); /* a = a + b */ - mp_sqr(&a, &b); /* b = a * a */ -\end{verbatim} - -The left to right order is a fairly natural way to implement the functions since it lets the developer read aloud the -functions and make sense of them. For example, the first function would read ``multiply a and b and store in c''. - -Certain libraries (\textit{LIP by Lenstra for instance}) accept parameters the other way around, to mimic the order -of assignment expressions. That is, the destination (output) is on the left and arguments (inputs) are on the right. In -truth, it is entirely a matter of preference. In the case of LibTomMath the convention from the MPI library has been -adopted. - -Another very useful design consideration, provided for in LibTomMath, is whether to allow argument sources to also be a -destination. For example, the second example (\textit{mp\_add}) adds $a$ to $b$ and stores in $a$. This is an important -feature to implement since it allows the calling functions to cut down on the number of variables it must maintain. -However, to implement this feature specific care has to be given to ensure the destination is not modified before the -source is fully read. - -\section{Return Values} -A well implemented application, no matter what its purpose, should trap as many runtime errors as possible and return them -to the caller. By catching runtime errors a library can be guaranteed to prevent undefined behaviour. However, the end -developer can still manage to cause a library to crash. For example, by passing an invalid pointer an application may -fault by dereferencing memory not owned by the application. - -In the case of LibTomMath the only errors that are checked for are related to inappropriate inputs (division by zero for -instance) and memory allocation errors. It will not check that the mp\_int passed to any function is valid nor -will it check pointers for validity. Any function that can cause a runtime error will return an error code as an -\textbf{int} data type with one of the following values (fig \ref{fig:errcodes}). - -\index{MP\_OKAY} \index{MP\_VAL} \index{MP\_MEM} -\begin{figure}[here] -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Value} & \textbf{Meaning} \\ -\hline \textbf{MP\_OKAY} & The function was successful \\ -\hline \textbf{MP\_VAL} & One of the input value(s) was invalid \\ -\hline \textbf{MP\_MEM} & The function ran out of heap memory \\ -\hline -\end{tabular} -\end{center} -\caption{LibTomMath Error Codes} -\label{fig:errcodes} -\end{figure} - -When an error is detected within a function it should free any memory it allocated, often during the initialization of -temporary mp\_ints, and return as soon as possible. The goal is to leave the system in the same state it was when the -function was called. Error checking with this style of API is fairly simple. - -\begin{verbatim} - int err; - if ((err = mp_add(&a, &b, &c)) != MP_OKAY) { - printf("Error: %s\n", mp_error_to_string(err)); - exit(EXIT_FAILURE); - } -\end{verbatim} - -The GMP \cite{GMP} library uses C style \textit{signals} to flag errors which is of questionable use. Not all errors are fatal -and it was not deemed ideal by the author of LibTomMath to force developers to have signal handlers for such cases. - -\section{Initialization and Clearing} -The logical starting point when actually writing multiple precision integer functions is the initialization and -clearing of the mp\_int structures. These two algorithms will be used by the majority of the higher level algorithms. - -Given the basic mp\_int structure an initialization routine must first allocate memory to hold the digits of -the integer. Often it is optimal to allocate a sufficiently large pre-set number of digits even though -the initial integer will represent zero. If only a single digit were allocated quite a few subsequent re-allocations -would occur when operations are performed on the integers. There is a tradeoff between how many default digits to allocate -and how many re-allocations are tolerable. Obviously allocating an excessive amount of digits initially will waste -memory and become unmanageable. - -If the memory for the digits has been successfully allocated then the rest of the members of the structure must -be initialized. Since the initial state of an mp\_int is to represent the zero integer, the allocated digits must be set -to zero. The \textbf{used} count set to zero and \textbf{sign} set to \textbf{MP\_ZPOS}. - -\subsection{Initializing an mp\_int} -An mp\_int is said to be initialized if it is set to a valid, preferably default, state such that all of the members of the -structure are set to valid values. The mp\_init algorithm will perform such an action. - -\index{mp\_init} -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Allocate memory and initialize $a$ to a known valid mp\_int state. \\ -\hline \\ -1. Allocate memory for \textbf{MP\_PREC} digits. \\ -2. If the allocation failed return(\textit{MP\_MEM}) \\ -3. for $n$ from $0$ to $MP\_PREC - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$\\ -4. $a.sign \leftarrow MP\_ZPOS$\\ -5. $a.used \leftarrow 0$\\ -6. $a.alloc \leftarrow MP\_PREC$\\ -7. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init} -\end{figure} - -\textbf{Algorithm mp\_init.} -The purpose of this function is to initialize an mp\_int structure so that the rest of the library can properly -manipulte it. It is assumed that the input may not have had any of its members previously initialized which is certainly -a valid assumption if the input resides on the stack. - -Before any of the members such as \textbf{sign}, \textbf{used} or \textbf{alloc} are initialized the memory for -the digits is allocated. If this fails the function returns before setting any of the other members. The \textbf{MP\_PREC} -name represents a constant\footnote{Defined in the ``tommath.h'' header file within LibTomMath.} -used to dictate the minimum precision of newly initialized mp\_int integers. Ideally, it is at least equal to the smallest -precision number you'll be working with. - -Allocating a block of digits at first instead of a single digit has the benefit of lowering the number of usually slow -heap operations later functions will have to perform in the future. If \textbf{MP\_PREC} is set correctly the slack -memory and the number of heap operations will be trivial. - -Once the allocation has been made the digits have to be set to zero as well as the \textbf{used}, \textbf{sign} and -\textbf{alloc} members initialized. This ensures that the mp\_int will always represent the default state of zero regardless -of the original condition of the input. - -\textbf{Remark.} -This function introduces the idiosyncrasy that all iterative loops, commonly initiated with the ``for'' keyword, iterate incrementally -when the ``to'' keyword is placed between two expressions. For example, ``for $a$ from $b$ to $c$ do'' means that -a subsequent expression (or body of expressions) are to be evaluated upto $c - b$ times so long as $b \le c$. In each -iteration the variable $a$ is substituted for a new integer that lies inclusively between $b$ and $c$. If $b > c$ occured -the loop would not iterate. By contrast if the ``downto'' keyword were used in place of ``to'' the loop would iterate -decrementally. - -EXAM,bn_mp_init.c - -One immediate observation of this initializtion function is that it does not return a pointer to a mp\_int structure. It -is assumed that the caller has already allocated memory for the mp\_int structure, typically on the application stack. The -call to mp\_init() is used only to initialize the members of the structure to a known default state. - -Here we see (line @23,XMALLOC@) the memory allocation is performed first. This allows us to exit cleanly and quickly -if there is an error. If the allocation fails the routine will return \textbf{MP\_MEM} to the caller to indicate there -was a memory error. The function XMALLOC is what actually allocates the memory. Technically XMALLOC is not a function -but a macro defined in ``tommath.h``. By default, XMALLOC will evaluate to malloc() which is the C library's built--in -memory allocation routine. - -In order to assure the mp\_int is in a known state the digits must be set to zero. On most platforms this could have been -accomplished by using calloc() instead of malloc(). However, to correctly initialize a integer type to a given value in a -portable fashion you have to actually assign the value. The for loop (line @28,for@) performs this required -operation. - -After the memory has been successfully initialized the remainder of the members are initialized -(lines @29,used@ through @31,sign@) to their respective default states. At this point the algorithm has succeeded and -a success code is returned to the calling function. If this function returns \textbf{MP\_OKAY} it is safe to assume the -mp\_int structure has been properly initialized and is safe to use with other functions within the library. - -\subsection{Clearing an mp\_int} -When an mp\_int is no longer required by the application, the memory that has been allocated for its digits must be -returned to the application's memory pool with the mp\_clear algorithm. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clear}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. The memory for $a$ shall be deallocated. \\ -\hline \\ -1. If $a$ has been previously freed then return(\textit{MP\_OKAY}). \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $a_n \leftarrow 0$ \\ -3. Free the memory allocated for the digits of $a$. \\ -4. $a.used \leftarrow 0$ \\ -5. $a.alloc \leftarrow 0$ \\ -6. $a.sign \leftarrow MP\_ZPOS$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_clear} -\end{figure} - -\textbf{Algorithm mp\_clear.} -This algorithm accomplishes two goals. First, it clears the digits and the other mp\_int members. This ensures that -if a developer accidentally re-uses a cleared structure it is less likely to cause problems. The second goal -is to free the allocated memory. - -The logic behind the algorithm is extended by marking cleared mp\_int structures so that subsequent calls to this -algorithm will not try to free the memory multiple times. Cleared mp\_ints are detectable by having a pre-defined invalid -digit pointer \textbf{dp} setting. - -Once an mp\_int has been cleared the mp\_int structure is no longer in a valid state for any other algorithm -with the exception of algorithms mp\_init, mp\_init\_copy, mp\_init\_size and mp\_clear. - -EXAM,bn_mp_clear.c - -The algorithm only operates on the mp\_int if it hasn't been previously cleared. The if statement (line @23,a->dp != NULL@) -checks to see if the \textbf{dp} member is not \textbf{NULL}. If the mp\_int is a valid mp\_int then \textbf{dp} cannot be -\textbf{NULL} in which case the if statement will evaluate to true. - -The digits of the mp\_int are cleared by the for loop (line @25,for@) which assigns a zero to every digit. Similar to mp\_init() -the digits are assigned zero instead of using block memory operations (such as memset()) since this is more portable. - -The digits are deallocated off the heap via the XFREE macro. Similar to XMALLOC the XFREE macro actually evaluates to -a standard C library function. In this case the free() function. Since free() only deallocates the memory the pointer -still has to be reset to \textbf{NULL} manually (line @33,NULL@). - -Now that the digits have been cleared and deallocated the other members are set to their final values (lines @34,= 0@ and @35,ZPOS@). - -\section{Maintenance Algorithms} - -The previous sections describes how to initialize and clear an mp\_int structure. To further support operations -that are to be performed on mp\_int structures (such as addition and multiplication) the dependent algorithms must be -able to augment the precision of an mp\_int and -initialize mp\_ints with differing initial conditions. - -These algorithms complete the set of low level algorithms required to work with mp\_int structures in the higher level -algorithms such as addition, multiplication and modular exponentiation. - -\subsection{Augmenting an mp\_int's Precision} -When storing a value in an mp\_int structure, a sufficient number of digits must be available to accomodate the entire -result of an operation without loss of precision. Quite often the size of the array given by the \textbf{alloc} member -is large enough to simply increase the \textbf{used} digit count. However, when the size of the array is too small it -must be re-sized appropriately to accomodate the result. The mp\_grow algorithm will provide this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_grow}. \\ -\textbf{Input}. An mp\_int $a$ and an integer $b$. \\ -\textbf{Output}. $a$ is expanded to accomodate $b$ digits. \\ -\hline \\ -1. if $a.alloc \ge b$ then return(\textit{MP\_OKAY}) \\ -2. $u \leftarrow b\mbox{ (mod }MP\_PREC\mbox{)}$ \\ -3. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -4. Re-allocate the array of digits $a$ to size $v$ \\ -5. If the allocation failed then return(\textit{MP\_MEM}). \\ -6. for n from a.alloc to $v - 1$ do \\ -\hspace{+3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.alloc \leftarrow v$ \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_grow} -\end{figure} - -\textbf{Algorithm mp\_grow.} -It is ideal to prevent re-allocations from being performed if they are not required (step one). This is useful to -prevent mp\_ints from growing excessively in code that erroneously calls mp\_grow. - -The requested digit count is padded up to next multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} (steps two and three). -This helps prevent many trivial reallocations that would grow an mp\_int by trivially small values. - -It is assumed that the reallocation (step four) leaves the lower $a.alloc$ digits of the mp\_int intact. This is much -akin to how the \textit{realloc} function from the standard C library works. Since the newly allocated digits are -assumed to contain undefined values they are initially set to zero. - -EXAM,bn_mp_grow.c - -A quick optimization is to first determine if a memory re-allocation is required at all. The if statement (line @24,alloc@) checks -if the \textbf{alloc} member of the mp\_int is smaller than the requested digit count. If the count is not larger than \textbf{alloc} -the function skips the re-allocation part thus saving time. - -When a re-allocation is performed it is turned into an optimal request to save time in the future. The requested digit count is -padded upwards to 2nd multiple of \textbf{MP\_PREC} larger than \textbf{alloc} (line @25, size@). The XREALLOC function is used -to re-allocate the memory. As per the other functions XREALLOC is actually a macro which evaluates to realloc by default. The realloc -function leaves the base of the allocation intact which means the first \textbf{alloc} digits of the mp\_int are the same as before -the re-allocation. All that is left is to clear the newly allocated digits and return. - -Note that the re-allocation result is actually stored in a temporary pointer $tmp$. This is to allow this function to return -an error with a valid pointer. Earlier releases of the library stored the result of XREALLOC into the mp\_int $a$. That would -result in a memory leak if XREALLOC ever failed. - -\subsection{Initializing Variable Precision mp\_ints} -Occasionally the number of digits required will be known in advance of an initialization, based on, for example, the size -of input mp\_ints to a given algorithm. The purpose of algorithm mp\_init\_size is similar to mp\_init except that it -will allocate \textit{at least} a specified number of digits. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_size}. \\ -\textbf{Input}. An mp\_int $a$ and the requested number of digits $b$. \\ -\textbf{Output}. $a$ is initialized to hold at least $b$ digits. \\ -\hline \\ -1. $u \leftarrow b \mbox{ (mod }MP\_PREC\mbox{)}$ \\ -2. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -3. Allocate $v$ digits. \\ -4. for $n$ from $0$ to $v - 1$ do \\ -\hspace{3mm}4.1 $a_n \leftarrow 0$ \\ -5. $a.sign \leftarrow MP\_ZPOS$\\ -6. $a.used \leftarrow 0$\\ -7. $a.alloc \leftarrow v$\\ -8. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_init\_size} -\end{figure} - -\textbf{Algorithm mp\_init\_size.} -This algorithm will initialize an mp\_int structure $a$ like algorithm mp\_init with the exception that the number of -digits allocated can be controlled by the second input argument $b$. The input size is padded upwards so it is a -multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} digits. This padding is used to prevent trivial -allocations from becoming a bottleneck in the rest of the algorithms. - -Like algorithm mp\_init, the mp\_int structure is initialized to a default state representing the integer zero. This -particular algorithm is useful if it is known ahead of time the approximate size of the input. If the approximation is -correct no further memory re-allocations are required to work with the mp\_int. - -EXAM,bn_mp_init_size.c - -The number of digits $b$ requested is padded (line @22,MP_PREC@) by first augmenting it to the next multiple of -\textbf{MP\_PREC} and then adding \textbf{MP\_PREC} to the result. If the memory can be successfully allocated the -mp\_int is placed in a default state representing the integer zero. Otherwise, the error code \textbf{MP\_MEM} will be -returned (line @27,return@). - -The digits are allocated with the malloc() function (line @27,XMALLOC@) and set to zero afterwards (line @38,for@). The -\textbf{used} count is set to zero, the \textbf{alloc} count set to the padded digit count and the \textbf{sign} flag set -to \textbf{MP\_ZPOS} to achieve a default valid mp\_int state (lines @29,used@, @30,alloc@ and @31,sign@). If the function -returns succesfully then it is correct to assume that the mp\_int structure is in a valid state for the remainder of the -functions to work with. - -\subsection{Multiple Integer Initializations and Clearings} -Occasionally a function will require a series of mp\_int data types to be made available simultaneously. -The purpose of algorithm mp\_init\_multi is to initialize a variable length array of mp\_int structures in a single -statement. It is essentially a shortcut to multiple initializations. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_multi}. \\ -\textbf{Input}. Variable length array $V_k$ of mp\_int variables of length $k$. \\ -\textbf{Output}. The array is initialized such that each mp\_int of $V_k$ is ready to use. \\ -\hline \\ -1. for $n$ from 0 to $k - 1$ do \\ -\hspace{+3mm}1.1. Initialize the mp\_int $V_n$ (\textit{mp\_init}) \\ -\hspace{+3mm}1.2. If initialization failed then do \\ -\hspace{+6mm}1.2.1. for $j$ from $0$ to $n$ do \\ -\hspace{+9mm}1.2.1.1. Free the mp\_int $V_j$ (\textit{mp\_clear}) \\ -\hspace{+6mm}1.2.2. Return(\textit{MP\_MEM}) \\ -2. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_multi} -\end{figure} - -\textbf{Algorithm mp\_init\_multi.} -The algorithm will initialize the array of mp\_int variables one at a time. If a runtime error has been detected -(\textit{step 1.2}) all of the previously initialized variables are cleared. The goal is an ``all or nothing'' -initialization which allows for quick recovery from runtime errors. - -EXAM,bn_mp_init_multi.c - -This function intializes a variable length list of mp\_int structure pointers. However, instead of having the mp\_int -structures in an actual C array they are simply passed as arguments to the function. This function makes use of the -``...'' argument syntax of the C programming language. The list is terminated with a final \textbf{NULL} argument -appended on the right. - -The function uses the ``stdarg.h'' \textit{va} functions to step portably through the arguments to the function. A count -$n$ of succesfully initialized mp\_int structures is maintained (line @47,n++@) such that if a failure does occur, -the algorithm can backtrack and free the previously initialized structures (lines @27,if@ to @46,}@). - - -\subsection{Clamping Excess Digits} -When a function anticipates a result will be $n$ digits it is simpler to assume this is true within the body of -the function instead of checking during the computation. For example, a multiplication of a $i$ digit number by a -$j$ digit produces a result of at most $i + j$ digits. It is entirely possible that the result is $i + j - 1$ -though, with no final carry into the last position. However, suppose the destination had to be first expanded -(\textit{via mp\_grow}) to accomodate $i + j - 1$ digits than further expanded to accomodate the final carry. -That would be a considerable waste of time since heap operations are relatively slow. - -The ideal solution is to always assume the result is $i + j$ and fix up the \textbf{used} count after the function -terminates. This way a single heap operation (\textit{at most}) is required. However, if the result was not checked -there would be an excess high order zero digit. - -For example, suppose the product of two integers was $x_n = (0x_{n-1}x_{n-2}...x_0)_{\beta}$. The leading zero digit -will not contribute to the precision of the result. In fact, through subsequent operations more leading zero digits would -accumulate to the point the size of the integer would be prohibitive. As a result even though the precision is very -low the representation is excessively large. - -The mp\_clamp algorithm is designed to solve this very problem. It will trim high-order zeros by decrementing the -\textbf{used} count until a non-zero most significant digit is found. Also in this system, zero is considered to be a -positive number which means that if the \textbf{used} count is decremented to zero, the sign must be set to -\textbf{MP\_ZPOS}. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clamp}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Any excess leading zero digits of $a$ are removed \\ -\hline \\ -1. while $a.used > 0$ and $a_{a.used - 1} = 0$ do \\ -\hspace{+3mm}1.1 $a.used \leftarrow a.used - 1$ \\ -2. if $a.used = 0$ then do \\ -\hspace{+3mm}2.1 $a.sign \leftarrow MP\_ZPOS$ \\ -\hline \\ -\end{tabular} -\end{center} -\caption{Algorithm mp\_clamp} -\end{figure} - -\textbf{Algorithm mp\_clamp.} -As can be expected this algorithm is very simple. The loop on step one is expected to iterate only once or twice at -the most. For example, this will happen in cases where there is not a carry to fill the last position. Step two fixes the sign for -when all of the digits are zero to ensure that the mp\_int is valid at all times. - -EXAM,bn_mp_clamp.c - -Note on line @27,while@ how to test for the \textbf{used} count is made on the left of the \&\& operator. In the C programming -language the terms to \&\& are evaluated left to right with a boolean short-circuit if any condition fails. This is -important since if the \textbf{used} is zero the test on the right would fetch below the array. That is obviously -undesirable. The parenthesis on line @28,a->used@ is used to make sure the \textbf{used} count is decremented and not -the pointer ``a''. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 1 \right ]$ & Discuss the relevance of the \textbf{used} member of the mp\_int structure. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the consequences of not using padding when performing allocations. \\ - & \\ -$\left [ 2 \right ]$ & Estimate an ideal value for \textbf{MP\_PREC} when performing 1024-bit RSA \\ - & encryption when $\beta = 2^{28}$. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the relevance of the algorithm mp\_clamp. What does it prevent? \\ - & \\ -$\left [ 1 \right ]$ & Give an example of when the algorithm mp\_init\_copy might be useful. \\ - & \\ -\end{tabular} - - -%%% -% CHAPTER FOUR -%%% - -\chapter{Basic Operations} - -\section{Introduction} -In the previous chapter a series of low level algorithms were established that dealt with initializing and maintaining -mp\_int structures. This chapter will discuss another set of seemingly non-algebraic algorithms which will form the low -level basis of the entire library. While these algorithm are relatively trivial it is important to understand how they -work before proceeding since these algorithms will be used almost intrinsically in the following chapters. - -The algorithms in this chapter deal primarily with more ``programmer'' related tasks such as creating copies of -mp\_int structures, assigning small values to mp\_int structures and comparisons of the values mp\_int structures -represent. - -\section{Assigning Values to mp\_int Structures} -\subsection{Copying an mp\_int} -Assigning the value that a given mp\_int structure represents to another mp\_int structure shall be known as making -a copy for the purposes of this text. The copy of the mp\_int will be a separate entity that represents the same -value as the mp\_int it was copied from. The mp\_copy algorithm provides this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$. \\ -\textbf{Output}. Store a copy of $a$ in $b$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to $a.used$ digits. (\textit{mp\_grow}) \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $b_{n} \leftarrow a_{n}$ \\ -3. for $n$ from $a.used$ to $b.used - 1$ do \\ -\hspace{3mm}3.1 $b_{n} \leftarrow 0$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $b.sign \leftarrow a.sign$ \\ -6. return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_copy} -\end{figure} - -\textbf{Algorithm mp\_copy.} -This algorithm copies the mp\_int $a$ such that upon succesful termination of the algorithm the mp\_int $b$ will -represent the same integer as the mp\_int $a$. The mp\_int $b$ shall be a complete and distinct copy of the -mp\_int $a$ meaing that the mp\_int $a$ can be modified and it shall not affect the value of the mp\_int $b$. - -If $b$ does not have enough room for the digits of $a$ it must first have its precision augmented via the mp\_grow -algorithm. The digits of $a$ are copied over the digits of $b$ and any excess digits of $b$ are set to zero (step two -and three). The \textbf{used} and \textbf{sign} members of $a$ are finally copied over the respective members of -$b$. - -\textbf{Remark.} This algorithm also introduces a new idiosyncrasy that will be used throughout the rest of the -text. The error return codes of other algorithms are not explicitly checked in the pseudo-code presented. For example, in -step one of the mp\_copy algorithm the return of mp\_grow is not explicitly checked to ensure it succeeded. Text space is -limited so it is assumed that if a algorithm fails it will clear all temporarily allocated mp\_ints and return -the error code itself. However, the C code presented will demonstrate all of the error handling logic required to -implement the pseudo-code. - -EXAM,bn_mp_copy.c - -Occasionally a dependent algorithm may copy an mp\_int effectively into itself such as when the input and output -mp\_int structures passed to a function are one and the same. For this case it is optimal to return immediately without -copying digits (line @24,a == b@). - -The mp\_int $b$ must have enough digits to accomodate the used digits of the mp\_int $a$. If $b.alloc$ is less than -$a.used$ the algorithm mp\_grow is used to augment the precision of $b$ (lines @29,alloc@ to @33,}@). In order to -simplify the inner loop that copies the digits from $a$ to $b$, two aliases $tmpa$ and $tmpb$ point directly at the digits -of the mp\_ints $a$ and $b$ respectively. These aliases (lines @42,tmpa@ and @45,tmpb@) allow the compiler to access the digits without first dereferencing the -mp\_int pointers and then subsequently the pointer to the digits. - -After the aliases are established the digits from $a$ are copied into $b$ (lines @48,for@ to @50,}@) and then the excess -digits of $b$ are set to zero (lines @53,for@ to @55,}@). Both ``for'' loops make use of the pointer aliases and in -fact the alias for $b$ is carried through into the second ``for'' loop to clear the excess digits. This optimization -allows the alias to stay in a machine register fairly easy between the two loops. - -\textbf{Remarks.} The use of pointer aliases is an implementation methodology first introduced in this function that will -be used considerably in other functions. Technically, a pointer alias is simply a short hand alias used to lower the -number of pointer dereferencing operations required to access data. For example, a for loop may resemble - -\begin{alltt} -for (x = 0; x < 100; x++) \{ - a->num[4]->dp[x] = 0; -\} -\end{alltt} - -This could be re-written using aliases as - -\begin{alltt} -mp_digit *tmpa; -a = a->num[4]->dp; -for (x = 0; x < 100; x++) \{ - *a++ = 0; -\} -\end{alltt} - -In this case an alias is used to access the -array of digits within an mp\_int structure directly. It may seem that a pointer alias is strictly not required -as a compiler may optimize out the redundant pointer operations. However, there are two dominant reasons to use aliases. - -The first reason is that most compilers will not effectively optimize pointer arithmetic. For example, some optimizations -may work for the Microsoft Visual C++ compiler (MSVC) and not for the GNU C Compiler (GCC). Also some optimizations may -work for GCC and not MSVC. As such it is ideal to find a common ground for as many compilers as possible. Pointer -aliases optimize the code considerably before the compiler even reads the source code which means the end compiled code -stands a better chance of being faster. - -The second reason is that pointer aliases often can make an algorithm simpler to read. Consider the first ``for'' -loop of the function mp\_copy() re-written to not use pointer aliases. - -\begin{alltt} - /* copy all the digits */ - for (n = 0; n < a->used; n++) \{ - b->dp[n] = a->dp[n]; - \} -\end{alltt} - -Whether this code is harder to read depends strongly on the individual. However, it is quantifiably slightly more -complicated as there are four variables within the statement instead of just two. - -\subsubsection{Nested Statements} -Another commonly used technique in the source routines is that certain sections of code are nested. This is used in -particular with the pointer aliases to highlight code phases. For example, a Comba multiplier (discussed in chapter six) -will typically have three different phases. First the temporaries are initialized, then the columns calculated and -finally the carries are propagated. In this example the middle column production phase will typically be nested as it -uses temporary variables and aliases the most. - -The nesting also simplies the source code as variables that are nested are only valid for their scope. As a result -the various temporary variables required do not propagate into other sections of code. - - -\subsection{Creating a Clone} -Another common operation is to make a local temporary copy of an mp\_int argument. To initialize an mp\_int -and then copy another existing mp\_int into the newly intialized mp\_int will be known as creating a clone. This is -useful within functions that need to modify an argument but do not wish to actually modify the original copy. The -mp\_init\_copy algorithm has been designed to help perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$\\ -\textbf{Output}. $a$ is initialized to be a copy of $b$. \\ -\hline \\ -1. Init $a$. (\textit{mp\_init}) \\ -2. Copy $b$ to $a$. (\textit{mp\_copy}) \\ -3. Return the status of the copy operation. \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_copy} -\end{figure} - -\textbf{Algorithm mp\_init\_copy.} -This algorithm will initialize an mp\_int variable and copy another previously initialized mp\_int variable into it. As -such this algorithm will perform two operations in one step. - -EXAM,bn_mp_init_copy.c - -This will initialize \textbf{a} and make it a verbatim copy of the contents of \textbf{b}. Note that -\textbf{a} will have its own memory allocated which means that \textbf{b} may be cleared after the call -and \textbf{a} will be left intact. - -\section{Zeroing an Integer} -Reseting an mp\_int to the default state is a common step in many algorithms. The mp\_zero algorithm will be the algorithm used to -perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_zero}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Zero the contents of $a$ \\ -\hline \\ -1. $a.used \leftarrow 0$ \\ -2. $a.sign \leftarrow$ MP\_ZPOS \\ -3. for $n$ from 0 to $a.alloc - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_zero} -\end{figure} - -\textbf{Algorithm mp\_zero.} -This algorithm simply resets a mp\_int to the default state. - -EXAM,bn_mp_zero.c - -After the function is completed, all of the digits are zeroed, the \textbf{used} count is zeroed and the -\textbf{sign} variable is set to \textbf{MP\_ZPOS}. - -\section{Sign Manipulation} -\subsection{Absolute Value} -With the mp\_int representation of an integer, calculating the absolute value is trivial. The mp\_abs algorithm will compute -the absolute value of an mp\_int. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_abs}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = \vert a \vert$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. $b.sign \leftarrow MP\_ZPOS$ \\ -4. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_abs} -\end{figure} - -\textbf{Algorithm mp\_abs.} -This algorithm computes the absolute of an mp\_int input. First it copies $a$ over $b$. This is an example of an -algorithm where the check in mp\_copy that determines if the source and destination are equal proves useful. This allows, -for instance, the developer to pass the same mp\_int as the source and destination to this function without addition -logic to handle it. - -EXAM,bn_mp_abs.c - -This fairly trivial algorithm first eliminates non--required duplications (line @27,a != b@) and then sets the -\textbf{sign} flag to \textbf{MP\_ZPOS}. - -\subsection{Integer Negation} -With the mp\_int representation of an integer, calculating the negation is also trivial. The mp\_neg algorithm will compute -the negative of an mp\_int input. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_neg}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = -a$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. If $a.used = 0$ then return(\textit{MP\_OKAY}). \\ -4. If $a.sign = MP\_ZPOS$ then do \\ -\hspace{3mm}4.1 $b.sign = MP\_NEG$. \\ -5. else do \\ -\hspace{3mm}5.1 $b.sign = MP\_ZPOS$. \\ -6. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_neg} -\end{figure} - -\textbf{Algorithm mp\_neg.} -This algorithm computes the negation of an input. First it copies $a$ over $b$. If $a$ has no used digits then -the algorithm returns immediately. Otherwise it flips the sign flag and stores the result in $b$. Note that if -$a$ had no digits then it must be positive by definition. Had step three been omitted then the algorithm would return -zero as negative. - -EXAM,bn_mp_neg.c - -Like mp\_abs() this function avoids non--required duplications (line @21,a != b@) and then sets the sign. We -have to make sure that only non--zero values get a \textbf{sign} of \textbf{MP\_NEG}. If the mp\_int is zero -than the \textbf{sign} is hard--coded to \textbf{MP\_ZPOS}. - -\section{Small Constants} -\subsection{Setting Small Constants} -Often a mp\_int must be set to a relatively small value such as $1$ or $2$. For these cases the mp\_set algorithm is useful. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set}. \\ -\textbf{Input}. An mp\_int $a$ and a digit $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}). \\ -2. $a_0 \leftarrow b \mbox{ (mod }\beta\mbox{)}$ \\ -3. $a.used \leftarrow \left \lbrace \begin{array}{ll} - 1 & \mbox{if }a_0 > 0 \\ - 0 & \mbox{if }a_0 = 0 - \end{array} \right .$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set} -\end{figure} - -\textbf{Algorithm mp\_set.} -This algorithm sets a mp\_int to a small single digit value. Step number 1 ensures that the integer is reset to the default state. The -single digit is set (\textit{modulo $\beta$}) and the \textbf{used} count is adjusted accordingly. - -EXAM,bn_mp_set.c - -First we zero (line @21,mp_zero@) the mp\_int to make sure that the other members are initialized for a -small positive constant. mp\_zero() ensures that the \textbf{sign} is positive and the \textbf{used} count -is zero. Next we set the digit and reduce it modulo $\beta$ (line @22,MP_MASK@). After this step we have to -check if the resulting digit is zero or not. If it is not then we set the \textbf{used} count to one, otherwise -to zero. - -We can quickly reduce modulo $\beta$ since it is of the form $2^k$ and a quick binary AND operation with -$2^k - 1$ will perform the same operation. - -One important limitation of this function is that it will only set one digit. The size of a digit is not fixed, meaning source that uses -this function should take that into account. Only trivially small constants can be set using this function. - -\subsection{Setting Large Constants} -To overcome the limitations of the mp\_set algorithm the mp\_set\_int algorithm is ideal. It accepts a ``long'' -data type as input and will always treat it as a 32-bit integer. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set\_int}. \\ -\textbf{Input}. An mp\_int $a$ and a ``long'' integer $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}) \\ -2. for $n$ from 0 to 7 do \\ -\hspace{3mm}2.1 $a \leftarrow a \cdot 16$ (\textit{mp\_mul2d}) \\ -\hspace{3mm}2.2 $u \leftarrow \lfloor b / 2^{4(7 - n)} \rfloor \mbox{ (mod }16\mbox{)}$\\ -\hspace{3mm}2.3 $a_0 \leftarrow a_0 + u$ \\ -\hspace{3mm}2.4 $a.used \leftarrow a.used + 1$ \\ -3. Clamp excess used digits (\textit{mp\_clamp}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set\_int} -\end{figure} - -\textbf{Algorithm mp\_set\_int.} -The algorithm performs eight iterations of a simple loop where in each iteration four bits from the source are added to the -mp\_int. Step 2.1 will multiply the current result by sixteen making room for four more bits in the less significant positions. In step 2.2 the -next four bits from the source are extracted and are added to the mp\_int. The \textbf{used} digit count is -incremented to reflect the addition. The \textbf{used} digit counter is incremented since if any of the leading digits were zero the mp\_int would have -zero digits used and the newly added four bits would be ignored. - -Excess zero digits are trimmed in steps 2.1 and 3 by using higher level algorithms mp\_mul2d and mp\_clamp. - -EXAM,bn_mp_set_int.c - -This function sets four bits of the number at a time to handle all practical \textbf{DIGIT\_BIT} sizes. The weird -addition on line @38,a->used@ ensures that the newly added in bits are added to the number of digits. While it may not -seem obvious as to why the digit counter does not grow exceedingly large it is because of the shift on line @27,mp_mul_2d@ -as well as the call to mp\_clamp() on line @40,mp_clamp@. Both functions will clamp excess leading digits which keeps -the number of used digits low. - -\section{Comparisons} -\subsection{Unsigned Comparisions} -Comparing a multiple precision integer is performed with the exact same algorithm used to compare two decimal numbers. For example, -to compare $1,234$ to $1,264$ the digits are extracted by their positions. That is we compare $1 \cdot 10^3 + 2 \cdot 10^2 + 3 \cdot 10^1 + 4 \cdot 10^0$ -to $1 \cdot 10^3 + 2 \cdot 10^2 + 6 \cdot 10^1 + 4 \cdot 10^0$ by comparing single digits at a time starting with the highest magnitude -positions. If any leading digit of one integer is greater than a digit in the same position of another integer then obviously it must be greater. - -The first comparision routine that will be developed is the unsigned magnitude compare which will perform a comparison based on the digits of two -mp\_int variables alone. It will ignore the sign of the two inputs. Such a function is useful when an absolute comparison is required or if the -signs are known to agree in advance. - -To facilitate working with the results of the comparison functions three constants are required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|r|l|} -\hline \textbf{Constant} & \textbf{Meaning} \\ -\hline \textbf{MP\_GT} & Greater Than \\ -\hline \textbf{MP\_EQ} & Equal To \\ -\hline \textbf{MP\_LT} & Less Than \\ -\hline -\end{tabular} -\end{center} -\caption{Comparison Return Codes} -\end{figure} - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp\_mag}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$. \\ -\textbf{Output}. Unsigned comparison results ($a$ to the left of $b$). \\ -\hline \\ -1. If $a.used > b.used$ then return(\textit{MP\_GT}) \\ -2. If $a.used < b.used$ then return(\textit{MP\_LT}) \\ -3. for n from $a.used - 1$ to 0 do \\ -\hspace{+3mm}3.1 if $a_n > b_n$ then return(\textit{MP\_GT}) \\ -\hspace{+3mm}3.2 if $a_n < b_n$ then return(\textit{MP\_LT}) \\ -4. Return(\textit{MP\_EQ}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp\_mag} -\end{figure} - -\textbf{Algorithm mp\_cmp\_mag.} -By saying ``$a$ to the left of $b$'' it is meant that the comparison is with respect to $a$, that is if $a$ is greater than $b$ it will return -\textbf{MP\_GT} and similar with respect to when $a = b$ and $a < b$. The first two steps compare the number of digits used in both $a$ and $b$. -Obviously if the digit counts differ there would be an imaginary zero digit in the smaller number where the leading digit of the larger number is. -If both have the same number of digits than the actual digits themselves must be compared starting at the leading digit. - -By step three both inputs must have the same number of digits so its safe to start from either $a.used - 1$ or $b.used - 1$ and count down to -the zero'th digit. If after all of the digits have been compared, no difference is found, the algorithm returns \textbf{MP\_EQ}. - -EXAM,bn_mp_cmp_mag.c - -The two if statements (lines @24,if@ and @28,if@) compare the number of digits in the two inputs. These two are -performed before all of the digits are compared since it is a very cheap test to perform and can potentially save -considerable time. The implementation given is also not valid without those two statements. $b.alloc$ may be -smaller than $a.used$, meaning that undefined values will be read from $b$ past the end of the array of digits. - - - -\subsection{Signed Comparisons} -Comparing with sign considerations is also fairly critical in several routines (\textit{division for example}). Based on an unsigned magnitude -comparison a trivial signed comparison algorithm can be written. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. Signed Comparison Results ($a$ to the left of $b$) \\ -\hline \\ -1. if $a.sign = MP\_NEG$ and $b.sign = MP\_ZPOS$ then return(\textit{MP\_LT}) \\ -2. if $a.sign = MP\_ZPOS$ and $b.sign = MP\_NEG$ then return(\textit{MP\_GT}) \\ -3. if $a.sign = MP\_NEG$ then \\ -\hspace{+3mm}3.1 Return the unsigned comparison of $b$ and $a$ (\textit{mp\_cmp\_mag}) \\ -4 Otherwise \\ -\hspace{+3mm}4.1 Return the unsigned comparison of $a$ and $b$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp} -\end{figure} - -\textbf{Algorithm mp\_cmp.} -The first two steps compare the signs of the two inputs. If the signs do not agree then it can return right away with the appropriate -comparison code. When the signs are equal the digits of the inputs must be compared to determine the correct result. In step -three the unsigned comparision flips the order of the arguments since they are both negative. For instance, if $-a > -b$ then -$\vert a \vert < \vert b \vert$. Step number four will compare the two when they are both positive. - -EXAM,bn_mp_cmp.c - -The two if statements (lines @22,if@ and @26,if@) perform the initial sign comparison. If the signs are not the equal then which ever -has the positive sign is larger. The inputs are compared (line @30,if@) based on magnitudes. If the signs were both -negative then the unsigned comparison is performed in the opposite direction (line @31,mp_cmp_mag@). Otherwise, the signs are assumed to -be both positive and a forward direction unsigned comparison is performed. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 2 \right ]$ & Modify algorithm mp\_set\_int to accept as input a variable length array of bits. \\ - & \\ -$\left [ 3 \right ]$ & Give the probability that algorithm mp\_cmp\_mag will have to compare $k$ digits \\ - & of two random digits (of equal magnitude) before a difference is found. \\ - & \\ -$\left [ 1 \right ]$ & Suggest a simple method to speed up the implementation of mp\_cmp\_mag based \\ - & on the observations made in the previous problem. \\ - & -\end{tabular} - -\chapter{Basic Arithmetic} -\section{Introduction} -At this point algorithms for initialization, clearing, zeroing, copying, comparing and setting small constants have been -established. The next logical set of algorithms to develop are addition, subtraction and digit shifting algorithms. These -algorithms make use of the lower level algorithms and are the cruicial building block for the multiplication algorithms. It is very important -that these algorithms are highly optimized. On their own they are simple $O(n)$ algorithms but they can be called from higher level algorithms -which easily places them at $O(n^2)$ or even $O(n^3)$ work levels. - -MARK,SHIFTS -All of the algorithms within this chapter make use of the logical bit shift operations denoted by $<<$ and $>>$ for left and right -logical shifts respectively. A logical shift is analogous to sliding the decimal point of radix-10 representations. For example, the real -number $0.9345$ is equivalent to $93.45\%$ which is found by sliding the the decimal two places to the right (\textit{multiplying by $\beta^2 = 10^2$}). -Algebraically a binary logical shift is equivalent to a division or multiplication by a power of two. -For example, $a << k = a \cdot 2^k$ while $a >> k = \lfloor a/2^k \rfloor$. - -One significant difference between a logical shift and the way decimals are shifted is that digits below the zero'th position are removed -from the number. For example, consider $1101_2 >> 1$ using decimal notation this would produce $110.1_2$. However, with a logical shift the -result is $110_2$. - -\section{Addition and Subtraction} -In common twos complement fixed precision arithmetic negative numbers are easily represented by subtraction from the modulus. For example, with 32-bit integers -$a - b\mbox{ (mod }2^{32}\mbox{)}$ is the same as $a + (2^{32} - b) \mbox{ (mod }2^{32}\mbox{)}$ since $2^{32} \equiv 0 \mbox{ (mod }2^{32}\mbox{)}$. -As a result subtraction can be performed with a trivial series of logical operations and an addition. - -However, in multiple precision arithmetic negative numbers are not represented in the same way. Instead a sign flag is used to keep track of the -sign of the integer. As a result signed addition and subtraction are actually implemented as conditional usage of lower level addition or -subtraction algorithms with the sign fixed up appropriately. - -The lower level algorithms will add or subtract integers without regard to the sign flag. That is they will add or subtract the magnitude of -the integers respectively. - -\subsection{Low Level Addition} -An unsigned addition of multiple precision integers is performed with the same long-hand algorithm used to add decimal numbers. That is to add the -trailing digits first and propagate the resulting carry upwards. Since this is a lower level algorithm the name will have a ``s\_'' prefix. -Historically that convention stems from the MPI library where ``s\_'' stood for static functions that were hidden from the developer entirely. - -\newpage -\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The unsigned addition $c = \vert a \vert + \vert b \vert$. \\ -\hline \\ -1. if $a.used > b.used$ then \\ -\hspace{+3mm}1.1 $min \leftarrow b.used$ \\ -\hspace{+3mm}1.2 $max \leftarrow a.used$ \\ -\hspace{+3mm}1.3 $x \leftarrow a$ \\ -2. else \\ -\hspace{+3mm}2.1 $min \leftarrow a.used$ \\ -\hspace{+3mm}2.2 $max \leftarrow b.used$ \\ -\hspace{+3mm}2.3 $x \leftarrow b$ \\ -3. If $c.alloc < max + 1$ then grow $c$ to hold at least $max + 1$ digits (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max + 1$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{+3mm}7.1 $c_n \leftarrow a_n + b_n + u$ \\ -\hspace{+3mm}7.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min \ne max$ then do \\ -\hspace{+3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{+6mm}8.1.1 $c_n \leftarrow x_n + u$ \\ -\hspace{+6mm}8.1.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. $c_{max} \leftarrow u$ \\ -10. if $olduse > max$ then \\ -\hspace{+3mm}10.1 for $n$ from $max + 1$ to $oldused - 1$ do \\ -\hspace{+6mm}10.1.1 $c_n \leftarrow 0$ \\ -11. Clamp excess digits in $c$. (\textit{mp\_clamp}) \\ -12. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_add} -\end{figure} - -\textbf{Algorithm s\_mp\_add.} -This algorithm is loosely based on algorithm 14.7 of HAC \cite[pp. 594]{HAC} but has been extended to allow the inputs to have different magnitudes. -Coincidentally the description of algorithm A in Knuth \cite[pp. 266]{TAOCPV2} shares the same deficiency as the algorithm from \cite{HAC}. Even the -MIX pseudo machine code presented by Knuth \cite[pp. 266-267]{TAOCPV2} is incapable of handling inputs which are of different magnitudes. - -The first thing that has to be accomplished is to sort out which of the two inputs is the largest. The addition logic -will simply add all of the smallest input to the largest input and store that first part of the result in the -destination. Then it will apply a simpler addition loop to excess digits of the larger input. - -The first two steps will handle sorting the inputs such that $min$ and $max$ hold the digit counts of the two -inputs. The variable $x$ will be an mp\_int alias for the largest input or the second input $b$ if they have the -same number of digits. After the inputs are sorted the destination $c$ is grown as required to accomodate the sum -of the two inputs. The original \textbf{used} count of $c$ is copied and set to the new used count. - -At this point the first addition loop will go through as many digit positions that both inputs have. The carry -variable $\mu$ is set to zero outside the loop. Inside the loop an ``addition'' step requires three statements to produce -one digit of the summand. First -two digits from $a$ and $b$ are added together along with the carry $\mu$. The carry of this step is extracted and stored -in $\mu$ and finally the digit of the result $c_n$ is truncated within the range $0 \le c_n < \beta$. - -Now all of the digit positions that both inputs have in common have been exhausted. If $min \ne max$ then $x$ is an alias -for one of the inputs that has more digits. A simplified addition loop is then used to essentially copy the remaining digits -and the carry to the destination. - -The final carry is stored in $c_{max}$ and digits above $max$ upto $oldused$ are zeroed which completes the addition. - - -EXAM,bn_s_mp_add.c - -We first sort (lines @27,if@ to @35,}@) the inputs based on magnitude and determine the $min$ and $max$ variables. -Note that $x$ is a pointer to an mp\_int assigned to the largest input, in effect it is a local alias. Next we -grow the destination (@37,init@ to @42,}@) ensure that it can accomodate the result of the addition. - -Similar to the implementation of mp\_copy this function uses the braced code and local aliases coding style. The three aliases that are on -lines @56,tmpa@, @59,tmpb@ and @62,tmpc@ represent the two inputs and destination variables respectively. These aliases are used to ensure the -compiler does not have to dereference $a$, $b$ or $c$ (respectively) to access the digits of the respective mp\_int. - -The initial carry $u$ will be cleared (line @65,u = 0@), note that $u$ is of type mp\_digit which ensures type -compatibility within the implementation. The initial addition (line @66,for@ to @75,}@) adds digits from -both inputs until the smallest input runs out of digits. Similarly the conditional addition loop -(line @81,for@ to @90,}@) adds the remaining digits from the larger of the two inputs. The addition is finished -with the final carry being stored in $tmpc$ (line @94,tmpc++@). Note the ``++'' operator within the same expression. -After line @94,tmpc++@, $tmpc$ will point to the $c.used$'th digit of the mp\_int $c$. This is useful -for the next loop (line @97,for@ to @99,}@) which set any old upper digits to zero. - -\subsection{Low Level Subtraction} -The low level unsigned subtraction algorithm is very similar to the low level unsigned addition algorithm. The principle difference is that the -unsigned subtraction algorithm requires the result to be positive. That is when computing $a - b$ the condition $\vert a \vert \ge \vert b\vert$ must -be met for this algorithm to function properly. Keep in mind this low level algorithm is not meant to be used in higher level algorithms directly. -This algorithm as will be shown can be used to create functional signed addition and subtraction algorithms. - -MARK,GAMMA - -For this algorithm a new variable is required to make the description simpler. Recall from section 1.3.1 that a mp\_digit must be able to represent -the range $0 \le x < 2\beta$ for the algorithms to work correctly. However, it is allowable that a mp\_digit represent a larger range of values. For -this algorithm we will assume that the variable $\gamma$ represents the number of bits available in a -mp\_digit (\textit{this implies $2^{\gamma} > \beta$}). - -For example, the default for LibTomMath is to use a ``unsigned long'' for the mp\_digit ``type'' while $\beta = 2^{28}$. In ISO C an ``unsigned long'' -data type must be able to represent $0 \le x < 2^{32}$ meaning that in this case $\gamma \ge 32$. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ ($\vert a \vert \ge \vert b \vert$) \\ -\textbf{Output}. The unsigned subtraction $c = \vert a \vert - \vert b \vert$. \\ -\hline \\ -1. $min \leftarrow b.used$ \\ -2. $max \leftarrow a.used$ \\ -3. If $c.alloc < max$ then grow $c$ to hold at least $max$ digits. (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{3mm}7.1 $c_n \leftarrow a_n - b_n - u$ \\ -\hspace{3mm}7.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min < max$ then do \\ -\hspace{3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{6mm}8.1.1 $c_n \leftarrow a_n - u$ \\ -\hspace{6mm}8.1.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. if $oldused > max$ then do \\ -\hspace{3mm}9.1 for $n$ from $max$ to $oldused - 1$ do \\ -\hspace{6mm}9.1.1 $c_n \leftarrow 0$ \\ -10. Clamp excess digits of $c$. (\textit{mp\_clamp}). \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_sub} -\end{figure} - -\textbf{Algorithm s\_mp\_sub.} -This algorithm performs the unsigned subtraction of two mp\_int variables under the restriction that the result must be positive. That is when -passing variables $a$ and $b$ the condition that $\vert a \vert \ge \vert b \vert$ must be met for the algorithm to function correctly. This -algorithm is loosely based on algorithm 14.9 \cite[pp. 595]{HAC} and is similar to algorithm S in \cite[pp. 267]{TAOCPV2} as well. As was the case -of the algorithm s\_mp\_add both other references lack discussion concerning various practical details such as when the inputs differ in magnitude. - -The initial sorting of the inputs is trivial in this algorithm since $a$ is guaranteed to have at least the same magnitude of $b$. Steps 1 and 2 -set the $min$ and $max$ variables. Unlike the addition routine there is guaranteed to be no carry which means that the final result can be at -most $max$ digits in length as opposed to $max + 1$. Similar to the addition algorithm the \textbf{used} count of $c$ is copied locally and -set to the maximal count for the operation. - -The subtraction loop that begins on step seven is essentially the same as the addition loop of algorithm s\_mp\_add except single precision -subtraction is used instead. Note the use of the $\gamma$ variable to extract the carry (\textit{also known as the borrow}) within the subtraction -loops. Under the assumption that two's complement single precision arithmetic is used this will successfully extract the desired carry. - -For example, consider subtracting $0101_2$ from $0100_2$ where $\gamma = 4$ and $\beta = 2$. The least significant bit will force a carry upwards to -the third bit which will be set to zero after the borrow. After the very first bit has been subtracted $4 - 1 \equiv 0011_2$ will remain, When the -third bit of $0101_2$ is subtracted from the result it will cause another carry. In this case though the carry will be forced to propagate all the -way to the most significant bit. - -Recall that $\beta < 2^{\gamma}$. This means that if a carry does occur just before the $lg(\beta)$'th bit it will propagate all the way to the most -significant bit. Thus, the high order bits of the mp\_digit that are not part of the actual digit will either be all zero, or all one. All that -is needed is a single zero or one bit for the carry. Therefore a single logical shift right by $\gamma - 1$ positions is sufficient to extract the -carry. This method of carry extraction may seem awkward but the reason for it becomes apparent when the implementation is discussed. - -If $b$ has a smaller magnitude than $a$ then step 9 will force the carry and copy operation to propagate through the larger input $a$ into $c$. Step -10 will ensure that any leading digits of $c$ above the $max$'th position are zeroed. - -EXAM,bn_s_mp_sub.c - -Like low level addition we ``sort'' the inputs. Except in this case the sorting is hardcoded -(lines @24,min@ and @25,max@). In reality the $min$ and $max$ variables are only aliases and are only -used to make the source code easier to read. Again the pointer alias optimization is used -within this algorithm. The aliases $tmpa$, $tmpb$ and $tmpc$ are initialized -(lines @42,tmpa@, @43,tmpb@ and @44,tmpc@) for $a$, $b$ and $c$ respectively. - -The first subtraction loop (lines @47,u = 0@ through @61,}@) subtract digits from both inputs until the smaller of -the two inputs has been exhausted. As remarked earlier there is an implementation reason for using the ``awkward'' -method of extracting the carry (line @57, >>@). The traditional method for extracting the carry would be to shift -by $lg(\beta)$ positions and logically AND the least significant bit. The AND operation is required because all of -the bits above the $\lg(\beta)$'th bit will be set to one after a carry occurs from subtraction. This carry -extraction requires two relatively cheap operations to extract the carry. The other method is to simply shift the -most significant bit to the least significant bit thus extracting the carry with a single cheap operation. This -optimization only works on twos compliment machines which is a safe assumption to make. - -If $a$ has a larger magnitude than $b$ an additional loop (lines @64,for@ through @73,}@) is required to propagate -the carry through $a$ and copy the result to $c$. - -\subsection{High Level Addition} -Now that both lower level addition and subtraction algorithms have been established an effective high level signed addition algorithm can be -established. This high level addition algorithm will be what other algorithms and developers will use to perform addition of mp\_int data -types. - -Recall from section 5.2 that an mp\_int represents an integer with an unsigned mantissa (\textit{the array of digits}) and a \textbf{sign} -flag. A high level addition is actually performed as a series of eight separate cases which can be optimized down to three unique cases. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed addition $c = a + b$. \\ -\hline \\ -1. if $a.sign = b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add})\\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert < \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow b.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert b \vert - \vert a \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert a \vert - \vert b \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_add} -\end{figure} - -\textbf{Algorithm mp\_add.} -This algorithm performs the signed addition of two mp\_int variables. There is no reference algorithm to draw upon from -either \cite{TAOCPV2} or \cite{HAC} since they both only provide unsigned operations. The algorithm is fairly -straightforward but restricted since subtraction can only produce positive results. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert > \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&&\\ - -\hline $+$ & $-$ & No & $c = b - a$ & $b.sign$ \\ -\hline $-$ & $+$ & No & $c = b - a$ & $b.sign$ \\ - -\hline &&&&\\ - -\hline $+$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ - -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Addition Guide Chart} -\label{fig:AddChart} -\end{figure} - -Figure~\ref{fig:AddChart} lists all of the eight possible input combinations and is sorted to show that only three -specific cases need to be handled. The return code of the unsigned operations at step 1.2, 2.1.2 and 2.2.2 are -forwarded to step three to check for errors. This simplifies the description of the algorithm considerably and best -follows how the implementation actually was achieved. - -Also note how the \textbf{sign} is set before the unsigned addition or subtraction is performed. Recall from the descriptions of algorithms -s\_mp\_add and s\_mp\_sub that the mp\_clamp function is used at the end to trim excess digits. The mp\_clamp algorithm will set the \textbf{sign} -to \textbf{MP\_ZPOS} when the \textbf{used} digit count reaches zero. - -For example, consider performing $-a + a$ with algorithm mp\_add. By the description of the algorithm the sign is set to \textbf{MP\_NEG} which would -produce a result of $-0$. However, since the sign is set first then the unsigned addition is performed the subsequent usage of algorithm mp\_clamp -within algorithm s\_mp\_add will force $-0$ to become $0$. - -EXAM,bn_mp_add.c - -The source code follows the algorithm fairly closely. The most notable new source code addition is the usage of the $res$ integer variable which -is used to pass result of the unsigned operations forward. Unlike in the algorithm, the variable $res$ is merely returned as is without -explicitly checking it and returning the constant \textbf{MP\_OKAY}. The observation is this algorithm will succeed or fail only if the lower -level functions do so. Returning their return code is sufficient. - -\subsection{High Level Subtraction} -The high level signed subtraction algorithm is essentially the same as the high level signed addition algorithm. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed subtraction $c = a - b$. \\ -\hline \\ -1. if $a.sign \ne b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add}) \\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert \ge \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert a \vert - \vert b \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = MP\_NEG \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert b \vert - \vert a \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_sub} -\end{figure} - -\textbf{Algorithm mp\_sub.} -This algorithm performs the signed subtraction of two inputs. Similar to algorithm mp\_add there is no reference in either \cite{TAOCPV2} or -\cite{HAC}. Also this algorithm is restricted by algorithm s\_mp\_sub. Chart \ref{fig:SubChart} lists the eight possible inputs and -the operations required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert \ge \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline $-$ & $-$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Subtraction Guide Chart} -\label{fig:SubChart} -\end{figure} - -Similar to the case of algorithm mp\_add the \textbf{sign} is set first before the unsigned addition or subtraction. That is to prevent the -algorithm from producing $-a - -a = -0$ as a result. - -EXAM,bn_mp_sub.c - -Much like the implementation of algorithm mp\_add the variable $res$ is used to catch the return code of the unsigned addition or subtraction operations -and forward it to the end of the function. On line @38, != MP_LT@ the ``not equal to'' \textbf{MP\_LT} expression is used to emulate a -``greater than or equal to'' comparison. - -\section{Bit and Digit Shifting} -MARK,POLY -It is quite common to think of a multiple precision integer as a polynomial in $x$, that is $y = f(\beta)$ where $f(x) = \sum_{i=0}^{n-1} a_i x^i$. -This notation arises within discussion of Montgomery and Diminished Radix Reduction as well as Karatsuba multiplication and squaring. - -In order to facilitate operations on polynomials in $x$ as above a series of simple ``digit'' algorithms have to be established. That is to shift -the digits left or right as well to shift individual bits of the digits left and right. It is important to note that not all ``shift'' operations -are on radix-$\beta$ digits. - -\subsection{Multiplication by Two} - -In a binary system where the radix is a power of two multiplication by two not only arises often in other algorithms it is a fairly efficient -operation to perform. A single precision logical shift left is sufficient to multiply a single digit by two. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = 2a$. \\ -\hline \\ -1. If $b.alloc < a.used + 1$ then grow $b$ to hold $a.used + 1$ digits. (\textit{mp\_grow}) \\ -2. $oldused \leftarrow b.used$ \\ -3. $b.used \leftarrow a.used$ \\ -4. $r \leftarrow 0$ \\ -5. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}5.1 $rr \leftarrow a_n >> (lg(\beta) - 1)$ \\ -\hspace{3mm}5.2 $b_n \leftarrow (a_n << 1) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.3 $r \leftarrow rr$ \\ -6. If $r \ne 0$ then do \\ -\hspace{3mm}6.1 $b_{n + 1} \leftarrow r$ \\ -\hspace{3mm}6.2 $b.used \leftarrow b.used + 1$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2} -\end{figure} - -\textbf{Algorithm mp\_mul\_2.} -This algorithm will quickly multiply a mp\_int by two provided $\beta$ is a power of two. Neither \cite{TAOCPV2} nor \cite{HAC} describe such -an algorithm despite the fact it arises often in other algorithms. The algorithm is setup much like the lower level algorithm s\_mp\_add since -it is for all intents and purposes equivalent to the operation $b = \vert a \vert + \vert a \vert$. - -Step 1 and 2 grow the input as required to accomodate the maximum number of \textbf{used} digits in the result. The initial \textbf{used} count -is set to $a.used$ at step 4. Only if there is a final carry will the \textbf{used} count require adjustment. - -Step 6 is an optimization implementation of the addition loop for this specific case. That is since the two values being added together -are the same there is no need to perform two reads from the digits of $a$. Step 6.1 performs a single precision shift on the current digit $a_n$ to -obtain what will be the carry for the next iteration. Step 6.2 calculates the $n$'th digit of the result as single precision shift of $a_n$ plus -the previous carry. Recall from ~SHIFTS~ that $a_n << 1$ is equivalent to $a_n \cdot 2$. An iteration of the addition loop is finished with -forwarding the carry to the next iteration. - -Step 7 takes care of any final carry by setting the $a.used$'th digit of the result to the carry and augmenting the \textbf{used} count of $b$. -Step 8 clears any leading digits of $b$ in case it originally had a larger magnitude than $a$. - -EXAM,bn_mp_mul_2.c - -This implementation is essentially an optimized implementation of s\_mp\_add for the case of doubling an input. The only noteworthy difference -is the use of the logical shift operator on line @52,<<@ to perform a single precision doubling. - -\subsection{Division by Two} -A division by two can just as easily be accomplished with a logical shift right as multiplication by two can be with a logical shift left. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = a/2$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to hold $a.used$ digits. (\textit{mp\_grow}) \\ -2. If the reallocation failed return(\textit{MP\_MEM}). \\ -3. $oldused \leftarrow b.used$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $r \leftarrow 0$ \\ -6. for $n$ from $b.used - 1$ to $0$ do \\ -\hspace{3mm}6.1 $rr \leftarrow a_n \mbox{ (mod }2\mbox{)}$\\ -\hspace{3mm}6.2 $b_n \leftarrow (a_n >> 1) + (r << (lg(\beta) - 1)) \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}6.3 $r \leftarrow rr$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Clamp excess digits of $b$. (\textit{mp\_clamp}) \\ -10. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2} -\end{figure} - -\textbf{Algorithm mp\_div\_2.} -This algorithm will divide an mp\_int by two using logical shifts to the right. Like mp\_mul\_2 it uses a modified low level addition -core as the basis of the algorithm. Unlike mp\_mul\_2 the shift operations work from the leading digit to the trailing digit. The algorithm -could be written to work from the trailing digit to the leading digit however, it would have to stop one short of $a.used - 1$ digits to prevent -reading past the end of the array of digits. - -Essentially the loop at step 6 is similar to that of mp\_mul\_2 except the logical shifts go in the opposite direction and the carry is at the -least significant bit not the most significant bit. - -EXAM,bn_mp_div_2.c - -\section{Polynomial Basis Operations} -Recall from ~POLY~ that any integer can be represented as a polynomial in $x$ as $y = f(\beta)$. Such a representation is also known as -the polynomial basis \cite[pp. 48]{ROSE}. Given such a notation a multiplication or division by $x$ amounts to shifting whole digits a single -place. The need for such operations arises in several other higher level algorithms such as Barrett and Montgomery reduction, integer -division and Karatsuba multiplication. - -Converting from an array of digits to polynomial basis is very simple. Consider the integer $y \equiv (a_2, a_1, a_0)_{\beta}$ and recall that -$y = \sum_{i=0}^{2} a_i \beta^i$. Simply replace $\beta$ with $x$ and the expression is in polynomial basis. For example, $f(x) = 8x + 9$ is the -polynomial basis representation for $89$ using radix ten. That is, $f(10) = 8(10) + 9 = 89$. - -\subsection{Multiplication by $x$} - -Given a polynomial in $x$ such as $f(x) = a_n x^n + a_{n-1} x^{n-1} + ... + a_0$ multiplying by $x$ amounts to shifting the coefficients up one -degree. In this case $f(x) \cdot x = a_n x^{n+1} + a_{n-1} x^n + ... + a_0 x$. From a scalar basis point of view multiplying by $x$ is equivalent to -multiplying by the integer $\beta$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a \cdot \beta^b$ (equivalent to multiplication by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_OKAY}). \\ -2. If $a.alloc < a.used + b$ then grow $a$ to at least $a.used + b$ digits. (\textit{mp\_grow}). \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. $a.used \leftarrow a.used + b$ \\ -5. $i \leftarrow a.used - 1$ \\ -6. $j \leftarrow a.used - 1 - b$ \\ -7. for $n$ from $a.used - 1$ to $b$ do \\ -\hspace{3mm}7.1 $a_{i} \leftarrow a_{j}$ \\ -\hspace{3mm}7.2 $i \leftarrow i - 1$ \\ -\hspace{3mm}7.3 $j \leftarrow j - 1$ \\ -8. for $n$ from 0 to $b - 1$ do \\ -\hspace{3mm}8.1 $a_n \leftarrow 0$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lshd} -\end{figure} - -\textbf{Algorithm mp\_lshd.} -This algorithm multiplies an mp\_int by the $b$'th power of $x$. This is equivalent to multiplying by $\beta^b$. The algorithm differs -from the other algorithms presented so far as it performs the operation in place instead storing the result in a separate location. The -motivation behind this change is due to the way this function is typically used. Algorithms such as mp\_add store the result in an optionally -different third mp\_int because the original inputs are often still required. Algorithm mp\_lshd (\textit{and similarly algorithm mp\_rshd}) is -typically used on values where the original value is no longer required. The algorithm will return success immediately if -$b \le 0$ since the rest of algorithm is only valid when $b > 0$. - -First the destination $a$ is grown as required to accomodate the result. The counters $i$ and $j$ are used to form a \textit{sliding window} over -the digits of $a$ of length $b$. The head of the sliding window is at $i$ (\textit{the leading digit}) and the tail at $j$ (\textit{the trailing digit}). -The loop on step 7 copies the digit from the tail to the head. In each iteration the window is moved down one digit. The last loop on -step 8 sets the lower $b$ digits to zero. - -\newpage -FIGU,sliding_window,Sliding Window Movement - -EXAM,bn_mp_lshd.c - -The if statement (line @24,if@) ensures that the $b$ variable is greater than zero since we do not interpret negative -shift counts properly. The \textbf{used} count is incremented by $b$ before the copy loop begins. This elminates -the need for an additional variable in the for loop. The variable $top$ (line @42,top@) is an alias -for the leading digit while $bottom$ (line @45,bottom@) is an alias for the trailing edge. The aliases form a -window of exactly $b$ digits over the input. - -\subsection{Division by $x$} - -Division by powers of $x$ is easily achieved by shifting the digits right and removing any that will end up to the right of the zero'th digit. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a / \beta^b$ (Divide by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return. \\ -2. If $a.used \le b$ then do \\ -\hspace{3mm}2.1 Zero $a$. (\textit{mp\_zero}). \\ -\hspace{3mm}2.2 Return. \\ -3. $i \leftarrow 0$ \\ -4. $j \leftarrow b$ \\ -5. for $n$ from 0 to $a.used - b - 1$ do \\ -\hspace{3mm}5.1 $a_i \leftarrow a_j$ \\ -\hspace{3mm}5.2 $i \leftarrow i + 1$ \\ -\hspace{3mm}5.3 $j \leftarrow j + 1$ \\ -6. for $n$ from $a.used - b$ to $a.used - 1$ do \\ -\hspace{3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.used \leftarrow a.used - b$ \\ -8. Return. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rshd} -\end{figure} - -\textbf{Algorithm mp\_rshd.} -This algorithm divides the input in place by the $b$'th power of $x$. It is analogous to dividing by a $\beta^b$ but much quicker since -it does not require single precision division. This algorithm does not actually return an error code as it cannot fail. - -If the input $b$ is less than one the algorithm quickly returns without performing any work. If the \textbf{used} count is less than or equal -to the shift count $b$ then it will simply zero the input and return. - -After the trivial cases of inputs have been handled the sliding window is setup. Much like the case of algorithm mp\_lshd a sliding window that -is $b$ digits wide is used to copy the digits. Unlike mp\_lshd the window slides in the opposite direction from the trailing to the leading digit. -Also the digits are copied from the leading to the trailing edge. - -Once the window copy is complete the upper digits must be zeroed and the \textbf{used} count decremented. - -EXAM,bn_mp_rshd.c - -The only noteworthy element of this routine is the lack of a return type since it cannot fail. Like mp\_lshd() we -form a sliding window except we copy in the other direction. After the window (line @59,for (;@) we then zero -the upper digits of the input to make sure the result is correct. - -\section{Powers of Two} - -Now that algorithms for moving single bits as well as whole digits exist algorithms for moving the ``in between'' distances are required. For -example, to quickly multiply by $2^k$ for any $k$ without using a full multiplier algorithm would prove useful. Instead of performing single -shifts $k$ times to achieve a multiplication by $2^{\pm k}$ a mixture of whole digit shifting and partial digit shifting is employed. - -\subsection{Multiplication by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot 2^b$. \\ -\hline \\ -1. $c \leftarrow a$. (\textit{mp\_copy}) \\ -2. If $c.alloc < c.used + \lfloor b / lg(\beta) \rfloor + 2$ then grow $c$ accordingly. \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. If $b \ge lg(\beta)$ then \\ -\hspace{3mm}4.1 $c \leftarrow c \cdot \beta^{\lfloor b / lg(\beta) \rfloor}$ (\textit{mp\_lshd}). \\ -\hspace{3mm}4.2 If step 4.1 failed return(\textit{MP\_MEM}). \\ -5. $d \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $d \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^d$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $0$ to $c.used - 1$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n >> (lg(\beta) - d) \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n << d) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -\hspace{3mm}6.4 If $r > 0$ then do \\ -\hspace{6mm}6.4.1 $c_{c.used} \leftarrow r$ \\ -\hspace{6mm}6.4.2 $c.used \leftarrow c.used + 1$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2d} -\end{figure} - -\textbf{Algorithm mp\_mul\_2d.} -This algorithm multiplies $a$ by $2^b$ and stores the result in $c$. The algorithm uses algorithm mp\_lshd and a derivative of algorithm mp\_mul\_2 to -quickly compute the product. - -First the algorithm will multiply $a$ by $x^{\lfloor b / lg(\beta) \rfloor}$ which will ensure that the remainder multiplicand is less than -$\beta$. For example, if $b = 37$ and $\beta = 2^{28}$ then this step will multiply by $x$ leaving a multiplication by $2^{37 - 28} = 2^{9}$ -left. - -After the digits have been shifted appropriately at most $lg(\beta) - 1$ shifts are left to perform. Step 5 calculates the number of remaining shifts -required. If it is non-zero a modified shift loop is used to calculate the remaining product. -Essentially the loop is a generic version of algorithm mp\_mul\_2 designed to handle any shift count in the range $1 \le x < lg(\beta)$. The $mask$ -variable is used to extract the upper $d$ bits to form the carry for the next iteration. - -This algorithm is loosely measured as a $O(2n)$ algorithm which means that if the input is $n$-digits that it takes $2n$ ``time'' to -complete. It is possible to optimize this algorithm down to a $O(n)$ algorithm at a cost of making the algorithm slightly harder to follow. - -EXAM,bn_mp_mul_2d.c - -The shifting is performed in--place which means the first step (line @24,a != c@) is to copy the input to the -destination. We avoid calling mp\_copy() by making sure the mp\_ints are different. The destination then -has to be grown (line @31,grow@) to accomodate the result. - -If the shift count $b$ is larger than $lg(\beta)$ then a call to mp\_lshd() is used to handle all of the multiples -of $lg(\beta)$. Leaving only a remaining shift of $lg(\beta) - 1$ or fewer bits left. Inside the actual shift -loop (lines @45,if@ to @76,}@) we make use of pre--computed values $shift$ and $mask$. These are used to -extract the carry bit(s) to pass into the next iteration of the loop. The $r$ and $rr$ variables form a -chain between consecutive iterations to propagate the carry. - -\subsection{Division by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow \lfloor a / 2^b \rfloor, d \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}1.2 $d \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.3 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow a$ \\ -3. $d \leftarrow a \mbox{ (mod }2^b\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -4. If $b \ge lg(\beta)$ then do \\ -\hspace{3mm}4.1 $c \leftarrow \lfloor c/\beta^{\lfloor b/lg(\beta) \rfloor} \rfloor$ (\textit{mp\_rshd}). \\ -5. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $k \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^k$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $c.used - 1$ to $0$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n >> k) + (r << (lg(\beta) - k))$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -7. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2d} -\end{figure} - -\textbf{Algorithm mp\_div\_2d.} -This algorithm will divide an input $a$ by $2^b$ and produce the quotient and remainder. The algorithm is designed much like algorithm -mp\_mul\_2d by first using whole digit shifts then single precision shifts. This algorithm will also produce the remainder of the division -by using algorithm mp\_mod\_2d. - -EXAM,bn_mp_div_2d.c - -The implementation of algorithm mp\_div\_2d is slightly different than the algorithm specifies. The remainder $d$ may be optionally -ignored by passing \textbf{NULL} as the pointer to the mp\_int variable. The temporary mp\_int variable $t$ is used to hold the -result of the remainder operation until the end. This allows $d$ and $a$ to represent the same mp\_int without modifying $a$ before -the quotient is obtained. - -The remainder of the source code is essentially the same as the source code for mp\_mul\_2d. The only significant difference is -the direction of the shifts. - -\subsection{Remainder of Division by Power of Two} - -The last algorithm in the series of polynomial basis power of two algorithms is calculating the remainder of division by $2^b$. This -algorithm benefits from the fact that in twos complement arithmetic $a \mbox{ (mod }2^b\mbox{)}$ is the same as $a$ AND $2^b - 1$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mod\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b > a.used \cdot lg(\beta)$ then do \\ -\hspace{3mm}2.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}2.2 Return the result of step 2.1. \\ -3. $c \leftarrow a$ \\ -4. If step 3 failed return(\textit{MP\_MEM}). \\ -5. for $n$ from $\lceil b / lg(\beta) \rceil$ to $c.used$ do \\ -\hspace{3mm}5.1 $c_n \leftarrow 0$ \\ -6. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -7. $c_{\lfloor b / lg(\beta) \rfloor} \leftarrow c_{\lfloor b / lg(\beta) \rfloor} \mbox{ (mod }2^{k}\mbox{)}$. \\ -8. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mod\_2d} -\end{figure} - -\textbf{Algorithm mp\_mod\_2d.} -This algorithm will quickly calculate the value of $a \mbox{ (mod }2^b\mbox{)}$. First if $b$ is less than or equal to zero the -result is set to zero. If $b$ is greater than the number of bits in $a$ then it simply copies $a$ to $c$ and returns. Otherwise, $a$ -is copied to $b$, leading digits are removed and the remaining leading digit is trimed to the exact bit count. - -EXAM,bn_mp_mod_2d.c - -We first avoid cases of $b \le 0$ by simply mp\_zero()'ing the destination in such cases. Next if $2^b$ is larger -than the input we just mp\_copy() the input and return right away. After this point we know we must actually -perform some work to produce the remainder. - -Recalling that reducing modulo $2^k$ and a binary ``and'' with $2^k - 1$ are numerically equivalent we can quickly reduce -the number. First we zero any digits above the last digit in $2^b$ (line @41,for@). Next we reduce the -leading digit of both (line @45,&=@) and then mp\_clamp(). - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an algorithm that performs $a \cdot 2^b$ for generic values of $b$ \\ - & in $O(n)$ time. \\ - &\\ -$\left [ 3 \right ] $ & Devise an efficient algorithm to multiply by small low hamming \\ - & weight values such as $3$, $5$ and $9$. Extend it to handle all values \\ - & upto $64$ with a hamming weight less than three. \\ - &\\ -$\left [ 2 \right ] $ & Modify the preceding algorithm to handle values of the form \\ - & $2^k - 1$ as well. \\ - &\\ -$\left [ 3 \right ] $ & Using only algorithms mp\_mul\_2, mp\_div\_2 and mp\_add create an \\ - & algorithm to multiply two integers in roughly $O(2n^2)$ time for \\ - & any $n$-bit input. Note that the time of addition is ignored in the \\ - & calculation. \\ - & \\ -$\left [ 5 \right ] $ & Improve the previous algorithm to have a working time of at most \\ - & $O \left (2^{(k-1)}n + \left ({2n^2 \over k} \right ) \right )$ for an appropriate choice of $k$. Again ignore \\ - & the cost of addition. \\ - & \\ -$\left [ 2 \right ] $ & Devise a chart to find optimal values of $k$ for the previous problem \\ - & for $n = 64 \ldots 1024$ in steps of $64$. \\ - & \\ -$\left [ 2 \right ] $ & Using only algorithms mp\_abs and mp\_sub devise another method for \\ - & calculating the result of a signed comparison. \\ - & -\end{tabular} - -\chapter{Multiplication and Squaring} -\section{The Multipliers} -For most number theoretic problems including certain public key cryptographic algorithms, the ``multipliers'' form the most important subset of -algorithms of any multiple precision integer package. The set of multiplier algorithms include integer multiplication, squaring and modular reduction -where in each of the algorithms single precision multiplication is the dominant operation performed. This chapter will discuss integer multiplication -and squaring, leaving modular reductions for the subsequent chapter. - -The importance of the multiplier algorithms is for the most part driven by the fact that certain popular public key algorithms are based on modular -exponentiation, that is computing $d \equiv a^b \mbox{ (mod }c\mbox{)}$ for some arbitrary choice of $a$, $b$, $c$ and $d$. During a modular -exponentiation the majority\footnote{Roughly speaking a modular exponentiation will spend about 40\% of the time performing modular reductions, -35\% of the time performing squaring and 25\% of the time performing multiplications.} of the processor time is spent performing single precision -multiplications. - -For centuries general purpose multiplication has required a lengthly $O(n^2)$ process, whereby each digit of one multiplicand has to be multiplied -against every digit of the other multiplicand. Traditional long-hand multiplication is based on this process; while the techniques can differ the -overall algorithm used is essentially the same. Only ``recently'' have faster algorithms been studied. First Karatsuba multiplication was discovered in -1962. This algorithm can multiply two numbers with considerably fewer single precision multiplications when compared to the long-hand approach. -This technique led to the discovery of polynomial basis algorithms (\textit{good reference?}) and subquently Fourier Transform based solutions. - -\section{Multiplication} -\subsection{The Baseline Multiplication} -\label{sec:basemult} -\index{baseline multiplication} -Computing the product of two integers in software can be achieved using a trivial adaptation of the standard $O(n^2)$ long-hand multiplication -algorithm that school children are taught. The algorithm is considered an $O(n^2)$ algorithm since for two $n$-digit inputs $n^2$ single precision -multiplications are required. More specifically for a $m$ and $n$ digit input $m \cdot n$ single precision multiplications are required. To -simplify most discussions, it will be assumed that the inputs have comparable number of digits. - -The ``baseline multiplication'' algorithm is designed to act as the ``catch-all'' algorithm, only to be used when the faster algorithms cannot be -used. This algorithm does not use any particularly interesting optimizations and should ideally be avoided if possible. One important -facet of this algorithm, is that it has been modified to only produce a certain amount of output digits as resolution. The importance of this -modification will become evident during the discussion of Barrett modular reduction. Recall that for a $n$ and $m$ digit input the product -will be at most $n + m$ digits. Therefore, this algorithm can be reduced to a full multiplier by having it produce $n + m$ digits of the product. - -Recall from ~GAMMA~ the definition of $\gamma$ as the number of bits in the type \textbf{mp\_digit}. We shall now extend the variable set to -include $\alpha$ which shall represent the number of bits in the type \textbf{mp\_word}. This implies that $2^{\alpha} > 2 \cdot \beta^2$. The -constant $\delta = 2^{\alpha - 2lg(\beta)}$ will represent the maximal weight of any column in a product (\textit{see ~COMBA~ for more information}). - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -1. If min$(a.used, b.used) < \delta$ then do \\ -\hspace{3mm}1.1 Calculate $c = \vert a \vert \cdot \vert b \vert$ by the Comba method (\textit{see algorithm~\ref{fig:COMBAMULT}}). \\ -\hspace{3mm}1.2 Return the result of step 1.1 \\ -\\ -Allocate and initialize a temporary mp\_int. \\ -2. Init $t$ to be of size $digs$ \\ -3. If step 2 failed return(\textit{MP\_MEM}). \\ -4. $t.used \leftarrow digs$ \\ -\\ -Compute the product. \\ -5. for $ix$ from $0$ to $a.used - 1$ do \\ -\hspace{3mm}5.1 $u \leftarrow 0$ \\ -\hspace{3mm}5.2 $pb \leftarrow \mbox{min}(b.used, digs - ix)$ \\ -\hspace{3mm}5.3 If $pb < 1$ then goto step 6. \\ -\hspace{3mm}5.4 for $iy$ from $0$ to $pb - 1$ do \\ -\hspace{6mm}5.4.1 $\hat r \leftarrow t_{iy + ix} + a_{ix} \cdot b_{iy} + u$ \\ -\hspace{6mm}5.4.2 $t_{iy + ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.5 if $ix + pb < digs$ then do \\ -\hspace{6mm}5.5.1 $t_{ix + pb} \leftarrow u$ \\ -6. Clamp excess digits of $t$. \\ -7. Swap $c$ with $t$ \\ -8. Clear $t$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_mul\_digs} -\end{figure} - -\textbf{Algorithm s\_mp\_mul\_digs.} -This algorithm computes the unsigned product of two inputs $a$ and $b$, limited to an output precision of $digs$ digits. While it may seem -a bit awkward to modify the function from its simple $O(n^2)$ description, the usefulness of partial multipliers will arise in a subsequent -algorithm. The algorithm is loosely based on algorithm 14.12 from \cite[pp. 595]{HAC} and is similar to Algorithm M of Knuth \cite[pp. 268]{TAOCPV2}. -Algorithm s\_mp\_mul\_digs differs from these cited references since it can produce a variable output precision regardless of the precision of the -inputs. - -The first thing this algorithm checks for is whether a Comba multiplier can be used instead. If the minimum digit count of either -input is less than $\delta$, then the Comba method may be used instead. After the Comba method is ruled out, the baseline algorithm begins. A -temporary mp\_int variable $t$ is used to hold the intermediate result of the product. This allows the algorithm to be used to -compute products when either $a = c$ or $b = c$ without overwriting the inputs. - -All of step 5 is the infamous $O(n^2)$ multiplication loop slightly modified to only produce upto $digs$ digits of output. The $pb$ variable -is given the count of digits to read from $b$ inside the nested loop. If $pb \le 1$ then no more output digits can be produced and the algorithm -will exit the loop. The best way to think of the loops are as a series of $pb \times 1$ multiplications. That is, in each pass of the -innermost loop $a_{ix}$ is multiplied against $b$ and the result is added (\textit{with an appropriate shift}) to $t$. - -For example, consider multiplying $576$ by $241$. That is equivalent to computing $10^0(1)(576) + 10^1(4)(576) + 10^2(2)(576)$ which is best -visualized in the following table. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|l|} -\hline && & 5 & 7 & 6 & \\ -\hline $\times$&& & 2 & 4 & 1 & \\ -\hline &&&&&&\\ - && & 5 & 7 & 6 & $10^0(1)(576)$ \\ - &2 & 3 & 6 & 1 & 6 & $10^1(4)(576) + 10^0(1)(576)$ \\ - 1 & 3 & 8 & 8 & 1 & 6 & $10^2(2)(576) + 10^1(4)(576) + 10^0(1)(576)$ \\ -\hline -\end{tabular} -\end{center} -\caption{Long-Hand Multiplication Diagram} -\end{figure} - -Each row of the product is added to the result after being shifted to the left (\textit{multiplied by a power of the radix}) by the appropriate -count. That is in pass $ix$ of the inner loop the product is added starting at the $ix$'th digit of the reult. - -Step 5.4.1 introduces the hat symbol (\textit{e.g. $\hat r$}) which represents a double precision variable. The multiplication on that step -is assumed to be a double wide output single precision multiplication. That is, two single precision variables are multiplied to produce a -double precision result. The step is somewhat optimized from a long-hand multiplication algorithm because the carry from the addition in step -5.4.1 is propagated through the nested loop. If the carry was not propagated immediately it would overflow the single precision digit -$t_{ix+iy}$ and the result would be lost. - -At step 5.5 the nested loop is finished and any carry that was left over should be forwarded. The carry does not have to be added to the $ix+pb$'th -digit since that digit is assumed to be zero at this point. However, if $ix + pb \ge digs$ the carry is not set as it would make the result -exceed the precision requested. - -EXAM,bn_s_mp_mul_digs.c - -First we determine (line @30,if@) if the Comba method can be used first since it's faster. The conditions for -sing the Comba routine are that min$(a.used, b.used) < \delta$ and the number of digits of output is less than -\textbf{MP\_WARRAY}. This new constant is used to control the stack usage in the Comba routines. By default it is -set to $\delta$ but can be reduced when memory is at a premium. - -If we cannot use the Comba method we proceed to setup the baseline routine. We allocate the the destination mp\_int -$t$ (line @36,init@) to the exact size of the output to avoid further re--allocations. At this point we now -begin the $O(n^2)$ loop. - -This implementation of multiplication has the caveat that it can be trimmed to only produce a variable number of -digits as output. In each iteration of the outer loop the $pb$ variable is set (line @48,MIN@) to the maximum -number of inner loop iterations. - -Inside the inner loop we calculate $\hat r$ as the mp\_word product of the two mp\_digits and the addition of the -carry from the previous iteration. A particularly important observation is that most modern optimizing -C compilers (GCC for instance) can recognize that a $N \times N \rightarrow 2N$ multiplication is all that -is required for the product. In x86 terms for example, this means using the MUL instruction. - -Each digit of the product is stored in turn (line @68,tmpt@) and the carry propagated (line @71,>>@) to the -next iteration. - -\subsection{Faster Multiplication by the ``Comba'' Method} -MARK,COMBA - -One of the huge drawbacks of the ``baseline'' algorithms is that at the $O(n^2)$ level the carry must be -computed and propagated upwards. This makes the nested loop very sequential and hard to unroll and implement -in parallel. The ``Comba'' \cite{COMBA} method is named after little known (\textit{in cryptographic venues}) Paul G. -Comba who described a method of implementing fast multipliers that do not require nested carry fixup operations. As an -interesting aside it seems that Paul Barrett describes a similar technique in his 1986 paper \cite{BARRETT} written -five years before. - -At the heart of the Comba technique is once again the long-hand algorithm. Except in this case a slight -twist is placed on how the columns of the result are produced. In the standard long-hand algorithm rows of products -are produced then added together to form the final result. In the baseline algorithm the columns are added together -after each iteration to get the result instantaneously. - -In the Comba algorithm the columns of the result are produced entirely independently of each other. That is at -the $O(n^2)$ level a simple multiplication and addition step is performed. The carries of the columns are propagated -after the nested loop to reduce the amount of work requiored. Succintly the first step of the algorithm is to compute -the product vector $\vec x$ as follows. - -\begin{equation} -\vec x_n = \sum_{i+j = n} a_ib_j, \forall n \in \lbrace 0, 1, 2, \ldots, i + j \rbrace -\end{equation} - -Where $\vec x_n$ is the $n'th$ column of the output vector. Consider the following example which computes the vector $\vec x$ for the multiplication -of $576$ and $241$. - -\newpage\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|} - \hline & & 5 & 7 & 6 & First Input\\ - \hline $\times$ & & 2 & 4 & 1 & Second Input\\ -\hline & & $1 \cdot 5 = 5$ & $1 \cdot 7 = 7$ & $1 \cdot 6 = 6$ & First pass \\ - & $4 \cdot 5 = 20$ & $4 \cdot 7+5=33$ & $4 \cdot 6+7=31$ & 6 & Second pass \\ - $2 \cdot 5 = 10$ & $2 \cdot 7 + 20 = 34$ & $2 \cdot 6+33=45$ & 31 & 6 & Third pass \\ -\hline 10 & 34 & 45 & 31 & 6 & Final Result \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Comba Multiplication Diagram} -\end{figure} - -At this point the vector $x = \left < 10, 34, 45, 31, 6 \right >$ is the result of the first step of the Comba multipler. -Now the columns must be fixed by propagating the carry upwards. The resultant vector will have one extra dimension over the input vector which is -congruent to adding a leading zero digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Comba Fixup}. \\ -\textbf{Input}. Vector $\vec x$ of dimension $k$ \\ -\textbf{Output}. Vector $\vec x$ such that the carries have been propagated. \\ -\hline \\ -1. for $n$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $\vec x_{n+1} \leftarrow \vec x_{n+1} + \lfloor \vec x_{n}/\beta \rfloor$ \\ -\hspace{3mm}1.2 $\vec x_{n} \leftarrow \vec x_{n} \mbox{ (mod }\beta\mbox{)}$ \\ -2. Return($\vec x$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Comba Fixup} -\end{figure} - -With that algorithm and $k = 5$ and $\beta = 10$ the following vector is produced $\vec x= \left < 1, 3, 8, 8, 1, 6 \right >$. In this case -$241 \cdot 576$ is in fact $138816$ and the procedure succeeded. If the algorithm is correct and as will be demonstrated shortly more -efficient than the baseline algorithm why not simply always use this algorithm? - -\subsubsection{Column Weight.} -At the nested $O(n^2)$ level the Comba method adds the product of two single precision variables to each column of the output -independently. A serious obstacle is if the carry is lost, due to lack of precision before the algorithm has a chance to fix -the carries. For example, in the multiplication of two three-digit numbers the third column of output will be the sum of -three single precision multiplications. If the precision of the accumulator for the output digits is less then $3 \cdot (\beta - 1)^2$ then -an overflow can occur and the carry information will be lost. For any $m$ and $n$ digit inputs the maximum weight of any column is -min$(m, n)$ which is fairly obvious. - -The maximum number of terms in any column of a product is known as the ``column weight'' and strictly governs when the algorithm can be used. Recall -from earlier that a double precision type has $\alpha$ bits of resolution and a single precision digit has $lg(\beta)$ bits of precision. Given these -two quantities we must not violate the following - -\begin{equation} -k \cdot \left (\beta - 1 \right )^2 < 2^{\alpha} -\end{equation} - -Which reduces to - -\begin{equation} -k \cdot \left ( \beta^2 - 2\beta + 1 \right ) < 2^{\alpha} -\end{equation} - -Let $\rho = lg(\beta)$ represent the number of bits in a single precision digit. By further re-arrangement of the equation the final solution is -found. - -\begin{equation} -k < {{2^{\alpha}} \over {\left (2^{2\rho} - 2^{\rho + 1} + 1 \right )}} -\end{equation} - -The defaults for LibTomMath are $\beta = 2^{28}$ and $\alpha = 2^{64}$ which means that $k$ is bounded by $k < 257$. In this configuration -the smaller input may not have more than $256$ digits if the Comba method is to be used. This is quite satisfactory for most applications since -$256$ digits would allow for numbers in the range of $0 \le x < 2^{7168}$ which, is much larger than most public key cryptographic algorithms require. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} single precision digits named $W$ on the stack. \\ -1. If $c.alloc < digs$ then grow $c$ to $digs$ digits. (\textit{mp\_grow}) \\ -2. If step 1 failed return(\textit{MP\_MEM}).\\ -\\ -3. $pa \leftarrow \mbox{MIN}(digs, a.used + b.used)$ \\ -\\ -4. $\_ \hat W \leftarrow 0$ \\ -5. for $ix$ from 0 to $pa - 1$ do \\ -\hspace{3mm}5.1 $ty \leftarrow \mbox{MIN}(b.used - 1, ix)$ \\ -\hspace{3mm}5.2 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.3 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.4 for $iz$ from 0 to $iy - 1$ do \\ -\hspace{6mm}5.4.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx+iy}b_{ty-iy}$ \\ -\hspace{3mm}5.5 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$\\ -\hspace{3mm}5.6 $\_ \hat W \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow c.used$ \\ -7. $c.used \leftarrow digs$ \\ -8. for $ix$ from $0$ to $pa$ do \\ -\hspace{3mm}8.1 $c_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa + 1$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -\\ -10. Clamp $c$. \\ -11. Return MP\_OKAY. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_mul\_digs} -\label{fig:COMBAMULT} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_mul\_digs.} -This algorithm performs the unsigned multiplication of $a$ and $b$ using the Comba method limited to $digs$ digits of precision. - -The outer loop of this algorithm is more complicated than that of the baseline multiplier. This is because on the inside of the -loop we want to produce one column per pass. This allows the accumulator $\_ \hat W$ to be placed in CPU registers and -reduce the memory bandwidth to two \textbf{mp\_digit} reads per iteration. - -The $ty$ variable is set to the minimum count of $ix$ or the number of digits in $b$. That way if $a$ has more digits than -$b$ this will be limited to $b.used - 1$. The $tx$ variable is set to the to the distance past $b.used$ the variable -$ix$ is. This is used for the immediately subsequent statement where we find $iy$. - -The variable $iy$ is the minimum digits we can read from either $a$ or $b$ before running out. Computing one column at a time -means we have to scan one integer upwards and the other downwards. $a$ starts at $tx$ and $b$ starts at $ty$. In each -pass we are producing the $ix$'th output column and we note that $tx + ty = ix$. As we move $tx$ upwards we have to -move $ty$ downards so the equality remains valid. The $iy$ variable is the number of iterations until -$tx \ge a.used$ or $ty < 0$ occurs. - -After every inner pass we store the lower half of the accumulator into $W_{ix}$ and then propagate the carry of the accumulator -into the next round by dividing $\_ \hat W$ by $\beta$. - -To measure the benefits of the Comba method over the baseline method consider the number of operations that are required. If the -cost in terms of time of a multiply and addition is $p$ and the cost of a carry propagation is $q$ then a baseline multiplication would require -$O \left ((p + q)n^2 \right )$ time to multiply two $n$-digit numbers. The Comba method requires only $O(pn^2 + qn)$ time, however in practice, -the speed increase is actually much more. With $O(n)$ space the algorithm can be reduced to $O(pn + qn)$ time by implementing the $n$ multiply -and addition operations in the nested loop in parallel. - -EXAM,bn_fast_s_mp_mul_digs.c - -As per the pseudo--code we first calculate $pa$ (line @47,MIN@) as the number of digits to output. Next we begin the outer loop -to produce the individual columns of the product. We use the two aliases $tmpx$ and $tmpy$ (lines @61,tmpx@, @62,tmpy@) to point -inside the two multiplicands quickly. - -The inner loop (lines @70,for@ to @72,}@) of this implementation is where the tradeoff come into play. Originally this comba -implementation was ``row--major'' which means it adds to each of the columns in each pass. After the outer loop it would then fix -the carries. This was very fast except it had an annoying drawback. You had to read a mp\_word and two mp\_digits and write -one mp\_word per iteration. On processors such as the Athlon XP and P4 this did not matter much since the cache bandwidth -is very high and it can keep the ALU fed with data. It did, however, matter on older and embedded cpus where cache is often -slower and also often doesn't exist. This new algorithm only performs two reads per iteration under the assumption that the -compiler has aliased $\_ \hat W$ to a CPU register. - -After the inner loop we store the current accumulator in $W$ and shift $\_ \hat W$ (lines @75,W[ix]@, @78,>>@) to forward it as -a carry for the next pass. After the outer loop we use the final carry (line @82,W[ix]@) as the last digit of the product. - -\subsection{Polynomial Basis Multiplication} -To break the $O(n^2)$ barrier in multiplication requires a completely different look at integer multiplication. In the following algorithms -the use of polynomial basis representation for two integers $a$ and $b$ as $f(x) = \sum_{i=0}^{n} a_i x^i$ and -$g(x) = \sum_{i=0}^{n} b_i x^i$ respectively, is required. In this system both $f(x)$ and $g(x)$ have $n + 1$ terms and are of the $n$'th degree. - -The product $a \cdot b \equiv f(x)g(x)$ is the polynomial $W(x) = \sum_{i=0}^{2n} w_i x^i$. The coefficients $w_i$ will -directly yield the desired product when $\beta$ is substituted for $x$. The direct solution to solve for the $2n + 1$ coefficients -requires $O(n^2)$ time and would in practice be slower than the Comba technique. - -However, numerical analysis theory indicates that only $2n + 1$ distinct points in $W(x)$ are required to determine the values of the $2n + 1$ unknown -coefficients. This means by finding $\zeta_y = W(y)$ for $2n + 1$ small values of $y$ the coefficients of $W(x)$ can be found with -Gaussian elimination. This technique is also occasionally refered to as the \textit{interpolation technique} (\textit{references please...}) since in -effect an interpolation based on $2n + 1$ points will yield a polynomial equivalent to $W(x)$. - -The coefficients of the polynomial $W(x)$ are unknown which makes finding $W(y)$ for any value of $y$ impossible. However, since -$W(x) = f(x)g(x)$ the equivalent $\zeta_y = f(y) g(y)$ can be used in its place. The benefit of this technique stems from the -fact that $f(y)$ and $g(y)$ are much smaller than either $a$ or $b$ respectively. As a result finding the $2n + 1$ relations required -by multiplying $f(y)g(y)$ involves multiplying integers that are much smaller than either of the inputs. - -When picking points to gather relations there are always three obvious points to choose, $y = 0, 1$ and $ \infty$. The $\zeta_0$ term -is simply the product $W(0) = w_0 = a_0 \cdot b_0$. The $\zeta_1$ term is the product -$W(1) = \left (\sum_{i = 0}^{n} a_i \right ) \left (\sum_{i = 0}^{n} b_i \right )$. The third point $\zeta_{\infty}$ is less obvious but rather -simple to explain. The $2n + 1$'th coefficient of $W(x)$ is numerically equivalent to the most significant column in an integer multiplication. -The point at $\infty$ is used symbolically to represent the most significant column, that is $W(\infty) = w_{2n} = a_nb_n$. Note that the -points at $y = 0$ and $\infty$ yield the coefficients $w_0$ and $w_{2n}$ directly. - -If more points are required they should be of small values and powers of two such as $2^q$ and the related \textit{mirror points} -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ for small values of $q$. The term ``mirror point'' stems from the fact that -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ can be calculated in the exact opposite fashion as $\zeta_{2^q}$. For -example, when $n = 2$ and $q = 1$ then following two equations are equivalent to the point $\zeta_{2}$ and its mirror. - -\begin{eqnarray} -\zeta_{2} = f(2)g(2) = (4a_2 + 2a_1 + a_0)(4b_2 + 2b_1 + b_0) \nonumber \\ -16 \cdot \zeta_{1 \over 2} = 4f({1\over 2}) \cdot 4g({1 \over 2}) = (a_2 + 2a_1 + 4a_0)(b_2 + 2b_1 + 4b_0) -\end{eqnarray} - -Using such points will allow the values of $f(y)$ and $g(y)$ to be independently calculated using only left shifts. For example, when $n = 2$ the -polynomial $f(2^q)$ is equal to $2^q((2^qa_2) + a_1) + a_0$. This technique of polynomial representation is known as Horner's method. - -As a general rule of the algorithm when the inputs are split into $n$ parts each there are $2n - 1$ multiplications. Each multiplication is of -multiplicands that have $n$ times fewer digits than the inputs. The asymptotic running time of this algorithm is -$O \left ( k^{lg_n(2n - 1)} \right )$ for $k$ digit inputs (\textit{assuming they have the same number of digits}). Figure~\ref{fig:exponent} -summarizes the exponents for various values of $n$. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Split into $n$ Parts} & \textbf{Exponent} & \textbf{Notes}\\ -\hline $2$ & $1.584962501$ & This is Karatsuba Multiplication. \\ -\hline $3$ & $1.464973520$ & This is Toom-Cook Multiplication. \\ -\hline $4$ & $1.403677461$ &\\ -\hline $5$ & $1.365212389$ &\\ -\hline $10$ & $1.278753601$ &\\ -\hline $100$ & $1.149426538$ &\\ -\hline $1000$ & $1.100270931$ &\\ -\hline $10000$ & $1.075252070$ &\\ -\hline -\end{tabular} -\end{center} -\caption{Asymptotic Running Time of Polynomial Basis Multiplication} -\label{fig:exponent} -\end{figure} - -At first it may seem like a good idea to choose $n = 1000$ since the exponent is approximately $1.1$. However, the overhead -of solving for the 2001 terms of $W(x)$ will certainly consume any savings the algorithm could offer for all but exceedingly large -numbers. - -\subsubsection{Cutoff Point} -The polynomial basis multiplication algorithms all require fewer single precision multiplications than a straight Comba approach. However, -the algorithms incur an overhead (\textit{at the $O(n)$ work level}) since they require a system of equations to be solved. This makes the -polynomial basis approach more costly to use with small inputs. - -Let $m$ represent the number of digits in the multiplicands (\textit{assume both multiplicands have the same number of digits}). There exists a -point $y$ such that when $m < y$ the polynomial basis algorithms are more costly than Comba, when $m = y$ they are roughly the same cost and -when $m > y$ the Comba methods are slower than the polynomial basis algorithms. - -The exact location of $y$ depends on several key architectural elements of the computer platform in question. - -\begin{enumerate} -\item The ratio of clock cycles for single precision multiplication versus other simpler operations such as addition, shifting, etc. For example -on the AMD Athlon the ratio is roughly $17 : 1$ while on the Intel P4 it is $29 : 1$. The higher the ratio in favour of multiplication the lower -the cutoff point $y$ will be. - -\item The complexity of the linear system of equations (\textit{for the coefficients of $W(x)$}) is. Generally speaking as the number of splits -grows the complexity grows substantially. Ideally solving the system will only involve addition, subtraction and shifting of integers. This -directly reflects on the ratio previous mentioned. - -\item To a lesser extent memory bandwidth and function call overheads. Provided the values are in the processor cache this is less of an -influence over the cutoff point. - -\end{enumerate} - -A clean cutoff point separation occurs when a point $y$ is found such that all of the cutoff point conditions are met. For example, if the point -is too low then there will be values of $m$ such that $m > y$ and the Comba method is still faster. Finding the cutoff points is fairly simple when -a high resolution timer is available. - -\subsection{Karatsuba Multiplication} -Karatsuba \cite{KARA} multiplication when originally proposed in 1962 was among the first set of algorithms to break the $O(n^2)$ barrier for -general purpose multiplication. Given two polynomial basis representations $f(x) = ax + b$ and $g(x) = cx + d$, Karatsuba proved with -light algebra \cite{KARAP} that the following polynomial is equivalent to multiplication of the two integers the polynomials represent. - -\begin{equation} -f(x) \cdot g(x) = acx^2 + ((a + b)(c + d) - (ac + bd))x + bd -\end{equation} - -Using the observation that $ac$ and $bd$ could be re-used only three half sized multiplications would be required to produce the product. Applying -this algorithm recursively, the work factor becomes $O(n^{lg(3)})$ which is substantially better than the work factor $O(n^2)$ of the Comba technique. It turns -out what Karatsuba did not know or at least did not publish was that this is simply polynomial basis multiplication with the points -$\zeta_0$, $\zeta_{\infty}$ and $\zeta_{1}$. Consider the resultant system of equations. - -\begin{center} -\begin{tabular}{rcrcrcrc} -$\zeta_{0}$ & $=$ & & & & & $w_0$ \\ -$\zeta_{1}$ & $=$ & $w_2$ & $+$ & $w_1$ & $+$ & $w_0$ \\ -$\zeta_{\infty}$ & $=$ & $w_2$ & & & & \\ -\end{tabular} -\end{center} - -By adding the first and last equation to the equation in the middle the term $w_1$ can be isolated and all three coefficients solved for. The simplicity -of this system of equations has made Karatsuba fairly popular. In fact the cutoff point is often fairly low\footnote{With LibTomMath 0.18 it is 70 and 109 digits for the Intel P4 and AMD Athlon respectively.} -making it an ideal algorithm to speed up certain public key cryptosystems such as RSA and Diffie-Hellman. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert$ \\ -\hline \\ -1. Init the following mp\_int variables: $x0$, $x1$, $y0$, $y1$, $t1$, $x0y0$, $x1y1$.\\ -2. If step 2 failed then return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1 \cdot \beta^B + x0$ \\ -3. $B \leftarrow \mbox{min}(a.used, b.used)/2$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $y0 \leftarrow b \mbox{ (mod }\beta^B\mbox{)}$ \\ -6. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_rshd}) \\ -7. $y1 \leftarrow \lfloor b / \beta^B \rfloor$ \\ -\\ -Calculate the three products. \\ -8. $x0y0 \leftarrow x0 \cdot y0$ (\textit{mp\_mul}) \\ -9. $x1y1 \leftarrow x1 \cdot y1$ \\ -10. $t1 \leftarrow x1 + x0$ (\textit{mp\_add}) \\ -11. $x0 \leftarrow y1 + y0$ \\ -12. $t1 \leftarrow t1 \cdot x0$ \\ -\\ -Calculate the middle term. \\ -13. $x0 \leftarrow x0y0 + x1y1$ \\ -14. $t1 \leftarrow t1 - x0$ (\textit{s\_mp\_sub}) \\ -\\ -Calculate the final product. \\ -15. $t1 \leftarrow t1 \cdot \beta^B$ (\textit{mp\_lshd}) \\ -16. $x1y1 \leftarrow x1y1 \cdot \beta^{2B}$ \\ -17. $t1 \leftarrow x0y0 + t1$ \\ -18. $c \leftarrow t1 + x1y1$ \\ -19. Clear all of the temporary variables. \\ -20. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_mul} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_mul.} -This algorithm computes the unsigned product of two inputs using the Karatsuba multiplication algorithm. It is loosely based on the description -from Knuth \cite[pp. 294-295]{TAOCPV2}. - -\index{radix point} -In order to split the two inputs into their respective halves, a suitable \textit{radix point} must be chosen. The radix point chosen must -be used for both of the inputs meaning that it must be smaller than the smallest input. Step 3 chooses the radix point $B$ as half of the -smallest input \textbf{used} count. After the radix point is chosen the inputs are split into lower and upper halves. Step 4 and 5 -compute the lower halves. Step 6 and 7 computer the upper halves. - -After the halves have been computed the three intermediate half-size products must be computed. Step 8 and 9 compute the trivial products -$x0 \cdot y0$ and $x1 \cdot y1$. The mp\_int $x0$ is used as a temporary variable after $x1 + x0$ has been computed. By using $x0$ instead -of an additional temporary variable, the algorithm can avoid an addition memory allocation operation. - -The remaining steps 13 through 18 compute the Karatsuba polynomial through a variety of digit shifting and addition operations. - -EXAM,bn_mp_karatsuba_mul.c - -The new coding element in this routine, not seen in previous routines, is the usage of goto statements. The conventional -wisdom is that goto statements should be avoided. This is generally true, however when every single function call can fail, it makes sense -to handle error recovery with a single piece of code. Lines @61,if@ to @75,if@ handle initializing all of the temporary variables -required. Note how each of the if statements goes to a different label in case of failure. This allows the routine to correctly free only -the temporaries that have been successfully allocated so far. - -The temporary variables are all initialized using the mp\_init\_size routine since they are expected to be large. This saves the -additional reallocation that would have been necessary. Also $x0$, $x1$, $y0$ and $y1$ have to be able to hold at least their respective -number of digits for the next section of code. - -The first algebraic portion of the algorithm is to split the two inputs into their halves. However, instead of using mp\_mod\_2d and mp\_rshd -to extract the halves, the respective code has been placed inline within the body of the function. To initialize the halves, the \textbf{used} and -\textbf{sign} members are copied first. The first for loop on line @98,for@ copies the lower halves. Since they are both the same magnitude it -is simpler to calculate both lower halves in a single loop. The for loop on lines @104,for@ and @109,for@ calculate the upper halves $x1$ and -$y1$ respectively. - -By inlining the calculation of the halves, the Karatsuba multiplier has a slightly lower overhead and can be used for smaller magnitude inputs. - -When line @152,err@ is reached, the algorithm has completed succesfully. The ``error status'' variable $err$ is set to \textbf{MP\_OKAY} so that -the same code that handles errors can be used to clear the temporary variables and return. - -\subsection{Toom-Cook $3$-Way Multiplication} -Toom-Cook $3$-Way \cite{TOOM} multiplication is essentially the polynomial basis algorithm for $n = 2$ except that the points are -chosen such that $\zeta$ is easy to compute and the resulting system of equations easy to reduce. Here, the points $\zeta_{0}$, -$16 \cdot \zeta_{1 \over 2}$, $\zeta_1$, $\zeta_2$ and $\zeta_{\infty}$ make up the five required points to solve for the coefficients -of the $W(x)$. - -With the five relations that Toom-Cook specifies, the following system of equations is formed. - -\begin{center} -\begin{tabular}{rcrcrcrcrcr} -$\zeta_0$ & $=$ & $0w_4$ & $+$ & $0w_3$ & $+$ & $0w_2$ & $+$ & $0w_1$ & $+$ & $1w_0$ \\ -$16 \cdot \zeta_{1 \over 2}$ & $=$ & $1w_4$ & $+$ & $2w_3$ & $+$ & $4w_2$ & $+$ & $8w_1$ & $+$ & $16w_0$ \\ -$\zeta_1$ & $=$ & $1w_4$ & $+$ & $1w_3$ & $+$ & $1w_2$ & $+$ & $1w_1$ & $+$ & $1w_0$ \\ -$\zeta_2$ & $=$ & $16w_4$ & $+$ & $8w_3$ & $+$ & $4w_2$ & $+$ & $2w_1$ & $+$ & $1w_0$ \\ -$\zeta_{\infty}$ & $=$ & $1w_4$ & $+$ & $0w_3$ & $+$ & $0w_2$ & $+$ & $0w_1$ & $+$ & $0w_0$ \\ -\end{tabular} -\end{center} - -A trivial solution to this matrix requires $12$ subtractions, two multiplications by a small power of two, two divisions by a small power -of two, two divisions by three and one multiplication by three. All of these $19$ sub-operations require less than quadratic time, meaning that -the algorithm can be faster than a baseline multiplication. However, the greater complexity of this algorithm places the cutoff point -(\textbf{TOOM\_MUL\_CUTOFF}) where Toom-Cook becomes more efficient much higher than the Karatsuba cutoff point. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toom\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b $ \\ -\hline \\ -Split $a$ and $b$ into three pieces. E.g. $a = a_2 \beta^{2k} + a_1 \beta^{k} + a_0$ \\ -1. $k \leftarrow \lfloor \mbox{min}(a.used, b.used) / 3 \rfloor$ \\ -2. $a_0 \leftarrow a \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -3. $a_1 \leftarrow \lfloor a / \beta^k \rfloor$, $a_1 \leftarrow a_1 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -4. $a_2 \leftarrow \lfloor a / \beta^{2k} \rfloor$, $a_2 \leftarrow a_2 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -5. $b_0 \leftarrow a \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -6. $b_1 \leftarrow \lfloor a / \beta^k \rfloor$, $b_1 \leftarrow b_1 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -7. $b_2 \leftarrow \lfloor a / \beta^{2k} \rfloor$, $b_2 \leftarrow b_2 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -\\ -Find the five equations for $w_0, w_1, ..., w_4$. \\ -8. $w_0 \leftarrow a_0 \cdot b_0$ \\ -9. $w_4 \leftarrow a_2 \cdot b_2$ \\ -10. $tmp_1 \leftarrow 2 \cdot a_0$, $tmp_1 \leftarrow a_1 + tmp_1$, $tmp_1 \leftarrow 2 \cdot tmp_1$, $tmp_1 \leftarrow tmp_1 + a_2$ \\ -11. $tmp_2 \leftarrow 2 \cdot b_0$, $tmp_2 \leftarrow b_1 + tmp_2$, $tmp_2 \leftarrow 2 \cdot tmp_2$, $tmp_2 \leftarrow tmp_2 + b_2$ \\ -12. $w_1 \leftarrow tmp_1 \cdot tmp_2$ \\ -13. $tmp_1 \leftarrow 2 \cdot a_2$, $tmp_1 \leftarrow a_1 + tmp_1$, $tmp_1 \leftarrow 2 \cdot tmp_1$, $tmp_1 \leftarrow tmp_1 + a_0$ \\ -14. $tmp_2 \leftarrow 2 \cdot b_2$, $tmp_2 \leftarrow b_1 + tmp_2$, $tmp_2 \leftarrow 2 \cdot tmp_2$, $tmp_2 \leftarrow tmp_2 + b_0$ \\ -15. $w_3 \leftarrow tmp_1 \cdot tmp_2$ \\ -16. $tmp_1 \leftarrow a_0 + a_1$, $tmp_1 \leftarrow tmp_1 + a_2$, $tmp_2 \leftarrow b_0 + b_1$, $tmp_2 \leftarrow tmp_2 + b_2$ \\ -17. $w_2 \leftarrow tmp_1 \cdot tmp_2$ \\ -\\ -Continued on the next page.\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toom\_mul} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toom\_mul} (continued). \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b $ \\ -\hline \\ -Now solve the system of equations. \\ -18. $w_1 \leftarrow w_4 - w_1$, $w_3 \leftarrow w_3 - w_0$ \\ -19. $w_1 \leftarrow \lfloor w_1 / 2 \rfloor$, $w_3 \leftarrow \lfloor w_3 / 2 \rfloor$ \\ -20. $w_2 \leftarrow w_2 - w_0$, $w_2 \leftarrow w_2 - w_4$ \\ -21. $w_1 \leftarrow w_1 - w_2$, $w_3 \leftarrow w_3 - w_2$ \\ -22. $tmp_1 \leftarrow 8 \cdot w_0$, $w_1 \leftarrow w_1 - tmp_1$, $tmp_1 \leftarrow 8 \cdot w_4$, $w_3 \leftarrow w_3 - tmp_1$ \\ -23. $w_2 \leftarrow 3 \cdot w_2$, $w_2 \leftarrow w_2 - w_1$, $w_2 \leftarrow w_2 - w_3$ \\ -24. $w_1 \leftarrow w_1 - w_2$, $w_3 \leftarrow w_3 - w_2$ \\ -25. $w_1 \leftarrow \lfloor w_1 / 3 \rfloor, w_3 \leftarrow \lfloor w_3 / 3 \rfloor$ \\ -\\ -Now substitute $\beta^k$ for $x$ by shifting $w_0, w_1, ..., w_4$. \\ -26. for $n$ from $1$ to $4$ do \\ -\hspace{3mm}26.1 $w_n \leftarrow w_n \cdot \beta^{nk}$ \\ -27. $c \leftarrow w_0 + w_1$, $c \leftarrow c + w_2$, $c \leftarrow c + w_3$, $c \leftarrow c + w_4$ \\ -28. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toom\_mul (continued)} -\end{figure} - -\textbf{Algorithm mp\_toom\_mul.} -This algorithm computes the product of two mp\_int variables $a$ and $b$ using the Toom-Cook approach. Compared to the Karatsuba multiplication, this -algorithm has a lower asymptotic running time of approximately $O(n^{1.464})$ but at an obvious cost in overhead. In this -description, several statements have been compounded to save space. The intention is that the statements are executed from left to right across -any given step. - -The two inputs $a$ and $b$ are first split into three $k$-digit integers $a_0, a_1, a_2$ and $b_0, b_1, b_2$ respectively. From these smaller -integers the coefficients of the polynomial basis representations $f(x)$ and $g(x)$ are known and can be used to find the relations required. - -The first two relations $w_0$ and $w_4$ are the points $\zeta_{0}$ and $\zeta_{\infty}$ respectively. The relation $w_1, w_2$ and $w_3$ correspond -to the points $16 \cdot \zeta_{1 \over 2}, \zeta_{2}$ and $\zeta_{1}$ respectively. These are found using logical shifts to independently find -$f(y)$ and $g(y)$ which significantly speeds up the algorithm. - -After the five relations $w_0, w_1, \ldots, w_4$ have been computed, the system they represent must be solved in order for the unknown coefficients -$w_1, w_2$ and $w_3$ to be isolated. The steps 18 through 25 perform the system reduction required as previously described. Each step of -the reduction represents the comparable matrix operation that would be performed had this been performed by pencil. For example, step 18 indicates -that row $1$ must be subtracted from row $4$ and simultaneously row $0$ subtracted from row $3$. - -Once the coeffients have been isolated, the polynomial $W(x) = \sum_{i=0}^{2n} w_i x^i$ is known. By substituting $\beta^{k}$ for $x$, the integer -result $a \cdot b$ is produced. - -EXAM,bn_mp_toom_mul.c - -The first obvious thing to note is that this algorithm is complicated. The complexity is worth it if you are multiplying very -large numbers. For example, a 10,000 digit multiplication takes approximaly 99,282,205 fewer single precision multiplications with -Toom--Cook than a Comba or baseline approach (this is a savings of more than 99$\%$). For most ``crypto'' sized numbers this -algorithm is not practical as Karatsuba has a much lower cutoff point. - -First we split $a$ and $b$ into three roughly equal portions. This has been accomplished (lines @40,mod@ to @69,rshd@) with -combinations of mp\_rshd() and mp\_mod\_2d() function calls. At this point $a = a2 \cdot \beta^2 + a1 \cdot \beta + a0$ and similiarly -for $b$. - -Next we compute the five points $w0, w1, w2, w3$ and $w4$. Recall that $w0$ and $w4$ can be computed directly from the portions so -we get those out of the way first (lines @72,mul@ and @77,mul@). Next we compute $w1, w2$ and $w3$ using Horners method. - -After this point we solve for the actual values of $w1, w2$ and $w3$ by reducing the $5 \times 5$ system which is relatively -straight forward. - -\subsection{Signed Multiplication} -Now that algorithms to handle multiplications of every useful dimensions have been developed, a rather simple finishing touch is required. So far all -of the multiplication algorithms have been unsigned multiplications which leaves only a signed multiplication algorithm to be established. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b$ \\ -\hline \\ -1. If $a.sign = b.sign$ then \\ -\hspace{3mm}1.1 $sign = MP\_ZPOS$ \\ -2. else \\ -\hspace{3mm}2.1 $sign = MP\_ZNEG$ \\ -3. If min$(a.used, b.used) \ge TOOM\_MUL\_CUTOFF$ then \\ -\hspace{3mm}3.1 $c \leftarrow a \cdot b$ using algorithm mp\_toom\_mul \\ -4. else if min$(a.used, b.used) \ge KARATSUBA\_MUL\_CUTOFF$ then \\ -\hspace{3mm}4.1 $c \leftarrow a \cdot b$ using algorithm mp\_karatsuba\_mul \\ -5. else \\ -\hspace{3mm}5.1 $digs \leftarrow a.used + b.used + 1$ \\ -\hspace{3mm}5.2 If $digs < MP\_ARRAY$ and min$(a.used, b.used) \le \delta$ then \\ -\hspace{6mm}5.2.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm fast\_s\_mp\_mul\_digs. \\ -\hspace{3mm}5.3 else \\ -\hspace{6mm}5.3.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm s\_mp\_mul\_digs. \\ -6. $c.sign \leftarrow sign$ \\ -7. Return the result of the unsigned multiplication performed. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul} -\end{figure} - -\textbf{Algorithm mp\_mul.} -This algorithm performs the signed multiplication of two inputs. It will make use of any of the three unsigned multiplication algorithms -available when the input is of appropriate size. The \textbf{sign} of the result is not set until the end of the algorithm since algorithm -s\_mp\_mul\_digs will clear it. - -EXAM,bn_mp_mul.c - -The implementation is rather simplistic and is not particularly noteworthy. Line @22,?@ computes the sign of the result using the ``?'' -operator from the C programming language. Line @37,<<@ computes $\delta$ using the fact that $1 << k$ is equal to $2^k$. - -\section{Squaring} -\label{sec:basesquare} - -Squaring is a special case of multiplication where both multiplicands are equal. At first it may seem like there is no significant optimization -available but in fact there is. Consider the multiplication of $576$ against $241$. In total there will be nine single precision multiplications -performed which are $1\cdot 6$, $1 \cdot 7$, $1 \cdot 5$, $4 \cdot 6$, $4 \cdot 7$, $4 \cdot 5$, $2 \cdot 6$, $2 \cdot 7$ and $2 \cdot 5$. Now consider -the multiplication of $123$ against $123$. The nine products are $3 \cdot 3$, $3 \cdot 2$, $3 \cdot 1$, $2 \cdot 3$, $2 \cdot 2$, $2 \cdot 1$, -$1 \cdot 3$, $1 \cdot 2$ and $1 \cdot 1$. On closer inspection some of the products are equivalent. For example, $3 \cdot 2 = 2 \cdot 3$ -and $3 \cdot 1 = 1 \cdot 3$. - -For any $n$-digit input, there are ${{\left (n^2 + n \right)}\over 2}$ possible unique single precision multiplications required compared to the $n^2$ -required for multiplication. The following diagram gives an example of the operations required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{ccccc|c} -&&1&2&3&\\ -$\times$ &&1&2&3&\\ -\hline && $3 \cdot 1$ & $3 \cdot 2$ & $3 \cdot 3$ & Row 0\\ - & $2 \cdot 1$ & $2 \cdot 2$ & $2 \cdot 3$ && Row 1 \\ - $1 \cdot 1$ & $1 \cdot 2$ & $1 \cdot 3$ &&& Row 2 \\ -\end{tabular} -\end{center} -\caption{Squaring Optimization Diagram} -\end{figure} - -MARK,SQUARE -Starting from zero and numbering the columns from right to left a very simple pattern becomes obvious. For the purposes of this discussion let $x$ -represent the number being squared. The first observation is that in row $k$ the $2k$'th column of the product has a $\left (x_k \right)^2$ term in it. - -The second observation is that every column $j$ in row $k$ where $j \ne 2k$ is part of a double product. Every non-square term of a column will -appear twice hence the name ``double product''. Every odd column is made up entirely of double products. In fact every column is made up of double -products and at most one square (\textit{see the exercise section}). - -The third and final observation is that for row $k$ the first unique non-square term, that is, one that hasn't already appeared in an earlier row, -occurs at column $2k + 1$. For example, on row $1$ of the previous squaring, column one is part of the double product with column one from row zero. -Column two of row one is a square and column three is the first unique column. - -\subsection{The Baseline Squaring Algorithm} -The baseline squaring algorithm is meant to be a catch-all squaring algorithm. It will handle any of the input sizes that the faster routines -will not handle. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Init a temporary mp\_int of at least $2 \cdot a.used +1$ digits. (\textit{mp\_init\_size}) \\ -2. If step 1 failed return(\textit{MP\_MEM}) \\ -3. $t.used \leftarrow 2 \cdot a.used + 1$ \\ -4. For $ix$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}Calculate the square. \\ -\hspace{3mm}4.1 $\hat r \leftarrow t_{2ix} + \left (a_{ix} \right )^2$ \\ -\hspace{3mm}4.2 $t_{2ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}Calculate the double products after the square. \\ -\hspace{3mm}4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}4.4 For $iy$ from $ix + 1$ to $a.used - 1$ do \\ -\hspace{6mm}4.4.1 $\hat r \leftarrow 2 \cdot a_{ix}a_{iy} + t_{ix + iy} + u$ \\ -\hspace{6mm}4.4.2 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}Set the last carry. \\ -\hspace{3mm}4.5 While $u > 0$ do \\ -\hspace{6mm}4.5.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}4.5.2 $\hat r \leftarrow t_{ix + iy} + u$ \\ -\hspace{6mm}4.5.3 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.5.4 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. Clamp excess digits of $t$. (\textit{mp\_clamp}) \\ -6. Exchange $b$ and $t$. \\ -7. Clear $t$ (\textit{mp\_clear}) \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm s\_mp\_sqr.} -This algorithm computes the square of an input using the three observations on squaring. It is based fairly faithfully on algorithm 14.16 of HAC -\cite[pp.596-597]{HAC}. Similar to algorithm s\_mp\_mul\_digs, a temporary mp\_int is allocated to hold the result of the squaring. This allows the -destination mp\_int to be the same as the source mp\_int. - -The outer loop of this algorithm begins on step 4. It is best to think of the outer loop as walking down the rows of the partial results, while -the inner loop computes the columns of the partial result. Step 4.1 and 4.2 compute the square term for each row, and step 4.3 and 4.4 propagate -the carry and compute the double products. - -The requirement that a mp\_word be able to represent the range $0 \le x < 2 \beta^2$ arises from this -very algorithm. The product $a_{ix}a_{iy}$ will lie in the range $0 \le x \le \beta^2 - 2\beta + 1$ which is obviously less than $\beta^2$ meaning that -when it is multiplied by two, it can be properly represented by a mp\_word. - -Similar to algorithm s\_mp\_mul\_digs, after every pass of the inner loop, the destination is correctly set to the sum of all of the partial -results calculated so far. This involves expensive carry propagation which will be eliminated in the next algorithm. - -EXAM,bn_s_mp_sqr.c - -Inside the outer loop (line @32,for@) the square term is calculated on line @35,r =@. The carry (line @42,>>@) has been -extracted from the mp\_word accumulator using a right shift. Aliases for $a_{ix}$ and $t_{ix+iy}$ are initialized -(lines @45,tmpx@ and @48,tmpt@) to simplify the inner loop. The doubling is performed using two -additions (line @57,r + r@) since it is usually faster than shifting, if not at least as fast. - -The important observation is that the inner loop does not begin at $iy = 0$ like for multiplication. As such the inner loops -get progressively shorter as the algorithm proceeds. This is what leads to the savings compared to using a multiplication to -square a number. - -\subsection{Faster Squaring by the ``Comba'' Method} -A major drawback to the baseline method is the requirement for single precision shifting inside the $O(n^2)$ nested loop. Squaring has an additional -drawback that it must double the product inside the inner loop as well. As for multiplication, the Comba technique can be used to eliminate these -performance hazards. - -The first obvious solution is to make an array of mp\_words which will hold all of the columns. This will indeed eliminate all of the carry -propagation operations from the inner loop. However, the inner product must still be doubled $O(n^2)$ times. The solution stems from the simple fact -that $2a + 2b + 2c = 2(a + b + c)$. That is the sum of all of the double products is equal to double the sum of all the products. For example, -$ab + ba + ac + ca = 2ab + 2ac = 2(ab + ac)$. - -However, we cannot simply double all of the columns, since the squares appear only once per row. The most practical solution is to have two -mp\_word arrays. One array will hold the squares and the other array will hold the double products. With both arrays the doubling and -carry propagation can be moved to a $O(n)$ work level outside the $O(n^2)$ level. In this case, we have an even simpler solution in mind. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_digits named $W$ on the stack. \\ -1. If $b.alloc < 2a.used + 1$ then grow $b$ to $2a.used + 1$ digits. (\textit{mp\_grow}). \\ -2. If step 1 failed return(\textit{MP\_MEM}). \\ -\\ -3. $pa \leftarrow 2 \cdot a.used$ \\ -4. $\hat W1 \leftarrow 0$ \\ -5. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}5.1 $\_ \hat W \leftarrow 0$ \\ -\hspace{3mm}5.2 $ty \leftarrow \mbox{MIN}(a.used - 1, ix)$ \\ -\hspace{3mm}5.3 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.4 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.5 $iy \leftarrow \mbox{MIN}(iy, \lfloor \left (ty - tx + 1 \right )/2 \rfloor)$ \\ -\hspace{3mm}5.6 for $iz$ from $0$ to $iz - 1$ do \\ -\hspace{6mm}5.6.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx + iz}a_{ty - iz}$ \\ -\hspace{3mm}5.7 $\_ \hat W \leftarrow 2 \cdot \_ \hat W + \hat W1$ \\ -\hspace{3mm}5.8 if $ix$ is even then \\ -\hspace{6mm}5.8.1 $\_ \hat W \leftarrow \_ \hat W + \left ( a_{\lfloor ix/2 \rfloor}\right )^2$ \\ -\hspace{3mm}5.9 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$ \\ -\hspace{3mm}5.10 $\hat W1 \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow b.used$ \\ -7. $b.used \leftarrow 2 \cdot a.used$ \\ -8. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}8.1 $b_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $b_{ix} \leftarrow 0$ \\ -10. Clamp excess digits from $b$. (\textit{mp\_clamp}) \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_sqr.} -This algorithm computes the square of an input using the Comba technique. It is designed to be a replacement for algorithm -s\_mp\_sqr when the number of input digits is less than \textbf{MP\_WARRAY} and less than $\delta \over 2$. -This algorithm is very similar to the Comba multiplier except with a few key differences we shall make note of. - -First, we have an accumulator and carry variables $\_ \hat W$ and $\hat W1$ respectively. This is because the inner loop -products are to be doubled. If we had added the previous carry in we would be doubling too much. Next we perform an -addition MIN condition on $iy$ (step 5.5) to prevent overlapping digits. For example, $a_3 \cdot a_5$ is equal -$a_5 \cdot a_3$. Whereas in the multiplication case we would have $5 < a.used$ and $3 \ge 0$ is maintained since we double the sum -of the products just outside the inner loop we have to avoid doing this. This is also a good thing since we perform -fewer multiplications and the routine ends up being faster. - -Finally the last difference is the addition of the ``square'' term outside the inner loop (step 5.8). We add in the square -only to even outputs and it is the square of the term at the $\lfloor ix / 2 \rfloor$ position. - -EXAM,bn_fast_s_mp_sqr.c - -This implementation is essentially a copy of Comba multiplication with the appropriate changes added to make it faster for -the special case of squaring. - -\subsection{Polynomial Basis Squaring} -The same algorithm that performs optimal polynomial basis multiplication can be used to perform polynomial basis squaring. The minor exception -is that $\zeta_y = f(y)g(y)$ is actually equivalent to $\zeta_y = f(y)^2$ since $f(y) = g(y)$. Instead of performing $2n + 1$ -multiplications to find the $\zeta$ relations, squaring operations are performed instead. - -\subsection{Karatsuba Squaring} -Let $f(x) = ax + b$ represent the polynomial basis representation of a number to square. -Let $h(x) = \left ( f(x) \right )^2$ represent the square of the polynomial. The Karatsuba equation can be modified to square a -number with the following equation. - -\begin{equation} -h(x) = a^2x^2 + \left ((a + b)^2 - (a^2 + b^2) \right )x + b^2 -\end{equation} - -Upon closer inspection this equation only requires the calculation of three half-sized squares: $a^2$, $b^2$ and $(a + b)^2$. As in -Karatsuba multiplication, this algorithm can be applied recursively on the input and will achieve an asymptotic running time of -$O \left ( n^{lg(3)} \right )$. - -If the asymptotic times of Karatsuba squaring and multiplication are the same, why not simply use the multiplication algorithm -instead? The answer to this arises from the cutoff point for squaring. As in multiplication there exists a cutoff point, at which the -time required for a Comba based squaring and a Karatsuba based squaring meet. Due to the overhead inherent in the Karatsuba method, the cutoff -point is fairly high. For example, on an AMD Athlon XP processor with $\beta = 2^{28}$, the cutoff point is around 127 digits. - -Consider squaring a 200 digit number with this technique. It will be split into two 100 digit halves which are subsequently squared. -The 100 digit halves will not be squared using Karatsuba, but instead using the faster Comba based squaring algorithm. If Karatsuba multiplication -were used instead, the 100 digit numbers would be squared with a slower Comba based multiplication. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Initialize the following temporary mp\_ints: $x0$, $x1$, $t1$, $t2$, $x0x0$ and $x1x1$. \\ -2. If any of the initializations on step 1 failed return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1\beta^B + x0$ \\ -3. $B \leftarrow \lfloor a.used / 2 \rfloor$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_lshd}) \\ -\\ -Calculate the three squares. \\ -6. $x0x0 \leftarrow x0^2$ (\textit{mp\_sqr}) \\ -7. $x1x1 \leftarrow x1^2$ \\ -8. $t1 \leftarrow x1 + x0$ (\textit{s\_mp\_add}) \\ -9. $t1 \leftarrow t1^2$ \\ -\\ -Compute the middle term. \\ -10. $t2 \leftarrow x0x0 + x1x1$ (\textit{s\_mp\_add}) \\ -11. $t1 \leftarrow t1 - t2$ \\ -\\ -Compute final product. \\ -12. $t1 \leftarrow t1\beta^B$ (\textit{mp\_lshd}) \\ -13. $x1x1 \leftarrow x1x1\beta^{2B}$ \\ -14. $t1 \leftarrow t1 + x0x0$ \\ -15. $b \leftarrow t1 + x1x1$ \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_sqr} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_sqr.} -This algorithm computes the square of an input $a$ using the Karatsuba technique. This algorithm is very similar to the Karatsuba based -multiplication algorithm with the exception that the three half-size multiplications have been replaced with three half-size squarings. - -The radix point for squaring is simply placed exactly in the middle of the digits when the input has an odd number of digits, otherwise it is -placed just below the middle. Step 3, 4 and 5 compute the two halves required using $B$ -as the radix point. The first two squares in steps 6 and 7 are rather straightforward while the last square is of a more compact form. - -By expanding $\left (x1 + x0 \right )^2$, the $x1^2$ and $x0^2$ terms in the middle disappear, that is $(x0 - x1)^2 - (x1^2 + x0^2) = 2 \cdot x0 \cdot x1$. -Now if $5n$ single precision additions and a squaring of $n$-digits is faster than multiplying two $n$-digit numbers and doubling then -this method is faster. Assuming no further recursions occur, the difference can be estimated with the following inequality. - -Let $p$ represent the cost of a single precision addition and $q$ the cost of a single precision multiplication both in terms of time\footnote{Or -machine clock cycles.}. - -\begin{equation} -5pn +{{q(n^2 + n)} \over 2} \le pn + qn^2 -\end{equation} - -For example, on an AMD Athlon XP processor $p = {1 \over 3}$ and $q = 6$. This implies that the following inequality should hold. -\begin{center} -\begin{tabular}{rcl} -${5n \over 3} + 3n^2 + 3n$ & $<$ & ${n \over 3} + 6n^2$ \\ -${5 \over 3} + 3n + 3$ & $<$ & ${1 \over 3} + 6n$ \\ -${13 \over 9}$ & $<$ & $n$ \\ -\end{tabular} -\end{center} - -This results in a cutoff point around $n = 2$. As a consequence it is actually faster to compute the middle term the ``long way'' on processors -where multiplication is substantially slower\footnote{On the Athlon there is a 1:17 ratio between clock cycles for addition and multiplication. On -the Intel P4 processor this ratio is 1:29 making this method even more beneficial. The only common exception is the ARMv4 processor which has a -ratio of 1:7. } than simpler operations such as addition. - -EXAM,bn_mp_karatsuba_sqr.c - -This implementation is largely based on the implementation of algorithm mp\_karatsuba\_mul. It uses the same inline style to copy and -shift the input into the two halves. The loop from line @54,{@ to line @70,}@ has been modified since only one input exists. The \textbf{used} -count of both $x0$ and $x1$ is fixed up and $x0$ is clamped before the calculations begin. At this point $x1$ and $x0$ are valid equivalents -to the respective halves as if mp\_rshd and mp\_mod\_2d had been used. - -By inlining the copy and shift operations the cutoff point for Karatsuba multiplication can be lowered. On the Athlon the cutoff point -is exactly at the point where Comba squaring can no longer be used (\textit{128 digits}). On slower processors such as the Intel P4 -it is actually below the Comba limit (\textit{at 110 digits}). - -This routine uses the same error trap coding style as mp\_karatsuba\_sqr. As the temporary variables are initialized errors are -redirected to the error trap higher up. If the algorithm completes without error the error code is set to \textbf{MP\_OKAY} and -mp\_clears are executed normally. - -\subsection{Toom-Cook Squaring} -The Toom-Cook squaring algorithm mp\_toom\_sqr is heavily based on the algorithm mp\_toom\_mul with the exception that squarings are used -instead of multiplication to find the five relations. The reader is encouraged to read the description of the latter algorithm and try to -derive their own Toom-Cook squaring algorithm. - -\subsection{High Level Squaring} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. If $a.used \ge TOOM\_SQR\_CUTOFF$ then \\ -\hspace{3mm}1.1 $b \leftarrow a^2$ using algorithm mp\_toom\_sqr \\ -2. else if $a.used \ge KARATSUBA\_SQR\_CUTOFF$ then \\ -\hspace{3mm}2.1 $b \leftarrow a^2$ using algorithm mp\_karatsuba\_sqr \\ -3. else \\ -\hspace{3mm}3.1 $digs \leftarrow a.used + b.used + 1$ \\ -\hspace{3mm}3.2 If $digs < MP\_ARRAY$ and $a.used \le \delta$ then \\ -\hspace{6mm}3.2.1 $b \leftarrow a^2$ using algorithm fast\_s\_mp\_sqr. \\ -\hspace{3mm}3.3 else \\ -\hspace{6mm}3.3.1 $b \leftarrow a^2$ using algorithm s\_mp\_sqr. \\ -4. $b.sign \leftarrow MP\_ZPOS$ \\ -5. Return the result of the unsigned squaring performed. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_sqr} -\end{figure} - -\textbf{Algorithm mp\_sqr.} -This algorithm computes the square of the input using one of four different algorithms. If the input is very large and has at least -\textbf{TOOM\_SQR\_CUTOFF} or \textbf{KARATSUBA\_SQR\_CUTOFF} digits then either the Toom-Cook or the Karatsuba Squaring algorithm is used. If -neither of the polynomial basis algorithms should be used then either the Comba or baseline algorithm is used. - -EXAM,bn_mp_sqr.c - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an efficient algorithm for selection of the radix point to handle inputs \\ - & that have different number of digits in Karatsuba multiplication. \\ - & \\ -$\left [ 2 \right ] $ & In ~SQUARE~ the fact that every column of a squaring is made up \\ - & of double products and at most one square is stated. Prove this statement. \\ - & \\ -$\left [ 3 \right ] $ & Prove the equation for Karatsuba squaring. \\ - & \\ -$\left [ 1 \right ] $ & Prove that Karatsuba squaring requires $O \left (n^{lg(3)} \right )$ time. \\ - & \\ -$\left [ 2 \right ] $ & Determine the minimal ratio between addition and multiplication clock cycles \\ - & required for equation $6.7$ to be true. \\ - & \\ -$\left [ 3 \right ] $ & Implement a threaded version of Comba multiplication (and squaring) where you \\ - & compute subsets of the columns in each thread. Determine a cutoff point where \\ - & it is effective and add the logic to mp\_mul() and mp\_sqr(). \\ - &\\ -$\left [ 4 \right ] $ & Same as the previous but also modify the Karatsuba and Toom-Cook. You must \\ - & increase the throughput of mp\_exptmod() for random odd moduli in the range \\ - & $512 \ldots 4096$ bits significantly ($> 2x$) to complete this challenge. \\ - & \\ -\end{tabular} - -\chapter{Modular Reduction} -MARK,REDUCTION -\section{Basics of Modular Reduction} -\index{modular residue} -Modular reduction is an operation that arises quite often within public key cryptography algorithms and various number theoretic algorithms, -such as factoring. Modular reduction algorithms are the third class of algorithms of the ``multipliers'' set. A number $a$ is said to be \textit{reduced} -modulo another number $b$ by finding the remainder of the division $a/b$. Full integer division with remainder is a topic to be covered -in~\ref{sec:division}. - -Modular reduction is equivalent to solving for $r$ in the following equation. $a = bq + r$ where $q = \lfloor a/b \rfloor$. The result -$r$ is said to be ``congruent to $a$ modulo $b$'' which is also written as $r \equiv a \mbox{ (mod }b\mbox{)}$. In other vernacular $r$ is known as the -``modular residue'' which leads to ``quadratic residue''\footnote{That's fancy talk for $b \equiv a^2 \mbox{ (mod }p\mbox{)}$.} and -other forms of residues. - -Modular reductions are normally used to create either finite groups, rings or fields. The most common usage for performance driven modular reductions -is in modular exponentiation algorithms. That is to compute $d = a^b \mbox{ (mod }c\mbox{)}$ as fast as possible. This operation is used in the -RSA and Diffie-Hellman public key algorithms, for example. Modular multiplication and squaring also appears as a fundamental operation in -elliptic curve cryptographic algorithms. As will be discussed in the subsequent chapter there exist fast algorithms for computing modular -exponentiations without having to perform (\textit{in this example}) $b - 1$ multiplications. These algorithms will produce partial results in the -range $0 \le x < c^2$ which can be taken advantage of to create several efficient algorithms. They have also been used to create redundancy check -algorithms known as CRCs, error correction codes such as Reed-Solomon and solve a variety of number theoeretic problems. - -\section{The Barrett Reduction} -The Barrett reduction algorithm \cite{BARRETT} was inspired by fast division algorithms which multiply by the reciprocal to emulate -division. Barretts observation was that the residue $c$ of $a$ modulo $b$ is equal to - -\begin{equation} -c = a - b \cdot \lfloor a/b \rfloor -\end{equation} - -Since algorithms such as modular exponentiation would be using the same modulus extensively, typical DSP\footnote{It is worth noting that Barrett's paper -targeted the DSP56K processor.} intuition would indicate the next step would be to replace $a/b$ by a multiplication by the reciprocal. However, -DSP intuition on its own will not work as these numbers are considerably larger than the precision of common DSP floating point data types. -It would take another common optimization to optimize the algorithm. - -\subsection{Fixed Point Arithmetic} -The trick used to optimize the above equation is based on a technique of emulating floating point data types with fixed precision integers. Fixed -point arithmetic would become very popular as it greatly optimize the ``3d-shooter'' genre of games in the mid 1990s when floating point units were -fairly slow if not unavailable. The idea behind fixed point arithmetic is to take a normal $k$-bit integer data type and break it into $p$-bit -integer and a $q$-bit fraction part (\textit{where $p+q = k$}). - -In this system a $k$-bit integer $n$ would actually represent $n/2^q$. For example, with $q = 4$ the integer $n = 37$ would actually represent the -value $2.3125$. To multiply two fixed point numbers the integers are multiplied using traditional arithmetic and subsequently normalized by -moving the implied decimal point back to where it should be. For example, with $q = 4$ to multiply the integers $9$ and $5$ they must be converted -to fixed point first by multiplying by $2^q$. Let $a = 9(2^q)$ represent the fixed point representation of $9$ and $b = 5(2^q)$ represent the -fixed point representation of $5$. The product $ab$ is equal to $45(2^{2q})$ which when normalized by dividing by $2^q$ produces $45(2^q)$. - -This technique became popular since a normal integer multiplication and logical shift right are the only required operations to perform a multiplication -of two fixed point numbers. Using fixed point arithmetic, division can be easily approximated by multiplying by the reciprocal. If $2^q$ is -equivalent to one than $2^q/b$ is equivalent to the fixed point approximation of $1/b$ using real arithmetic. Using this fact dividing an integer -$a$ by another integer $b$ can be achieved with the following expression. - -\begin{equation} -\lfloor a / b \rfloor \mbox{ }\approx\mbox{ } \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -The precision of the division is proportional to the value of $q$. If the divisor $b$ is used frequently as is the case with -modular exponentiation pre-computing $2^q/b$ will allow a division to be performed with a multiplication and a right shift. Both operations -are considerably faster than division on most processors. - -Consider dividing $19$ by $5$. The correct result is $\lfloor 19/5 \rfloor = 3$. With $q = 3$ the reciprocal is $\lfloor 2^q/5 \rfloor = 1$ which -leads to a product of $19$ which when divided by $2^q$ produces $2$. However, with $q = 4$ the reciprocal is $\lfloor 2^q/5 \rfloor = 3$ and -the result of the emulated division is $\lfloor 3 \cdot 19 / 2^q \rfloor = 3$ which is correct. The value of $2^q$ must be close to or ideally -larger than the dividend. In effect if $a$ is the dividend then $q$ should allow $0 \le \lfloor a/2^q \rfloor \le 1$ in order for this approach -to work correctly. Plugging this form of divison into the original equation the following modular residue equation arises. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -Using the notation from \cite{BARRETT} the value of $\lfloor 2^q / b \rfloor$ will be represented by the $\mu$ symbol. Using the $\mu$ -variable also helps re-inforce the idea that it is meant to be computed once and re-used. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \mu)/2^q \rfloor -\end{equation} - -Provided that $2^q \ge a$ this algorithm will produce a quotient that is either exactly correct or off by a value of one. In the context of Barrett -reduction the value of $a$ is bound by $0 \le a \le (b - 1)^2$ meaning that $2^q \ge b^2$ is sufficient to ensure the reciprocal will have enough -precision. - -Let $n$ represent the number of digits in $b$. This algorithm requires approximately $2n^2$ single precision multiplications to produce the quotient and -another $n^2$ single precision multiplications to find the residue. In total $3n^2$ single precision multiplications are required to -reduce the number. - -For example, if $b = 1179677$ and $q = 41$ ($2^q > b^2$), then the reciprocal $\mu$ is equal to $\lfloor 2^q / b \rfloor = 1864089$. Consider reducing -$a = 180388626447$ modulo $b$ using the above reduction equation. The quotient using the new formula is $\lfloor (a \cdot \mu) / 2^q \rfloor = 152913$. -By subtracting $152913b$ from $a$ the correct residue $a \equiv 677346 \mbox{ (mod }b\mbox{)}$ is found. - -\subsection{Choosing a Radix Point} -Using the fixed point representation a modular reduction can be performed with $3n^2$ single precision multiplications. If that were the best -that could be achieved a full division\footnote{A division requires approximately $O(2cn^2)$ single precision multiplications for a small value of $c$. -See~\ref{sec:division} for further details.} might as well be used in its place. The key to optimizing the reduction is to reduce the precision of -the initial multiplication that finds the quotient. - -Let $a$ represent the number of which the residue is sought. Let $b$ represent the modulus used to find the residue. Let $m$ represent -the number of digits in $b$. For the purposes of this discussion we will assume that the number of digits in $a$ is $2m$, which is generally true if -two $m$-digit numbers have been multiplied. Dividing $a$ by $b$ is the same as dividing a $2m$ digit integer by a $m$ digit integer. Digits below the -$m - 1$'th digit of $a$ will contribute at most a value of $1$ to the quotient because $\beta^k < b$ for any $0 \le k \le m - 1$. Another way to -express this is by re-writing $a$ as two parts. If $a' \equiv a \mbox{ (mod }b^m\mbox{)}$ and $a'' = a - a'$ then -${a \over b} \equiv {{a' + a''} \over b}$ which is equivalent to ${a' \over b} + {a'' \over b}$. Since $a'$ is bound to be less than $b$ the quotient -is bound by $0 \le {a' \over b} < 1$. - -Since the digits of $a'$ do not contribute much to the quotient the observation is that they might as well be zero. However, if the digits -``might as well be zero'' they might as well not be there in the first place. Let $q_0 = \lfloor a/\beta^{m-1} \rfloor$ represent the input -with the irrelevant digits trimmed. Now the modular reduction is trimmed to the almost equivalent equation - -\begin{equation} -c = a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor -\end{equation} - -Note that the original divisor $2^q$ has been replaced with $\beta^{m+1}$ where in this case $q$ is a multiple of $lg(\beta)$. Also note that the -exponent on the divisor when added to the amount $q_0$ was shifted by equals $2m$. If the optimization had not been performed the divisor -would have the exponent $2m$ so in the end the exponents do ``add up''. Using the above equation the quotient -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ can be off from the true quotient by at most two. The original fixed point quotient can be off -by as much as one (\textit{provided the radix point is chosen suitably}) and now that the lower irrelevent digits have been trimmed the quotient -can be off by an additional value of one for a total of at most two. This implies that -$0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. By first subtracting $b$ times the quotient and then conditionally subtracting -$b$ once or twice the residue is found. - -The quotient is now found using $(m + 1)(m) = m^2 + m$ single precision multiplications and the residue with an additional $m^2$ single -precision multiplications, ignoring the subtractions required. In total $2m^2 + m$ single precision multiplications are required to find the residue. -This is considerably faster than the original attempt. - -For example, let $\beta = 10$ represent the radix of the digits. Let $b = 9999$ represent the modulus which implies $m = 4$. Let $a = 99929878$ -represent the value of which the residue is desired. In this case $q = 8$ since $10^7 < 9999^2$ meaning that $\mu = \lfloor \beta^{q}/b \rfloor = 10001$. -With the new observation the multiplicand for the quotient is equal to $q_0 = \lfloor a / \beta^{m - 1} \rfloor = 99929$. The quotient is then -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor = 9993$. Subtracting $9993b$ from $a$ and the correct residue $a \equiv 9871 \mbox{ (mod }b\mbox{)}$ -is found. - -\subsection{Trimming the Quotient} -So far the reduction algorithm has been optimized from $3m^2$ single precision multiplications down to $2m^2 + m$ single precision multiplications. As -it stands now the algorithm is already fairly fast compared to a full integer division algorithm. However, there is still room for -optimization. - -After the first multiplication inside the quotient ($q_0 \cdot \mu$) the value is shifted right by $m + 1$ places effectively nullifying the lower -half of the product. It would be nice to be able to remove those digits from the product to effectively cut down the number of single precision -multiplications. If the number of digits in the modulus $m$ is far less than $\beta$ a full product is not required for the algorithm to work properly. -In fact the lower $m - 2$ digits will not affect the upper half of the product at all and do not need to be computed. - -The value of $\mu$ is a $m$-digit number and $q_0$ is a $m + 1$ digit number. Using a full multiplier $(m + 1)(m) = m^2 + m$ single precision -multiplications would be required. Using a multiplier that will only produce digits at and above the $m - 1$'th digit reduces the number -of single precision multiplications to ${m^2 + m} \over 2$ single precision multiplications. - -\subsection{Trimming the Residue} -After the quotient has been calculated it is used to reduce the input. As previously noted the algorithm is not exact and it can be off by a small -multiple of the modulus, that is $0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. If $b$ is $m$ digits than the -result of reduction equation is a value of at most $m + 1$ digits (\textit{provided $3 < \beta$}) implying that the upper $m - 1$ digits are -implicitly zero. - -The next optimization arises from this very fact. Instead of computing $b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ using a full -$O(m^2)$ multiplication algorithm only the lower $m+1$ digits of the product have to be computed. Similarly the value of $a$ can -be reduced modulo $\beta^{m+1}$ before the multiple of $b$ is subtracted which simplifes the subtraction as well. A multiplication that produces -only the lower $m+1$ digits requires ${m^2 + 3m - 2} \over 2$ single precision multiplications. - -With both optimizations in place the algorithm is the algorithm Barrett proposed. It requires $m^2 + 2m - 1$ single precision multiplications which -is considerably faster than the straightforward $3m^2$ method. - -\subsection{The Barrett Algorithm} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and $\mu = \lfloor \beta^{2m}/b \rfloor, m = \lceil lg_{\beta}(b) \rceil, (0 \le a < b^2, b > 1)$ \\ -\textbf{Output}. $a \mbox{ (mod }b\mbox{)}$ \\ -\hline \\ -Let $m$ represent the number of digits in $b$. \\ -1. Make a copy of $a$ and store it in $q$. (\textit{mp\_init\_copy}) \\ -2. $q \leftarrow \lfloor q / \beta^{m - 1} \rfloor$ (\textit{mp\_rshd}) \\ -\\ -Produce the quotient. \\ -3. $q \leftarrow q \cdot \mu$ (\textit{note: only produce digits at or above $m-1$}) \\ -4. $q \leftarrow \lfloor q / \beta^{m + 1} \rfloor$ \\ -\\ -Subtract the multiple of modulus from the input. \\ -5. $a \leftarrow a \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -6. $q \leftarrow q \cdot b \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{s\_mp\_mul\_digs}) \\ -7. $a \leftarrow a - q$ (\textit{mp\_sub}) \\ -\\ -Add $\beta^{m+1}$ if a carry occured. \\ -8. If $a < 0$ then (\textit{mp\_cmp\_d}) \\ -\hspace{3mm}8.1 $q \leftarrow 1$ (\textit{mp\_set}) \\ -\hspace{3mm}8.2 $q \leftarrow q \cdot \beta^{m+1}$ (\textit{mp\_lshd}) \\ -\hspace{3mm}8.3 $a \leftarrow a + q$ \\ -\\ -Now subtract the modulus if the residue is too large (e.g. quotient too small). \\ -9. While $a \ge b$ do (\textit{mp\_cmp}) \\ -\hspace{3mm}9.1 $c \leftarrow a - b$ \\ -10. Clear $q$. \\ -11. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce} -\end{figure} - -\textbf{Algorithm mp\_reduce.} -This algorithm will reduce the input $a$ modulo $b$ in place using the Barrett algorithm. It is loosely based on algorithm 14.42 of HAC -\cite[pp. 602]{HAC} which is based on the paper from Paul Barrett \cite{BARRETT}. The algorithm has several restrictions and assumptions which must -be adhered to for the algorithm to work. - -First the modulus $b$ is assumed to be positive and greater than one. If the modulus were less than or equal to one than subtracting -a multiple of it would either accomplish nothing or actually enlarge the input. The input $a$ must be in the range $0 \le a < b^2$ in order -for the quotient to have enough precision. If $a$ is the product of two numbers that were already reduced modulo $b$, this will not be a problem. -Technically the algorithm will still work if $a \ge b^2$ but it will take much longer to finish. The value of $\mu$ is passed as an argument to this -algorithm and is assumed to be calculated and stored before the algorithm is used. - -Recall that the multiplication for the quotient on step 3 must only produce digits at or above the $m-1$'th position. An algorithm called -$s\_mp\_mul\_high\_digs$ which has not been presented is used to accomplish this task. The algorithm is based on $s\_mp\_mul\_digs$ except that -instead of stopping at a given level of precision it starts at a given level of precision. This optimal algorithm can only be used if the number -of digits in $b$ is very much smaller than $\beta$. - -While it is known that -$a \ge b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ only the lower $m+1$ digits are being used to compute the residue, so an implied -``borrow'' from the higher digits might leave a negative result. After the multiple of the modulus has been subtracted from $a$ the residue must be -fixed up in case it is negative. The invariant $\beta^{m+1}$ must be added to the residue to make it positive again. - -The while loop at step 9 will subtract $b$ until the residue is less than $b$. If the algorithm is performed correctly this step is -performed at most twice, and on average once. However, if $a \ge b^2$ than it will iterate substantially more times than it should. - -EXAM,bn_mp_reduce.c - -The first multiplication that determines the quotient can be performed by only producing the digits from $m - 1$ and up. This essentially halves -the number of single precision multiplications required. However, the optimization is only safe if $\beta$ is much larger than the number of digits -in the modulus. In the source code this is evaluated on lines @36,if@ to @44,}@ where algorithm s\_mp\_mul\_high\_digs is used when it is -safe to do so. - -\subsection{The Barrett Setup Algorithm} -In order to use algorithm mp\_reduce the value of $\mu$ must be calculated in advance. Ideally this value should be computed once and stored for -future use so that the Barrett algorithm can be used without delay. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_setup}. \\ -\textbf{Input}. mp\_int $a$ ($a > 1$) \\ -\textbf{Output}. $\mu \leftarrow \lfloor \beta^{2m}/a \rfloor$ \\ -\hline \\ -1. $\mu \leftarrow 2^{2 \cdot lg(\beta) \cdot m}$ (\textit{mp\_2expt}) \\ -2. $\mu \leftarrow \lfloor \mu / b \rfloor$ (\textit{mp\_div}) \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_setup.} -This algorithm computes the reciprocal $\mu$ required for Barrett reduction. First $\beta^{2m}$ is calculated as $2^{2 \cdot lg(\beta) \cdot m}$ which -is equivalent and much faster. The final value is computed by taking the integer quotient of $\lfloor \mu / b \rfloor$. - -EXAM,bn_mp_reduce_setup.c - -This simple routine calculates the reciprocal $\mu$ required by Barrett reduction. Note the extended usage of algorithm mp\_div where the variable -which would received the remainder is passed as NULL. As will be discussed in~\ref{sec:division} the division routine allows both the quotient and the -remainder to be passed as NULL meaning to ignore the value. - -\section{The Montgomery Reduction} -Montgomery reduction\footnote{Thanks to Niels Ferguson for his insightful explanation of the algorithm.} \cite{MONT} is by far the most interesting -form of reduction in common use. It computes a modular residue which is not actually equal to the residue of the input yet instead equal to a -residue times a constant. However, as perplexing as this may sound the algorithm is relatively simple and very efficient. - -Throughout this entire section the variable $n$ will represent the modulus used to form the residue. As will be discussed shortly the value of -$n$ must be odd. The variable $x$ will represent the quantity of which the residue is sought. Similar to the Barrett algorithm the input -is restricted to $0 \le x < n^2$. To begin the description some simple number theory facts must be established. - -\textbf{Fact 1.} Adding $n$ to $x$ does not change the residue since in effect it adds one to the quotient $\lfloor x / n \rfloor$. Another way -to explain this is that $n$ is (\textit{or multiples of $n$ are}) congruent to zero modulo $n$. Adding zero will not change the value of the residue. - -\textbf{Fact 2.} If $x$ is even then performing a division by two in $\Z$ is congruent to $x \cdot 2^{-1} \mbox{ (mod }n\mbox{)}$. Actually -this is an application of the fact that if $x$ is evenly divisible by any $k \in \Z$ then division in $\Z$ will be congruent to -multiplication by $k^{-1}$ modulo $n$. - -From these two simple facts the following simple algorithm can be derived. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction}. \\ -\textbf{Input}. Integer $x$, $n$ and $k$ \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If $x$ is odd then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + n$ \\ -\hspace{3mm}1.2 $x \leftarrow x/2$ \\ -2. Return $x$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction} -\end{figure} - -The algorithm reduces the input one bit at a time using the two congruencies stated previously. Inside the loop $n$, which is odd, is -added to $x$ if $x$ is odd. This forces $x$ to be even which allows the division by two in $\Z$ to be congruent to a modular division by two. Since -$x$ is assumed to be initially much larger than $n$ the addition of $n$ will contribute an insignificant magnitude to $x$. Let $r$ represent the -final result of the Montgomery algorithm. If $k > lg(n)$ and $0 \le x < n^2$ then the final result is limited to -$0 \le r < \lfloor x/2^k \rfloor + n$. As a result at most a single subtraction is required to get the residue desired. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} \\ -\hline $1$ & $x + n = 5812$, $x/2 = 2906$ \\ -\hline $2$ & $x/2 = 1453$ \\ -\hline $3$ & $x + n = 1710$, $x/2 = 855$ \\ -\hline $4$ & $x + n = 1112$, $x/2 = 556$ \\ -\hline $5$ & $x/2 = 278$ \\ -\hline $6$ & $x/2 = 139$ \\ -\hline $7$ & $x + n = 396$, $x/2 = 198$ \\ -\hline $8$ & $x/2 = 99$ \\ -\hline $9$ & $x + n = 356$, $x/2 = 178$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (I)} -\label{fig:MONT1} -\end{figure} - -Consider the example in figure~\ref{fig:MONT1} which reduces $x = 5555$ modulo $n = 257$ when $k = 9$ (note $\beta^k = 512$ which is larger than $n$). The result of -the algorithm $r = 178$ is congruent to the value of $2^{-9} \cdot 5555 \mbox{ (mod }257\mbox{)}$. When $r$ is multiplied by $2^9$ modulo $257$ the correct residue -$r \equiv 158$ is produced. - -Let $k = \lfloor lg(n) \rfloor + 1$ represent the number of bits in $n$. The current algorithm requires $2k^2$ single precision shifts -and $k^2$ single precision additions. At this rate the algorithm is most certainly slower than Barrett reduction and not terribly useful. -Fortunately there exists an alternative representation of the algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified I). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($2^k > n$) \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If the $t$'th bit of $x$ is one then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + 2^tn$ \\ -2. Return $x/2^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified I)} -\end{figure} - -This algorithm is equivalent since $2^tn$ is a multiple of $n$ and the lower $k$ bits of $x$ are zero by step 2. The number of single -precision shifts has now been reduced from $2k^2$ to $k^2 + k$ which is only a small improvement. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|r|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} & \textbf{Result ($x$) in Binary} \\ -\hline -- & $5555$ & $1010110110011$ \\ -\hline $1$ & $x + 2^{0}n = 5812$ & $1011010110100$ \\ -\hline $2$ & $5812$ & $1011010110100$ \\ -\hline $3$ & $x + 2^{2}n = 6840$ & $1101010111000$ \\ -\hline $4$ & $x + 2^{3}n = 8896$ & $10001011000000$ \\ -\hline $5$ & $8896$ & $10001011000000$ \\ -\hline $6$ & $8896$ & $10001011000000$ \\ -\hline $7$ & $x + 2^{6}n = 25344$ & $110001100000000$ \\ -\hline $8$ & $25344$ & $110001100000000$ \\ -\hline $9$ & $x + 2^{7}n = 91136$ & $10110010000000000$ \\ -\hline -- & $x/2^k = 178$ & \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (II)} -\label{fig:MONT2} -\end{figure} - -Figure~\ref{fig:MONT2} demonstrates the modified algorithm reducing $x = 5555$ modulo $n = 257$ with $k = 9$. -With this algorithm a single shift right at the end is the only right shift required to reduce the input instead of $k$ right shifts inside the -loop. Note that for the iterations $t = 2, 5, 6$ and $8$ where the result $x$ is not changed. In those iterations the $t$'th bit of $x$ is -zero and the appropriate multiple of $n$ does not need to be added to force the $t$'th bit of the result to zero. - -\subsection{Digit Based Montgomery Reduction} -Instead of computing the reduction on a bit-by-bit basis it is actually much faster to compute it on digit-by-digit basis. Consider the -previous algorithm re-written to compute the Montgomery reduction in this new fashion. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified II). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($\beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $x \leftarrow x + \mu n \beta^t$ \\ -2. Return $x/\beta^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified II)} -\end{figure} - -The value $\mu n \beta^t$ is a multiple of the modulus $n$ meaning that it will not change the residue. If the first digit of -the value $\mu n \beta^t$ equals the negative (modulo $\beta$) of the $t$'th digit of $x$ then the addition will result in a zero digit. This -problem breaks down to solving the following congruency. - -\begin{center} -\begin{tabular}{rcl} -$x_t + \mu n_0$ & $\equiv$ & $0 \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu n_0$ & $\equiv$ & $-x_t \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu$ & $\equiv$ & $-x_t/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\end{tabular} -\end{center} - -In each iteration of the loop on step 1 a new value of $\mu$ must be calculated. The value of $-1/n_0 \mbox{ (mod }\beta\mbox{)}$ is used -extensively in this algorithm and should be precomputed. Let $\rho$ represent the negative of the modular inverse of $n_0$ modulo $\beta$. - -For example, let $\beta = 10$ represent the radix. Let $n = 17$ represent the modulus which implies $k = 2$ and $\rho \equiv 7$. Let $x = 33$ -represent the value to reduce. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Step ($t$)} & \textbf{Value of $x$} & \textbf{Value of $\mu$} \\ -\hline -- & $33$ & --\\ -\hline $0$ & $33 + \mu n = 50$ & $1$ \\ -\hline $1$ & $50 + \mu n \beta = 900$ & $5$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Montgomery Reduction} -\end{figure} - -The final result $900$ is then divided by $\beta^k$ to produce the final result $9$. The first observation is that $9 \nequiv x \mbox{ (mod }n\mbox{)}$ -which implies the result is not the modular residue of $x$ modulo $n$. However, recall that the residue is actually multiplied by $\beta^{-k}$ in -the algorithm. To get the true residue the value must be multiplied by $\beta^k$. In this case $\beta^k \equiv 15 \mbox{ (mod }n\mbox{)}$ and -the correct residue is $9 \cdot 15 \equiv 16 \mbox{ (mod }n\mbox{)}$. - -\subsection{Baseline Montgomery Reduction} -The baseline Montgomery reduction algorithm will produce the residue for any size input. It is designed to be a catch-all algororithm for -Montgomery reductions. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. $digs \leftarrow 2n.used + 1$ \\ -2. If $digs < MP\_ARRAY$ and $m.used < \delta$ then \\ -\hspace{3mm}2.1 Use algorithm fast\_mp\_montgomery\_reduce instead. \\ -\\ -Setup $x$ for the reduction. \\ -3. If $x.alloc < digs$ then grow $x$ to $digs$ digits. \\ -4. $x.used \leftarrow digs$ \\ -\\ -Eliminate the lower $k$ digits. \\ -5. For $ix$ from $0$ to $k - 1$ do \\ -\hspace{3mm}5.1 $\mu \leftarrow x_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.2 $u \leftarrow 0$ \\ -\hspace{3mm}5.3 For $iy$ from $0$ to $k - 1$ do \\ -\hspace{6mm}5.3.1 $\hat r \leftarrow \mu n_{iy} + x_{ix + iy} + u$ \\ -\hspace{6mm}5.3.2 $x_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.3.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.4 While $u > 0$ do \\ -\hspace{6mm}5.4.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}5.4.2 $x_{ix + iy} \leftarrow x_{ix + iy} + u$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor x_{ix+iy} / \beta \rfloor$ \\ -\hspace{6mm}5.4.4 $x_{ix + iy} \leftarrow x_{ix+iy} \mbox{ (mod }\beta\mbox{)}$ \\ -\\ -Divide by $\beta^k$ and fix up as required. \\ -6. $x \leftarrow \lfloor x / \beta^k \rfloor$ \\ -7. If $x \ge n$ then \\ -\hspace{3mm}7.1 $x \leftarrow x - n$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_reduce.} -This algorithm reduces the input $x$ modulo $n$ in place using the Montgomery reduction algorithm. The algorithm is loosely based -on algorithm 14.32 of \cite[pp.601]{HAC} except it merges the multiplication of $\mu n \beta^t$ with the addition in the inner loop. The -restrictions on this algorithm are fairly easy to adapt to. First $0 \le x < n^2$ bounds the input to numbers in the same range as -for the Barrett algorithm. Additionally if $n > 1$ and $n$ is odd there will exist a modular inverse $\rho$. $\rho$ must be calculated in -advance of this algorithm. Finally the variable $k$ is fixed and a pseudonym for $n.used$. - -Step 2 decides whether a faster Montgomery algorithm can be used. It is based on the Comba technique meaning that there are limits on -the size of the input. This algorithm is discussed in ~COMBARED~. - -Step 5 is the main reduction loop of the algorithm. The value of $\mu$ is calculated once per iteration in the outer loop. The inner loop -calculates $x + \mu n \beta^{ix}$ by multiplying $\mu n$ and adding the result to $x$ shifted by $ix$ digits. Both the addition and -multiplication are performed in the same loop to save time and memory. Step 5.4 will handle any additional carries that escape the inner loop. - -Using a quick inspection this algorithm requires $n$ single precision multiplications for the outer loop and $n^2$ single precision multiplications -in the inner loop. In total $n^2 + n$ single precision multiplications which compares favourably to Barrett at $n^2 + 2n - 1$ single precision -multiplications. - -EXAM,bn_mp_montgomery_reduce.c - -This is the baseline implementation of the Montgomery reduction algorithm. Lines @30,digs@ to @35,}@ determine if the Comba based -routine can be used instead. Line @47,mu@ computes the value of $\mu$ for that particular iteration of the outer loop. - -The multiplication $\mu n \beta^{ix}$ is performed in one step in the inner loop. The alias $tmpx$ refers to the $ix$'th digit of $x$ and -the alias $tmpn$ refers to the modulus $n$. - -\subsection{Faster ``Comba'' Montgomery Reduction} -MARK,COMBARED - -The Montgomery reduction requires fewer single precision multiplications than a Barrett reduction, however it is much slower due to the serial -nature of the inner loop. The Barrett reduction algorithm requires two slightly modified multipliers which can be implemented with the Comba -technique. The Montgomery reduction algorithm cannot directly use the Comba technique to any significant advantage since the inner loop calculates -a $k \times 1$ product $k$ times. - -The biggest obstacle is that at the $ix$'th iteration of the outer loop the value of $x_{ix}$ is required to calculate $\mu$. This means the -carries from $0$ to $ix - 1$ must have been propagated upwards to form a valid $ix$'th digit. The solution as it turns out is very simple. -Perform a Comba like multiplier and inside the outer loop just after the inner loop fix up the $ix + 1$'th digit by forwarding the carry. - -With this change in place the Montgomery reduction algorithm can be performed with a Comba style multiplication loop which substantially increases -the speed of the algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_word variables called $\hat W$ on the stack. \\ -1. if $x.alloc < n.used + 1$ then grow $x$ to $n.used + 1$ digits. \\ -Copy the digits of $x$ into the array $\hat W$ \\ -2. For $ix$ from $0$ to $x.used - 1$ do \\ -\hspace{3mm}2.1 $\hat W_{ix} \leftarrow x_{ix}$ \\ -3. For $ix$ from $x.used$ to $2n.used - 1$ do \\ -\hspace{3mm}3.1 $\hat W_{ix} \leftarrow 0$ \\ -Elimiate the lower $k$ digits. \\ -4. for $ix$ from $0$ to $n.used - 1$ do \\ -\hspace{3mm}4.1 $\mu \leftarrow \hat W_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.2 For $iy$ from $0$ to $n.used - 1$ do \\ -\hspace{6mm}4.2.1 $\hat W_{iy + ix} \leftarrow \hat W_{iy + ix} + \mu \cdot n_{iy}$ \\ -\hspace{3mm}4.3 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Propagate carries upwards. \\ -5. for $ix$ from $n.used$ to $2n.used + 1$ do \\ -\hspace{3mm}5.1 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Shift right and reduce modulo $\beta$ simultaneously. \\ -6. for $ix$ from $0$ to $n.used + 1$ do \\ -\hspace{3mm}6.1 $x_{ix} \leftarrow \hat W_{ix + n.used} \mbox{ (mod }\beta\mbox{)}$ \\ -Zero excess digits and fixup $x$. \\ -7. if $x.used > n.used + 1$ then do \\ -\hspace{3mm}7.1 for $ix$ from $n.used + 1$ to $x.used - 1$ do \\ -\hspace{6mm}7.1.1 $x_{ix} \leftarrow 0$ \\ -8. $x.used \leftarrow n.used + 1$ \\ -9. Clamp excessive digits of $x$. \\ -10. If $x \ge n$ then \\ -\hspace{3mm}10.1 $x \leftarrow x - n$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm fast\_mp\_montgomery\_reduce.} -This algorithm will compute the Montgomery reduction of $x$ modulo $n$ using the Comba technique. It is on most computer platforms significantly -faster than algorithm mp\_montgomery\_reduce and algorithm mp\_reduce (\textit{Barrett reduction}). The algorithm has the same restrictions -on the input as the baseline reduction algorithm. An additional two restrictions are imposed on this algorithm. The number of digits $k$ in the -the modulus $n$ must not violate $MP\_WARRAY > 2k +1$ and $n < \delta$. When $\beta = 2^{28}$ this algorithm can be used to reduce modulo -a modulus of at most $3,556$ bits in length. - -As in the other Comba reduction algorithms there is a $\hat W$ array which stores the columns of the product. It is initially filled with the -contents of $x$ with the excess digits zeroed. The reduction loop is very similar the to the baseline loop at heart. The multiplication on step -4.1 can be single precision only since $ab \mbox{ (mod }\beta\mbox{)} \equiv (a \mbox{ mod }\beta)(b \mbox{ mod }\beta)$. Some multipliers such -as those on the ARM processors take a variable length time to complete depending on the number of bytes of result it must produce. By performing -a single precision multiplication instead half the amount of time is spent. - -Also note that digit $\hat W_{ix}$ must have the carry from the $ix - 1$'th digit propagated upwards in order for this to work. That is what step -4.3 will do. In effect over the $n.used$ iterations of the outer loop the $n.used$'th lower columns all have the their carries propagated forwards. Note -how the upper bits of those same words are not reduced modulo $\beta$. This is because those values will be discarded shortly and there is no -point. - -Step 5 will propagate the remainder of the carries upwards. On step 6 the columns are reduced modulo $\beta$ and shifted simultaneously as they are -stored in the destination $x$. - -EXAM,bn_fast_mp_montgomery_reduce.c - -The $\hat W$ array is first filled with digits of $x$ on line @49,for@ then the rest of the digits are zeroed on line @54,for@. Both loops share -the same alias variables to make the code easier to read. - -The value of $\mu$ is calculated in an interesting fashion. First the value $\hat W_{ix}$ is reduced modulo $\beta$ and cast to a mp\_digit. This -forces the compiler to use a single precision multiplication and prevents any concerns about loss of precision. Line @101,>>@ fixes the carry -for the next iteration of the loop by propagating the carry from $\hat W_{ix}$ to $\hat W_{ix+1}$. - -The for loop on line @113,for@ propagates the rest of the carries upwards through the columns. The for loop on line @126,for@ reduces the columns -modulo $\beta$ and shifts them $k$ places at the same time. The alias $\_ \hat W$ actually refers to the array $\hat W$ starting at the $n.used$'th -digit, that is $\_ \hat W_{t} = \hat W_{n.used + t}$. - -\subsection{Montgomery Setup} -To calculate the variable $\rho$ a relatively simple algorithm will be required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_setup}. \\ -\textbf{Input}. mp\_int $n$ ($n > 1$ and $(n, 2) = 1$) \\ -\textbf{Output}. $\rho \equiv -1/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\hline \\ -1. $b \leftarrow n_0$ \\ -2. If $b$ is even return(\textit{MP\_VAL}) \\ -3. $x \leftarrow (((b + 2) \mbox{ AND } 4) << 1) + b$ \\ -4. for $k$ from 0 to $\lceil lg(lg(\beta)) \rceil - 2$ do \\ -\hspace{3mm}4.1 $x \leftarrow x \cdot (2 - bx)$ \\ -5. $\rho \leftarrow \beta - x \mbox{ (mod }\beta\mbox{)}$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_setup} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_setup.} -This algorithm will calculate the value of $\rho$ required within the Montgomery reduction algorithms. It uses a very interesting trick -to calculate $1/n_0$ when $\beta$ is a power of two. - -EXAM,bn_mp_montgomery_setup.c - -This source code computes the value of $\rho$ required to perform Montgomery reduction. It has been modified to avoid performing excess -multiplications when $\beta$ is not the default 28-bits. - -\section{The Diminished Radix Algorithm} -The Diminished Radix method of modular reduction \cite{DRMET} is a fairly clever technique which can be more efficient than either the Barrett -or Montgomery methods for certain forms of moduli. The technique is based on the following simple congruence. - -\begin{equation} -(x \mbox{ mod } n) + k \lfloor x / n \rfloor \equiv x \mbox{ (mod }(n - k)\mbox{)} -\end{equation} - -This observation was used in the MMB \cite{MMB} block cipher to create a diffusion primitive. It used the fact that if $n = 2^{31}$ and $k=1$ that -then a x86 multiplier could produce the 62-bit product and use the ``shrd'' instruction to perform a double-precision right shift. The proof -of the above equation is very simple. First write $x$ in the product form. - -\begin{equation} -x = qn + r -\end{equation} - -Now reduce both sides modulo $(n - k)$. - -\begin{equation} -x \equiv qk + r \mbox{ (mod }(n-k)\mbox{)} -\end{equation} - -The variable $n$ reduces modulo $n - k$ to $k$. By putting $q = \lfloor x/n \rfloor$ and $r = x \mbox{ mod } n$ -into the equation the original congruence is reproduced, thus concluding the proof. The following algorithm is based on this observation. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Diminished Radix Reduction}. \\ -\textbf{Input}. Integer $x$, $n$, $k$ \\ -\textbf{Output}. $x \mbox{ mod } (n - k)$ \\ -\hline \\ -1. $q \leftarrow \lfloor x / n \rfloor$ \\ -2. $q \leftarrow k \cdot q$ \\ -3. $x \leftarrow x \mbox{ (mod }n\mbox{)}$ \\ -4. $x \leftarrow x + q$ \\ -5. If $x \ge (n - k)$ then \\ -\hspace{3mm}5.1 $x \leftarrow x - (n - k)$ \\ -\hspace{3mm}5.2 Goto step 1. \\ -6. Return $x$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Diminished Radix Reduction} -\label{fig:DR} -\end{figure} - -This algorithm will reduce $x$ modulo $n - k$ and return the residue. If $0 \le x < (n - k)^2$ then the algorithm will loop almost always -once or twice and occasionally three times. For simplicity sake the value of $x$ is bounded by the following simple polynomial. - -\begin{equation} -0 \le x < n^2 + k^2 - 2nk -\end{equation} - -The true bound is $0 \le x < (n - k - 1)^2$ but this has quite a few more terms. The value of $q$ after step 1 is bounded by the following. - -\begin{equation} -q < n - 2k - k^2/n -\end{equation} - -Since $k^2$ is going to be considerably smaller than $n$ that term will always be zero. The value of $x$ after step 3 is bounded trivially as -$0 \le x < n$. By step four the sum $x + q$ is bounded by - -\begin{equation} -0 \le q + x < (k + 1)n - 2k^2 - 1 -\end{equation} - -With a second pass $q$ will be loosely bounded by $0 \le q < k^2$ after step 2 while $x$ will still be loosely bounded by $0 \le x < n$ after step 3. After the second pass it is highly unlike that the -sum in step 4 will exceed $n - k$. In practice fewer than three passes of the algorithm are required to reduce virtually every input in the -range $0 \le x < (n - k - 1)^2$. - -\begin{figure} -\begin{small} -\begin{center} -\begin{tabular}{|l|} -\hline -$x = 123456789, n = 256, k = 3$ \\ -\hline $q \leftarrow \lfloor x/n \rfloor = 482253$ \\ -$q \leftarrow q*k = 1446759$ \\ -$x \leftarrow x \mbox{ mod } n = 21$ \\ -$x \leftarrow x + q = 1446780$ \\ -$x \leftarrow x - (n - k) = 1446527$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 5650$ \\ -$q \leftarrow q*k = 16950$ \\ -$x \leftarrow x \mbox{ mod } n = 127$ \\ -$x \leftarrow x + q = 17077$ \\ -$x \leftarrow x - (n - k) = 16824$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 65$ \\ -$q \leftarrow q*k = 195$ \\ -$x \leftarrow x \mbox{ mod } n = 184$ \\ -$x \leftarrow x + q = 379$ \\ -$x \leftarrow x - (n - k) = 126$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example Diminished Radix Reduction} -\label{fig:EXDR} -\end{figure} - -Figure~\ref{fig:EXDR} demonstrates the reduction of $x = 123456789$ modulo $n - k = 253$ when $n = 256$ and $k = 3$. Note that even while $x$ -is considerably larger than $(n - k - 1)^2 = 63504$ the algorithm still converges on the modular residue exceedingly fast. In this case only -three passes were required to find the residue $x \equiv 126$. - - -\subsection{Choice of Moduli} -On the surface this algorithm looks like a very expensive algorithm. It requires a couple of subtractions followed by multiplication and other -modular reductions. The usefulness of this algorithm becomes exceedingly clear when an appropriate modulus is chosen. - -Division in general is a very expensive operation to perform. The one exception is when the division is by a power of the radix of representation used. -Division by ten for example is simple for pencil and paper mathematics since it amounts to shifting the decimal place to the right. Similarly division -by two (\textit{or powers of two}) is very simple for binary computers to perform. It would therefore seem logical to choose $n$ of the form $2^p$ -which would imply that $\lfloor x / n \rfloor$ is a simple shift of $x$ right $p$ bits. - -However, there is one operation related to division of power of twos that is even faster than this. If $n = \beta^p$ then the division may be -performed by moving whole digits to the right $p$ places. In practice division by $\beta^p$ is much faster than division by $2^p$ for any $p$. -Also with the choice of $n = \beta^p$ reducing $x$ modulo $n$ merely requires zeroing the digits above the $p-1$'th digit of $x$. - -Throughout the next section the term ``restricted modulus'' will refer to a modulus of the form $\beta^p - k$ whereas the term ``unrestricted -modulus'' will refer to a modulus of the form $2^p - k$. The word ``restricted'' in this case refers to the fact that it is based on the -$2^p$ logic except $p$ must be a multiple of $lg(\beta)$. - -\subsection{Choice of $k$} -Now that division and reduction (\textit{step 1 and 3 of figure~\ref{fig:DR}}) have been optimized to simple digit operations the multiplication by $k$ -in step 2 is the most expensive operation. Fortunately the choice of $k$ is not terribly limited. For all intents and purposes it might -as well be a single digit. The smaller the value of $k$ is the faster the algorithm will be. - -\subsection{Restricted Diminished Radix Reduction} -The restricted Diminished Radix algorithm can quickly reduce an input modulo a modulus of the form $n = \beta^p - k$. This algorithm can reduce -an input $x$ within the range $0 \le x < n^2$ using only a couple passes of the algorithm demonstrated in figure~\ref{fig:DR}. The implementation -of this algorithm has been optimized to avoid additional overhead associated with a division by $\beta^p$, the multiplication by $k$ or the addition -of $x$ and $q$. The resulting algorithm is very efficient and can lead to substantial improvements over Barrett and Montgomery reduction when modular -exponentiations are performed. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_reduce}. \\ -\textbf{Input}. mp\_int $x$, $n$ and a mp\_digit $k = \beta - n_0$ \\ -\hspace{11.5mm}($0 \le x < n^2$, $n > 1$, $0 < k < \beta$) \\ -\textbf{Output}. $x \mbox{ mod } n$ \\ -\hline \\ -1. $m \leftarrow n.used$ \\ -2. If $x.alloc < 2m$ then grow $x$ to $2m$ digits. \\ -3. $\mu \leftarrow 0$ \\ -4. for $i$ from $0$ to $m - 1$ do \\ -\hspace{3mm}4.1 $\hat r \leftarrow k \cdot x_{m+i} + x_{i} + \mu$ \\ -\hspace{3mm}4.2 $x_{i} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. $x_{m} \leftarrow \mu$ \\ -6. for $i$ from $m + 1$ to $x.used - 1$ do \\ -\hspace{3mm}6.1 $x_{i} \leftarrow 0$ \\ -7. Clamp excess digits of $x$. \\ -8. If $x \ge n$ then \\ -\hspace{3mm}8.1 $x \leftarrow x - n$ \\ -\hspace{3mm}8.2 Goto step 3. \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_reduce} -\end{figure} - -\textbf{Algorithm mp\_dr\_reduce.} -This algorithm will perform the Dimished Radix reduction of $x$ modulo $n$. It has similar restrictions to that of the Barrett reduction -with the addition that $n$ must be of the form $n = \beta^m - k$ where $0 < k <\beta$. - -This algorithm essentially implements the pseudo-code in figure~\ref{fig:DR} except with a slight optimization. The division by $\beta^m$, multiplication by $k$ -and addition of $x \mbox{ mod }\beta^m$ are all performed simultaneously inside the loop on step 4. The division by $\beta^m$ is emulated by accessing -the term at the $m+i$'th position which is subsequently multiplied by $k$ and added to the term at the $i$'th position. After the loop the $m$'th -digit is set to the carry and the upper digits are zeroed. Steps 5 and 6 emulate the reduction modulo $\beta^m$ that should have happend to -$x$ before the addition of the multiple of the upper half. - -At step 8 if $x$ is still larger than $n$ another pass of the algorithm is required. First $n$ is subtracted from $x$ and then the algorithm resumes -at step 3. - -EXAM,bn_mp_dr_reduce.c - -The first step is to grow $x$ as required to $2m$ digits since the reduction is performed in place on $x$. The label on line @49,top:@ is where -the algorithm will resume if further reduction passes are required. In theory it could be placed at the top of the function however, the size of -the modulus and question of whether $x$ is large enough are invariant after the first pass meaning that it would be a waste of time. - -The aliases $tmpx1$ and $tmpx2$ refer to the digits of $x$ where the latter is offset by $m$ digits. By reading digits from $x$ offset by $m$ digits -a division by $\beta^m$ can be simulated virtually for free. The loop on line @61,for@ performs the bulk of the work (\textit{corresponds to step 4 of algorithm 7.11}) -in this algorithm. - -By line @68,mu@ the pointer $tmpx1$ points to the $m$'th digit of $x$ which is where the final carry will be placed. Similarly by line @71,for@ the -same pointer will point to the $m+1$'th digit where the zeroes will be placed. - -Since the algorithm is only valid if both $x$ and $n$ are greater than zero an unsigned comparison suffices to determine if another pass is required. -With the same logic at line @82,sub@ the value of $x$ is known to be greater than or equal to $n$ meaning that an unsigned subtraction can be used -as well. Since the destination of the subtraction is the larger of the inputs the call to algorithm s\_mp\_sub cannot fail and the return code -does not need to be checked. - -\subsubsection{Setup} -To setup the restricted Diminished Radix algorithm the value $k = \beta - n_0$ is required. This algorithm is not really complicated but provided for -completeness. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = \beta - n_0$ \\ -\hline \\ -1. $k \leftarrow \beta - n_0$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_setup} -\end{figure} - -EXAM,bn_mp_dr_setup.c - -\subsubsection{Modulus Detection} -Another algorithm which will be useful is the ability to detect a restricted Diminished Radix modulus. An integer is said to be -of restricted Diminished Radix form if all of the digits are equal to $\beta - 1$ except the trailing digit which may be any value. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_is\_modulus}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if $n$ is in D.R form, $0$ otherwise \\ -\hline -1. If $n.used < 2$ then return($0$). \\ -2. for $ix$ from $1$ to $n.used - 1$ do \\ -\hspace{3mm}2.1 If $n_{ix} \ne \beta - 1$ return($0$). \\ -3. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_is\_modulus} -\end{figure} - -\textbf{Algorithm mp\_dr\_is\_modulus.} -This algorithm determines if a value is in Diminished Radix form. Step 1 rejects obvious cases where fewer than two digits are -in the mp\_int. Step 2 tests all but the first digit to see if they are equal to $\beta - 1$. If the algorithm manages to get to -step 3 then $n$ must be of Diminished Radix form. - -EXAM,bn_mp_dr_is_modulus.c - -\subsection{Unrestricted Diminished Radix Reduction} -The unrestricted Diminished Radix algorithm allows modular reductions to be performed when the modulus is of the form $2^p - k$. This algorithm -is a straightforward adaptation of algorithm~\ref{fig:DR}. - -In general the restricted Diminished Radix reduction algorithm is much faster since it has considerably lower overhead. However, this new -algorithm is much faster than either Montgomery or Barrett reduction when the moduli are of the appropriate form. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k}. \\ -\textbf{Input}. mp\_int $a$ and $n$. mp\_digit $k$ \\ -\hspace{11.5mm}($a \ge 0$, $n > 1$, $0 < k < \beta$, $n + k$ is a power of two) \\ -\textbf{Output}. $a \mbox{ (mod }n\mbox{)}$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. While $a \ge n$ do \\ -\hspace{3mm}2.1 $q \leftarrow \lfloor a / 2^p \rfloor$ (\textit{mp\_div\_2d}) \\ -\hspace{3mm}2.2 $a \leftarrow a \mbox{ (mod }2^p\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -\hspace{3mm}2.3 $q \leftarrow q \cdot k$ (\textit{mp\_mul\_d}) \\ -\hspace{3mm}2.4 $a \leftarrow a - q$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.5 If $a \ge n$ then do \\ -\hspace{6mm}2.5.1 $a \leftarrow a - n$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k.} -This algorithm quickly reduces an input $a$ modulo an unrestricted Diminished Radix modulus $n$. Division by $2^p$ is emulated with a right -shift which makes the algorithm fairly inexpensive to use. - -EXAM,bn_mp_reduce_2k.c - -The algorithm mp\_count\_bits calculates the number of bits in an mp\_int which is used to find the initial value of $p$. The call to mp\_div\_2d -on line @31,mp_div_2d@ calculates both the quotient $q$ and the remainder $a$ required. By doing both in a single function call the code size -is kept fairly small. The multiplication by $k$ is only performed if $k > 1$. This allows reductions modulo $2^p - 1$ to be performed without -any multiplications. - -The unsigned s\_mp\_add, mp\_cmp\_mag and s\_mp\_sub are used in place of their full sign counterparts since the inputs are only valid if they are -positive. By using the unsigned versions the overhead is kept to a minimum. - -\subsubsection{Unrestricted Setup} -To setup this reduction algorithm the value of $k = 2^p - n$ is required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = 2^p - n$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. $x \leftarrow 2^p$ (\textit{mp\_2expt}) \\ -3. $x \leftarrow x - n$ (\textit{mp\_sub}) \\ -4. $k \leftarrow x_0$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k\_setup.} -This algorithm computes the value of $k$ required for the algorithm mp\_reduce\_2k. By making a temporary variable $x$ equal to $2^p$ a subtraction -is sufficient to solve for $k$. Alternatively if $n$ has more than one digit the value of $k$ is simply $\beta - n_0$. - -EXAM,bn_mp_reduce_2k_setup.c - -\subsubsection{Unrestricted Detection} -An integer $n$ is a valid unrestricted Diminished Radix modulus if either of the following are true. - -\begin{enumerate} -\item The number has only one digit. -\item The number has more than one digit and every bit from the $\beta$'th to the most significant is one. -\end{enumerate} - -If either condition is true than there is a power of two $2^p$ such that $0 < 2^p - n < \beta$. If the input is only -one digit than it will always be of the correct form. Otherwise all of the bits above the first digit must be one. This arises from the fact -that there will be value of $k$ that when added to the modulus causes a carry in the first digit which propagates all the way to the most -significant bit. The resulting sum will be a power of two. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_is\_2k}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if of proper form, $0$ otherwise \\ -\hline -1. If $n.used = 0$ then return($0$). \\ -2. If $n.used = 1$ then return($1$). \\ -3. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -4. for $x$ from $lg(\beta)$ to $p$ do \\ -\hspace{3mm}4.1 If the ($x \mbox{ mod }lg(\beta)$)'th bit of the $\lfloor x / lg(\beta) \rfloor$ of $n$ is zero then return($0$). \\ -5. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_is\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_is\_2k.} -This algorithm quickly determines if a modulus is of the form required for algorithm mp\_reduce\_2k to function properly. - -EXAM,bn_mp_reduce_is_2k.c - - - -\section{Algorithm Comparison} -So far three very different algorithms for modular reduction have been discussed. Each of the algorithms have their own strengths and weaknesses -that makes having such a selection very useful. The following table sumarizes the three algorithms along with comparisons of work factors. Since -all three algorithms have the restriction that $0 \le x < n^2$ and $n > 1$ those limitations are not included in the table. - -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Method} & \textbf{Work Required} & \textbf{Limitations} & \textbf{$m = 8$} & \textbf{$m = 32$} & \textbf{$m = 64$} \\ -\hline Barrett & $m^2 + 2m - 1$ & None & $79$ & $1087$ & $4223$ \\ -\hline Montgomery & $m^2 + m$ & $n$ must be odd & $72$ & $1056$ & $4160$ \\ -\hline D.R. & $2m$ & $n = \beta^m - k$ & $16$ & $64$ & $128$ \\ -\hline -\end{tabular} -\end{small} -\end{center} - -In theory Montgomery and Barrett reductions would require roughly the same amount of time to complete. However, in practice since Montgomery -reduction can be written as a single function with the Comba technique it is much faster. Barrett reduction suffers from the overhead of -calling the half precision multipliers, addition and division by $\beta$ algorithms. - -For almost every cryptographic algorithm Montgomery reduction is the algorithm of choice. The one set of algorithms where Diminished Radix reduction truly -shines are based on the discrete logarithm problem such as Diffie-Hellman \cite{DH} and ElGamal \cite{ELGAMAL}. In these algorithms -primes of the form $\beta^m - k$ can be found and shared amongst users. These primes will allow the Diminished Radix algorithm to be used in -modular exponentiation to greatly speed up the operation. - - - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ]$ & Prove that the ``trick'' in algorithm mp\_montgomery\_setup actually \\ - & calculates the correct value of $\rho$. \\ - & \\ -$\left [ 2 \right ]$ & Devise an algorithm to reduce modulo $n + k$ for small $k$ quickly. \\ - & \\ -$\left [ 4 \right ]$ & Prove that the pseudo-code algorithm ``Diminished Radix Reduction'' \\ - & (\textit{figure~\ref{fig:DR}}) terminates. Also prove the probability that it will \\ - & terminate within $1 \le k \le 10$ iterations. \\ - & \\ -\end{tabular} - - -\chapter{Exponentiation} -Exponentiation is the operation of raising one variable to the power of another, for example, $a^b$. A variant of exponentiation, computed -in a finite field or ring, is called modular exponentiation. This latter style of operation is typically used in public key -cryptosystems such as RSA and Diffie-Hellman. The ability to quickly compute modular exponentiations is of great benefit to any -such cryptosystem and many methods have been sought to speed it up. - -\section{Exponentiation Basics} -A trivial algorithm would simply multiply $a$ against itself $b - 1$ times to compute the exponentiation desired. However, as $b$ grows in size -the number of multiplications becomes prohibitive. Imagine what would happen if $b$ $\approx$ $2^{1024}$ as is the case when computing an RSA signature -with a $1024$-bit key. Such a calculation could never be completed as it would take simply far too long. - -Fortunately there is a very simple algorithm based on the laws of exponents. Recall that $lg_a(a^b) = b$ and that $lg_a(a^ba^c) = b + c$ which -are two trivial relationships between the base and the exponent. Let $b_i$ represent the $i$'th bit of $b$ starting from the least -significant bit. If $b$ is a $k$-bit integer than the following equation is true. - -\begin{equation} -a^b = \prod_{i=0}^{k-1} a^{2^i \cdot b_i} -\end{equation} - -By taking the base $a$ logarithm of both sides of the equation the following equation is the result. - -\begin{equation} -b = \sum_{i=0}^{k-1}2^i \cdot b_i -\end{equation} - -The term $a^{2^i}$ can be found from the $i - 1$'th term by squaring the term since $\left ( a^{2^i} \right )^2$ is equal to -$a^{2^{i+1}}$. This observation forms the basis of essentially all fast exponentiation algorithms. It requires $k$ squarings and on average -$k \over 2$ multiplications to compute the result. This is indeed quite an improvement over simply multiplying by $a$ a total of $b-1$ times. - -While this current method is a considerable speed up there are further improvements to be made. For example, the $a^{2^i}$ term does not need to -be computed in an auxilary variable. Consider the following equivalent algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Left to Right Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$ and $k$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $k - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 $c \leftarrow c \cdot a^{b_i}$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Left to Right Exponentiation} -\label{fig:LTOR} -\end{figure} - -This algorithm starts from the most significant bit and works towards the least significant bit. When the $i$'th bit of $b$ is set $a$ is -multiplied against the current product. In each iteration the product is squared which doubles the exponent of the individual terms of the -product. - -For example, let $b = 101100_2 \equiv 44_{10}$. The following chart demonstrates the actions of the algorithm. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|} -\hline \textbf{Value of $i$} & \textbf{Value of $c$} \\ -\hline - & $1$ \\ -\hline $5$ & $a$ \\ -\hline $4$ & $a^2$ \\ -\hline $3$ & $a^4 \cdot a$ \\ -\hline $2$ & $a^8 \cdot a^2 \cdot a$ \\ -\hline $1$ & $a^{16} \cdot a^4 \cdot a^2$ \\ -\hline $0$ & $a^{32} \cdot a^8 \cdot a^4$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Left to Right Exponentiation} -\end{figure} - -When the product $a^{32} \cdot a^8 \cdot a^4$ is simplified it is equal $a^{44}$ which is the desired exponentiation. This particular algorithm is -called ``Left to Right'' because it reads the exponent in that order. All of the exponentiation algorithms that will be presented are of this nature. - -\subsection{Single Digit Exponentiation} -The first algorithm in the series of exponentiation algorithms will be an unbounded algorithm where the exponent is a single digit. It is intended -to be used when a small power of an input is required (\textit{e.g. $a^5$}). It is faster than simply multiplying $b - 1$ times for all values of -$b$ that are greater than three. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_expt\_d}. \\ -\textbf{Input}. mp\_int $a$ and mp\_digit $b$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $g \leftarrow a$ (\textit{mp\_init\_copy}) \\ -2. $c \leftarrow 1$ (\textit{mp\_set}) \\ -3. for $x$ from 1 to $lg(\beta)$ do \\ -\hspace{3mm}3.1 $c \leftarrow c^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}3.2 If $b$ AND $2^{lg(\beta) - 1} \ne 0$ then \\ -\hspace{6mm}3.2.1 $c \leftarrow c \cdot g$ (\textit{mp\_mul}) \\ -\hspace{3mm}3.3 $b \leftarrow b << 1$ \\ -4. Clear $g$. \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_expt\_d} -\end{figure} - -\textbf{Algorithm mp\_expt\_d.} -This algorithm computes the value of $a$ raised to the power of a single digit $b$. It uses the left to right exponentiation algorithm to -quickly compute the exponentiation. It is loosely based on algorithm 14.79 of HAC \cite[pp. 615]{HAC} with the difference that the -exponent is a fixed width. - -A copy of $a$ is made first to allow destination variable $c$ be the same as the source variable $a$. The result is set to the initial value of -$1$ in the subsequent step. - -Inside the loop the exponent is read from the most significant bit first down to the least significant bit. First $c$ is invariably squared -on step 3.1. In the following step if the most significant bit of $b$ is one the copy of $a$ is multiplied against $c$. The value -of $b$ is shifted left one bit to make the next bit down from the most signficant bit the new most significant bit. In effect each -iteration of the loop moves the bits of the exponent $b$ upwards to the most significant location. - -EXAM,bn_mp_expt_d_ex.c - -This describes only the algorithm that is used when the parameter $fast$ is $0$. Line @31,mp_set@ sets the initial value of the result to $1$. Next the loop on line @54,for@ steps through each bit of the exponent starting from -the most significant down towards the least significant. The invariant squaring operation placed on line @333,mp_sqr@ is performed first. After -the squaring the result $c$ is multiplied by the base $g$ if and only if the most significant bit of the exponent is set. The shift on line -@69,<<@ moves all of the bits of the exponent upwards towards the most significant location. - -\section{$k$-ary Exponentiation} -When calculating an exponentiation the most time consuming bottleneck is the multiplications which are in general a small factor -slower than squaring. Recall from the previous algorithm that $b_{i}$ refers to the $i$'th bit of the exponent $b$. Suppose instead it referred to -the $i$'th $k$-bit digit of the exponent of $b$. For $k = 1$ the definitions are synonymous and for $k > 1$ algorithm~\ref{fig:KARY} -computes the same exponentiation. A group of $k$ bits from the exponent is called a \textit{window}. That is it is a small window on only a -portion of the entire exponent. Consider the following modification to the basic left to right exponentiation algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{$k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^{2^k} $ \\ -\hspace{3mm}2.2 Extract the $i$'th $k$-bit word from $b$ and store it in $g$. \\ -\hspace{3mm}2.3 $c \leftarrow c \cdot a^g$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{$k$-ary Exponentiation} -\label{fig:KARY} -\end{figure} - -The squaring on step 2.1 can be calculated by squaring the value $c$ successively $k$ times. If the values of $a^g$ for $0 < g < 2^k$ have been -precomputed this algorithm requires only $t$ multiplications and $tk$ squarings. The table can be generated with $2^{k - 1} - 1$ squarings and -$2^{k - 1} + 1$ multiplications. This algorithm assumes that the number of bits in the exponent is evenly divisible by $k$. -However, when it is not the remaining $0 < x \le k - 1$ bits can be handled with algorithm~\ref{fig:LTOR}. - -Suppose $k = 4$ and $t = 100$. This modified algorithm will require $109$ multiplications and $408$ squarings to compute the exponentiation. The -original algorithm would on average have required $200$ multiplications and $400$ squrings to compute the same value. The total number of squarings -has increased slightly but the number of multiplications has nearly halved. - -\subsection{Optimal Values of $k$} -An optimal value of $k$ will minimize $2^{k} + \lceil n / k \rceil + n - 1$ for a fixed number of bits in the exponent $n$. The simplest -approach is to brute force search amongst the values $k = 2, 3, \ldots, 8$ for the lowest result. Table~\ref{fig:OPTK} lists optimal values of $k$ -for various exponent sizes and compares the number of multiplication and squarings required against algorithm~\ref{fig:LTOR}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:LTOR}} \\ -\hline $16$ & $2$ & $27$ & $24$ \\ -\hline $32$ & $3$ & $49$ & $48$ \\ -\hline $64$ & $3$ & $92$ & $96$ \\ -\hline $128$ & $4$ & $175$ & $192$ \\ -\hline $256$ & $4$ & $335$ & $384$ \\ -\hline $512$ & $5$ & $645$ & $768$ \\ -\hline $1024$ & $6$ & $1257$ & $1536$ \\ -\hline $2048$ & $6$ & $2452$ & $3072$ \\ -\hline $4096$ & $7$ & $4808$ & $6144$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for $k$-ary Exponentiation} -\label{fig:OPTK} -\end{figure} - -\subsection{Sliding-Window Exponentiation} -A simple modification to the previous algorithm is only generate the upper half of the table in the range $2^{k-1} \le g < 2^k$. Essentially -this is a table for all values of $g$ where the most significant bit of $g$ is a one. However, in order for this to be allowed in the -algorithm values of $g$ in the range $0 \le g < 2^{k-1}$ must be avoided. - -Table~\ref{fig:OPTK2} lists optimal values of $k$ for various exponent sizes and compares the work required against algorithm {\ref{fig:KARY}}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:KARY}} \\ -\hline $16$ & $3$ & $24$ & $27$ \\ -\hline $32$ & $3$ & $45$ & $49$ \\ -\hline $64$ & $4$ & $87$ & $92$ \\ -\hline $128$ & $4$ & $167$ & $175$ \\ -\hline $256$ & $5$ & $322$ & $335$ \\ -\hline $512$ & $6$ & $628$ & $645$ \\ -\hline $1024$ & $6$ & $1225$ & $1257$ \\ -\hline $2048$ & $7$ & $2403$ & $2452$ \\ -\hline $4096$ & $8$ & $4735$ & $4808$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for Sliding Window Exponentiation} -\label{fig:OPTK2} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Sliding Window $k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 If the $i$'th bit of $b$ is a zero then \\ -\hspace{6mm}2.1.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c \leftarrow c^{2^k}$ \\ -\hspace{6mm}2.2.2 Extract the $k$ bits from $(b_{i}b_{i-1}\ldots b_{i-(k-1)})$ and store it in $g$. \\ -\hspace{6mm}2.2.3 $c \leftarrow c \cdot a^g$ \\ -\hspace{6mm}2.2.4 $i \leftarrow i - k$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Sliding Window $k$-ary Exponentiation} -\end{figure} - -Similar to the previous algorithm this algorithm must have a special handler when fewer than $k$ bits are left in the exponent. While this -algorithm requires the same number of squarings it can potentially have fewer multiplications. The pre-computed table $a^g$ is also half -the size as the previous table. - -Consider the exponent $b = 111101011001000_2 \equiv 31432_{10}$ with $k = 3$ using both algorithms. The first algorithm will divide the exponent up as -the following five $3$-bit words $b \equiv \left ( 111, 101, 011, 001, 000 \right )_{2}$. The second algorithm will break the -exponent as $b \equiv \left ( 111, 101, 0, 110, 0, 100, 0 \right )_{2}$. The single digit $0$ in the second representation are where -a single squaring took place instead of a squaring and multiplication. In total the first method requires $10$ multiplications and $18$ -squarings. The second method requires $8$ multiplications and $18$ squarings. - -In general the sliding window method is never slower than the generic $k$-ary method and often it is slightly faster. - -\section{Modular Exponentiation} - -Modular exponentiation is essentially computing the power of a base within a finite field or ring. For example, computing -$d \equiv a^b \mbox{ (mod }c\mbox{)}$ is a modular exponentiation. Instead of first computing $a^b$ and then reducing it -modulo $c$ the intermediate result is reduced modulo $c$ after every squaring or multiplication operation. - -This guarantees that any intermediate result is bounded by $0 \le d \le c^2 - 2c + 1$ and can be reduced modulo $c$ quickly using -one of the algorithms presented in ~REDUCTION~. - -Before the actual modular exponentiation algorithm can be written a wrapper algorithm must be written first. This algorithm -will allow the exponent $b$ to be negative which is computed as $c \equiv \left (1 / a \right )^{\vert b \vert} \mbox{(mod }d\mbox{)}$. The -value of $(1/a) \mbox{ mod }c$ is computed using the modular inverse (\textit{see \ref{sec;modinv}}). If no inverse exists the algorithm -terminates with an error. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. If $c.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. If $b.sign = MP\_NEG$ then \\ -\hspace{3mm}2.1 $g' \leftarrow g^{-1} \mbox{ (mod }c\mbox{)}$ \\ -\hspace{3mm}2.2 $x' \leftarrow \vert x \vert$ \\ -\hspace{3mm}2.3 Compute $d \equiv g'^{x'} \mbox{ (mod }c\mbox{)}$ via recursion. \\ -3. if $p$ is odd \textbf{OR} $p$ is a D.R. modulus then \\ -\hspace{3mm}3.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm mp\_exptmod\_fast. \\ -4. else \\ -\hspace{3mm}4.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm s\_mp\_exptmod. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_exptmod} -\end{figure} - -\textbf{Algorithm mp\_exptmod.} -The first algorithm which actually performs modular exponentiation is algorithm s\_mp\_exptmod. It is a sliding window $k$-ary algorithm -which uses Barrett reduction to reduce the product modulo $p$. The second algorithm mp\_exptmod\_fast performs the same operation -except it uses either Montgomery or Diminished Radix reduction. The two latter reduction algorithms are clumped in the same exponentiation -algorithm since their arguments are essentially the same (\textit{two mp\_ints and one mp\_digit}). - -EXAM,bn_mp_exptmod.c - -In order to keep the algorithms in a known state the first step on line @29,if@ is to reject any negative modulus as input. If the exponent is -negative the algorithm tries to perform a modular exponentiation with the modular inverse of the base $G$. The temporary variable $tmpG$ is assigned -the modular inverse of $G$ and $tmpX$ is assigned the absolute value of $X$. The algorithm will recuse with these new values with a positive -exponent. - -If the exponent is positive the algorithm resumes the exponentiation. Line @63,dr_@ determines if the modulus is of the restricted Diminished Radix -form. If it is not line @65,reduce@ attempts to determine if it is of a unrestricted Diminished Radix form. The integer $dr$ will take on one -of three values. - -\begin{enumerate} -\item $dr = 0$ means that the modulus is not of either restricted or unrestricted Diminished Radix form. -\item $dr = 1$ means that the modulus is of restricted Diminished Radix form. -\item $dr = 2$ means that the modulus is of unrestricted Diminished Radix form. -\end{enumerate} - -Line @69,if@ determines if the fast modular exponentiation algorithm can be used. It is allowed if $dr \ne 0$ or if the modulus is odd. Otherwise, -the slower s\_mp\_exptmod algorithm is used which uses Barrett reduction. - -\subsection{Barrett Modular Exponentiation} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. $k \leftarrow lg(x)$ \\ -2. $winsize \leftarrow \left \lbrace \begin{array}{ll} - 2 & \mbox{if }k \le 7 \\ - 3 & \mbox{if }7 < k \le 36 \\ - 4 & \mbox{if }36 < k \le 140 \\ - 5 & \mbox{if }140 < k \le 450 \\ - 6 & \mbox{if }450 < k \le 1303 \\ - 7 & \mbox{if }1303 < k \le 3529 \\ - 8 & \mbox{if }3529 < k \\ - \end{array} \right .$ \\ -3. Initialize $2^{winsize}$ mp\_ints in an array named $M$ and one mp\_int named $\mu$ \\ -4. Calculate the $\mu$ required for Barrett Reduction (\textit{mp\_reduce\_setup}). \\ -5. $M_1 \leftarrow g \mbox{ (mod }p\mbox{)}$ \\ -\\ -Setup the table of small powers of $g$. First find $g^{2^{winsize}}$ and then all multiples of it. \\ -6. $k \leftarrow 2^{winsize - 1}$ \\ -7. $M_{k} \leftarrow M_1$ \\ -8. for $ix$ from 0 to $winsize - 2$ do \\ -\hspace{3mm}8.1 $M_k \leftarrow \left ( M_k \right )^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}8.2 $M_k \leftarrow M_k \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -9. for $ix$ from $2^{winsize - 1} + 1$ to $2^{winsize} - 1$ do \\ -\hspace{3mm}9.1 $M_{ix} \leftarrow M_{ix - 1} \cdot M_{1}$ (\textit{mp\_mul}) \\ -\hspace{3mm}9.2 $M_{ix} \leftarrow M_{ix} \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -10. $res \leftarrow 1$ \\ -\\ -Start Sliding Window. \\ -11. $mode \leftarrow 0, bitcnt \leftarrow 1, buf \leftarrow 0, digidx \leftarrow x.used - 1, bitcpy \leftarrow 0, bitbuf \leftarrow 0$ \\ -12. Loop \\ -\hspace{3mm}12.1 $bitcnt \leftarrow bitcnt - 1$ \\ -\hspace{3mm}12.2 If $bitcnt = 0$ then do \\ -\hspace{6mm}12.2.1 If $digidx = -1$ goto step 13. \\ -\hspace{6mm}12.2.2 $buf \leftarrow x_{digidx}$ \\ -\hspace{6mm}12.2.3 $digidx \leftarrow digidx - 1$ \\ -\hspace{6mm}12.2.4 $bitcnt \leftarrow lg(\beta)$ \\ -Continued on next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod} (\textit{continued}). \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -\hspace{3mm}12.3 $y \leftarrow (buf >> (lg(\beta) - 1))$ AND $1$ \\ -\hspace{3mm}12.4 $buf \leftarrow buf << 1$ \\ -\hspace{3mm}12.5 if $mode = 0$ and $y = 0$ then goto step 12. \\ -\hspace{3mm}12.6 if $mode = 1$ and $y = 0$ then do \\ -\hspace{6mm}12.6.1 $res \leftarrow res^2$ \\ -\hspace{6mm}12.6.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.6.3 Goto step 12. \\ -\hspace{3mm}12.7 $bitcpy \leftarrow bitcpy + 1$ \\ -\hspace{3mm}12.8 $bitbuf \leftarrow bitbuf + (y << (winsize - bitcpy))$ \\ -\hspace{3mm}12.9 $mode \leftarrow 2$ \\ -\hspace{3mm}12.10 If $bitcpy = winsize$ then do \\ -\hspace{6mm}Window is full so perform the squarings and single multiplication. \\ -\hspace{6mm}12.10.1 for $ix$ from $0$ to $winsize -1$ do \\ -\hspace{9mm}12.10.1.1 $res \leftarrow res^2$ \\ -\hspace{9mm}12.10.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.10.2 $res \leftarrow res \cdot M_{bitbuf}$ \\ -\hspace{6mm}12.10.3 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}Reset the window. \\ -\hspace{6mm}12.10.4 $bitcpy \leftarrow 0, bitbuf \leftarrow 0, mode \leftarrow 1$ \\ -\\ -No more windows left. Check for residual bits of exponent. \\ -13. If $mode = 2$ and $bitcpy > 0$ then do \\ -\hspace{3mm}13.1 for $ix$ form $0$ to $bitcpy - 1$ do \\ -\hspace{6mm}13.1.1 $res \leftarrow res^2$ \\ -\hspace{6mm}13.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}13.1.3 $bitbuf \leftarrow bitbuf << 1$ \\ -\hspace{6mm}13.1.4 If $bitbuf$ AND $2^{winsize} \ne 0$ then do \\ -\hspace{9mm}13.1.4.1 $res \leftarrow res \cdot M_{1}$ \\ -\hspace{9mm}13.1.4.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -14. $y \leftarrow res$ \\ -15. Clear $res$, $mu$ and the $M$ array. \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod (continued)} -\end{figure} - -\textbf{Algorithm s\_mp\_exptmod.} -This algorithm computes the $x$'th power of $g$ modulo $p$ and stores the result in $y$. It takes advantage of the Barrett reduction -algorithm to keep the product small throughout the algorithm. - -The first two steps determine the optimal window size based on the number of bits in the exponent. The larger the exponent the -larger the window size becomes. After a window size $winsize$ has been chosen an array of $2^{winsize}$ mp\_int variables is allocated. This -table will hold the values of $g^x \mbox{ (mod }p\mbox{)}$ for $2^{winsize - 1} \le x < 2^{winsize}$. - -After the table is allocated the first power of $g$ is found. Since $g \ge p$ is allowed it must be first reduced modulo $p$ to make -the rest of the algorithm more efficient. The first element of the table at $2^{winsize - 1}$ is found by squaring $M_1$ successively $winsize - 2$ -times. The rest of the table elements are found by multiplying the previous element by $M_1$ modulo $p$. - -Now that the table is available the sliding window may begin. The following list describes the functions of all the variables in the window. -\begin{enumerate} -\item The variable $mode$ dictates how the bits of the exponent are interpreted. -\begin{enumerate} - \item When $mode = 0$ the bits are ignored since no non-zero bit of the exponent has been seen yet. For example, if the exponent were simply - $1$ then there would be $lg(\beta) - 1$ zero bits before the first non-zero bit. In this case bits are ignored until a non-zero bit is found. - \item When $mode = 1$ a non-zero bit has been seen before and a new $winsize$-bit window has not been formed yet. In this mode leading $0$ bits - are read and a single squaring is performed. If a non-zero bit is read a new window is created. - \item When $mode = 2$ the algorithm is in the middle of forming a window and new bits are appended to the window from the most significant bit - downwards. -\end{enumerate} -\item The variable $bitcnt$ indicates how many bits are left in the current digit of the exponent left to be read. When it reaches zero a new digit - is fetched from the exponent. -\item The variable $buf$ holds the currently read digit of the exponent. -\item The variable $digidx$ is an index into the exponents digits. It starts at the leading digit $x.used - 1$ and moves towards the trailing digit. -\item The variable $bitcpy$ indicates how many bits are in the currently formed window. When it reaches $winsize$ the window is flushed and - the appropriate operations performed. -\item The variable $bitbuf$ holds the current bits of the window being formed. -\end{enumerate} - -All of step 12 is the window processing loop. It will iterate while there are digits available form the exponent to read. The first step -inside this loop is to extract a new digit if no more bits are available in the current digit. If there are no bits left a new digit is -read and if there are no digits left than the loop terminates. - -After a digit is made available step 12.3 will extract the most significant bit of the current digit and move all other bits in the digit -upwards. In effect the digit is read from most significant bit to least significant bit and since the digits are read from leading to -trailing edges the entire exponent is read from most significant bit to least significant bit. - -At step 12.5 if the $mode$ and currently extracted bit $y$ are both zero the bit is ignored and the next bit is read. This prevents the -algorithm from having to perform trivial squaring and reduction operations before the first non-zero bit is read. Step 12.6 and 12.7-10 handle -the two cases of $mode = 1$ and $mode = 2$ respectively. - -FIGU,expt_state,Sliding Window State Diagram - -By step 13 there are no more digits left in the exponent. However, there may be partial bits in the window left. If $mode = 2$ then -a Left-to-Right algorithm is used to process the remaining few bits. - -EXAM,bn_s_mp_exptmod.c - -Lines @31,if@ through @45,}@ determine the optimal window size based on the length of the exponent in bits. The window divisions are sorted -from smallest to greatest so that in each \textbf{if} statement only one condition must be tested. For example, by the \textbf{if} statement -on line @37,if@ the value of $x$ is already known to be greater than $140$. - -The conditional piece of code beginning on line @42,ifdef@ allows the window size to be restricted to five bits. This logic is used to ensure -the table of precomputed powers of $G$ remains relatively small. - -The for loop on line @60,for@ initializes the $M$ array while lines @71,mp_init@ and @75,mp_reduce@ through @85,}@ initialize the reduction -function that will be used for this modulus. - --- More later. - -\section{Quick Power of Two} -Calculating $b = 2^a$ can be performed much quicker than with any of the previous algorithms. Recall that a logical shift left $m << k$ is -equivalent to $m \cdot 2^k$. By this logic when $m = 1$ a quick power of two can be achieved. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_2expt}. \\ -\textbf{Input}. integer $b$ \\ -\textbf{Output}. $a \leftarrow 2^b$ \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $a.alloc < \lfloor b / lg(\beta) \rfloor + 1$ then grow $a$ appropriately. \\ -3. $a.used \leftarrow \lfloor b / lg(\beta) \rfloor + 1$ \\ -4. $a_{\lfloor b / lg(\beta) \rfloor} \leftarrow 1 << (b \mbox{ mod } lg(\beta))$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_2expt} -\end{figure} - -\textbf{Algorithm mp\_2expt.} - -EXAM,bn_mp_2expt.c - -\chapter{Higher Level Algorithms} - -This chapter discusses the various higher level algorithms that are required to complete a well rounded multiple precision integer package. These -routines are less performance oriented than the algorithms of chapters five, six and seven but are no less important. - -The first section describes a method of integer division with remainder that is universally well known. It provides the signed division logic -for the package. The subsequent section discusses a set of algorithms which allow a single digit to be the 2nd operand for a variety of operations. -These algorithms serve mostly to simplify other algorithms where small constants are required. The last two sections discuss how to manipulate -various representations of integers. For example, converting from an mp\_int to a string of character. - -\section{Integer Division with Remainder} -\label{sec:division} - -Integer division aside from modular exponentiation is the most intensive algorithm to compute. Like addition, subtraction and multiplication -the basis of this algorithm is the long-hand division algorithm taught to school children. Throughout this discussion several common variables -will be used. Let $x$ represent the divisor and $y$ represent the dividend. Let $q$ represent the integer quotient $\lfloor y / x \rfloor$ and -let $r$ represent the remainder $r = y - x \lfloor y / x \rfloor$. The following simple algorithm will be used to start the discussion. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Radix-$\beta$ Integer Division}. \\ -\textbf{Input}. integer $x$ and $y$ \\ -\textbf{Output}. $q = \lfloor y/x\rfloor, r = y - xq$ \\ -\hline \\ -1. $q \leftarrow 0$ \\ -2. $n \leftarrow \vert \vert y \vert \vert - \vert \vert x \vert \vert$ \\ -3. for $t$ from $n$ down to $0$ do \\ -\hspace{3mm}3.1 Maximize $k$ such that $kx\beta^t$ is less than or equal to $y$ and $(k + 1)x\beta^t$ is greater. \\ -\hspace{3mm}3.2 $q \leftarrow q + k\beta^t$ \\ -\hspace{3mm}3.3 $y \leftarrow y - kx\beta^t$ \\ -4. $r \leftarrow y$ \\ -5. Return($q, r$) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Radix-$\beta$ Integer Division} -\label{fig:raddiv} -\end{figure} - -As children we are taught this very simple algorithm for the case of $\beta = 10$. Almost instinctively several optimizations are taught for which -their reason of existing are never explained. For this example let $y = 5471$ represent the dividend and $x = 23$ represent the divisor. - -To find the first digit of the quotient the value of $k$ must be maximized such that $kx\beta^t$ is less than or equal to $y$ and -simultaneously $(k + 1)x\beta^t$ is greater than $y$. Implicitly $k$ is the maximum value the $t$'th digit of the quotient may have. The habitual method -used to find the maximum is to ``eyeball'' the two numbers, typically only the leading digits and quickly estimate a quotient. By only using leading -digits a much simpler division may be used to form an educated guess at what the value must be. In this case $k = \lfloor 54/23\rfloor = 2$ quickly -arises as a possible solution. Indeed $2x\beta^2 = 4600$ is less than $y = 5471$ and simultaneously $(k + 1)x\beta^2 = 6900$ is larger than $y$. -As a result $k\beta^2$ is added to the quotient which now equals $q = 200$ and $4600$ is subtracted from $y$ to give a remainder of $y = 841$. - -Again this process is repeated to produce the quotient digit $k = 3$ which makes the quotient $q = 200 + 3\beta = 230$ and the remainder -$y = 841 - 3x\beta = 181$. Finally the last iteration of the loop produces $k = 7$ which leads to the quotient $q = 230 + 7 = 237$ and the -remainder $y = 181 - 7x = 20$. The final quotient and remainder found are $q = 237$ and $r = y = 20$ which are indeed correct since -$237 \cdot 23 + 20 = 5471$ is true. - -\subsection{Quotient Estimation} -\label{sec:divest} -As alluded to earlier the quotient digit $k$ can be estimated from only the leading digits of both the divisor and dividend. When $p$ leading -digits are used from both the divisor and dividend to form an estimation the accuracy of the estimation rises as $p$ grows. Technically -speaking the estimation is based on assuming the lower $\vert \vert y \vert \vert - p$ and $\vert \vert x \vert \vert - p$ lower digits of the -dividend and divisor are zero. - -The value of the estimation may off by a few values in either direction and in general is fairly correct. A simplification \cite[pp. 271]{TAOCPV2} -of the estimation technique is to use $t + 1$ digits of the dividend and $t$ digits of the divisor, in particularly when $t = 1$. The estimate -using this technique is never too small. For the following proof let $t = \vert \vert y \vert \vert - 1$ and $s = \vert \vert x \vert \vert - 1$ -represent the most significant digits of the dividend and divisor respectively. - -\textbf{Proof.}\textit{ The quotient $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ is greater than or equal to -$k = \lfloor y / (x \cdot \beta^{\vert \vert y \vert \vert - \vert \vert x \vert \vert - 1}) \rfloor$. } -The first obvious case is when $\hat k = \beta - 1$ in which case the proof is concluded since the real quotient cannot be larger. For all other -cases $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ and $\hat k x_s \ge y_t\beta + y_{t-1} - x_s + 1$. The latter portion of the inequalility -$-x_s + 1$ arises from the fact that a truncated integer division will give the same quotient for at most $x_s - 1$ values. Next a series of -inequalities will prove the hypothesis. - -\begin{equation} -y - \hat k x \le y - \hat k x_s\beta^s -\end{equation} - -This is trivially true since $x \ge x_s\beta^s$. Next we replace $\hat kx_s\beta^s$ by the previous inequality for $\hat kx_s$. - -\begin{equation} -y - \hat k x \le y_t\beta^t + \ldots + y_0 - (y_t\beta^t + y_{t-1}\beta^{t-1} - x_s\beta^t + \beta^s) -\end{equation} - -By simplifying the previous inequality the following inequality is formed. - -\begin{equation} -y - \hat k x \le y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s -\end{equation} - -Subsequently, - -\begin{equation} -y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s < x_s\beta^s \le x -\end{equation} - -Which proves that $y - \hat kx \le x$ and by consequence $\hat k \ge k$ which concludes the proof. \textbf{QED} - - -\subsection{Normalized Integers} -For the purposes of division a normalized input is when the divisors leading digit $x_n$ is greater than or equal to $\beta / 2$. By multiplying both -$x$ and $y$ by $j = \lfloor (\beta / 2) / x_n \rfloor$ the quotient remains unchanged and the remainder is simply $j$ times the original -remainder. The purpose of normalization is to ensure the leading digit of the divisor is sufficiently large such that the estimated quotient will -lie in the domain of a single digit. Consider the maximum dividend $(\beta - 1) \cdot \beta + (\beta - 1)$ and the minimum divisor $\beta / 2$. - -\begin{equation} -{{\beta^2 - 1} \over { \beta / 2}} \le 2\beta - {2 \over \beta} -\end{equation} - -At most the quotient approaches $2\beta$, however, in practice this will not occur since that would imply the previous quotient digit was too small. - -\subsection{Radix-$\beta$ Division with Remainder} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div}. \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -1. If $b = 0$ return(\textit{MP\_VAL}). \\ -2. If $\vert a \vert < \vert b \vert$ then do \\ -\hspace{3mm}2.1 $d \leftarrow a$ \\ -\hspace{3mm}2.2 $c \leftarrow 0$ \\ -\hspace{3mm}2.3 Return(\textit{MP\_OKAY}). \\ -\\ -Setup the quotient to receive the digits. \\ -3. Grow $q$ to $a.used + 2$ digits. \\ -4. $q \leftarrow 0$ \\ -5. $x \leftarrow \vert a \vert , y \leftarrow \vert b \vert$ \\ -6. $sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = b.sign \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\\ -Normalize the inputs such that the leading digit of $y$ is greater than or equal to $\beta / 2$. \\ -7. $norm \leftarrow (lg(\beta) - 1) - (\lceil lg(y) \rceil \mbox{ (mod }lg(\beta)\mbox{)})$ \\ -8. $x \leftarrow x \cdot 2^{norm}, y \leftarrow y \cdot 2^{norm}$ \\ -\\ -Find the leading digit of the quotient. \\ -9. $n \leftarrow x.used - 1, t \leftarrow y.used - 1$ \\ -10. $y \leftarrow y \cdot \beta^{n - t}$ \\ -11. While ($x \ge y$) do \\ -\hspace{3mm}11.1 $q_{n - t} \leftarrow q_{n - t} + 1$ \\ -\hspace{3mm}11.2 $x \leftarrow x - y$ \\ -12. $y \leftarrow \lfloor y / \beta^{n-t} \rfloor$ \\ -\\ -Continued on the next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div} (continued). \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -Now find the remainder fo the digits. \\ -13. for $i$ from $n$ down to $(t + 1)$ do \\ -\hspace{3mm}13.1 If $i > x.used$ then jump to the next iteration of this loop. \\ -\hspace{3mm}13.2 If $x_{i} = y_{t}$ then \\ -\hspace{6mm}13.2.1 $q_{i - t - 1} \leftarrow \beta - 1$ \\ -\hspace{3mm}13.3 else \\ -\hspace{6mm}13.3.1 $\hat r \leftarrow x_{i} \cdot \beta + x_{i - 1}$ \\ -\hspace{6mm}13.3.2 $\hat r \leftarrow \lfloor \hat r / y_{t} \rfloor$ \\ -\hspace{6mm}13.3.3 $q_{i - t - 1} \leftarrow \hat r$ \\ -\hspace{3mm}13.4 $q_{i - t - 1} \leftarrow q_{i - t - 1} + 1$ \\ -\\ -Fixup quotient estimation. \\ -\hspace{3mm}13.5 Loop \\ -\hspace{6mm}13.5.1 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\hspace{6mm}13.5.2 t$1 \leftarrow 0$ \\ -\hspace{6mm}13.5.3 t$1_0 \leftarrow y_{t - 1}, $ t$1_1 \leftarrow y_t,$ t$1.used \leftarrow 2$ \\ -\hspace{6mm}13.5.4 $t1 \leftarrow t1 \cdot q_{i - t - 1}$ \\ -\hspace{6mm}13.5.5 t$2_0 \leftarrow x_{i - 2}, $ t$2_1 \leftarrow x_{i - 1}, $ t$2_2 \leftarrow x_i, $ t$2.used \leftarrow 3$ \\ -\hspace{6mm}13.5.6 If $\vert t1 \vert > \vert t2 \vert$ then goto step 13.5. \\ -\hspace{3mm}13.6 t$1 \leftarrow y \cdot q_{i - t - 1}$ \\ -\hspace{3mm}13.7 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{3mm}13.8 $x \leftarrow x - $ t$1$ \\ -\hspace{3mm}13.9 If $x.sign = MP\_NEG$ then \\ -\hspace{6mm}13.10 t$1 \leftarrow y$ \\ -\hspace{6mm}13.11 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{6mm}13.12 $x \leftarrow x + $ t$1$ \\ -\hspace{6mm}13.13 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\\ -Finalize the result. \\ -14. Clamp excess digits of $q$ \\ -15. $c \leftarrow q, c.sign \leftarrow sign$ \\ -16. $x.sign \leftarrow a.sign$ \\ -17. $d \leftarrow \lfloor x / 2^{norm} \rfloor$ \\ -18. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div (continued)} -\end{figure} -\textbf{Algorithm mp\_div.} -This algorithm will calculate quotient and remainder from an integer division given a dividend and divisor. The algorithm is a signed -division and will produce a fully qualified quotient and remainder. - -First the divisor $b$ must be non-zero which is enforced in step one. If the divisor is larger than the dividend than the quotient is implicitly -zero and the remainder is the dividend. - -After the first two trivial cases of inputs are handled the variable $q$ is setup to receive the digits of the quotient. Two unsigned copies of the -divisor $y$ and dividend $x$ are made as well. The core of the division algorithm is an unsigned division and will only work if the values are -positive. Now the two values $x$ and $y$ must be normalized such that the leading digit of $y$ is greater than or equal to $\beta / 2$. -This is performed by shifting both to the left by enough bits to get the desired normalization. - -At this point the division algorithm can begin producing digits of the quotient. Recall that maximum value of the estimation used is -$2\beta - {2 \over \beta}$ which means that a digit of the quotient must be first produced by another means. In this case $y$ is shifted -to the left (\textit{step ten}) so that it has the same number of digits as $x$. The loop on step eleven will subtract multiples of the -shifted copy of $y$ until $x$ is smaller. Since the leading digit of $y$ is greater than or equal to $\beta/2$ this loop will iterate at most two -times to produce the desired leading digit of the quotient. - -Now the remainder of the digits can be produced. The equation $\hat q = \lfloor {{x_i \beta + x_{i-1}}\over y_t} \rfloor$ is used to fairly -accurately approximate the true quotient digit. The estimation can in theory produce an estimation as high as $2\beta - {2 \over \beta}$ but by -induction the upper quotient digit is correct (\textit{as established on step eleven}) and the estimate must be less than $\beta$. - -Recall from section~\ref{sec:divest} that the estimation is never too low but may be too high. The next step of the estimation process is -to refine the estimation. The loop on step 13.5 uses $x_i\beta^2 + x_{i-1}\beta + x_{i-2}$ and $q_{i - t - 1}(y_t\beta + y_{t-1})$ as a higher -order approximation to adjust the quotient digit. - -After both phases of estimation the quotient digit may still be off by a value of one\footnote{This is similar to the error introduced -by optimizing Barrett reduction.}. Steps 13.6 and 13.7 subtract the multiple of the divisor from the dividend (\textit{Similar to step 3.3 of -algorithm~\ref{fig:raddiv}} and then subsequently add a multiple of the divisor if the quotient was too large. - -Now that the quotient has been determine finializing the result is a matter of clamping the quotient, fixing the sizes and de-normalizing the -remainder. An important aspect of this algorithm seemingly overlooked in other descriptions such as that of Algorithm 14.20 HAC \cite[pp. 598]{HAC} -is that when the estimations are being made (\textit{inside the loop on step 13.5}) that the digits $y_{t-1}$, $x_{i-2}$ and $x_{i-1}$ may lie -outside their respective boundaries. For example, if $t = 0$ or $i \le 1$ then the digits would be undefined. In those cases the digits should -respectively be replaced with a zero. - -EXAM,bn_mp_div.c - -The implementation of this algorithm differs slightly from the pseudo code presented previously. In this algorithm either of the quotient $c$ or -remainder $d$ may be passed as a \textbf{NULL} pointer which indicates their value is not desired. For example, the C code to call the division -algorithm with only the quotient is - -\begin{verbatim} -mp_div(&a, &b, &c, NULL); /* c = [a/b] */ -\end{verbatim} - -Lines @108,if@ and @113,if@ handle the two trivial cases of inputs which are division by zero and dividend smaller than the divisor -respectively. After the two trivial cases all of the temporary variables are initialized. Line @147,neg@ determines the sign of -the quotient and line @148,sign@ ensures that both $x$ and $y$ are positive. - -The number of bits in the leading digit is calculated on line @151,norm@. Implictly an mp\_int with $r$ digits will require $lg(\beta)(r-1) + k$ bits -of precision which when reduced modulo $lg(\beta)$ produces the value of $k$. In this case $k$ is the number of bits in the leading digit which is -exactly what is required. For the algorithm to operate $k$ must equal $lg(\beta) - 1$ and when it does not the inputs must be normalized by shifting -them to the left by $lg(\beta) - 1 - k$ bits. - -Throughout the variables $n$ and $t$ will represent the highest digit of $x$ and $y$ respectively. These are first used to produce the -leading digit of the quotient. The loop beginning on line @184,for@ will produce the remainder of the quotient digits. - -The conditional ``continue'' on line @186,continue@ is used to prevent the algorithm from reading past the leading edge of $x$ which can occur when the -algorithm eliminates multiple non-zero digits in a single iteration. This ensures that $x_i$ is always non-zero since by definition the digits -above the $i$'th position $x$ must be zero in order for the quotient to be precise\footnote{Precise as far as integer division is concerned.}. - -Lines @214,t1@, @216,t1@ and @222,t2@ through @225,t2@ manually construct the high accuracy estimations by setting the digits of the two mp\_int -variables directly. - -\section{Single Digit Helpers} - -This section briefly describes a series of single digit helper algorithms which come in handy when working with small constants. All of -the helper functions assume the single digit input is positive and will treat them as such. - -\subsection{Single Digit Addition and Subtraction} - -Both addition and subtraction are performed by ``cheating'' and using mp\_set followed by the higher level addition or subtraction -algorithms. As a result these algorithms are subtantially simpler with a slight cost in performance. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = a + b$ \\ -\hline \\ -1. $t \leftarrow b$ (\textit{mp\_set}) \\ -2. $c \leftarrow a + t$ \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_add\_d} -\end{figure} - -\textbf{Algorithm mp\_add\_d.} -This algorithm initiates a temporary mp\_int with the value of the single digit and uses algorithm mp\_add to add the two values together. - -EXAM,bn_mp_add_d.c - -Clever use of the letter 't'. - -\subsubsection{Subtraction} -The single digit subtraction algorithm mp\_sub\_d is essentially the same except it uses mp\_sub to subtract the digit from the mp\_int. - -\subsection{Single Digit Multiplication} -Single digit multiplication arises enough in division and radix conversion that it ought to be implement as a special case of the baseline -multiplication algorithm. Essentially this algorithm is a modified version of algorithm s\_mp\_mul\_digs where one of the multiplicands -only has one digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = ab$ \\ -\hline \\ -1. $pa \leftarrow a.used$ \\ -2. Grow $c$ to at least $pa + 1$ digits. \\ -3. $oldused \leftarrow c.used$ \\ -4. $c.used \leftarrow pa + 1$ \\ -5. $c.sign \leftarrow a.sign$ \\ -6. $\mu \leftarrow 0$ \\ -7. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}7.1 $\hat r \leftarrow \mu + a_{ix}b$ \\ -\hspace{3mm}7.2 $c_{ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}7.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -8. $c_{pa} \leftarrow \mu$ \\ -9. for $ix$ from $pa + 1$ to $oldused$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -10. Clamp excess digits of $c$. \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_d} -\end{figure} -\textbf{Algorithm mp\_mul\_d.} -This algorithm quickly multiplies an mp\_int by a small single digit value. It is specially tailored to the job and has a minimal of overhead. -Unlike the full multiplication algorithms this algorithm does not require any significnat temporary storage or memory allocations. - -EXAM,bn_mp_mul_d.c - -In this implementation the destination $c$ may point to the same mp\_int as the source $a$ since the result is written after the digit is -read from the source. This function uses pointer aliases $tmpa$ and $tmpc$ for the digits of $a$ and $c$ respectively. - -\subsection{Single Digit Division} -Like the single digit multiplication algorithm, single digit division is also a fairly common algorithm used in radix conversion. Since the -divisor is only a single digit a specialized variant of the division algorithm can be used to compute the quotient. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = \lfloor a / b \rfloor, d = a - cb$ \\ -\hline \\ -1. If $b = 0$ then return(\textit{MP\_VAL}).\\ -2. If $b = 3$ then use algorithm mp\_div\_3 instead. \\ -3. Init $q$ to $a.used$ digits. \\ -4. $q.used \leftarrow a.used$ \\ -5. $q.sign \leftarrow a.sign$ \\ -6. $\hat w \leftarrow 0$ \\ -7. for $ix$ from $a.used - 1$ down to $0$ do \\ -\hspace{3mm}7.1 $\hat w \leftarrow \hat w \beta + a_{ix}$ \\ -\hspace{3mm}7.2 If $\hat w \ge b$ then \\ -\hspace{6mm}7.2.1 $t \leftarrow \lfloor \hat w / b \rfloor$ \\ -\hspace{6mm}7.2.2 $\hat w \leftarrow \hat w \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}7.3 else\\ -\hspace{6mm}7.3.1 $t \leftarrow 0$ \\ -\hspace{3mm}7.4 $q_{ix} \leftarrow t$ \\ -8. $d \leftarrow \hat w$ \\ -9. Clamp excess digits of $q$. \\ -10. $c \leftarrow q$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_d} -\end{figure} -\textbf{Algorithm mp\_div\_d.} -This algorithm divides the mp\_int $a$ by the single mp\_digit $b$ using an optimized approach. Essentially in every iteration of the -algorithm another digit of the dividend is reduced and another digit of quotient produced. Provided $b < \beta$ the value of $\hat w$ -after step 7.1 will be limited such that $0 \le \lfloor \hat w / b \rfloor < \beta$. - -If the divisor $b$ is equal to three a variant of this algorithm is used which is called mp\_div\_3. It replaces the division by three with -a multiplication by $\lfloor \beta / 3 \rfloor$ and the appropriate shift and residual fixup. In essence it is much like the Barrett reduction -from chapter seven. - -EXAM,bn_mp_div_d.c - -Like the implementation of algorithm mp\_div this algorithm allows either of the quotient or remainder to be passed as a \textbf{NULL} pointer to -indicate the respective value is not required. This allows a trivial single digit modular reduction algorithm, mp\_mod\_d to be created. - -The division and remainder on lines @90,/@ and @91,-@ can be replaced often by a single division on most processors. For example, the 32-bit x86 based -processors can divide a 64-bit quantity by a 32-bit quantity and produce the quotient and remainder simultaneously. Unfortunately the GCC -compiler does not recognize that optimization and will actually produce two function calls to find the quotient and remainder respectively. - -\subsection{Single Digit Root Extraction} - -Finding the $n$'th root of an integer is fairly easy as far as numerical analysis is concerned. Algorithms such as the Newton-Raphson approximation -(\ref{eqn:newton}) series will converge very quickly to a root for any continuous function $f(x)$. - -\begin{equation} -x_{i+1} = x_i - {f(x_i) \over f'(x_i)} -\label{eqn:newton} -\end{equation} - -In this case the $n$'th root is desired and $f(x) = x^n - a$ where $a$ is the integer of which the root is desired. The derivative of $f(x)$ is -simply $f'(x) = nx^{n - 1}$. Of particular importance is that this algorithm will be used over the integers not over the a more continuous domain -such as the real numbers. As a result the root found can be above the true root by few and must be manually adjusted. Ideally at the end of the -algorithm the $n$'th root $b$ of an integer $a$ is desired such that $b^n \le a$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_n\_root}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c^b \le a$ \\ -\hline \\ -1. If $b$ is even and $a.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. $sign \leftarrow a.sign$ \\ -3. $a.sign \leftarrow MP\_ZPOS$ \\ -4. t$2 \leftarrow 2$ \\ -5. Loop \\ -\hspace{3mm}5.1 t$1 \leftarrow $ t$2$ \\ -\hspace{3mm}5.2 t$3 \leftarrow $ t$1^{b - 1}$ \\ -\hspace{3mm}5.3 t$2 \leftarrow $ t$3 $ $\cdot$ t$1$ \\ -\hspace{3mm}5.4 t$2 \leftarrow $ t$2 - a$ \\ -\hspace{3mm}5.5 t$3 \leftarrow $ t$3 \cdot b$ \\ -\hspace{3mm}5.6 t$3 \leftarrow \lfloor $t$2 / $t$3 \rfloor$ \\ -\hspace{3mm}5.7 t$2 \leftarrow $ t$1 - $ t$3$ \\ -\hspace{3mm}5.8 If t$1 \ne $ t$2$ then goto step 5. \\ -6. Loop \\ -\hspace{3mm}6.1 t$2 \leftarrow $ t$1^b$ \\ -\hspace{3mm}6.2 If t$2 > a$ then \\ -\hspace{6mm}6.2.1 t$1 \leftarrow $ t$1 - 1$ \\ -\hspace{6mm}6.2.2 Goto step 6. \\ -7. $a.sign \leftarrow sign$ \\ -8. $c \leftarrow $ t$1$ \\ -9. $c.sign \leftarrow sign$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_n\_root} -\end{figure} -\textbf{Algorithm mp\_n\_root.} -This algorithm finds the integer $n$'th root of an input using the Newton-Raphson approach. It is partially optimized based on the observation -that the numerator of ${f(x) \over f'(x)}$ can be derived from a partial denominator. That is at first the denominator is calculated by finding -$x^{b - 1}$. This value can then be multiplied by $x$ and have $a$ subtracted from it to find the numerator. This saves a total of $b - 1$ -multiplications by t$1$ inside the loop. - -The initial value of the approximation is t$2 = 2$ which allows the algorithm to start with very small values and quickly converge on the -root. Ideally this algorithm is meant to find the $n$'th root of an input where $n$ is bounded by $2 \le n \le 5$. - -EXAM,bn_mp_n_root.c - -\section{Random Number Generation} - -Random numbers come up in a variety of activities from public key cryptography to simple simulations and various randomized algorithms. Pollard-Rho -factoring for example, can make use of random values as starting points to find factors of a composite integer. In this case the algorithm presented -is solely for simulations and not intended for cryptographic use. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rand}. \\ -\textbf{Input}. An integer $b$ \\ -\textbf{Output}. A pseudo-random number of $b$ digits \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $b \le 0$ return(\textit{MP\_OKAY}) \\ -3. Pick a non-zero random digit $d$. \\ -4. $a \leftarrow a + d$ \\ -5. for $ix$ from 1 to $d - 1$ do \\ -\hspace{3mm}5.1 $a \leftarrow a \cdot \beta$ \\ -\hspace{3mm}5.2 Pick a random digit $d$. \\ -\hspace{3mm}5.3 $a \leftarrow a + d$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rand} -\end{figure} -\textbf{Algorithm mp\_rand.} -This algorithm produces a pseudo-random integer of $b$ digits. By ensuring that the first digit is non-zero the algorithm also guarantees that the -final result has at least $b$ digits. It relies heavily on a third-part random number generator which should ideally generate uniformly all of -the integers from $0$ to $\beta - 1$. - -EXAM,bn_mp_rand.c - -\section{Formatted Representations} -The ability to emit a radix-$n$ textual representation of an integer is useful for interacting with human parties. For example, the ability to -be given a string of characters such as ``114585'' and turn it into the radix-$\beta$ equivalent would make it easier to enter numbers -into a program. - -\subsection{Reading Radix-n Input} -For the purposes of this text we will assume that a simple lower ASCII map (\ref{fig:ASC}) is used for the values of from $0$ to $63$ to -printable characters. For example, when the character ``N'' is read it represents the integer $23$. The first $16$ characters of the -map are for the common representations up to hexadecimal. After that they match the ``base64'' encoding scheme which are suitable chosen -such that they are printable. While outputting as base64 may not be too helpful for human operators it does allow communication via non binary -mediums. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{cc|cc|cc|cc} -\hline \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} \\ -\hline -0 & 0 & 1 & 1 & 2 & 2 & 3 & 3 \\ -4 & 4 & 5 & 5 & 6 & 6 & 7 & 7 \\ -8 & 8 & 9 & 9 & 10 & A & 11 & B \\ -12 & C & 13 & D & 14 & E & 15 & F \\ -16 & G & 17 & H & 18 & I & 19 & J \\ -20 & K & 21 & L & 22 & M & 23 & N \\ -24 & O & 25 & P & 26 & Q & 27 & R \\ -28 & S & 29 & T & 30 & U & 31 & V \\ -32 & W & 33 & X & 34 & Y & 35 & Z \\ -36 & a & 37 & b & 38 & c & 39 & d \\ -40 & e & 41 & f & 42 & g & 43 & h \\ -44 & i & 45 & j & 46 & k & 47 & l \\ -48 & m & 49 & n & 50 & o & 51 & p \\ -52 & q & 53 & r & 54 & s & 55 & t \\ -56 & u & 57 & v & 58 & w & 59 & x \\ -60 & y & 61 & z & 62 & $+$ & 63 & $/$ \\ -\hline -\end{tabular} -\end{center} -\caption{Lower ASCII Map} -\label{fig:ASC} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_read\_radix}. \\ -\textbf{Input}. A string $str$ of length $sn$ and radix $r$. \\ -\textbf{Output}. The radix-$\beta$ equivalent mp\_int. \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. $ix \leftarrow 0$ \\ -3. If $str_0 =$ ``-'' then do \\ -\hspace{3mm}3.1 $ix \leftarrow ix + 1$ \\ -\hspace{3mm}3.2 $sign \leftarrow MP\_NEG$ \\ -4. else \\ -\hspace{3mm}4.1 $sign \leftarrow MP\_ZPOS$ \\ -5. $a \leftarrow 0$ \\ -6. for $iy$ from $ix$ to $sn - 1$ do \\ -\hspace{3mm}6.1 Let $y$ denote the position in the map of $str_{iy}$. \\ -\hspace{3mm}6.2 If $str_{iy}$ is not in the map or $y \ge r$ then goto step 7. \\ -\hspace{3mm}6.3 $a \leftarrow a \cdot r$ \\ -\hspace{3mm}6.4 $a \leftarrow a + y$ \\ -7. If $a \ne 0$ then $a.sign \leftarrow sign$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_read\_radix} -\end{figure} -\textbf{Algorithm mp\_read\_radix.} -This algorithm will read an ASCII string and produce the radix-$\beta$ mp\_int representation of the same integer. A minus symbol ``-'' may precede the -string to indicate the value is negative, otherwise it is assumed to be positive. The algorithm will read up to $sn$ characters from the input -and will stop when it reads a character it cannot map the algorithm stops reading characters from the string. This allows numbers to be embedded -as part of larger input without any significant problem. - -EXAM,bn_mp_read_radix.c - -\subsection{Generating Radix-$n$ Output} -Generating radix-$n$ output is fairly trivial with a division and remainder algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toradix}. \\ -\textbf{Input}. A mp\_int $a$ and an integer $r$\\ -\textbf{Output}. The radix-$r$ representation of $a$ \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. If $a = 0$ then $str = $ ``$0$'' and return(\textit{MP\_OKAY}). \\ -3. $t \leftarrow a$ \\ -4. $str \leftarrow$ ``'' \\ -5. if $t.sign = MP\_NEG$ then \\ -\hspace{3mm}5.1 $str \leftarrow str + $ ``-'' \\ -\hspace{3mm}5.2 $t.sign = MP\_ZPOS$ \\ -6. While ($t \ne 0$) do \\ -\hspace{3mm}6.1 $d \leftarrow t \mbox{ (mod }r\mbox{)}$ \\ -\hspace{3mm}6.2 $t \leftarrow \lfloor t / r \rfloor$ \\ -\hspace{3mm}6.3 Look up $d$ in the map and store the equivalent character in $y$. \\ -\hspace{3mm}6.4 $str \leftarrow str + y$ \\ -7. If $str_0 = $``$-$'' then \\ -\hspace{3mm}7.1 Reverse the digits $str_1, str_2, \ldots str_n$. \\ -8. Otherwise \\ -\hspace{3mm}8.1 Reverse the digits $str_0, str_1, \ldots str_n$. \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toradix} -\end{figure} -\textbf{Algorithm mp\_toradix.} -This algorithm computes the radix-$r$ representation of an mp\_int $a$. The ``digits'' of the representation are extracted by reducing -successive powers of $\lfloor a / r^k \rfloor$ the input modulo $r$ until $r^k > a$. Note that instead of actually dividing by $r^k$ in -each iteration the quotient $\lfloor a / r \rfloor$ is saved for the next iteration. As a result a series of trivial $n \times 1$ divisions -are required instead of a series of $n \times k$ divisions. One design flaw of this approach is that the digits are produced in the reverse order -(see~\ref{fig:mpradix}). To remedy this flaw the digits must be swapped or simply ``reversed''. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Value of $a$} & \textbf{Value of $d$} & \textbf{Value of $str$} \\ -\hline $1234$ & -- & -- \\ -\hline $123$ & $4$ & ``4'' \\ -\hline $12$ & $3$ & ``43'' \\ -\hline $1$ & $2$ & ``432'' \\ -\hline $0$ & $1$ & ``4321'' \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Algorithm mp\_toradix.} -\label{fig:mpradix} -\end{figure} - -EXAM,bn_mp_toradix.c - -\chapter{Number Theoretic Algorithms} -This chapter discusses several fundamental number theoretic algorithms such as the greatest common divisor, least common multiple and Jacobi -symbol computation. These algorithms arise as essential components in several key cryptographic algorithms such as the RSA public key algorithm and -various Sieve based factoring algorithms. - -\section{Greatest Common Divisor} -The greatest common divisor of two integers $a$ and $b$, often denoted as $(a, b)$ is the largest integer $k$ that is a proper divisor of -both $a$ and $b$. That is, $k$ is the largest integer such that $0 \equiv a \mbox{ (mod }k\mbox{)}$ and $0 \equiv b \mbox{ (mod }k\mbox{)}$ occur -simultaneously. - -The most common approach (cite) is to reduce one input modulo another. That is if $a$ and $b$ are divisible by some integer $k$ and if $qa + r = b$ then -$r$ is also divisible by $k$. The reduction pattern follows $\left < a , b \right > \rightarrow \left < b, a \mbox{ mod } b \right >$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (I)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 $r \leftarrow a \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}1.2 $a \leftarrow b$ \\ -\hspace{3mm}1.3 $b \leftarrow r$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (I)} -\label{fig:gcd1} -\end{figure} - -This algorithm will quickly converge on the greatest common divisor since the residue $r$ tends diminish rapidly. However, divisions are -relatively expensive operations to perform and should ideally be avoided. There is another approach based on a similar relationship of -greatest common divisors. The faster approach is based on the observation that if $k$ divides both $a$ and $b$ it will also divide $a - b$. -In particular, we would like $a - b$ to decrease in magnitude which implies that $b \ge a$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (II)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}1.2 $b \leftarrow b - a$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (II)} -\label{fig:gcd2} -\end{figure} - -\textbf{Proof} \textit{Algorithm~\ref{fig:gcd2} will return the greatest common divisor of $a$ and $b$.} -The algorithm in figure~\ref{fig:gcd2} will eventually terminate since $b \ge a$ the subtraction in step 1.2 will be a value less than $b$. In other -words in every iteration that tuple $\left < a, b \right >$ decrease in magnitude until eventually $a = b$. Since both $a$ and $b$ are always -divisible by the greatest common divisor (\textit{until the last iteration}) and in the last iteration of the algorithm $b = 0$, therefore, in the -second to last iteration of the algorithm $b = a$ and clearly $(a, a) = a$ which concludes the proof. \textbf{QED}. - -As a matter of practicality algorithm \ref{fig:gcd1} decreases far too slowly to be useful. Specially if $b$ is much larger than $a$ such that -$b - a$ is still very much larger than $a$. A simple addition to the algorithm is to divide $b - a$ by a power of some integer $p$ which does -not divide the greatest common divisor but will divide $b - a$. In this case ${b - a} \over p$ is also an integer and still divisible by -the greatest common divisor. - -However, instead of factoring $b - a$ to find a suitable value of $p$ the powers of $p$ can be removed from $a$ and $b$ that are in common first. -Then inside the loop whenever $b - a$ is divisible by some power of $p$ it can be safely removed. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (III)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. $k \leftarrow 0$ \\ -2. While $a$ and $b$ are both divisible by $p$ do \\ -\hspace{3mm}2.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -\hspace{3mm}2.2 $b \leftarrow \lfloor b / p \rfloor$ \\ -\hspace{3mm}2.3 $k \leftarrow k + 1$ \\ -3. While $a$ is divisible by $p$ do \\ -\hspace{3mm}3.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -4. While $b$ is divisible by $p$ do \\ -\hspace{3mm}4.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -5. While ($b > 0$) do \\ -\hspace{3mm}5.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}5.2 $b \leftarrow b - a$ \\ -\hspace{3mm}5.3 While $b$ is divisible by $p$ do \\ -\hspace{6mm}5.3.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -6. Return($a \cdot p^k$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (III)} -\label{fig:gcd3} -\end{figure} - -This algorithm is based on the first except it removes powers of $p$ first and inside the main loop to ensure the tuple $\left < a, b \right >$ -decreases more rapidly. The first loop on step two removes powers of $p$ that are in common. A count, $k$, is kept which will present a common -divisor of $p^k$. After step two the remaining common divisor of $a$ and $b$ cannot be divisible by $p$. This means that $p$ can be safely -divided out of the difference $b - a$ so long as the division leaves no remainder. - -In particular the value of $p$ should be chosen such that the division on step 5.3.1 occur often. It also helps that division by $p$ be easy -to compute. The ideal choice of $p$ is two since division by two amounts to a right logical shift. Another important observation is that by -step five both $a$ and $b$ are odd. Therefore, the diffrence $b - a$ must be even which means that each iteration removes one bit from the -largest of the pair. - -\subsection{Complete Greatest Common Divisor} -The algorithms presented so far cannot handle inputs which are zero or negative. The following algorithm can handle all input cases properly -and will produce the greatest common divisor. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_gcd}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The greatest common divisor $c = (a, b)$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow \vert b \vert $ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b = 0$ then \\ -\hspace{3mm}2.1 $c \leftarrow \vert a \vert $ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $u \leftarrow \vert a \vert, v \leftarrow \vert b \vert$ \\ -4. $k \leftarrow 0$ \\ -5. While $u.used > 0$ and $v.used > 0$ and $u_0 \equiv v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}5.3 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -8. While $v.used > 0$ \\ -\hspace{3mm}8.1 If $\vert u \vert > \vert v \vert$ then \\ -\hspace{6mm}8.1.1 Swap $u$ and $v$. \\ -\hspace{3mm}8.2 $v \leftarrow \vert v \vert - \vert u \vert$ \\ -\hspace{3mm}8.3 While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{6mm}8.3.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -9. $c \leftarrow u \cdot 2^k$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_gcd} -\end{figure} -\textbf{Algorithm mp\_gcd.} -This algorithm will produce the greatest common divisor of two mp\_ints $a$ and $b$. The algorithm was originally based on Algorithm B of -Knuth \cite[pp. 338]{TAOCPV2} but has been modified to be simpler to explain. In theory it achieves the same asymptotic working time as -Algorithm B and in practice this appears to be true. - -The first two steps handle the cases where either one of or both inputs are zero. If either input is zero the greatest common divisor is the -largest input or zero if they are both zero. If the inputs are not trivial than $u$ and $v$ are assigned the absolute values of -$a$ and $b$ respectively and the algorithm will proceed to reduce the pair. - -Step five will divide out any common factors of two and keep track of the count in the variable $k$. After this step, two is no longer a -factor of the remaining greatest common divisor between $u$ and $v$ and can be safely evenly divided out of either whenever they are even. Step -six and seven ensure that the $u$ and $v$ respectively have no more factors of two. At most only one of the while--loops will iterate since -they cannot both be even. - -By step eight both of $u$ and $v$ are odd which is required for the inner logic. First the pair are swapped such that $v$ is equal to -or greater than $u$. This ensures that the subtraction on step 8.2 will always produce a positive and even result. Step 8.3 removes any -factors of two from the difference $u$ to ensure that in the next iteration of the loop both are once again odd. - -After $v = 0$ occurs the variable $u$ has the greatest common divisor of the pair $\left < u, v \right >$ just after step six. The result -must be adjusted by multiplying by the common factors of two ($2^k$) removed earlier. - -EXAM,bn_mp_gcd.c - -This function makes use of the macros mp\_iszero and mp\_iseven. The former evaluates to $1$ if the input mp\_int is equivalent to the -integer zero otherwise it evaluates to $0$. The latter evaluates to $1$ if the input mp\_int represents a non-zero even integer otherwise -it evaluates to $0$. Note that just because mp\_iseven may evaluate to $0$ does not mean the input is odd, it could also be zero. The three -trivial cases of inputs are handled on lines @23,zero@ through @29,}@. After those lines the inputs are assumed to be non-zero. - -Lines @32,if@ and @36,if@ make local copies $u$ and $v$ of the inputs $a$ and $b$ respectively. At this point the common factors of two -must be divided out of the two inputs. The block starting at line @43,common@ removes common factors of two by first counting the number of trailing -zero bits in both. The local integer $k$ is used to keep track of how many factors of $2$ are pulled out of both values. It is assumed that -the number of factors will not exceed the maximum value of a C ``int'' data type\footnote{Strictly speaking no array in C may have more than -entries than are accessible by an ``int'' so this is not a limitation.}. - -At this point there are no more common factors of two in the two values. The divisions by a power of two on lines @60,div_2d@ and @67,div_2d@ remove -any independent factors of two such that both $u$ and $v$ are guaranteed to be an odd integer before hitting the main body of the algorithm. The while loop -on line @72, while@ performs the reduction of the pair until $v$ is equal to zero. The unsigned comparison and subtraction algorithms are used in -place of the full signed routines since both values are guaranteed to be positive and the result of the subtraction is guaranteed to be non-negative. - -\section{Least Common Multiple} -The least common multiple of a pair of integers is their product divided by their greatest common divisor. For two integers $a$ and $b$ the -least common multiple is normally denoted as $[ a, b ]$ and numerically equivalent to ${ab} \over {(a, b)}$. For example, if $a = 2 \cdot 2 \cdot 3 = 12$ -and $b = 2 \cdot 3 \cdot 3 \cdot 7 = 126$ the least common multiple is ${126 \over {(12, 126)}} = {126 \over 6} = 21$. - -The least common multiple arises often in coding theory as well as number theory. If two functions have periods of $a$ and $b$ respectively they will -collide, that is be in synchronous states, after only $[ a, b ]$ iterations. This is why, for example, random number generators based on -Linear Feedback Shift Registers (LFSR) tend to use registers with periods which are co-prime (\textit{e.g. the greatest common divisor is one.}). -Similarly in number theory if a composite $n$ has two prime factors $p$ and $q$ then maximal order of any unit of $\Z/n\Z$ will be $[ p - 1, q - 1] $. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lcm}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The least common multiple $c = [a, b]$. \\ -\hline \\ -1. $c \leftarrow (a, b)$ \\ -2. $t \leftarrow a \cdot b$ \\ -3. $c \leftarrow \lfloor t / c \rfloor$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lcm} -\end{figure} -\textbf{Algorithm mp\_lcm.} -This algorithm computes the least common multiple of two mp\_int inputs $a$ and $b$. It computes the least common multiple directly by -dividing the product of the two inputs by their greatest common divisor. - -EXAM,bn_mp_lcm.c - -\section{Jacobi Symbol Computation} -To explain the Jacobi Symbol we shall first discuss the Legendre function\footnote{Arrg. What is the name of this?} off which the Jacobi symbol is -defined. The Legendre function computes whether or not an integer $a$ is a quadratic residue modulo an odd prime $p$. Numerically it is -equivalent to equation \ref{eqn:legendre}. - -\textit{-- Tom, don't be an ass, cite your source here...!} - -\begin{equation} -a^{(p-1)/2} \equiv \begin{array}{rl} - -1 & \mbox{if }a\mbox{ is a quadratic non-residue.} \\ - 0 & \mbox{if }a\mbox{ divides }p\mbox{.} \\ - 1 & \mbox{if }a\mbox{ is a quadratic residue}. - \end{array} \mbox{ (mod }p\mbox{)} -\label{eqn:legendre} -\end{equation} - -\textbf{Proof.} \textit{Equation \ref{eqn:legendre} correctly identifies the residue status of an integer $a$ modulo a prime $p$.} -An integer $a$ is a quadratic residue if the following equation has a solution. - -\begin{equation} -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\label{eqn:root} -\end{equation} - -Consider the following equation. - -\begin{equation} -0 \equiv x^{p-1} - 1 \equiv \left \lbrace \left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \right \rbrace + \left ( a^{(p-1)/2} - 1 \right ) \mbox{ (mod }p\mbox{)} -\label{eqn:rooti} -\end{equation} - -Whether equation \ref{eqn:root} has a solution or not equation \ref{eqn:rooti} is always true. If $a^{(p-1)/2} - 1 \equiv 0 \mbox{ (mod }p\mbox{)}$ -then the quantity in the braces must be zero. By reduction, - -\begin{eqnarray} -\left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \equiv 0 \nonumber \\ -\left (x^2 \right )^{(p-1)/2} \equiv a^{(p-1)/2} \nonumber \\ -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\end{eqnarray} - -As a result there must be a solution to the quadratic equation and in turn $a$ must be a quadratic residue. If $a$ does not divide $p$ and $a$ -is not a quadratic residue then the only other value $a^{(p-1)/2}$ may be congruent to is $-1$ since -\begin{equation} -0 \equiv a^{p - 1} - 1 \equiv (a^{(p-1)/2} + 1)(a^{(p-1)/2} - 1) \mbox{ (mod }p\mbox{)} -\end{equation} -One of the terms on the right hand side must be zero. \textbf{QED} - -\subsection{Jacobi Symbol} -The Jacobi symbol is a generalization of the Legendre function for any odd non prime moduli $p$ greater than 2. If $p = \prod_{i=0}^n p_i$ then -the Jacobi symbol $\left ( { a \over p } \right )$ is equal to the following equation. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { a \over p_0} \right ) \left ( { a \over p_1} \right ) \ldots \left ( { a \over p_n} \right ) -\end{equation} - -By inspection if $p$ is prime the Jacobi symbol is equivalent to the Legendre function. The following facts\footnote{See HAC \cite[pp. 72-74]{HAC} for -further details.} will be used to derive an efficient Jacobi symbol algorithm. Where $p$ is an odd integer greater than two and $a, b \in \Z$ the -following are true. - -\begin{enumerate} -\item $\left ( { a \over p} \right )$ equals $-1$, $0$ or $1$. -\item $\left ( { ab \over p} \right ) = \left ( { a \over p} \right )\left ( { b \over p} \right )$. -\item If $a \equiv b$ then $\left ( { a \over p} \right ) = \left ( { b \over p} \right )$. -\item $\left ( { 2 \over p} \right )$ equals $1$ if $p \equiv 1$ or $7 \mbox{ (mod }8\mbox{)}$. Otherwise, it equals $-1$. -\item $\left ( { a \over p} \right ) \equiv \left ( { p \over a} \right ) \cdot (-1)^{(p-1)(a-1)/4}$. More specifically -$\left ( { a \over p} \right ) = \left ( { p \over a} \right )$ if $p \equiv a \equiv 1 \mbox{ (mod }4\mbox{)}$. -\end{enumerate} - -Using these facts if $a = 2^k \cdot a'$ then - -\begin{eqnarray} -\left ( { a \over p } \right ) = \left ( {{2^k} \over p } \right ) \left ( {a' \over p} \right ) \nonumber \\ - = \left ( {2 \over p } \right )^k \left ( {a' \over p} \right ) -\label{eqn:jacobi} -\end{eqnarray} - -By fact five, - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { p \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -Subsequently by fact three since $p \equiv (p \mbox{ mod }a) \mbox{ (mod }a\mbox{)}$ then - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { {p \mbox{ mod } a} \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -By putting both observations into equation \ref{eqn:jacobi} the following simplified equation is formed. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( {2 \over p } \right )^k \left ( {{p\mbox{ mod }a'} \over a'} \right ) \cdot (-1)^{(p-1)(a'-1)/4} -\end{equation} - -The value of $\left ( {{p \mbox{ mod }a'} \over a'} \right )$ can be found by using the same equation recursively. The value of -$\left ( {2 \over p } \right )^k$ equals $1$ if $k$ is even otherwise it equals $\left ( {2 \over p } \right )$. Using this approach the -factors of $p$ do not have to be known. Furthermore, if $(a, p) = 1$ then the algorithm will terminate when the recursion requests the -Jacobi symbol computation of $\left ( {1 \over a'} \right )$ which is simply $1$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_jacobi}. \\ -\textbf{Input}. mp\_int $a$ and $p$, $a \ge 0$, $p \ge 3$, $p \equiv 1 \mbox{ (mod }2\mbox{)}$ \\ -\textbf{Output}. The Jacobi symbol $c = \left ( {a \over p } \right )$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow 0$ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $a = 1$ then \\ -\hspace{3mm}2.1 $c \leftarrow 1$ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $a' \leftarrow a$ \\ -4. $k \leftarrow 0$ \\ -5. While $a'.used > 0$ and $a'_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $a' \leftarrow \lfloor a' / 2 \rfloor$ \\ -6. If $k \equiv 0 \mbox{ (mod }2\mbox{)}$ then \\ -\hspace{3mm}6.1 $s \leftarrow 1$ \\ -7. else \\ -\hspace{3mm}7.1 $r \leftarrow p_0 \mbox{ (mod }8\mbox{)}$ \\ -\hspace{3mm}7.2 If $r = 1$ or $r = 7$ then \\ -\hspace{6mm}7.2.1 $s \leftarrow 1$ \\ -\hspace{3mm}7.3 else \\ -\hspace{6mm}7.3.1 $s \leftarrow -1$ \\ -8. If $p_0 \equiv a'_0 \equiv 3 \mbox{ (mod }4\mbox{)}$ then \\ -\hspace{3mm}8.1 $s \leftarrow -s$ \\ -9. If $a' \ne 1$ then \\ -\hspace{3mm}9.1 $p' \leftarrow p \mbox{ (mod }a'\mbox{)}$ \\ -\hspace{3mm}9.2 $s \leftarrow s \cdot \mbox{mp\_jacobi}(p', a')$ \\ -10. $c \leftarrow s$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_jacobi} -\end{figure} -\textbf{Algorithm mp\_jacobi.} -This algorithm computes the Jacobi symbol for an arbitrary positive integer $a$ with respect to an odd integer $p$ greater than three. The algorithm -is based on algorithm 2.149 of HAC \cite[pp. 73]{HAC}. - -Step numbers one and two handle the trivial cases of $a = 0$ and $a = 1$ respectively. Step five determines the number of two factors in the -input $a$. If $k$ is even than the term $\left ( { 2 \over p } \right )^k$ must always evaluate to one. If $k$ is odd than the term evaluates to one -if $p_0$ is congruent to one or seven modulo eight, otherwise it evaluates to $-1$. After the the $\left ( { 2 \over p } \right )^k$ term is handled -the $(-1)^{(p-1)(a'-1)/4}$ is computed and multiplied against the current product $s$. The latter term evaluates to one if both $p$ and $a'$ -are congruent to one modulo four, otherwise it evaluates to negative one. - -By step nine if $a'$ does not equal one a recursion is required. Step 9.1 computes $p' \equiv p \mbox{ (mod }a'\mbox{)}$ and will recurse to compute -$\left ( {p' \over a'} \right )$ which is multiplied against the current Jacobi product. - -EXAM,bn_mp_jacobi.c - -As a matter of practicality the variable $a'$ as per the pseudo-code is reprensented by the variable $a1$ since the $'$ symbol is not valid for a C -variable name character. - -The two simple cases of $a = 0$ and $a = 1$ are handled at the very beginning to simplify the algorithm. If the input is non-trivial the algorithm -has to proceed compute the Jacobi. The variable $s$ is used to hold the current Jacobi product. Note that $s$ is merely a C ``int'' data type since -the values it may obtain are merely $-1$, $0$ and $1$. - -After a local copy of $a$ is made all of the factors of two are divided out and the total stored in $k$. Technically only the least significant -bit of $k$ is required, however, it makes the algorithm simpler to follow to perform an addition. In practice an exclusive-or and addition have the same -processor requirements and neither is faster than the other. - -Line @59, if@ through @70, }@ determines the value of $\left ( { 2 \over p } \right )^k$. If the least significant bit of $k$ is zero than -$k$ is even and the value is one. Otherwise, the value of $s$ depends on which residue class $p$ belongs to modulo eight. The value of -$(-1)^{(p-1)(a'-1)/4}$ is compute and multiplied against $s$ on lines @73, if@ through @75, }@. - -Finally, if $a1$ does not equal one the algorithm must recurse and compute $\left ( {p' \over a'} \right )$. - -\textit{-- Comment about default $s$ and such...} - -\section{Modular Inverse} -\label{sec:modinv} -The modular inverse of a number actually refers to the modular multiplicative inverse. Essentially for any integer $a$ such that $(a, p) = 1$ there -exist another integer $b$ such that $ab \equiv 1 \mbox{ (mod }p\mbox{)}$. The integer $b$ is called the multiplicative inverse of $a$ which is -denoted as $b = a^{-1}$. Technically speaking modular inversion is a well defined operation for any finite ring or field not just for rings and -fields of integers. However, the former will be the matter of discussion. - -The simplest approach is to compute the algebraic inverse of the input. That is to compute $b \equiv a^{\Phi(p) - 1}$. If $\Phi(p)$ is the -order of the multiplicative subgroup modulo $p$ then $b$ must be the multiplicative inverse of $a$. The proof of which is trivial. - -\begin{equation} -ab \equiv a \left (a^{\Phi(p) - 1} \right ) \equiv a^{\Phi(p)} \equiv a^0 \equiv 1 \mbox{ (mod }p\mbox{)} -\end{equation} - -However, as simple as this approach may be it has two serious flaws. It requires that the value of $\Phi(p)$ be known which if $p$ is composite -requires all of the prime factors. This approach also is very slow as the size of $p$ grows. - -A simpler approach is based on the observation that solving for the multiplicative inverse is equivalent to solving the linear -Diophantine\footnote{See LeVeque \cite[pp. 40-43]{LeVeque} for more information.} equation. - -\begin{equation} -ab + pq = 1 -\end{equation} - -Where $a$, $b$, $p$ and $q$ are all integers. If such a pair of integers $ \left < b, q \right >$ exist than $b$ is the multiplicative inverse of -$a$ modulo $p$. The extended Euclidean algorithm (Knuth \cite[pp. 342]{TAOCPV2}) can be used to solve such equations provided $(a, p) = 1$. -However, instead of using that algorithm directly a variant known as the binary Extended Euclidean algorithm will be used in its place. The -binary approach is very similar to the binary greatest common divisor algorithm except it will produce a full solution to the Diophantine -equation. - -\subsection{General Case} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_invmod}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $(a, b) = 1$, $p \ge 2$, $0 < a < p$. \\ -\textbf{Output}. The modular inverse $c \equiv a^{-1} \mbox{ (mod }b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_VAL}). \\ -2. If $b_0 \equiv 1 \mbox{ (mod }2\mbox{)}$ then use algorithm fast\_mp\_invmod. \\ -3. $x \leftarrow \vert a \vert, y \leftarrow b$ \\ -4. If $x_0 \equiv y_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ then return(\textit{MP\_VAL}). \\ -5. $B \leftarrow 0, C \leftarrow 0, A \leftarrow 1, D \leftarrow 1$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}6.2 If ($A.used > 0$ and $A_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($B.used > 0$ and $B_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}6.2.1 $A \leftarrow A + y$ \\ -\hspace{6mm}6.2.2 $B \leftarrow B - x$ \\ -\hspace{3mm}6.3 $A \leftarrow \lfloor A / 2 \rfloor$ \\ -\hspace{3mm}6.4 $B \leftarrow \lfloor B / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -\hspace{3mm}7.2 If ($C.used > 0$ and $C_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($D.used > 0$ and $D_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}7.2.1 $C \leftarrow C + y$ \\ -\hspace{6mm}7.2.2 $D \leftarrow D - x$ \\ -\hspace{3mm}7.3 $C \leftarrow \lfloor C / 2 \rfloor$ \\ -\hspace{3mm}7.4 $D \leftarrow \lfloor D / 2 \rfloor$ \\ -8. If $u \ge v$ then \\ -\hspace{3mm}8.1 $u \leftarrow u - v$ \\ -\hspace{3mm}8.2 $A \leftarrow A - C$ \\ -\hspace{3mm}8.3 $B \leftarrow B - D$ \\ -9. else \\ -\hspace{3mm}9.1 $v \leftarrow v - u$ \\ -\hspace{3mm}9.2 $C \leftarrow C - A$ \\ -\hspace{3mm}9.3 $D \leftarrow D - B$ \\ -10. If $u \ne 0$ goto step 6. \\ -11. If $v \ne 1$ return(\textit{MP\_VAL}). \\ -12. While $C \le 0$ do \\ -\hspace{3mm}12.1 $C \leftarrow C + b$ \\ -13. While $C \ge b$ do \\ -\hspace{3mm}13.1 $C \leftarrow C - b$ \\ -14. $c \leftarrow C$ \\ -15. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\end{figure} -\textbf{Algorithm mp\_invmod.} -This algorithm computes the modular multiplicative inverse of an integer $a$ modulo an integer $b$. This algorithm is a variation of the -extended binary Euclidean algorithm from HAC \cite[pp. 608]{HAC}. It has been modified to only compute the modular inverse and not a complete -Diophantine solution. - -If $b \le 0$ than the modulus is invalid and MP\_VAL is returned. Similarly if both $a$ and $b$ are even then there cannot be a multiplicative -inverse for $a$ and the error is reported. - -The astute reader will observe that steps seven through nine are very similar to the binary greatest common divisor algorithm mp\_gcd. In this case -the other variables to the Diophantine equation are solved. The algorithm terminates when $u = 0$ in which case the solution is - -\begin{equation} -Ca + Db = v -\end{equation} - -If $v$, the greatest common divisor of $a$ and $b$ is not equal to one then the algorithm will report an error as no inverse exists. Otherwise, $C$ -is the modular inverse of $a$. The actual value of $C$ is congruent to, but not necessarily equal to, the ideal modular inverse which should lie -within $1 \le a^{-1} < b$. Step numbers twelve and thirteen adjust the inverse until it is in range. If the original input $a$ is within $0 < a < p$ -then only a couple of additions or subtractions will be required to adjust the inverse. - -EXAM,bn_mp_invmod.c - -\subsubsection{Odd Moduli} - -When the modulus $b$ is odd the variables $A$ and $C$ are fixed and are not required to compute the inverse. In particular by attempting to solve -the Diophantine $Cb + Da = 1$ only $B$ and $D$ are required to find the inverse of $a$. - -The algorithm fast\_mp\_invmod is a direct adaptation of algorithm mp\_invmod with all all steps involving either $A$ or $C$ removed. This -optimization will halve the time required to compute the modular inverse. - -\section{Primality Tests} - -A non-zero integer $a$ is said to be prime if it is not divisible by any other integer excluding one and itself. For example, $a = 7$ is prime -since the integers $2 \ldots 6$ do not evenly divide $a$. By contrast, $a = 6$ is not prime since $a = 6 = 2 \cdot 3$. - -Prime numbers arise in cryptography considerably as they allow finite fields to be formed. The ability to determine whether an integer is prime or -not quickly has been a viable subject in cryptography and number theory for considerable time. The algorithms that will be presented are all -probablistic algorithms in that when they report an integer is composite it must be composite. However, when the algorithms report an integer is -prime the algorithm may be incorrect. - -As will be discussed it is possible to limit the probability of error so well that for practical purposes the probablity of error might as -well be zero. For the purposes of these discussions let $n$ represent the candidate integer of which the primality is in question. - -\subsection{Trial Division} - -Trial division means to attempt to evenly divide a candidate integer by small prime integers. If the candidate can be evenly divided it obviously -cannot be prime. By dividing by all primes $1 < p \le \sqrt{n}$ this test can actually prove whether an integer is prime. However, such a test -would require a prohibitive amount of time as $n$ grows. - -Instead of dividing by every prime, a smaller, more mangeable set of primes may be used instead. By performing trial division with only a subset -of the primes less than $\sqrt{n} + 1$ the algorithm cannot prove if a candidate is prime. However, often it can prove a candidate is not prime. - -The benefit of this test is that trial division by small values is fairly efficient. Specially compared to the other algorithms that will be -discussed shortly. The probability that this approach correctly identifies a composite candidate when tested with all primes upto $q$ is given by -$1 - {1.12 \over ln(q)}$. The graph (\ref{pic:primality}, will be added later) demonstrates the probability of success for the range -$3 \le q \le 100$. - -At approximately $q = 30$ the gain of performing further tests diminishes fairly quickly. At $q = 90$ further testing is generally not going to -be of any practical use. In the case of LibTomMath the default limit $q = 256$ was chosen since it is not too high and will eliminate -approximately $80\%$ of all candidate integers. The constant \textbf{PRIME\_SIZE} is equal to the number of primes in the test base. The -array \_\_prime\_tab is an array of the first \textbf{PRIME\_SIZE} prime numbers. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_is\_divisible}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $c = 1$ if $n$ is divisible by a small prime, otherwise $c = 0$. \\ -\hline \\ -1. for $ix$ from $0$ to $PRIME\_SIZE$ do \\ -\hspace{3mm}1.1 $d \leftarrow n \mbox{ (mod }\_\_prime\_tab_{ix}\mbox{)}$ \\ -\hspace{3mm}1.2 If $d = 0$ then \\ -\hspace{6mm}1.2.1 $c \leftarrow 1$ \\ -\hspace{6mm}1.2.2 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow 0$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_is\_divisible} -\end{figure} -\textbf{Algorithm mp\_prime\_is\_divisible.} -This algorithm attempts to determine if a candidate integer $n$ is composite by performing trial divisions. - -EXAM,bn_mp_prime_is_divisible.c - -The algorithm defaults to a return of $0$ in case an error occurs. The values in the prime table are all specified to be in the range of a -mp\_digit. The table \_\_prime\_tab is defined in the following file. - -EXAM,bn_prime_tab.c - -Note that there are two possible tables. When an mp\_digit is 7-bits long only the primes upto $127$ may be included, otherwise the primes -upto $1619$ are used. Note that the value of \textbf{PRIME\_SIZE} is a constant dependent on the size of a mp\_digit. - -\subsection{The Fermat Test} -The Fermat test is probably one the oldest tests to have a non-trivial probability of success. It is based on the fact that if $n$ is in -fact prime then $a^{n} \equiv a \mbox{ (mod }n\mbox{)}$ for all $0 < a < n$. The reason being that if $n$ is prime than the order of -the multiplicative sub group is $n - 1$. Any base $a$ must have an order which divides $n - 1$ and as such $a^n$ is equivalent to -$a^1 = a$. - -If $n$ is composite then any given base $a$ does not have to have a period which divides $n - 1$. In which case -it is possible that $a^n \nequiv a \mbox{ (mod }n\mbox{)}$. However, this test is not absolute as it is possible that the order -of a base will divide $n - 1$ which would then be reported as prime. Such a base yields what is known as a Fermat pseudo-prime. Several -integers known as Carmichael numbers will be a pseudo-prime to all valid bases. Fortunately such numbers are extremely rare as $n$ grows -in size. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_fermat}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $b^a \equiv b \mbox{ (mod }a\mbox{)}$, otherwise $c = 0$. \\ -\hline \\ -1. $t \leftarrow b^a \mbox{ (mod }a\mbox{)}$ \\ -2. If $t = b$ then \\ -\hspace{3mm}2.1 $c = 1$ \\ -3. else \\ -\hspace{3mm}3.1 $c = 0$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_fermat} -\end{figure} -\textbf{Algorithm mp\_prime\_fermat.} -This algorithm determines whether an mp\_int $a$ is a Fermat prime to the base $b$ or not. It uses a single modular exponentiation to -determine the result. - -EXAM,bn_mp_prime_fermat.c - -\subsection{The Miller-Rabin Test} -The Miller-Rabin (citation) test is another primality test which has tighter error bounds than the Fermat test specifically with sequentially chosen -candidate integers. The algorithm is based on the observation that if $n - 1 = 2^kr$ and if $b^r \nequiv \pm 1$ then after upto $k - 1$ squarings the -value must be equal to $-1$. The squarings are stopped as soon as $-1$ is observed. If the value of $1$ is observed first it means that -some value not congruent to $\pm 1$ when squared equals one which cannot occur if $n$ is prime. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_miller\_rabin}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $a$ is a Miller-Rabin prime to the base $a$, otherwise $c = 0$. \\ -\hline -1. $a' \leftarrow a - 1$ \\ -2. $r \leftarrow n1$ \\ -3. $c \leftarrow 0, s \leftarrow 0$ \\ -4. While $r.used > 0$ and $r_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}4.1 $s \leftarrow s + 1$ \\ -\hspace{3mm}4.2 $r \leftarrow \lfloor r / 2 \rfloor$ \\ -5. $y \leftarrow b^r \mbox{ (mod }a\mbox{)}$ \\ -6. If $y \nequiv \pm 1$ then \\ -\hspace{3mm}6.1 $j \leftarrow 1$ \\ -\hspace{3mm}6.2 While $j \le (s - 1)$ and $y \nequiv a'$ \\ -\hspace{6mm}6.2.1 $y \leftarrow y^2 \mbox{ (mod }a\mbox{)}$ \\ -\hspace{6mm}6.2.2 If $y = 1$ then goto step 8. \\ -\hspace{6mm}6.2.3 $j \leftarrow j + 1$ \\ -\hspace{3mm}6.3 If $y \nequiv a'$ goto step 8. \\ -7. $c \leftarrow 1$\\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_miller\_rabin} -\end{figure} -\textbf{Algorithm mp\_prime\_miller\_rabin.} -This algorithm performs one trial round of the Miller-Rabin algorithm to the base $b$. It will set $c = 1$ if the algorithm cannot determine -if $b$ is composite or $c = 0$ if $b$ is provably composite. The values of $s$ and $r$ are computed such that $a' = a - 1 = 2^sr$. - -If the value $y \equiv b^r$ is congruent to $\pm 1$ then the algorithm cannot prove if $a$ is composite or not. Otherwise, the algorithm will -square $y$ upto $s - 1$ times stopping only when $y \equiv -1$. If $y^2 \equiv 1$ and $y \nequiv \pm 1$ then the algorithm can report that $a$ -is provably composite. If the algorithm performs $s - 1$ squarings and $y \nequiv -1$ then $a$ is provably composite. If $a$ is not provably -composite then it is \textit{probably} prime. - -EXAM,bn_mp_prime_miller_rabin.c - - - - -\backmatter -\appendix -\begin{thebibliography}{ABCDEF} -\bibitem[1]{TAOCPV2} -Donald Knuth, \textit{The Art of Computer Programming}, Third Edition, Volume Two, Seminumerical Algorithms, Addison-Wesley, 1998 - -\bibitem[2]{HAC} -A. Menezes, P. van Oorschot, S. Vanstone, \textit{Handbook of Applied Cryptography}, CRC Press, 1996 - -\bibitem[3]{ROSE} -Michael Rosing, \textit{Implementing Elliptic Curve Cryptography}, Manning Publications, 1999 - -\bibitem[4]{COMBA} -Paul G. Comba, \textit{Exponentiation Cryptosystems on the IBM PC}. IBM Systems Journal 29(4): 526-538 (1990) - -\bibitem[5]{KARA} -A. Karatsuba, Doklay Akad. Nauk SSSR 145 (1962), pp.293-294 - -\bibitem[6]{KARAP} -Andre Weimerskirch and Christof Paar, \textit{Generalizations of the Karatsuba Algorithm for Polynomial Multiplication}, Submitted to Design, Codes and Cryptography, March 2002 - -\bibitem[7]{BARRETT} -Paul Barrett, \textit{Implementing the Rivest Shamir and Adleman Public Key Encryption Algorithm on a Standard Digital Signal Processor}, Advances in Cryptology, Crypto '86, Springer-Verlag. - -\bibitem[8]{MONT} -P.L.Montgomery. \textit{Modular multiplication without trial division}. Mathematics of Computation, 44(170):519-521, April 1985. - -\bibitem[9]{DRMET} -Chae Hoon Lim and Pil Joong Lee, \textit{Generating Efficient Primes for Discrete Log Cryptosystems}, POSTECH Information Research Laboratories - -\bibitem[10]{MMB} -J. Daemen and R. Govaerts and J. Vandewalle, \textit{Block ciphers based on Modular Arithmetic}, State and {P}rogress in the {R}esearch of {C}ryptography, 1993, pp. 80-89 - -\bibitem[11]{RSAREF} -R.L. Rivest, A. Shamir, L. Adleman, \textit{A Method for Obtaining Digital Signatures and Public-Key Cryptosystems} - -\bibitem[12]{DHREF} -Whitfield Diffie, Martin E. Hellman, \textit{New Directions in Cryptography}, IEEE Transactions on Information Theory, 1976 - -\bibitem[13]{IEEE} -IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) - -\bibitem[14]{GMP} -GNU Multiple Precision (GMP), \url{http://www.swox.com/gmp/} - -\bibitem[15]{MPI} -Multiple Precision Integer Library (MPI), Michael Fromberger, \url{http://thayer.dartmouth.edu/~sting/mpi/} - -\bibitem[16]{OPENSSL} -OpenSSL Cryptographic Toolkit, \url{http://openssl.org} - -\bibitem[17]{LIP} -Large Integer Package, \url{http://home.hetnet.nl/~ecstr/LIP.zip} - -\bibitem[18]{ISOC} -JTC1/SC22/WG14, ISO/IEC 9899:1999, ``A draft rationale for the C99 standard.'' - -\bibitem[19]{JAVA} -The Sun Java Website, \url{http://java.sun.com/} - -\end{thebibliography} - -\input{tommath.ind} - -\end{document} diff --git a/libtommath/tommath.tex b/libtommath/tommath.tex deleted file mode 100644 index d70b64b..0000000 --- a/libtommath/tommath.tex +++ /dev/null @@ -1,10816 +0,0 @@ -\documentclass[b5paper]{book} -\usepackage{hyperref} -\usepackage{makeidx} -\usepackage{amssymb} -\usepackage{color} -\usepackage{alltt} -\usepackage{graphicx} -\usepackage{layout} -\def\union{\cup} -\def\intersect{\cap} -\def\getsrandom{\stackrel{\rm R}{\gets}} -\def\cross{\times} -\def\cat{\hspace{0.5em} \| \hspace{0.5em}} -\def\catn{$\|$} -\def\divides{\hspace{0.3em} | \hspace{0.3em}} -\def\nequiv{\not\equiv} -\def\approx{\raisebox{0.2ex}{\mbox{\small $\sim$}}} -\def\lcm{{\rm lcm}} -\def\gcd{{\rm gcd}} -\def\log{{\rm log}} -\def\ord{{\rm ord}} -\def\abs{{\mathit abs}} -\def\rep{{\mathit rep}} -\def\mod{{\mathit\ mod\ }} -\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})} -\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} -\newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} -\def\Or{{\rm\ or\ }} -\def\And{{\rm\ and\ }} -\def\iff{\hspace{1em}\Longleftrightarrow\hspace{1em}} -\def\implies{\Rightarrow} -\def\undefined{{\rm ``undefined"}} -\def\Proof{\vspace{1ex}\noindent {\bf Proof:}\hspace{1em}} -\let\oldphi\phi -\def\phi{\varphi} -\def\Pr{{\rm Pr}} -\newcommand{\str}[1]{{\mathbf{#1}}} -\def\F{{\mathbb F}} -\def\N{{\mathbb N}} -\def\Z{{\mathbb Z}} -\def\R{{\mathbb R}} -\def\C{{\mathbb C}} -\def\Q{{\mathbb Q}} -\definecolor{DGray}{gray}{0.5} -\newcommand{\emailaddr}[1]{\mbox{$<${#1}$>$}} -\def\twiddle{\raisebox{0.3ex}{\mbox{\tiny $\sim$}}} -\def\gap{\vspace{0.5ex}} -\makeindex -\begin{document} -\frontmatter -\pagestyle{empty} -\title{Multi--Precision Math} -\author{\mbox{ -%\begin{small} -\begin{tabular}{c} -Tom St Denis \\ -Algonquin College \\ -\\ -Mads Rasmussen \\ -Open Communications Security \\ -\\ -Greg Rose \\ -QUALCOMM Australia \\ -\end{tabular} -%\end{small} -} -} -\maketitle -This text has been placed in the public domain. This text corresponds to the v0.39 release of the -LibTomMath project. - -This text is formatted to the international B5 paper size of 176mm wide by 250mm tall using the \LaTeX{} -{\em book} macro package and the Perl {\em booker} package. - -\tableofcontents -\listoffigures -\chapter*{Prefaces} -When I tell people about my LibTom projects and that I release them as public domain they are often puzzled. -They ask why I did it and especially why I continue to work on them for free. The best I can explain it is ``Because I can.'' -Which seems odd and perhaps too terse for adult conversation. I often qualify it with ``I am able, I am willing.'' which -perhaps explains it better. I am the first to admit there is not anything that special with what I have done. Perhaps -others can see that too and then we would have a society to be proud of. My LibTom projects are what I am doing to give -back to society in the form of tools and knowledge that can help others in their endeavours. - -I started writing this book because it was the most logical task to further my goal of open academia. The LibTomMath source -code itself was written to be easy to follow and learn from. There are times, however, where pure C source code does not -explain the algorithms properly. Hence this book. The book literally starts with the foundation of the library and works -itself outwards to the more complicated algorithms. The use of both pseudo--code and verbatim source code provides a duality -of ``theory'' and ``practice'' that the computer science students of the world shall appreciate. I never deviate too far -from relatively straightforward algebra and I hope that this book can be a valuable learning asset. - -This book and indeed much of the LibTom projects would not exist in their current form if it was not for a plethora -of kind people donating their time, resources and kind words to help support my work. Writing a text of significant -length (along with the source code) is a tiresome and lengthy process. Currently the LibTom project is four years old, -comprises of literally thousands of users and over 100,000 lines of source code, TeX and other material. People like Mads and Greg -were there at the beginning to encourage me to work well. It is amazing how timely validation from others can boost morale to -continue the project. Definitely my parents were there for me by providing room and board during the many months of work in 2003. - -To my many friends whom I have met through the years I thank you for the good times and the words of encouragement. I hope I -honour your kind gestures with this project. - -Open Source. Open Academia. Open Minds. - -\begin{flushright} Tom St Denis \end{flushright} - -\newpage -I found the opportunity to work with Tom appealing for several reasons, not only could I broaden my own horizons, but also -contribute to educate others facing the problem of having to handle big number mathematical calculations. - -This book is Tom's child and he has been caring and fostering the project ever since the beginning with a clear mind of -how he wanted the project to turn out. I have helped by proofreading the text and we have had several discussions about -the layout and language used. - -I hold a masters degree in cryptography from the University of Southern Denmark and have always been interested in the -practical aspects of cryptography. - -Having worked in the security consultancy business for several years in S\~{a}o Paulo, Brazil, I have been in touch with a -great deal of work in which multiple precision mathematics was needed. Understanding the possibilities for speeding up -multiple precision calculations is often very important since we deal with outdated machine architecture where modular -reductions, for example, become painfully slow. - -This text is for people who stop and wonder when first examining algorithms such as RSA for the first time and asks -themselves, ``You tell me this is only secure for large numbers, fine; but how do you implement these numbers?'' - -\begin{flushright} -Mads Rasmussen - -S\~{a}o Paulo - SP - -Brazil -\end{flushright} - -\newpage -It's all because I broke my leg. That just happened to be at about the same time that Tom asked for someone to review the section of the book about -Karatsuba multiplication. I was laid up, alone and immobile, and thought ``Why not?'' I vaguely knew what Karatsuba multiplication was, but not -really, so I thought I could help, learn, and stop myself from watching daytime cable TV, all at once. - -At the time of writing this, I've still not met Tom or Mads in meatspace. I've been following Tom's progress since his first splash on the -sci.crypt Usenet news group. I watched him go from a clueless newbie, to the cryptographic equivalent of a reformed smoker, to a real -contributor to the field, over a period of about two years. I've been impressed with his obvious intelligence, and astounded by his productivity. -Of course, he's young enough to be my own child, so he doesn't have my problems with staying awake. - -When I reviewed that single section of the book, in its very earliest form, I was very pleasantly surprised. So I decided to collaborate more fully, -and at least review all of it, and perhaps write some bits too. There's still a long way to go with it, and I have watched a number of close -friends go through the mill of publication, so I think that the way to go is longer than Tom thinks it is. Nevertheless, it's a good effort, -and I'm pleased to be involved with it. - -\begin{flushright} -Greg Rose, Sydney, Australia, June 2003. -\end{flushright} - -\mainmatter -\pagestyle{headings} -\chapter{Introduction} -\section{Multiple Precision Arithmetic} - -\subsection{What is Multiple Precision Arithmetic?} -When we think of long-hand arithmetic such as addition or multiplication we rarely consider the fact that we instinctively -raise or lower the precision of the numbers we are dealing with. For example, in decimal we almost immediate can -reason that $7$ times $6$ is $42$. However, $42$ has two digits of precision as opposed to one digit we started with. -Further multiplications of say $3$ result in a larger precision result $126$. In these few examples we have multiple -precisions for the numbers we are working with. Despite the various levels of precision a single subset\footnote{With the occasional optimization.} - of algorithms can be designed to accomodate them. - -By way of comparison a fixed or single precision operation would lose precision on various operations. For example, in -the decimal system with fixed precision $6 \cdot 7 = 2$. - -Essentially at the heart of computer based multiple precision arithmetic are the same long-hand algorithms taught in -schools to manually add, subtract, multiply and divide. - -\subsection{The Need for Multiple Precision Arithmetic} -The most prevalent need for multiple precision arithmetic, often referred to as ``bignum'' math, is within the implementation -of public-key cryptography algorithms. Algorithms such as RSA \cite{RSAREF} and Diffie-Hellman \cite{DHREF} require -integers of significant magnitude to resist known cryptanalytic attacks. For example, at the time of this writing a -typical RSA modulus would be at least greater than $10^{309}$. However, modern programming languages such as ISO C \cite{ISOC} and -Java \cite{JAVA} only provide instrinsic support for integers which are relatively small and single precision. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{|r|c|} -\hline \textbf{Data Type} & \textbf{Range} \\ -\hline char & $-128 \ldots 127$ \\ -\hline short & $-32768 \ldots 32767$ \\ -\hline long & $-2147483648 \ldots 2147483647$ \\ -\hline long long & $-9223372036854775808 \ldots 9223372036854775807$ \\ -\hline -\end{tabular} -\end{center} -\caption{Typical Data Types for the C Programming Language} -\label{fig:ISOC} -\end{figure} - -The largest data type guaranteed to be provided by the ISO C programming -language\footnote{As per the ISO C standard. However, each compiler vendor is allowed to augment the precision as they -see fit.} can only represent values up to $10^{19}$ as shown in figure \ref{fig:ISOC}. On its own the C language is -insufficient to accomodate the magnitude required for the problem at hand. An RSA modulus of magnitude $10^{19}$ could be -trivially factored\footnote{A Pollard-Rho factoring would take only $2^{16}$ time.} on the average desktop computer, -rendering any protocol based on the algorithm insecure. Multiple precision algorithms solve this very problem by -extending the range of representable integers while using single precision data types. - -Most advancements in fast multiple precision arithmetic stem from the need for faster and more efficient cryptographic -primitives. Faster modular reduction and exponentiation algorithms such as Barrett's algorithm, which have appeared in -various cryptographic journals, can render algorithms such as RSA and Diffie-Hellman more efficient. In fact, several -major companies such as RSA Security, Certicom and Entrust have built entire product lines on the implementation and -deployment of efficient algorithms. - -However, cryptography is not the only field of study that can benefit from fast multiple precision integer routines. -Another auxiliary use of multiple precision integers is high precision floating point data types. -The basic IEEE \cite{IEEE} standard floating point type is made up of an integer mantissa $q$, an exponent $e$ and a sign bit $s$. -Numbers are given in the form $n = q \cdot b^e \cdot -1^s$ where $b = 2$ is the most common base for IEEE. Since IEEE -floating point is meant to be implemented in hardware the precision of the mantissa is often fairly small -(\textit{23, 48 and 64 bits}). The mantissa is merely an integer and a multiple precision integer could be used to create -a mantissa of much larger precision than hardware alone can efficiently support. This approach could be useful where -scientific applications must minimize the total output error over long calculations. - -Yet another use for large integers is within arithmetic on polynomials of large characteristic (i.e. $GF(p)[x]$ for large $p$). -In fact the library discussed within this text has already been used to form a polynomial basis library\footnote{See \url{http://poly.libtomcrypt.org} for more details.}. - -\subsection{Benefits of Multiple Precision Arithmetic} -\index{precision} -The benefit of multiple precision representations over single or fixed precision representations is that -no precision is lost while representing the result of an operation which requires excess precision. For example, -the product of two $n$-bit integers requires at least $2n$ bits of precision to be represented faithfully. A multiple -precision algorithm would augment the precision of the destination to accomodate the result while a single precision system -would truncate excess bits to maintain a fixed level of precision. - -It is possible to implement algorithms which require large integers with fixed precision algorithms. For example, elliptic -curve cryptography (\textit{ECC}) is often implemented on smartcards by fixing the precision of the integers to the maximum -size the system will ever need. Such an approach can lead to vastly simpler algorithms which can accomodate the -integers required even if the host platform cannot natively accomodate them\footnote{For example, the average smartcard -processor has an 8 bit accumulator.}. However, as efficient as such an approach may be, the resulting source code is not -normally very flexible. It cannot, at runtime, accomodate inputs of higher magnitude than the designer anticipated. - -Multiple precision algorithms have the most overhead of any style of arithmetic. For the the most part the -overhead can be kept to a minimum with careful planning, but overall, it is not well suited for most memory starved -platforms. However, multiple precision algorithms do offer the most flexibility in terms of the magnitude of the -inputs. That is, the same algorithms based on multiple precision integers can accomodate any reasonable size input -without the designer's explicit forethought. This leads to lower cost of ownership for the code as it only has to -be written and tested once. - -\section{Purpose of This Text} -The purpose of this text is to instruct the reader regarding how to implement efficient multiple precision algorithms. -That is to not only explain a limited subset of the core theory behind the algorithms but also the various ``house keeping'' -elements that are neglected by authors of other texts on the subject. Several well reknowned texts \cite{TAOCPV2,HAC} -give considerably detailed explanations of the theoretical aspects of algorithms and often very little information -regarding the practical implementation aspects. - -In most cases how an algorithm is explained and how it is actually implemented are two very different concepts. For -example, the Handbook of Applied Cryptography (\textit{HAC}), algorithm 14.7 on page 594, gives a relatively simple -algorithm for performing multiple precision integer addition. However, the description lacks any discussion concerning -the fact that the two integer inputs may be of differing magnitudes. As a result the implementation is not as simple -as the text would lead people to believe. Similarly the division routine (\textit{algorithm 14.20, pp. 598}) does not -discuss how to handle sign or handle the dividend's decreasing magnitude in the main loop (\textit{step \#3}). - -Both texts also do not discuss several key optimal algorithms required such as ``Comba'' and Karatsuba multipliers -and fast modular inversion, which we consider practical oversights. These optimal algorithms are vital to achieve -any form of useful performance in non-trivial applications. - -To solve this problem the focus of this text is on the practical aspects of implementing a multiple precision integer -package. As a case study the ``LibTomMath''\footnote{Available at \url{http://math.libtomcrypt.com}} package is used -to demonstrate algorithms with real implementations\footnote{In the ISO C programming language.} that have been field -tested and work very well. The LibTomMath library is freely available on the Internet for all uses and this text -discusses a very large portion of the inner workings of the library. - -The algorithms that are presented will always include at least one ``pseudo-code'' description followed -by the actual C source code that implements the algorithm. The pseudo-code can be used to implement the same -algorithm in other programming languages as the reader sees fit. - -This text shall also serve as a walkthrough of the creation of multiple precision algorithms from scratch. Showing -the reader how the algorithms fit together as well as where to start on various taskings. - -\section{Discussion and Notation} -\subsection{Notation} -A multiple precision integer of $n$-digits shall be denoted as $x = (x_{n-1}, \ldots, x_1, x_0)_{ \beta }$ and represent -the integer $x \equiv \sum_{i=0}^{n-1} x_i\beta^i$. The elements of the array $x$ are said to be the radix $\beta$ digits -of the integer. For example, $x = (1,2,3)_{10}$ would represent the integer -$1\cdot 10^2 + 2\cdot10^1 + 3\cdot10^0 = 123$. - -\index{mp\_int} -The term ``mp\_int'' shall refer to a composite structure which contains the digits of the integer it represents, as well -as auxilary data required to manipulate the data. These additional members are discussed further in section -\ref{sec:MPINT}. For the purposes of this text a ``multiple precision integer'' and an ``mp\_int'' are assumed to be -synonymous. When an algorithm is specified to accept an mp\_int variable it is assumed the various auxliary data members -are present as well. An expression of the type \textit{variablename.item} implies that it should evaluate to the -member named ``item'' of the variable. For example, a string of characters may have a member ``length'' which would -evaluate to the number of characters in the string. If the string $a$ equals ``hello'' then it follows that -$a.length = 5$. - -For certain discussions more generic algorithms are presented to help the reader understand the final algorithm used -to solve a given problem. When an algorithm is described as accepting an integer input it is assumed the input is -a plain integer with no additional multiple-precision members. That is, algorithms that use integers as opposed to -mp\_ints as inputs do not concern themselves with the housekeeping operations required such as memory management. These -algorithms will be used to establish the relevant theory which will subsequently be used to describe a multiple -precision algorithm to solve the same problem. - -\subsection{Precision Notation} -The variable $\beta$ represents the radix of a single digit of a multiple precision integer and -must be of the form $q^p$ for $q, p \in \Z^+$. A single precision variable must be able to represent integers in -the range $0 \le x < q \beta$ while a double precision variable must be able to represent integers in the range -$0 \le x < q \beta^2$. The extra radix-$q$ factor allows additions and subtractions to proceed without truncation of the -carry. Since all modern computers are binary, it is assumed that $q$ is two. - -\index{mp\_digit} \index{mp\_word} -Within the source code that will be presented for each algorithm, the data type \textbf{mp\_digit} will represent -a single precision integer type, while, the data type \textbf{mp\_word} will represent a double precision integer type. In -several algorithms (notably the Comba routines) temporary results will be stored in arrays of double precision mp\_words. -For the purposes of this text $x_j$ will refer to the $j$'th digit of a single precision array and $\hat x_j$ will refer to -the $j$'th digit of a double precision array. Whenever an expression is to be assigned to a double precision -variable it is assumed that all single precision variables are promoted to double precision during the evaluation. -Expressions that are assigned to a single precision variable are truncated to fit within the precision of a single -precision data type. - -For example, if $\beta = 10^2$ a single precision data type may represent a value in the -range $0 \le x < 10^3$, while a double precision data type may represent a value in the range $0 \le x < 10^5$. Let -$a = 23$ and $b = 49$ represent two single precision variables. The single precision product shall be written -as $c \leftarrow a \cdot b$ while the double precision product shall be written as $\hat c \leftarrow a \cdot b$. -In this particular case, $\hat c = 1127$ and $c = 127$. The most significant digit of the product would not fit -in a single precision data type and as a result $c \ne \hat c$. - -\subsection{Algorithm Inputs and Outputs} -Within the algorithm descriptions all variables are assumed to be scalars of either single or double precision -as indicated. The only exception to this rule is when variables have been indicated to be of type mp\_int. This -distinction is important as scalars are often used as array indicies and various other counters. - -\subsection{Mathematical Expressions} -The $\lfloor \mbox{ } \rfloor$ brackets imply an expression truncated to an integer not greater than the expression -itself. For example, $\lfloor 5.7 \rfloor = 5$. Similarly the $\lceil \mbox{ } \rceil$ brackets imply an expression -rounded to an integer not less than the expression itself. For example, $\lceil 5.1 \rceil = 6$. Typically when -the $/$ division symbol is used the intention is to perform an integer division with truncation. For example, -$5/2 = 2$ which will often be written as $\lfloor 5/2 \rfloor = 2$ for clarity. When an expression is written as a -fraction a real value division is implied, for example ${5 \over 2} = 2.5$. - -The norm of a multiple precision integer, for example $\vert \vert x \vert \vert$, will be used to represent the number of digits in the representation -of the integer. For example, $\vert \vert 123 \vert \vert = 3$ and $\vert \vert 79452 \vert \vert = 5$. - -\subsection{Work Effort} -\index{big-Oh} -To measure the efficiency of the specified algorithms, a modified big-Oh notation is used. In this system all -single precision operations are considered to have the same cost\footnote{Except where explicitly noted.}. -That is a single precision addition, multiplication and division are assumed to take the same time to -complete. While this is generally not true in practice, it will simplify the discussions considerably. - -Some algorithms have slight advantages over others which is why some constants will not be removed in -the notation. For example, a normal baseline multiplication (section \ref{sec:basemult}) requires $O(n^2)$ work while a -baseline squaring (section \ref{sec:basesquare}) requires $O({{n^2 + n}\over 2})$ work. In standard big-Oh notation these -would both be said to be equivalent to $O(n^2)$. However, -in the context of the this text this is not the case as the magnitude of the inputs will typically be rather small. As a -result small constant factors in the work effort will make an observable difference in algorithm efficiency. - -All of the algorithms presented in this text have a polynomial time work level. That is, of the form -$O(n^k)$ for $n, k \in \Z^{+}$. This will help make useful comparisons in terms of the speed of the algorithms and how -various optimizations will help pay off in the long run. - -\section{Exercises} -Within the more advanced chapters a section will be set aside to give the reader some challenging exercises related to -the discussion at hand. These exercises are not designed to be prize winning problems, but instead to be thought -provoking. Wherever possible the problems are forward minded, stating problems that will be answered in subsequent -chapters. The reader is encouraged to finish the exercises as they appear to get a better understanding of the -subject material. - -That being said, the problems are designed to affirm knowledge of a particular subject matter. Students in particular -are encouraged to verify they can answer the problems correctly before moving on. - -Similar to the exercises of \cite[pp. ix]{TAOCPV2} these exercises are given a scoring system based on the difficulty of -the problem. However, unlike \cite{TAOCPV2} the problems do not get nearly as hard. The scoring of these -exercises ranges from one (the easiest) to five (the hardest). The following table sumarizes the -scoring system used. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|l|} -\hline $\left [ 1 \right ]$ & An easy problem that should only take the reader a manner of \\ - & minutes to solve. Usually does not involve much computer time \\ - & to solve. \\ -\hline $\left [ 2 \right ]$ & An easy problem that involves a marginal amount of computer \\ - & time usage. Usually requires a program to be written to \\ - & solve the problem. \\ -\hline $\left [ 3 \right ]$ & A moderately hard problem that requires a non-trivial amount \\ - & of work. Usually involves trivial research and development of \\ - & new theory from the perspective of a student. \\ -\hline $\left [ 4 \right ]$ & A moderately hard problem that involves a non-trivial amount \\ - & of work and research, the solution to which will demonstrate \\ - & a higher mastery of the subject matter. \\ -\hline $\left [ 5 \right ]$ & A hard problem that involves concepts that are difficult for a \\ - & novice to solve. Solutions to these problems will demonstrate a \\ - & complete mastery of the given subject. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Exercise Scoring System} -\end{figure} - -Problems at the first level are meant to be simple questions that the reader can answer quickly without programming a solution or -devising new theory. These problems are quick tests to see if the material is understood. Problems at the second level -are also designed to be easy but will require a program or algorithm to be implemented to arrive at the answer. These -two levels are essentially entry level questions. - -Problems at the third level are meant to be a bit more difficult than the first two levels. The answer is often -fairly obvious but arriving at an exacting solution requires some thought and skill. These problems will almost always -involve devising a new algorithm or implementing a variation of another algorithm previously presented. Readers who can -answer these questions will feel comfortable with the concepts behind the topic at hand. - -Problems at the fourth level are meant to be similar to those of the level three questions except they will require -additional research to be completed. The reader will most likely not know the answer right away, nor will the text provide -the exact details of the answer until a subsequent chapter. - -Problems at the fifth level are meant to be the hardest -problems relative to all the other problems in the chapter. People who can correctly answer fifth level problems have a -mastery of the subject matter at hand. - -Often problems will be tied together. The purpose of this is to start a chain of thought that will be discussed in future chapters. The reader -is encouraged to answer the follow-up problems and try to draw the relevance of problems. - -\section{Introduction to LibTomMath} - -\subsection{What is LibTomMath?} -LibTomMath is a free and open source multiple precision integer library written entirely in portable ISO C. By portable it -is meant that the library does not contain any code that is computer platform dependent or otherwise problematic to use on -any given platform. - -The library has been successfully tested under numerous operating systems including Unix\footnote{All of these -trademarks belong to their respective rightful owners.}, MacOS, Windows, Linux, PalmOS and on standalone hardware such -as the Gameboy Advance. The library is designed to contain enough functionality to be able to develop applications such -as public key cryptosystems and still maintain a relatively small footprint. - -\subsection{Goals of LibTomMath} - -Libraries which obtain the most efficiency are rarely written in a high level programming language such as C. However, -even though this library is written entirely in ISO C, considerable care has been taken to optimize the algorithm implementations within the -library. Specifically the code has been written to work well with the GNU C Compiler (\textit{GCC}) on both x86 and ARM -processors. Wherever possible, highly efficient algorithms, such as Karatsuba multiplication, sliding window -exponentiation and Montgomery reduction have been provided to make the library more efficient. - -Even with the nearly optimal and specialized algorithms that have been included the Application Programing Interface -(\textit{API}) has been kept as simple as possible. Often generic place holder routines will make use of specialized -algorithms automatically without the developer's specific attention. One such example is the generic multiplication -algorithm \textbf{mp\_mul()} which will automatically use Toom--Cook, Karatsuba, Comba or baseline multiplication -based on the magnitude of the inputs and the configuration of the library. - -Making LibTomMath as efficient as possible is not the only goal of the LibTomMath project. Ideally the library should -be source compatible with another popular library which makes it more attractive for developers to use. In this case the -MPI library was used as a API template for all the basic functions. MPI was chosen because it is another library that fits -in the same niche as LibTomMath. Even though LibTomMath uses MPI as the template for the function names and argument -passing conventions, it has been written from scratch by Tom St Denis. - -The project is also meant to act as a learning tool for students, the logic being that no easy-to-follow ``bignum'' -library exists which can be used to teach computer science students how to perform fast and reliable multiple precision -integer arithmetic. To this end the source code has been given quite a few comments and algorithm discussion points. - -\section{Choice of LibTomMath} -LibTomMath was chosen as the case study of this text not only because the author of both projects is one and the same but -for more worthy reasons. Other libraries such as GMP \cite{GMP}, MPI \cite{MPI}, LIP \cite{LIP} and OpenSSL -\cite{OPENSSL} have multiple precision integer arithmetic routines but would not be ideal for this text for -reasons that will be explained in the following sub-sections. - -\subsection{Code Base} -The LibTomMath code base is all portable ISO C source code. This means that there are no platform dependent conditional -segments of code littered throughout the source. This clean and uncluttered approach to the library means that a -developer can more readily discern the true intent of a given section of source code without trying to keep track of -what conditional code will be used. - -The code base of LibTomMath is well organized. Each function is in its own separate source code file -which allows the reader to find a given function very quickly. On average there are $76$ lines of code per source -file which makes the source very easily to follow. By comparison MPI and LIP are single file projects making code tracing -very hard. GMP has many conditional code segments which also hinder tracing. - -When compiled with GCC for the x86 processor and optimized for speed the entire library is approximately $100$KiB\footnote{The notation ``KiB'' means $2^{10}$ octets, similarly ``MiB'' means $2^{20}$ octets.} - which is fairly small compared to GMP (over $250$KiB). LibTomMath is slightly larger than MPI (which compiles to about -$50$KiB) but LibTomMath is also much faster and more complete than MPI. - -\subsection{API Simplicity} -LibTomMath is designed after the MPI library and shares the API design. Quite often programs that use MPI will build -with LibTomMath without change. The function names correlate directly to the action they perform. Almost all of the -functions share the same parameter passing convention. The learning curve is fairly shallow with the API provided -which is an extremely valuable benefit for the student and developer alike. - -The LIP library is an example of a library with an API that is awkward to work with. LIP uses function names that are often ``compressed'' to -illegible short hand. LibTomMath does not share this characteristic. - -The GMP library also does not return error codes. Instead it uses a POSIX.1 \cite{POSIX1} signal system where errors -are signaled to the host application. This happens to be the fastest approach but definitely not the most versatile. In -effect a math error (i.e. invalid input, heap error, etc) can cause a program to stop functioning which is definitely -undersireable in many situations. - -\subsection{Optimizations} -While LibTomMath is certainly not the fastest library (GMP often beats LibTomMath by a factor of two) it does -feature a set of optimal algorithms for tasks such as modular reduction, exponentiation, multiplication and squaring. GMP -and LIP also feature such optimizations while MPI only uses baseline algorithms with no optimizations. GMP lacks a few -of the additional modular reduction optimizations that LibTomMath features\footnote{At the time of this writing GMP -only had Barrett and Montgomery modular reduction algorithms.}. - -LibTomMath is almost always an order of magnitude faster than the MPI library at computationally expensive tasks such as modular -exponentiation. In the grand scheme of ``bignum'' libraries LibTomMath is faster than the average library and usually -slower than the best libraries such as GMP and OpenSSL by only a small factor. - -\subsection{Portability and Stability} -LibTomMath will build ``out of the box'' on any platform equipped with a modern version of the GNU C Compiler -(\textit{GCC}). This means that without changes the library will build without configuration or setting up any -variables. LIP and MPI will build ``out of the box'' as well but have numerous known bugs. Most notably the author of -MPI has recently stopped working on his library and LIP has long since been discontinued. - -GMP requires a configuration script to run and will not build out of the box. GMP and LibTomMath are still in active -development and are very stable across a variety of platforms. - -\subsection{Choice} -LibTomMath is a relatively compact, well documented, highly optimized and portable library which seems only natural for -the case study of this text. Various source files from the LibTomMath project will be included within the text. However, -the reader is encouraged to download their own copy of the library to actually be able to work with the library. - -\chapter{Getting Started} -\section{Library Basics} -The trick to writing any useful library of source code is to build a solid foundation and work outwards from it. First, -a problem along with allowable solution parameters should be identified and analyzed. In this particular case the -inability to accomodate multiple precision integers is the problem. Futhermore, the solution must be written -as portable source code that is reasonably efficient across several different computer platforms. - -After a foundation is formed the remainder of the library can be designed and implemented in a hierarchical fashion. -That is, to implement the lowest level dependencies first and work towards the most abstract functions last. For example, -before implementing a modular exponentiation algorithm one would implement a modular reduction algorithm. -By building outwards from a base foundation instead of using a parallel design methodology the resulting project is -highly modular. Being highly modular is a desirable property of any project as it often means the resulting product -has a small footprint and updates are easy to perform. - -Usually when I start a project I will begin with the header files. I define the data types I think I will need and -prototype the initial functions that are not dependent on other functions (within the library). After I -implement these base functions I prototype more dependent functions and implement them. The process repeats until -I implement all of the functions I require. For example, in the case of LibTomMath I implemented functions such as -mp\_init() well before I implemented mp\_mul() and even further before I implemented mp\_exptmod(). As an example as to -why this design works note that the Karatsuba and Toom-Cook multipliers were written \textit{after} the -dependent function mp\_exptmod() was written. Adding the new multiplication algorithms did not require changes to the -mp\_exptmod() function itself and lowered the total cost of ownership (\textit{so to speak}) and of development -for new algorithms. This methodology allows new algorithms to be tested in a complete framework with relative ease. - -\begin{center} -\begin{figure}[here] -\includegraphics{pics/design_process.ps} -\caption{Design Flow of the First Few Original LibTomMath Functions.} -\label{pic:design_process} -\end{figure} -\end{center} - -Only after the majority of the functions were in place did I pursue a less hierarchical approach to auditing and optimizing -the source code. For example, one day I may audit the multipliers and the next day the polynomial basis functions. - -It only makes sense to begin the text with the preliminary data types and support algorithms required as well. -This chapter discusses the core algorithms of the library which are the dependents for every other algorithm. - -\section{What is a Multiple Precision Integer?} -Recall that most programming languages, in particular ISO C \cite{ISOC}, only have fixed precision data types that on their own cannot -be used to represent values larger than their precision will allow. The purpose of multiple precision algorithms is -to use fixed precision data types to create and manipulate multiple precision integers which may represent values -that are very large. - -As a well known analogy, school children are taught how to form numbers larger than nine by prepending more radix ten digits. In the decimal system -the largest single digit value is $9$. However, by concatenating digits together larger numbers may be represented. Newly prepended digits -(\textit{to the left}) are said to be in a different power of ten column. That is, the number $123$ can be described as having a $1$ in the hundreds -column, $2$ in the tens column and $3$ in the ones column. Or more formally $123 = 1 \cdot 10^2 + 2 \cdot 10^1 + 3 \cdot 10^0$. Computer based -multiple precision arithmetic is essentially the same concept. Larger integers are represented by adjoining fixed -precision computer words with the exception that a different radix is used. - -What most people probably do not think about explicitly are the various other attributes that describe a multiple precision -integer. For example, the integer $154_{10}$ has two immediately obvious properties. First, the integer is positive, -that is the sign of this particular integer is positive as opposed to negative. Second, the integer has three digits in -its representation. There is an additional property that the integer posesses that does not concern pencil-and-paper -arithmetic. The third property is how many digits placeholders are available to hold the integer. - -The human analogy of this third property is ensuring there is enough space on the paper to write the integer. For example, -if one starts writing a large number too far to the right on a piece of paper they will have to erase it and move left. -Similarly, computer algorithms must maintain strict control over memory usage to ensure that the digits of an integer -will not exceed the allowed boundaries. These three properties make up what is known as a multiple precision -integer or mp\_int for short. - -\subsection{The mp\_int Structure} -\label{sec:MPINT} -The mp\_int structure is the ISO C based manifestation of what represents a multiple precision integer. The ISO C standard does not provide for -any such data type but it does provide for making composite data types known as structures. The following is the structure definition -used within LibTomMath. - -\index{mp\_int} -\begin{figure}[here] -\begin{center} -\begin{small} -%\begin{verbatim} -\begin{tabular}{|l|} -\hline -typedef struct \{ \\ -\hspace{3mm}int used, alloc, sign;\\ -\hspace{3mm}mp\_digit *dp;\\ -\} \textbf{mp\_int}; \\ -\hline -\end{tabular} -%\end{verbatim} -\end{small} -\caption{The mp\_int Structure} -\label{fig:mpint} -\end{center} -\end{figure} - -The mp\_int structure (fig. \ref{fig:mpint}) can be broken down as follows. - -\begin{enumerate} -\item The \textbf{used} parameter denotes how many digits of the array \textbf{dp} contain the digits used to represent -a given integer. The \textbf{used} count must be positive (or zero) and may not exceed the \textbf{alloc} count. - -\item The \textbf{alloc} parameter denotes how -many digits are available in the array to use by functions before it has to increase in size. When the \textbf{used} count -of a result would exceed the \textbf{alloc} count all of the algorithms will automatically increase the size of the -array to accommodate the precision of the result. - -\item The pointer \textbf{dp} points to a dynamically allocated array of digits that represent the given multiple -precision integer. It is padded with $(\textbf{alloc} - \textbf{used})$ zero digits. The array is maintained in a least -significant digit order. As a pencil and paper analogy the array is organized such that the right most digits are stored -first starting at the location indexed by zero\footnote{In C all arrays begin at zero.} in the array. For example, -if \textbf{dp} contains $\lbrace a, b, c, \ldots \rbrace$ where \textbf{dp}$_0 = a$, \textbf{dp}$_1 = b$, \textbf{dp}$_2 = c$, $\ldots$ then -it would represent the integer $a + b\beta + c\beta^2 + \ldots$ - -\index{MP\_ZPOS} \index{MP\_NEG} -\item The \textbf{sign} parameter denotes the sign as either zero/positive (\textbf{MP\_ZPOS}) or negative (\textbf{MP\_NEG}). -\end{enumerate} - -\subsubsection{Valid mp\_int Structures} -Several rules are placed on the state of an mp\_int structure and are assumed to be followed for reasons of efficiency. -The only exceptions are when the structure is passed to initialization functions such as mp\_init() and mp\_init\_copy(). - -\begin{enumerate} -\item The value of \textbf{alloc} may not be less than one. That is \textbf{dp} always points to a previously allocated -array of digits. -\item The value of \textbf{used} may not exceed \textbf{alloc} and must be greater than or equal to zero. -\item The value of \textbf{used} implies the digit at index $(used - 1)$ of the \textbf{dp} array is non-zero. That is, -leading zero digits in the most significant positions must be trimmed. - \begin{enumerate} - \item Digits in the \textbf{dp} array at and above the \textbf{used} location must be zero. - \end{enumerate} -\item The value of \textbf{sign} must be \textbf{MP\_ZPOS} if \textbf{used} is zero; -this represents the mp\_int value of zero. -\end{enumerate} - -\section{Argument Passing} -A convention of argument passing must be adopted early on in the development of any library. Making the function -prototypes consistent will help eliminate many headaches in the future as the library grows to significant complexity. -In LibTomMath the multiple precision integer functions accept parameters from left to right as pointers to mp\_int -structures. That means that the source (input) operands are placed on the left and the destination (output) on the right. -Consider the following examples. - -\begin{verbatim} - mp_mul(&a, &b, &c); /* c = a * b */ - mp_add(&a, &b, &a); /* a = a + b */ - mp_sqr(&a, &b); /* b = a * a */ -\end{verbatim} - -The left to right order is a fairly natural way to implement the functions since it lets the developer read aloud the -functions and make sense of them. For example, the first function would read ``multiply a and b and store in c''. - -Certain libraries (\textit{LIP by Lenstra for instance}) accept parameters the other way around, to mimic the order -of assignment expressions. That is, the destination (output) is on the left and arguments (inputs) are on the right. In -truth, it is entirely a matter of preference. In the case of LibTomMath the convention from the MPI library has been -adopted. - -Another very useful design consideration, provided for in LibTomMath, is whether to allow argument sources to also be a -destination. For example, the second example (\textit{mp\_add}) adds $a$ to $b$ and stores in $a$. This is an important -feature to implement since it allows the calling functions to cut down on the number of variables it must maintain. -However, to implement this feature specific care has to be given to ensure the destination is not modified before the -source is fully read. - -\section{Return Values} -A well implemented application, no matter what its purpose, should trap as many runtime errors as possible and return them -to the caller. By catching runtime errors a library can be guaranteed to prevent undefined behaviour. However, the end -developer can still manage to cause a library to crash. For example, by passing an invalid pointer an application may -fault by dereferencing memory not owned by the application. - -In the case of LibTomMath the only errors that are checked for are related to inappropriate inputs (division by zero for -instance) and memory allocation errors. It will not check that the mp\_int passed to any function is valid nor -will it check pointers for validity. Any function that can cause a runtime error will return an error code as an -\textbf{int} data type with one of the following values (fig \ref{fig:errcodes}). - -\index{MP\_OKAY} \index{MP\_VAL} \index{MP\_MEM} -\begin{figure}[here] -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Value} & \textbf{Meaning} \\ -\hline \textbf{MP\_OKAY} & The function was successful \\ -\hline \textbf{MP\_VAL} & One of the input value(s) was invalid \\ -\hline \textbf{MP\_MEM} & The function ran out of heap memory \\ -\hline -\end{tabular} -\end{center} -\caption{LibTomMath Error Codes} -\label{fig:errcodes} -\end{figure} - -When an error is detected within a function it should free any memory it allocated, often during the initialization of -temporary mp\_ints, and return as soon as possible. The goal is to leave the system in the same state it was when the -function was called. Error checking with this style of API is fairly simple. - -\begin{verbatim} - int err; - if ((err = mp_add(&a, &b, &c)) != MP_OKAY) { - printf("Error: %s\n", mp_error_to_string(err)); - exit(EXIT_FAILURE); - } -\end{verbatim} - -The GMP \cite{GMP} library uses C style \textit{signals} to flag errors which is of questionable use. Not all errors are fatal -and it was not deemed ideal by the author of LibTomMath to force developers to have signal handlers for such cases. - -\section{Initialization and Clearing} -The logical starting point when actually writing multiple precision integer functions is the initialization and -clearing of the mp\_int structures. These two algorithms will be used by the majority of the higher level algorithms. - -Given the basic mp\_int structure an initialization routine must first allocate memory to hold the digits of -the integer. Often it is optimal to allocate a sufficiently large pre-set number of digits even though -the initial integer will represent zero. If only a single digit were allocated quite a few subsequent re-allocations -would occur when operations are performed on the integers. There is a tradeoff between how many default digits to allocate -and how many re-allocations are tolerable. Obviously allocating an excessive amount of digits initially will waste -memory and become unmanageable. - -If the memory for the digits has been successfully allocated then the rest of the members of the structure must -be initialized. Since the initial state of an mp\_int is to represent the zero integer, the allocated digits must be set -to zero. The \textbf{used} count set to zero and \textbf{sign} set to \textbf{MP\_ZPOS}. - -\subsection{Initializing an mp\_int} -An mp\_int is said to be initialized if it is set to a valid, preferably default, state such that all of the members of the -structure are set to valid values. The mp\_init algorithm will perform such an action. - -\index{mp\_init} -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Allocate memory and initialize $a$ to a known valid mp\_int state. \\ -\hline \\ -1. Allocate memory for \textbf{MP\_PREC} digits. \\ -2. If the allocation failed return(\textit{MP\_MEM}) \\ -3. for $n$ from $0$ to $MP\_PREC - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$\\ -4. $a.sign \leftarrow MP\_ZPOS$\\ -5. $a.used \leftarrow 0$\\ -6. $a.alloc \leftarrow MP\_PREC$\\ -7. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init} -\end{figure} - -\textbf{Algorithm mp\_init.} -The purpose of this function is to initialize an mp\_int structure so that the rest of the library can properly -manipulte it. It is assumed that the input may not have had any of its members previously initialized which is certainly -a valid assumption if the input resides on the stack. - -Before any of the members such as \textbf{sign}, \textbf{used} or \textbf{alloc} are initialized the memory for -the digits is allocated. If this fails the function returns before setting any of the other members. The \textbf{MP\_PREC} -name represents a constant\footnote{Defined in the ``tommath.h'' header file within LibTomMath.} -used to dictate the minimum precision of newly initialized mp\_int integers. Ideally, it is at least equal to the smallest -precision number you'll be working with. - -Allocating a block of digits at first instead of a single digit has the benefit of lowering the number of usually slow -heap operations later functions will have to perform in the future. If \textbf{MP\_PREC} is set correctly the slack -memory and the number of heap operations will be trivial. - -Once the allocation has been made the digits have to be set to zero as well as the \textbf{used}, \textbf{sign} and -\textbf{alloc} members initialized. This ensures that the mp\_int will always represent the default state of zero regardless -of the original condition of the input. - -\textbf{Remark.} -This function introduces the idiosyncrasy that all iterative loops, commonly initiated with the ``for'' keyword, iterate incrementally -when the ``to'' keyword is placed between two expressions. For example, ``for $a$ from $b$ to $c$ do'' means that -a subsequent expression (or body of expressions) are to be evaluated upto $c - b$ times so long as $b \le c$. In each -iteration the variable $a$ is substituted for a new integer that lies inclusively between $b$ and $c$. If $b > c$ occured -the loop would not iterate. By contrast if the ``downto'' keyword were used in place of ``to'' the loop would iterate -decrementally. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* init a new mp_int */ -018 int mp_init (mp_int * a) -019 \{ -020 int i; -021 -022 /* allocate memory required and clear it */ -023 a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC); -024 if (a->dp == NULL) \{ -025 return MP_MEM; -026 \} -027 -028 /* set the digits to zero */ -029 for (i = 0; i < MP_PREC; i++) \{ -030 a->dp[i] = 0; -031 \} -032 -033 /* set the used to zero, allocated digits to the default precision -034 * and sign to positive */ -035 a->used = 0; -036 a->alloc = MP_PREC; -037 a->sign = MP_ZPOS; -038 -039 return MP_OKAY; -040 \} -041 #endif -042 -\end{alltt} -\end{small} - -One immediate observation of this initializtion function is that it does not return a pointer to a mp\_int structure. It -is assumed that the caller has already allocated memory for the mp\_int structure, typically on the application stack. The -call to mp\_init() is used only to initialize the members of the structure to a known default state. - -Here we see (line 23) the memory allocation is performed first. This allows us to exit cleanly and quickly -if there is an error. If the allocation fails the routine will return \textbf{MP\_MEM} to the caller to indicate there -was a memory error. The function XMALLOC is what actually allocates the memory. Technically XMALLOC is not a function -but a macro defined in ``tommath.h``. By default, XMALLOC will evaluate to malloc() which is the C library's built--in -memory allocation routine. - -In order to assure the mp\_int is in a known state the digits must be set to zero. On most platforms this could have been -accomplished by using calloc() instead of malloc(). However, to correctly initialize a integer type to a given value in a -portable fashion you have to actually assign the value. The for loop (line 29) performs this required -operation. - -After the memory has been successfully initialized the remainder of the members are initialized -(lines 33 through 34) to their respective default states. At this point the algorithm has succeeded and -a success code is returned to the calling function. If this function returns \textbf{MP\_OKAY} it is safe to assume the -mp\_int structure has been properly initialized and is safe to use with other functions within the library. - -\subsection{Clearing an mp\_int} -When an mp\_int is no longer required by the application, the memory that has been allocated for its digits must be -returned to the application's memory pool with the mp\_clear algorithm. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clear}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. The memory for $a$ shall be deallocated. \\ -\hline \\ -1. If $a$ has been previously freed then return(\textit{MP\_OKAY}). \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $a_n \leftarrow 0$ \\ -3. Free the memory allocated for the digits of $a$. \\ -4. $a.used \leftarrow 0$ \\ -5. $a.alloc \leftarrow 0$ \\ -6. $a.sign \leftarrow MP\_ZPOS$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_clear} -\end{figure} - -\textbf{Algorithm mp\_clear.} -This algorithm accomplishes two goals. First, it clears the digits and the other mp\_int members. This ensures that -if a developer accidentally re-uses a cleared structure it is less likely to cause problems. The second goal -is to free the allocated memory. - -The logic behind the algorithm is extended by marking cleared mp\_int structures so that subsequent calls to this -algorithm will not try to free the memory multiple times. Cleared mp\_ints are detectable by having a pre-defined invalid -digit pointer \textbf{dp} setting. - -Once an mp\_int has been cleared the mp\_int structure is no longer in a valid state for any other algorithm -with the exception of algorithms mp\_init, mp\_init\_copy, mp\_init\_size and mp\_clear. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_clear.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* clear one (frees) */ -018 void -019 mp_clear (mp_int * a) -020 \{ -021 int i; -022 -023 /* only do anything if a hasn't been freed previously */ -024 if (a->dp != NULL) \{ -025 /* first zero the digits */ -026 for (i = 0; i < a->used; i++) \{ -027 a->dp[i] = 0; -028 \} -029 -030 /* free ram */ -031 XFREE(a->dp); -032 -033 /* reset members to make debugging easier */ -034 a->dp = NULL; -035 a->alloc = a->used = 0; -036 a->sign = MP_ZPOS; -037 \} -038 \} -039 #endif -040 -\end{alltt} -\end{small} - -The algorithm only operates on the mp\_int if it hasn't been previously cleared. The if statement (line 24) -checks to see if the \textbf{dp} member is not \textbf{NULL}. If the mp\_int is a valid mp\_int then \textbf{dp} cannot be -\textbf{NULL} in which case the if statement will evaluate to true. - -The digits of the mp\_int are cleared by the for loop (line 26) which assigns a zero to every digit. Similar to mp\_init() -the digits are assigned zero instead of using block memory operations (such as memset()) since this is more portable. - -The digits are deallocated off the heap via the XFREE macro. Similar to XMALLOC the XFREE macro actually evaluates to -a standard C library function. In this case the free() function. Since free() only deallocates the memory the pointer -still has to be reset to \textbf{NULL} manually (line 34). - -Now that the digits have been cleared and deallocated the other members are set to their final values (lines 35 and 36). - -\section{Maintenance Algorithms} - -The previous sections describes how to initialize and clear an mp\_int structure. To further support operations -that are to be performed on mp\_int structures (such as addition and multiplication) the dependent algorithms must be -able to augment the precision of an mp\_int and -initialize mp\_ints with differing initial conditions. - -These algorithms complete the set of low level algorithms required to work with mp\_int structures in the higher level -algorithms such as addition, multiplication and modular exponentiation. - -\subsection{Augmenting an mp\_int's Precision} -When storing a value in an mp\_int structure, a sufficient number of digits must be available to accomodate the entire -result of an operation without loss of precision. Quite often the size of the array given by the \textbf{alloc} member -is large enough to simply increase the \textbf{used} digit count. However, when the size of the array is too small it -must be re-sized appropriately to accomodate the result. The mp\_grow algorithm will provide this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_grow}. \\ -\textbf{Input}. An mp\_int $a$ and an integer $b$. \\ -\textbf{Output}. $a$ is expanded to accomodate $b$ digits. \\ -\hline \\ -1. if $a.alloc \ge b$ then return(\textit{MP\_OKAY}) \\ -2. $u \leftarrow b\mbox{ (mod }MP\_PREC\mbox{)}$ \\ -3. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -4. Re-allocate the array of digits $a$ to size $v$ \\ -5. If the allocation failed then return(\textit{MP\_MEM}). \\ -6. for n from a.alloc to $v - 1$ do \\ -\hspace{+3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.alloc \leftarrow v$ \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_grow} -\end{figure} - -\textbf{Algorithm mp\_grow.} -It is ideal to prevent re-allocations from being performed if they are not required (step one). This is useful to -prevent mp\_ints from growing excessively in code that erroneously calls mp\_grow. - -The requested digit count is padded up to next multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} (steps two and three). -This helps prevent many trivial reallocations that would grow an mp\_int by trivially small values. - -It is assumed that the reallocation (step four) leaves the lower $a.alloc$ digits of the mp\_int intact. This is much -akin to how the \textit{realloc} function from the standard C library works. Since the newly allocated digits are -assumed to contain undefined values they are initially set to zero. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_grow.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* grow as required */ -018 int mp_grow (mp_int * a, int size) -019 \{ -020 int i; -021 mp_digit *tmp; -022 -023 /* if the alloc size is smaller alloc more ram */ -024 if (a->alloc < size) \{ -025 /* ensure there are always at least MP_PREC digits extra on top */ -026 size += (MP_PREC * 2) - (size % MP_PREC); -027 -028 /* reallocate the array a->dp -029 * -030 * We store the return in a temporary variable -031 * in case the operation failed we don't want -032 * to overwrite the dp member of a. -033 */ -034 tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size); -035 if (tmp == NULL) \{ -036 /* reallocation failed but "a" is still valid [can be freed] */ -037 return MP_MEM; -038 \} -039 -040 /* reallocation succeeded so set a->dp */ -041 a->dp = tmp; -042 -043 /* zero excess digits */ -044 i = a->alloc; -045 a->alloc = size; -046 for (; i < a->alloc; i++) \{ -047 a->dp[i] = 0; -048 \} -049 \} -050 return MP_OKAY; -051 \} -052 #endif -053 -\end{alltt} -\end{small} - -A quick optimization is to first determine if a memory re-allocation is required at all. The if statement (line 24) checks -if the \textbf{alloc} member of the mp\_int is smaller than the requested digit count. If the count is not larger than \textbf{alloc} -the function skips the re-allocation part thus saving time. - -When a re-allocation is performed it is turned into an optimal request to save time in the future. The requested digit count is -padded upwards to 2nd multiple of \textbf{MP\_PREC} larger than \textbf{alloc} (line 26). The XREALLOC function is used -to re-allocate the memory. As per the other functions XREALLOC is actually a macro which evaluates to realloc by default. The realloc -function leaves the base of the allocation intact which means the first \textbf{alloc} digits of the mp\_int are the same as before -the re-allocation. All that is left is to clear the newly allocated digits and return. - -Note that the re-allocation result is actually stored in a temporary pointer $tmp$. This is to allow this function to return -an error with a valid pointer. Earlier releases of the library stored the result of XREALLOC into the mp\_int $a$. That would -result in a memory leak if XREALLOC ever failed. - -\subsection{Initializing Variable Precision mp\_ints} -Occasionally the number of digits required will be known in advance of an initialization, based on, for example, the size -of input mp\_ints to a given algorithm. The purpose of algorithm mp\_init\_size is similar to mp\_init except that it -will allocate \textit{at least} a specified number of digits. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_size}. \\ -\textbf{Input}. An mp\_int $a$ and the requested number of digits $b$. \\ -\textbf{Output}. $a$ is initialized to hold at least $b$ digits. \\ -\hline \\ -1. $u \leftarrow b \mbox{ (mod }MP\_PREC\mbox{)}$ \\ -2. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -3. Allocate $v$ digits. \\ -4. for $n$ from $0$ to $v - 1$ do \\ -\hspace{3mm}4.1 $a_n \leftarrow 0$ \\ -5. $a.sign \leftarrow MP\_ZPOS$\\ -6. $a.used \leftarrow 0$\\ -7. $a.alloc \leftarrow v$\\ -8. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_init\_size} -\end{figure} - -\textbf{Algorithm mp\_init\_size.} -This algorithm will initialize an mp\_int structure $a$ like algorithm mp\_init with the exception that the number of -digits allocated can be controlled by the second input argument $b$. The input size is padded upwards so it is a -multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} digits. This padding is used to prevent trivial -allocations from becoming a bottleneck in the rest of the algorithms. - -Like algorithm mp\_init, the mp\_int structure is initialized to a default state representing the integer zero. This -particular algorithm is useful if it is known ahead of time the approximate size of the input. If the approximation is -correct no further memory re-allocations are required to work with the mp\_int. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init\_size.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* init an mp_init for a given size */ -018 int mp_init_size (mp_int * a, int size) -019 \{ -020 int x; -021 -022 /* pad size so there are always extra digits */ -023 size += (MP_PREC * 2) - (size % MP_PREC); -024 -025 /* alloc mem */ -026 a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size); -027 if (a->dp == NULL) \{ -028 return MP_MEM; -029 \} -030 -031 /* set the members */ -032 a->used = 0; -033 a->alloc = size; -034 a->sign = MP_ZPOS; -035 -036 /* zero the digits */ -037 for (x = 0; x < size; x++) \{ -038 a->dp[x] = 0; -039 \} -040 -041 return MP_OKAY; -042 \} -043 #endif -044 -\end{alltt} -\end{small} - -The number of digits $b$ requested is padded (line 23) by first augmenting it to the next multiple of -\textbf{MP\_PREC} and then adding \textbf{MP\_PREC} to the result. If the memory can be successfully allocated the -mp\_int is placed in a default state representing the integer zero. Otherwise, the error code \textbf{MP\_MEM} will be -returned (line 28). - -The digits are allocated with the malloc() function (line 26) and set to zero afterwards (line 37). The -\textbf{used} count is set to zero, the \textbf{alloc} count set to the padded digit count and the \textbf{sign} flag set -to \textbf{MP\_ZPOS} to achieve a default valid mp\_int state (lines 32, 33 and 34). If the function -returns succesfully then it is correct to assume that the mp\_int structure is in a valid state for the remainder of the -functions to work with. - -\subsection{Multiple Integer Initializations and Clearings} -Occasionally a function will require a series of mp\_int data types to be made available simultaneously. -The purpose of algorithm mp\_init\_multi is to initialize a variable length array of mp\_int structures in a single -statement. It is essentially a shortcut to multiple initializations. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_multi}. \\ -\textbf{Input}. Variable length array $V_k$ of mp\_int variables of length $k$. \\ -\textbf{Output}. The array is initialized such that each mp\_int of $V_k$ is ready to use. \\ -\hline \\ -1. for $n$ from 0 to $k - 1$ do \\ -\hspace{+3mm}1.1. Initialize the mp\_int $V_n$ (\textit{mp\_init}) \\ -\hspace{+3mm}1.2. If initialization failed then do \\ -\hspace{+6mm}1.2.1. for $j$ from $0$ to $n$ do \\ -\hspace{+9mm}1.2.1.1. Free the mp\_int $V_j$ (\textit{mp\_clear}) \\ -\hspace{+6mm}1.2.2. Return(\textit{MP\_MEM}) \\ -2. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_multi} -\end{figure} - -\textbf{Algorithm mp\_init\_multi.} -The algorithm will initialize the array of mp\_int variables one at a time. If a runtime error has been detected -(\textit{step 1.2}) all of the previously initialized variables are cleared. The goal is an ``all or nothing'' -initialization which allows for quick recovery from runtime errors. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init\_multi.c -\vspace{-3mm} -\begin{alltt} -016 #include -017 -018 int mp_init_multi(mp_int *mp, ...) -019 \{ -020 mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ -021 int n = 0; /* Number of ok inits */ -022 mp_int* cur_arg = mp; -023 va_list args; -024 -025 va_start(args, mp); /* init args to next argument from caller */ -026 while (cur_arg != NULL) \{ -027 if (mp_init(cur_arg) != MP_OKAY) \{ -028 /* Oops - error! Back-track and mp_clear what we already -029 succeeded in init-ing, then return error. -030 */ -031 va_list clean_args; -032 -033 /* end the current list */ -034 va_end(args); -035 -036 /* now start cleaning up */ -037 cur_arg = mp; -038 va_start(clean_args, mp); -039 while (n-- != 0) \{ -040 mp_clear(cur_arg); -041 cur_arg = va_arg(clean_args, mp_int*); -042 \} -043 va_end(clean_args); -044 res = MP_MEM; -045 break; -046 \} -047 n++; -048 cur_arg = va_arg(args, mp_int*); -049 \} -050 va_end(args); -051 return res; /* Assumed ok, if error flagged above. */ -052 \} -053 -054 #endif -055 -\end{alltt} -\end{small} - -This function intializes a variable length list of mp\_int structure pointers. However, instead of having the mp\_int -structures in an actual C array they are simply passed as arguments to the function. This function makes use of the -``...'' argument syntax of the C programming language. The list is terminated with a final \textbf{NULL} argument -appended on the right. - -The function uses the ``stdarg.h'' \textit{va} functions to step portably through the arguments to the function. A count -$n$ of succesfully initialized mp\_int structures is maintained (line 47) such that if a failure does occur, -the algorithm can backtrack and free the previously initialized structures (lines 27 to 46). - - -\subsection{Clamping Excess Digits} -When a function anticipates a result will be $n$ digits it is simpler to assume this is true within the body of -the function instead of checking during the computation. For example, a multiplication of a $i$ digit number by a -$j$ digit produces a result of at most $i + j$ digits. It is entirely possible that the result is $i + j - 1$ -though, with no final carry into the last position. However, suppose the destination had to be first expanded -(\textit{via mp\_grow}) to accomodate $i + j - 1$ digits than further expanded to accomodate the final carry. -That would be a considerable waste of time since heap operations are relatively slow. - -The ideal solution is to always assume the result is $i + j$ and fix up the \textbf{used} count after the function -terminates. This way a single heap operation (\textit{at most}) is required. However, if the result was not checked -there would be an excess high order zero digit. - -For example, suppose the product of two integers was $x_n = (0x_{n-1}x_{n-2}...x_0)_{\beta}$. The leading zero digit -will not contribute to the precision of the result. In fact, through subsequent operations more leading zero digits would -accumulate to the point the size of the integer would be prohibitive. As a result even though the precision is very -low the representation is excessively large. - -The mp\_clamp algorithm is designed to solve this very problem. It will trim high-order zeros by decrementing the -\textbf{used} count until a non-zero most significant digit is found. Also in this system, zero is considered to be a -positive number which means that if the \textbf{used} count is decremented to zero, the sign must be set to -\textbf{MP\_ZPOS}. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clamp}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Any excess leading zero digits of $a$ are removed \\ -\hline \\ -1. while $a.used > 0$ and $a_{a.used - 1} = 0$ do \\ -\hspace{+3mm}1.1 $a.used \leftarrow a.used - 1$ \\ -2. if $a.used = 0$ then do \\ -\hspace{+3mm}2.1 $a.sign \leftarrow MP\_ZPOS$ \\ -\hline \\ -\end{tabular} -\end{center} -\caption{Algorithm mp\_clamp} -\end{figure} - -\textbf{Algorithm mp\_clamp.} -As can be expected this algorithm is very simple. The loop on step one is expected to iterate only once or twice at -the most. For example, this will happen in cases where there is not a carry to fill the last position. Step two fixes the sign for -when all of the digits are zero to ensure that the mp\_int is valid at all times. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_clamp.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* trim unused digits -018 * -019 * This is used to ensure that leading zero digits are -020 * trimed and the leading "used" digit will be non-zero -021 * Typically very fast. Also fixes the sign if there -022 * are no more leading digits -023 */ -024 void -025 mp_clamp (mp_int * a) -026 \{ -027 /* decrease used while the most significant digit is -028 * zero. -029 */ -030 while ((a->used > 0) && (a->dp[a->used - 1] == 0)) \{ -031 --(a->used); -032 \} -033 -034 /* reset the sign flag if used == 0 */ -035 if (a->used == 0) \{ -036 a->sign = MP_ZPOS; -037 \} -038 \} -039 #endif -040 -\end{alltt} -\end{small} - -Note on line 27 how to test for the \textbf{used} count is made on the left of the \&\& operator. In the C programming -language the terms to \&\& are evaluated left to right with a boolean short-circuit if any condition fails. This is -important since if the \textbf{used} is zero the test on the right would fetch below the array. That is obviously -undesirable. The parenthesis on line 30 is used to make sure the \textbf{used} count is decremented and not -the pointer ``a''. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 1 \right ]$ & Discuss the relevance of the \textbf{used} member of the mp\_int structure. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the consequences of not using padding when performing allocations. \\ - & \\ -$\left [ 2 \right ]$ & Estimate an ideal value for \textbf{MP\_PREC} when performing 1024-bit RSA \\ - & encryption when $\beta = 2^{28}$. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the relevance of the algorithm mp\_clamp. What does it prevent? \\ - & \\ -$\left [ 1 \right ]$ & Give an example of when the algorithm mp\_init\_copy might be useful. \\ - & \\ -\end{tabular} - - -%%% -% CHAPTER FOUR -%%% - -\chapter{Basic Operations} - -\section{Introduction} -In the previous chapter a series of low level algorithms were established that dealt with initializing and maintaining -mp\_int structures. This chapter will discuss another set of seemingly non-algebraic algorithms which will form the low -level basis of the entire library. While these algorithm are relatively trivial it is important to understand how they -work before proceeding since these algorithms will be used almost intrinsically in the following chapters. - -The algorithms in this chapter deal primarily with more ``programmer'' related tasks such as creating copies of -mp\_int structures, assigning small values to mp\_int structures and comparisons of the values mp\_int structures -represent. - -\section{Assigning Values to mp\_int Structures} -\subsection{Copying an mp\_int} -Assigning the value that a given mp\_int structure represents to another mp\_int structure shall be known as making -a copy for the purposes of this text. The copy of the mp\_int will be a separate entity that represents the same -value as the mp\_int it was copied from. The mp\_copy algorithm provides this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$. \\ -\textbf{Output}. Store a copy of $a$ in $b$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to $a.used$ digits. (\textit{mp\_grow}) \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $b_{n} \leftarrow a_{n}$ \\ -3. for $n$ from $a.used$ to $b.used - 1$ do \\ -\hspace{3mm}3.1 $b_{n} \leftarrow 0$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $b.sign \leftarrow a.sign$ \\ -6. return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_copy} -\end{figure} - -\textbf{Algorithm mp\_copy.} -This algorithm copies the mp\_int $a$ such that upon succesful termination of the algorithm the mp\_int $b$ will -represent the same integer as the mp\_int $a$. The mp\_int $b$ shall be a complete and distinct copy of the -mp\_int $a$ meaing that the mp\_int $a$ can be modified and it shall not affect the value of the mp\_int $b$. - -If $b$ does not have enough room for the digits of $a$ it must first have its precision augmented via the mp\_grow -algorithm. The digits of $a$ are copied over the digits of $b$ and any excess digits of $b$ are set to zero (step two -and three). The \textbf{used} and \textbf{sign} members of $a$ are finally copied over the respective members of -$b$. - -\textbf{Remark.} This algorithm also introduces a new idiosyncrasy that will be used throughout the rest of the -text. The error return codes of other algorithms are not explicitly checked in the pseudo-code presented. For example, in -step one of the mp\_copy algorithm the return of mp\_grow is not explicitly checked to ensure it succeeded. Text space is -limited so it is assumed that if a algorithm fails it will clear all temporarily allocated mp\_ints and return -the error code itself. However, the C code presented will demonstrate all of the error handling logic required to -implement the pseudo-code. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_copy.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* copy, b = a */ -018 int -019 mp_copy (mp_int * a, mp_int * b) -020 \{ -021 int res, n; -022 -023 /* if dst == src do nothing */ -024 if (a == b) \{ -025 return MP_OKAY; -026 \} -027 -028 /* grow dest */ -029 if (b->alloc < a->used) \{ -030 if ((res = mp_grow (b, a->used)) != MP_OKAY) \{ -031 return res; -032 \} -033 \} -034 -035 /* zero b and copy the parameters over */ -036 \{ -037 mp_digit *tmpa, *tmpb; -038 -039 /* pointer aliases */ -040 -041 /* source */ -042 tmpa = a->dp; -043 -044 /* destination */ -045 tmpb = b->dp; -046 -047 /* copy all the digits */ -048 for (n = 0; n < a->used; n++) \{ -049 *tmpb++ = *tmpa++; -050 \} -051 -052 /* clear high digits */ -053 for (; n < b->used; n++) \{ -054 *tmpb++ = 0; -055 \} -056 \} -057 -058 /* copy used count and sign */ -059 b->used = a->used; -060 b->sign = a->sign; -061 return MP_OKAY; -062 \} -063 #endif -064 -\end{alltt} -\end{small} - -Occasionally a dependent algorithm may copy an mp\_int effectively into itself such as when the input and output -mp\_int structures passed to a function are one and the same. For this case it is optimal to return immediately without -copying digits (line 24). - -The mp\_int $b$ must have enough digits to accomodate the used digits of the mp\_int $a$. If $b.alloc$ is less than -$a.used$ the algorithm mp\_grow is used to augment the precision of $b$ (lines 29 to 33). In order to -simplify the inner loop that copies the digits from $a$ to $b$, two aliases $tmpa$ and $tmpb$ point directly at the digits -of the mp\_ints $a$ and $b$ respectively. These aliases (lines 42 and 45) allow the compiler to access the digits without first dereferencing the -mp\_int pointers and then subsequently the pointer to the digits. - -After the aliases are established the digits from $a$ are copied into $b$ (lines 48 to 50) and then the excess -digits of $b$ are set to zero (lines 53 to 55). Both ``for'' loops make use of the pointer aliases and in -fact the alias for $b$ is carried through into the second ``for'' loop to clear the excess digits. This optimization -allows the alias to stay in a machine register fairly easy between the two loops. - -\textbf{Remarks.} The use of pointer aliases is an implementation methodology first introduced in this function that will -be used considerably in other functions. Technically, a pointer alias is simply a short hand alias used to lower the -number of pointer dereferencing operations required to access data. For example, a for loop may resemble - -\begin{alltt} -for (x = 0; x < 100; x++) \{ - a->num[4]->dp[x] = 0; -\} -\end{alltt} - -This could be re-written using aliases as - -\begin{alltt} -mp_digit *tmpa; -a = a->num[4]->dp; -for (x = 0; x < 100; x++) \{ - *a++ = 0; -\} -\end{alltt} - -In this case an alias is used to access the -array of digits within an mp\_int structure directly. It may seem that a pointer alias is strictly not required -as a compiler may optimize out the redundant pointer operations. However, there are two dominant reasons to use aliases. - -The first reason is that most compilers will not effectively optimize pointer arithmetic. For example, some optimizations -may work for the Microsoft Visual C++ compiler (MSVC) and not for the GNU C Compiler (GCC). Also some optimizations may -work for GCC and not MSVC. As such it is ideal to find a common ground for as many compilers as possible. Pointer -aliases optimize the code considerably before the compiler even reads the source code which means the end compiled code -stands a better chance of being faster. - -The second reason is that pointer aliases often can make an algorithm simpler to read. Consider the first ``for'' -loop of the function mp\_copy() re-written to not use pointer aliases. - -\begin{alltt} - /* copy all the digits */ - for (n = 0; n < a->used; n++) \{ - b->dp[n] = a->dp[n]; - \} -\end{alltt} - -Whether this code is harder to read depends strongly on the individual. However, it is quantifiably slightly more -complicated as there are four variables within the statement instead of just two. - -\subsubsection{Nested Statements} -Another commonly used technique in the source routines is that certain sections of code are nested. This is used in -particular with the pointer aliases to highlight code phases. For example, a Comba multiplier (discussed in chapter six) -will typically have three different phases. First the temporaries are initialized, then the columns calculated and -finally the carries are propagated. In this example the middle column production phase will typically be nested as it -uses temporary variables and aliases the most. - -The nesting also simplies the source code as variables that are nested are only valid for their scope. As a result -the various temporary variables required do not propagate into other sections of code. - - -\subsection{Creating a Clone} -Another common operation is to make a local temporary copy of an mp\_int argument. To initialize an mp\_int -and then copy another existing mp\_int into the newly intialized mp\_int will be known as creating a clone. This is -useful within functions that need to modify an argument but do not wish to actually modify the original copy. The -mp\_init\_copy algorithm has been designed to help perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$\\ -\textbf{Output}. $a$ is initialized to be a copy of $b$. \\ -\hline \\ -1. Init $a$. (\textit{mp\_init}) \\ -2. Copy $b$ to $a$. (\textit{mp\_copy}) \\ -3. Return the status of the copy operation. \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_copy} -\end{figure} - -\textbf{Algorithm mp\_init\_copy.} -This algorithm will initialize an mp\_int variable and copy another previously initialized mp\_int variable into it. As -such this algorithm will perform two operations in one step. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init\_copy.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* creates "a" then copies b into it */ -018 int mp_init_copy (mp_int * a, mp_int * b) -019 \{ -020 int res; -021 -022 if ((res = mp_init_size (a, b->used)) != MP_OKAY) \{ -023 return res; -024 \} -025 return mp_copy (b, a); -026 \} -027 #endif -028 -\end{alltt} -\end{small} - -This will initialize \textbf{a} and make it a verbatim copy of the contents of \textbf{b}. Note that -\textbf{a} will have its own memory allocated which means that \textbf{b} may be cleared after the call -and \textbf{a} will be left intact. - -\section{Zeroing an Integer} -Reseting an mp\_int to the default state is a common step in many algorithms. The mp\_zero algorithm will be the algorithm used to -perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_zero}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Zero the contents of $a$ \\ -\hline \\ -1. $a.used \leftarrow 0$ \\ -2. $a.sign \leftarrow$ MP\_ZPOS \\ -3. for $n$ from 0 to $a.alloc - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_zero} -\end{figure} - -\textbf{Algorithm mp\_zero.} -This algorithm simply resets a mp\_int to the default state. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_zero.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* set to zero */ -018 void mp_zero (mp_int * a) -019 \{ -020 int n; -021 mp_digit *tmp; -022 -023 a->sign = MP_ZPOS; -024 a->used = 0; -025 -026 tmp = a->dp; -027 for (n = 0; n < a->alloc; n++) \{ -028 *tmp++ = 0; -029 \} -030 \} -031 #endif -032 -\end{alltt} -\end{small} - -After the function is completed, all of the digits are zeroed, the \textbf{used} count is zeroed and the -\textbf{sign} variable is set to \textbf{MP\_ZPOS}. - -\section{Sign Manipulation} -\subsection{Absolute Value} -With the mp\_int representation of an integer, calculating the absolute value is trivial. The mp\_abs algorithm will compute -the absolute value of an mp\_int. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_abs}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = \vert a \vert$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. $b.sign \leftarrow MP\_ZPOS$ \\ -4. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_abs} -\end{figure} - -\textbf{Algorithm mp\_abs.} -This algorithm computes the absolute of an mp\_int input. First it copies $a$ over $b$. This is an example of an -algorithm where the check in mp\_copy that determines if the source and destination are equal proves useful. This allows, -for instance, the developer to pass the same mp\_int as the source and destination to this function without addition -logic to handle it. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_abs.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = |a| -018 * -019 * Simple function copies the input and fixes the sign to positive -020 */ -021 int -022 mp_abs (mp_int * a, mp_int * b) -023 \{ -024 int res; -025 -026 /* copy a to b */ -027 if (a != b) \{ -028 if ((res = mp_copy (a, b)) != MP_OKAY) \{ -029 return res; -030 \} -031 \} -032 -033 /* force the sign of b to positive */ -034 b->sign = MP_ZPOS; -035 -036 return MP_OKAY; -037 \} -038 #endif -039 -\end{alltt} -\end{small} - -This fairly trivial algorithm first eliminates non--required duplications (line 27) and then sets the -\textbf{sign} flag to \textbf{MP\_ZPOS}. - -\subsection{Integer Negation} -With the mp\_int representation of an integer, calculating the negation is also trivial. The mp\_neg algorithm will compute -the negative of an mp\_int input. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_neg}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = -a$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. If $a.used = 0$ then return(\textit{MP\_OKAY}). \\ -4. If $a.sign = MP\_ZPOS$ then do \\ -\hspace{3mm}4.1 $b.sign = MP\_NEG$. \\ -5. else do \\ -\hspace{3mm}5.1 $b.sign = MP\_ZPOS$. \\ -6. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_neg} -\end{figure} - -\textbf{Algorithm mp\_neg.} -This algorithm computes the negation of an input. First it copies $a$ over $b$. If $a$ has no used digits then -the algorithm returns immediately. Otherwise it flips the sign flag and stores the result in $b$. Note that if -$a$ had no digits then it must be positive by definition. Had step three been omitted then the algorithm would return -zero as negative. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_neg.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = -a */ -018 int mp_neg (mp_int * a, mp_int * b) -019 \{ -020 int res; -021 if (a != b) \{ -022 if ((res = mp_copy (a, b)) != MP_OKAY) \{ -023 return res; -024 \} -025 \} -026 -027 if (mp_iszero(b) != MP_YES) \{ -028 b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; -029 \} else \{ -030 b->sign = MP_ZPOS; -031 \} -032 -033 return MP_OKAY; -034 \} -035 #endif -036 -\end{alltt} -\end{small} - -Like mp\_abs() this function avoids non--required duplications (line 21) and then sets the sign. We -have to make sure that only non--zero values get a \textbf{sign} of \textbf{MP\_NEG}. If the mp\_int is zero -than the \textbf{sign} is hard--coded to \textbf{MP\_ZPOS}. - -\section{Small Constants} -\subsection{Setting Small Constants} -Often a mp\_int must be set to a relatively small value such as $1$ or $2$. For these cases the mp\_set algorithm is useful. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set}. \\ -\textbf{Input}. An mp\_int $a$ and a digit $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}). \\ -2. $a_0 \leftarrow b \mbox{ (mod }\beta\mbox{)}$ \\ -3. $a.used \leftarrow \left \lbrace \begin{array}{ll} - 1 & \mbox{if }a_0 > 0 \\ - 0 & \mbox{if }a_0 = 0 - \end{array} \right .$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set} -\end{figure} - -\textbf{Algorithm mp\_set.} -This algorithm sets a mp\_int to a small single digit value. Step number 1 ensures that the integer is reset to the default state. The -single digit is set (\textit{modulo $\beta$}) and the \textbf{used} count is adjusted accordingly. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_set.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* set to a digit */ -018 void mp_set (mp_int * a, mp_digit b) -019 \{ -020 mp_zero (a); -021 a->dp[0] = b & MP_MASK; -022 a->used = (a->dp[0] != 0) ? 1 : 0; -023 \} -024 #endif -025 -\end{alltt} -\end{small} - -First we zero (line 20) the mp\_int to make sure that the other members are initialized for a -small positive constant. mp\_zero() ensures that the \textbf{sign} is positive and the \textbf{used} count -is zero. Next we set the digit and reduce it modulo $\beta$ (line 21). After this step we have to -check if the resulting digit is zero or not. If it is not then we set the \textbf{used} count to one, otherwise -to zero. - -We can quickly reduce modulo $\beta$ since it is of the form $2^k$ and a quick binary AND operation with -$2^k - 1$ will perform the same operation. - -One important limitation of this function is that it will only set one digit. The size of a digit is not fixed, meaning source that uses -this function should take that into account. Only trivially small constants can be set using this function. - -\subsection{Setting Large Constants} -To overcome the limitations of the mp\_set algorithm the mp\_set\_int algorithm is ideal. It accepts a ``long'' -data type as input and will always treat it as a 32-bit integer. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set\_int}. \\ -\textbf{Input}. An mp\_int $a$ and a ``long'' integer $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}) \\ -2. for $n$ from 0 to 7 do \\ -\hspace{3mm}2.1 $a \leftarrow a \cdot 16$ (\textit{mp\_mul2d}) \\ -\hspace{3mm}2.2 $u \leftarrow \lfloor b / 2^{4(7 - n)} \rfloor \mbox{ (mod }16\mbox{)}$\\ -\hspace{3mm}2.3 $a_0 \leftarrow a_0 + u$ \\ -\hspace{3mm}2.4 $a.used \leftarrow a.used + 1$ \\ -3. Clamp excess used digits (\textit{mp\_clamp}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set\_int} -\end{figure} - -\textbf{Algorithm mp\_set\_int.} -The algorithm performs eight iterations of a simple loop where in each iteration four bits from the source are added to the -mp\_int. Step 2.1 will multiply the current result by sixteen making room for four more bits in the less significant positions. In step 2.2 the -next four bits from the source are extracted and are added to the mp\_int. The \textbf{used} digit count is -incremented to reflect the addition. The \textbf{used} digit counter is incremented since if any of the leading digits were zero the mp\_int would have -zero digits used and the newly added four bits would be ignored. - -Excess zero digits are trimmed in steps 2.1 and 3 by using higher level algorithms mp\_mul2d and mp\_clamp. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_set\_int.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* set a 32-bit const */ -018 int mp_set_int (mp_int * a, unsigned long b) -019 \{ -020 int x, res; -021 -022 mp_zero (a); -023 -024 /* set four bits at a time */ -025 for (x = 0; x < 8; x++) \{ -026 /* shift the number up four bits */ -027 if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) \{ -028 return res; -029 \} -030 -031 /* OR in the top four bits of the source */ -032 a->dp[0] |= (b >> 28) & 15; -033 -034 /* shift the source up to the next four bits */ -035 b <<= 4; -036 -037 /* ensure that digits are not clamped off */ -038 a->used += 1; -039 \} -040 mp_clamp (a); -041 return MP_OKAY; -042 \} -043 #endif -044 -\end{alltt} -\end{small} - -This function sets four bits of the number at a time to handle all practical \textbf{DIGIT\_BIT} sizes. The weird -addition on line 38 ensures that the newly added in bits are added to the number of digits. While it may not -seem obvious as to why the digit counter does not grow exceedingly large it is because of the shift on line 27 -as well as the call to mp\_clamp() on line 40. Both functions will clamp excess leading digits which keeps -the number of used digits low. - -\section{Comparisons} -\subsection{Unsigned Comparisions} -Comparing a multiple precision integer is performed with the exact same algorithm used to compare two decimal numbers. For example, -to compare $1,234$ to $1,264$ the digits are extracted by their positions. That is we compare $1 \cdot 10^3 + 2 \cdot 10^2 + 3 \cdot 10^1 + 4 \cdot 10^0$ -to $1 \cdot 10^3 + 2 \cdot 10^2 + 6 \cdot 10^1 + 4 \cdot 10^0$ by comparing single digits at a time starting with the highest magnitude -positions. If any leading digit of one integer is greater than a digit in the same position of another integer then obviously it must be greater. - -The first comparision routine that will be developed is the unsigned magnitude compare which will perform a comparison based on the digits of two -mp\_int variables alone. It will ignore the sign of the two inputs. Such a function is useful when an absolute comparison is required or if the -signs are known to agree in advance. - -To facilitate working with the results of the comparison functions three constants are required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|r|l|} -\hline \textbf{Constant} & \textbf{Meaning} \\ -\hline \textbf{MP\_GT} & Greater Than \\ -\hline \textbf{MP\_EQ} & Equal To \\ -\hline \textbf{MP\_LT} & Less Than \\ -\hline -\end{tabular} -\end{center} -\caption{Comparison Return Codes} -\end{figure} - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp\_mag}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$. \\ -\textbf{Output}. Unsigned comparison results ($a$ to the left of $b$). \\ -\hline \\ -1. If $a.used > b.used$ then return(\textit{MP\_GT}) \\ -2. If $a.used < b.used$ then return(\textit{MP\_LT}) \\ -3. for n from $a.used - 1$ to 0 do \\ -\hspace{+3mm}3.1 if $a_n > b_n$ then return(\textit{MP\_GT}) \\ -\hspace{+3mm}3.2 if $a_n < b_n$ then return(\textit{MP\_LT}) \\ -4. Return(\textit{MP\_EQ}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp\_mag} -\end{figure} - -\textbf{Algorithm mp\_cmp\_mag.} -By saying ``$a$ to the left of $b$'' it is meant that the comparison is with respect to $a$, that is if $a$ is greater than $b$ it will return -\textbf{MP\_GT} and similar with respect to when $a = b$ and $a < b$. The first two steps compare the number of digits used in both $a$ and $b$. -Obviously if the digit counts differ there would be an imaginary zero digit in the smaller number where the leading digit of the larger number is. -If both have the same number of digits than the actual digits themselves must be compared starting at the leading digit. - -By step three both inputs must have the same number of digits so its safe to start from either $a.used - 1$ or $b.used - 1$ and count down to -the zero'th digit. If after all of the digits have been compared, no difference is found, the algorithm returns \textbf{MP\_EQ}. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_cmp\_mag.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* compare maginitude of two ints (unsigned) */ -018 int mp_cmp_mag (mp_int * a, mp_int * b) -019 \{ -020 int n; -021 mp_digit *tmpa, *tmpb; -022 -023 /* compare based on # of non-zero digits */ -024 if (a->used > b->used) \{ -025 return MP_GT; -026 \} -027 -028 if (a->used < b->used) \{ -029 return MP_LT; -030 \} -031 -032 /* alias for a */ -033 tmpa = a->dp + (a->used - 1); -034 -035 /* alias for b */ -036 tmpb = b->dp + (a->used - 1); -037 -038 /* compare based on digits */ -039 for (n = 0; n < a->used; ++n, --tmpa, --tmpb) \{ -040 if (*tmpa > *tmpb) \{ -041 return MP_GT; -042 \} -043 -044 if (*tmpa < *tmpb) \{ -045 return MP_LT; -046 \} -047 \} -048 return MP_EQ; -049 \} -050 #endif -051 -\end{alltt} -\end{small} - -The two if statements (lines 24 and 28) compare the number of digits in the two inputs. These two are -performed before all of the digits are compared since it is a very cheap test to perform and can potentially save -considerable time. The implementation given is also not valid without those two statements. $b.alloc$ may be -smaller than $a.used$, meaning that undefined values will be read from $b$ past the end of the array of digits. - - - -\subsection{Signed Comparisons} -Comparing with sign considerations is also fairly critical in several routines (\textit{division for example}). Based on an unsigned magnitude -comparison a trivial signed comparison algorithm can be written. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. Signed Comparison Results ($a$ to the left of $b$) \\ -\hline \\ -1. if $a.sign = MP\_NEG$ and $b.sign = MP\_ZPOS$ then return(\textit{MP\_LT}) \\ -2. if $a.sign = MP\_ZPOS$ and $b.sign = MP\_NEG$ then return(\textit{MP\_GT}) \\ -3. if $a.sign = MP\_NEG$ then \\ -\hspace{+3mm}3.1 Return the unsigned comparison of $b$ and $a$ (\textit{mp\_cmp\_mag}) \\ -4 Otherwise \\ -\hspace{+3mm}4.1 Return the unsigned comparison of $a$ and $b$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp} -\end{figure} - -\textbf{Algorithm mp\_cmp.} -The first two steps compare the signs of the two inputs. If the signs do not agree then it can return right away with the appropriate -comparison code. When the signs are equal the digits of the inputs must be compared to determine the correct result. In step -three the unsigned comparision flips the order of the arguments since they are both negative. For instance, if $-a > -b$ then -$\vert a \vert < \vert b \vert$. Step number four will compare the two when they are both positive. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_cmp.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* compare two ints (signed)*/ -018 int -019 mp_cmp (mp_int * a, mp_int * b) -020 \{ -021 /* compare based on sign */ -022 if (a->sign != b->sign) \{ -023 if (a->sign == MP_NEG) \{ -024 return MP_LT; -025 \} else \{ -026 return MP_GT; -027 \} -028 \} -029 -030 /* compare digits */ -031 if (a->sign == MP_NEG) \{ -032 /* if negative compare opposite direction */ -033 return mp_cmp_mag(b, a); -034 \} else \{ -035 return mp_cmp_mag(a, b); -036 \} -037 \} -038 #endif -039 -\end{alltt} -\end{small} - -The two if statements (lines 22 and 23) perform the initial sign comparison. If the signs are not the equal then which ever -has the positive sign is larger. The inputs are compared (line 31) based on magnitudes. If the signs were both -negative then the unsigned comparison is performed in the opposite direction (line 33). Otherwise, the signs are assumed to -be both positive and a forward direction unsigned comparison is performed. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 2 \right ]$ & Modify algorithm mp\_set\_int to accept as input a variable length array of bits. \\ - & \\ -$\left [ 3 \right ]$ & Give the probability that algorithm mp\_cmp\_mag will have to compare $k$ digits \\ - & of two random digits (of equal magnitude) before a difference is found. \\ - & \\ -$\left [ 1 \right ]$ & Suggest a simple method to speed up the implementation of mp\_cmp\_mag based \\ - & on the observations made in the previous problem. \\ - & -\end{tabular} - -\chapter{Basic Arithmetic} -\section{Introduction} -At this point algorithms for initialization, clearing, zeroing, copying, comparing and setting small constants have been -established. The next logical set of algorithms to develop are addition, subtraction and digit shifting algorithms. These -algorithms make use of the lower level algorithms and are the cruicial building block for the multiplication algorithms. It is very important -that these algorithms are highly optimized. On their own they are simple $O(n)$ algorithms but they can be called from higher level algorithms -which easily places them at $O(n^2)$ or even $O(n^3)$ work levels. - -All of the algorithms within this chapter make use of the logical bit shift operations denoted by $<<$ and $>>$ for left and right -logical shifts respectively. A logical shift is analogous to sliding the decimal point of radix-10 representations. For example, the real -number $0.9345$ is equivalent to $93.45\%$ which is found by sliding the the decimal two places to the right (\textit{multiplying by $\beta^2 = 10^2$}). -Algebraically a binary logical shift is equivalent to a division or multiplication by a power of two. -For example, $a << k = a \cdot 2^k$ while $a >> k = \lfloor a/2^k \rfloor$. - -One significant difference between a logical shift and the way decimals are shifted is that digits below the zero'th position are removed -from the number. For example, consider $1101_2 >> 1$ using decimal notation this would produce $110.1_2$. However, with a logical shift the -result is $110_2$. - -\section{Addition and Subtraction} -In common twos complement fixed precision arithmetic negative numbers are easily represented by subtraction from the modulus. For example, with 32-bit integers -$a - b\mbox{ (mod }2^{32}\mbox{)}$ is the same as $a + (2^{32} - b) \mbox{ (mod }2^{32}\mbox{)}$ since $2^{32} \equiv 0 \mbox{ (mod }2^{32}\mbox{)}$. -As a result subtraction can be performed with a trivial series of logical operations and an addition. - -However, in multiple precision arithmetic negative numbers are not represented in the same way. Instead a sign flag is used to keep track of the -sign of the integer. As a result signed addition and subtraction are actually implemented as conditional usage of lower level addition or -subtraction algorithms with the sign fixed up appropriately. - -The lower level algorithms will add or subtract integers without regard to the sign flag. That is they will add or subtract the magnitude of -the integers respectively. - -\subsection{Low Level Addition} -An unsigned addition of multiple precision integers is performed with the same long-hand algorithm used to add decimal numbers. That is to add the -trailing digits first and propagate the resulting carry upwards. Since this is a lower level algorithm the name will have a ``s\_'' prefix. -Historically that convention stems from the MPI library where ``s\_'' stood for static functions that were hidden from the developer entirely. - -\newpage -\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The unsigned addition $c = \vert a \vert + \vert b \vert$. \\ -\hline \\ -1. if $a.used > b.used$ then \\ -\hspace{+3mm}1.1 $min \leftarrow b.used$ \\ -\hspace{+3mm}1.2 $max \leftarrow a.used$ \\ -\hspace{+3mm}1.3 $x \leftarrow a$ \\ -2. else \\ -\hspace{+3mm}2.1 $min \leftarrow a.used$ \\ -\hspace{+3mm}2.2 $max \leftarrow b.used$ \\ -\hspace{+3mm}2.3 $x \leftarrow b$ \\ -3. If $c.alloc < max + 1$ then grow $c$ to hold at least $max + 1$ digits (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max + 1$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{+3mm}7.1 $c_n \leftarrow a_n + b_n + u$ \\ -\hspace{+3mm}7.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min \ne max$ then do \\ -\hspace{+3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{+6mm}8.1.1 $c_n \leftarrow x_n + u$ \\ -\hspace{+6mm}8.1.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. $c_{max} \leftarrow u$ \\ -10. if $olduse > max$ then \\ -\hspace{+3mm}10.1 for $n$ from $max + 1$ to $oldused - 1$ do \\ -\hspace{+6mm}10.1.1 $c_n \leftarrow 0$ \\ -11. Clamp excess digits in $c$. (\textit{mp\_clamp}) \\ -12. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_add} -\end{figure} - -\textbf{Algorithm s\_mp\_add.} -This algorithm is loosely based on algorithm 14.7 of HAC \cite[pp. 594]{HAC} but has been extended to allow the inputs to have different magnitudes. -Coincidentally the description of algorithm A in Knuth \cite[pp. 266]{TAOCPV2} shares the same deficiency as the algorithm from \cite{HAC}. Even the -MIX pseudo machine code presented by Knuth \cite[pp. 266-267]{TAOCPV2} is incapable of handling inputs which are of different magnitudes. - -The first thing that has to be accomplished is to sort out which of the two inputs is the largest. The addition logic -will simply add all of the smallest input to the largest input and store that first part of the result in the -destination. Then it will apply a simpler addition loop to excess digits of the larger input. - -The first two steps will handle sorting the inputs such that $min$ and $max$ hold the digit counts of the two -inputs. The variable $x$ will be an mp\_int alias for the largest input or the second input $b$ if they have the -same number of digits. After the inputs are sorted the destination $c$ is grown as required to accomodate the sum -of the two inputs. The original \textbf{used} count of $c$ is copied and set to the new used count. - -At this point the first addition loop will go through as many digit positions that both inputs have. The carry -variable $\mu$ is set to zero outside the loop. Inside the loop an ``addition'' step requires three statements to produce -one digit of the summand. First -two digits from $a$ and $b$ are added together along with the carry $\mu$. The carry of this step is extracted and stored -in $\mu$ and finally the digit of the result $c_n$ is truncated within the range $0 \le c_n < \beta$. - -Now all of the digit positions that both inputs have in common have been exhausted. If $min \ne max$ then $x$ is an alias -for one of the inputs that has more digits. A simplified addition loop is then used to essentially copy the remaining digits -and the carry to the destination. - -The final carry is stored in $c_{max}$ and digits above $max$ upto $oldused$ are zeroed which completes the addition. - - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_add.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -018 int -019 s_mp_add (mp_int * a, mp_int * b, mp_int * c) -020 \{ -021 mp_int *x; -022 int olduse, res, min, max; -023 -024 /* find sizes, we let |a| <= |b| which means we have to sort -025 * them. "x" will point to the input with the most digits -026 */ -027 if (a->used > b->used) \{ -028 min = b->used; -029 max = a->used; -030 x = a; -031 \} else \{ -032 min = a->used; -033 max = b->used; -034 x = b; -035 \} -036 -037 /* init result */ -038 if (c->alloc < (max + 1)) \{ -039 if ((res = mp_grow (c, max + 1)) != MP_OKAY) \{ -040 return res; -041 \} -042 \} -043 -044 /* get old used digit count and set new one */ -045 olduse = c->used; -046 c->used = max + 1; -047 -048 \{ -049 mp_digit u, *tmpa, *tmpb, *tmpc; -050 int i; -051 -052 /* alias for digit pointers */ -053 -054 /* first input */ -055 tmpa = a->dp; -056 -057 /* second input */ -058 tmpb = b->dp; -059 -060 /* destination */ -061 tmpc = c->dp; -062 -063 /* zero the carry */ -064 u = 0; -065 for (i = 0; i < min; i++) \{ -066 /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ -067 *tmpc = *tmpa++ + *tmpb++ + u; -068 -069 /* U = carry bit of T[i] */ -070 u = *tmpc >> ((mp_digit)DIGIT_BIT); -071 -072 /* take away carry bit from T[i] */ -073 *tmpc++ &= MP_MASK; -074 \} -075 -076 /* now copy higher words if any, that is in A+B -077 * if A or B has more digits add those in -078 */ -079 if (min != max) \{ -080 for (; i < max; i++) \{ -081 /* T[i] = X[i] + U */ -082 *tmpc = x->dp[i] + u; -083 -084 /* U = carry bit of T[i] */ -085 u = *tmpc >> ((mp_digit)DIGIT_BIT); -086 -087 /* take away carry bit from T[i] */ -088 *tmpc++ &= MP_MASK; -089 \} -090 \} -091 -092 /* add carry */ -093 *tmpc++ = u; -094 -095 /* clear digits above oldused */ -096 for (i = c->used; i < olduse; i++) \{ -097 *tmpc++ = 0; -098 \} -099 \} -100 -101 mp_clamp (c); -102 return MP_OKAY; -103 \} -104 #endif -105 -\end{alltt} -\end{small} - -We first sort (lines 27 to 35) the inputs based on magnitude and determine the $min$ and $max$ variables. -Note that $x$ is a pointer to an mp\_int assigned to the largest input, in effect it is a local alias. Next we -grow the destination (37 to 42) ensure that it can accomodate the result of the addition. - -Similar to the implementation of mp\_copy this function uses the braced code and local aliases coding style. The three aliases that are on -lines 55, 58 and 61 represent the two inputs and destination variables respectively. These aliases are used to ensure the -compiler does not have to dereference $a$, $b$ or $c$ (respectively) to access the digits of the respective mp\_int. - -The initial carry $u$ will be cleared (line 64), note that $u$ is of type mp\_digit which ensures type -compatibility within the implementation. The initial addition (line 65 to 74) adds digits from -both inputs until the smallest input runs out of digits. Similarly the conditional addition loop -(line 80 to 90) adds the remaining digits from the larger of the two inputs. The addition is finished -with the final carry being stored in $tmpc$ (line 93). Note the ``++'' operator within the same expression. -After line 93, $tmpc$ will point to the $c.used$'th digit of the mp\_int $c$. This is useful -for the next loop (line 96 to 99) which set any old upper digits to zero. - -\subsection{Low Level Subtraction} -The low level unsigned subtraction algorithm is very similar to the low level unsigned addition algorithm. The principle difference is that the -unsigned subtraction algorithm requires the result to be positive. That is when computing $a - b$ the condition $\vert a \vert \ge \vert b\vert$ must -be met for this algorithm to function properly. Keep in mind this low level algorithm is not meant to be used in higher level algorithms directly. -This algorithm as will be shown can be used to create functional signed addition and subtraction algorithms. - - -For this algorithm a new variable is required to make the description simpler. Recall from section 1.3.1 that a mp\_digit must be able to represent -the range $0 \le x < 2\beta$ for the algorithms to work correctly. However, it is allowable that a mp\_digit represent a larger range of values. For -this algorithm we will assume that the variable $\gamma$ represents the number of bits available in a -mp\_digit (\textit{this implies $2^{\gamma} > \beta$}). - -For example, the default for LibTomMath is to use a ``unsigned long'' for the mp\_digit ``type'' while $\beta = 2^{28}$. In ISO C an ``unsigned long'' -data type must be able to represent $0 \le x < 2^{32}$ meaning that in this case $\gamma \ge 32$. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ ($\vert a \vert \ge \vert b \vert$) \\ -\textbf{Output}. The unsigned subtraction $c = \vert a \vert - \vert b \vert$. \\ -\hline \\ -1. $min \leftarrow b.used$ \\ -2. $max \leftarrow a.used$ \\ -3. If $c.alloc < max$ then grow $c$ to hold at least $max$ digits. (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{3mm}7.1 $c_n \leftarrow a_n - b_n - u$ \\ -\hspace{3mm}7.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min < max$ then do \\ -\hspace{3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{6mm}8.1.1 $c_n \leftarrow a_n - u$ \\ -\hspace{6mm}8.1.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. if $oldused > max$ then do \\ -\hspace{3mm}9.1 for $n$ from $max$ to $oldused - 1$ do \\ -\hspace{6mm}9.1.1 $c_n \leftarrow 0$ \\ -10. Clamp excess digits of $c$. (\textit{mp\_clamp}). \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_sub} -\end{figure} - -\textbf{Algorithm s\_mp\_sub.} -This algorithm performs the unsigned subtraction of two mp\_int variables under the restriction that the result must be positive. That is when -passing variables $a$ and $b$ the condition that $\vert a \vert \ge \vert b \vert$ must be met for the algorithm to function correctly. This -algorithm is loosely based on algorithm 14.9 \cite[pp. 595]{HAC} and is similar to algorithm S in \cite[pp. 267]{TAOCPV2} as well. As was the case -of the algorithm s\_mp\_add both other references lack discussion concerning various practical details such as when the inputs differ in magnitude. - -The initial sorting of the inputs is trivial in this algorithm since $a$ is guaranteed to have at least the same magnitude of $b$. Steps 1 and 2 -set the $min$ and $max$ variables. Unlike the addition routine there is guaranteed to be no carry which means that the final result can be at -most $max$ digits in length as opposed to $max + 1$. Similar to the addition algorithm the \textbf{used} count of $c$ is copied locally and -set to the maximal count for the operation. - -The subtraction loop that begins on step seven is essentially the same as the addition loop of algorithm s\_mp\_add except single precision -subtraction is used instead. Note the use of the $\gamma$ variable to extract the carry (\textit{also known as the borrow}) within the subtraction -loops. Under the assumption that two's complement single precision arithmetic is used this will successfully extract the desired carry. - -For example, consider subtracting $0101_2$ from $0100_2$ where $\gamma = 4$ and $\beta = 2$. The least significant bit will force a carry upwards to -the third bit which will be set to zero after the borrow. After the very first bit has been subtracted $4 - 1 \equiv 0011_2$ will remain, When the -third bit of $0101_2$ is subtracted from the result it will cause another carry. In this case though the carry will be forced to propagate all the -way to the most significant bit. - -Recall that $\beta < 2^{\gamma}$. This means that if a carry does occur just before the $lg(\beta)$'th bit it will propagate all the way to the most -significant bit. Thus, the high order bits of the mp\_digit that are not part of the actual digit will either be all zero, or all one. All that -is needed is a single zero or one bit for the carry. Therefore a single logical shift right by $\gamma - 1$ positions is sufficient to extract the -carry. This method of carry extraction may seem awkward but the reason for it becomes apparent when the implementation is discussed. - -If $b$ has a smaller magnitude than $a$ then step 9 will force the carry and copy operation to propagate through the larger input $a$ into $c$. Step -10 will ensure that any leading digits of $c$ above the $max$'th position are zeroed. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_sub.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -018 int -019 s_mp_sub (mp_int * a, mp_int * b, mp_int * c) -020 \{ -021 int olduse, res, min, max; -022 -023 /* find sizes */ -024 min = b->used; -025 max = a->used; -026 -027 /* init result */ -028 if (c->alloc < max) \{ -029 if ((res = mp_grow (c, max)) != MP_OKAY) \{ -030 return res; -031 \} -032 \} -033 olduse = c->used; -034 c->used = max; -035 -036 \{ -037 mp_digit u, *tmpa, *tmpb, *tmpc; -038 int i; -039 -040 /* alias for digit pointers */ -041 tmpa = a->dp; -042 tmpb = b->dp; -043 tmpc = c->dp; -044 -045 /* set carry to zero */ -046 u = 0; -047 for (i = 0; i < min; i++) \{ -048 /* T[i] = A[i] - B[i] - U */ -049 *tmpc = (*tmpa++ - *tmpb++) - u; -050 -051 /* U = carry bit of T[i] -052 * Note this saves performing an AND operation since -053 * if a carry does occur it will propagate all the way to the -054 * MSB. As a result a single shift is enough to get the carry -055 */ -056 u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); -057 -058 /* Clear carry from T[i] */ -059 *tmpc++ &= MP_MASK; -060 \} -061 -062 /* now copy higher words if any, e.g. if A has more digits than B */ -063 for (; i < max; i++) \{ -064 /* T[i] = A[i] - U */ -065 *tmpc = *tmpa++ - u; -066 -067 /* U = carry bit of T[i] */ -068 u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); -069 -070 /* Clear carry from T[i] */ -071 *tmpc++ &= MP_MASK; -072 \} -073 -074 /* clear digits above used (since we may not have grown result above) */ - -075 for (i = c->used; i < olduse; i++) \{ -076 *tmpc++ = 0; -077 \} -078 \} -079 -080 mp_clamp (c); -081 return MP_OKAY; -082 \} -083 -084 #endif -085 -\end{alltt} -\end{small} - -Like low level addition we ``sort'' the inputs. Except in this case the sorting is hardcoded -(lines 24 and 25). In reality the $min$ and $max$ variables are only aliases and are only -used to make the source code easier to read. Again the pointer alias optimization is used -within this algorithm. The aliases $tmpa$, $tmpb$ and $tmpc$ are initialized -(lines 41, 42 and 43) for $a$, $b$ and $c$ respectively. - -The first subtraction loop (lines 46 through 60) subtract digits from both inputs until the smaller of -the two inputs has been exhausted. As remarked earlier there is an implementation reason for using the ``awkward'' -method of extracting the carry (line 56). The traditional method for extracting the carry would be to shift -by $lg(\beta)$ positions and logically AND the least significant bit. The AND operation is required because all of -the bits above the $\lg(\beta)$'th bit will be set to one after a carry occurs from subtraction. This carry -extraction requires two relatively cheap operations to extract the carry. The other method is to simply shift the -most significant bit to the least significant bit thus extracting the carry with a single cheap operation. This -optimization only works on twos compliment machines which is a safe assumption to make. - -If $a$ has a larger magnitude than $b$ an additional loop (lines 63 through 72) is required to propagate -the carry through $a$ and copy the result to $c$. - -\subsection{High Level Addition} -Now that both lower level addition and subtraction algorithms have been established an effective high level signed addition algorithm can be -established. This high level addition algorithm will be what other algorithms and developers will use to perform addition of mp\_int data -types. - -Recall from section 5.2 that an mp\_int represents an integer with an unsigned mantissa (\textit{the array of digits}) and a \textbf{sign} -flag. A high level addition is actually performed as a series of eight separate cases which can be optimized down to three unique cases. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed addition $c = a + b$. \\ -\hline \\ -1. if $a.sign = b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add})\\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert < \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow b.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert b \vert - \vert a \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert a \vert - \vert b \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_add} -\end{figure} - -\textbf{Algorithm mp\_add.} -This algorithm performs the signed addition of two mp\_int variables. There is no reference algorithm to draw upon from -either \cite{TAOCPV2} or \cite{HAC} since they both only provide unsigned operations. The algorithm is fairly -straightforward but restricted since subtraction can only produce positive results. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert > \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&&\\ - -\hline $+$ & $-$ & No & $c = b - a$ & $b.sign$ \\ -\hline $-$ & $+$ & No & $c = b - a$ & $b.sign$ \\ - -\hline &&&&\\ - -\hline $+$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ - -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Addition Guide Chart} -\label{fig:AddChart} -\end{figure} - -Figure~\ref{fig:AddChart} lists all of the eight possible input combinations and is sorted to show that only three -specific cases need to be handled. The return code of the unsigned operations at step 1.2, 2.1.2 and 2.2.2 are -forwarded to step three to check for errors. This simplifies the description of the algorithm considerably and best -follows how the implementation actually was achieved. - -Also note how the \textbf{sign} is set before the unsigned addition or subtraction is performed. Recall from the descriptions of algorithms -s\_mp\_add and s\_mp\_sub that the mp\_clamp function is used at the end to trim excess digits. The mp\_clamp algorithm will set the \textbf{sign} -to \textbf{MP\_ZPOS} when the \textbf{used} digit count reaches zero. - -For example, consider performing $-a + a$ with algorithm mp\_add. By the description of the algorithm the sign is set to \textbf{MP\_NEG} which would -produce a result of $-0$. However, since the sign is set first then the unsigned addition is performed the subsequent usage of algorithm mp\_clamp -within algorithm s\_mp\_add will force $-0$ to become $0$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_add.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* high level addition (handles signs) */ -018 int mp_add (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 int sa, sb, res; -021 -022 /* get sign of both inputs */ -023 sa = a->sign; -024 sb = b->sign; -025 -026 /* handle two cases, not four */ -027 if (sa == sb) \{ -028 /* both positive or both negative */ -029 /* add their magnitudes, copy the sign */ -030 c->sign = sa; -031 res = s_mp_add (a, b, c); -032 \} else \{ -033 /* one positive, the other negative */ -034 /* subtract the one with the greater magnitude from */ -035 /* the one of the lesser magnitude. The result gets */ -036 /* the sign of the one with the greater magnitude. */ -037 if (mp_cmp_mag (a, b) == MP_LT) \{ -038 c->sign = sb; -039 res = s_mp_sub (b, a, c); -040 \} else \{ -041 c->sign = sa; -042 res = s_mp_sub (a, b, c); -043 \} -044 \} -045 return res; -046 \} -047 -048 #endif -049 -\end{alltt} -\end{small} - -The source code follows the algorithm fairly closely. The most notable new source code addition is the usage of the $res$ integer variable which -is used to pass result of the unsigned operations forward. Unlike in the algorithm, the variable $res$ is merely returned as is without -explicitly checking it and returning the constant \textbf{MP\_OKAY}. The observation is this algorithm will succeed or fail only if the lower -level functions do so. Returning their return code is sufficient. - -\subsection{High Level Subtraction} -The high level signed subtraction algorithm is essentially the same as the high level signed addition algorithm. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed subtraction $c = a - b$. \\ -\hline \\ -1. if $a.sign \ne b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add}) \\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert \ge \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert a \vert - \vert b \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = MP\_NEG \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert b \vert - \vert a \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_sub} -\end{figure} - -\textbf{Algorithm mp\_sub.} -This algorithm performs the signed subtraction of two inputs. Similar to algorithm mp\_add there is no reference in either \cite{TAOCPV2} or -\cite{HAC}. Also this algorithm is restricted by algorithm s\_mp\_sub. Chart \ref{fig:SubChart} lists the eight possible inputs and -the operations required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert \ge \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline $-$ & $-$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Subtraction Guide Chart} -\label{fig:SubChart} -\end{figure} - -Similar to the case of algorithm mp\_add the \textbf{sign} is set first before the unsigned addition or subtraction. That is to prevent the -algorithm from producing $-a - -a = -0$ as a result. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_sub.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* high level subtraction (handles signs) */ -018 int -019 mp_sub (mp_int * a, mp_int * b, mp_int * c) -020 \{ -021 int sa, sb, res; -022 -023 sa = a->sign; -024 sb = b->sign; -025 -026 if (sa != sb) \{ -027 /* subtract a negative from a positive, OR */ -028 /* subtract a positive from a negative. */ -029 /* In either case, ADD their magnitudes, */ -030 /* and use the sign of the first number. */ -031 c->sign = sa; -032 res = s_mp_add (a, b, c); -033 \} else \{ -034 /* subtract a positive from a positive, OR */ -035 /* subtract a negative from a negative. */ -036 /* First, take the difference between their */ -037 /* magnitudes, then... */ -038 if (mp_cmp_mag (a, b) != MP_LT) \{ -039 /* Copy the sign from the first */ -040 c->sign = sa; -041 /* The first has a larger or equal magnitude */ -042 res = s_mp_sub (a, b, c); -043 \} else \{ -044 /* The result has the *opposite* sign from */ -045 /* the first number. */ -046 c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; -047 /* The second has a larger magnitude */ -048 res = s_mp_sub (b, a, c); -049 \} -050 \} -051 return res; -052 \} -053 -054 #endif -055 -\end{alltt} -\end{small} - -Much like the implementation of algorithm mp\_add the variable $res$ is used to catch the return code of the unsigned addition or subtraction operations -and forward it to the end of the function. On line 38 the ``not equal to'' \textbf{MP\_LT} expression is used to emulate a -``greater than or equal to'' comparison. - -\section{Bit and Digit Shifting} -It is quite common to think of a multiple precision integer as a polynomial in $x$, that is $y = f(\beta)$ where $f(x) = \sum_{i=0}^{n-1} a_i x^i$. -This notation arises within discussion of Montgomery and Diminished Radix Reduction as well as Karatsuba multiplication and squaring. - -In order to facilitate operations on polynomials in $x$ as above a series of simple ``digit'' algorithms have to be established. That is to shift -the digits left or right as well to shift individual bits of the digits left and right. It is important to note that not all ``shift'' operations -are on radix-$\beta$ digits. - -\subsection{Multiplication by Two} - -In a binary system where the radix is a power of two multiplication by two not only arises often in other algorithms it is a fairly efficient -operation to perform. A single precision logical shift left is sufficient to multiply a single digit by two. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = 2a$. \\ -\hline \\ -1. If $b.alloc < a.used + 1$ then grow $b$ to hold $a.used + 1$ digits. (\textit{mp\_grow}) \\ -2. $oldused \leftarrow b.used$ \\ -3. $b.used \leftarrow a.used$ \\ -4. $r \leftarrow 0$ \\ -5. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}5.1 $rr \leftarrow a_n >> (lg(\beta) - 1)$ \\ -\hspace{3mm}5.2 $b_n \leftarrow (a_n << 1) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.3 $r \leftarrow rr$ \\ -6. If $r \ne 0$ then do \\ -\hspace{3mm}6.1 $b_{n + 1} \leftarrow r$ \\ -\hspace{3mm}6.2 $b.used \leftarrow b.used + 1$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2} -\end{figure} - -\textbf{Algorithm mp\_mul\_2.} -This algorithm will quickly multiply a mp\_int by two provided $\beta$ is a power of two. Neither \cite{TAOCPV2} nor \cite{HAC} describe such -an algorithm despite the fact it arises often in other algorithms. The algorithm is setup much like the lower level algorithm s\_mp\_add since -it is for all intents and purposes equivalent to the operation $b = \vert a \vert + \vert a \vert$. - -Step 1 and 2 grow the input as required to accomodate the maximum number of \textbf{used} digits in the result. The initial \textbf{used} count -is set to $a.used$ at step 4. Only if there is a final carry will the \textbf{used} count require adjustment. - -Step 6 is an optimization implementation of the addition loop for this specific case. That is since the two values being added together -are the same there is no need to perform two reads from the digits of $a$. Step 6.1 performs a single precision shift on the current digit $a_n$ to -obtain what will be the carry for the next iteration. Step 6.2 calculates the $n$'th digit of the result as single precision shift of $a_n$ plus -the previous carry. Recall from section 4.1 that $a_n << 1$ is equivalent to $a_n \cdot 2$. An iteration of the addition loop is finished with -forwarding the carry to the next iteration. - -Step 7 takes care of any final carry by setting the $a.used$'th digit of the result to the carry and augmenting the \textbf{used} count of $b$. -Step 8 clears any leading digits of $b$ in case it originally had a larger magnitude than $a$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul\_2.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = a*2 */ -018 int mp_mul_2(mp_int * a, mp_int * b) -019 \{ -020 int x, res, oldused; -021 -022 /* grow to accomodate result */ -023 if (b->alloc < (a->used + 1)) \{ -024 if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) \{ -025 return res; -026 \} -027 \} -028 -029 oldused = b->used; -030 b->used = a->used; -031 -032 \{ -033 mp_digit r, rr, *tmpa, *tmpb; -034 -035 /* alias for source */ -036 tmpa = a->dp; -037 -038 /* alias for dest */ -039 tmpb = b->dp; -040 -041 /* carry */ -042 r = 0; -043 for (x = 0; x < a->used; x++) \{ -044 -045 /* get what will be the *next* carry bit from the -046 * MSB of the current digit -047 */ -048 rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); -049 -050 /* now shift up this digit, add in the carry [from the previous] */ -051 *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; -052 -053 /* copy the carry that would be from the source -054 * digit into the next iteration -055 */ -056 r = rr; -057 \} -058 -059 /* new leading digit? */ -060 if (r != 0) \{ -061 /* add a MSB which is always 1 at this point */ -062 *tmpb = 1; -063 ++(b->used); -064 \} -065 -066 /* now zero any excess digits on the destination -067 * that we didn't write to -068 */ -069 tmpb = b->dp + b->used; -070 for (x = b->used; x < oldused; x++) \{ -071 *tmpb++ = 0; -072 \} -073 \} -074 b->sign = a->sign; -075 return MP_OKAY; -076 \} -077 #endif -078 -\end{alltt} -\end{small} - -This implementation is essentially an optimized implementation of s\_mp\_add for the case of doubling an input. The only noteworthy difference -is the use of the logical shift operator on line 51 to perform a single precision doubling. - -\subsection{Division by Two} -A division by two can just as easily be accomplished with a logical shift right as multiplication by two can be with a logical shift left. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = a/2$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to hold $a.used$ digits. (\textit{mp\_grow}) \\ -2. If the reallocation failed return(\textit{MP\_MEM}). \\ -3. $oldused \leftarrow b.used$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $r \leftarrow 0$ \\ -6. for $n$ from $b.used - 1$ to $0$ do \\ -\hspace{3mm}6.1 $rr \leftarrow a_n \mbox{ (mod }2\mbox{)}$\\ -\hspace{3mm}6.2 $b_n \leftarrow (a_n >> 1) + (r << (lg(\beta) - 1)) \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}6.3 $r \leftarrow rr$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Clamp excess digits of $b$. (\textit{mp\_clamp}) \\ -10. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2} -\end{figure} - -\textbf{Algorithm mp\_div\_2.} -This algorithm will divide an mp\_int by two using logical shifts to the right. Like mp\_mul\_2 it uses a modified low level addition -core as the basis of the algorithm. Unlike mp\_mul\_2 the shift operations work from the leading digit to the trailing digit. The algorithm -could be written to work from the trailing digit to the leading digit however, it would have to stop one short of $a.used - 1$ digits to prevent -reading past the end of the array of digits. - -Essentially the loop at step 6 is similar to that of mp\_mul\_2 except the logical shifts go in the opposite direction and the carry is at the -least significant bit not the most significant bit. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div\_2.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = a/2 */ -018 int mp_div_2(mp_int * a, mp_int * b) -019 \{ -020 int x, res, oldused; -021 -022 /* copy */ -023 if (b->alloc < a->used) \{ -024 if ((res = mp_grow (b, a->used)) != MP_OKAY) \{ -025 return res; -026 \} -027 \} -028 -029 oldused = b->used; -030 b->used = a->used; -031 \{ -032 mp_digit r, rr, *tmpa, *tmpb; -033 -034 /* source alias */ -035 tmpa = a->dp + b->used - 1; -036 -037 /* dest alias */ -038 tmpb = b->dp + b->used - 1; -039 -040 /* carry */ -041 r = 0; -042 for (x = b->used - 1; x >= 0; x--) \{ -043 /* get the carry for the next iteration */ -044 rr = *tmpa & 1; -045 -046 /* shift the current digit, add in carry and store */ -047 *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); -048 -049 /* forward carry to next iteration */ -050 r = rr; -051 \} -052 -053 /* zero excess digits */ -054 tmpb = b->dp + b->used; -055 for (x = b->used; x < oldused; x++) \{ -056 *tmpb++ = 0; -057 \} -058 \} -059 b->sign = a->sign; -060 mp_clamp (b); -061 return MP_OKAY; -062 \} -063 #endif -064 -\end{alltt} -\end{small} - -\section{Polynomial Basis Operations} -Recall from section 4.3 that any integer can be represented as a polynomial in $x$ as $y = f(\beta)$. Such a representation is also known as -the polynomial basis \cite[pp. 48]{ROSE}. Given such a notation a multiplication or division by $x$ amounts to shifting whole digits a single -place. The need for such operations arises in several other higher level algorithms such as Barrett and Montgomery reduction, integer -division and Karatsuba multiplication. - -Converting from an array of digits to polynomial basis is very simple. Consider the integer $y \equiv (a_2, a_1, a_0)_{\beta}$ and recall that -$y = \sum_{i=0}^{2} a_i \beta^i$. Simply replace $\beta$ with $x$ and the expression is in polynomial basis. For example, $f(x) = 8x + 9$ is the -polynomial basis representation for $89$ using radix ten. That is, $f(10) = 8(10) + 9 = 89$. - -\subsection{Multiplication by $x$} - -Given a polynomial in $x$ such as $f(x) = a_n x^n + a_{n-1} x^{n-1} + ... + a_0$ multiplying by $x$ amounts to shifting the coefficients up one -degree. In this case $f(x) \cdot x = a_n x^{n+1} + a_{n-1} x^n + ... + a_0 x$. From a scalar basis point of view multiplying by $x$ is equivalent to -multiplying by the integer $\beta$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a \cdot \beta^b$ (equivalent to multiplication by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_OKAY}). \\ -2. If $a.alloc < a.used + b$ then grow $a$ to at least $a.used + b$ digits. (\textit{mp\_grow}). \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. $a.used \leftarrow a.used + b$ \\ -5. $i \leftarrow a.used - 1$ \\ -6. $j \leftarrow a.used - 1 - b$ \\ -7. for $n$ from $a.used - 1$ to $b$ do \\ -\hspace{3mm}7.1 $a_{i} \leftarrow a_{j}$ \\ -\hspace{3mm}7.2 $i \leftarrow i - 1$ \\ -\hspace{3mm}7.3 $j \leftarrow j - 1$ \\ -8. for $n$ from 0 to $b - 1$ do \\ -\hspace{3mm}8.1 $a_n \leftarrow 0$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lshd} -\end{figure} - -\textbf{Algorithm mp\_lshd.} -This algorithm multiplies an mp\_int by the $b$'th power of $x$. This is equivalent to multiplying by $\beta^b$. The algorithm differs -from the other algorithms presented so far as it performs the operation in place instead storing the result in a separate location. The -motivation behind this change is due to the way this function is typically used. Algorithms such as mp\_add store the result in an optionally -different third mp\_int because the original inputs are often still required. Algorithm mp\_lshd (\textit{and similarly algorithm mp\_rshd}) is -typically used on values where the original value is no longer required. The algorithm will return success immediately if -$b \le 0$ since the rest of algorithm is only valid when $b > 0$. - -First the destination $a$ is grown as required to accomodate the result. The counters $i$ and $j$ are used to form a \textit{sliding window} over -the digits of $a$ of length $b$. The head of the sliding window is at $i$ (\textit{the leading digit}) and the tail at $j$ (\textit{the trailing digit}). -The loop on step 7 copies the digit from the tail to the head. In each iteration the window is moved down one digit. The last loop on -step 8 sets the lower $b$ digits to zero. - -\newpage -\begin{center} -\begin{figure}[here] -\includegraphics{pics/sliding_window.ps} -\caption{Sliding Window Movement} -\label{pic:sliding_window} -\end{figure} -\end{center} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_lshd.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift left a certain amount of digits */ -018 int mp_lshd (mp_int * a, int b) -019 \{ -020 int x, res; -021 -022 /* if its less than zero return */ -023 if (b <= 0) \{ -024 return MP_OKAY; -025 \} -026 -027 /* grow to fit the new digits */ -028 if (a->alloc < (a->used + b)) \{ -029 if ((res = mp_grow (a, a->used + b)) != MP_OKAY) \{ -030 return res; -031 \} -032 \} -033 -034 \{ -035 mp_digit *top, *bottom; -036 -037 /* increment the used by the shift amount then copy upwards */ -038 a->used += b; -039 -040 /* top */ -041 top = a->dp + a->used - 1; -042 -043 /* base */ -044 bottom = (a->dp + a->used - 1) - b; -045 -046 /* much like mp_rshd this is implemented using a sliding window -047 * except the window goes the otherway around. Copying from -048 * the bottom to the top. see bn_mp_rshd.c for more info. -049 */ -050 for (x = a->used - 1; x >= b; x--) \{ -051 *top-- = *bottom--; -052 \} -053 -054 /* zero the lower digits */ -055 top = a->dp; -056 for (x = 0; x < b; x++) \{ -057 *top++ = 0; -058 \} -059 \} -060 return MP_OKAY; -061 \} -062 #endif -063 -\end{alltt} -\end{small} - -The if statement (line 23) ensures that the $b$ variable is greater than zero since we do not interpret negative -shift counts properly. The \textbf{used} count is incremented by $b$ before the copy loop begins. This elminates -the need for an additional variable in the for loop. The variable $top$ (line 41) is an alias -for the leading digit while $bottom$ (line 44) is an alias for the trailing edge. The aliases form a -window of exactly $b$ digits over the input. - -\subsection{Division by $x$} - -Division by powers of $x$ is easily achieved by shifting the digits right and removing any that will end up to the right of the zero'th digit. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a / \beta^b$ (Divide by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return. \\ -2. If $a.used \le b$ then do \\ -\hspace{3mm}2.1 Zero $a$. (\textit{mp\_zero}). \\ -\hspace{3mm}2.2 Return. \\ -3. $i \leftarrow 0$ \\ -4. $j \leftarrow b$ \\ -5. for $n$ from 0 to $a.used - b - 1$ do \\ -\hspace{3mm}5.1 $a_i \leftarrow a_j$ \\ -\hspace{3mm}5.2 $i \leftarrow i + 1$ \\ -\hspace{3mm}5.3 $j \leftarrow j + 1$ \\ -6. for $n$ from $a.used - b$ to $a.used - 1$ do \\ -\hspace{3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.used \leftarrow a.used - b$ \\ -8. Return. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rshd} -\end{figure} - -\textbf{Algorithm mp\_rshd.} -This algorithm divides the input in place by the $b$'th power of $x$. It is analogous to dividing by a $\beta^b$ but much quicker since -it does not require single precision division. This algorithm does not actually return an error code as it cannot fail. - -If the input $b$ is less than one the algorithm quickly returns without performing any work. If the \textbf{used} count is less than or equal -to the shift count $b$ then it will simply zero the input and return. - -After the trivial cases of inputs have been handled the sliding window is setup. Much like the case of algorithm mp\_lshd a sliding window that -is $b$ digits wide is used to copy the digits. Unlike mp\_lshd the window slides in the opposite direction from the trailing to the leading digit. -Also the digits are copied from the leading to the trailing edge. - -Once the window copy is complete the upper digits must be zeroed and the \textbf{used} count decremented. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_rshd.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift right a certain amount of digits */ -018 void mp_rshd (mp_int * a, int b) -019 \{ -020 int x; -021 -022 /* if b <= 0 then ignore it */ -023 if (b <= 0) \{ -024 return; -025 \} -026 -027 /* if b > used then simply zero it and return */ -028 if (a->used <= b) \{ -029 mp_zero (a); -030 return; -031 \} -032 -033 \{ -034 mp_digit *bottom, *top; -035 -036 /* shift the digits down */ -037 -038 /* bottom */ -039 bottom = a->dp; -040 -041 /* top [offset into digits] */ -042 top = a->dp + b; -043 -044 /* this is implemented as a sliding window where -045 * the window is b-digits long and digits from -046 * the top of the window are copied to the bottom -047 * -048 * e.g. -049 -050 b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> -051 /\symbol{92} | ----> -052 \symbol{92}-------------------/ ----> -053 */ -054 for (x = 0; x < (a->used - b); x++) \{ -055 *bottom++ = *top++; -056 \} -057 -058 /* zero the top digits */ -059 for (; x < a->used; x++) \{ -060 *bottom++ = 0; -061 \} -062 \} -063 -064 /* remove excess digits */ -065 a->used -= b; -066 \} -067 #endif -068 -\end{alltt} -\end{small} - -The only noteworthy element of this routine is the lack of a return type since it cannot fail. Like mp\_lshd() we -form a sliding window except we copy in the other direction. After the window (line 59) we then zero -the upper digits of the input to make sure the result is correct. - -\section{Powers of Two} - -Now that algorithms for moving single bits as well as whole digits exist algorithms for moving the ``in between'' distances are required. For -example, to quickly multiply by $2^k$ for any $k$ without using a full multiplier algorithm would prove useful. Instead of performing single -shifts $k$ times to achieve a multiplication by $2^{\pm k}$ a mixture of whole digit shifting and partial digit shifting is employed. - -\subsection{Multiplication by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot 2^b$. \\ -\hline \\ -1. $c \leftarrow a$. (\textit{mp\_copy}) \\ -2. If $c.alloc < c.used + \lfloor b / lg(\beta) \rfloor + 2$ then grow $c$ accordingly. \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. If $b \ge lg(\beta)$ then \\ -\hspace{3mm}4.1 $c \leftarrow c \cdot \beta^{\lfloor b / lg(\beta) \rfloor}$ (\textit{mp\_lshd}). \\ -\hspace{3mm}4.2 If step 4.1 failed return(\textit{MP\_MEM}). \\ -5. $d \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $d \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^d$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $0$ to $c.used - 1$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n >> (lg(\beta) - d) \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n << d) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -\hspace{3mm}6.4 If $r > 0$ then do \\ -\hspace{6mm}6.4.1 $c_{c.used} \leftarrow r$ \\ -\hspace{6mm}6.4.2 $c.used \leftarrow c.used + 1$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2d} -\end{figure} - -\textbf{Algorithm mp\_mul\_2d.} -This algorithm multiplies $a$ by $2^b$ and stores the result in $c$. The algorithm uses algorithm mp\_lshd and a derivative of algorithm mp\_mul\_2 to -quickly compute the product. - -First the algorithm will multiply $a$ by $x^{\lfloor b / lg(\beta) \rfloor}$ which will ensure that the remainder multiplicand is less than -$\beta$. For example, if $b = 37$ and $\beta = 2^{28}$ then this step will multiply by $x$ leaving a multiplication by $2^{37 - 28} = 2^{9}$ -left. - -After the digits have been shifted appropriately at most $lg(\beta) - 1$ shifts are left to perform. Step 5 calculates the number of remaining shifts -required. If it is non-zero a modified shift loop is used to calculate the remaining product. -Essentially the loop is a generic version of algorithm mp\_mul\_2 designed to handle any shift count in the range $1 \le x < lg(\beta)$. The $mask$ -variable is used to extract the upper $d$ bits to form the carry for the next iteration. - -This algorithm is loosely measured as a $O(2n)$ algorithm which means that if the input is $n$-digits that it takes $2n$ ``time'' to -complete. It is possible to optimize this algorithm down to a $O(n)$ algorithm at a cost of making the algorithm slightly harder to follow. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul\_2d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift left by a certain bit count */ -018 int mp_mul_2d (mp_int * a, int b, mp_int * c) -019 \{ -020 mp_digit d; -021 int res; -022 -023 /* copy */ -024 if (a != c) \{ -025 if ((res = mp_copy (a, c)) != MP_OKAY) \{ -026 return res; -027 \} -028 \} -029 -030 if (c->alloc < (int)(c->used + (b / DIGIT_BIT) + 1)) \{ -031 if ((res = mp_grow (c, c->used + (b / DIGIT_BIT) + 1)) != MP_OKAY) \{ -032 return res; -033 \} -034 \} -035 -036 /* shift by as many digits in the bit count */ -037 if (b >= (int)DIGIT_BIT) \{ -038 if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) \{ -039 return res; -040 \} -041 \} -042 -043 /* shift any bit count < DIGIT_BIT */ -044 d = (mp_digit) (b % DIGIT_BIT); -045 if (d != 0) \{ -046 mp_digit *tmpc, shift, mask, r, rr; -047 int x; -048 -049 /* bitmask for carries */ -050 mask = (((mp_digit)1) << d) - 1; -051 -052 /* shift for msbs */ -053 shift = DIGIT_BIT - d; -054 -055 /* alias */ -056 tmpc = c->dp; -057 -058 /* carry */ -059 r = 0; -060 for (x = 0; x < c->used; x++) \{ -061 /* get the higher bits of the current word */ -062 rr = (*tmpc >> shift) & mask; -063 -064 /* shift the current word and OR in the carry */ -065 *tmpc = ((*tmpc << d) | r) & MP_MASK; -066 ++tmpc; -067 -068 /* set the carry to the carry bits of the current word */ -069 r = rr; -070 \} -071 -072 /* set final carry */ -073 if (r != 0) \{ -074 c->dp[(c->used)++] = r; -075 \} -076 \} -077 mp_clamp (c); -078 return MP_OKAY; -079 \} -080 #endif -081 -\end{alltt} -\end{small} - -The shifting is performed in--place which means the first step (line 24) is to copy the input to the -destination. We avoid calling mp\_copy() by making sure the mp\_ints are different. The destination then -has to be grown (line 31) to accomodate the result. - -If the shift count $b$ is larger than $lg(\beta)$ then a call to mp\_lshd() is used to handle all of the multiples -of $lg(\beta)$. Leaving only a remaining shift of $lg(\beta) - 1$ or fewer bits left. Inside the actual shift -loop (lines 45 to 76) we make use of pre--computed values $shift$ and $mask$. These are used to -extract the carry bit(s) to pass into the next iteration of the loop. The $r$ and $rr$ variables form a -chain between consecutive iterations to propagate the carry. - -\subsection{Division by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow \lfloor a / 2^b \rfloor, d \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}1.2 $d \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.3 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow a$ \\ -3. $d \leftarrow a \mbox{ (mod }2^b\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -4. If $b \ge lg(\beta)$ then do \\ -\hspace{3mm}4.1 $c \leftarrow \lfloor c/\beta^{\lfloor b/lg(\beta) \rfloor} \rfloor$ (\textit{mp\_rshd}). \\ -5. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $k \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^k$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $c.used - 1$ to $0$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n >> k) + (r << (lg(\beta) - k))$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -7. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2d} -\end{figure} - -\textbf{Algorithm mp\_div\_2d.} -This algorithm will divide an input $a$ by $2^b$ and produce the quotient and remainder. The algorithm is designed much like algorithm -mp\_mul\_2d by first using whole digit shifts then single precision shifts. This algorithm will also produce the remainder of the division -by using algorithm mp\_mod\_2d. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div\_2d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift right by a certain bit count (store quotient in c, optional remaind - er in d) */ -018 int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) -019 \{ -020 mp_digit D, r, rr; -021 int x, res; -022 mp_int t; -023 -024 -025 /* if the shift count is <= 0 then we do no work */ -026 if (b <= 0) \{ -027 res = mp_copy (a, c); -028 if (d != NULL) \{ -029 mp_zero (d); -030 \} -031 return res; -032 \} -033 -034 if ((res = mp_init (&t)) != MP_OKAY) \{ -035 return res; -036 \} -037 -038 /* get the remainder */ -039 if (d != NULL) \{ -040 if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) \{ -041 mp_clear (&t); -042 return res; -043 \} -044 \} -045 -046 /* copy */ -047 if ((res = mp_copy (a, c)) != MP_OKAY) \{ -048 mp_clear (&t); -049 return res; -050 \} -051 -052 /* shift by as many digits in the bit count */ -053 if (b >= (int)DIGIT_BIT) \{ -054 mp_rshd (c, b / DIGIT_BIT); -055 \} -056 -057 /* shift any bit count < DIGIT_BIT */ -058 D = (mp_digit) (b % DIGIT_BIT); -059 if (D != 0) \{ -060 mp_digit *tmpc, mask, shift; -061 -062 /* mask */ -063 mask = (((mp_digit)1) << D) - 1; -064 -065 /* shift for lsb */ -066 shift = DIGIT_BIT - D; -067 -068 /* alias */ -069 tmpc = c->dp + (c->used - 1); -070 -071 /* carry */ -072 r = 0; -073 for (x = c->used - 1; x >= 0; x--) \{ -074 /* get the lower bits of this word in a temp */ -075 rr = *tmpc & mask; -076 -077 /* shift the current word and mix in the carry bits from the previous - word */ -078 *tmpc = (*tmpc >> D) | (r << shift); -079 --tmpc; -080 -081 /* set the carry to the carry bits of the current word found above */ -082 r = rr; -083 \} -084 \} -085 mp_clamp (c); -086 if (d != NULL) \{ -087 mp_exch (&t, d); -088 \} -089 mp_clear (&t); -090 return MP_OKAY; -091 \} -092 #endif -093 -\end{alltt} -\end{small} - -The implementation of algorithm mp\_div\_2d is slightly different than the algorithm specifies. The remainder $d$ may be optionally -ignored by passing \textbf{NULL} as the pointer to the mp\_int variable. The temporary mp\_int variable $t$ is used to hold the -result of the remainder operation until the end. This allows $d$ and $a$ to represent the same mp\_int without modifying $a$ before -the quotient is obtained. - -The remainder of the source code is essentially the same as the source code for mp\_mul\_2d. The only significant difference is -the direction of the shifts. - -\subsection{Remainder of Division by Power of Two} - -The last algorithm in the series of polynomial basis power of two algorithms is calculating the remainder of division by $2^b$. This -algorithm benefits from the fact that in twos complement arithmetic $a \mbox{ (mod }2^b\mbox{)}$ is the same as $a$ AND $2^b - 1$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mod\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b > a.used \cdot lg(\beta)$ then do \\ -\hspace{3mm}2.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}2.2 Return the result of step 2.1. \\ -3. $c \leftarrow a$ \\ -4. If step 3 failed return(\textit{MP\_MEM}). \\ -5. for $n$ from $\lceil b / lg(\beta) \rceil$ to $c.used$ do \\ -\hspace{3mm}5.1 $c_n \leftarrow 0$ \\ -6. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -7. $c_{\lfloor b / lg(\beta) \rfloor} \leftarrow c_{\lfloor b / lg(\beta) \rfloor} \mbox{ (mod }2^{k}\mbox{)}$. \\ -8. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mod\_2d} -\end{figure} - -\textbf{Algorithm mp\_mod\_2d.} -This algorithm will quickly calculate the value of $a \mbox{ (mod }2^b\mbox{)}$. First if $b$ is less than or equal to zero the -result is set to zero. If $b$ is greater than the number of bits in $a$ then it simply copies $a$ to $c$ and returns. Otherwise, $a$ -is copied to $b$, leading digits are removed and the remaining leading digit is trimed to the exact bit count. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mod\_2d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* calc a value mod 2**b */ -018 int -019 mp_mod_2d (mp_int * a, int b, mp_int * c) -020 \{ -021 int x, res; -022 -023 /* if b is <= 0 then zero the int */ -024 if (b <= 0) \{ -025 mp_zero (c); -026 return MP_OKAY; -027 \} -028 -029 /* if the modulus is larger than the value than return */ -030 if (b >= (int) (a->used * DIGIT_BIT)) \{ -031 res = mp_copy (a, c); -032 return res; -033 \} -034 -035 /* copy */ -036 if ((res = mp_copy (a, c)) != MP_OKAY) \{ -037 return res; -038 \} -039 -040 /* zero digits above the last digit of the modulus */ -041 for (x = (b / DIGIT_BIT) + (((b % DIGIT_BIT) == 0) ? 0 : 1); x < c->used; - x++) \{ -042 c->dp[x] = 0; -043 \} -044 /* clear the digit that is not completely outside/inside the modulus */ -045 c->dp[b / DIGIT_BIT] &= -046 (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digi - t) 1)); -047 mp_clamp (c); -048 return MP_OKAY; -049 \} -050 #endif -051 -\end{alltt} -\end{small} - -We first avoid cases of $b \le 0$ by simply mp\_zero()'ing the destination in such cases. Next if $2^b$ is larger -than the input we just mp\_copy() the input and return right away. After this point we know we must actually -perform some work to produce the remainder. - -Recalling that reducing modulo $2^k$ and a binary ``and'' with $2^k - 1$ are numerically equivalent we can quickly reduce -the number. First we zero any digits above the last digit in $2^b$ (line 41). Next we reduce the -leading digit of both (line 45) and then mp\_clamp(). - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an algorithm that performs $a \cdot 2^b$ for generic values of $b$ \\ - & in $O(n)$ time. \\ - &\\ -$\left [ 3 \right ] $ & Devise an efficient algorithm to multiply by small low hamming \\ - & weight values such as $3$, $5$ and $9$. Extend it to handle all values \\ - & upto $64$ with a hamming weight less than three. \\ - &\\ -$\left [ 2 \right ] $ & Modify the preceding algorithm to handle values of the form \\ - & $2^k - 1$ as well. \\ - &\\ -$\left [ 3 \right ] $ & Using only algorithms mp\_mul\_2, mp\_div\_2 and mp\_add create an \\ - & algorithm to multiply two integers in roughly $O(2n^2)$ time for \\ - & any $n$-bit input. Note that the time of addition is ignored in the \\ - & calculation. \\ - & \\ -$\left [ 5 \right ] $ & Improve the previous algorithm to have a working time of at most \\ - & $O \left (2^{(k-1)}n + \left ({2n^2 \over k} \right ) \right )$ for an appropriate choice of $k$. Again ignore \\ - & the cost of addition. \\ - & \\ -$\left [ 2 \right ] $ & Devise a chart to find optimal values of $k$ for the previous problem \\ - & for $n = 64 \ldots 1024$ in steps of $64$. \\ - & \\ -$\left [ 2 \right ] $ & Using only algorithms mp\_abs and mp\_sub devise another method for \\ - & calculating the result of a signed comparison. \\ - & -\end{tabular} - -\chapter{Multiplication and Squaring} -\section{The Multipliers} -For most number theoretic problems including certain public key cryptographic algorithms, the ``multipliers'' form the most important subset of -algorithms of any multiple precision integer package. The set of multiplier algorithms include integer multiplication, squaring and modular reduction -where in each of the algorithms single precision multiplication is the dominant operation performed. This chapter will discuss integer multiplication -and squaring, leaving modular reductions for the subsequent chapter. - -The importance of the multiplier algorithms is for the most part driven by the fact that certain popular public key algorithms are based on modular -exponentiation, that is computing $d \equiv a^b \mbox{ (mod }c\mbox{)}$ for some arbitrary choice of $a$, $b$, $c$ and $d$. During a modular -exponentiation the majority\footnote{Roughly speaking a modular exponentiation will spend about 40\% of the time performing modular reductions, -35\% of the time performing squaring and 25\% of the time performing multiplications.} of the processor time is spent performing single precision -multiplications. - -For centuries general purpose multiplication has required a lengthly $O(n^2)$ process, whereby each digit of one multiplicand has to be multiplied -against every digit of the other multiplicand. Traditional long-hand multiplication is based on this process; while the techniques can differ the -overall algorithm used is essentially the same. Only ``recently'' have faster algorithms been studied. First Karatsuba multiplication was discovered in -1962. This algorithm can multiply two numbers with considerably fewer single precision multiplications when compared to the long-hand approach. -This technique led to the discovery of polynomial basis algorithms (\textit{good reference?}) and subquently Fourier Transform based solutions. - -\section{Multiplication} -\subsection{The Baseline Multiplication} -\label{sec:basemult} -\index{baseline multiplication} -Computing the product of two integers in software can be achieved using a trivial adaptation of the standard $O(n^2)$ long-hand multiplication -algorithm that school children are taught. The algorithm is considered an $O(n^2)$ algorithm since for two $n$-digit inputs $n^2$ single precision -multiplications are required. More specifically for a $m$ and $n$ digit input $m \cdot n$ single precision multiplications are required. To -simplify most discussions, it will be assumed that the inputs have comparable number of digits. - -The ``baseline multiplication'' algorithm is designed to act as the ``catch-all'' algorithm, only to be used when the faster algorithms cannot be -used. This algorithm does not use any particularly interesting optimizations and should ideally be avoided if possible. One important -facet of this algorithm, is that it has been modified to only produce a certain amount of output digits as resolution. The importance of this -modification will become evident during the discussion of Barrett modular reduction. Recall that for a $n$ and $m$ digit input the product -will be at most $n + m$ digits. Therefore, this algorithm can be reduced to a full multiplier by having it produce $n + m$ digits of the product. - -Recall from sub-section 4.2.2 the definition of $\gamma$ as the number of bits in the type \textbf{mp\_digit}. We shall now extend the variable set to -include $\alpha$ which shall represent the number of bits in the type \textbf{mp\_word}. This implies that $2^{\alpha} > 2 \cdot \beta^2$. The -constant $\delta = 2^{\alpha - 2lg(\beta)}$ will represent the maximal weight of any column in a product (\textit{see sub-section 5.2.2 for more information}). - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -1. If min$(a.used, b.used) < \delta$ then do \\ -\hspace{3mm}1.1 Calculate $c = \vert a \vert \cdot \vert b \vert$ by the Comba method (\textit{see algorithm~\ref{fig:COMBAMULT}}). \\ -\hspace{3mm}1.2 Return the result of step 1.1 \\ -\\ -Allocate and initialize a temporary mp\_int. \\ -2. Init $t$ to be of size $digs$ \\ -3. If step 2 failed return(\textit{MP\_MEM}). \\ -4. $t.used \leftarrow digs$ \\ -\\ -Compute the product. \\ -5. for $ix$ from $0$ to $a.used - 1$ do \\ -\hspace{3mm}5.1 $u \leftarrow 0$ \\ -\hspace{3mm}5.2 $pb \leftarrow \mbox{min}(b.used, digs - ix)$ \\ -\hspace{3mm}5.3 If $pb < 1$ then goto step 6. \\ -\hspace{3mm}5.4 for $iy$ from $0$ to $pb - 1$ do \\ -\hspace{6mm}5.4.1 $\hat r \leftarrow t_{iy + ix} + a_{ix} \cdot b_{iy} + u$ \\ -\hspace{6mm}5.4.2 $t_{iy + ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.5 if $ix + pb < digs$ then do \\ -\hspace{6mm}5.5.1 $t_{ix + pb} \leftarrow u$ \\ -6. Clamp excess digits of $t$. \\ -7. Swap $c$ with $t$ \\ -8. Clear $t$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_mul\_digs} -\end{figure} - -\textbf{Algorithm s\_mp\_mul\_digs.} -This algorithm computes the unsigned product of two inputs $a$ and $b$, limited to an output precision of $digs$ digits. While it may seem -a bit awkward to modify the function from its simple $O(n^2)$ description, the usefulness of partial multipliers will arise in a subsequent -algorithm. The algorithm is loosely based on algorithm 14.12 from \cite[pp. 595]{HAC} and is similar to Algorithm M of Knuth \cite[pp. 268]{TAOCPV2}. -Algorithm s\_mp\_mul\_digs differs from these cited references since it can produce a variable output precision regardless of the precision of the -inputs. - -The first thing this algorithm checks for is whether a Comba multiplier can be used instead. If the minimum digit count of either -input is less than $\delta$, then the Comba method may be used instead. After the Comba method is ruled out, the baseline algorithm begins. A -temporary mp\_int variable $t$ is used to hold the intermediate result of the product. This allows the algorithm to be used to -compute products when either $a = c$ or $b = c$ without overwriting the inputs. - -All of step 5 is the infamous $O(n^2)$ multiplication loop slightly modified to only produce upto $digs$ digits of output. The $pb$ variable -is given the count of digits to read from $b$ inside the nested loop. If $pb \le 1$ then no more output digits can be produced and the algorithm -will exit the loop. The best way to think of the loops are as a series of $pb \times 1$ multiplications. That is, in each pass of the -innermost loop $a_{ix}$ is multiplied against $b$ and the result is added (\textit{with an appropriate shift}) to $t$. - -For example, consider multiplying $576$ by $241$. That is equivalent to computing $10^0(1)(576) + 10^1(4)(576) + 10^2(2)(576)$ which is best -visualized in the following table. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|l|} -\hline && & 5 & 7 & 6 & \\ -\hline $\times$&& & 2 & 4 & 1 & \\ -\hline &&&&&&\\ - && & 5 & 7 & 6 & $10^0(1)(576)$ \\ - &2 & 3 & 6 & 1 & 6 & $10^1(4)(576) + 10^0(1)(576)$ \\ - 1 & 3 & 8 & 8 & 1 & 6 & $10^2(2)(576) + 10^1(4)(576) + 10^0(1)(576)$ \\ -\hline -\end{tabular} -\end{center} -\caption{Long-Hand Multiplication Diagram} -\end{figure} - -Each row of the product is added to the result after being shifted to the left (\textit{multiplied by a power of the radix}) by the appropriate -count. That is in pass $ix$ of the inner loop the product is added starting at the $ix$'th digit of the reult. - -Step 5.4.1 introduces the hat symbol (\textit{e.g. $\hat r$}) which represents a double precision variable. The multiplication on that step -is assumed to be a double wide output single precision multiplication. That is, two single precision variables are multiplied to produce a -double precision result. The step is somewhat optimized from a long-hand multiplication algorithm because the carry from the addition in step -5.4.1 is propagated through the nested loop. If the carry was not propagated immediately it would overflow the single precision digit -$t_{ix+iy}$ and the result would be lost. - -At step 5.5 the nested loop is finished and any carry that was left over should be forwarded. The carry does not have to be added to the $ix+pb$'th -digit since that digit is assumed to be zero at this point. However, if $ix + pb \ge digs$ the carry is not set as it would make the result -exceed the precision requested. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_mul\_digs.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* multiplies |a| * |b| and only computes upto digs digits of result -018 * HAC pp. 595, Algorithm 14.12 Modified so you can control how -019 * many digits of output are created. -020 */ -021 int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -022 \{ -023 mp_int t; -024 int res, pa, pb, ix, iy; -025 mp_digit u; -026 mp_word r; -027 mp_digit tmpx, *tmpt, *tmpy; -028 -029 /* can we use the fast multiplier? */ -030 if (((digs) < MP_WARRAY) && -031 (MIN (a->used, b->used) < -032 (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) \{ -033 return fast_s_mp_mul_digs (a, b, c, digs); -034 \} -035 -036 if ((res = mp_init_size (&t, digs)) != MP_OKAY) \{ -037 return res; -038 \} -039 t.used = digs; -040 -041 /* compute the digits of the product directly */ -042 pa = a->used; -043 for (ix = 0; ix < pa; ix++) \{ -044 /* set the carry to zero */ -045 u = 0; -046 -047 /* limit ourselves to making digs digits of output */ -048 pb = MIN (b->used, digs - ix); -049 -050 /* setup some aliases */ -051 /* copy of the digit from a used within the nested loop */ -052 tmpx = a->dp[ix]; -053 -054 /* an alias for the destination shifted ix places */ -055 tmpt = t.dp + ix; -056 -057 /* an alias for the digits of b */ -058 tmpy = b->dp; -059 -060 /* compute the columns of the output and propagate the carry */ -061 for (iy = 0; iy < pb; iy++) \{ -062 /* compute the column as a mp_word */ -063 r = (mp_word)*tmpt + -064 ((mp_word)tmpx * (mp_word)*tmpy++) + -065 (mp_word)u; -066 -067 /* the new column is the lower part of the result */ -068 *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); -069 -070 /* get the carry word from the result */ -071 u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); -072 \} -073 /* set carry if it is placed below digs */ -074 if ((ix + iy) < digs) \{ -075 *tmpt = u; -076 \} -077 \} -078 -079 mp_clamp (&t); -080 mp_exch (&t, c); -081 -082 mp_clear (&t); -083 return MP_OKAY; -084 \} -085 #endif -086 -\end{alltt} -\end{small} - -First we determine (line 30) if the Comba method can be used first since it's faster. The conditions for -sing the Comba routine are that min$(a.used, b.used) < \delta$ and the number of digits of output is less than -\textbf{MP\_WARRAY}. This new constant is used to control the stack usage in the Comba routines. By default it is -set to $\delta$ but can be reduced when memory is at a premium. - -If we cannot use the Comba method we proceed to setup the baseline routine. We allocate the the destination mp\_int -$t$ (line 36) to the exact size of the output to avoid further re--allocations. At this point we now -begin the $O(n^2)$ loop. - -This implementation of multiplication has the caveat that it can be trimmed to only produce a variable number of -digits as output. In each iteration of the outer loop the $pb$ variable is set (line 48) to the maximum -number of inner loop iterations. - -Inside the inner loop we calculate $\hat r$ as the mp\_word product of the two mp\_digits and the addition of the -carry from the previous iteration. A particularly important observation is that most modern optimizing -C compilers (GCC for instance) can recognize that a $N \times N \rightarrow 2N$ multiplication is all that -is required for the product. In x86 terms for example, this means using the MUL instruction. - -Each digit of the product is stored in turn (line 68) and the carry propagated (line 71) to the -next iteration. - -\subsection{Faster Multiplication by the ``Comba'' Method} - -One of the huge drawbacks of the ``baseline'' algorithms is that at the $O(n^2)$ level the carry must be -computed and propagated upwards. This makes the nested loop very sequential and hard to unroll and implement -in parallel. The ``Comba'' \cite{COMBA} method is named after little known (\textit{in cryptographic venues}) Paul G. -Comba who described a method of implementing fast multipliers that do not require nested carry fixup operations. As an -interesting aside it seems that Paul Barrett describes a similar technique in his 1986 paper \cite{BARRETT} written -five years before. - -At the heart of the Comba technique is once again the long-hand algorithm. Except in this case a slight -twist is placed on how the columns of the result are produced. In the standard long-hand algorithm rows of products -are produced then added together to form the final result. In the baseline algorithm the columns are added together -after each iteration to get the result instantaneously. - -In the Comba algorithm the columns of the result are produced entirely independently of each other. That is at -the $O(n^2)$ level a simple multiplication and addition step is performed. The carries of the columns are propagated -after the nested loop to reduce the amount of work requiored. Succintly the first step of the algorithm is to compute -the product vector $\vec x$ as follows. - -\begin{equation} -\vec x_n = \sum_{i+j = n} a_ib_j, \forall n \in \lbrace 0, 1, 2, \ldots, i + j \rbrace -\end{equation} - -Where $\vec x_n$ is the $n'th$ column of the output vector. Consider the following example which computes the vector $\vec x$ for the multiplication -of $576$ and $241$. - -\newpage\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|} - \hline & & 5 & 7 & 6 & First Input\\ - \hline $\times$ & & 2 & 4 & 1 & Second Input\\ -\hline & & $1 \cdot 5 = 5$ & $1 \cdot 7 = 7$ & $1 \cdot 6 = 6$ & First pass \\ - & $4 \cdot 5 = 20$ & $4 \cdot 7+5=33$ & $4 \cdot 6+7=31$ & 6 & Second pass \\ - $2 \cdot 5 = 10$ & $2 \cdot 7 + 20 = 34$ & $2 \cdot 6+33=45$ & 31 & 6 & Third pass \\ -\hline 10 & 34 & 45 & 31 & 6 & Final Result \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Comba Multiplication Diagram} -\end{figure} - -At this point the vector $x = \left < 10, 34, 45, 31, 6 \right >$ is the result of the first step of the Comba multipler. -Now the columns must be fixed by propagating the carry upwards. The resultant vector will have one extra dimension over the input vector which is -congruent to adding a leading zero digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Comba Fixup}. \\ -\textbf{Input}. Vector $\vec x$ of dimension $k$ \\ -\textbf{Output}. Vector $\vec x$ such that the carries have been propagated. \\ -\hline \\ -1. for $n$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $\vec x_{n+1} \leftarrow \vec x_{n+1} + \lfloor \vec x_{n}/\beta \rfloor$ \\ -\hspace{3mm}1.2 $\vec x_{n} \leftarrow \vec x_{n} \mbox{ (mod }\beta\mbox{)}$ \\ -2. Return($\vec x$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Comba Fixup} -\end{figure} - -With that algorithm and $k = 5$ and $\beta = 10$ the following vector is produced $\vec x= \left < 1, 3, 8, 8, 1, 6 \right >$. In this case -$241 \cdot 576$ is in fact $138816$ and the procedure succeeded. If the algorithm is correct and as will be demonstrated shortly more -efficient than the baseline algorithm why not simply always use this algorithm? - -\subsubsection{Column Weight.} -At the nested $O(n^2)$ level the Comba method adds the product of two single precision variables to each column of the output -independently. A serious obstacle is if the carry is lost, due to lack of precision before the algorithm has a chance to fix -the carries. For example, in the multiplication of two three-digit numbers the third column of output will be the sum of -three single precision multiplications. If the precision of the accumulator for the output digits is less then $3 \cdot (\beta - 1)^2$ then -an overflow can occur and the carry information will be lost. For any $m$ and $n$ digit inputs the maximum weight of any column is -min$(m, n)$ which is fairly obvious. - -The maximum number of terms in any column of a product is known as the ``column weight'' and strictly governs when the algorithm can be used. Recall -from earlier that a double precision type has $\alpha$ bits of resolution and a single precision digit has $lg(\beta)$ bits of precision. Given these -two quantities we must not violate the following - -\begin{equation} -k \cdot \left (\beta - 1 \right )^2 < 2^{\alpha} -\end{equation} - -Which reduces to - -\begin{equation} -k \cdot \left ( \beta^2 - 2\beta + 1 \right ) < 2^{\alpha} -\end{equation} - -Let $\rho = lg(\beta)$ represent the number of bits in a single precision digit. By further re-arrangement of the equation the final solution is -found. - -\begin{equation} -k < {{2^{\alpha}} \over {\left (2^{2\rho} - 2^{\rho + 1} + 1 \right )}} -\end{equation} - -The defaults for LibTomMath are $\beta = 2^{28}$ and $\alpha = 2^{64}$ which means that $k$ is bounded by $k < 257$. In this configuration -the smaller input may not have more than $256$ digits if the Comba method is to be used. This is quite satisfactory for most applications since -$256$ digits would allow for numbers in the range of $0 \le x < 2^{7168}$ which, is much larger than most public key cryptographic algorithms require. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} single precision digits named $W$ on the stack. \\ -1. If $c.alloc < digs$ then grow $c$ to $digs$ digits. (\textit{mp\_grow}) \\ -2. If step 1 failed return(\textit{MP\_MEM}).\\ -\\ -3. $pa \leftarrow \mbox{MIN}(digs, a.used + b.used)$ \\ -\\ -4. $\_ \hat W \leftarrow 0$ \\ -5. for $ix$ from 0 to $pa - 1$ do \\ -\hspace{3mm}5.1 $ty \leftarrow \mbox{MIN}(b.used - 1, ix)$ \\ -\hspace{3mm}5.2 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.3 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.4 for $iz$ from 0 to $iy - 1$ do \\ -\hspace{6mm}5.4.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx+iy}b_{ty-iy}$ \\ -\hspace{3mm}5.5 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$\\ -\hspace{3mm}5.6 $\_ \hat W \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow c.used$ \\ -7. $c.used \leftarrow digs$ \\ -8. for $ix$ from $0$ to $pa$ do \\ -\hspace{3mm}8.1 $c_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa + 1$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -\\ -10. Clamp $c$. \\ -11. Return MP\_OKAY. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_mul\_digs} -\label{fig:COMBAMULT} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_mul\_digs.} -This algorithm performs the unsigned multiplication of $a$ and $b$ using the Comba method limited to $digs$ digits of precision. - -The outer loop of this algorithm is more complicated than that of the baseline multiplier. This is because on the inside of the -loop we want to produce one column per pass. This allows the accumulator $\_ \hat W$ to be placed in CPU registers and -reduce the memory bandwidth to two \textbf{mp\_digit} reads per iteration. - -The $ty$ variable is set to the minimum count of $ix$ or the number of digits in $b$. That way if $a$ has more digits than -$b$ this will be limited to $b.used - 1$. The $tx$ variable is set to the to the distance past $b.used$ the variable -$ix$ is. This is used for the immediately subsequent statement where we find $iy$. - -The variable $iy$ is the minimum digits we can read from either $a$ or $b$ before running out. Computing one column at a time -means we have to scan one integer upwards and the other downwards. $a$ starts at $tx$ and $b$ starts at $ty$. In each -pass we are producing the $ix$'th output column and we note that $tx + ty = ix$. As we move $tx$ upwards we have to -move $ty$ downards so the equality remains valid. The $iy$ variable is the number of iterations until -$tx \ge a.used$ or $ty < 0$ occurs. - -After every inner pass we store the lower half of the accumulator into $W_{ix}$ and then propagate the carry of the accumulator -into the next round by dividing $\_ \hat W$ by $\beta$. - -To measure the benefits of the Comba method over the baseline method consider the number of operations that are required. If the -cost in terms of time of a multiply and addition is $p$ and the cost of a carry propagation is $q$ then a baseline multiplication would require -$O \left ((p + q)n^2 \right )$ time to multiply two $n$-digit numbers. The Comba method requires only $O(pn^2 + qn)$ time, however in practice, -the speed increase is actually much more. With $O(n)$ space the algorithm can be reduced to $O(pn + qn)$ time by implementing the $n$ multiply -and addition operations in the nested loop in parallel. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_fast\_s\_mp\_mul\_digs.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Fast (comba) multiplier -018 * -019 * This is the fast column-array [comba] multiplier. It is -020 * designed to compute the columns of the product first -021 * then handle the carries afterwards. This has the effect -022 * of making the nested loops that compute the columns very -023 * simple and schedulable on super-scalar processors. -024 * -025 * This has been modified to produce a variable number of -026 * digits of output so if say only a half-product is required -027 * you don't have to compute the upper half (a feature -028 * required for fast Barrett reduction). -029 * -030 * Based on Algorithm 14.12 on pp.595 of HAC. -031 * -032 */ -033 int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -034 \{ -035 int olduse, res, pa, ix, iz; -036 mp_digit W[MP_WARRAY]; -037 mp_word _W; -038 -039 /* grow the destination as required */ -040 if (c->alloc < digs) \{ -041 if ((res = mp_grow (c, digs)) != MP_OKAY) \{ -042 return res; -043 \} -044 \} -045 -046 /* number of output digits to produce */ -047 pa = MIN(digs, a->used + b->used); -048 -049 /* clear the carry */ -050 _W = 0; -051 for (ix = 0; ix < pa; ix++) \{ -052 int tx, ty; -053 int iy; -054 mp_digit *tmpx, *tmpy; -055 -056 /* get offsets into the two bignums */ -057 ty = MIN(b->used-1, ix); -058 tx = ix - ty; -059 -060 /* setup temp aliases */ -061 tmpx = a->dp + tx; -062 tmpy = b->dp + ty; -063 -064 /* this is the number of times the loop will iterrate, essentially -065 while (tx++ < a->used && ty-- >= 0) \{ ... \} -066 */ -067 iy = MIN(a->used-tx, ty+1); -068 -069 /* execute loop */ -070 for (iz = 0; iz < iy; ++iz) \{ -071 _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); -072 -073 \} -074 -075 /* store term */ -076 W[ix] = ((mp_digit)_W) & MP_MASK; -077 -078 /* make next carry */ -079 _W = _W >> ((mp_word)DIGIT_BIT); -080 \} -081 -082 /* setup dest */ -083 olduse = c->used; -084 c->used = pa; -085 -086 \{ -087 mp_digit *tmpc; -088 tmpc = c->dp; -089 for (ix = 0; ix < (pa + 1); ix++) \{ -090 /* now extract the previous digit [below the carry] */ -091 *tmpc++ = W[ix]; -092 \} -093 -094 /* clear unused digits [that existed in the old copy of c] */ -095 for (; ix < olduse; ix++) \{ -096 *tmpc++ = 0; -097 \} -098 \} -099 mp_clamp (c); -100 return MP_OKAY; -101 \} -102 #endif -103 -\end{alltt} -\end{small} - -As per the pseudo--code we first calculate $pa$ (line 47) as the number of digits to output. Next we begin the outer loop -to produce the individual columns of the product. We use the two aliases $tmpx$ and $tmpy$ (lines 61, 62) to point -inside the two multiplicands quickly. - -The inner loop (lines 70 to 73) of this implementation is where the tradeoff come into play. Originally this comba -implementation was ``row--major'' which means it adds to each of the columns in each pass. After the outer loop it would then fix -the carries. This was very fast except it had an annoying drawback. You had to read a mp\_word and two mp\_digits and write -one mp\_word per iteration. On processors such as the Athlon XP and P4 this did not matter much since the cache bandwidth -is very high and it can keep the ALU fed with data. It did, however, matter on older and embedded cpus where cache is often -slower and also often doesn't exist. This new algorithm only performs two reads per iteration under the assumption that the -compiler has aliased $\_ \hat W$ to a CPU register. - -After the inner loop we store the current accumulator in $W$ and shift $\_ \hat W$ (lines 76, 79) to forward it as -a carry for the next pass. After the outer loop we use the final carry (line 76) as the last digit of the product. - -\subsection{Polynomial Basis Multiplication} -To break the $O(n^2)$ barrier in multiplication requires a completely different look at integer multiplication. In the following algorithms -the use of polynomial basis representation for two integers $a$ and $b$ as $f(x) = \sum_{i=0}^{n} a_i x^i$ and -$g(x) = \sum_{i=0}^{n} b_i x^i$ respectively, is required. In this system both $f(x)$ and $g(x)$ have $n + 1$ terms and are of the $n$'th degree. - -The product $a \cdot b \equiv f(x)g(x)$ is the polynomial $W(x) = \sum_{i=0}^{2n} w_i x^i$. The coefficients $w_i$ will -directly yield the desired product when $\beta$ is substituted for $x$. The direct solution to solve for the $2n + 1$ coefficients -requires $O(n^2)$ time and would in practice be slower than the Comba technique. - -However, numerical analysis theory indicates that only $2n + 1$ distinct points in $W(x)$ are required to determine the values of the $2n + 1$ unknown -coefficients. This means by finding $\zeta_y = W(y)$ for $2n + 1$ small values of $y$ the coefficients of $W(x)$ can be found with -Gaussian elimination. This technique is also occasionally refered to as the \textit{interpolation technique} (\textit{references please...}) since in -effect an interpolation based on $2n + 1$ points will yield a polynomial equivalent to $W(x)$. - -The coefficients of the polynomial $W(x)$ are unknown which makes finding $W(y)$ for any value of $y$ impossible. However, since -$W(x) = f(x)g(x)$ the equivalent $\zeta_y = f(y) g(y)$ can be used in its place. The benefit of this technique stems from the -fact that $f(y)$ and $g(y)$ are much smaller than either $a$ or $b$ respectively. As a result finding the $2n + 1$ relations required -by multiplying $f(y)g(y)$ involves multiplying integers that are much smaller than either of the inputs. - -When picking points to gather relations there are always three obvious points to choose, $y = 0, 1$ and $ \infty$. The $\zeta_0$ term -is simply the product $W(0) = w_0 = a_0 \cdot b_0$. The $\zeta_1$ term is the product -$W(1) = \left (\sum_{i = 0}^{n} a_i \right ) \left (\sum_{i = 0}^{n} b_i \right )$. The third point $\zeta_{\infty}$ is less obvious but rather -simple to explain. The $2n + 1$'th coefficient of $W(x)$ is numerically equivalent to the most significant column in an integer multiplication. -The point at $\infty$ is used symbolically to represent the most significant column, that is $W(\infty) = w_{2n} = a_nb_n$. Note that the -points at $y = 0$ and $\infty$ yield the coefficients $w_0$ and $w_{2n}$ directly. - -If more points are required they should be of small values and powers of two such as $2^q$ and the related \textit{mirror points} -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ for small values of $q$. The term ``mirror point'' stems from the fact that -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ can be calculated in the exact opposite fashion as $\zeta_{2^q}$. For -example, when $n = 2$ and $q = 1$ then following two equations are equivalent to the point $\zeta_{2}$ and its mirror. - -\begin{eqnarray} -\zeta_{2} = f(2)g(2) = (4a_2 + 2a_1 + a_0)(4b_2 + 2b_1 + b_0) \nonumber \\ -16 \cdot \zeta_{1 \over 2} = 4f({1\over 2}) \cdot 4g({1 \over 2}) = (a_2 + 2a_1 + 4a_0)(b_2 + 2b_1 + 4b_0) -\end{eqnarray} - -Using such points will allow the values of $f(y)$ and $g(y)$ to be independently calculated using only left shifts. For example, when $n = 2$ the -polynomial $f(2^q)$ is equal to $2^q((2^qa_2) + a_1) + a_0$. This technique of polynomial representation is known as Horner's method. - -As a general rule of the algorithm when the inputs are split into $n$ parts each there are $2n - 1$ multiplications. Each multiplication is of -multiplicands that have $n$ times fewer digits than the inputs. The asymptotic running time of this algorithm is -$O \left ( k^{lg_n(2n - 1)} \right )$ for $k$ digit inputs (\textit{assuming they have the same number of digits}). Figure~\ref{fig:exponent} -summarizes the exponents for various values of $n$. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Split into $n$ Parts} & \textbf{Exponent} & \textbf{Notes}\\ -\hline $2$ & $1.584962501$ & This is Karatsuba Multiplication. \\ -\hline $3$ & $1.464973520$ & This is Toom-Cook Multiplication. \\ -\hline $4$ & $1.403677461$ &\\ -\hline $5$ & $1.365212389$ &\\ -\hline $10$ & $1.278753601$ &\\ -\hline $100$ & $1.149426538$ &\\ -\hline $1000$ & $1.100270931$ &\\ -\hline $10000$ & $1.075252070$ &\\ -\hline -\end{tabular} -\end{center} -\caption{Asymptotic Running Time of Polynomial Basis Multiplication} -\label{fig:exponent} -\end{figure} - -At first it may seem like a good idea to choose $n = 1000$ since the exponent is approximately $1.1$. However, the overhead -of solving for the 2001 terms of $W(x)$ will certainly consume any savings the algorithm could offer for all but exceedingly large -numbers. - -\subsubsection{Cutoff Point} -The polynomial basis multiplication algorithms all require fewer single precision multiplications than a straight Comba approach. However, -the algorithms incur an overhead (\textit{at the $O(n)$ work level}) since they require a system of equations to be solved. This makes the -polynomial basis approach more costly to use with small inputs. - -Let $m$ represent the number of digits in the multiplicands (\textit{assume both multiplicands have the same number of digits}). There exists a -point $y$ such that when $m < y$ the polynomial basis algorithms are more costly than Comba, when $m = y$ they are roughly the same cost and -when $m > y$ the Comba methods are slower than the polynomial basis algorithms. - -The exact location of $y$ depends on several key architectural elements of the computer platform in question. - -\begin{enumerate} -\item The ratio of clock cycles for single precision multiplication versus other simpler operations such as addition, shifting, etc. For example -on the AMD Athlon the ratio is roughly $17 : 1$ while on the Intel P4 it is $29 : 1$. The higher the ratio in favour of multiplication the lower -the cutoff point $y$ will be. - -\item The complexity of the linear system of equations (\textit{for the coefficients of $W(x)$}) is. Generally speaking as the number of splits -grows the complexity grows substantially. Ideally solving the system will only involve addition, subtraction and shifting of integers. This -directly reflects on the ratio previous mentioned. - -\item To a lesser extent memory bandwidth and function call overheads. Provided the values are in the processor cache this is less of an -influence over the cutoff point. - -\end{enumerate} - -A clean cutoff point separation occurs when a point $y$ is found such that all of the cutoff point conditions are met. For example, if the point -is too low then there will be values of $m$ such that $m > y$ and the Comba method is still faster. Finding the cutoff points is fairly simple when -a high resolution timer is available. - -\subsection{Karatsuba Multiplication} -Karatsuba \cite{KARA} multiplication when originally proposed in 1962 was among the first set of algorithms to break the $O(n^2)$ barrier for -general purpose multiplication. Given two polynomial basis representations $f(x) = ax + b$ and $g(x) = cx + d$, Karatsuba proved with -light algebra \cite{KARAP} that the following polynomial is equivalent to multiplication of the two integers the polynomials represent. - -\begin{equation} -f(x) \cdot g(x) = acx^2 + ((a + b)(c + d) - (ac + bd))x + bd -\end{equation} - -Using the observation that $ac$ and $bd$ could be re-used only three half sized multiplications would be required to produce the product. Applying -this algorithm recursively, the work factor becomes $O(n^{lg(3)})$ which is substantially better than the work factor $O(n^2)$ of the Comba technique. It turns -out what Karatsuba did not know or at least did not publish was that this is simply polynomial basis multiplication with the points -$\zeta_0$, $\zeta_{\infty}$ and $\zeta_{1}$. Consider the resultant system of equations. - -\begin{center} -\begin{tabular}{rcrcrcrc} -$\zeta_{0}$ & $=$ & & & & & $w_0$ \\ -$\zeta_{1}$ & $=$ & $w_2$ & $+$ & $w_1$ & $+$ & $w_0$ \\ -$\zeta_{\infty}$ & $=$ & $w_2$ & & & & \\ -\end{tabular} -\end{center} - -By adding the first and last equation to the equation in the middle the term $w_1$ can be isolated and all three coefficients solved for. The simplicity -of this system of equations has made Karatsuba fairly popular. In fact the cutoff point is often fairly low\footnote{With LibTomMath 0.18 it is 70 and 109 digits for the Intel P4 and AMD Athlon respectively.} -making it an ideal algorithm to speed up certain public key cryptosystems such as RSA and Diffie-Hellman. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert$ \\ -\hline \\ -1. Init the following mp\_int variables: $x0$, $x1$, $y0$, $y1$, $t1$, $x0y0$, $x1y1$.\\ -2. If step 2 failed then return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1 \cdot \beta^B + x0$ \\ -3. $B \leftarrow \mbox{min}(a.used, b.used)/2$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $y0 \leftarrow b \mbox{ (mod }\beta^B\mbox{)}$ \\ -6. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_rshd}) \\ -7. $y1 \leftarrow \lfloor b / \beta^B \rfloor$ \\ -\\ -Calculate the three products. \\ -8. $x0y0 \leftarrow x0 \cdot y0$ (\textit{mp\_mul}) \\ -9. $x1y1 \leftarrow x1 \cdot y1$ \\ -10. $t1 \leftarrow x1 + x0$ (\textit{mp\_add}) \\ -11. $x0 \leftarrow y1 + y0$ \\ -12. $t1 \leftarrow t1 \cdot x0$ \\ -\\ -Calculate the middle term. \\ -13. $x0 \leftarrow x0y0 + x1y1$ \\ -14. $t1 \leftarrow t1 - x0$ (\textit{s\_mp\_sub}) \\ -\\ -Calculate the final product. \\ -15. $t1 \leftarrow t1 \cdot \beta^B$ (\textit{mp\_lshd}) \\ -16. $x1y1 \leftarrow x1y1 \cdot \beta^{2B}$ \\ -17. $t1 \leftarrow x0y0 + t1$ \\ -18. $c \leftarrow t1 + x1y1$ \\ -19. Clear all of the temporary variables. \\ -20. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_mul} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_mul.} -This algorithm computes the unsigned product of two inputs using the Karatsuba multiplication algorithm. It is loosely based on the description -from Knuth \cite[pp. 294-295]{TAOCPV2}. - -\index{radix point} -In order to split the two inputs into their respective halves, a suitable \textit{radix point} must be chosen. The radix point chosen must -be used for both of the inputs meaning that it must be smaller than the smallest input. Step 3 chooses the radix point $B$ as half of the -smallest input \textbf{used} count. After the radix point is chosen the inputs are split into lower and upper halves. Step 4 and 5 -compute the lower halves. Step 6 and 7 computer the upper halves. - -After the halves have been computed the three intermediate half-size products must be computed. Step 8 and 9 compute the trivial products -$x0 \cdot y0$ and $x1 \cdot y1$. The mp\_int $x0$ is used as a temporary variable after $x1 + x0$ has been computed. By using $x0$ instead -of an additional temporary variable, the algorithm can avoid an addition memory allocation operation. - -The remaining steps 13 through 18 compute the Karatsuba polynomial through a variety of digit shifting and addition operations. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_karatsuba\_mul.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* c = |a| * |b| using Karatsuba Multiplication using -018 * three half size multiplications -019 * -020 * Let B represent the radix [e.g. 2**DIGIT_BIT] and -021 * let n represent half of the number of digits in -022 * the min(a,b) -023 * -024 * a = a1 * B**n + a0 -025 * b = b1 * B**n + b0 -026 * -027 * Then, a * b => -028 a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0 -029 * -030 * Note that a1b1 and a0b0 are used twice and only need to be -031 * computed once. So in total three half size (half # of -032 * digit) multiplications are performed, a0b0, a1b1 and -033 * (a1+b1)(a0+b0) -034 * -035 * Note that a multiplication of half the digits requires -036 * 1/4th the number of single precision multiplications so in -037 * total after one call 25% of the single precision multiplications -038 * are saved. Note also that the call to mp_mul can end up back -039 * in this function if the a0, a1, b0, or b1 are above the threshold. -040 * This is known as divide-and-conquer and leads to the famous -041 * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than -042 * the standard O(N**2) that the baseline/comba methods use. -043 * Generally though the overhead of this method doesn't pay off -044 * until a certain size (N ~ 80) is reached. -045 */ -046 int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) -047 \{ -048 mp_int x0, x1, y0, y1, t1, x0y0, x1y1; -049 int B, err; -050 -051 /* default the return code to an error */ -052 err = MP_MEM; -053 -054 /* min # of digits */ -055 B = MIN (a->used, b->used); -056 -057 /* now divide in two */ -058 B = B >> 1; -059 -060 /* init copy all the temps */ -061 if (mp_init_size (&x0, B) != MP_OKAY) -062 goto ERR; -063 if (mp_init_size (&x1, a->used - B) != MP_OKAY) -064 goto X0; -065 if (mp_init_size (&y0, B) != MP_OKAY) -066 goto X1; -067 if (mp_init_size (&y1, b->used - B) != MP_OKAY) -068 goto Y0; -069 -070 /* init temps */ -071 if (mp_init_size (&t1, B * 2) != MP_OKAY) -072 goto Y1; -073 if (mp_init_size (&x0y0, B * 2) != MP_OKAY) -074 goto T1; -075 if (mp_init_size (&x1y1, B * 2) != MP_OKAY) -076 goto X0Y0; -077 -078 /* now shift the digits */ -079 x0.used = y0.used = B; -080 x1.used = a->used - B; -081 y1.used = b->used - B; -082 -083 \{ -084 int x; -085 mp_digit *tmpa, *tmpb, *tmpx, *tmpy; -086 -087 /* we copy the digits directly instead of using higher level functions -088 * since we also need to shift the digits -089 */ -090 tmpa = a->dp; -091 tmpb = b->dp; -092 -093 tmpx = x0.dp; -094 tmpy = y0.dp; -095 for (x = 0; x < B; x++) \{ -096 *tmpx++ = *tmpa++; -097 *tmpy++ = *tmpb++; -098 \} -099 -100 tmpx = x1.dp; -101 for (x = B; x < a->used; x++) \{ -102 *tmpx++ = *tmpa++; -103 \} -104 -105 tmpy = y1.dp; -106 for (x = B; x < b->used; x++) \{ -107 *tmpy++ = *tmpb++; -108 \} -109 \} -110 -111 /* only need to clamp the lower words since by definition the -112 * upper words x1/y1 must have a known number of digits -113 */ -114 mp_clamp (&x0); -115 mp_clamp (&y0); -116 -117 /* now calc the products x0y0 and x1y1 */ -118 /* after this x0 is no longer required, free temp [x0==t2]! */ -119 if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY) -120 goto X1Y1; /* x0y0 = x0*y0 */ -121 if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) -122 goto X1Y1; /* x1y1 = x1*y1 */ -123 -124 /* now calc x1+x0 and y1+y0 */ -125 if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) -126 goto X1Y1; /* t1 = x1 - x0 */ -127 if (s_mp_add (&y1, &y0, &x0) != MP_OKAY) -128 goto X1Y1; /* t2 = y1 - y0 */ -129 if (mp_mul (&t1, &x0, &t1) != MP_OKAY) -130 goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ -131 -132 /* add x0y0 */ -133 if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) -134 goto X1Y1; /* t2 = x0y0 + x1y1 */ -135 if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY) -136 goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ -137 -138 /* shift by B */ -139 if (mp_lshd (&t1, B) != MP_OKAY) -140 goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))<used, b->used) / 3; -038 -039 /* a = a2 * B**2 + a1 * B + a0 */ -040 if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) \{ -041 goto ERR; -042 \} -043 -044 if ((res = mp_copy(a, &a1)) != MP_OKAY) \{ -045 goto ERR; -046 \} -047 mp_rshd(&a1, B); -048 if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) \{ -049 goto ERR; -050 \} -051 -052 if ((res = mp_copy(a, &a2)) != MP_OKAY) \{ -053 goto ERR; -054 \} -055 mp_rshd(&a2, B*2); -056 -057 /* b = b2 * B**2 + b1 * B + b0 */ -058 if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) \{ -059 goto ERR; -060 \} -061 -062 if ((res = mp_copy(b, &b1)) != MP_OKAY) \{ -063 goto ERR; -064 \} -065 mp_rshd(&b1, B); -066 (void)mp_mod_2d(&b1, DIGIT_BIT * B, &b1); -067 -068 if ((res = mp_copy(b, &b2)) != MP_OKAY) \{ -069 goto ERR; -070 \} -071 mp_rshd(&b2, B*2); -072 -073 /* w0 = a0*b0 */ -074 if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) \{ -075 goto ERR; -076 \} -077 -078 /* w4 = a2 * b2 */ -079 if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) \{ -080 goto ERR; -081 \} -082 -083 /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ -084 if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) \{ -085 goto ERR; -086 \} -087 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) \{ -088 goto ERR; -089 \} -090 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) \{ -091 goto ERR; -092 \} -093 if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) \{ -094 goto ERR; -095 \} -096 -097 if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) \{ -098 goto ERR; -099 \} -100 if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) \{ -101 goto ERR; -102 \} -103 if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) \{ -104 goto ERR; -105 \} -106 if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) \{ -107 goto ERR; -108 \} -109 -110 if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) \{ -111 goto ERR; -112 \} -113 -114 /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ -115 if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) \{ -116 goto ERR; -117 \} -118 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) \{ -119 goto ERR; -120 \} -121 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) \{ -122 goto ERR; -123 \} -124 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) \{ -125 goto ERR; -126 \} -127 -128 if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) \{ -129 goto ERR; -130 \} -131 if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) \{ -132 goto ERR; -133 \} -134 if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) \{ -135 goto ERR; -136 \} -137 if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) \{ -138 goto ERR; -139 \} -140 -141 if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) \{ -142 goto ERR; -143 \} -144 -145 -146 /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ -147 if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) \{ -148 goto ERR; -149 \} -150 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) \{ -151 goto ERR; -152 \} -153 if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) \{ -154 goto ERR; -155 \} -156 if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) \{ -157 goto ERR; -158 \} -159 if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) \{ -160 goto ERR; -161 \} -162 -163 /* now solve the matrix -164 -165 0 0 0 0 1 -166 1 2 4 8 16 -167 1 1 1 1 1 -168 16 8 4 2 1 -169 1 0 0 0 0 -170 -171 using 12 subtractions, 4 shifts, -172 2 small divisions and 1 small multiplication -173 */ -174 -175 /* r1 - r4 */ -176 if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) \{ -177 goto ERR; -178 \} -179 /* r3 - r0 */ -180 if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) \{ -181 goto ERR; -182 \} -183 /* r1/2 */ -184 if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) \{ -185 goto ERR; -186 \} -187 /* r3/2 */ -188 if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) \{ -189 goto ERR; -190 \} -191 /* r2 - r0 - r4 */ -192 if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) \{ -193 goto ERR; -194 \} -195 if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) \{ -196 goto ERR; -197 \} -198 /* r1 - r2 */ -199 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) \{ -200 goto ERR; -201 \} -202 /* r3 - r2 */ -203 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) \{ -204 goto ERR; -205 \} -206 /* r1 - 8r0 */ -207 if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) \{ -208 goto ERR; -209 \} -210 if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) \{ -211 goto ERR; -212 \} -213 /* r3 - 8r4 */ -214 if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) \{ -215 goto ERR; -216 \} -217 if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) \{ -218 goto ERR; -219 \} -220 /* 3r2 - r1 - r3 */ -221 if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) \{ -222 goto ERR; -223 \} -224 if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) \{ -225 goto ERR; -226 \} -227 if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) \{ -228 goto ERR; -229 \} -230 /* r1 - r2 */ -231 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) \{ -232 goto ERR; -233 \} -234 /* r3 - r2 */ -235 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) \{ -236 goto ERR; -237 \} -238 /* r1/3 */ -239 if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) \{ -240 goto ERR; -241 \} -242 /* r3/3 */ -243 if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) \{ -244 goto ERR; -245 \} -246 -247 /* at this point shift W[n] by B*n */ -248 if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) \{ -249 goto ERR; -250 \} -251 if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) \{ -252 goto ERR; -253 \} -254 if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) \{ -255 goto ERR; -256 \} -257 if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) \{ -258 goto ERR; -259 \} -260 -261 if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) \{ -262 goto ERR; -263 \} -264 if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) \{ -265 goto ERR; -266 \} -267 if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) \{ -268 goto ERR; -269 \} -270 if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) \{ -271 goto ERR; -272 \} -273 -274 ERR: -275 mp_clear_multi(&w0, &w1, &w2, &w3, &w4, -276 &a0, &a1, &a2, &b0, &b1, -277 &b2, &tmp1, &tmp2, NULL); -278 return res; -279 \} -280 -281 #endif -282 -\end{alltt} -\end{small} - -The first obvious thing to note is that this algorithm is complicated. The complexity is worth it if you are multiplying very -large numbers. For example, a 10,000 digit multiplication takes approximaly 99,282,205 fewer single precision multiplications with -Toom--Cook than a Comba or baseline approach (this is a savings of more than 99$\%$). For most ``crypto'' sized numbers this -algorithm is not practical as Karatsuba has a much lower cutoff point. - -First we split $a$ and $b$ into three roughly equal portions. This has been accomplished (lines 40 to 71) with -combinations of mp\_rshd() and mp\_mod\_2d() function calls. At this point $a = a2 \cdot \beta^2 + a1 \cdot \beta + a0$ and similiarly -for $b$. - -Next we compute the five points $w0, w1, w2, w3$ and $w4$. Recall that $w0$ and $w4$ can be computed directly from the portions so -we get those out of the way first (lines 74 and 79). Next we compute $w1, w2$ and $w3$ using Horners method. - -After this point we solve for the actual values of $w1, w2$ and $w3$ by reducing the $5 \times 5$ system which is relatively -straight forward. - -\subsection{Signed Multiplication} -Now that algorithms to handle multiplications of every useful dimensions have been developed, a rather simple finishing touch is required. So far all -of the multiplication algorithms have been unsigned multiplications which leaves only a signed multiplication algorithm to be established. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b$ \\ -\hline \\ -1. If $a.sign = b.sign$ then \\ -\hspace{3mm}1.1 $sign = MP\_ZPOS$ \\ -2. else \\ -\hspace{3mm}2.1 $sign = MP\_ZNEG$ \\ -3. If min$(a.used, b.used) \ge TOOM\_MUL\_CUTOFF$ then \\ -\hspace{3mm}3.1 $c \leftarrow a \cdot b$ using algorithm mp\_toom\_mul \\ -4. else if min$(a.used, b.used) \ge KARATSUBA\_MUL\_CUTOFF$ then \\ -\hspace{3mm}4.1 $c \leftarrow a \cdot b$ using algorithm mp\_karatsuba\_mul \\ -5. else \\ -\hspace{3mm}5.1 $digs \leftarrow a.used + b.used + 1$ \\ -\hspace{3mm}5.2 If $digs < MP\_ARRAY$ and min$(a.used, b.used) \le \delta$ then \\ -\hspace{6mm}5.2.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm fast\_s\_mp\_mul\_digs. \\ -\hspace{3mm}5.3 else \\ -\hspace{6mm}5.3.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm s\_mp\_mul\_digs. \\ -6. $c.sign \leftarrow sign$ \\ -7. Return the result of the unsigned multiplication performed. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul} -\end{figure} - -\textbf{Algorithm mp\_mul.} -This algorithm performs the signed multiplication of two inputs. It will make use of any of the three unsigned multiplication algorithms -available when the input is of appropriate size. The \textbf{sign} of the result is not set until the end of the algorithm since algorithm -s\_mp\_mul\_digs will clear it. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* high level multiplication (handles sign) */ -018 int mp_mul (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 int res, neg; -021 neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; -022 -023 /* use Toom-Cook? */ -024 #ifdef BN_MP_TOOM_MUL_C -025 if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) \{ -026 res = mp_toom_mul(a, b, c); -027 \} else -028 #endif -029 #ifdef BN_MP_KARATSUBA_MUL_C -030 /* use Karatsuba? */ -031 if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) \{ -032 res = mp_karatsuba_mul (a, b, c); -033 \} else -034 #endif -035 \{ -036 /* can we use the fast multiplier? -037 * -038 * The fast multiplier can be used if the output will -039 * have less than MP_WARRAY digits and the number of -040 * digits won't affect carry propagation -041 */ -042 int digs = a->used + b->used + 1; -043 -044 #ifdef BN_FAST_S_MP_MUL_DIGS_C -045 if ((digs < MP_WARRAY) && -046 (MIN(a->used, b->used) <= -047 (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) \{ -048 res = fast_s_mp_mul_digs (a, b, c, digs); -049 \} else -050 #endif -051 \{ -052 #ifdef BN_S_MP_MUL_DIGS_C -053 res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ -054 #else -055 res = MP_VAL; -056 #endif -057 \} -058 \} -059 c->sign = (c->used > 0) ? neg : MP_ZPOS; -060 return res; -061 \} -062 #endif -063 -\end{alltt} -\end{small} - -The implementation is rather simplistic and is not particularly noteworthy. Line 23 computes the sign of the result using the ``?'' -operator from the C programming language. Line 47 computes $\delta$ using the fact that $1 << k$ is equal to $2^k$. - -\section{Squaring} -\label{sec:basesquare} - -Squaring is a special case of multiplication where both multiplicands are equal. At first it may seem like there is no significant optimization -available but in fact there is. Consider the multiplication of $576$ against $241$. In total there will be nine single precision multiplications -performed which are $1\cdot 6$, $1 \cdot 7$, $1 \cdot 5$, $4 \cdot 6$, $4 \cdot 7$, $4 \cdot 5$, $2 \cdot 6$, $2 \cdot 7$ and $2 \cdot 5$. Now consider -the multiplication of $123$ against $123$. The nine products are $3 \cdot 3$, $3 \cdot 2$, $3 \cdot 1$, $2 \cdot 3$, $2 \cdot 2$, $2 \cdot 1$, -$1 \cdot 3$, $1 \cdot 2$ and $1 \cdot 1$. On closer inspection some of the products are equivalent. For example, $3 \cdot 2 = 2 \cdot 3$ -and $3 \cdot 1 = 1 \cdot 3$. - -For any $n$-digit input, there are ${{\left (n^2 + n \right)}\over 2}$ possible unique single precision multiplications required compared to the $n^2$ -required for multiplication. The following diagram gives an example of the operations required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{ccccc|c} -&&1&2&3&\\ -$\times$ &&1&2&3&\\ -\hline && $3 \cdot 1$ & $3 \cdot 2$ & $3 \cdot 3$ & Row 0\\ - & $2 \cdot 1$ & $2 \cdot 2$ & $2 \cdot 3$ && Row 1 \\ - $1 \cdot 1$ & $1 \cdot 2$ & $1 \cdot 3$ &&& Row 2 \\ -\end{tabular} -\end{center} -\caption{Squaring Optimization Diagram} -\end{figure} - -Starting from zero and numbering the columns from right to left a very simple pattern becomes obvious. For the purposes of this discussion let $x$ -represent the number being squared. The first observation is that in row $k$ the $2k$'th column of the product has a $\left (x_k \right)^2$ term in it. - -The second observation is that every column $j$ in row $k$ where $j \ne 2k$ is part of a double product. Every non-square term of a column will -appear twice hence the name ``double product''. Every odd column is made up entirely of double products. In fact every column is made up of double -products and at most one square (\textit{see the exercise section}). - -The third and final observation is that for row $k$ the first unique non-square term, that is, one that hasn't already appeared in an earlier row, -occurs at column $2k + 1$. For example, on row $1$ of the previous squaring, column one is part of the double product with column one from row zero. -Column two of row one is a square and column three is the first unique column. - -\subsection{The Baseline Squaring Algorithm} -The baseline squaring algorithm is meant to be a catch-all squaring algorithm. It will handle any of the input sizes that the faster routines -will not handle. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Init a temporary mp\_int of at least $2 \cdot a.used +1$ digits. (\textit{mp\_init\_size}) \\ -2. If step 1 failed return(\textit{MP\_MEM}) \\ -3. $t.used \leftarrow 2 \cdot a.used + 1$ \\ -4. For $ix$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}Calculate the square. \\ -\hspace{3mm}4.1 $\hat r \leftarrow t_{2ix} + \left (a_{ix} \right )^2$ \\ -\hspace{3mm}4.2 $t_{2ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}Calculate the double products after the square. \\ -\hspace{3mm}4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}4.4 For $iy$ from $ix + 1$ to $a.used - 1$ do \\ -\hspace{6mm}4.4.1 $\hat r \leftarrow 2 \cdot a_{ix}a_{iy} + t_{ix + iy} + u$ \\ -\hspace{6mm}4.4.2 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}Set the last carry. \\ -\hspace{3mm}4.5 While $u > 0$ do \\ -\hspace{6mm}4.5.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}4.5.2 $\hat r \leftarrow t_{ix + iy} + u$ \\ -\hspace{6mm}4.5.3 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.5.4 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. Clamp excess digits of $t$. (\textit{mp\_clamp}) \\ -6. Exchange $b$ and $t$. \\ -7. Clear $t$ (\textit{mp\_clear}) \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm s\_mp\_sqr.} -This algorithm computes the square of an input using the three observations on squaring. It is based fairly faithfully on algorithm 14.16 of HAC -\cite[pp.596-597]{HAC}. Similar to algorithm s\_mp\_mul\_digs, a temporary mp\_int is allocated to hold the result of the squaring. This allows the -destination mp\_int to be the same as the source mp\_int. - -The outer loop of this algorithm begins on step 4. It is best to think of the outer loop as walking down the rows of the partial results, while -the inner loop computes the columns of the partial result. Step 4.1 and 4.2 compute the square term for each row, and step 4.3 and 4.4 propagate -the carry and compute the double products. - -The requirement that a mp\_word be able to represent the range $0 \le x < 2 \beta^2$ arises from this -very algorithm. The product $a_{ix}a_{iy}$ will lie in the range $0 \le x \le \beta^2 - 2\beta + 1$ which is obviously less than $\beta^2$ meaning that -when it is multiplied by two, it can be properly represented by a mp\_word. - -Similar to algorithm s\_mp\_mul\_digs, after every pass of the inner loop, the destination is correctly set to the sum of all of the partial -results calculated so far. This involves expensive carry propagation which will be eliminated in the next algorithm. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_sqr.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -018 int s_mp_sqr (mp_int * a, mp_int * b) -019 \{ -020 mp_int t; -021 int res, ix, iy, pa; -022 mp_word r; -023 mp_digit u, tmpx, *tmpt; -024 -025 pa = a->used; -026 if ((res = mp_init_size (&t, (2 * pa) + 1)) != MP_OKAY) \{ -027 return res; -028 \} -029 -030 /* default used is maximum possible size */ -031 t.used = (2 * pa) + 1; -032 -033 for (ix = 0; ix < pa; ix++) \{ -034 /* first calculate the digit at 2*ix */ -035 /* calculate double precision result */ -036 r = (mp_word)t.dp[2*ix] + -037 ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); -038 -039 /* store lower part in result */ -040 t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK)); -041 -042 /* get the carry */ -043 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -044 -045 /* left hand side of A[ix] * A[iy] */ -046 tmpx = a->dp[ix]; -047 -048 /* alias for where to store the results */ -049 tmpt = t.dp + ((2 * ix) + 1); -050 -051 for (iy = ix + 1; iy < pa; iy++) \{ -052 /* first calculate the product */ -053 r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); -054 -055 /* now calculate the double precision result, note we use -056 * addition instead of *2 since it's easier to optimize -057 */ -058 r = ((mp_word) *tmpt) + r + r + ((mp_word) u); -059 -060 /* store lower part */ -061 *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); -062 -063 /* get carry */ -064 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -065 \} -066 /* propagate upwards */ -067 while (u != ((mp_digit) 0)) \{ -068 r = ((mp_word) *tmpt) + ((mp_word) u); -069 *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); -070 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -071 \} -072 \} -073 -074 mp_clamp (&t); -075 mp_exch (&t, b); -076 mp_clear (&t); -077 return MP_OKAY; -078 \} -079 #endif -080 -\end{alltt} -\end{small} - -Inside the outer loop (line 33) the square term is calculated on line 36. The carry (line 43) has been -extracted from the mp\_word accumulator using a right shift. Aliases for $a_{ix}$ and $t_{ix+iy}$ are initialized -(lines 46 and 49) to simplify the inner loop. The doubling is performed using two -additions (line 58) since it is usually faster than shifting, if not at least as fast. - -The important observation is that the inner loop does not begin at $iy = 0$ like for multiplication. As such the inner loops -get progressively shorter as the algorithm proceeds. This is what leads to the savings compared to using a multiplication to -square a number. - -\subsection{Faster Squaring by the ``Comba'' Method} -A major drawback to the baseline method is the requirement for single precision shifting inside the $O(n^2)$ nested loop. Squaring has an additional -drawback that it must double the product inside the inner loop as well. As for multiplication, the Comba technique can be used to eliminate these -performance hazards. - -The first obvious solution is to make an array of mp\_words which will hold all of the columns. This will indeed eliminate all of the carry -propagation operations from the inner loop. However, the inner product must still be doubled $O(n^2)$ times. The solution stems from the simple fact -that $2a + 2b + 2c = 2(a + b + c)$. That is the sum of all of the double products is equal to double the sum of all the products. For example, -$ab + ba + ac + ca = 2ab + 2ac = 2(ab + ac)$. - -However, we cannot simply double all of the columns, since the squares appear only once per row. The most practical solution is to have two -mp\_word arrays. One array will hold the squares and the other array will hold the double products. With both arrays the doubling and -carry propagation can be moved to a $O(n)$ work level outside the $O(n^2)$ level. In this case, we have an even simpler solution in mind. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_digits named $W$ on the stack. \\ -1. If $b.alloc < 2a.used + 1$ then grow $b$ to $2a.used + 1$ digits. (\textit{mp\_grow}). \\ -2. If step 1 failed return(\textit{MP\_MEM}). \\ -\\ -3. $pa \leftarrow 2 \cdot a.used$ \\ -4. $\hat W1 \leftarrow 0$ \\ -5. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}5.1 $\_ \hat W \leftarrow 0$ \\ -\hspace{3mm}5.2 $ty \leftarrow \mbox{MIN}(a.used - 1, ix)$ \\ -\hspace{3mm}5.3 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.4 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.5 $iy \leftarrow \mbox{MIN}(iy, \lfloor \left (ty - tx + 1 \right )/2 \rfloor)$ \\ -\hspace{3mm}5.6 for $iz$ from $0$ to $iz - 1$ do \\ -\hspace{6mm}5.6.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx + iz}a_{ty - iz}$ \\ -\hspace{3mm}5.7 $\_ \hat W \leftarrow 2 \cdot \_ \hat W + \hat W1$ \\ -\hspace{3mm}5.8 if $ix$ is even then \\ -\hspace{6mm}5.8.1 $\_ \hat W \leftarrow \_ \hat W + \left ( a_{\lfloor ix/2 \rfloor}\right )^2$ \\ -\hspace{3mm}5.9 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$ \\ -\hspace{3mm}5.10 $\hat W1 \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow b.used$ \\ -7. $b.used \leftarrow 2 \cdot a.used$ \\ -8. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}8.1 $b_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $b_{ix} \leftarrow 0$ \\ -10. Clamp excess digits from $b$. (\textit{mp\_clamp}) \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_sqr.} -This algorithm computes the square of an input using the Comba technique. It is designed to be a replacement for algorithm -s\_mp\_sqr when the number of input digits is less than \textbf{MP\_WARRAY} and less than $\delta \over 2$. -This algorithm is very similar to the Comba multiplier except with a few key differences we shall make note of. - -First, we have an accumulator and carry variables $\_ \hat W$ and $\hat W1$ respectively. This is because the inner loop -products are to be doubled. If we had added the previous carry in we would be doubling too much. Next we perform an -addition MIN condition on $iy$ (step 5.5) to prevent overlapping digits. For example, $a_3 \cdot a_5$ is equal -$a_5 \cdot a_3$. Whereas in the multiplication case we would have $5 < a.used$ and $3 \ge 0$ is maintained since we double the sum -of the products just outside the inner loop we have to avoid doing this. This is also a good thing since we perform -fewer multiplications and the routine ends up being faster. - -Finally the last difference is the addition of the ``square'' term outside the inner loop (step 5.8). We add in the square -only to even outputs and it is the square of the term at the $\lfloor ix / 2 \rfloor$ position. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_fast\_s\_mp\_sqr.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* the jist of squaring... -018 * you do like mult except the offset of the tmpx [one that -019 * starts closer to zero] can't equal the offset of tmpy. -020 * So basically you set up iy like before then you min it with -021 * (ty-tx) so that it never happens. You double all those -022 * you add in the inner loop -023 -024 After that loop you do the squares and add them in. -025 */ -026 -027 int fast_s_mp_sqr (mp_int * a, mp_int * b) -028 \{ -029 int olduse, res, pa, ix, iz; -030 mp_digit W[MP_WARRAY], *tmpx; -031 mp_word W1; -032 -033 /* grow the destination as required */ -034 pa = a->used + a->used; -035 if (b->alloc < pa) \{ -036 if ((res = mp_grow (b, pa)) != MP_OKAY) \{ -037 return res; -038 \} -039 \} -040 -041 /* number of output digits to produce */ -042 W1 = 0; -043 for (ix = 0; ix < pa; ix++) \{ -044 int tx, ty, iy; -045 mp_word _W; -046 mp_digit *tmpy; -047 -048 /* clear counter */ -049 _W = 0; -050 -051 /* get offsets into the two bignums */ -052 ty = MIN(a->used-1, ix); -053 tx = ix - ty; -054 -055 /* setup temp aliases */ -056 tmpx = a->dp + tx; -057 tmpy = a->dp + ty; -058 -059 /* this is the number of times the loop will iterrate, essentially -060 while (tx++ < a->used && ty-- >= 0) \{ ... \} -061 */ -062 iy = MIN(a->used-tx, ty+1); -063 -064 /* now for squaring tx can never equal ty -065 * we halve the distance since they approach at a rate of 2x -066 * and we have to round because odd cases need to be executed -067 */ -068 iy = MIN(iy, ((ty-tx)+1)>>1); -069 -070 /* execute loop */ -071 for (iz = 0; iz < iy; iz++) \{ -072 _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); -073 \} -074 -075 /* double the inner product and add carry */ -076 _W = _W + _W + W1; -077 -078 /* even columns have the square term in them */ -079 if ((ix&1) == 0) \{ -080 _W += ((mp_word)a->dp[ix>>1])*((mp_word)a->dp[ix>>1]); -081 \} -082 -083 /* store it */ -084 W[ix] = (mp_digit)(_W & MP_MASK); -085 -086 /* make next carry */ -087 W1 = _W >> ((mp_word)DIGIT_BIT); -088 \} -089 -090 /* setup dest */ -091 olduse = b->used; -092 b->used = a->used+a->used; -093 -094 \{ -095 mp_digit *tmpb; -096 tmpb = b->dp; -097 for (ix = 0; ix < pa; ix++) \{ -098 *tmpb++ = W[ix] & MP_MASK; -099 \} -100 -101 /* clear unused digits [that existed in the old copy of c] */ -102 for (; ix < olduse; ix++) \{ -103 *tmpb++ = 0; -104 \} -105 \} -106 mp_clamp (b); -107 return MP_OKAY; -108 \} -109 #endif -110 -\end{alltt} -\end{small} - -This implementation is essentially a copy of Comba multiplication with the appropriate changes added to make it faster for -the special case of squaring. - -\subsection{Polynomial Basis Squaring} -The same algorithm that performs optimal polynomial basis multiplication can be used to perform polynomial basis squaring. The minor exception -is that $\zeta_y = f(y)g(y)$ is actually equivalent to $\zeta_y = f(y)^2$ since $f(y) = g(y)$. Instead of performing $2n + 1$ -multiplications to find the $\zeta$ relations, squaring operations are performed instead. - -\subsection{Karatsuba Squaring} -Let $f(x) = ax + b$ represent the polynomial basis representation of a number to square. -Let $h(x) = \left ( f(x) \right )^2$ represent the square of the polynomial. The Karatsuba equation can be modified to square a -number with the following equation. - -\begin{equation} -h(x) = a^2x^2 + \left ((a + b)^2 - (a^2 + b^2) \right )x + b^2 -\end{equation} - -Upon closer inspection this equation only requires the calculation of three half-sized squares: $a^2$, $b^2$ and $(a + b)^2$. As in -Karatsuba multiplication, this algorithm can be applied recursively on the input and will achieve an asymptotic running time of -$O \left ( n^{lg(3)} \right )$. - -If the asymptotic times of Karatsuba squaring and multiplication are the same, why not simply use the multiplication algorithm -instead? The answer to this arises from the cutoff point for squaring. As in multiplication there exists a cutoff point, at which the -time required for a Comba based squaring and a Karatsuba based squaring meet. Due to the overhead inherent in the Karatsuba method, the cutoff -point is fairly high. For example, on an AMD Athlon XP processor with $\beta = 2^{28}$, the cutoff point is around 127 digits. - -Consider squaring a 200 digit number with this technique. It will be split into two 100 digit halves which are subsequently squared. -The 100 digit halves will not be squared using Karatsuba, but instead using the faster Comba based squaring algorithm. If Karatsuba multiplication -were used instead, the 100 digit numbers would be squared with a slower Comba based multiplication. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Initialize the following temporary mp\_ints: $x0$, $x1$, $t1$, $t2$, $x0x0$ and $x1x1$. \\ -2. If any of the initializations on step 1 failed return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1\beta^B + x0$ \\ -3. $B \leftarrow \lfloor a.used / 2 \rfloor$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_lshd}) \\ -\\ -Calculate the three squares. \\ -6. $x0x0 \leftarrow x0^2$ (\textit{mp\_sqr}) \\ -7. $x1x1 \leftarrow x1^2$ \\ -8. $t1 \leftarrow x1 + x0$ (\textit{s\_mp\_add}) \\ -9. $t1 \leftarrow t1^2$ \\ -\\ -Compute the middle term. \\ -10. $t2 \leftarrow x0x0 + x1x1$ (\textit{s\_mp\_add}) \\ -11. $t1 \leftarrow t1 - t2$ \\ -\\ -Compute final product. \\ -12. $t1 \leftarrow t1\beta^B$ (\textit{mp\_lshd}) \\ -13. $x1x1 \leftarrow x1x1\beta^{2B}$ \\ -14. $t1 \leftarrow t1 + x0x0$ \\ -15. $b \leftarrow t1 + x1x1$ \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_sqr} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_sqr.} -This algorithm computes the square of an input $a$ using the Karatsuba technique. This algorithm is very similar to the Karatsuba based -multiplication algorithm with the exception that the three half-size multiplications have been replaced with three half-size squarings. - -The radix point for squaring is simply placed exactly in the middle of the digits when the input has an odd number of digits, otherwise it is -placed just below the middle. Step 3, 4 and 5 compute the two halves required using $B$ -as the radix point. The first two squares in steps 6 and 7 are rather straightforward while the last square is of a more compact form. - -By expanding $\left (x1 + x0 \right )^2$, the $x1^2$ and $x0^2$ terms in the middle disappear, that is $(x0 - x1)^2 - (x1^2 + x0^2) = 2 \cdot x0 \cdot x1$. -Now if $5n$ single precision additions and a squaring of $n$-digits is faster than multiplying two $n$-digit numbers and doubling then -this method is faster. Assuming no further recursions occur, the difference can be estimated with the following inequality. - -Let $p$ represent the cost of a single precision addition and $q$ the cost of a single precision multiplication both in terms of time\footnote{Or -machine clock cycles.}. - -\begin{equation} -5pn +{{q(n^2 + n)} \over 2} \le pn + qn^2 -\end{equation} - -For example, on an AMD Athlon XP processor $p = {1 \over 3}$ and $q = 6$. This implies that the following inequality should hold. -\begin{center} -\begin{tabular}{rcl} -${5n \over 3} + 3n^2 + 3n$ & $<$ & ${n \over 3} + 6n^2$ \\ -${5 \over 3} + 3n + 3$ & $<$ & ${1 \over 3} + 6n$ \\ -${13 \over 9}$ & $<$ & $n$ \\ -\end{tabular} -\end{center} - -This results in a cutoff point around $n = 2$. As a consequence it is actually faster to compute the middle term the ``long way'' on processors -where multiplication is substantially slower\footnote{On the Athlon there is a 1:17 ratio between clock cycles for addition and multiplication. On -the Intel P4 processor this ratio is 1:29 making this method even more beneficial. The only common exception is the ARMv4 processor which has a -ratio of 1:7. } than simpler operations such as addition. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_karatsuba\_sqr.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Karatsuba squaring, computes b = a*a using three -018 * half size squarings -019 * -020 * See comments of karatsuba_mul for details. It -021 * is essentially the same algorithm but merely -022 * tuned to perform recursive squarings. -023 */ -024 int mp_karatsuba_sqr (mp_int * a, mp_int * b) -025 \{ -026 mp_int x0, x1, t1, t2, x0x0, x1x1; -027 int B, err; -028 -029 err = MP_MEM; -030 -031 /* min # of digits */ -032 B = a->used; -033 -034 /* now divide in two */ -035 B = B >> 1; -036 -037 /* init copy all the temps */ -038 if (mp_init_size (&x0, B) != MP_OKAY) -039 goto ERR; -040 if (mp_init_size (&x1, a->used - B) != MP_OKAY) -041 goto X0; -042 -043 /* init temps */ -044 if (mp_init_size (&t1, a->used * 2) != MP_OKAY) -045 goto X1; -046 if (mp_init_size (&t2, a->used * 2) != MP_OKAY) -047 goto T1; -048 if (mp_init_size (&x0x0, B * 2) != MP_OKAY) -049 goto T2; -050 if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY) -051 goto X0X0; -052 -053 \{ -054 int x; -055 mp_digit *dst, *src; -056 -057 src = a->dp; -058 -059 /* now shift the digits */ -060 dst = x0.dp; -061 for (x = 0; x < B; x++) \{ -062 *dst++ = *src++; -063 \} -064 -065 dst = x1.dp; -066 for (x = B; x < a->used; x++) \{ -067 *dst++ = *src++; -068 \} -069 \} -070 -071 x0.used = B; -072 x1.used = a->used - B; -073 -074 mp_clamp (&x0); -075 -076 /* now calc the products x0*x0 and x1*x1 */ -077 if (mp_sqr (&x0, &x0x0) != MP_OKAY) -078 goto X1X1; /* x0x0 = x0*x0 */ -079 if (mp_sqr (&x1, &x1x1) != MP_OKAY) -080 goto X1X1; /* x1x1 = x1*x1 */ -081 -082 /* now calc (x1+x0)**2 */ -083 if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) -084 goto X1X1; /* t1 = x1 - x0 */ -085 if (mp_sqr (&t1, &t1) != MP_OKAY) -086 goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ -087 -088 /* add x0y0 */ -089 if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) -090 goto X1X1; /* t2 = x0x0 + x1x1 */ -091 if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) -092 goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ -093 -094 /* shift by B */ -095 if (mp_lshd (&t1, B) != MP_OKAY) -096 goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))<used >= TOOM_SQR_CUTOFF) \{ -026 res = mp_toom_sqr(a, b); -027 /* Karatsuba? */ -028 \} else -029 #endif -030 #ifdef BN_MP_KARATSUBA_SQR_C -031 if (a->used >= KARATSUBA_SQR_CUTOFF) \{ -032 res = mp_karatsuba_sqr (a, b); -033 \} else -034 #endif -035 \{ -036 #ifdef BN_FAST_S_MP_SQR_C -037 /* can we use the fast comba multiplier? */ -038 if ((((a->used * 2) + 1) < MP_WARRAY) && -039 (a->used < -040 (1 << (((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT)) - 1)))) \{ -041 res = fast_s_mp_sqr (a, b); -042 \} else -043 #endif -044 \{ -045 #ifdef BN_S_MP_SQR_C -046 res = s_mp_sqr (a, b); -047 #else -048 res = MP_VAL; -049 #endif -050 \} -051 \} -052 b->sign = MP_ZPOS; -053 return res; -054 \} -055 #endif -056 -\end{alltt} -\end{small} - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an efficient algorithm for selection of the radix point to handle inputs \\ - & that have different number of digits in Karatsuba multiplication. \\ - & \\ -$\left [ 2 \right ] $ & In section 5.3 the fact that every column of a squaring is made up \\ - & of double products and at most one square is stated. Prove this statement. \\ - & \\ -$\left [ 3 \right ] $ & Prove the equation for Karatsuba squaring. \\ - & \\ -$\left [ 1 \right ] $ & Prove that Karatsuba squaring requires $O \left (n^{lg(3)} \right )$ time. \\ - & \\ -$\left [ 2 \right ] $ & Determine the minimal ratio between addition and multiplication clock cycles \\ - & required for equation $6.7$ to be true. \\ - & \\ -$\left [ 3 \right ] $ & Implement a threaded version of Comba multiplication (and squaring) where you \\ - & compute subsets of the columns in each thread. Determine a cutoff point where \\ - & it is effective and add the logic to mp\_mul() and mp\_sqr(). \\ - &\\ -$\left [ 4 \right ] $ & Same as the previous but also modify the Karatsuba and Toom-Cook. You must \\ - & increase the throughput of mp\_exptmod() for random odd moduli in the range \\ - & $512 \ldots 4096$ bits significantly ($> 2x$) to complete this challenge. \\ - & \\ -\end{tabular} - -\chapter{Modular Reduction} -\section{Basics of Modular Reduction} -\index{modular residue} -Modular reduction is an operation that arises quite often within public key cryptography algorithms and various number theoretic algorithms, -such as factoring. Modular reduction algorithms are the third class of algorithms of the ``multipliers'' set. A number $a$ is said to be \textit{reduced} -modulo another number $b$ by finding the remainder of the division $a/b$. Full integer division with remainder is a topic to be covered -in~\ref{sec:division}. - -Modular reduction is equivalent to solving for $r$ in the following equation. $a = bq + r$ where $q = \lfloor a/b \rfloor$. The result -$r$ is said to be ``congruent to $a$ modulo $b$'' which is also written as $r \equiv a \mbox{ (mod }b\mbox{)}$. In other vernacular $r$ is known as the -``modular residue'' which leads to ``quadratic residue''\footnote{That's fancy talk for $b \equiv a^2 \mbox{ (mod }p\mbox{)}$.} and -other forms of residues. - -Modular reductions are normally used to create either finite groups, rings or fields. The most common usage for performance driven modular reductions -is in modular exponentiation algorithms. That is to compute $d = a^b \mbox{ (mod }c\mbox{)}$ as fast as possible. This operation is used in the -RSA and Diffie-Hellman public key algorithms, for example. Modular multiplication and squaring also appears as a fundamental operation in -elliptic curve cryptographic algorithms. As will be discussed in the subsequent chapter there exist fast algorithms for computing modular -exponentiations without having to perform (\textit{in this example}) $b - 1$ multiplications. These algorithms will produce partial results in the -range $0 \le x < c^2$ which can be taken advantage of to create several efficient algorithms. They have also been used to create redundancy check -algorithms known as CRCs, error correction codes such as Reed-Solomon and solve a variety of number theoeretic problems. - -\section{The Barrett Reduction} -The Barrett reduction algorithm \cite{BARRETT} was inspired by fast division algorithms which multiply by the reciprocal to emulate -division. Barretts observation was that the residue $c$ of $a$ modulo $b$ is equal to - -\begin{equation} -c = a - b \cdot \lfloor a/b \rfloor -\end{equation} - -Since algorithms such as modular exponentiation would be using the same modulus extensively, typical DSP\footnote{It is worth noting that Barrett's paper -targeted the DSP56K processor.} intuition would indicate the next step would be to replace $a/b$ by a multiplication by the reciprocal. However, -DSP intuition on its own will not work as these numbers are considerably larger than the precision of common DSP floating point data types. -It would take another common optimization to optimize the algorithm. - -\subsection{Fixed Point Arithmetic} -The trick used to optimize the above equation is based on a technique of emulating floating point data types with fixed precision integers. Fixed -point arithmetic would become very popular as it greatly optimize the ``3d-shooter'' genre of games in the mid 1990s when floating point units were -fairly slow if not unavailable. The idea behind fixed point arithmetic is to take a normal $k$-bit integer data type and break it into $p$-bit -integer and a $q$-bit fraction part (\textit{where $p+q = k$}). - -In this system a $k$-bit integer $n$ would actually represent $n/2^q$. For example, with $q = 4$ the integer $n = 37$ would actually represent the -value $2.3125$. To multiply two fixed point numbers the integers are multiplied using traditional arithmetic and subsequently normalized by -moving the implied decimal point back to where it should be. For example, with $q = 4$ to multiply the integers $9$ and $5$ they must be converted -to fixed point first by multiplying by $2^q$. Let $a = 9(2^q)$ represent the fixed point representation of $9$ and $b = 5(2^q)$ represent the -fixed point representation of $5$. The product $ab$ is equal to $45(2^{2q})$ which when normalized by dividing by $2^q$ produces $45(2^q)$. - -This technique became popular since a normal integer multiplication and logical shift right are the only required operations to perform a multiplication -of two fixed point numbers. Using fixed point arithmetic, division can be easily approximated by multiplying by the reciprocal. If $2^q$ is -equivalent to one than $2^q/b$ is equivalent to the fixed point approximation of $1/b$ using real arithmetic. Using this fact dividing an integer -$a$ by another integer $b$ can be achieved with the following expression. - -\begin{equation} -\lfloor a / b \rfloor \mbox{ }\approx\mbox{ } \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -The precision of the division is proportional to the value of $q$. If the divisor $b$ is used frequently as is the case with -modular exponentiation pre-computing $2^q/b$ will allow a division to be performed with a multiplication and a right shift. Both operations -are considerably faster than division on most processors. - -Consider dividing $19$ by $5$. The correct result is $\lfloor 19/5 \rfloor = 3$. With $q = 3$ the reciprocal is $\lfloor 2^q/5 \rfloor = 1$ which -leads to a product of $19$ which when divided by $2^q$ produces $2$. However, with $q = 4$ the reciprocal is $\lfloor 2^q/5 \rfloor = 3$ and -the result of the emulated division is $\lfloor 3 \cdot 19 / 2^q \rfloor = 3$ which is correct. The value of $2^q$ must be close to or ideally -larger than the dividend. In effect if $a$ is the dividend then $q$ should allow $0 \le \lfloor a/2^q \rfloor \le 1$ in order for this approach -to work correctly. Plugging this form of divison into the original equation the following modular residue equation arises. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -Using the notation from \cite{BARRETT} the value of $\lfloor 2^q / b \rfloor$ will be represented by the $\mu$ symbol. Using the $\mu$ -variable also helps re-inforce the idea that it is meant to be computed once and re-used. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \mu)/2^q \rfloor -\end{equation} - -Provided that $2^q \ge a$ this algorithm will produce a quotient that is either exactly correct or off by a value of one. In the context of Barrett -reduction the value of $a$ is bound by $0 \le a \le (b - 1)^2$ meaning that $2^q \ge b^2$ is sufficient to ensure the reciprocal will have enough -precision. - -Let $n$ represent the number of digits in $b$. This algorithm requires approximately $2n^2$ single precision multiplications to produce the quotient and -another $n^2$ single precision multiplications to find the residue. In total $3n^2$ single precision multiplications are required to -reduce the number. - -For example, if $b = 1179677$ and $q = 41$ ($2^q > b^2$), then the reciprocal $\mu$ is equal to $\lfloor 2^q / b \rfloor = 1864089$. Consider reducing -$a = 180388626447$ modulo $b$ using the above reduction equation. The quotient using the new formula is $\lfloor (a \cdot \mu) / 2^q \rfloor = 152913$. -By subtracting $152913b$ from $a$ the correct residue $a \equiv 677346 \mbox{ (mod }b\mbox{)}$ is found. - -\subsection{Choosing a Radix Point} -Using the fixed point representation a modular reduction can be performed with $3n^2$ single precision multiplications. If that were the best -that could be achieved a full division\footnote{A division requires approximately $O(2cn^2)$ single precision multiplications for a small value of $c$. -See~\ref{sec:division} for further details.} might as well be used in its place. The key to optimizing the reduction is to reduce the precision of -the initial multiplication that finds the quotient. - -Let $a$ represent the number of which the residue is sought. Let $b$ represent the modulus used to find the residue. Let $m$ represent -the number of digits in $b$. For the purposes of this discussion we will assume that the number of digits in $a$ is $2m$, which is generally true if -two $m$-digit numbers have been multiplied. Dividing $a$ by $b$ is the same as dividing a $2m$ digit integer by a $m$ digit integer. Digits below the -$m - 1$'th digit of $a$ will contribute at most a value of $1$ to the quotient because $\beta^k < b$ for any $0 \le k \le m - 1$. Another way to -express this is by re-writing $a$ as two parts. If $a' \equiv a \mbox{ (mod }b^m\mbox{)}$ and $a'' = a - a'$ then -${a \over b} \equiv {{a' + a''} \over b}$ which is equivalent to ${a' \over b} + {a'' \over b}$. Since $a'$ is bound to be less than $b$ the quotient -is bound by $0 \le {a' \over b} < 1$. - -Since the digits of $a'$ do not contribute much to the quotient the observation is that they might as well be zero. However, if the digits -``might as well be zero'' they might as well not be there in the first place. Let $q_0 = \lfloor a/\beta^{m-1} \rfloor$ represent the input -with the irrelevant digits trimmed. Now the modular reduction is trimmed to the almost equivalent equation - -\begin{equation} -c = a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor -\end{equation} - -Note that the original divisor $2^q$ has been replaced with $\beta^{m+1}$ where in this case $q$ is a multiple of $lg(\beta)$. Also note that the -exponent on the divisor when added to the amount $q_0$ was shifted by equals $2m$. If the optimization had not been performed the divisor -would have the exponent $2m$ so in the end the exponents do ``add up''. Using the above equation the quotient -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ can be off from the true quotient by at most two. The original fixed point quotient can be off -by as much as one (\textit{provided the radix point is chosen suitably}) and now that the lower irrelevent digits have been trimmed the quotient -can be off by an additional value of one for a total of at most two. This implies that -$0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. By first subtracting $b$ times the quotient and then conditionally subtracting -$b$ once or twice the residue is found. - -The quotient is now found using $(m + 1)(m) = m^2 + m$ single precision multiplications and the residue with an additional $m^2$ single -precision multiplications, ignoring the subtractions required. In total $2m^2 + m$ single precision multiplications are required to find the residue. -This is considerably faster than the original attempt. - -For example, let $\beta = 10$ represent the radix of the digits. Let $b = 9999$ represent the modulus which implies $m = 4$. Let $a = 99929878$ -represent the value of which the residue is desired. In this case $q = 8$ since $10^7 < 9999^2$ meaning that $\mu = \lfloor \beta^{q}/b \rfloor = 10001$. -With the new observation the multiplicand for the quotient is equal to $q_0 = \lfloor a / \beta^{m - 1} \rfloor = 99929$. The quotient is then -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor = 9993$. Subtracting $9993b$ from $a$ and the correct residue $a \equiv 9871 \mbox{ (mod }b\mbox{)}$ -is found. - -\subsection{Trimming the Quotient} -So far the reduction algorithm has been optimized from $3m^2$ single precision multiplications down to $2m^2 + m$ single precision multiplications. As -it stands now the algorithm is already fairly fast compared to a full integer division algorithm. However, there is still room for -optimization. - -After the first multiplication inside the quotient ($q_0 \cdot \mu$) the value is shifted right by $m + 1$ places effectively nullifying the lower -half of the product. It would be nice to be able to remove those digits from the product to effectively cut down the number of single precision -multiplications. If the number of digits in the modulus $m$ is far less than $\beta$ a full product is not required for the algorithm to work properly. -In fact the lower $m - 2$ digits will not affect the upper half of the product at all and do not need to be computed. - -The value of $\mu$ is a $m$-digit number and $q_0$ is a $m + 1$ digit number. Using a full multiplier $(m + 1)(m) = m^2 + m$ single precision -multiplications would be required. Using a multiplier that will only produce digits at and above the $m - 1$'th digit reduces the number -of single precision multiplications to ${m^2 + m} \over 2$ single precision multiplications. - -\subsection{Trimming the Residue} -After the quotient has been calculated it is used to reduce the input. As previously noted the algorithm is not exact and it can be off by a small -multiple of the modulus, that is $0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. If $b$ is $m$ digits than the -result of reduction equation is a value of at most $m + 1$ digits (\textit{provided $3 < \beta$}) implying that the upper $m - 1$ digits are -implicitly zero. - -The next optimization arises from this very fact. Instead of computing $b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ using a full -$O(m^2)$ multiplication algorithm only the lower $m+1$ digits of the product have to be computed. Similarly the value of $a$ can -be reduced modulo $\beta^{m+1}$ before the multiple of $b$ is subtracted which simplifes the subtraction as well. A multiplication that produces -only the lower $m+1$ digits requires ${m^2 + 3m - 2} \over 2$ single precision multiplications. - -With both optimizations in place the algorithm is the algorithm Barrett proposed. It requires $m^2 + 2m - 1$ single precision multiplications which -is considerably faster than the straightforward $3m^2$ method. - -\subsection{The Barrett Algorithm} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and $\mu = \lfloor \beta^{2m}/b \rfloor, m = \lceil lg_{\beta}(b) \rceil, (0 \le a < b^2, b > 1)$ \\ -\textbf{Output}. $a \mbox{ (mod }b\mbox{)}$ \\ -\hline \\ -Let $m$ represent the number of digits in $b$. \\ -1. Make a copy of $a$ and store it in $q$. (\textit{mp\_init\_copy}) \\ -2. $q \leftarrow \lfloor q / \beta^{m - 1} \rfloor$ (\textit{mp\_rshd}) \\ -\\ -Produce the quotient. \\ -3. $q \leftarrow q \cdot \mu$ (\textit{note: only produce digits at or above $m-1$}) \\ -4. $q \leftarrow \lfloor q / \beta^{m + 1} \rfloor$ \\ -\\ -Subtract the multiple of modulus from the input. \\ -5. $a \leftarrow a \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -6. $q \leftarrow q \cdot b \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{s\_mp\_mul\_digs}) \\ -7. $a \leftarrow a - q$ (\textit{mp\_sub}) \\ -\\ -Add $\beta^{m+1}$ if a carry occured. \\ -8. If $a < 0$ then (\textit{mp\_cmp\_d}) \\ -\hspace{3mm}8.1 $q \leftarrow 1$ (\textit{mp\_set}) \\ -\hspace{3mm}8.2 $q \leftarrow q \cdot \beta^{m+1}$ (\textit{mp\_lshd}) \\ -\hspace{3mm}8.3 $a \leftarrow a + q$ \\ -\\ -Now subtract the modulus if the residue is too large (e.g. quotient too small). \\ -9. While $a \ge b$ do (\textit{mp\_cmp}) \\ -\hspace{3mm}9.1 $c \leftarrow a - b$ \\ -10. Clear $q$. \\ -11. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce} -\end{figure} - -\textbf{Algorithm mp\_reduce.} -This algorithm will reduce the input $a$ modulo $b$ in place using the Barrett algorithm. It is loosely based on algorithm 14.42 of HAC -\cite[pp. 602]{HAC} which is based on the paper from Paul Barrett \cite{BARRETT}. The algorithm has several restrictions and assumptions which must -be adhered to for the algorithm to work. - -First the modulus $b$ is assumed to be positive and greater than one. If the modulus were less than or equal to one than subtracting -a multiple of it would either accomplish nothing or actually enlarge the input. The input $a$ must be in the range $0 \le a < b^2$ in order -for the quotient to have enough precision. If $a$ is the product of two numbers that were already reduced modulo $b$, this will not be a problem. -Technically the algorithm will still work if $a \ge b^2$ but it will take much longer to finish. The value of $\mu$ is passed as an argument to this -algorithm and is assumed to be calculated and stored before the algorithm is used. - -Recall that the multiplication for the quotient on step 3 must only produce digits at or above the $m-1$'th position. An algorithm called -$s\_mp\_mul\_high\_digs$ which has not been presented is used to accomplish this task. The algorithm is based on $s\_mp\_mul\_digs$ except that -instead of stopping at a given level of precision it starts at a given level of precision. This optimal algorithm can only be used if the number -of digits in $b$ is very much smaller than $\beta$. - -While it is known that -$a \ge b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ only the lower $m+1$ digits are being used to compute the residue, so an implied -``borrow'' from the higher digits might leave a negative result. After the multiple of the modulus has been subtracted from $a$ the residue must be -fixed up in case it is negative. The invariant $\beta^{m+1}$ must be added to the residue to make it positive again. - -The while loop at step 9 will subtract $b$ until the residue is less than $b$. If the algorithm is performed correctly this step is -performed at most twice, and on average once. However, if $a \ge b^2$ than it will iterate substantially more times than it should. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* reduces x mod m, assumes 0 < x < m**2, mu is -018 * precomputed via mp_reduce_setup. -019 * From HAC pp.604 Algorithm 14.42 -020 */ -021 int mp_reduce (mp_int * x, mp_int * m, mp_int * mu) -022 \{ -023 mp_int q; -024 int res, um = m->used; -025 -026 /* q = x */ -027 if ((res = mp_init_copy (&q, x)) != MP_OKAY) \{ -028 return res; -029 \} -030 -031 /* q1 = x / b**(k-1) */ -032 mp_rshd (&q, um - 1); -033 -034 /* according to HAC this optimization is ok */ -035 if (((mp_digit) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) \{ -036 if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) \{ -037 goto CLEANUP; -038 \} -039 \} else \{ -040 #ifdef BN_S_MP_MUL_HIGH_DIGS_C -041 if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) \{ -042 goto CLEANUP; -043 \} -044 #elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) -045 if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) \{ -046 goto CLEANUP; -047 \} -048 #else -049 \{ -050 res = MP_VAL; -051 goto CLEANUP; -052 \} -053 #endif -054 \} -055 -056 /* q3 = q2 / b**(k+1) */ -057 mp_rshd (&q, um + 1); -058 -059 /* x = x mod b**(k+1), quick (no division) */ -060 if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) \{ -061 goto CLEANUP; -062 \} -063 -064 /* q = q * m mod b**(k+1), quick (no division) */ -065 if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) \{ -066 goto CLEANUP; -067 \} -068 -069 /* x = x - q */ -070 if ((res = mp_sub (x, &q, x)) != MP_OKAY) \{ -071 goto CLEANUP; -072 \} -073 -074 /* If x < 0, add b**(k+1) to it */ -075 if (mp_cmp_d (x, 0) == MP_LT) \{ -076 mp_set (&q, 1); -077 if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) -078 goto CLEANUP; -079 if ((res = mp_add (x, &q, x)) != MP_OKAY) -080 goto CLEANUP; -081 \} -082 -083 /* Back off if it's too big */ -084 while (mp_cmp (x, m) != MP_LT) \{ -085 if ((res = s_mp_sub (x, m, x)) != MP_OKAY) \{ -086 goto CLEANUP; -087 \} -088 \} -089 -090 CLEANUP: -091 mp_clear (&q); -092 -093 return res; -094 \} -095 #endif -096 -\end{alltt} -\end{small} - -The first multiplication that determines the quotient can be performed by only producing the digits from $m - 1$ and up. This essentially halves -the number of single precision multiplications required. However, the optimization is only safe if $\beta$ is much larger than the number of digits -in the modulus. In the source code this is evaluated on lines 36 to 43 where algorithm s\_mp\_mul\_high\_digs is used when it is -safe to do so. - -\subsection{The Barrett Setup Algorithm} -In order to use algorithm mp\_reduce the value of $\mu$ must be calculated in advance. Ideally this value should be computed once and stored for -future use so that the Barrett algorithm can be used without delay. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_setup}. \\ -\textbf{Input}. mp\_int $a$ ($a > 1$) \\ -\textbf{Output}. $\mu \leftarrow \lfloor \beta^{2m}/a \rfloor$ \\ -\hline \\ -1. $\mu \leftarrow 2^{2 \cdot lg(\beta) \cdot m}$ (\textit{mp\_2expt}) \\ -2. $\mu \leftarrow \lfloor \mu / b \rfloor$ (\textit{mp\_div}) \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_setup.} -This algorithm computes the reciprocal $\mu$ required for Barrett reduction. First $\beta^{2m}$ is calculated as $2^{2 \cdot lg(\beta) \cdot m}$ which -is equivalent and much faster. The final value is computed by taking the integer quotient of $\lfloor \mu / b \rfloor$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* pre-calculate the value required for Barrett reduction -018 * For a given modulus "b" it calulates the value required in "a" -019 */ -020 int mp_reduce_setup (mp_int * a, mp_int * b) -021 \{ -022 int res; -023 -024 if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) \{ -025 return res; -026 \} -027 return mp_div (a, b, a, NULL); -028 \} -029 #endif -030 -\end{alltt} -\end{small} - -This simple routine calculates the reciprocal $\mu$ required by Barrett reduction. Note the extended usage of algorithm mp\_div where the variable -which would received the remainder is passed as NULL. As will be discussed in~\ref{sec:division} the division routine allows both the quotient and the -remainder to be passed as NULL meaning to ignore the value. - -\section{The Montgomery Reduction} -Montgomery reduction\footnote{Thanks to Niels Ferguson for his insightful explanation of the algorithm.} \cite{MONT} is by far the most interesting -form of reduction in common use. It computes a modular residue which is not actually equal to the residue of the input yet instead equal to a -residue times a constant. However, as perplexing as this may sound the algorithm is relatively simple and very efficient. - -Throughout this entire section the variable $n$ will represent the modulus used to form the residue. As will be discussed shortly the value of -$n$ must be odd. The variable $x$ will represent the quantity of which the residue is sought. Similar to the Barrett algorithm the input -is restricted to $0 \le x < n^2$. To begin the description some simple number theory facts must be established. - -\textbf{Fact 1.} Adding $n$ to $x$ does not change the residue since in effect it adds one to the quotient $\lfloor x / n \rfloor$. Another way -to explain this is that $n$ is (\textit{or multiples of $n$ are}) congruent to zero modulo $n$. Adding zero will not change the value of the residue. - -\textbf{Fact 2.} If $x$ is even then performing a division by two in $\Z$ is congruent to $x \cdot 2^{-1} \mbox{ (mod }n\mbox{)}$. Actually -this is an application of the fact that if $x$ is evenly divisible by any $k \in \Z$ then division in $\Z$ will be congruent to -multiplication by $k^{-1}$ modulo $n$. - -From these two simple facts the following simple algorithm can be derived. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction}. \\ -\textbf{Input}. Integer $x$, $n$ and $k$ \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If $x$ is odd then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + n$ \\ -\hspace{3mm}1.2 $x \leftarrow x/2$ \\ -2. Return $x$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction} -\end{figure} - -The algorithm reduces the input one bit at a time using the two congruencies stated previously. Inside the loop $n$, which is odd, is -added to $x$ if $x$ is odd. This forces $x$ to be even which allows the division by two in $\Z$ to be congruent to a modular division by two. Since -$x$ is assumed to be initially much larger than $n$ the addition of $n$ will contribute an insignificant magnitude to $x$. Let $r$ represent the -final result of the Montgomery algorithm. If $k > lg(n)$ and $0 \le x < n^2$ then the final result is limited to -$0 \le r < \lfloor x/2^k \rfloor + n$. As a result at most a single subtraction is required to get the residue desired. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} \\ -\hline $1$ & $x + n = 5812$, $x/2 = 2906$ \\ -\hline $2$ & $x/2 = 1453$ \\ -\hline $3$ & $x + n = 1710$, $x/2 = 855$ \\ -\hline $4$ & $x + n = 1112$, $x/2 = 556$ \\ -\hline $5$ & $x/2 = 278$ \\ -\hline $6$ & $x/2 = 139$ \\ -\hline $7$ & $x + n = 396$, $x/2 = 198$ \\ -\hline $8$ & $x/2 = 99$ \\ -\hline $9$ & $x + n = 356$, $x/2 = 178$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (I)} -\label{fig:MONT1} -\end{figure} - -Consider the example in figure~\ref{fig:MONT1} which reduces $x = 5555$ modulo $n = 257$ when $k = 9$ (note $\beta^k = 512$ which is larger than $n$). The result of -the algorithm $r = 178$ is congruent to the value of $2^{-9} \cdot 5555 \mbox{ (mod }257\mbox{)}$. When $r$ is multiplied by $2^9$ modulo $257$ the correct residue -$r \equiv 158$ is produced. - -Let $k = \lfloor lg(n) \rfloor + 1$ represent the number of bits in $n$. The current algorithm requires $2k^2$ single precision shifts -and $k^2$ single precision additions. At this rate the algorithm is most certainly slower than Barrett reduction and not terribly useful. -Fortunately there exists an alternative representation of the algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified I). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($2^k > n$) \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If the $t$'th bit of $x$ is one then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + 2^tn$ \\ -2. Return $x/2^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified I)} -\end{figure} - -This algorithm is equivalent since $2^tn$ is a multiple of $n$ and the lower $k$ bits of $x$ are zero by step 2. The number of single -precision shifts has now been reduced from $2k^2$ to $k^2 + k$ which is only a small improvement. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|r|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} & \textbf{Result ($x$) in Binary} \\ -\hline -- & $5555$ & $1010110110011$ \\ -\hline $1$ & $x + 2^{0}n = 5812$ & $1011010110100$ \\ -\hline $2$ & $5812$ & $1011010110100$ \\ -\hline $3$ & $x + 2^{2}n = 6840$ & $1101010111000$ \\ -\hline $4$ & $x + 2^{3}n = 8896$ & $10001011000000$ \\ -\hline $5$ & $8896$ & $10001011000000$ \\ -\hline $6$ & $8896$ & $10001011000000$ \\ -\hline $7$ & $x + 2^{6}n = 25344$ & $110001100000000$ \\ -\hline $8$ & $25344$ & $110001100000000$ \\ -\hline $9$ & $x + 2^{7}n = 91136$ & $10110010000000000$ \\ -\hline -- & $x/2^k = 178$ & \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (II)} -\label{fig:MONT2} -\end{figure} - -Figure~\ref{fig:MONT2} demonstrates the modified algorithm reducing $x = 5555$ modulo $n = 257$ with $k = 9$. -With this algorithm a single shift right at the end is the only right shift required to reduce the input instead of $k$ right shifts inside the -loop. Note that for the iterations $t = 2, 5, 6$ and $8$ where the result $x$ is not changed. In those iterations the $t$'th bit of $x$ is -zero and the appropriate multiple of $n$ does not need to be added to force the $t$'th bit of the result to zero. - -\subsection{Digit Based Montgomery Reduction} -Instead of computing the reduction on a bit-by-bit basis it is actually much faster to compute it on digit-by-digit basis. Consider the -previous algorithm re-written to compute the Montgomery reduction in this new fashion. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified II). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($\beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $x \leftarrow x + \mu n \beta^t$ \\ -2. Return $x/\beta^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified II)} -\end{figure} - -The value $\mu n \beta^t$ is a multiple of the modulus $n$ meaning that it will not change the residue. If the first digit of -the value $\mu n \beta^t$ equals the negative (modulo $\beta$) of the $t$'th digit of $x$ then the addition will result in a zero digit. This -problem breaks down to solving the following congruency. - -\begin{center} -\begin{tabular}{rcl} -$x_t + \mu n_0$ & $\equiv$ & $0 \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu n_0$ & $\equiv$ & $-x_t \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu$ & $\equiv$ & $-x_t/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\end{tabular} -\end{center} - -In each iteration of the loop on step 1 a new value of $\mu$ must be calculated. The value of $-1/n_0 \mbox{ (mod }\beta\mbox{)}$ is used -extensively in this algorithm and should be precomputed. Let $\rho$ represent the negative of the modular inverse of $n_0$ modulo $\beta$. - -For example, let $\beta = 10$ represent the radix. Let $n = 17$ represent the modulus which implies $k = 2$ and $\rho \equiv 7$. Let $x = 33$ -represent the value to reduce. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Step ($t$)} & \textbf{Value of $x$} & \textbf{Value of $\mu$} \\ -\hline -- & $33$ & --\\ -\hline $0$ & $33 + \mu n = 50$ & $1$ \\ -\hline $1$ & $50 + \mu n \beta = 900$ & $5$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Montgomery Reduction} -\end{figure} - -The final result $900$ is then divided by $\beta^k$ to produce the final result $9$. The first observation is that $9 \nequiv x \mbox{ (mod }n\mbox{)}$ -which implies the result is not the modular residue of $x$ modulo $n$. However, recall that the residue is actually multiplied by $\beta^{-k}$ in -the algorithm. To get the true residue the value must be multiplied by $\beta^k$. In this case $\beta^k \equiv 15 \mbox{ (mod }n\mbox{)}$ and -the correct residue is $9 \cdot 15 \equiv 16 \mbox{ (mod }n\mbox{)}$. - -\subsection{Baseline Montgomery Reduction} -The baseline Montgomery reduction algorithm will produce the residue for any size input. It is designed to be a catch-all algororithm for -Montgomery reductions. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. $digs \leftarrow 2n.used + 1$ \\ -2. If $digs < MP\_ARRAY$ and $m.used < \delta$ then \\ -\hspace{3mm}2.1 Use algorithm fast\_mp\_montgomery\_reduce instead. \\ -\\ -Setup $x$ for the reduction. \\ -3. If $x.alloc < digs$ then grow $x$ to $digs$ digits. \\ -4. $x.used \leftarrow digs$ \\ -\\ -Eliminate the lower $k$ digits. \\ -5. For $ix$ from $0$ to $k - 1$ do \\ -\hspace{3mm}5.1 $\mu \leftarrow x_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.2 $u \leftarrow 0$ \\ -\hspace{3mm}5.3 For $iy$ from $0$ to $k - 1$ do \\ -\hspace{6mm}5.3.1 $\hat r \leftarrow \mu n_{iy} + x_{ix + iy} + u$ \\ -\hspace{6mm}5.3.2 $x_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.3.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.4 While $u > 0$ do \\ -\hspace{6mm}5.4.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}5.4.2 $x_{ix + iy} \leftarrow x_{ix + iy} + u$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor x_{ix+iy} / \beta \rfloor$ \\ -\hspace{6mm}5.4.4 $x_{ix + iy} \leftarrow x_{ix+iy} \mbox{ (mod }\beta\mbox{)}$ \\ -\\ -Divide by $\beta^k$ and fix up as required. \\ -6. $x \leftarrow \lfloor x / \beta^k \rfloor$ \\ -7. If $x \ge n$ then \\ -\hspace{3mm}7.1 $x \leftarrow x - n$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_reduce.} -This algorithm reduces the input $x$ modulo $n$ in place using the Montgomery reduction algorithm. The algorithm is loosely based -on algorithm 14.32 of \cite[pp.601]{HAC} except it merges the multiplication of $\mu n \beta^t$ with the addition in the inner loop. The -restrictions on this algorithm are fairly easy to adapt to. First $0 \le x < n^2$ bounds the input to numbers in the same range as -for the Barrett algorithm. Additionally if $n > 1$ and $n$ is odd there will exist a modular inverse $\rho$. $\rho$ must be calculated in -advance of this algorithm. Finally the variable $k$ is fixed and a pseudonym for $n.used$. - -Step 2 decides whether a faster Montgomery algorithm can be used. It is based on the Comba technique meaning that there are limits on -the size of the input. This algorithm is discussed in sub-section 6.3.3. - -Step 5 is the main reduction loop of the algorithm. The value of $\mu$ is calculated once per iteration in the outer loop. The inner loop -calculates $x + \mu n \beta^{ix}$ by multiplying $\mu n$ and adding the result to $x$ shifted by $ix$ digits. Both the addition and -multiplication are performed in the same loop to save time and memory. Step 5.4 will handle any additional carries that escape the inner loop. - -Using a quick inspection this algorithm requires $n$ single precision multiplications for the outer loop and $n^2$ single precision multiplications -in the inner loop. In total $n^2 + n$ single precision multiplications which compares favourably to Barrett at $n^2 + 2n - 1$ single precision -multiplications. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_montgomery\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -018 int -019 mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -020 \{ -021 int ix, res, digs; -022 mp_digit mu; -023 -024 /* can the fast reduction [comba] method be used? -025 * -026 * Note that unlike in mul you're safely allowed *less* -027 * than the available columns [255 per default] since carries -028 * are fixed up in the inner loop. -029 */ -030 digs = (n->used * 2) + 1; -031 if ((digs < MP_WARRAY) && -032 (n->used < -033 (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) \{ -034 return fast_mp_montgomery_reduce (x, n, rho); -035 \} -036 -037 /* grow the input as required */ -038 if (x->alloc < digs) \{ -039 if ((res = mp_grow (x, digs)) != MP_OKAY) \{ -040 return res; -041 \} -042 \} -043 x->used = digs; -044 -045 for (ix = 0; ix < n->used; ix++) \{ -046 /* mu = ai * rho mod b -047 * -048 * The value of rho must be precalculated via -049 * montgomery_setup() such that -050 * it equals -1/n0 mod b this allows the -051 * following inner loop to reduce the -052 * input one digit at a time -053 */ -054 mu = (mp_digit) (((mp_word)x->dp[ix] * (mp_word)rho) & MP_MASK); -055 -056 /* a = a + mu * m * b**i */ -057 \{ -058 int iy; -059 mp_digit *tmpn, *tmpx, u; -060 mp_word r; -061 -062 /* alias for digits of the modulus */ -063 tmpn = n->dp; -064 -065 /* alias for the digits of x [the input] */ -066 tmpx = x->dp + ix; -067 -068 /* set the carry to zero */ -069 u = 0; -070 -071 /* Multiply and add in place */ -072 for (iy = 0; iy < n->used; iy++) \{ -073 /* compute product and sum */ -074 r = ((mp_word)mu * (mp_word)*tmpn++) + -075 (mp_word) u + (mp_word) *tmpx; -076 -077 /* get carry */ -078 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -079 -080 /* fix digit */ -081 *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); -082 \} -083 /* At this point the ix'th digit of x should be zero */ -084 -085 -086 /* propagate carries upwards as required*/ -087 while (u != 0) \{ -088 *tmpx += u; -089 u = *tmpx >> DIGIT_BIT; -090 *tmpx++ &= MP_MASK; -091 \} -092 \} -093 \} -094 -095 /* at this point the n.used'th least -096 * significant digits of x are all zero -097 * which means we can shift x to the -098 * right by n.used digits and the -099 * residue is unchanged. -100 */ -101 -102 /* x = x/b**n.used */ -103 mp_clamp(x); -104 mp_rshd (x, n->used); -105 -106 /* if x >= n then x = x - n */ -107 if (mp_cmp_mag (x, n) != MP_LT) \{ -108 return s_mp_sub (x, n, x); -109 \} -110 -111 return MP_OKAY; -112 \} -113 #endif -114 -\end{alltt} -\end{small} - -This is the baseline implementation of the Montgomery reduction algorithm. Lines 30 to 35 determine if the Comba based -routine can be used instead. Line 48 computes the value of $\mu$ for that particular iteration of the outer loop. - -The multiplication $\mu n \beta^{ix}$ is performed in one step in the inner loop. The alias $tmpx$ refers to the $ix$'th digit of $x$ and -the alias $tmpn$ refers to the modulus $n$. - -\subsection{Faster ``Comba'' Montgomery Reduction} - -The Montgomery reduction requires fewer single precision multiplications than a Barrett reduction, however it is much slower due to the serial -nature of the inner loop. The Barrett reduction algorithm requires two slightly modified multipliers which can be implemented with the Comba -technique. The Montgomery reduction algorithm cannot directly use the Comba technique to any significant advantage since the inner loop calculates -a $k \times 1$ product $k$ times. - -The biggest obstacle is that at the $ix$'th iteration of the outer loop the value of $x_{ix}$ is required to calculate $\mu$. This means the -carries from $0$ to $ix - 1$ must have been propagated upwards to form a valid $ix$'th digit. The solution as it turns out is very simple. -Perform a Comba like multiplier and inside the outer loop just after the inner loop fix up the $ix + 1$'th digit by forwarding the carry. - -With this change in place the Montgomery reduction algorithm can be performed with a Comba style multiplication loop which substantially increases -the speed of the algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_word variables called $\hat W$ on the stack. \\ -1. if $x.alloc < n.used + 1$ then grow $x$ to $n.used + 1$ digits. \\ -Copy the digits of $x$ into the array $\hat W$ \\ -2. For $ix$ from $0$ to $x.used - 1$ do \\ -\hspace{3mm}2.1 $\hat W_{ix} \leftarrow x_{ix}$ \\ -3. For $ix$ from $x.used$ to $2n.used - 1$ do \\ -\hspace{3mm}3.1 $\hat W_{ix} \leftarrow 0$ \\ -Elimiate the lower $k$ digits. \\ -4. for $ix$ from $0$ to $n.used - 1$ do \\ -\hspace{3mm}4.1 $\mu \leftarrow \hat W_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.2 For $iy$ from $0$ to $n.used - 1$ do \\ -\hspace{6mm}4.2.1 $\hat W_{iy + ix} \leftarrow \hat W_{iy + ix} + \mu \cdot n_{iy}$ \\ -\hspace{3mm}4.3 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Propagate carries upwards. \\ -5. for $ix$ from $n.used$ to $2n.used + 1$ do \\ -\hspace{3mm}5.1 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Shift right and reduce modulo $\beta$ simultaneously. \\ -6. for $ix$ from $0$ to $n.used + 1$ do \\ -\hspace{3mm}6.1 $x_{ix} \leftarrow \hat W_{ix + n.used} \mbox{ (mod }\beta\mbox{)}$ \\ -Zero excess digits and fixup $x$. \\ -7. if $x.used > n.used + 1$ then do \\ -\hspace{3mm}7.1 for $ix$ from $n.used + 1$ to $x.used - 1$ do \\ -\hspace{6mm}7.1.1 $x_{ix} \leftarrow 0$ \\ -8. $x.used \leftarrow n.used + 1$ \\ -9. Clamp excessive digits of $x$. \\ -10. If $x \ge n$ then \\ -\hspace{3mm}10.1 $x \leftarrow x - n$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm fast\_mp\_montgomery\_reduce.} -This algorithm will compute the Montgomery reduction of $x$ modulo $n$ using the Comba technique. It is on most computer platforms significantly -faster than algorithm mp\_montgomery\_reduce and algorithm mp\_reduce (\textit{Barrett reduction}). The algorithm has the same restrictions -on the input as the baseline reduction algorithm. An additional two restrictions are imposed on this algorithm. The number of digits $k$ in the -the modulus $n$ must not violate $MP\_WARRAY > 2k +1$ and $n < \delta$. When $\beta = 2^{28}$ this algorithm can be used to reduce modulo -a modulus of at most $3,556$ bits in length. - -As in the other Comba reduction algorithms there is a $\hat W$ array which stores the columns of the product. It is initially filled with the -contents of $x$ with the excess digits zeroed. The reduction loop is very similar the to the baseline loop at heart. The multiplication on step -4.1 can be single precision only since $ab \mbox{ (mod }\beta\mbox{)} \equiv (a \mbox{ mod }\beta)(b \mbox{ mod }\beta)$. Some multipliers such -as those on the ARM processors take a variable length time to complete depending on the number of bytes of result it must produce. By performing -a single precision multiplication instead half the amount of time is spent. - -Also note that digit $\hat W_{ix}$ must have the carry from the $ix - 1$'th digit propagated upwards in order for this to work. That is what step -4.3 will do. In effect over the $n.used$ iterations of the outer loop the $n.used$'th lower columns all have the their carries propagated forwards. Note -how the upper bits of those same words are not reduced modulo $\beta$. This is because those values will be discarded shortly and there is no -point. - -Step 5 will propagate the remainder of the carries upwards. On step 6 the columns are reduced modulo $\beta$ and shifted simultaneously as they are -stored in the destination $x$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_fast\_mp\_montgomery\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes xR**-1 == x (mod N) via Montgomery Reduction -018 * -019 * This is an optimized implementation of montgomery_reduce -020 * which uses the comba method to quickly calculate the columns of the -021 * reduction. -022 * -023 * Based on Algorithm 14.32 on pp.601 of HAC. -024 */ -025 int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -026 \{ -027 int ix, res, olduse; -028 mp_word W[MP_WARRAY]; -029 -030 /* get old used count */ -031 olduse = x->used; -032 -033 /* grow a as required */ -034 if (x->alloc < (n->used + 1)) \{ -035 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) \{ -036 return res; -037 \} -038 \} -039 -040 /* first we have to get the digits of the input into -041 * an array of double precision words W[...] -042 */ -043 \{ -044 mp_word *_W; -045 mp_digit *tmpx; -046 -047 /* alias for the W[] array */ -048 _W = W; -049 -050 /* alias for the digits of x*/ -051 tmpx = x->dp; -052 -053 /* copy the digits of a into W[0..a->used-1] */ -054 for (ix = 0; ix < x->used; ix++) \{ -055 *_W++ = *tmpx++; -056 \} -057 -058 /* zero the high words of W[a->used..m->used*2] */ -059 for (; ix < ((n->used * 2) + 1); ix++) \{ -060 *_W++ = 0; -061 \} -062 \} -063 -064 /* now we proceed to zero successive digits -065 * from the least significant upwards -066 */ -067 for (ix = 0; ix < n->used; ix++) \{ -068 /* mu = ai * m' mod b -069 * -070 * We avoid a double precision multiplication (which isn't required) -071 * by casting the value down to a mp_digit. Note this requires -072 * that W[ix-1] have the carry cleared (see after the inner loop) -073 */ -074 mp_digit mu; -075 mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); -076 -077 /* a = a + mu * m * b**i -078 * -079 * This is computed in place and on the fly. The multiplication -080 * by b**i is handled by offseting which columns the results -081 * are added to. -082 * -083 * Note the comba method normally doesn't handle carries in the -084 * inner loop In this case we fix the carry from the previous -085 * column since the Montgomery reduction requires digits of the -086 * result (so far) [see above] to work. This is -087 * handled by fixing up one carry after the inner loop. The -088 * carry fixups are done in order so after these loops the -089 * first m->used words of W[] have the carries fixed -090 */ -091 \{ -092 int iy; -093 mp_digit *tmpn; -094 mp_word *_W; -095 -096 /* alias for the digits of the modulus */ -097 tmpn = n->dp; -098 -099 /* Alias for the columns set by an offset of ix */ -100 _W = W + ix; -101 -102 /* inner loop */ -103 for (iy = 0; iy < n->used; iy++) \{ -104 *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); -105 \} -106 \} -107 -108 /* now fix carry for next digit, W[ix+1] */ -109 W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); -110 \} -111 -112 /* now we have to propagate the carries and -113 * shift the words downward [all those least -114 * significant digits we zeroed]. -115 */ -116 \{ -117 mp_digit *tmpx; -118 mp_word *_W, *_W1; -119 -120 /* nox fix rest of carries */ -121 -122 /* alias for current word */ -123 _W1 = W + ix; -124 -125 /* alias for next word, where the carry goes */ -126 _W = W + ++ix; -127 -128 for (; ix <= ((n->used * 2) + 1); ix++) \{ -129 *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); -130 \} -131 -132 /* copy out, A = A/b**n -133 * -134 * The result is A/b**n but instead of converting from an -135 * array of mp_word to mp_digit than calling mp_rshd -136 * we just copy them in the right order -137 */ -138 -139 /* alias for destination word */ -140 tmpx = x->dp; -141 -142 /* alias for shifted double precision result */ -143 _W = W + n->used; -144 -145 for (ix = 0; ix < (n->used + 1); ix++) \{ -146 *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); -147 \} -148 -149 /* zero oldused digits, if the input a was larger than -150 * m->used+1 we'll have to clear the digits -151 */ -152 for (; ix < olduse; ix++) \{ -153 *tmpx++ = 0; -154 \} -155 \} -156 -157 /* set the max used and clamp */ -158 x->used = n->used + 1; -159 mp_clamp (x); -160 -161 /* if A >= m then A = A - m */ -162 if (mp_cmp_mag (x, n) != MP_LT) \{ -163 return s_mp_sub (x, n, x); -164 \} -165 return MP_OKAY; -166 \} -167 #endif -168 -\end{alltt} -\end{small} - -The $\hat W$ array is first filled with digits of $x$ on line 50 then the rest of the digits are zeroed on line 54. Both loops share -the same alias variables to make the code easier to read. - -The value of $\mu$ is calculated in an interesting fashion. First the value $\hat W_{ix}$ is reduced modulo $\beta$ and cast to a mp\_digit. This -forces the compiler to use a single precision multiplication and prevents any concerns about loss of precision. Line 109 fixes the carry -for the next iteration of the loop by propagating the carry from $\hat W_{ix}$ to $\hat W_{ix+1}$. - -The for loop on line 108 propagates the rest of the carries upwards through the columns. The for loop on line 125 reduces the columns -modulo $\beta$ and shifts them $k$ places at the same time. The alias $\_ \hat W$ actually refers to the array $\hat W$ starting at the $n.used$'th -digit, that is $\_ \hat W_{t} = \hat W_{n.used + t}$. - -\subsection{Montgomery Setup} -To calculate the variable $\rho$ a relatively simple algorithm will be required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_setup}. \\ -\textbf{Input}. mp\_int $n$ ($n > 1$ and $(n, 2) = 1$) \\ -\textbf{Output}. $\rho \equiv -1/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\hline \\ -1. $b \leftarrow n_0$ \\ -2. If $b$ is even return(\textit{MP\_VAL}) \\ -3. $x \leftarrow (((b + 2) \mbox{ AND } 4) << 1) + b$ \\ -4. for $k$ from 0 to $\lceil lg(lg(\beta)) \rceil - 2$ do \\ -\hspace{3mm}4.1 $x \leftarrow x \cdot (2 - bx)$ \\ -5. $\rho \leftarrow \beta - x \mbox{ (mod }\beta\mbox{)}$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_setup} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_setup.} -This algorithm will calculate the value of $\rho$ required within the Montgomery reduction algorithms. It uses a very interesting trick -to calculate $1/n_0$ when $\beta$ is a power of two. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_montgomery\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* setups the montgomery reduction stuff */ -018 int -019 mp_montgomery_setup (mp_int * n, mp_digit * rho) -020 \{ -021 mp_digit x, b; -022 -023 /* fast inversion mod 2**k -024 * -025 * Based on the fact that -026 * -027 * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) -028 * => 2*X*A - X*X*A*A = 1 -029 * => 2*(1) - (1) = 1 -030 */ -031 b = n->dp[0]; -032 -033 if ((b & 1) == 0) \{ -034 return MP_VAL; -035 \} -036 -037 x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ -038 x *= 2 - (b * x); /* here x*a==1 mod 2**8 */ -039 #if !defined(MP_8BIT) -040 x *= 2 - (b * x); /* here x*a==1 mod 2**16 */ -041 #endif -042 #if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) -043 x *= 2 - (b * x); /* here x*a==1 mod 2**32 */ -044 #endif -045 #ifdef MP_64BIT -046 x *= 2 - (b * x); /* here x*a==1 mod 2**64 */ -047 #endif -048 -049 /* rho = -1/m mod b */ -050 *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; -051 -052 return MP_OKAY; -053 \} -054 #endif -055 -\end{alltt} -\end{small} - -This source code computes the value of $\rho$ required to perform Montgomery reduction. It has been modified to avoid performing excess -multiplications when $\beta$ is not the default 28-bits. - -\section{The Diminished Radix Algorithm} -The Diminished Radix method of modular reduction \cite{DRMET} is a fairly clever technique which can be more efficient than either the Barrett -or Montgomery methods for certain forms of moduli. The technique is based on the following simple congruence. - -\begin{equation} -(x \mbox{ mod } n) + k \lfloor x / n \rfloor \equiv x \mbox{ (mod }(n - k)\mbox{)} -\end{equation} - -This observation was used in the MMB \cite{MMB} block cipher to create a diffusion primitive. It used the fact that if $n = 2^{31}$ and $k=1$ that -then a x86 multiplier could produce the 62-bit product and use the ``shrd'' instruction to perform a double-precision right shift. The proof -of the above equation is very simple. First write $x$ in the product form. - -\begin{equation} -x = qn + r -\end{equation} - -Now reduce both sides modulo $(n - k)$. - -\begin{equation} -x \equiv qk + r \mbox{ (mod }(n-k)\mbox{)} -\end{equation} - -The variable $n$ reduces modulo $n - k$ to $k$. By putting $q = \lfloor x/n \rfloor$ and $r = x \mbox{ mod } n$ -into the equation the original congruence is reproduced, thus concluding the proof. The following algorithm is based on this observation. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Diminished Radix Reduction}. \\ -\textbf{Input}. Integer $x$, $n$, $k$ \\ -\textbf{Output}. $x \mbox{ mod } (n - k)$ \\ -\hline \\ -1. $q \leftarrow \lfloor x / n \rfloor$ \\ -2. $q \leftarrow k \cdot q$ \\ -3. $x \leftarrow x \mbox{ (mod }n\mbox{)}$ \\ -4. $x \leftarrow x + q$ \\ -5. If $x \ge (n - k)$ then \\ -\hspace{3mm}5.1 $x \leftarrow x - (n - k)$ \\ -\hspace{3mm}5.2 Goto step 1. \\ -6. Return $x$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Diminished Radix Reduction} -\label{fig:DR} -\end{figure} - -This algorithm will reduce $x$ modulo $n - k$ and return the residue. If $0 \le x < (n - k)^2$ then the algorithm will loop almost always -once or twice and occasionally three times. For simplicity sake the value of $x$ is bounded by the following simple polynomial. - -\begin{equation} -0 \le x < n^2 + k^2 - 2nk -\end{equation} - -The true bound is $0 \le x < (n - k - 1)^2$ but this has quite a few more terms. The value of $q$ after step 1 is bounded by the following. - -\begin{equation} -q < n - 2k - k^2/n -\end{equation} - -Since $k^2$ is going to be considerably smaller than $n$ that term will always be zero. The value of $x$ after step 3 is bounded trivially as -$0 \le x < n$. By step four the sum $x + q$ is bounded by - -\begin{equation} -0 \le q + x < (k + 1)n - 2k^2 - 1 -\end{equation} - -With a second pass $q$ will be loosely bounded by $0 \le q < k^2$ after step 2 while $x$ will still be loosely bounded by $0 \le x < n$ after step 3. After the second pass it is highly unlike that the -sum in step 4 will exceed $n - k$. In practice fewer than three passes of the algorithm are required to reduce virtually every input in the -range $0 \le x < (n - k - 1)^2$. - -\begin{figure} -\begin{small} -\begin{center} -\begin{tabular}{|l|} -\hline -$x = 123456789, n = 256, k = 3$ \\ -\hline $q \leftarrow \lfloor x/n \rfloor = 482253$ \\ -$q \leftarrow q*k = 1446759$ \\ -$x \leftarrow x \mbox{ mod } n = 21$ \\ -$x \leftarrow x + q = 1446780$ \\ -$x \leftarrow x - (n - k) = 1446527$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 5650$ \\ -$q \leftarrow q*k = 16950$ \\ -$x \leftarrow x \mbox{ mod } n = 127$ \\ -$x \leftarrow x + q = 17077$ \\ -$x \leftarrow x - (n - k) = 16824$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 65$ \\ -$q \leftarrow q*k = 195$ \\ -$x \leftarrow x \mbox{ mod } n = 184$ \\ -$x \leftarrow x + q = 379$ \\ -$x \leftarrow x - (n - k) = 126$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example Diminished Radix Reduction} -\label{fig:EXDR} -\end{figure} - -Figure~\ref{fig:EXDR} demonstrates the reduction of $x = 123456789$ modulo $n - k = 253$ when $n = 256$ and $k = 3$. Note that even while $x$ -is considerably larger than $(n - k - 1)^2 = 63504$ the algorithm still converges on the modular residue exceedingly fast. In this case only -three passes were required to find the residue $x \equiv 126$. - - -\subsection{Choice of Moduli} -On the surface this algorithm looks like a very expensive algorithm. It requires a couple of subtractions followed by multiplication and other -modular reductions. The usefulness of this algorithm becomes exceedingly clear when an appropriate modulus is chosen. - -Division in general is a very expensive operation to perform. The one exception is when the division is by a power of the radix of representation used. -Division by ten for example is simple for pencil and paper mathematics since it amounts to shifting the decimal place to the right. Similarly division -by two (\textit{or powers of two}) is very simple for binary computers to perform. It would therefore seem logical to choose $n$ of the form $2^p$ -which would imply that $\lfloor x / n \rfloor$ is a simple shift of $x$ right $p$ bits. - -However, there is one operation related to division of power of twos that is even faster than this. If $n = \beta^p$ then the division may be -performed by moving whole digits to the right $p$ places. In practice division by $\beta^p$ is much faster than division by $2^p$ for any $p$. -Also with the choice of $n = \beta^p$ reducing $x$ modulo $n$ merely requires zeroing the digits above the $p-1$'th digit of $x$. - -Throughout the next section the term ``restricted modulus'' will refer to a modulus of the form $\beta^p - k$ whereas the term ``unrestricted -modulus'' will refer to a modulus of the form $2^p - k$. The word ``restricted'' in this case refers to the fact that it is based on the -$2^p$ logic except $p$ must be a multiple of $lg(\beta)$. - -\subsection{Choice of $k$} -Now that division and reduction (\textit{step 1 and 3 of figure~\ref{fig:DR}}) have been optimized to simple digit operations the multiplication by $k$ -in step 2 is the most expensive operation. Fortunately the choice of $k$ is not terribly limited. For all intents and purposes it might -as well be a single digit. The smaller the value of $k$ is the faster the algorithm will be. - -\subsection{Restricted Diminished Radix Reduction} -The restricted Diminished Radix algorithm can quickly reduce an input modulo a modulus of the form $n = \beta^p - k$. This algorithm can reduce -an input $x$ within the range $0 \le x < n^2$ using only a couple passes of the algorithm demonstrated in figure~\ref{fig:DR}. The implementation -of this algorithm has been optimized to avoid additional overhead associated with a division by $\beta^p$, the multiplication by $k$ or the addition -of $x$ and $q$. The resulting algorithm is very efficient and can lead to substantial improvements over Barrett and Montgomery reduction when modular -exponentiations are performed. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_reduce}. \\ -\textbf{Input}. mp\_int $x$, $n$ and a mp\_digit $k = \beta - n_0$ \\ -\hspace{11.5mm}($0 \le x < n^2$, $n > 1$, $0 < k < \beta$) \\ -\textbf{Output}. $x \mbox{ mod } n$ \\ -\hline \\ -1. $m \leftarrow n.used$ \\ -2. If $x.alloc < 2m$ then grow $x$ to $2m$ digits. \\ -3. $\mu \leftarrow 0$ \\ -4. for $i$ from $0$ to $m - 1$ do \\ -\hspace{3mm}4.1 $\hat r \leftarrow k \cdot x_{m+i} + x_{i} + \mu$ \\ -\hspace{3mm}4.2 $x_{i} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. $x_{m} \leftarrow \mu$ \\ -6. for $i$ from $m + 1$ to $x.used - 1$ do \\ -\hspace{3mm}6.1 $x_{i} \leftarrow 0$ \\ -7. Clamp excess digits of $x$. \\ -8. If $x \ge n$ then \\ -\hspace{3mm}8.1 $x \leftarrow x - n$ \\ -\hspace{3mm}8.2 Goto step 3. \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_reduce} -\end{figure} - -\textbf{Algorithm mp\_dr\_reduce.} -This algorithm will perform the Dimished Radix reduction of $x$ modulo $n$. It has similar restrictions to that of the Barrett reduction -with the addition that $n$ must be of the form $n = \beta^m - k$ where $0 < k <\beta$. - -This algorithm essentially implements the pseudo-code in figure~\ref{fig:DR} except with a slight optimization. The division by $\beta^m$, multiplication by $k$ -and addition of $x \mbox{ mod }\beta^m$ are all performed simultaneously inside the loop on step 4. The division by $\beta^m$ is emulated by accessing -the term at the $m+i$'th position which is subsequently multiplied by $k$ and added to the term at the $i$'th position. After the loop the $m$'th -digit is set to the carry and the upper digits are zeroed. Steps 5 and 6 emulate the reduction modulo $\beta^m$ that should have happend to -$x$ before the addition of the multiple of the upper half. - -At step 8 if $x$ is still larger than $n$ another pass of the algorithm is required. First $n$ is subtracted from $x$ and then the algorithm resumes -at step 3. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_dr\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* reduce "x" in place modulo "n" using the Diminished Radix algorithm. -018 * -019 * Based on algorithm from the paper -020 * -021 * "Generating Efficient Primes for Discrete Log Cryptosystems" -022 * Chae Hoon Lim, Pil Joong Lee, -023 * POSTECH Information Research Laboratories -024 * -025 * The modulus must be of a special format [see manual] -026 * -027 * Has been modified to use algorithm 7.10 from the LTM book instead -028 * -029 * Input x must be in the range 0 <= x <= (n-1)**2 -030 */ -031 int -032 mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k) -033 \{ -034 int err, i, m; -035 mp_word r; -036 mp_digit mu, *tmpx1, *tmpx2; -037 -038 /* m = digits in modulus */ -039 m = n->used; -040 -041 /* ensure that "x" has at least 2m digits */ -042 if (x->alloc < (m + m)) \{ -043 if ((err = mp_grow (x, m + m)) != MP_OKAY) \{ -044 return err; -045 \} -046 \} -047 -048 /* top of loop, this is where the code resumes if -049 * another reduction pass is required. -050 */ -051 top: -052 /* aliases for digits */ -053 /* alias for lower half of x */ -054 tmpx1 = x->dp; -055 -056 /* alias for upper half of x, or x/B**m */ -057 tmpx2 = x->dp + m; -058 -059 /* set carry to zero */ -060 mu = 0; -061 -062 /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ -063 for (i = 0; i < m; i++) \{ -064 r = (((mp_word)*tmpx2++) * (mp_word)k) + *tmpx1 + mu; -065 *tmpx1++ = (mp_digit)(r & MP_MASK); -066 mu = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); -067 \} -068 -069 /* set final carry */ -070 *tmpx1++ = mu; -071 -072 /* zero words above m */ -073 for (i = m + 1; i < x->used; i++) \{ -074 *tmpx1++ = 0; -075 \} -076 -077 /* clamp, sub and return */ -078 mp_clamp (x); -079 -080 /* if x >= n then subtract and reduce again -081 * Each successive "recursion" makes the input smaller and smaller. -082 */ -083 if (mp_cmp_mag (x, n) != MP_LT) \{ -084 if ((err = s_mp_sub(x, n, x)) != MP_OKAY) \{ -085 return err; -086 \} -087 goto top; -088 \} -089 return MP_OKAY; -090 \} -091 #endif -092 -\end{alltt} -\end{small} - -The first step is to grow $x$ as required to $2m$ digits since the reduction is performed in place on $x$. The label on line 51 is where -the algorithm will resume if further reduction passes are required. In theory it could be placed at the top of the function however, the size of -the modulus and question of whether $x$ is large enough are invariant after the first pass meaning that it would be a waste of time. - -The aliases $tmpx1$ and $tmpx2$ refer to the digits of $x$ where the latter is offset by $m$ digits. By reading digits from $x$ offset by $m$ digits -a division by $\beta^m$ can be simulated virtually for free. The loop on line 63 performs the bulk of the work (\textit{corresponds to step 4 of algorithm 7.11}) -in this algorithm. - -By line 70 the pointer $tmpx1$ points to the $m$'th digit of $x$ which is where the final carry will be placed. Similarly by line 73 the -same pointer will point to the $m+1$'th digit where the zeroes will be placed. - -Since the algorithm is only valid if both $x$ and $n$ are greater than zero an unsigned comparison suffices to determine if another pass is required. -With the same logic at line 84 the value of $x$ is known to be greater than or equal to $n$ meaning that an unsigned subtraction can be used -as well. Since the destination of the subtraction is the larger of the inputs the call to algorithm s\_mp\_sub cannot fail and the return code -does not need to be checked. - -\subsubsection{Setup} -To setup the restricted Diminished Radix algorithm the value $k = \beta - n_0$ is required. This algorithm is not really complicated but provided for -completeness. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = \beta - n_0$ \\ -\hline \\ -1. $k \leftarrow \beta - n_0$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_setup} -\end{figure} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_dr\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines the setup value */ -018 void mp_dr_setup(mp_int *a, mp_digit *d) -019 \{ -020 /* the casts are required if DIGIT_BIT is one less than -021 * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] -022 */ -023 *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - -024 ((mp_word)a->dp[0])); -025 \} -026 -027 #endif -028 -\end{alltt} -\end{small} - -\subsubsection{Modulus Detection} -Another algorithm which will be useful is the ability to detect a restricted Diminished Radix modulus. An integer is said to be -of restricted Diminished Radix form if all of the digits are equal to $\beta - 1$ except the trailing digit which may be any value. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_is\_modulus}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if $n$ is in D.R form, $0$ otherwise \\ -\hline -1. If $n.used < 2$ then return($0$). \\ -2. for $ix$ from $1$ to $n.used - 1$ do \\ -\hspace{3mm}2.1 If $n_{ix} \ne \beta - 1$ return($0$). \\ -3. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_is\_modulus} -\end{figure} - -\textbf{Algorithm mp\_dr\_is\_modulus.} -This algorithm determines if a value is in Diminished Radix form. Step 1 rejects obvious cases where fewer than two digits are -in the mp\_int. Step 2 tests all but the first digit to see if they are equal to $\beta - 1$. If the algorithm manages to get to -step 3 then $n$ must be of Diminished Radix form. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_dr\_is\_modulus.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines if a number is a valid DR modulus */ -018 int mp_dr_is_modulus(mp_int *a) -019 \{ -020 int ix; -021 -022 /* must be at least two digits */ -023 if (a->used < 2) \{ -024 return 0; -025 \} -026 -027 /* must be of the form b**k - a [a <= b] so all -028 * but the first digit must be equal to -1 (mod b). -029 */ -030 for (ix = 1; ix < a->used; ix++) \{ -031 if (a->dp[ix] != MP_MASK) \{ -032 return 0; -033 \} -034 \} -035 return 1; -036 \} -037 -038 #endif -039 -\end{alltt} -\end{small} - -\subsection{Unrestricted Diminished Radix Reduction} -The unrestricted Diminished Radix algorithm allows modular reductions to be performed when the modulus is of the form $2^p - k$. This algorithm -is a straightforward adaptation of algorithm~\ref{fig:DR}. - -In general the restricted Diminished Radix reduction algorithm is much faster since it has considerably lower overhead. However, this new -algorithm is much faster than either Montgomery or Barrett reduction when the moduli are of the appropriate form. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k}. \\ -\textbf{Input}. mp\_int $a$ and $n$. mp\_digit $k$ \\ -\hspace{11.5mm}($a \ge 0$, $n > 1$, $0 < k < \beta$, $n + k$ is a power of two) \\ -\textbf{Output}. $a \mbox{ (mod }n\mbox{)}$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. While $a \ge n$ do \\ -\hspace{3mm}2.1 $q \leftarrow \lfloor a / 2^p \rfloor$ (\textit{mp\_div\_2d}) \\ -\hspace{3mm}2.2 $a \leftarrow a \mbox{ (mod }2^p\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -\hspace{3mm}2.3 $q \leftarrow q \cdot k$ (\textit{mp\_mul\_d}) \\ -\hspace{3mm}2.4 $a \leftarrow a - q$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.5 If $a \ge n$ then do \\ -\hspace{6mm}2.5.1 $a \leftarrow a - n$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k.} -This algorithm quickly reduces an input $a$ modulo an unrestricted Diminished Radix modulus $n$. Division by $2^p$ is emulated with a right -shift which makes the algorithm fairly inexpensive to use. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_2k.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* reduces a modulo n where n is of the form 2**p - d */ -018 int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) -019 \{ -020 mp_int q; -021 int p, res; -022 -023 if ((res = mp_init(&q)) != MP_OKAY) \{ -024 return res; -025 \} -026 -027 p = mp_count_bits(n); -028 top: -029 /* q = a/2**p, a = a mod 2**p */ -030 if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) \{ -031 goto ERR; -032 \} -033 -034 if (d != 1) \{ -035 /* q = q * d */ -036 if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) \{ -037 goto ERR; -038 \} -039 \} -040 -041 /* a = a + q */ -042 if ((res = s_mp_add(a, &q, a)) != MP_OKAY) \{ -043 goto ERR; -044 \} -045 -046 if (mp_cmp_mag(a, n) != MP_LT) \{ -047 if ((res = s_mp_sub(a, n, a)) != MP_OKAY) \{ -048 goto ERR; -049 \} -050 goto top; -051 \} -052 -053 ERR: -054 mp_clear(&q); -055 return res; -056 \} -057 -058 #endif -059 -\end{alltt} -\end{small} - -The algorithm mp\_count\_bits calculates the number of bits in an mp\_int which is used to find the initial value of $p$. The call to mp\_div\_2d -on line 30 calculates both the quotient $q$ and the remainder $a$ required. By doing both in a single function call the code size -is kept fairly small. The multiplication by $k$ is only performed if $k > 1$. This allows reductions modulo $2^p - 1$ to be performed without -any multiplications. - -The unsigned s\_mp\_add, mp\_cmp\_mag and s\_mp\_sub are used in place of their full sign counterparts since the inputs are only valid if they are -positive. By using the unsigned versions the overhead is kept to a minimum. - -\subsubsection{Unrestricted Setup} -To setup this reduction algorithm the value of $k = 2^p - n$ is required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = 2^p - n$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. $x \leftarrow 2^p$ (\textit{mp\_2expt}) \\ -3. $x \leftarrow x - n$ (\textit{mp\_sub}) \\ -4. $k \leftarrow x_0$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k\_setup.} -This algorithm computes the value of $k$ required for the algorithm mp\_reduce\_2k. By making a temporary variable $x$ equal to $2^p$ a subtraction -is sufficient to solve for $k$. Alternatively if $n$ has more than one digit the value of $k$ is simply $\beta - n_0$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_2k\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines the setup value */ -018 int mp_reduce_2k_setup(mp_int *a, mp_digit *d) -019 \{ -020 int res, p; -021 mp_int tmp; -022 -023 if ((res = mp_init(&tmp)) != MP_OKAY) \{ -024 return res; -025 \} -026 -027 p = mp_count_bits(a); -028 if ((res = mp_2expt(&tmp, p)) != MP_OKAY) \{ -029 mp_clear(&tmp); -030 return res; -031 \} -032 -033 if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) \{ -034 mp_clear(&tmp); -035 return res; -036 \} -037 -038 *d = tmp.dp[0]; -039 mp_clear(&tmp); -040 return MP_OKAY; -041 \} -042 #endif -043 -\end{alltt} -\end{small} - -\subsubsection{Unrestricted Detection} -An integer $n$ is a valid unrestricted Diminished Radix modulus if either of the following are true. - -\begin{enumerate} -\item The number has only one digit. -\item The number has more than one digit and every bit from the $\beta$'th to the most significant is one. -\end{enumerate} - -If either condition is true than there is a power of two $2^p$ such that $0 < 2^p - n < \beta$. If the input is only -one digit than it will always be of the correct form. Otherwise all of the bits above the first digit must be one. This arises from the fact -that there will be value of $k$ that when added to the modulus causes a carry in the first digit which propagates all the way to the most -significant bit. The resulting sum will be a power of two. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_is\_2k}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if of proper form, $0$ otherwise \\ -\hline -1. If $n.used = 0$ then return($0$). \\ -2. If $n.used = 1$ then return($1$). \\ -3. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -4. for $x$ from $lg(\beta)$ to $p$ do \\ -\hspace{3mm}4.1 If the ($x \mbox{ mod }lg(\beta)$)'th bit of the $\lfloor x / lg(\beta) \rfloor$ of $n$ is zero then return($0$). \\ -5. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_is\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_is\_2k.} -This algorithm quickly determines if a modulus is of the form required for algorithm mp\_reduce\_2k to function properly. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_is\_2k.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines if mp_reduce_2k can be used */ -018 int mp_reduce_is_2k(mp_int *a) -019 \{ -020 int ix, iy, iw; -021 mp_digit iz; -022 -023 if (a->used == 0) \{ -024 return MP_NO; -025 \} else if (a->used == 1) \{ -026 return MP_YES; -027 \} else if (a->used > 1) \{ -028 iy = mp_count_bits(a); -029 iz = 1; -030 iw = 1; -031 -032 /* Test every bit from the second digit up, must be 1 */ -033 for (ix = DIGIT_BIT; ix < iy; ix++) \{ -034 if ((a->dp[iw] & iz) == 0) \{ -035 return MP_NO; -036 \} -037 iz <<= 1; -038 if (iz > (mp_digit)MP_MASK) \{ -039 ++iw; -040 iz = 1; -041 \} -042 \} -043 \} -044 return MP_YES; -045 \} -046 -047 #endif -048 -\end{alltt} -\end{small} - - - -\section{Algorithm Comparison} -So far three very different algorithms for modular reduction have been discussed. Each of the algorithms have their own strengths and weaknesses -that makes having such a selection very useful. The following table sumarizes the three algorithms along with comparisons of work factors. Since -all three algorithms have the restriction that $0 \le x < n^2$ and $n > 1$ those limitations are not included in the table. - -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Method} & \textbf{Work Required} & \textbf{Limitations} & \textbf{$m = 8$} & \textbf{$m = 32$} & \textbf{$m = 64$} \\ -\hline Barrett & $m^2 + 2m - 1$ & None & $79$ & $1087$ & $4223$ \\ -\hline Montgomery & $m^2 + m$ & $n$ must be odd & $72$ & $1056$ & $4160$ \\ -\hline D.R. & $2m$ & $n = \beta^m - k$ & $16$ & $64$ & $128$ \\ -\hline -\end{tabular} -\end{small} -\end{center} - -In theory Montgomery and Barrett reductions would require roughly the same amount of time to complete. However, in practice since Montgomery -reduction can be written as a single function with the Comba technique it is much faster. Barrett reduction suffers from the overhead of -calling the half precision multipliers, addition and division by $\beta$ algorithms. - -For almost every cryptographic algorithm Montgomery reduction is the algorithm of choice. The one set of algorithms where Diminished Radix reduction truly -shines are based on the discrete logarithm problem such as Diffie-Hellman \cite{DH} and ElGamal \cite{ELGAMAL}. In these algorithms -primes of the form $\beta^m - k$ can be found and shared amongst users. These primes will allow the Diminished Radix algorithm to be used in -modular exponentiation to greatly speed up the operation. - - - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ]$ & Prove that the ``trick'' in algorithm mp\_montgomery\_setup actually \\ - & calculates the correct value of $\rho$. \\ - & \\ -$\left [ 2 \right ]$ & Devise an algorithm to reduce modulo $n + k$ for small $k$ quickly. \\ - & \\ -$\left [ 4 \right ]$ & Prove that the pseudo-code algorithm ``Diminished Radix Reduction'' \\ - & (\textit{figure~\ref{fig:DR}}) terminates. Also prove the probability that it will \\ - & terminate within $1 \le k \le 10$ iterations. \\ - & \\ -\end{tabular} - - -\chapter{Exponentiation} -Exponentiation is the operation of raising one variable to the power of another, for example, $a^b$. A variant of exponentiation, computed -in a finite field or ring, is called modular exponentiation. This latter style of operation is typically used in public key -cryptosystems such as RSA and Diffie-Hellman. The ability to quickly compute modular exponentiations is of great benefit to any -such cryptosystem and many methods have been sought to speed it up. - -\section{Exponentiation Basics} -A trivial algorithm would simply multiply $a$ against itself $b - 1$ times to compute the exponentiation desired. However, as $b$ grows in size -the number of multiplications becomes prohibitive. Imagine what would happen if $b$ $\approx$ $2^{1024}$ as is the case when computing an RSA signature -with a $1024$-bit key. Such a calculation could never be completed as it would take simply far too long. - -Fortunately there is a very simple algorithm based on the laws of exponents. Recall that $lg_a(a^b) = b$ and that $lg_a(a^ba^c) = b + c$ which -are two trivial relationships between the base and the exponent. Let $b_i$ represent the $i$'th bit of $b$ starting from the least -significant bit. If $b$ is a $k$-bit integer than the following equation is true. - -\begin{equation} -a^b = \prod_{i=0}^{k-1} a^{2^i \cdot b_i} -\end{equation} - -By taking the base $a$ logarithm of both sides of the equation the following equation is the result. - -\begin{equation} -b = \sum_{i=0}^{k-1}2^i \cdot b_i -\end{equation} - -The term $a^{2^i}$ can be found from the $i - 1$'th term by squaring the term since $\left ( a^{2^i} \right )^2$ is equal to -$a^{2^{i+1}}$. This observation forms the basis of essentially all fast exponentiation algorithms. It requires $k$ squarings and on average -$k \over 2$ multiplications to compute the result. This is indeed quite an improvement over simply multiplying by $a$ a total of $b-1$ times. - -While this current method is a considerable speed up there are further improvements to be made. For example, the $a^{2^i}$ term does not need to -be computed in an auxilary variable. Consider the following equivalent algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Left to Right Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$ and $k$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $k - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 $c \leftarrow c \cdot a^{b_i}$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Left to Right Exponentiation} -\label{fig:LTOR} -\end{figure} - -This algorithm starts from the most significant bit and works towards the least significant bit. When the $i$'th bit of $b$ is set $a$ is -multiplied against the current product. In each iteration the product is squared which doubles the exponent of the individual terms of the -product. - -For example, let $b = 101100_2 \equiv 44_{10}$. The following chart demonstrates the actions of the algorithm. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|} -\hline \textbf{Value of $i$} & \textbf{Value of $c$} \\ -\hline - & $1$ \\ -\hline $5$ & $a$ \\ -\hline $4$ & $a^2$ \\ -\hline $3$ & $a^4 \cdot a$ \\ -\hline $2$ & $a^8 \cdot a^2 \cdot a$ \\ -\hline $1$ & $a^{16} \cdot a^4 \cdot a^2$ \\ -\hline $0$ & $a^{32} \cdot a^8 \cdot a^4$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Left to Right Exponentiation} -\end{figure} - -When the product $a^{32} \cdot a^8 \cdot a^4$ is simplified it is equal $a^{44}$ which is the desired exponentiation. This particular algorithm is -called ``Left to Right'' because it reads the exponent in that order. All of the exponentiation algorithms that will be presented are of this nature. - -\subsection{Single Digit Exponentiation} -The first algorithm in the series of exponentiation algorithms will be an unbounded algorithm where the exponent is a single digit. It is intended -to be used when a small power of an input is required (\textit{e.g. $a^5$}). It is faster than simply multiplying $b - 1$ times for all values of -$b$ that are greater than three. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_expt\_d}. \\ -\textbf{Input}. mp\_int $a$ and mp\_digit $b$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $g \leftarrow a$ (\textit{mp\_init\_copy}) \\ -2. $c \leftarrow 1$ (\textit{mp\_set}) \\ -3. for $x$ from 1 to $lg(\beta)$ do \\ -\hspace{3mm}3.1 $c \leftarrow c^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}3.2 If $b$ AND $2^{lg(\beta) - 1} \ne 0$ then \\ -\hspace{6mm}3.2.1 $c \leftarrow c \cdot g$ (\textit{mp\_mul}) \\ -\hspace{3mm}3.3 $b \leftarrow b << 1$ \\ -4. Clear $g$. \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_expt\_d} -\end{figure} - -\textbf{Algorithm mp\_expt\_d.} -This algorithm computes the value of $a$ raised to the power of a single digit $b$. It uses the left to right exponentiation algorithm to -quickly compute the exponentiation. It is loosely based on algorithm 14.79 of HAC \cite[pp. 615]{HAC} with the difference that the -exponent is a fixed width. - -A copy of $a$ is made first to allow destination variable $c$ be the same as the source variable $a$. The result is set to the initial value of -$1$ in the subsequent step. - -Inside the loop the exponent is read from the most significant bit first down to the least significant bit. First $c$ is invariably squared -on step 3.1. In the following step if the most significant bit of $b$ is one the copy of $a$ is multiplied against $c$. The value -of $b$ is shifted left one bit to make the next bit down from the most signficant bit the new most significant bit. In effect each -iteration of the loop moves the bits of the exponent $b$ upwards to the most significant location. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_expt\_d\_ex.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* calculate c = a**b using a square-multiply algorithm */ -018 int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) -019 \{ -020 int res; -021 unsigned int x; -022 -023 mp_int g; -024 -025 if ((res = mp_init_copy (&g, a)) != MP_OKAY) \{ -026 return res; -027 \} -028 -029 /* set initial result */ -030 mp_set (c, 1); -031 -032 if (fast != 0) \{ -033 while (b > 0) \{ -034 /* if the bit is set multiply */ -035 if ((b & 1) != 0) \{ -036 if ((res = mp_mul (c, &g, c)) != MP_OKAY) \{ -037 mp_clear (&g); -038 return res; -039 \} -040 \} -041 -042 /* square */ -043 if (b > 1) \{ -044 if ((res = mp_sqr (&g, &g)) != MP_OKAY) \{ -045 mp_clear (&g); -046 return res; -047 \} -048 \} -049 -050 /* shift to next bit */ -051 b >>= 1; -052 \} -053 \} -054 else \{ -055 for (x = 0; x < DIGIT_BIT; x++) \{ -056 /* square */ -057 if ((res = mp_sqr (c, c)) != MP_OKAY) \{ -058 mp_clear (&g); -059 return res; -060 \} -061 -062 /* if the bit is set multiply */ -063 if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) \{ -064 if ((res = mp_mul (c, &g, c)) != MP_OKAY) \{ -065 mp_clear (&g); -066 return res; -067 \} -068 \} -069 -070 /* shift to next bit */ -071 b <<= 1; -072 \} -073 \} /* if ... else */ -074 -075 mp_clear (&g); -076 return MP_OKAY; -077 \} -078 #endif -079 -\end{alltt} -\end{small} - -This describes only the algorithm that is used when the parameter $fast$ is $0$. Line 30 sets the initial value of the result to $1$. Next the loop on line 55 steps through each bit of the exponent starting from -the most significant down towards the least significant. The invariant squaring operation placed on line 57 is performed first. After -the squaring the result $c$ is multiplied by the base $g$ if and only if the most significant bit of the exponent is set. The shift on line -71 moves all of the bits of the exponent upwards towards the most significant location. - -\section{$k$-ary Exponentiation} -When calculating an exponentiation the most time consuming bottleneck is the multiplications which are in general a small factor -slower than squaring. Recall from the previous algorithm that $b_{i}$ refers to the $i$'th bit of the exponent $b$. Suppose instead it referred to -the $i$'th $k$-bit digit of the exponent of $b$. For $k = 1$ the definitions are synonymous and for $k > 1$ algorithm~\ref{fig:KARY} -computes the same exponentiation. A group of $k$ bits from the exponent is called a \textit{window}. That is it is a small window on only a -portion of the entire exponent. Consider the following modification to the basic left to right exponentiation algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{$k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^{2^k} $ \\ -\hspace{3mm}2.2 Extract the $i$'th $k$-bit word from $b$ and store it in $g$. \\ -\hspace{3mm}2.3 $c \leftarrow c \cdot a^g$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{$k$-ary Exponentiation} -\label{fig:KARY} -\end{figure} - -The squaring on step 2.1 can be calculated by squaring the value $c$ successively $k$ times. If the values of $a^g$ for $0 < g < 2^k$ have been -precomputed this algorithm requires only $t$ multiplications and $tk$ squarings. The table can be generated with $2^{k - 1} - 1$ squarings and -$2^{k - 1} + 1$ multiplications. This algorithm assumes that the number of bits in the exponent is evenly divisible by $k$. -However, when it is not the remaining $0 < x \le k - 1$ bits can be handled with algorithm~\ref{fig:LTOR}. - -Suppose $k = 4$ and $t = 100$. This modified algorithm will require $109$ multiplications and $408$ squarings to compute the exponentiation. The -original algorithm would on average have required $200$ multiplications and $400$ squrings to compute the same value. The total number of squarings -has increased slightly but the number of multiplications has nearly halved. - -\subsection{Optimal Values of $k$} -An optimal value of $k$ will minimize $2^{k} + \lceil n / k \rceil + n - 1$ for a fixed number of bits in the exponent $n$. The simplest -approach is to brute force search amongst the values $k = 2, 3, \ldots, 8$ for the lowest result. Table~\ref{fig:OPTK} lists optimal values of $k$ -for various exponent sizes and compares the number of multiplication and squarings required against algorithm~\ref{fig:LTOR}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:LTOR}} \\ -\hline $16$ & $2$ & $27$ & $24$ \\ -\hline $32$ & $3$ & $49$ & $48$ \\ -\hline $64$ & $3$ & $92$ & $96$ \\ -\hline $128$ & $4$ & $175$ & $192$ \\ -\hline $256$ & $4$ & $335$ & $384$ \\ -\hline $512$ & $5$ & $645$ & $768$ \\ -\hline $1024$ & $6$ & $1257$ & $1536$ \\ -\hline $2048$ & $6$ & $2452$ & $3072$ \\ -\hline $4096$ & $7$ & $4808$ & $6144$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for $k$-ary Exponentiation} -\label{fig:OPTK} -\end{figure} - -\subsection{Sliding-Window Exponentiation} -A simple modification to the previous algorithm is only generate the upper half of the table in the range $2^{k-1} \le g < 2^k$. Essentially -this is a table for all values of $g$ where the most significant bit of $g$ is a one. However, in order for this to be allowed in the -algorithm values of $g$ in the range $0 \le g < 2^{k-1}$ must be avoided. - -Table~\ref{fig:OPTK2} lists optimal values of $k$ for various exponent sizes and compares the work required against algorithm {\ref{fig:KARY}}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:KARY}} \\ -\hline $16$ & $3$ & $24$ & $27$ \\ -\hline $32$ & $3$ & $45$ & $49$ \\ -\hline $64$ & $4$ & $87$ & $92$ \\ -\hline $128$ & $4$ & $167$ & $175$ \\ -\hline $256$ & $5$ & $322$ & $335$ \\ -\hline $512$ & $6$ & $628$ & $645$ \\ -\hline $1024$ & $6$ & $1225$ & $1257$ \\ -\hline $2048$ & $7$ & $2403$ & $2452$ \\ -\hline $4096$ & $8$ & $4735$ & $4808$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for Sliding Window Exponentiation} -\label{fig:OPTK2} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Sliding Window $k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 If the $i$'th bit of $b$ is a zero then \\ -\hspace{6mm}2.1.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c \leftarrow c^{2^k}$ \\ -\hspace{6mm}2.2.2 Extract the $k$ bits from $(b_{i}b_{i-1}\ldots b_{i-(k-1)})$ and store it in $g$. \\ -\hspace{6mm}2.2.3 $c \leftarrow c \cdot a^g$ \\ -\hspace{6mm}2.2.4 $i \leftarrow i - k$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Sliding Window $k$-ary Exponentiation} -\end{figure} - -Similar to the previous algorithm this algorithm must have a special handler when fewer than $k$ bits are left in the exponent. While this -algorithm requires the same number of squarings it can potentially have fewer multiplications. The pre-computed table $a^g$ is also half -the size as the previous table. - -Consider the exponent $b = 111101011001000_2 \equiv 31432_{10}$ with $k = 3$ using both algorithms. The first algorithm will divide the exponent up as -the following five $3$-bit words $b \equiv \left ( 111, 101, 011, 001, 000 \right )_{2}$. The second algorithm will break the -exponent as $b \equiv \left ( 111, 101, 0, 110, 0, 100, 0 \right )_{2}$. The single digit $0$ in the second representation are where -a single squaring took place instead of a squaring and multiplication. In total the first method requires $10$ multiplications and $18$ -squarings. The second method requires $8$ multiplications and $18$ squarings. - -In general the sliding window method is never slower than the generic $k$-ary method and often it is slightly faster. - -\section{Modular Exponentiation} - -Modular exponentiation is essentially computing the power of a base within a finite field or ring. For example, computing -$d \equiv a^b \mbox{ (mod }c\mbox{)}$ is a modular exponentiation. Instead of first computing $a^b$ and then reducing it -modulo $c$ the intermediate result is reduced modulo $c$ after every squaring or multiplication operation. - -This guarantees that any intermediate result is bounded by $0 \le d \le c^2 - 2c + 1$ and can be reduced modulo $c$ quickly using -one of the algorithms presented in chapter six. - -Before the actual modular exponentiation algorithm can be written a wrapper algorithm must be written first. This algorithm -will allow the exponent $b$ to be negative which is computed as $c \equiv \left (1 / a \right )^{\vert b \vert} \mbox{(mod }d\mbox{)}$. The -value of $(1/a) \mbox{ mod }c$ is computed using the modular inverse (\textit{see \ref{sec;modinv}}). If no inverse exists the algorithm -terminates with an error. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. If $c.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. If $b.sign = MP\_NEG$ then \\ -\hspace{3mm}2.1 $g' \leftarrow g^{-1} \mbox{ (mod }c\mbox{)}$ \\ -\hspace{3mm}2.2 $x' \leftarrow \vert x \vert$ \\ -\hspace{3mm}2.3 Compute $d \equiv g'^{x'} \mbox{ (mod }c\mbox{)}$ via recursion. \\ -3. if $p$ is odd \textbf{OR} $p$ is a D.R. modulus then \\ -\hspace{3mm}3.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm mp\_exptmod\_fast. \\ -4. else \\ -\hspace{3mm}4.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm s\_mp\_exptmod. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_exptmod} -\end{figure} - -\textbf{Algorithm mp\_exptmod.} -The first algorithm which actually performs modular exponentiation is algorithm s\_mp\_exptmod. It is a sliding window $k$-ary algorithm -which uses Barrett reduction to reduce the product modulo $p$. The second algorithm mp\_exptmod\_fast performs the same operation -except it uses either Montgomery or Diminished Radix reduction. The two latter reduction algorithms are clumped in the same exponentiation -algorithm since their arguments are essentially the same (\textit{two mp\_ints and one mp\_digit}). - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_exptmod.c -\vspace{-3mm} -\begin{alltt} -016 -017 -018 /* this is a shell function that calls either the normal or Montgomery -019 * exptmod functions. Originally the call to the montgomery code was -020 * embedded in the normal function but that wasted alot of stack space -021 * for nothing (since 99% of the time the Montgomery code would be called) -022 */ -023 int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) -024 \{ -025 int dr; -026 -027 /* modulus P must be positive */ -028 if (P->sign == MP_NEG) \{ -029 return MP_VAL; -030 \} -031 -032 /* if exponent X is negative we have to recurse */ -033 if (X->sign == MP_NEG) \{ -034 #ifdef BN_MP_INVMOD_C -035 mp_int tmpG, tmpX; -036 int err; -037 -038 /* first compute 1/G mod P */ -039 if ((err = mp_init(&tmpG)) != MP_OKAY) \{ -040 return err; -041 \} -042 if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) \{ -043 mp_clear(&tmpG); -044 return err; -045 \} -046 -047 /* now get |X| */ -048 if ((err = mp_init(&tmpX)) != MP_OKAY) \{ -049 mp_clear(&tmpG); -050 return err; -051 \} -052 if ((err = mp_abs(X, &tmpX)) != MP_OKAY) \{ -053 mp_clear_multi(&tmpG, &tmpX, NULL); -054 return err; -055 \} -056 -057 /* and now compute (1/G)**|X| instead of G**X [X < 0] */ -058 err = mp_exptmod(&tmpG, &tmpX, P, Y); -059 mp_clear_multi(&tmpG, &tmpX, NULL); -060 return err; -061 #else -062 /* no invmod */ -063 return MP_VAL; -064 #endif -065 \} -066 -067 /* modified diminished radix reduction */ -068 #if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defin - ed(BN_S_MP_EXPTMOD_C) -069 if (mp_reduce_is_2k_l(P) == MP_YES) \{ -070 return s_mp_exptmod(G, X, P, Y, 1); -071 \} -072 #endif -073 -074 #ifdef BN_MP_DR_IS_MODULUS_C -075 /* is it a DR modulus? */ -076 dr = mp_dr_is_modulus(P); -077 #else -078 /* default to no */ -079 dr = 0; -080 #endif -081 -082 #ifdef BN_MP_REDUCE_IS_2K_C -083 /* if not, is it a unrestricted DR modulus? */ -084 if (dr == 0) \{ -085 dr = mp_reduce_is_2k(P) << 1; -086 \} -087 #endif -088 -089 /* if the modulus is odd or dr != 0 use the montgomery method */ -090 #ifdef BN_MP_EXPTMOD_FAST_C -091 if ((mp_isodd (P) == MP_YES) || (dr != 0)) \{ -092 return mp_exptmod_fast (G, X, P, Y, dr); -093 \} else \{ -094 #endif -095 #ifdef BN_S_MP_EXPTMOD_C -096 /* otherwise use the generic Barrett reduction technique */ -097 return s_mp_exptmod (G, X, P, Y, 0); -098 #else -099 /* no exptmod for evens */ -100 return MP_VAL; -101 #endif -102 #ifdef BN_MP_EXPTMOD_FAST_C -103 \} -104 #endif -105 \} -106 -107 #endif -108 -\end{alltt} -\end{small} - -In order to keep the algorithms in a known state the first step on line 28 is to reject any negative modulus as input. If the exponent is -negative the algorithm tries to perform a modular exponentiation with the modular inverse of the base $G$. The temporary variable $tmpG$ is assigned -the modular inverse of $G$ and $tmpX$ is assigned the absolute value of $X$. The algorithm will recuse with these new values with a positive -exponent. - -If the exponent is positive the algorithm resumes the exponentiation. Line 76 determines if the modulus is of the restricted Diminished Radix -form. If it is not line 69 attempts to determine if it is of a unrestricted Diminished Radix form. The integer $dr$ will take on one -of three values. - -\begin{enumerate} -\item $dr = 0$ means that the modulus is not of either restricted or unrestricted Diminished Radix form. -\item $dr = 1$ means that the modulus is of restricted Diminished Radix form. -\item $dr = 2$ means that the modulus is of unrestricted Diminished Radix form. -\end{enumerate} - -Line 69 determines if the fast modular exponentiation algorithm can be used. It is allowed if $dr \ne 0$ or if the modulus is odd. Otherwise, -the slower s\_mp\_exptmod algorithm is used which uses Barrett reduction. - -\subsection{Barrett Modular Exponentiation} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. $k \leftarrow lg(x)$ \\ -2. $winsize \leftarrow \left \lbrace \begin{array}{ll} - 2 & \mbox{if }k \le 7 \\ - 3 & \mbox{if }7 < k \le 36 \\ - 4 & \mbox{if }36 < k \le 140 \\ - 5 & \mbox{if }140 < k \le 450 \\ - 6 & \mbox{if }450 < k \le 1303 \\ - 7 & \mbox{if }1303 < k \le 3529 \\ - 8 & \mbox{if }3529 < k \\ - \end{array} \right .$ \\ -3. Initialize $2^{winsize}$ mp\_ints in an array named $M$ and one mp\_int named $\mu$ \\ -4. Calculate the $\mu$ required for Barrett Reduction (\textit{mp\_reduce\_setup}). \\ -5. $M_1 \leftarrow g \mbox{ (mod }p\mbox{)}$ \\ -\\ -Setup the table of small powers of $g$. First find $g^{2^{winsize}}$ and then all multiples of it. \\ -6. $k \leftarrow 2^{winsize - 1}$ \\ -7. $M_{k} \leftarrow M_1$ \\ -8. for $ix$ from 0 to $winsize - 2$ do \\ -\hspace{3mm}8.1 $M_k \leftarrow \left ( M_k \right )^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}8.2 $M_k \leftarrow M_k \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -9. for $ix$ from $2^{winsize - 1} + 1$ to $2^{winsize} - 1$ do \\ -\hspace{3mm}9.1 $M_{ix} \leftarrow M_{ix - 1} \cdot M_{1}$ (\textit{mp\_mul}) \\ -\hspace{3mm}9.2 $M_{ix} \leftarrow M_{ix} \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -10. $res \leftarrow 1$ \\ -\\ -Start Sliding Window. \\ -11. $mode \leftarrow 0, bitcnt \leftarrow 1, buf \leftarrow 0, digidx \leftarrow x.used - 1, bitcpy \leftarrow 0, bitbuf \leftarrow 0$ \\ -12. Loop \\ -\hspace{3mm}12.1 $bitcnt \leftarrow bitcnt - 1$ \\ -\hspace{3mm}12.2 If $bitcnt = 0$ then do \\ -\hspace{6mm}12.2.1 If $digidx = -1$ goto step 13. \\ -\hspace{6mm}12.2.2 $buf \leftarrow x_{digidx}$ \\ -\hspace{6mm}12.2.3 $digidx \leftarrow digidx - 1$ \\ -\hspace{6mm}12.2.4 $bitcnt \leftarrow lg(\beta)$ \\ -Continued on next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod} (\textit{continued}). \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -\hspace{3mm}12.3 $y \leftarrow (buf >> (lg(\beta) - 1))$ AND $1$ \\ -\hspace{3mm}12.4 $buf \leftarrow buf << 1$ \\ -\hspace{3mm}12.5 if $mode = 0$ and $y = 0$ then goto step 12. \\ -\hspace{3mm}12.6 if $mode = 1$ and $y = 0$ then do \\ -\hspace{6mm}12.6.1 $res \leftarrow res^2$ \\ -\hspace{6mm}12.6.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.6.3 Goto step 12. \\ -\hspace{3mm}12.7 $bitcpy \leftarrow bitcpy + 1$ \\ -\hspace{3mm}12.8 $bitbuf \leftarrow bitbuf + (y << (winsize - bitcpy))$ \\ -\hspace{3mm}12.9 $mode \leftarrow 2$ \\ -\hspace{3mm}12.10 If $bitcpy = winsize$ then do \\ -\hspace{6mm}Window is full so perform the squarings and single multiplication. \\ -\hspace{6mm}12.10.1 for $ix$ from $0$ to $winsize -1$ do \\ -\hspace{9mm}12.10.1.1 $res \leftarrow res^2$ \\ -\hspace{9mm}12.10.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.10.2 $res \leftarrow res \cdot M_{bitbuf}$ \\ -\hspace{6mm}12.10.3 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}Reset the window. \\ -\hspace{6mm}12.10.4 $bitcpy \leftarrow 0, bitbuf \leftarrow 0, mode \leftarrow 1$ \\ -\\ -No more windows left. Check for residual bits of exponent. \\ -13. If $mode = 2$ and $bitcpy > 0$ then do \\ -\hspace{3mm}13.1 for $ix$ form $0$ to $bitcpy - 1$ do \\ -\hspace{6mm}13.1.1 $res \leftarrow res^2$ \\ -\hspace{6mm}13.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}13.1.3 $bitbuf \leftarrow bitbuf << 1$ \\ -\hspace{6mm}13.1.4 If $bitbuf$ AND $2^{winsize} \ne 0$ then do \\ -\hspace{9mm}13.1.4.1 $res \leftarrow res \cdot M_{1}$ \\ -\hspace{9mm}13.1.4.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -14. $y \leftarrow res$ \\ -15. Clear $res$, $mu$ and the $M$ array. \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod (continued)} -\end{figure} - -\textbf{Algorithm s\_mp\_exptmod.} -This algorithm computes the $x$'th power of $g$ modulo $p$ and stores the result in $y$. It takes advantage of the Barrett reduction -algorithm to keep the product small throughout the algorithm. - -The first two steps determine the optimal window size based on the number of bits in the exponent. The larger the exponent the -larger the window size becomes. After a window size $winsize$ has been chosen an array of $2^{winsize}$ mp\_int variables is allocated. This -table will hold the values of $g^x \mbox{ (mod }p\mbox{)}$ for $2^{winsize - 1} \le x < 2^{winsize}$. - -After the table is allocated the first power of $g$ is found. Since $g \ge p$ is allowed it must be first reduced modulo $p$ to make -the rest of the algorithm more efficient. The first element of the table at $2^{winsize - 1}$ is found by squaring $M_1$ successively $winsize - 2$ -times. The rest of the table elements are found by multiplying the previous element by $M_1$ modulo $p$. - -Now that the table is available the sliding window may begin. The following list describes the functions of all the variables in the window. -\begin{enumerate} -\item The variable $mode$ dictates how the bits of the exponent are interpreted. -\begin{enumerate} - \item When $mode = 0$ the bits are ignored since no non-zero bit of the exponent has been seen yet. For example, if the exponent were simply - $1$ then there would be $lg(\beta) - 1$ zero bits before the first non-zero bit. In this case bits are ignored until a non-zero bit is found. - \item When $mode = 1$ a non-zero bit has been seen before and a new $winsize$-bit window has not been formed yet. In this mode leading $0$ bits - are read and a single squaring is performed. If a non-zero bit is read a new window is created. - \item When $mode = 2$ the algorithm is in the middle of forming a window and new bits are appended to the window from the most significant bit - downwards. -\end{enumerate} -\item The variable $bitcnt$ indicates how many bits are left in the current digit of the exponent left to be read. When it reaches zero a new digit - is fetched from the exponent. -\item The variable $buf$ holds the currently read digit of the exponent. -\item The variable $digidx$ is an index into the exponents digits. It starts at the leading digit $x.used - 1$ and moves towards the trailing digit. -\item The variable $bitcpy$ indicates how many bits are in the currently formed window. When it reaches $winsize$ the window is flushed and - the appropriate operations performed. -\item The variable $bitbuf$ holds the current bits of the window being formed. -\end{enumerate} - -All of step 12 is the window processing loop. It will iterate while there are digits available form the exponent to read. The first step -inside this loop is to extract a new digit if no more bits are available in the current digit. If there are no bits left a new digit is -read and if there are no digits left than the loop terminates. - -After a digit is made available step 12.3 will extract the most significant bit of the current digit and move all other bits in the digit -upwards. In effect the digit is read from most significant bit to least significant bit and since the digits are read from leading to -trailing edges the entire exponent is read from most significant bit to least significant bit. - -At step 12.5 if the $mode$ and currently extracted bit $y$ are both zero the bit is ignored and the next bit is read. This prevents the -algorithm from having to perform trivial squaring and reduction operations before the first non-zero bit is read. Step 12.6 and 12.7-10 handle -the two cases of $mode = 1$ and $mode = 2$ respectively. - -\begin{center} -\begin{figure}[here] -\includegraphics{pics/expt_state.ps} -\caption{Sliding Window State Diagram} -\label{pic:expt_state} -\end{figure} -\end{center} - -By step 13 there are no more digits left in the exponent. However, there may be partial bits in the window left. If $mode = 2$ then -a Left-to-Right algorithm is used to process the remaining few bits. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_exptmod.c -\vspace{-3mm} -\begin{alltt} -016 #ifdef MP_LOW_MEM -017 #define TAB_SIZE 32 -018 #else -019 #define TAB_SIZE 256 -020 #endif -021 -022 int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmod - e) -023 \{ -024 mp_int M[TAB_SIZE], res, mu; -025 mp_digit buf; -026 int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; -027 int (*redux)(mp_int*,mp_int*,mp_int*); -028 -029 /* find window size */ -030 x = mp_count_bits (X); -031 if (x <= 7) \{ -032 winsize = 2; -033 \} else if (x <= 36) \{ -034 winsize = 3; -035 \} else if (x <= 140) \{ -036 winsize = 4; -037 \} else if (x <= 450) \{ -038 winsize = 5; -039 \} else if (x <= 1303) \{ -040 winsize = 6; -041 \} else if (x <= 3529) \{ -042 winsize = 7; -043 \} else \{ -044 winsize = 8; -045 \} -046 -047 #ifdef MP_LOW_MEM -048 if (winsize > 5) \{ -049 winsize = 5; -050 \} -051 #endif -052 -053 /* init M array */ -054 /* init first cell */ -055 if ((err = mp_init(&M[1])) != MP_OKAY) \{ -056 return err; -057 \} -058 -059 /* now init the second half of the array */ -060 for (x = 1<<(winsize-1); x < (1 << winsize); x++) \{ -061 if ((err = mp_init(&M[x])) != MP_OKAY) \{ -062 for (y = 1<<(winsize-1); y < x; y++) \{ -063 mp_clear (&M[y]); -064 \} -065 mp_clear(&M[1]); -066 return err; -067 \} -068 \} -069 -070 /* create mu, used for Barrett reduction */ -071 if ((err = mp_init (&mu)) != MP_OKAY) \{ -072 goto LBL_M; -073 \} -074 -075 if (redmode == 0) \{ -076 if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) \{ -077 goto LBL_MU; -078 \} -079 redux = mp_reduce; -080 \} else \{ -081 if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) \{ -082 goto LBL_MU; -083 \} -084 redux = mp_reduce_2k_l; -085 \} -086 -087 /* create M table -088 * -089 * The M table contains powers of the base, -090 * e.g. M[x] = G**x mod P -091 * -092 * The first half of the table is not -093 * computed though accept for M[0] and M[1] -094 */ -095 if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) \{ -096 goto LBL_MU; -097 \} -098 -099 /* compute the value at M[1<<(winsize-1)] by squaring -100 * M[1] (winsize-1) times -101 */ -102 if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) \{ -103 goto LBL_MU; -104 \} -105 -106 for (x = 0; x < (winsize - 1); x++) \{ -107 /* square it */ -108 if ((err = mp_sqr (&M[1 << (winsize - 1)], -109 &M[1 << (winsize - 1)])) != MP_OKAY) \{ -110 goto LBL_MU; -111 \} -112 -113 /* reduce modulo P */ -114 if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) \{ -115 goto LBL_MU; -116 \} -117 \} -118 -119 /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) -120 * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) -121 */ -122 for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) \{ -123 if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) \{ -124 goto LBL_MU; -125 \} -126 if ((err = redux (&M[x], P, &mu)) != MP_OKAY) \{ -127 goto LBL_MU; -128 \} -129 \} -130 -131 /* setup result */ -132 if ((err = mp_init (&res)) != MP_OKAY) \{ -133 goto LBL_MU; -134 \} -135 mp_set (&res, 1); -136 -137 /* set initial mode and bit cnt */ -138 mode = 0; -139 bitcnt = 1; -140 buf = 0; -141 digidx = X->used - 1; -142 bitcpy = 0; -143 bitbuf = 0; -144 -145 for (;;) \{ -146 /* grab next digit as required */ -147 if (--bitcnt == 0) \{ -148 /* if digidx == -1 we are out of digits */ -149 if (digidx == -1) \{ -150 break; -151 \} -152 /* read next digit and reset the bitcnt */ -153 buf = X->dp[digidx--]; -154 bitcnt = (int) DIGIT_BIT; -155 \} -156 -157 /* grab the next msb from the exponent */ -158 y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; -159 buf <<= (mp_digit)1; -160 -161 /* if the bit is zero and mode == 0 then we ignore it -162 * These represent the leading zero bits before the first 1 bit -163 * in the exponent. Technically this opt is not required but it -164 * does lower the # of trivial squaring/reductions used -165 */ -166 if ((mode == 0) && (y == 0)) \{ -167 continue; -168 \} -169 -170 /* if the bit is zero and mode == 1 then we square */ -171 if ((mode == 1) && (y == 0)) \{ -172 if ((err = mp_sqr (&res, &res)) != MP_OKAY) \{ -173 goto LBL_RES; -174 \} -175 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -176 goto LBL_RES; -177 \} -178 continue; -179 \} -180 -181 /* else we add it to the window */ -182 bitbuf |= (y << (winsize - ++bitcpy)); -183 mode = 2; -184 -185 if (bitcpy == winsize) \{ -186 /* ok window is filled so square as required and multiply */ -187 /* square first */ -188 for (x = 0; x < winsize; x++) \{ -189 if ((err = mp_sqr (&res, &res)) != MP_OKAY) \{ -190 goto LBL_RES; -191 \} -192 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -193 goto LBL_RES; -194 \} -195 \} -196 -197 /* then multiply */ -198 if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) \{ -199 goto LBL_RES; -200 \} -201 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -202 goto LBL_RES; -203 \} -204 -205 /* empty window and reset */ -206 bitcpy = 0; -207 bitbuf = 0; -208 mode = 1; -209 \} -210 \} -211 -212 /* if bits remain then square/multiply */ -213 if ((mode == 2) && (bitcpy > 0)) \{ -214 /* square then multiply if the bit is set */ -215 for (x = 0; x < bitcpy; x++) \{ -216 if ((err = mp_sqr (&res, &res)) != MP_OKAY) \{ -217 goto LBL_RES; -218 \} -219 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -220 goto LBL_RES; -221 \} -222 -223 bitbuf <<= 1; -224 if ((bitbuf & (1 << winsize)) != 0) \{ -225 /* then multiply */ -226 if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) \{ -227 goto LBL_RES; -228 \} -229 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -230 goto LBL_RES; -231 \} -232 \} -233 \} -234 \} -235 -236 mp_exch (&res, Y); -237 err = MP_OKAY; -238 LBL_RES:mp_clear (&res); -239 LBL_MU:mp_clear (&mu); -240 LBL_M: -241 mp_clear(&M[1]); -242 for (x = 1<<(winsize-1); x < (1 << winsize); x++) \{ -243 mp_clear (&M[x]); -244 \} -245 return err; -246 \} -247 #endif -248 -\end{alltt} -\end{small} - -Lines 31 through 45 determine the optimal window size based on the length of the exponent in bits. The window divisions are sorted -from smallest to greatest so that in each \textbf{if} statement only one condition must be tested. For example, by the \textbf{if} statement -on line 37 the value of $x$ is already known to be greater than $140$. - -The conditional piece of code beginning on line 47 allows the window size to be restricted to five bits. This logic is used to ensure -the table of precomputed powers of $G$ remains relatively small. - -The for loop on line 60 initializes the $M$ array while lines 71 and 76 through 85 initialize the reduction -function that will be used for this modulus. - --- More later. - -\section{Quick Power of Two} -Calculating $b = 2^a$ can be performed much quicker than with any of the previous algorithms. Recall that a logical shift left $m << k$ is -equivalent to $m \cdot 2^k$. By this logic when $m = 1$ a quick power of two can be achieved. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_2expt}. \\ -\textbf{Input}. integer $b$ \\ -\textbf{Output}. $a \leftarrow 2^b$ \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $a.alloc < \lfloor b / lg(\beta) \rfloor + 1$ then grow $a$ appropriately. \\ -3. $a.used \leftarrow \lfloor b / lg(\beta) \rfloor + 1$ \\ -4. $a_{\lfloor b / lg(\beta) \rfloor} \leftarrow 1 << (b \mbox{ mod } lg(\beta))$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_2expt} -\end{figure} - -\textbf{Algorithm mp\_2expt.} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_2expt.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes a = 2**b -018 * -019 * Simple algorithm which zeroes the int, grows it then just sets one bit -020 * as required. -021 */ -022 int -023 mp_2expt (mp_int * a, int b) -024 \{ -025 int res; -026 -027 /* zero a as per default */ -028 mp_zero (a); -029 -030 /* grow a to accomodate the single bit */ -031 if ((res = mp_grow (a, (b / DIGIT_BIT) + 1)) != MP_OKAY) \{ -032 return res; -033 \} -034 -035 /* set the used count of where the bit will go */ -036 a->used = (b / DIGIT_BIT) + 1; -037 -038 /* put the single bit in its place */ -039 a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); -040 -041 return MP_OKAY; -042 \} -043 #endif -044 -\end{alltt} -\end{small} - -\chapter{Higher Level Algorithms} - -This chapter discusses the various higher level algorithms that are required to complete a well rounded multiple precision integer package. These -routines are less performance oriented than the algorithms of chapters five, six and seven but are no less important. - -The first section describes a method of integer division with remainder that is universally well known. It provides the signed division logic -for the package. The subsequent section discusses a set of algorithms which allow a single digit to be the 2nd operand for a variety of operations. -These algorithms serve mostly to simplify other algorithms where small constants are required. The last two sections discuss how to manipulate -various representations of integers. For example, converting from an mp\_int to a string of character. - -\section{Integer Division with Remainder} -\label{sec:division} - -Integer division aside from modular exponentiation is the most intensive algorithm to compute. Like addition, subtraction and multiplication -the basis of this algorithm is the long-hand division algorithm taught to school children. Throughout this discussion several common variables -will be used. Let $x$ represent the divisor and $y$ represent the dividend. Let $q$ represent the integer quotient $\lfloor y / x \rfloor$ and -let $r$ represent the remainder $r = y - x \lfloor y / x \rfloor$. The following simple algorithm will be used to start the discussion. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Radix-$\beta$ Integer Division}. \\ -\textbf{Input}. integer $x$ and $y$ \\ -\textbf{Output}. $q = \lfloor y/x\rfloor, r = y - xq$ \\ -\hline \\ -1. $q \leftarrow 0$ \\ -2. $n \leftarrow \vert \vert y \vert \vert - \vert \vert x \vert \vert$ \\ -3. for $t$ from $n$ down to $0$ do \\ -\hspace{3mm}3.1 Maximize $k$ such that $kx\beta^t$ is less than or equal to $y$ and $(k + 1)x\beta^t$ is greater. \\ -\hspace{3mm}3.2 $q \leftarrow q + k\beta^t$ \\ -\hspace{3mm}3.3 $y \leftarrow y - kx\beta^t$ \\ -4. $r \leftarrow y$ \\ -5. Return($q, r$) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Radix-$\beta$ Integer Division} -\label{fig:raddiv} -\end{figure} - -As children we are taught this very simple algorithm for the case of $\beta = 10$. Almost instinctively several optimizations are taught for which -their reason of existing are never explained. For this example let $y = 5471$ represent the dividend and $x = 23$ represent the divisor. - -To find the first digit of the quotient the value of $k$ must be maximized such that $kx\beta^t$ is less than or equal to $y$ and -simultaneously $(k + 1)x\beta^t$ is greater than $y$. Implicitly $k$ is the maximum value the $t$'th digit of the quotient may have. The habitual method -used to find the maximum is to ``eyeball'' the two numbers, typically only the leading digits and quickly estimate a quotient. By only using leading -digits a much simpler division may be used to form an educated guess at what the value must be. In this case $k = \lfloor 54/23\rfloor = 2$ quickly -arises as a possible solution. Indeed $2x\beta^2 = 4600$ is less than $y = 5471$ and simultaneously $(k + 1)x\beta^2 = 6900$ is larger than $y$. -As a result $k\beta^2$ is added to the quotient which now equals $q = 200$ and $4600$ is subtracted from $y$ to give a remainder of $y = 841$. - -Again this process is repeated to produce the quotient digit $k = 3$ which makes the quotient $q = 200 + 3\beta = 230$ and the remainder -$y = 841 - 3x\beta = 181$. Finally the last iteration of the loop produces $k = 7$ which leads to the quotient $q = 230 + 7 = 237$ and the -remainder $y = 181 - 7x = 20$. The final quotient and remainder found are $q = 237$ and $r = y = 20$ which are indeed correct since -$237 \cdot 23 + 20 = 5471$ is true. - -\subsection{Quotient Estimation} -\label{sec:divest} -As alluded to earlier the quotient digit $k$ can be estimated from only the leading digits of both the divisor and dividend. When $p$ leading -digits are used from both the divisor and dividend to form an estimation the accuracy of the estimation rises as $p$ grows. Technically -speaking the estimation is based on assuming the lower $\vert \vert y \vert \vert - p$ and $\vert \vert x \vert \vert - p$ lower digits of the -dividend and divisor are zero. - -The value of the estimation may off by a few values in either direction and in general is fairly correct. A simplification \cite[pp. 271]{TAOCPV2} -of the estimation technique is to use $t + 1$ digits of the dividend and $t$ digits of the divisor, in particularly when $t = 1$. The estimate -using this technique is never too small. For the following proof let $t = \vert \vert y \vert \vert - 1$ and $s = \vert \vert x \vert \vert - 1$ -represent the most significant digits of the dividend and divisor respectively. - -\textbf{Proof.}\textit{ The quotient $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ is greater than or equal to -$k = \lfloor y / (x \cdot \beta^{\vert \vert y \vert \vert - \vert \vert x \vert \vert - 1}) \rfloor$. } -The first obvious case is when $\hat k = \beta - 1$ in which case the proof is concluded since the real quotient cannot be larger. For all other -cases $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ and $\hat k x_s \ge y_t\beta + y_{t-1} - x_s + 1$. The latter portion of the inequalility -$-x_s + 1$ arises from the fact that a truncated integer division will give the same quotient for at most $x_s - 1$ values. Next a series of -inequalities will prove the hypothesis. - -\begin{equation} -y - \hat k x \le y - \hat k x_s\beta^s -\end{equation} - -This is trivially true since $x \ge x_s\beta^s$. Next we replace $\hat kx_s\beta^s$ by the previous inequality for $\hat kx_s$. - -\begin{equation} -y - \hat k x \le y_t\beta^t + \ldots + y_0 - (y_t\beta^t + y_{t-1}\beta^{t-1} - x_s\beta^t + \beta^s) -\end{equation} - -By simplifying the previous inequality the following inequality is formed. - -\begin{equation} -y - \hat k x \le y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s -\end{equation} - -Subsequently, - -\begin{equation} -y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s < x_s\beta^s \le x -\end{equation} - -Which proves that $y - \hat kx \le x$ and by consequence $\hat k \ge k$ which concludes the proof. \textbf{QED} - - -\subsection{Normalized Integers} -For the purposes of division a normalized input is when the divisors leading digit $x_n$ is greater than or equal to $\beta / 2$. By multiplying both -$x$ and $y$ by $j = \lfloor (\beta / 2) / x_n \rfloor$ the quotient remains unchanged and the remainder is simply $j$ times the original -remainder. The purpose of normalization is to ensure the leading digit of the divisor is sufficiently large such that the estimated quotient will -lie in the domain of a single digit. Consider the maximum dividend $(\beta - 1) \cdot \beta + (\beta - 1)$ and the minimum divisor $\beta / 2$. - -\begin{equation} -{{\beta^2 - 1} \over { \beta / 2}} \le 2\beta - {2 \over \beta} -\end{equation} - -At most the quotient approaches $2\beta$, however, in practice this will not occur since that would imply the previous quotient digit was too small. - -\subsection{Radix-$\beta$ Division with Remainder} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div}. \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -1. If $b = 0$ return(\textit{MP\_VAL}). \\ -2. If $\vert a \vert < \vert b \vert$ then do \\ -\hspace{3mm}2.1 $d \leftarrow a$ \\ -\hspace{3mm}2.2 $c \leftarrow 0$ \\ -\hspace{3mm}2.3 Return(\textit{MP\_OKAY}). \\ -\\ -Setup the quotient to receive the digits. \\ -3. Grow $q$ to $a.used + 2$ digits. \\ -4. $q \leftarrow 0$ \\ -5. $x \leftarrow \vert a \vert , y \leftarrow \vert b \vert$ \\ -6. $sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = b.sign \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\\ -Normalize the inputs such that the leading digit of $y$ is greater than or equal to $\beta / 2$. \\ -7. $norm \leftarrow (lg(\beta) - 1) - (\lceil lg(y) \rceil \mbox{ (mod }lg(\beta)\mbox{)})$ \\ -8. $x \leftarrow x \cdot 2^{norm}, y \leftarrow y \cdot 2^{norm}$ \\ -\\ -Find the leading digit of the quotient. \\ -9. $n \leftarrow x.used - 1, t \leftarrow y.used - 1$ \\ -10. $y \leftarrow y \cdot \beta^{n - t}$ \\ -11. While ($x \ge y$) do \\ -\hspace{3mm}11.1 $q_{n - t} \leftarrow q_{n - t} + 1$ \\ -\hspace{3mm}11.2 $x \leftarrow x - y$ \\ -12. $y \leftarrow \lfloor y / \beta^{n-t} \rfloor$ \\ -\\ -Continued on the next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div} (continued). \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -Now find the remainder fo the digits. \\ -13. for $i$ from $n$ down to $(t + 1)$ do \\ -\hspace{3mm}13.1 If $i > x.used$ then jump to the next iteration of this loop. \\ -\hspace{3mm}13.2 If $x_{i} = y_{t}$ then \\ -\hspace{6mm}13.2.1 $q_{i - t - 1} \leftarrow \beta - 1$ \\ -\hspace{3mm}13.3 else \\ -\hspace{6mm}13.3.1 $\hat r \leftarrow x_{i} \cdot \beta + x_{i - 1}$ \\ -\hspace{6mm}13.3.2 $\hat r \leftarrow \lfloor \hat r / y_{t} \rfloor$ \\ -\hspace{6mm}13.3.3 $q_{i - t - 1} \leftarrow \hat r$ \\ -\hspace{3mm}13.4 $q_{i - t - 1} \leftarrow q_{i - t - 1} + 1$ \\ -\\ -Fixup quotient estimation. \\ -\hspace{3mm}13.5 Loop \\ -\hspace{6mm}13.5.1 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\hspace{6mm}13.5.2 t$1 \leftarrow 0$ \\ -\hspace{6mm}13.5.3 t$1_0 \leftarrow y_{t - 1}, $ t$1_1 \leftarrow y_t,$ t$1.used \leftarrow 2$ \\ -\hspace{6mm}13.5.4 $t1 \leftarrow t1 \cdot q_{i - t - 1}$ \\ -\hspace{6mm}13.5.5 t$2_0 \leftarrow x_{i - 2}, $ t$2_1 \leftarrow x_{i - 1}, $ t$2_2 \leftarrow x_i, $ t$2.used \leftarrow 3$ \\ -\hspace{6mm}13.5.6 If $\vert t1 \vert > \vert t2 \vert$ then goto step 13.5. \\ -\hspace{3mm}13.6 t$1 \leftarrow y \cdot q_{i - t - 1}$ \\ -\hspace{3mm}13.7 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{3mm}13.8 $x \leftarrow x - $ t$1$ \\ -\hspace{3mm}13.9 If $x.sign = MP\_NEG$ then \\ -\hspace{6mm}13.10 t$1 \leftarrow y$ \\ -\hspace{6mm}13.11 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{6mm}13.12 $x \leftarrow x + $ t$1$ \\ -\hspace{6mm}13.13 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\\ -Finalize the result. \\ -14. Clamp excess digits of $q$ \\ -15. $c \leftarrow q, c.sign \leftarrow sign$ \\ -16. $x.sign \leftarrow a.sign$ \\ -17. $d \leftarrow \lfloor x / 2^{norm} \rfloor$ \\ -18. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div (continued)} -\end{figure} -\textbf{Algorithm mp\_div.} -This algorithm will calculate quotient and remainder from an integer division given a dividend and divisor. The algorithm is a signed -division and will produce a fully qualified quotient and remainder. - -First the divisor $b$ must be non-zero which is enforced in step one. If the divisor is larger than the dividend than the quotient is implicitly -zero and the remainder is the dividend. - -After the first two trivial cases of inputs are handled the variable $q$ is setup to receive the digits of the quotient. Two unsigned copies of the -divisor $y$ and dividend $x$ are made as well. The core of the division algorithm is an unsigned division and will only work if the values are -positive. Now the two values $x$ and $y$ must be normalized such that the leading digit of $y$ is greater than or equal to $\beta / 2$. -This is performed by shifting both to the left by enough bits to get the desired normalization. - -At this point the division algorithm can begin producing digits of the quotient. Recall that maximum value of the estimation used is -$2\beta - {2 \over \beta}$ which means that a digit of the quotient must be first produced by another means. In this case $y$ is shifted -to the left (\textit{step ten}) so that it has the same number of digits as $x$. The loop on step eleven will subtract multiples of the -shifted copy of $y$ until $x$ is smaller. Since the leading digit of $y$ is greater than or equal to $\beta/2$ this loop will iterate at most two -times to produce the desired leading digit of the quotient. - -Now the remainder of the digits can be produced. The equation $\hat q = \lfloor {{x_i \beta + x_{i-1}}\over y_t} \rfloor$ is used to fairly -accurately approximate the true quotient digit. The estimation can in theory produce an estimation as high as $2\beta - {2 \over \beta}$ but by -induction the upper quotient digit is correct (\textit{as established on step eleven}) and the estimate must be less than $\beta$. - -Recall from section~\ref{sec:divest} that the estimation is never too low but may be too high. The next step of the estimation process is -to refine the estimation. The loop on step 13.5 uses $x_i\beta^2 + x_{i-1}\beta + x_{i-2}$ and $q_{i - t - 1}(y_t\beta + y_{t-1})$ as a higher -order approximation to adjust the quotient digit. - -After both phases of estimation the quotient digit may still be off by a value of one\footnote{This is similar to the error introduced -by optimizing Barrett reduction.}. Steps 13.6 and 13.7 subtract the multiple of the divisor from the dividend (\textit{Similar to step 3.3 of -algorithm~\ref{fig:raddiv}} and then subsequently add a multiple of the divisor if the quotient was too large. - -Now that the quotient has been determine finializing the result is a matter of clamping the quotient, fixing the sizes and de-normalizing the -remainder. An important aspect of this algorithm seemingly overlooked in other descriptions such as that of Algorithm 14.20 HAC \cite[pp. 598]{HAC} -is that when the estimations are being made (\textit{inside the loop on step 13.5}) that the digits $y_{t-1}$, $x_{i-2}$ and $x_{i-1}$ may lie -outside their respective boundaries. For example, if $t = 0$ or $i \le 1$ then the digits would be undefined. In those cases the digits should -respectively be replaced with a zero. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div.c -\vspace{-3mm} -\begin{alltt} -016 -017 #ifdef BN_MP_DIV_SMALL -018 -019 /* slower bit-bang division... also smaller */ -020 int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) -021 \{ -022 mp_int ta, tb, tq, q; -023 int res, n, n2; -024 -025 /* is divisor zero ? */ -026 if (mp_iszero (b) == MP_YES) \{ -027 return MP_VAL; -028 \} -029 -030 /* if a < b then q=0, r = a */ -031 if (mp_cmp_mag (a, b) == MP_LT) \{ -032 if (d != NULL) \{ -033 res = mp_copy (a, d); -034 \} else \{ -035 res = MP_OKAY; -036 \} -037 if (c != NULL) \{ -038 mp_zero (c); -039 \} -040 return res; -041 \} -042 -043 /* init our temps */ -044 if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL)) != MP_OKAY) \{ -045 return res; -046 \} -047 -048 -049 mp_set(&tq, 1); -050 n = mp_count_bits(a) - mp_count_bits(b); -051 if (((res = mp_abs(a, &ta)) != MP_OKAY) || -052 ((res = mp_abs(b, &tb)) != MP_OKAY) || -053 ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || -054 ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) \{ -055 goto LBL_ERR; -056 \} -057 -058 while (n-- >= 0) \{ -059 if (mp_cmp(&tb, &ta) != MP_GT) \{ -060 if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || -061 ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) \{ -062 goto LBL_ERR; -063 \} -064 \} -065 if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || -066 ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) \{ -067 goto LBL_ERR; -068 \} -069 \} -070 -071 /* now q == quotient and ta == remainder */ -072 n = a->sign; -073 n2 = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; -074 if (c != NULL) \{ -075 mp_exch(c, &q); -076 c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; -077 \} -078 if (d != NULL) \{ -079 mp_exch(d, &ta); -080 d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; -081 \} -082 LBL_ERR: -083 mp_clear_multi(&ta, &tb, &tq, &q, NULL); -084 return res; -085 \} -086 -087 #else -088 -089 /* integer signed division. -090 * c*b + d == a [e.g. a/b, c=quotient, d=remainder] -091 * HAC pp.598 Algorithm 14.20 -092 * -093 * Note that the description in HAC is horribly -094 * incomplete. For example, it doesn't consider -095 * the case where digits are removed from 'x' in -096 * the inner loop. It also doesn't consider the -097 * case that y has fewer than three digits, etc.. -098 * -099 * The overall algorithm is as described as -100 * 14.20 from HAC but fixed to treat these cases. -101 */ -102 int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -103 \{ -104 mp_int q, x, y, t1, t2; -105 int res, n, t, i, norm, neg; -106 -107 /* is divisor zero ? */ -108 if (mp_iszero (b) == MP_YES) \{ -109 return MP_VAL; -110 \} -111 -112 /* if a < b then q=0, r = a */ -113 if (mp_cmp_mag (a, b) == MP_LT) \{ -114 if (d != NULL) \{ -115 res = mp_copy (a, d); -116 \} else \{ -117 res = MP_OKAY; -118 \} -119 if (c != NULL) \{ -120 mp_zero (c); -121 \} -122 return res; -123 \} -124 -125 if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) \{ -126 return res; -127 \} -128 q.used = a->used + 2; -129 -130 if ((res = mp_init (&t1)) != MP_OKAY) \{ -131 goto LBL_Q; -132 \} -133 -134 if ((res = mp_init (&t2)) != MP_OKAY) \{ -135 goto LBL_T1; -136 \} -137 -138 if ((res = mp_init_copy (&x, a)) != MP_OKAY) \{ -139 goto LBL_T2; -140 \} -141 -142 if ((res = mp_init_copy (&y, b)) != MP_OKAY) \{ -143 goto LBL_X; -144 \} -145 -146 /* fix the sign */ -147 neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; -148 x.sign = y.sign = MP_ZPOS; -149 -150 /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ -151 norm = mp_count_bits(&y) % DIGIT_BIT; -152 if (norm < (int)(DIGIT_BIT-1)) \{ -153 norm = (DIGIT_BIT-1) - norm; -154 if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) \{ -155 goto LBL_Y; -156 \} -157 if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) \{ -158 goto LBL_Y; -159 \} -160 \} else \{ -161 norm = 0; -162 \} -163 -164 /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ -165 n = x.used - 1; -166 t = y.used - 1; -167 -168 /* while (x >= y*b**n-t) do \{ q[n-t] += 1; x -= y*b**\{n-t\} \} */ -169 if ((res = mp_lshd (&y, n - t)) != MP_OKAY) \{ /* y = y*b**\{n-t\} */ -170 goto LBL_Y; -171 \} -172 -173 while (mp_cmp (&x, &y) != MP_LT) \{ -174 ++(q.dp[n - t]); -175 if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) \{ -176 goto LBL_Y; -177 \} -178 \} -179 -180 /* reset y by shifting it back down */ -181 mp_rshd (&y, n - t); -182 -183 /* step 3. for i from n down to (t + 1) */ -184 for (i = n; i >= (t + 1); i--) \{ -185 if (i > x.used) \{ -186 continue; -187 \} -188 -189 /* step 3.1 if xi == yt then set q\{i-t-1\} to b-1, -190 * otherwise set q\{i-t-1\} to (xi*b + x\{i-1\})/yt */ -191 if (x.dp[i] == y.dp[t]) \{ -192 q.dp[(i - t) - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); -193 \} else \{ -194 mp_word tmp; -195 tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); -196 tmp |= ((mp_word) x.dp[i - 1]); -197 tmp /= ((mp_word) y.dp[t]); -198 if (tmp > (mp_word) MP_MASK) \{ -199 tmp = MP_MASK; -200 \} -201 q.dp[(i - t) - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK)); -202 \} -203 -204 /* while (q\{i-t-1\} * (yt * b + y\{t-1\})) > -205 xi * b**2 + xi-1 * b + xi-2 -206 -207 do q\{i-t-1\} -= 1; -208 */ -209 q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] + 1) & MP_MASK; -210 do \{ -211 q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1) & MP_MASK; -212 -213 /* find left hand */ -214 mp_zero (&t1); -215 t1.dp[0] = ((t - 1) < 0) ? 0 : y.dp[t - 1]; -216 t1.dp[1] = y.dp[t]; -217 t1.used = 2; -218 if ((res = mp_mul_d (&t1, q.dp[(i - t) - 1], &t1)) != MP_OKAY) \{ -219 goto LBL_Y; -220 \} -221 -222 /* find right hand */ -223 t2.dp[0] = ((i - 2) < 0) ? 0 : x.dp[i - 2]; -224 t2.dp[1] = ((i - 1) < 0) ? 0 : x.dp[i - 1]; -225 t2.dp[2] = x.dp[i]; -226 t2.used = 3; -227 \} while (mp_cmp_mag(&t1, &t2) == MP_GT); -228 -229 /* step 3.3 x = x - q\{i-t-1\} * y * b**\{i-t-1\} */ -230 if ((res = mp_mul_d (&y, q.dp[(i - t) - 1], &t1)) != MP_OKAY) \{ -231 goto LBL_Y; -232 \} -233 -234 if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) \{ -235 goto LBL_Y; -236 \} -237 -238 if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) \{ -239 goto LBL_Y; -240 \} -241 -242 /* if x < 0 then \{ x = x + y*b**\{i-t-1\}; q\{i-t-1\} -= 1; \} */ -243 if (x.sign == MP_NEG) \{ -244 if ((res = mp_copy (&y, &t1)) != MP_OKAY) \{ -245 goto LBL_Y; -246 \} -247 if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) \{ -248 goto LBL_Y; -249 \} -250 if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) \{ -251 goto LBL_Y; -252 \} -253 -254 q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1UL) & MP_MASK; -255 \} -256 \} -257 -258 /* now q is the quotient and x is the remainder -259 * [which we have to normalize] -260 */ -261 -262 /* get sign before writing to c */ -263 x.sign = (x.used == 0) ? MP_ZPOS : a->sign; -264 -265 if (c != NULL) \{ -266 mp_clamp (&q); -267 mp_exch (&q, c); -268 c->sign = neg; -269 \} -270 -271 if (d != NULL) \{ -272 if ((res = mp_div_2d (&x, norm, &x, NULL)) != MP_OKAY) \{ -273 goto LBL_Y; -274 \} -275 mp_exch (&x, d); -276 \} -277 -278 res = MP_OKAY; -279 -280 LBL_Y:mp_clear (&y); -281 LBL_X:mp_clear (&x); -282 LBL_T2:mp_clear (&t2); -283 LBL_T1:mp_clear (&t1); -284 LBL_Q:mp_clear (&q); -285 return res; -286 \} -287 -288 #endif -289 -290 #endif -291 -\end{alltt} -\end{small} - -The implementation of this algorithm differs slightly from the pseudo code presented previously. In this algorithm either of the quotient $c$ or -remainder $d$ may be passed as a \textbf{NULL} pointer which indicates their value is not desired. For example, the C code to call the division -algorithm with only the quotient is - -\begin{verbatim} -mp_div(&a, &b, &c, NULL); /* c = [a/b] */ -\end{verbatim} - -Lines 108 and 113 handle the two trivial cases of inputs which are division by zero and dividend smaller than the divisor -respectively. After the two trivial cases all of the temporary variables are initialized. Line 147 determines the sign of -the quotient and line 148 ensures that both $x$ and $y$ are positive. - -The number of bits in the leading digit is calculated on line 151. Implictly an mp\_int with $r$ digits will require $lg(\beta)(r-1) + k$ bits -of precision which when reduced modulo $lg(\beta)$ produces the value of $k$. In this case $k$ is the number of bits in the leading digit which is -exactly what is required. For the algorithm to operate $k$ must equal $lg(\beta) - 1$ and when it does not the inputs must be normalized by shifting -them to the left by $lg(\beta) - 1 - k$ bits. - -Throughout the variables $n$ and $t$ will represent the highest digit of $x$ and $y$ respectively. These are first used to produce the -leading digit of the quotient. The loop beginning on line 184 will produce the remainder of the quotient digits. - -The conditional ``continue'' on line 186 is used to prevent the algorithm from reading past the leading edge of $x$ which can occur when the -algorithm eliminates multiple non-zero digits in a single iteration. This ensures that $x_i$ is always non-zero since by definition the digits -above the $i$'th position $x$ must be zero in order for the quotient to be precise\footnote{Precise as far as integer division is concerned.}. - -Lines 214, 216 and 223 through 225 manually construct the high accuracy estimations by setting the digits of the two mp\_int -variables directly. - -\section{Single Digit Helpers} - -This section briefly describes a series of single digit helper algorithms which come in handy when working with small constants. All of -the helper functions assume the single digit input is positive and will treat them as such. - -\subsection{Single Digit Addition and Subtraction} - -Both addition and subtraction are performed by ``cheating'' and using mp\_set followed by the higher level addition or subtraction -algorithms. As a result these algorithms are subtantially simpler with a slight cost in performance. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = a + b$ \\ -\hline \\ -1. $t \leftarrow b$ (\textit{mp\_set}) \\ -2. $c \leftarrow a + t$ \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_add\_d} -\end{figure} - -\textbf{Algorithm mp\_add\_d.} -This algorithm initiates a temporary mp\_int with the value of the single digit and uses algorithm mp\_add to add the two values together. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_add\_d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* single digit addition */ -018 int -019 mp_add_d (mp_int * a, mp_digit b, mp_int * c) -020 \{ -021 int res, ix, oldused; -022 mp_digit *tmpa, *tmpc, mu; -023 -024 /* grow c as required */ -025 if (c->alloc < (a->used + 1)) \{ -026 if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) \{ -027 return res; -028 \} -029 \} -030 -031 /* if a is negative and |a| >= b, call c = |a| - b */ -032 if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) \{ -033 /* temporarily fix sign of a */ -034 a->sign = MP_ZPOS; -035 -036 /* c = |a| - b */ -037 res = mp_sub_d(a, b, c); -038 -039 /* fix sign */ -040 a->sign = c->sign = MP_NEG; -041 -042 /* clamp */ -043 mp_clamp(c); -044 -045 return res; -046 \} -047 -048 /* old number of used digits in c */ -049 oldused = c->used; -050 -051 /* sign always positive */ -052 c->sign = MP_ZPOS; -053 -054 /* source alias */ -055 tmpa = a->dp; -056 -057 /* destination alias */ -058 tmpc = c->dp; -059 -060 /* if a is positive */ -061 if (a->sign == MP_ZPOS) \{ -062 /* add digit, after this we're propagating -063 * the carry. -064 */ -065 *tmpc = *tmpa++ + b; -066 mu = *tmpc >> DIGIT_BIT; -067 *tmpc++ &= MP_MASK; -068 -069 /* now handle rest of the digits */ -070 for (ix = 1; ix < a->used; ix++) \{ -071 *tmpc = *tmpa++ + mu; -072 mu = *tmpc >> DIGIT_BIT; -073 *tmpc++ &= MP_MASK; -074 \} -075 /* set final carry */ -076 ix++; -077 *tmpc++ = mu; -078 -079 /* setup size */ -080 c->used = a->used + 1; -081 \} else \{ -082 /* a was negative and |a| < b */ -083 c->used = 1; -084 -085 /* the result is a single digit */ -086 if (a->used == 1) \{ -087 *tmpc++ = b - a->dp[0]; -088 \} else \{ -089 *tmpc++ = b; -090 \} -091 -092 /* setup count so the clearing of oldused -093 * can fall through correctly -094 */ -095 ix = 1; -096 \} -097 -098 /* now zero to oldused */ -099 while (ix++ < oldused) \{ -100 *tmpc++ = 0; -101 \} -102 mp_clamp(c); -103 -104 return MP_OKAY; -105 \} -106 -107 #endif -108 -\end{alltt} -\end{small} - -Clever use of the letter 't'. - -\subsubsection{Subtraction} -The single digit subtraction algorithm mp\_sub\_d is essentially the same except it uses mp\_sub to subtract the digit from the mp\_int. - -\subsection{Single Digit Multiplication} -Single digit multiplication arises enough in division and radix conversion that it ought to be implement as a special case of the baseline -multiplication algorithm. Essentially this algorithm is a modified version of algorithm s\_mp\_mul\_digs where one of the multiplicands -only has one digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = ab$ \\ -\hline \\ -1. $pa \leftarrow a.used$ \\ -2. Grow $c$ to at least $pa + 1$ digits. \\ -3. $oldused \leftarrow c.used$ \\ -4. $c.used \leftarrow pa + 1$ \\ -5. $c.sign \leftarrow a.sign$ \\ -6. $\mu \leftarrow 0$ \\ -7. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}7.1 $\hat r \leftarrow \mu + a_{ix}b$ \\ -\hspace{3mm}7.2 $c_{ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}7.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -8. $c_{pa} \leftarrow \mu$ \\ -9. for $ix$ from $pa + 1$ to $oldused$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -10. Clamp excess digits of $c$. \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_d} -\end{figure} -\textbf{Algorithm mp\_mul\_d.} -This algorithm quickly multiplies an mp\_int by a small single digit value. It is specially tailored to the job and has a minimal of overhead. -Unlike the full multiplication algorithms this algorithm does not require any significnat temporary storage or memory allocations. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul\_d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* multiply by a digit */ -018 int -019 mp_mul_d (mp_int * a, mp_digit b, mp_int * c) -020 \{ -021 mp_digit u, *tmpa, *tmpc; -022 mp_word r; -023 int ix, res, olduse; -024 -025 /* make sure c is big enough to hold a*b */ -026 if (c->alloc < (a->used + 1)) \{ -027 if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) \{ -028 return res; -029 \} -030 \} -031 -032 /* get the original destinations used count */ -033 olduse = c->used; -034 -035 /* set the sign */ -036 c->sign = a->sign; -037 -038 /* alias for a->dp [source] */ -039 tmpa = a->dp; -040 -041 /* alias for c->dp [dest] */ -042 tmpc = c->dp; -043 -044 /* zero carry */ -045 u = 0; -046 -047 /* compute columns */ -048 for (ix = 0; ix < a->used; ix++) \{ -049 /* compute product and carry sum for this term */ -050 r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); -051 -052 /* mask off higher bits to get a single digit */ -053 *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); -054 -055 /* send carry into next iteration */ -056 u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); -057 \} -058 -059 /* store final carry [if any] and increment ix offset */ -060 *tmpc++ = u; -061 ++ix; -062 -063 /* now zero digits above the top */ -064 while (ix++ < olduse) \{ -065 *tmpc++ = 0; -066 \} -067 -068 /* set used count */ -069 c->used = a->used + 1; -070 mp_clamp(c); -071 -072 return MP_OKAY; -073 \} -074 #endif -075 -\end{alltt} -\end{small} - -In this implementation the destination $c$ may point to the same mp\_int as the source $a$ since the result is written after the digit is -read from the source. This function uses pointer aliases $tmpa$ and $tmpc$ for the digits of $a$ and $c$ respectively. - -\subsection{Single Digit Division} -Like the single digit multiplication algorithm, single digit division is also a fairly common algorithm used in radix conversion. Since the -divisor is only a single digit a specialized variant of the division algorithm can be used to compute the quotient. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = \lfloor a / b \rfloor, d = a - cb$ \\ -\hline \\ -1. If $b = 0$ then return(\textit{MP\_VAL}).\\ -2. If $b = 3$ then use algorithm mp\_div\_3 instead. \\ -3. Init $q$ to $a.used$ digits. \\ -4. $q.used \leftarrow a.used$ \\ -5. $q.sign \leftarrow a.sign$ \\ -6. $\hat w \leftarrow 0$ \\ -7. for $ix$ from $a.used - 1$ down to $0$ do \\ -\hspace{3mm}7.1 $\hat w \leftarrow \hat w \beta + a_{ix}$ \\ -\hspace{3mm}7.2 If $\hat w \ge b$ then \\ -\hspace{6mm}7.2.1 $t \leftarrow \lfloor \hat w / b \rfloor$ \\ -\hspace{6mm}7.2.2 $\hat w \leftarrow \hat w \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}7.3 else\\ -\hspace{6mm}7.3.1 $t \leftarrow 0$ \\ -\hspace{3mm}7.4 $q_{ix} \leftarrow t$ \\ -8. $d \leftarrow \hat w$ \\ -9. Clamp excess digits of $q$. \\ -10. $c \leftarrow q$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_d} -\end{figure} -\textbf{Algorithm mp\_div\_d.} -This algorithm divides the mp\_int $a$ by the single mp\_digit $b$ using an optimized approach. Essentially in every iteration of the -algorithm another digit of the dividend is reduced and another digit of quotient produced. Provided $b < \beta$ the value of $\hat w$ -after step 7.1 will be limited such that $0 \le \lfloor \hat w / b \rfloor < \beta$. - -If the divisor $b$ is equal to three a variant of this algorithm is used which is called mp\_div\_3. It replaces the division by three with -a multiplication by $\lfloor \beta / 3 \rfloor$ and the appropriate shift and residual fixup. In essence it is much like the Barrett reduction -from chapter seven. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div\_d.c -\vspace{-3mm} -\begin{alltt} -016 -017 static int s_is_power_of_two(mp_digit b, int *p) -018 \{ -019 int x; -020 -021 /* fast return if no power of two */ -022 if ((b == 0) || ((b & (b-1)) != 0)) \{ -023 return 0; -024 \} -025 -026 for (x = 0; x < DIGIT_BIT; x++) \{ -027 if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)<used)) != MP_OKAY) \{ -079 return res; -080 \} -081 -082 q.used = a->used; -083 q.sign = a->sign; -084 w = 0; -085 for (ix = a->used - 1; ix >= 0; ix--) \{ -086 w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); -087 -088 if (w >= b) \{ -089 t = (mp_digit)(w / b); -090 w -= ((mp_word)t) * ((mp_word)b); -091 \} else \{ -092 t = 0; -093 \} -094 q.dp[ix] = (mp_digit)t; -095 \} -096 -097 if (d != NULL) \{ -098 *d = (mp_digit)w; -099 \} -100 -101 if (c != NULL) \{ -102 mp_clamp(&q); -103 mp_exch(&q, c); -104 \} -105 mp_clear(&q); -106 -107 return res; -108 \} -109 -110 #endif -111 -\end{alltt} -\end{small} - -Like the implementation of algorithm mp\_div this algorithm allows either of the quotient or remainder to be passed as a \textbf{NULL} pointer to -indicate the respective value is not required. This allows a trivial single digit modular reduction algorithm, mp\_mod\_d to be created. - -The division and remainder on lines 89 and 90 can be replaced often by a single division on most processors. For example, the 32-bit x86 based -processors can divide a 64-bit quantity by a 32-bit quantity and produce the quotient and remainder simultaneously. Unfortunately the GCC -compiler does not recognize that optimization and will actually produce two function calls to find the quotient and remainder respectively. - -\subsection{Single Digit Root Extraction} - -Finding the $n$'th root of an integer is fairly easy as far as numerical analysis is concerned. Algorithms such as the Newton-Raphson approximation -(\ref{eqn:newton}) series will converge very quickly to a root for any continuous function $f(x)$. - -\begin{equation} -x_{i+1} = x_i - {f(x_i) \over f'(x_i)} -\label{eqn:newton} -\end{equation} - -In this case the $n$'th root is desired and $f(x) = x^n - a$ where $a$ is the integer of which the root is desired. The derivative of $f(x)$ is -simply $f'(x) = nx^{n - 1}$. Of particular importance is that this algorithm will be used over the integers not over the a more continuous domain -such as the real numbers. As a result the root found can be above the true root by few and must be manually adjusted. Ideally at the end of the -algorithm the $n$'th root $b$ of an integer $a$ is desired such that $b^n \le a$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_n\_root}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c^b \le a$ \\ -\hline \\ -1. If $b$ is even and $a.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. $sign \leftarrow a.sign$ \\ -3. $a.sign \leftarrow MP\_ZPOS$ \\ -4. t$2 \leftarrow 2$ \\ -5. Loop \\ -\hspace{3mm}5.1 t$1 \leftarrow $ t$2$ \\ -\hspace{3mm}5.2 t$3 \leftarrow $ t$1^{b - 1}$ \\ -\hspace{3mm}5.3 t$2 \leftarrow $ t$3 $ $\cdot$ t$1$ \\ -\hspace{3mm}5.4 t$2 \leftarrow $ t$2 - a$ \\ -\hspace{3mm}5.5 t$3 \leftarrow $ t$3 \cdot b$ \\ -\hspace{3mm}5.6 t$3 \leftarrow \lfloor $t$2 / $t$3 \rfloor$ \\ -\hspace{3mm}5.7 t$2 \leftarrow $ t$1 - $ t$3$ \\ -\hspace{3mm}5.8 If t$1 \ne $ t$2$ then goto step 5. \\ -6. Loop \\ -\hspace{3mm}6.1 t$2 \leftarrow $ t$1^b$ \\ -\hspace{3mm}6.2 If t$2 > a$ then \\ -\hspace{6mm}6.2.1 t$1 \leftarrow $ t$1 - 1$ \\ -\hspace{6mm}6.2.2 Goto step 6. \\ -7. $a.sign \leftarrow sign$ \\ -8. $c \leftarrow $ t$1$ \\ -9. $c.sign \leftarrow sign$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_n\_root} -\end{figure} -\textbf{Algorithm mp\_n\_root.} -This algorithm finds the integer $n$'th root of an input using the Newton-Raphson approach. It is partially optimized based on the observation -that the numerator of ${f(x) \over f'(x)}$ can be derived from a partial denominator. That is at first the denominator is calculated by finding -$x^{b - 1}$. This value can then be multiplied by $x$ and have $a$ subtracted from it to find the numerator. This saves a total of $b - 1$ -multiplications by t$1$ inside the loop. - -The initial value of the approximation is t$2 = 2$ which allows the algorithm to start with very small values and quickly converge on the -root. Ideally this algorithm is meant to find the $n$'th root of an input where $n$ is bounded by $2 \le n \le 5$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_n\_root.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* wrapper function for mp_n_root_ex() -018 * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a -019 */ -020 int mp_n_root (mp_int * a, mp_digit b, mp_int * c) -021 \{ -022 return mp_n_root_ex(a, b, c, 0); -023 \} -024 -025 #endif -026 -\end{alltt} -\end{small} - -\section{Random Number Generation} - -Random numbers come up in a variety of activities from public key cryptography to simple simulations and various randomized algorithms. Pollard-Rho -factoring for example, can make use of random values as starting points to find factors of a composite integer. In this case the algorithm presented -is solely for simulations and not intended for cryptographic use. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rand}. \\ -\textbf{Input}. An integer $b$ \\ -\textbf{Output}. A pseudo-random number of $b$ digits \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $b \le 0$ return(\textit{MP\_OKAY}) \\ -3. Pick a non-zero random digit $d$. \\ -4. $a \leftarrow a + d$ \\ -5. for $ix$ from 1 to $d - 1$ do \\ -\hspace{3mm}5.1 $a \leftarrow a \cdot \beta$ \\ -\hspace{3mm}5.2 Pick a random digit $d$. \\ -\hspace{3mm}5.3 $a \leftarrow a + d$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rand} -\end{figure} -\textbf{Algorithm mp\_rand.} -This algorithm produces a pseudo-random integer of $b$ digits. By ensuring that the first digit is non-zero the algorithm also guarantees that the -final result has at least $b$ digits. It relies heavily on a third-part random number generator which should ideally generate uniformly all of -the integers from $0$ to $\beta - 1$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_rand.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* makes a pseudo-random int of a given size */ -018 int -019 mp_rand (mp_int * a, int digits) -020 \{ -021 int res; -022 mp_digit d; -023 -024 mp_zero (a); -025 if (digits <= 0) \{ -026 return MP_OKAY; -027 \} -028 -029 /* first place a random non-zero digit */ -030 do \{ -031 d = ((mp_digit) abs (MP_GEN_RANDOM())) & MP_MASK; -032 \} while (d == 0); -033 -034 if ((res = mp_add_d (a, d, a)) != MP_OKAY) \{ -035 return res; -036 \} -037 -038 while (--digits > 0) \{ -039 if ((res = mp_lshd (a, 1)) != MP_OKAY) \{ -040 return res; -041 \} -042 -043 if ((res = mp_add_d (a, ((mp_digit) abs (MP_GEN_RANDOM())), a)) != MP_OK - AY) \{ -044 return res; -045 \} -046 \} -047 -048 return MP_OKAY; -049 \} -050 #endif -051 -\end{alltt} -\end{small} - -\section{Formatted Representations} -The ability to emit a radix-$n$ textual representation of an integer is useful for interacting with human parties. For example, the ability to -be given a string of characters such as ``114585'' and turn it into the radix-$\beta$ equivalent would make it easier to enter numbers -into a program. - -\subsection{Reading Radix-n Input} -For the purposes of this text we will assume that a simple lower ASCII map (\ref{fig:ASC}) is used for the values of from $0$ to $63$ to -printable characters. For example, when the character ``N'' is read it represents the integer $23$. The first $16$ characters of the -map are for the common representations up to hexadecimal. After that they match the ``base64'' encoding scheme which are suitable chosen -such that they are printable. While outputting as base64 may not be too helpful for human operators it does allow communication via non binary -mediums. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{cc|cc|cc|cc} -\hline \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} \\ -\hline -0 & 0 & 1 & 1 & 2 & 2 & 3 & 3 \\ -4 & 4 & 5 & 5 & 6 & 6 & 7 & 7 \\ -8 & 8 & 9 & 9 & 10 & A & 11 & B \\ -12 & C & 13 & D & 14 & E & 15 & F \\ -16 & G & 17 & H & 18 & I & 19 & J \\ -20 & K & 21 & L & 22 & M & 23 & N \\ -24 & O & 25 & P & 26 & Q & 27 & R \\ -28 & S & 29 & T & 30 & U & 31 & V \\ -32 & W & 33 & X & 34 & Y & 35 & Z \\ -36 & a & 37 & b & 38 & c & 39 & d \\ -40 & e & 41 & f & 42 & g & 43 & h \\ -44 & i & 45 & j & 46 & k & 47 & l \\ -48 & m & 49 & n & 50 & o & 51 & p \\ -52 & q & 53 & r & 54 & s & 55 & t \\ -56 & u & 57 & v & 58 & w & 59 & x \\ -60 & y & 61 & z & 62 & $+$ & 63 & $/$ \\ -\hline -\end{tabular} -\end{center} -\caption{Lower ASCII Map} -\label{fig:ASC} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_read\_radix}. \\ -\textbf{Input}. A string $str$ of length $sn$ and radix $r$. \\ -\textbf{Output}. The radix-$\beta$ equivalent mp\_int. \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. $ix \leftarrow 0$ \\ -3. If $str_0 =$ ``-'' then do \\ -\hspace{3mm}3.1 $ix \leftarrow ix + 1$ \\ -\hspace{3mm}3.2 $sign \leftarrow MP\_NEG$ \\ -4. else \\ -\hspace{3mm}4.1 $sign \leftarrow MP\_ZPOS$ \\ -5. $a \leftarrow 0$ \\ -6. for $iy$ from $ix$ to $sn - 1$ do \\ -\hspace{3mm}6.1 Let $y$ denote the position in the map of $str_{iy}$. \\ -\hspace{3mm}6.2 If $str_{iy}$ is not in the map or $y \ge r$ then goto step 7. \\ -\hspace{3mm}6.3 $a \leftarrow a \cdot r$ \\ -\hspace{3mm}6.4 $a \leftarrow a + y$ \\ -7. If $a \ne 0$ then $a.sign \leftarrow sign$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_read\_radix} -\end{figure} -\textbf{Algorithm mp\_read\_radix.} -This algorithm will read an ASCII string and produce the radix-$\beta$ mp\_int representation of the same integer. A minus symbol ``-'' may precede the -string to indicate the value is negative, otherwise it is assumed to be positive. The algorithm will read up to $sn$ characters from the input -and will stop when it reads a character it cannot map the algorithm stops reading characters from the string. This allows numbers to be embedded -as part of larger input without any significant problem. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_read\_radix.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* read a string [ASCII] in a given radix */ -018 int mp_read_radix (mp_int * a, const char *str, int radix) -019 \{ -020 int y, res, neg; -021 char ch; -022 -023 /* zero the digit bignum */ -024 mp_zero(a); -025 -026 /* make sure the radix is ok */ -027 if ((radix < 2) || (radix > 64)) \{ -028 return MP_VAL; -029 \} -030 -031 /* if the leading digit is a -032 * minus set the sign to negative. -033 */ -034 if (*str == '-') \{ -035 ++str; -036 neg = MP_NEG; -037 \} else \{ -038 neg = MP_ZPOS; -039 \} -040 -041 /* set the integer to the default of zero */ -042 mp_zero (a); -043 -044 /* process each digit of the string */ -045 while (*str != '\symbol{92}0') \{ -046 /* if the radix <= 36 the conversion is case insensitive -047 * this allows numbers like 1AB and 1ab to represent the same value -048 * [e.g. in hex] -049 */ -050 ch = (radix <= 36) ? (char)toupper((int)*str) : *str; -051 for (y = 0; y < 64; y++) \{ -052 if (ch == mp_s_rmap[y]) \{ -053 break; -054 \} -055 \} -056 -057 /* if the char was found in the map -058 * and is less than the given radix add it -059 * to the number, otherwise exit the loop. -060 */ -061 if (y < radix) \{ -062 if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) \{ -063 return res; -064 \} -065 if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) \{ -066 return res; -067 \} -068 \} else \{ -069 break; -070 \} -071 ++str; -072 \} -073 -074 /* set the sign only if a != 0 */ -075 if (mp_iszero(a) != MP_YES) \{ -076 a->sign = neg; -077 \} -078 return MP_OKAY; -079 \} -080 #endif -081 -\end{alltt} -\end{small} - -\subsection{Generating Radix-$n$ Output} -Generating radix-$n$ output is fairly trivial with a division and remainder algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toradix}. \\ -\textbf{Input}. A mp\_int $a$ and an integer $r$\\ -\textbf{Output}. The radix-$r$ representation of $a$ \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. If $a = 0$ then $str = $ ``$0$'' and return(\textit{MP\_OKAY}). \\ -3. $t \leftarrow a$ \\ -4. $str \leftarrow$ ``'' \\ -5. if $t.sign = MP\_NEG$ then \\ -\hspace{3mm}5.1 $str \leftarrow str + $ ``-'' \\ -\hspace{3mm}5.2 $t.sign = MP\_ZPOS$ \\ -6. While ($t \ne 0$) do \\ -\hspace{3mm}6.1 $d \leftarrow t \mbox{ (mod }r\mbox{)}$ \\ -\hspace{3mm}6.2 $t \leftarrow \lfloor t / r \rfloor$ \\ -\hspace{3mm}6.3 Look up $d$ in the map and store the equivalent character in $y$. \\ -\hspace{3mm}6.4 $str \leftarrow str + y$ \\ -7. If $str_0 = $``$-$'' then \\ -\hspace{3mm}7.1 Reverse the digits $str_1, str_2, \ldots str_n$. \\ -8. Otherwise \\ -\hspace{3mm}8.1 Reverse the digits $str_0, str_1, \ldots str_n$. \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toradix} -\end{figure} -\textbf{Algorithm mp\_toradix.} -This algorithm computes the radix-$r$ representation of an mp\_int $a$. The ``digits'' of the representation are extracted by reducing -successive powers of $\lfloor a / r^k \rfloor$ the input modulo $r$ until $r^k > a$. Note that instead of actually dividing by $r^k$ in -each iteration the quotient $\lfloor a / r \rfloor$ is saved for the next iteration. As a result a series of trivial $n \times 1$ divisions -are required instead of a series of $n \times k$ divisions. One design flaw of this approach is that the digits are produced in the reverse order -(see~\ref{fig:mpradix}). To remedy this flaw the digits must be swapped or simply ``reversed''. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Value of $a$} & \textbf{Value of $d$} & \textbf{Value of $str$} \\ -\hline $1234$ & -- & -- \\ -\hline $123$ & $4$ & ``4'' \\ -\hline $12$ & $3$ & ``43'' \\ -\hline $1$ & $2$ & ``432'' \\ -\hline $0$ & $1$ & ``4321'' \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Algorithm mp\_toradix.} -\label{fig:mpradix} -\end{figure} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_toradix.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* stores a bignum as a ASCII string in a given radix (2..64) */ -018 int mp_toradix (mp_int * a, char *str, int radix) -019 \{ -020 int res, digs; -021 mp_int t; -022 mp_digit d; -023 char *_s = str; -024 -025 /* check range of the radix */ -026 if ((radix < 2) || (radix > 64)) \{ -027 return MP_VAL; -028 \} -029 -030 /* quick out if its zero */ -031 if (mp_iszero(a) == MP_YES) \{ -032 *str++ = '0'; -033 *str = '\symbol{92}0'; -034 return MP_OKAY; -035 \} -036 -037 if ((res = mp_init_copy (&t, a)) != MP_OKAY) \{ -038 return res; -039 \} -040 -041 /* if it is negative output a - */ -042 if (t.sign == MP_NEG) \{ -043 ++_s; -044 *str++ = '-'; -045 t.sign = MP_ZPOS; -046 \} -047 -048 digs = 0; -049 while (mp_iszero (&t) == MP_NO) \{ -050 if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) \{ -051 mp_clear (&t); -052 return res; -053 \} -054 *str++ = mp_s_rmap[d]; -055 ++digs; -056 \} -057 -058 /* reverse the digits of the string. In this case _s points -059 * to the first digit [exluding the sign] of the number] -060 */ -061 bn_reverse ((unsigned char *)_s, digs); -062 -063 /* append a NULL so the string is properly terminated */ -064 *str = '\symbol{92}0'; -065 -066 mp_clear (&t); -067 return MP_OKAY; -068 \} -069 -070 #endif -071 -\end{alltt} -\end{small} - -\chapter{Number Theoretic Algorithms} -This chapter discusses several fundamental number theoretic algorithms such as the greatest common divisor, least common multiple and Jacobi -symbol computation. These algorithms arise as essential components in several key cryptographic algorithms such as the RSA public key algorithm and -various Sieve based factoring algorithms. - -\section{Greatest Common Divisor} -The greatest common divisor of two integers $a$ and $b$, often denoted as $(a, b)$ is the largest integer $k$ that is a proper divisor of -both $a$ and $b$. That is, $k$ is the largest integer such that $0 \equiv a \mbox{ (mod }k\mbox{)}$ and $0 \equiv b \mbox{ (mod }k\mbox{)}$ occur -simultaneously. - -The most common approach (cite) is to reduce one input modulo another. That is if $a$ and $b$ are divisible by some integer $k$ and if $qa + r = b$ then -$r$ is also divisible by $k$. The reduction pattern follows $\left < a , b \right > \rightarrow \left < b, a \mbox{ mod } b \right >$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (I)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 $r \leftarrow a \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}1.2 $a \leftarrow b$ \\ -\hspace{3mm}1.3 $b \leftarrow r$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (I)} -\label{fig:gcd1} -\end{figure} - -This algorithm will quickly converge on the greatest common divisor since the residue $r$ tends diminish rapidly. However, divisions are -relatively expensive operations to perform and should ideally be avoided. There is another approach based on a similar relationship of -greatest common divisors. The faster approach is based on the observation that if $k$ divides both $a$ and $b$ it will also divide $a - b$. -In particular, we would like $a - b$ to decrease in magnitude which implies that $b \ge a$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (II)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}1.2 $b \leftarrow b - a$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (II)} -\label{fig:gcd2} -\end{figure} - -\textbf{Proof} \textit{Algorithm~\ref{fig:gcd2} will return the greatest common divisor of $a$ and $b$.} -The algorithm in figure~\ref{fig:gcd2} will eventually terminate since $b \ge a$ the subtraction in step 1.2 will be a value less than $b$. In other -words in every iteration that tuple $\left < a, b \right >$ decrease in magnitude until eventually $a = b$. Since both $a$ and $b$ are always -divisible by the greatest common divisor (\textit{until the last iteration}) and in the last iteration of the algorithm $b = 0$, therefore, in the -second to last iteration of the algorithm $b = a$ and clearly $(a, a) = a$ which concludes the proof. \textbf{QED}. - -As a matter of practicality algorithm \ref{fig:gcd1} decreases far too slowly to be useful. Specially if $b$ is much larger than $a$ such that -$b - a$ is still very much larger than $a$. A simple addition to the algorithm is to divide $b - a$ by a power of some integer $p$ which does -not divide the greatest common divisor but will divide $b - a$. In this case ${b - a} \over p$ is also an integer and still divisible by -the greatest common divisor. - -However, instead of factoring $b - a$ to find a suitable value of $p$ the powers of $p$ can be removed from $a$ and $b$ that are in common first. -Then inside the loop whenever $b - a$ is divisible by some power of $p$ it can be safely removed. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (III)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. $k \leftarrow 0$ \\ -2. While $a$ and $b$ are both divisible by $p$ do \\ -\hspace{3mm}2.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -\hspace{3mm}2.2 $b \leftarrow \lfloor b / p \rfloor$ \\ -\hspace{3mm}2.3 $k \leftarrow k + 1$ \\ -3. While $a$ is divisible by $p$ do \\ -\hspace{3mm}3.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -4. While $b$ is divisible by $p$ do \\ -\hspace{3mm}4.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -5. While ($b > 0$) do \\ -\hspace{3mm}5.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}5.2 $b \leftarrow b - a$ \\ -\hspace{3mm}5.3 While $b$ is divisible by $p$ do \\ -\hspace{6mm}5.3.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -6. Return($a \cdot p^k$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (III)} -\label{fig:gcd3} -\end{figure} - -This algorithm is based on the first except it removes powers of $p$ first and inside the main loop to ensure the tuple $\left < a, b \right >$ -decreases more rapidly. The first loop on step two removes powers of $p$ that are in common. A count, $k$, is kept which will present a common -divisor of $p^k$. After step two the remaining common divisor of $a$ and $b$ cannot be divisible by $p$. This means that $p$ can be safely -divided out of the difference $b - a$ so long as the division leaves no remainder. - -In particular the value of $p$ should be chosen such that the division on step 5.3.1 occur often. It also helps that division by $p$ be easy -to compute. The ideal choice of $p$ is two since division by two amounts to a right logical shift. Another important observation is that by -step five both $a$ and $b$ are odd. Therefore, the diffrence $b - a$ must be even which means that each iteration removes one bit from the -largest of the pair. - -\subsection{Complete Greatest Common Divisor} -The algorithms presented so far cannot handle inputs which are zero or negative. The following algorithm can handle all input cases properly -and will produce the greatest common divisor. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_gcd}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The greatest common divisor $c = (a, b)$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow \vert b \vert $ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b = 0$ then \\ -\hspace{3mm}2.1 $c \leftarrow \vert a \vert $ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $u \leftarrow \vert a \vert, v \leftarrow \vert b \vert$ \\ -4. $k \leftarrow 0$ \\ -5. While $u.used > 0$ and $v.used > 0$ and $u_0 \equiv v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}5.3 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -8. While $v.used > 0$ \\ -\hspace{3mm}8.1 If $\vert u \vert > \vert v \vert$ then \\ -\hspace{6mm}8.1.1 Swap $u$ and $v$. \\ -\hspace{3mm}8.2 $v \leftarrow \vert v \vert - \vert u \vert$ \\ -\hspace{3mm}8.3 While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{6mm}8.3.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -9. $c \leftarrow u \cdot 2^k$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_gcd} -\end{figure} -\textbf{Algorithm mp\_gcd.} -This algorithm will produce the greatest common divisor of two mp\_ints $a$ and $b$. The algorithm was originally based on Algorithm B of -Knuth \cite[pp. 338]{TAOCPV2} but has been modified to be simpler to explain. In theory it achieves the same asymptotic working time as -Algorithm B and in practice this appears to be true. - -The first two steps handle the cases where either one of or both inputs are zero. If either input is zero the greatest common divisor is the -largest input or zero if they are both zero. If the inputs are not trivial than $u$ and $v$ are assigned the absolute values of -$a$ and $b$ respectively and the algorithm will proceed to reduce the pair. - -Step five will divide out any common factors of two and keep track of the count in the variable $k$. After this step, two is no longer a -factor of the remaining greatest common divisor between $u$ and $v$ and can be safely evenly divided out of either whenever they are even. Step -six and seven ensure that the $u$ and $v$ respectively have no more factors of two. At most only one of the while--loops will iterate since -they cannot both be even. - -By step eight both of $u$ and $v$ are odd which is required for the inner logic. First the pair are swapped such that $v$ is equal to -or greater than $u$. This ensures that the subtraction on step 8.2 will always produce a positive and even result. Step 8.3 removes any -factors of two from the difference $u$ to ensure that in the next iteration of the loop both are once again odd. - -After $v = 0$ occurs the variable $u$ has the greatest common divisor of the pair $\left < u, v \right >$ just after step six. The result -must be adjusted by multiplying by the common factors of two ($2^k$) removed earlier. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_gcd.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Greatest Common Divisor using the binary method */ -018 int mp_gcd (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 mp_int u, v; -021 int k, u_lsb, v_lsb, res; -022 -023 /* either zero than gcd is the largest */ -024 if (mp_iszero (a) == MP_YES) \{ -025 return mp_abs (b, c); -026 \} -027 if (mp_iszero (b) == MP_YES) \{ -028 return mp_abs (a, c); -029 \} -030 -031 /* get copies of a and b we can modify */ -032 if ((res = mp_init_copy (&u, a)) != MP_OKAY) \{ -033 return res; -034 \} -035 -036 if ((res = mp_init_copy (&v, b)) != MP_OKAY) \{ -037 goto LBL_U; -038 \} -039 -040 /* must be positive for the remainder of the algorithm */ -041 u.sign = v.sign = MP_ZPOS; -042 -043 /* B1. Find the common power of two for u and v */ -044 u_lsb = mp_cnt_lsb(&u); -045 v_lsb = mp_cnt_lsb(&v); -046 k = MIN(u_lsb, v_lsb); -047 -048 if (k > 0) \{ -049 /* divide the power of two out */ -050 if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) \{ -051 goto LBL_V; -052 \} -053 -054 if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) \{ -055 goto LBL_V; -056 \} -057 \} -058 -059 /* divide any remaining factors of two out */ -060 if (u_lsb != k) \{ -061 if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) \{ -062 goto LBL_V; -063 \} -064 \} -065 -066 if (v_lsb != k) \{ -067 if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) \{ -068 goto LBL_V; -069 \} -070 \} -071 -072 while (mp_iszero(&v) == MP_NO) \{ -073 /* make sure v is the largest */ -074 if (mp_cmp_mag(&u, &v) == MP_GT) \{ -075 /* swap u and v to make sure v is >= u */ -076 mp_exch(&u, &v); -077 \} -078 -079 /* subtract smallest from largest */ -080 if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) \{ -081 goto LBL_V; -082 \} -083 -084 /* Divide out all factors of two */ -085 if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) \{ -086 goto LBL_V; -087 \} -088 \} -089 -090 /* multiply by 2**k which we divided out at the beginning */ -091 if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) \{ -092 goto LBL_V; -093 \} -094 c->sign = MP_ZPOS; -095 res = MP_OKAY; -096 LBL_V:mp_clear (&u); -097 LBL_U:mp_clear (&v); -098 return res; -099 \} -100 #endif -101 -\end{alltt} -\end{small} - -This function makes use of the macros mp\_iszero and mp\_iseven. The former evaluates to $1$ if the input mp\_int is equivalent to the -integer zero otherwise it evaluates to $0$. The latter evaluates to $1$ if the input mp\_int represents a non-zero even integer otherwise -it evaluates to $0$. Note that just because mp\_iseven may evaluate to $0$ does not mean the input is odd, it could also be zero. The three -trivial cases of inputs are handled on lines 23 through 29. After those lines the inputs are assumed to be non-zero. - -Lines 32 and 36 make local copies $u$ and $v$ of the inputs $a$ and $b$ respectively. At this point the common factors of two -must be divided out of the two inputs. The block starting at line 43 removes common factors of two by first counting the number of trailing -zero bits in both. The local integer $k$ is used to keep track of how many factors of $2$ are pulled out of both values. It is assumed that -the number of factors will not exceed the maximum value of a C ``int'' data type\footnote{Strictly speaking no array in C may have more than -entries than are accessible by an ``int'' so this is not a limitation.}. - -At this point there are no more common factors of two in the two values. The divisions by a power of two on lines 61 and 67 remove -any independent factors of two such that both $u$ and $v$ are guaranteed to be an odd integer before hitting the main body of the algorithm. The while loop -on line 72 performs the reduction of the pair until $v$ is equal to zero. The unsigned comparison and subtraction algorithms are used in -place of the full signed routines since both values are guaranteed to be positive and the result of the subtraction is guaranteed to be non-negative. - -\section{Least Common Multiple} -The least common multiple of a pair of integers is their product divided by their greatest common divisor. For two integers $a$ and $b$ the -least common multiple is normally denoted as $[ a, b ]$ and numerically equivalent to ${ab} \over {(a, b)}$. For example, if $a = 2 \cdot 2 \cdot 3 = 12$ -and $b = 2 \cdot 3 \cdot 3 \cdot 7 = 126$ the least common multiple is ${126 \over {(12, 126)}} = {126 \over 6} = 21$. - -The least common multiple arises often in coding theory as well as number theory. If two functions have periods of $a$ and $b$ respectively they will -collide, that is be in synchronous states, after only $[ a, b ]$ iterations. This is why, for example, random number generators based on -Linear Feedback Shift Registers (LFSR) tend to use registers with periods which are co-prime (\textit{e.g. the greatest common divisor is one.}). -Similarly in number theory if a composite $n$ has two prime factors $p$ and $q$ then maximal order of any unit of $\Z/n\Z$ will be $[ p - 1, q - 1] $. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lcm}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The least common multiple $c = [a, b]$. \\ -\hline \\ -1. $c \leftarrow (a, b)$ \\ -2. $t \leftarrow a \cdot b$ \\ -3. $c \leftarrow \lfloor t / c \rfloor$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lcm} -\end{figure} -\textbf{Algorithm mp\_lcm.} -This algorithm computes the least common multiple of two mp\_int inputs $a$ and $b$. It computes the least common multiple directly by -dividing the product of the two inputs by their greatest common divisor. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_lcm.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes least common multiple as |a*b|/(a, b) */ -018 int mp_lcm (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 int res; -021 mp_int t1, t2; -022 -023 -024 if ((res = mp_init_multi (&t1, &t2, NULL)) != MP_OKAY) \{ -025 return res; -026 \} -027 -028 /* t1 = get the GCD of the two inputs */ -029 if ((res = mp_gcd (a, b, &t1)) != MP_OKAY) \{ -030 goto LBL_T; -031 \} -032 -033 /* divide the smallest by the GCD */ -034 if (mp_cmp_mag(a, b) == MP_LT) \{ -035 /* store quotient in t2 such that t2 * b is the LCM */ -036 if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) \{ -037 goto LBL_T; -038 \} -039 res = mp_mul(b, &t2, c); -040 \} else \{ -041 /* store quotient in t2 such that t2 * a is the LCM */ -042 if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) \{ -043 goto LBL_T; -044 \} -045 res = mp_mul(a, &t2, c); -046 \} -047 -048 /* fix the sign to positive */ -049 c->sign = MP_ZPOS; -050 -051 LBL_T: -052 mp_clear_multi (&t1, &t2, NULL); -053 return res; -054 \} -055 #endif -056 -\end{alltt} -\end{small} - -\section{Jacobi Symbol Computation} -To explain the Jacobi Symbol we shall first discuss the Legendre function\footnote{Arrg. What is the name of this?} off which the Jacobi symbol is -defined. The Legendre function computes whether or not an integer $a$ is a quadratic residue modulo an odd prime $p$. Numerically it is -equivalent to equation \ref{eqn:legendre}. - -\textit{-- Tom, don't be an ass, cite your source here...!} - -\begin{equation} -a^{(p-1)/2} \equiv \begin{array}{rl} - -1 & \mbox{if }a\mbox{ is a quadratic non-residue.} \\ - 0 & \mbox{if }a\mbox{ divides }p\mbox{.} \\ - 1 & \mbox{if }a\mbox{ is a quadratic residue}. - \end{array} \mbox{ (mod }p\mbox{)} -\label{eqn:legendre} -\end{equation} - -\textbf{Proof.} \textit{Equation \ref{eqn:legendre} correctly identifies the residue status of an integer $a$ modulo a prime $p$.} -An integer $a$ is a quadratic residue if the following equation has a solution. - -\begin{equation} -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\label{eqn:root} -\end{equation} - -Consider the following equation. - -\begin{equation} -0 \equiv x^{p-1} - 1 \equiv \left \lbrace \left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \right \rbrace + \left ( a^{(p-1)/2} - 1 \right ) \mbox{ (mod }p\mbox{)} -\label{eqn:rooti} -\end{equation} - -Whether equation \ref{eqn:root} has a solution or not equation \ref{eqn:rooti} is always true. If $a^{(p-1)/2} - 1 \equiv 0 \mbox{ (mod }p\mbox{)}$ -then the quantity in the braces must be zero. By reduction, - -\begin{eqnarray} -\left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \equiv 0 \nonumber \\ -\left (x^2 \right )^{(p-1)/2} \equiv a^{(p-1)/2} \nonumber \\ -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\end{eqnarray} - -As a result there must be a solution to the quadratic equation and in turn $a$ must be a quadratic residue. If $a$ does not divide $p$ and $a$ -is not a quadratic residue then the only other value $a^{(p-1)/2}$ may be congruent to is $-1$ since -\begin{equation} -0 \equiv a^{p - 1} - 1 \equiv (a^{(p-1)/2} + 1)(a^{(p-1)/2} - 1) \mbox{ (mod }p\mbox{)} -\end{equation} -One of the terms on the right hand side must be zero. \textbf{QED} - -\subsection{Jacobi Symbol} -The Jacobi symbol is a generalization of the Legendre function for any odd non prime moduli $p$ greater than 2. If $p = \prod_{i=0}^n p_i$ then -the Jacobi symbol $\left ( { a \over p } \right )$ is equal to the following equation. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { a \over p_0} \right ) \left ( { a \over p_1} \right ) \ldots \left ( { a \over p_n} \right ) -\end{equation} - -By inspection if $p$ is prime the Jacobi symbol is equivalent to the Legendre function. The following facts\footnote{See HAC \cite[pp. 72-74]{HAC} for -further details.} will be used to derive an efficient Jacobi symbol algorithm. Where $p$ is an odd integer greater than two and $a, b \in \Z$ the -following are true. - -\begin{enumerate} -\item $\left ( { a \over p} \right )$ equals $-1$, $0$ or $1$. -\item $\left ( { ab \over p} \right ) = \left ( { a \over p} \right )\left ( { b \over p} \right )$. -\item If $a \equiv b$ then $\left ( { a \over p} \right ) = \left ( { b \over p} \right )$. -\item $\left ( { 2 \over p} \right )$ equals $1$ if $p \equiv 1$ or $7 \mbox{ (mod }8\mbox{)}$. Otherwise, it equals $-1$. -\item $\left ( { a \over p} \right ) \equiv \left ( { p \over a} \right ) \cdot (-1)^{(p-1)(a-1)/4}$. More specifically -$\left ( { a \over p} \right ) = \left ( { p \over a} \right )$ if $p \equiv a \equiv 1 \mbox{ (mod }4\mbox{)}$. -\end{enumerate} - -Using these facts if $a = 2^k \cdot a'$ then - -\begin{eqnarray} -\left ( { a \over p } \right ) = \left ( {{2^k} \over p } \right ) \left ( {a' \over p} \right ) \nonumber \\ - = \left ( {2 \over p } \right )^k \left ( {a' \over p} \right ) -\label{eqn:jacobi} -\end{eqnarray} - -By fact five, - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { p \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -Subsequently by fact three since $p \equiv (p \mbox{ mod }a) \mbox{ (mod }a\mbox{)}$ then - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { {p \mbox{ mod } a} \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -By putting both observations into equation \ref{eqn:jacobi} the following simplified equation is formed. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( {2 \over p } \right )^k \left ( {{p\mbox{ mod }a'} \over a'} \right ) \cdot (-1)^{(p-1)(a'-1)/4} -\end{equation} - -The value of $\left ( {{p \mbox{ mod }a'} \over a'} \right )$ can be found by using the same equation recursively. The value of -$\left ( {2 \over p } \right )^k$ equals $1$ if $k$ is even otherwise it equals $\left ( {2 \over p } \right )$. Using this approach the -factors of $p$ do not have to be known. Furthermore, if $(a, p) = 1$ then the algorithm will terminate when the recursion requests the -Jacobi symbol computation of $\left ( {1 \over a'} \right )$ which is simply $1$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_jacobi}. \\ -\textbf{Input}. mp\_int $a$ and $p$, $a \ge 0$, $p \ge 3$, $p \equiv 1 \mbox{ (mod }2\mbox{)}$ \\ -\textbf{Output}. The Jacobi symbol $c = \left ( {a \over p } \right )$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow 0$ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $a = 1$ then \\ -\hspace{3mm}2.1 $c \leftarrow 1$ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $a' \leftarrow a$ \\ -4. $k \leftarrow 0$ \\ -5. While $a'.used > 0$ and $a'_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $a' \leftarrow \lfloor a' / 2 \rfloor$ \\ -6. If $k \equiv 0 \mbox{ (mod }2\mbox{)}$ then \\ -\hspace{3mm}6.1 $s \leftarrow 1$ \\ -7. else \\ -\hspace{3mm}7.1 $r \leftarrow p_0 \mbox{ (mod }8\mbox{)}$ \\ -\hspace{3mm}7.2 If $r = 1$ or $r = 7$ then \\ -\hspace{6mm}7.2.1 $s \leftarrow 1$ \\ -\hspace{3mm}7.3 else \\ -\hspace{6mm}7.3.1 $s \leftarrow -1$ \\ -8. If $p_0 \equiv a'_0 \equiv 3 \mbox{ (mod }4\mbox{)}$ then \\ -\hspace{3mm}8.1 $s \leftarrow -s$ \\ -9. If $a' \ne 1$ then \\ -\hspace{3mm}9.1 $p' \leftarrow p \mbox{ (mod }a'\mbox{)}$ \\ -\hspace{3mm}9.2 $s \leftarrow s \cdot \mbox{mp\_jacobi}(p', a')$ \\ -10. $c \leftarrow s$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_jacobi} -\end{figure} -\textbf{Algorithm mp\_jacobi.} -This algorithm computes the Jacobi symbol for an arbitrary positive integer $a$ with respect to an odd integer $p$ greater than three. The algorithm -is based on algorithm 2.149 of HAC \cite[pp. 73]{HAC}. - -Step numbers one and two handle the trivial cases of $a = 0$ and $a = 1$ respectively. Step five determines the number of two factors in the -input $a$. If $k$ is even than the term $\left ( { 2 \over p } \right )^k$ must always evaluate to one. If $k$ is odd than the term evaluates to one -if $p_0$ is congruent to one or seven modulo eight, otherwise it evaluates to $-1$. After the the $\left ( { 2 \over p } \right )^k$ term is handled -the $(-1)^{(p-1)(a'-1)/4}$ is computed and multiplied against the current product $s$. The latter term evaluates to one if both $p$ and $a'$ -are congruent to one modulo four, otherwise it evaluates to negative one. - -By step nine if $a'$ does not equal one a recursion is required. Step 9.1 computes $p' \equiv p \mbox{ (mod }a'\mbox{)}$ and will recurse to compute -$\left ( {p' \over a'} \right )$ which is multiplied against the current Jacobi product. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_jacobi.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes the jacobi c = (a | n) (or Legendre if n is prime) -018 * HAC pp. 73 Algorithm 2.149 -019 * HAC is wrong here, as the special case of (0 | 1) is not -020 * handled correctly. -021 */ -022 int mp_jacobi (mp_int * a, mp_int * n, int *c) -023 \{ -024 mp_int a1, p1; -025 int k, s, r, res; -026 mp_digit residue; -027 -028 /* if a < 0 return MP_VAL */ -029 if (mp_isneg(a) == MP_YES) \{ -030 return MP_VAL; -031 \} -032 -033 /* if n <= 0 return MP_VAL */ -034 if (mp_cmp_d(n, 0) != MP_GT) \{ -035 return MP_VAL; -036 \} -037 -038 /* step 1. handle case of a == 0 */ -039 if (mp_iszero (a) == MP_YES) \{ -040 /* special case of a == 0 and n == 1 */ -041 if (mp_cmp_d (n, 1) == MP_EQ) \{ -042 *c = 1; -043 \} else \{ -044 *c = 0; -045 \} -046 return MP_OKAY; -047 \} -048 -049 /* step 2. if a == 1, return 1 */ -050 if (mp_cmp_d (a, 1) == MP_EQ) \{ -051 *c = 1; -052 return MP_OKAY; -053 \} -054 -055 /* default */ -056 s = 0; -057 -058 /* step 3. write a = a1 * 2**k */ -059 if ((res = mp_init_copy (&a1, a)) != MP_OKAY) \{ -060 return res; -061 \} -062 -063 if ((res = mp_init (&p1)) != MP_OKAY) \{ -064 goto LBL_A1; -065 \} -066 -067 /* divide out larger power of two */ -068 k = mp_cnt_lsb(&a1); -069 if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) \{ -070 goto LBL_P1; -071 \} -072 -073 /* step 4. if e is even set s=1 */ -074 if ((k & 1) == 0) \{ -075 s = 1; -076 \} else \{ -077 /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ -078 residue = n->dp[0] & 7; -079 -080 if ((residue == 1) || (residue == 7)) \{ -081 s = 1; -082 \} else if ((residue == 3) || (residue == 5)) \{ -083 s = -1; -084 \} -085 \} -086 -087 /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ -088 if ( ((n->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) \{ -089 s = -s; -090 \} -091 -092 /* if a1 == 1 we're done */ -093 if (mp_cmp_d (&a1, 1) == MP_EQ) \{ -094 *c = s; -095 \} else \{ -096 /* n1 = n mod a1 */ -097 if ((res = mp_mod (n, &a1, &p1)) != MP_OKAY) \{ -098 goto LBL_P1; -099 \} -100 if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) \{ -101 goto LBL_P1; -102 \} -103 *c = s * r; -104 \} -105 -106 /* done */ -107 res = MP_OKAY; -108 LBL_P1:mp_clear (&p1); -109 LBL_A1:mp_clear (&a1); -110 return res; -111 \} -112 #endif -113 -\end{alltt} -\end{small} - -As a matter of practicality the variable $a'$ as per the pseudo-code is reprensented by the variable $a1$ since the $'$ symbol is not valid for a C -variable name character. - -The two simple cases of $a = 0$ and $a = 1$ are handled at the very beginning to simplify the algorithm. If the input is non-trivial the algorithm -has to proceed compute the Jacobi. The variable $s$ is used to hold the current Jacobi product. Note that $s$ is merely a C ``int'' data type since -the values it may obtain are merely $-1$, $0$ and $1$. - -After a local copy of $a$ is made all of the factors of two are divided out and the total stored in $k$. Technically only the least significant -bit of $k$ is required, however, it makes the algorithm simpler to follow to perform an addition. In practice an exclusive-or and addition have the same -processor requirements and neither is faster than the other. - -Line 59 through 71 determines the value of $\left ( { 2 \over p } \right )^k$. If the least significant bit of $k$ is zero than -$k$ is even and the value is one. Otherwise, the value of $s$ depends on which residue class $p$ belongs to modulo eight. The value of -$(-1)^{(p-1)(a'-1)/4}$ is compute and multiplied against $s$ on lines 73 through 76. - -Finally, if $a1$ does not equal one the algorithm must recurse and compute $\left ( {p' \over a'} \right )$. - -\textit{-- Comment about default $s$ and such...} - -\section{Modular Inverse} -\label{sec:modinv} -The modular inverse of a number actually refers to the modular multiplicative inverse. Essentially for any integer $a$ such that $(a, p) = 1$ there -exist another integer $b$ such that $ab \equiv 1 \mbox{ (mod }p\mbox{)}$. The integer $b$ is called the multiplicative inverse of $a$ which is -denoted as $b = a^{-1}$. Technically speaking modular inversion is a well defined operation for any finite ring or field not just for rings and -fields of integers. However, the former will be the matter of discussion. - -The simplest approach is to compute the algebraic inverse of the input. That is to compute $b \equiv a^{\Phi(p) - 1}$. If $\Phi(p)$ is the -order of the multiplicative subgroup modulo $p$ then $b$ must be the multiplicative inverse of $a$. The proof of which is trivial. - -\begin{equation} -ab \equiv a \left (a^{\Phi(p) - 1} \right ) \equiv a^{\Phi(p)} \equiv a^0 \equiv 1 \mbox{ (mod }p\mbox{)} -\end{equation} - -However, as simple as this approach may be it has two serious flaws. It requires that the value of $\Phi(p)$ be known which if $p$ is composite -requires all of the prime factors. This approach also is very slow as the size of $p$ grows. - -A simpler approach is based on the observation that solving for the multiplicative inverse is equivalent to solving the linear -Diophantine\footnote{See LeVeque \cite[pp. 40-43]{LeVeque} for more information.} equation. - -\begin{equation} -ab + pq = 1 -\end{equation} - -Where $a$, $b$, $p$ and $q$ are all integers. If such a pair of integers $ \left < b, q \right >$ exist than $b$ is the multiplicative inverse of -$a$ modulo $p$. The extended Euclidean algorithm (Knuth \cite[pp. 342]{TAOCPV2}) can be used to solve such equations provided $(a, p) = 1$. -However, instead of using that algorithm directly a variant known as the binary Extended Euclidean algorithm will be used in its place. The -binary approach is very similar to the binary greatest common divisor algorithm except it will produce a full solution to the Diophantine -equation. - -\subsection{General Case} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_invmod}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $(a, b) = 1$, $p \ge 2$, $0 < a < p$. \\ -\textbf{Output}. The modular inverse $c \equiv a^{-1} \mbox{ (mod }b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_VAL}). \\ -2. If $b_0 \equiv 1 \mbox{ (mod }2\mbox{)}$ then use algorithm fast\_mp\_invmod. \\ -3. $x \leftarrow \vert a \vert, y \leftarrow b$ \\ -4. If $x_0 \equiv y_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ then return(\textit{MP\_VAL}). \\ -5. $B \leftarrow 0, C \leftarrow 0, A \leftarrow 1, D \leftarrow 1$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}6.2 If ($A.used > 0$ and $A_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($B.used > 0$ and $B_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}6.2.1 $A \leftarrow A + y$ \\ -\hspace{6mm}6.2.2 $B \leftarrow B - x$ \\ -\hspace{3mm}6.3 $A \leftarrow \lfloor A / 2 \rfloor$ \\ -\hspace{3mm}6.4 $B \leftarrow \lfloor B / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -\hspace{3mm}7.2 If ($C.used > 0$ and $C_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($D.used > 0$ and $D_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}7.2.1 $C \leftarrow C + y$ \\ -\hspace{6mm}7.2.2 $D \leftarrow D - x$ \\ -\hspace{3mm}7.3 $C \leftarrow \lfloor C / 2 \rfloor$ \\ -\hspace{3mm}7.4 $D \leftarrow \lfloor D / 2 \rfloor$ \\ -8. If $u \ge v$ then \\ -\hspace{3mm}8.1 $u \leftarrow u - v$ \\ -\hspace{3mm}8.2 $A \leftarrow A - C$ \\ -\hspace{3mm}8.3 $B \leftarrow B - D$ \\ -9. else \\ -\hspace{3mm}9.1 $v \leftarrow v - u$ \\ -\hspace{3mm}9.2 $C \leftarrow C - A$ \\ -\hspace{3mm}9.3 $D \leftarrow D - B$ \\ -10. If $u \ne 0$ goto step 6. \\ -11. If $v \ne 1$ return(\textit{MP\_VAL}). \\ -12. While $C \le 0$ do \\ -\hspace{3mm}12.1 $C \leftarrow C + b$ \\ -13. While $C \ge b$ do \\ -\hspace{3mm}13.1 $C \leftarrow C - b$ \\ -14. $c \leftarrow C$ \\ -15. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\end{figure} -\textbf{Algorithm mp\_invmod.} -This algorithm computes the modular multiplicative inverse of an integer $a$ modulo an integer $b$. This algorithm is a variation of the -extended binary Euclidean algorithm from HAC \cite[pp. 608]{HAC}. It has been modified to only compute the modular inverse and not a complete -Diophantine solution. - -If $b \le 0$ than the modulus is invalid and MP\_VAL is returned. Similarly if both $a$ and $b$ are even then there cannot be a multiplicative -inverse for $a$ and the error is reported. - -The astute reader will observe that steps seven through nine are very similar to the binary greatest common divisor algorithm mp\_gcd. In this case -the other variables to the Diophantine equation are solved. The algorithm terminates when $u = 0$ in which case the solution is - -\begin{equation} -Ca + Db = v -\end{equation} - -If $v$, the greatest common divisor of $a$ and $b$ is not equal to one then the algorithm will report an error as no inverse exists. Otherwise, $C$ -is the modular inverse of $a$. The actual value of $C$ is congruent to, but not necessarily equal to, the ideal modular inverse which should lie -within $1 \le a^{-1} < b$. Step numbers twelve and thirteen adjust the inverse until it is in range. If the original input $a$ is within $0 < a < p$ -then only a couple of additions or subtractions will be required to adjust the inverse. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_invmod.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* hac 14.61, pp608 */ -018 int mp_invmod (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 /* b cannot be negative */ -021 if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) \{ -022 return MP_VAL; -023 \} -024 -025 #ifdef BN_FAST_MP_INVMOD_C -026 /* if the modulus is odd we can use a faster routine instead */ -027 if (mp_isodd (b) == MP_YES) \{ -028 return fast_mp_invmod (a, b, c); -029 \} -030 #endif -031 -032 #ifdef BN_MP_INVMOD_SLOW_C -033 return mp_invmod_slow(a, b, c); -034 #else -035 return MP_VAL; -036 #endif -037 \} -038 #endif -039 -\end{alltt} -\end{small} - -\subsubsection{Odd Moduli} - -When the modulus $b$ is odd the variables $A$ and $C$ are fixed and are not required to compute the inverse. In particular by attempting to solve -the Diophantine $Cb + Da = 1$ only $B$ and $D$ are required to find the inverse of $a$. - -The algorithm fast\_mp\_invmod is a direct adaptation of algorithm mp\_invmod with all all steps involving either $A$ or $C$ removed. This -optimization will halve the time required to compute the modular inverse. - -\section{Primality Tests} - -A non-zero integer $a$ is said to be prime if it is not divisible by any other integer excluding one and itself. For example, $a = 7$ is prime -since the integers $2 \ldots 6$ do not evenly divide $a$. By contrast, $a = 6$ is not prime since $a = 6 = 2 \cdot 3$. - -Prime numbers arise in cryptography considerably as they allow finite fields to be formed. The ability to determine whether an integer is prime or -not quickly has been a viable subject in cryptography and number theory for considerable time. The algorithms that will be presented are all -probablistic algorithms in that when they report an integer is composite it must be composite. However, when the algorithms report an integer is -prime the algorithm may be incorrect. - -As will be discussed it is possible to limit the probability of error so well that for practical purposes the probablity of error might as -well be zero. For the purposes of these discussions let $n$ represent the candidate integer of which the primality is in question. - -\subsection{Trial Division} - -Trial division means to attempt to evenly divide a candidate integer by small prime integers. If the candidate can be evenly divided it obviously -cannot be prime. By dividing by all primes $1 < p \le \sqrt{n}$ this test can actually prove whether an integer is prime. However, such a test -would require a prohibitive amount of time as $n$ grows. - -Instead of dividing by every prime, a smaller, more mangeable set of primes may be used instead. By performing trial division with only a subset -of the primes less than $\sqrt{n} + 1$ the algorithm cannot prove if a candidate is prime. However, often it can prove a candidate is not prime. - -The benefit of this test is that trial division by small values is fairly efficient. Specially compared to the other algorithms that will be -discussed shortly. The probability that this approach correctly identifies a composite candidate when tested with all primes upto $q$ is given by -$1 - {1.12 \over ln(q)}$. The graph (\ref{pic:primality}, will be added later) demonstrates the probability of success for the range -$3 \le q \le 100$. - -At approximately $q = 30$ the gain of performing further tests diminishes fairly quickly. At $q = 90$ further testing is generally not going to -be of any practical use. In the case of LibTomMath the default limit $q = 256$ was chosen since it is not too high and will eliminate -approximately $80\%$ of all candidate integers. The constant \textbf{PRIME\_SIZE} is equal to the number of primes in the test base. The -array \_\_prime\_tab is an array of the first \textbf{PRIME\_SIZE} prime numbers. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_is\_divisible}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $c = 1$ if $n$ is divisible by a small prime, otherwise $c = 0$. \\ -\hline \\ -1. for $ix$ from $0$ to $PRIME\_SIZE$ do \\ -\hspace{3mm}1.1 $d \leftarrow n \mbox{ (mod }\_\_prime\_tab_{ix}\mbox{)}$ \\ -\hspace{3mm}1.2 If $d = 0$ then \\ -\hspace{6mm}1.2.1 $c \leftarrow 1$ \\ -\hspace{6mm}1.2.2 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow 0$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_is\_divisible} -\end{figure} -\textbf{Algorithm mp\_prime\_is\_divisible.} -This algorithm attempts to determine if a candidate integer $n$ is composite by performing trial divisions. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_prime\_is\_divisible.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines if an integers is divisible by one -018 * of the first PRIME_SIZE primes or not -019 * -020 * sets result to 0 if not, 1 if yes -021 */ -022 int mp_prime_is_divisible (mp_int * a, int *result) -023 \{ -024 int err, ix; -025 mp_digit res; -026 -027 /* default to not */ -028 *result = MP_NO; -029 -030 for (ix = 0; ix < PRIME_SIZE; ix++) \{ -031 /* what is a mod LBL_prime_tab[ix] */ -032 if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) \{ -033 return err; -034 \} -035 -036 /* is the residue zero? */ -037 if (res == 0) \{ -038 *result = MP_YES; -039 return MP_OKAY; -040 \} -041 \} -042 -043 return MP_OKAY; -044 \} -045 #endif -046 -\end{alltt} -\end{small} - -The algorithm defaults to a return of $0$ in case an error occurs. The values in the prime table are all specified to be in the range of a -mp\_digit. The table \_\_prime\_tab is defined in the following file. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_prime\_tab.c -\vspace{-3mm} -\begin{alltt} -016 const mp_digit ltm_prime_tab[] = \{ -017 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, -018 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, -019 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, -020 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, -021 #ifndef MP_8BIT -022 0x0083, -023 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, -024 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, -025 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, -026 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, -027 -028 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, -029 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, -030 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, -031 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, -032 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, -033 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, -034 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, -035 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, -036 -037 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, -038 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, -039 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, -040 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, -041 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, -042 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, -043 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, -044 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, -045 -046 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, -047 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, -048 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, -049 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, -050 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, -051 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, -052 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, -053 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 -054 #endif -055 \}; -056 #endif -057 -\end{alltt} -\end{small} - -Note that there are two possible tables. When an mp\_digit is 7-bits long only the primes upto $127$ may be included, otherwise the primes -upto $1619$ are used. Note that the value of \textbf{PRIME\_SIZE} is a constant dependent on the size of a mp\_digit. - -\subsection{The Fermat Test} -The Fermat test is probably one the oldest tests to have a non-trivial probability of success. It is based on the fact that if $n$ is in -fact prime then $a^{n} \equiv a \mbox{ (mod }n\mbox{)}$ for all $0 < a < n$. The reason being that if $n$ is prime than the order of -the multiplicative sub group is $n - 1$. Any base $a$ must have an order which divides $n - 1$ and as such $a^n$ is equivalent to -$a^1 = a$. - -If $n$ is composite then any given base $a$ does not have to have a period which divides $n - 1$. In which case -it is possible that $a^n \nequiv a \mbox{ (mod }n\mbox{)}$. However, this test is not absolute as it is possible that the order -of a base will divide $n - 1$ which would then be reported as prime. Such a base yields what is known as a Fermat pseudo-prime. Several -integers known as Carmichael numbers will be a pseudo-prime to all valid bases. Fortunately such numbers are extremely rare as $n$ grows -in size. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_fermat}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $b^a \equiv b \mbox{ (mod }a\mbox{)}$, otherwise $c = 0$. \\ -\hline \\ -1. $t \leftarrow b^a \mbox{ (mod }a\mbox{)}$ \\ -2. If $t = b$ then \\ -\hspace{3mm}2.1 $c = 1$ \\ -3. else \\ -\hspace{3mm}3.1 $c = 0$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_fermat} -\end{figure} -\textbf{Algorithm mp\_prime\_fermat.} -This algorithm determines whether an mp\_int $a$ is a Fermat prime to the base $b$ or not. It uses a single modular exponentiation to -determine the result. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_prime\_fermat.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* performs one Fermat test. -018 * -019 * If "a" were prime then b**a == b (mod a) since the order of -020 * the multiplicative sub-group would be phi(a) = a-1. That means -021 * it would be the same as b**(a mod (a-1)) == b**1 == b (mod a). -022 * -023 * Sets result to 1 if the congruence holds, or zero otherwise. -024 */ -025 int mp_prime_fermat (mp_int * a, mp_int * b, int *result) -026 \{ -027 mp_int t; -028 int err; -029 -030 /* default to composite */ -031 *result = MP_NO; -032 -033 /* ensure b > 1 */ -034 if (mp_cmp_d(b, 1) != MP_GT) \{ -035 return MP_VAL; -036 \} -037 -038 /* init t */ -039 if ((err = mp_init (&t)) != MP_OKAY) \{ -040 return err; -041 \} -042 -043 /* compute t = b**a mod a */ -044 if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) \{ -045 goto LBL_T; -046 \} -047 -048 /* is it equal to b? */ -049 if (mp_cmp (&t, b) == MP_EQ) \{ -050 *result = MP_YES; -051 \} -052 -053 err = MP_OKAY; -054 LBL_T:mp_clear (&t); -055 return err; -056 \} -057 #endif -058 -\end{alltt} -\end{small} - -\subsection{The Miller-Rabin Test} -The Miller-Rabin (citation) test is another primality test which has tighter error bounds than the Fermat test specifically with sequentially chosen -candidate integers. The algorithm is based on the observation that if $n - 1 = 2^kr$ and if $b^r \nequiv \pm 1$ then after upto $k - 1$ squarings the -value must be equal to $-1$. The squarings are stopped as soon as $-1$ is observed. If the value of $1$ is observed first it means that -some value not congruent to $\pm 1$ when squared equals one which cannot occur if $n$ is prime. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_miller\_rabin}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $a$ is a Miller-Rabin prime to the base $a$, otherwise $c = 0$. \\ -\hline -1. $a' \leftarrow a - 1$ \\ -2. $r \leftarrow n1$ \\ -3. $c \leftarrow 0, s \leftarrow 0$ \\ -4. While $r.used > 0$ and $r_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}4.1 $s \leftarrow s + 1$ \\ -\hspace{3mm}4.2 $r \leftarrow \lfloor r / 2 \rfloor$ \\ -5. $y \leftarrow b^r \mbox{ (mod }a\mbox{)}$ \\ -6. If $y \nequiv \pm 1$ then \\ -\hspace{3mm}6.1 $j \leftarrow 1$ \\ -\hspace{3mm}6.2 While $j \le (s - 1)$ and $y \nequiv a'$ \\ -\hspace{6mm}6.2.1 $y \leftarrow y^2 \mbox{ (mod }a\mbox{)}$ \\ -\hspace{6mm}6.2.2 If $y = 1$ then goto step 8. \\ -\hspace{6mm}6.2.3 $j \leftarrow j + 1$ \\ -\hspace{3mm}6.3 If $y \nequiv a'$ goto step 8. \\ -7. $c \leftarrow 1$\\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_miller\_rabin} -\end{figure} -\textbf{Algorithm mp\_prime\_miller\_rabin.} -This algorithm performs one trial round of the Miller-Rabin algorithm to the base $b$. It will set $c = 1$ if the algorithm cannot determine -if $b$ is composite or $c = 0$ if $b$ is provably composite. The values of $s$ and $r$ are computed such that $a' = a - 1 = 2^sr$. - -If the value $y \equiv b^r$ is congruent to $\pm 1$ then the algorithm cannot prove if $a$ is composite or not. Otherwise, the algorithm will -square $y$ upto $s - 1$ times stopping only when $y \equiv -1$. If $y^2 \equiv 1$ and $y \nequiv \pm 1$ then the algorithm can report that $a$ -is provably composite. If the algorithm performs $s - 1$ squarings and $y \nequiv -1$ then $a$ is provably composite. If $a$ is not provably -composite then it is \textit{probably} prime. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_prime\_miller\_rabin.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Miller-Rabin test of "a" to the base of "b" as described in -018 * HAC pp. 139 Algorithm 4.24 -019 * -020 * Sets result to 0 if definitely composite or 1 if probably prime. -021 * Randomly the chance of error is no more than 1/4 and often -022 * very much lower. -023 */ -024 int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) -025 \{ -026 mp_int n1, y, r; -027 int s, j, err; -028 -029 /* default */ -030 *result = MP_NO; -031 -032 /* ensure b > 1 */ -033 if (mp_cmp_d(b, 1) != MP_GT) \{ -034 return MP_VAL; -035 \} -036 -037 /* get n1 = a - 1 */ -038 if ((err = mp_init_copy (&n1, a)) != MP_OKAY) \{ -039 return err; -040 \} -041 if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) \{ -042 goto LBL_N1; -043 \} -044 -045 /* set 2**s * r = n1 */ -046 if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) \{ -047 goto LBL_N1; -048 \} -049 -050 /* count the number of least significant bits -051 * which are zero -052 */ -053 s = mp_cnt_lsb(&r); -054 -055 /* now divide n - 1 by 2**s */ -056 if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) \{ -057 goto LBL_R; -058 \} -059 -060 /* compute y = b**r mod a */ -061 if ((err = mp_init (&y)) != MP_OKAY) \{ -062 goto LBL_R; -063 \} -064 if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) \{ -065 goto LBL_Y; -066 \} -067 -068 /* if y != 1 and y != n1 do */ -069 if ((mp_cmp_d (&y, 1) != MP_EQ) && (mp_cmp (&y, &n1) != MP_EQ)) \{ -070 j = 1; -071 /* while j <= s-1 and y != n1 */ -072 while ((j <= (s - 1)) && (mp_cmp (&y, &n1) != MP_EQ)) \{ -073 if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) \{ -074 goto LBL_Y; -075 \} -076 -077 /* if y == 1 then composite */ -078 if (mp_cmp_d (&y, 1) == MP_EQ) \{ -079 goto LBL_Y; -080 \} -081 -082 ++j; -083 \} -084 -085 /* if y != n1 then composite */ -086 if (mp_cmp (&y, &n1) != MP_EQ) \{ -087 goto LBL_Y; -088 \} -089 \} -090 -091 /* probably prime now */ -092 *result = MP_YES; -093 LBL_Y:mp_clear (&y); -094 LBL_R:mp_clear (&r); -095 LBL_N1:mp_clear (&n1); -096 return err; -097 \} -098 #endif -099 -\end{alltt} -\end{small} - - - - -\backmatter -\appendix -\begin{thebibliography}{ABCDEF} -\bibitem[1]{TAOCPV2} -Donald Knuth, \textit{The Art of Computer Programming}, Third Edition, Volume Two, Seminumerical Algorithms, Addison-Wesley, 1998 - -\bibitem[2]{HAC} -A. Menezes, P. van Oorschot, S. Vanstone, \textit{Handbook of Applied Cryptography}, CRC Press, 1996 - -\bibitem[3]{ROSE} -Michael Rosing, \textit{Implementing Elliptic Curve Cryptography}, Manning Publications, 1999 - -\bibitem[4]{COMBA} -Paul G. Comba, \textit{Exponentiation Cryptosystems on the IBM PC}. IBM Systems Journal 29(4): 526-538 (1990) - -\bibitem[5]{KARA} -A. Karatsuba, Doklay Akad. Nauk SSSR 145 (1962), pp.293-294 - -\bibitem[6]{KARAP} -Andre Weimerskirch and Christof Paar, \textit{Generalizations of the Karatsuba Algorithm for Polynomial Multiplication}, Submitted to Design, Codes and Cryptography, March 2002 - -\bibitem[7]{BARRETT} -Paul Barrett, \textit{Implementing the Rivest Shamir and Adleman Public Key Encryption Algorithm on a Standard Digital Signal Processor}, Advances in Cryptology, Crypto '86, Springer-Verlag. - -\bibitem[8]{MONT} -P.L.Montgomery. \textit{Modular multiplication without trial division}. Mathematics of Computation, 44(170):519-521, April 1985. - -\bibitem[9]{DRMET} -Chae Hoon Lim and Pil Joong Lee, \textit{Generating Efficient Primes for Discrete Log Cryptosystems}, POSTECH Information Research Laboratories - -\bibitem[10]{MMB} -J. Daemen and R. Govaerts and J. Vandewalle, \textit{Block ciphers based on Modular Arithmetic}, State and {P}rogress in the {R}esearch of {C}ryptography, 1993, pp. 80-89 - -\bibitem[11]{RSAREF} -R.L. Rivest, A. Shamir, L. Adleman, \textit{A Method for Obtaining Digital Signatures and Public-Key Cryptosystems} - -\bibitem[12]{DHREF} -Whitfield Diffie, Martin E. Hellman, \textit{New Directions in Cryptography}, IEEE Transactions on Information Theory, 1976 - -\bibitem[13]{IEEE} -IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) - -\bibitem[14]{GMP} -GNU Multiple Precision (GMP), \url{http://www.swox.com/gmp/} - -\bibitem[15]{MPI} -Multiple Precision Integer Library (MPI), Michael Fromberger, \url{http://thayer.dartmouth.edu/~sting/mpi/} - -\bibitem[16]{OPENSSL} -OpenSSL Cryptographic Toolkit, \url{http://openssl.org} - -\bibitem[17]{LIP} -Large Integer Package, \url{http://home.hetnet.nl/~ecstr/LIP.zip} - -\bibitem[18]{ISOC} -JTC1/SC22/WG14, ISO/IEC 9899:1999, ``A draft rationale for the C99 standard.'' - -\bibitem[19]{JAVA} -The Sun Java Website, \url{http://java.sun.com/} - -\end{thebibliography} - -\input{tommath.ind} - -\end{document} -- cgit v0.12 From 6d8b0c705f0d36540ea0d5624619a64a38986ec8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Aug 2017 12:37:50 +0000 Subject: Tweak libtommath building, such that it doesn't depend on uint64_t any more. (handle mp_word in the same way as mp_digit) --- generic/tcl.h | 2 ++ generic/tclTomMath.h | 15 +++++++++++++++ tools/fix_tommath_h.tcl | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/generic/tcl.h b/generic/tcl.h index 6fa26f9..da9b292 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2263,6 +2263,8 @@ typedef struct mp_int mp_int; #define MP_INT_DECLARED typedef unsigned int mp_digit; #define MP_DIGIT_DECLARED +typedef unsigned TCL_WIDE_INT_TYPE mp_word; +#define MP_WORD_DECLARED /* *---------------------------------------------------------------------------- diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 87fe756..39132ed 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -46,7 +46,10 @@ extern "C" { typedef uint8_t mp_digit; #define MP_DIGIT_DECLARED #endif +#ifndef MP_WORD_DECLARED typedef uint16_t mp_word; +#define MP_WORD_DECLARED +#endif #define MP_SIZEOF_MP_DIGIT 1 #ifdef DIGIT_BIT #error You must not define DIGIT_BIT when using MP_8BIT @@ -56,7 +59,10 @@ extern "C" { typedef uint16_t mp_digit; #define MP_DIGIT_DECLARED #endif +#ifndef MP_WORD_DECLARED typedef uint32_t mp_word; +#define MP_WORD_DECLARED +#endif #define MP_SIZEOF_MP_DIGIT 2 #ifdef DIGIT_BIT #error You must not define DIGIT_BIT when using MP_16BIT @@ -68,13 +74,19 @@ extern "C" { #define MP_DIGIT_DECLARED #endif #if defined(_WIN32) +#ifndef MP_WORD_DECLARED typedef unsigned __int128 mp_word; +#define MP_WORD_DECLARED +#endif #elif defined(__GNUC__) typedef unsigned long mp_word __attribute__ ((mode(TI))); #else /* it seems you have a problem * but we assume you can somewhere define your own uint128_t */ +#ifndef MP_WORD_DECLARED typedef uint128_t mp_word; +#define MP_WORD_DECLARED +#endif #endif #define DIGIT_BIT 60 @@ -86,7 +98,10 @@ extern "C" { typedef uint32_t mp_digit; #define MP_DIGIT_DECLARED #endif +#ifndef MP_WORD_DECLARED typedef uint64_t mp_word; +#define MP_WORD_DECLARED +#endif #ifdef MP_31BIT /* this is an extension that uses 31-bit digits */ diff --git a/tools/fix_tommath_h.tcl b/tools/fix_tommath_h.tcl index 61fa4fd..cee29fa 100755 --- a/tools/fix_tommath_h.tcl +++ b/tools/fix_tommath_h.tcl @@ -45,6 +45,12 @@ foreach line [split $data \n] { puts "\#define MP_DIGIT_DECLARED" puts "\#endif" } + {typedef.*mp_word;} { + puts "\#ifndef MP_WORD_DECLARED" + puts $line + puts "\#define MP_WORD_DECLARED" + puts "\#endif" + } {typedef struct} { puts "\#ifndef MP_INT_DECLARED" puts "\#define MP_INT_DECLARED" -- cgit v0.12 From 7aafa756acec8c1f6746b28c8538c9868f5a89bf Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 30 Aug 2017 15:29:16 +0000 Subject: Cherrypick string.test [de104ef5ab] --- tests/string.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/string.test b/tests/string.test index 7b02928..549944d 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1371,6 +1371,9 @@ test string-14.16 {string replace} { test string-14.17 {string replace} { string replace abcdefghijklmnop end end-1 } {abcdefghijklmnop} +test string-14.18 {string replace} { + string replace abcdefghijklmnop 10 9 XXX +} {abcdefghijklmnop} test string-15.1 {string tolower too few args} { list [catch {string tolower} msg] $msg -- cgit v0.12 From 432e75210fdb31c3bab2a57d04a6184b88c12c68 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Aug 2017 13:32:52 +0000 Subject: Undo tag removal (just get libtommath directly from GitHUB), so we don't have useless file changes with every new release --- .fossil-settings/crlf-glob | 17 ++++ libtommath/README.md | 4 +- libtommath/TODO | 16 ---- libtommath/bn_error.c | 6 +- libtommath/bn_fast_mp_invmod.c | 6 +- libtommath/bn_fast_mp_montgomery_reduce.c | 6 +- libtommath/bn_fast_s_mp_mul_digs.c | 6 +- libtommath/bn_fast_s_mp_mul_high_digs.c | 6 +- libtommath/bn_fast_s_mp_sqr.c | 6 +- libtommath/bn_mp_2expt.c | 6 +- libtommath/bn_mp_abs.c | 6 +- libtommath/bn_mp_add.c | 6 +- libtommath/bn_mp_add_d.c | 6 +- libtommath/bn_mp_addmod.c | 6 +- libtommath/bn_mp_and.c | 6 +- libtommath/bn_mp_clamp.c | 6 +- libtommath/bn_mp_clear.c | 6 +- libtommath/bn_mp_clear_multi.c | 6 +- libtommath/bn_mp_cmp.c | 6 +- libtommath/bn_mp_cmp_d.c | 6 +- libtommath/bn_mp_cmp_mag.c | 6 +- libtommath/bn_mp_cnt_lsb.c | 6 +- libtommath/bn_mp_copy.c | 6 +- libtommath/bn_mp_count_bits.c | 6 +- libtommath/bn_mp_div.c | 6 +- libtommath/bn_mp_div_2.c | 6 +- libtommath/bn_mp_div_2d.c | 6 +- libtommath/bn_mp_div_3.c | 6 +- libtommath/bn_mp_div_d.c | 6 +- libtommath/bn_mp_dr_is_modulus.c | 6 +- libtommath/bn_mp_dr_reduce.c | 6 +- libtommath/bn_mp_dr_setup.c | 6 +- libtommath/bn_mp_exch.c | 6 +- libtommath/bn_mp_export.c | 6 +- libtommath/bn_mp_expt_d.c | 6 +- libtommath/bn_mp_expt_d_ex.c | 6 +- libtommath/bn_mp_exptmod.c | 6 +- libtommath/bn_mp_exptmod_fast.c | 6 +- libtommath/bn_mp_exteuclid.c | 6 +- libtommath/bn_mp_fread.c | 6 +- libtommath/bn_mp_fwrite.c | 6 +- libtommath/bn_mp_gcd.c | 6 +- libtommath/bn_mp_get_int.c | 6 +- libtommath/bn_mp_grow.c | 6 +- libtommath/bn_mp_import.c | 6 +- libtommath/bn_mp_init.c | 6 +- libtommath/bn_mp_init_copy.c | 6 +- libtommath/bn_mp_init_multi.c | 6 +- libtommath/bn_mp_init_set.c | 6 +- libtommath/bn_mp_init_set_int.c | 6 +- libtommath/bn_mp_init_size.c | 6 +- libtommath/bn_mp_invmod.c | 6 +- libtommath/bn_mp_invmod_slow.c | 6 +- libtommath/bn_mp_is_square.c | 6 +- libtommath/bn_mp_jacobi.c | 6 +- libtommath/bn_mp_karatsuba_mul.c | 6 +- libtommath/bn_mp_karatsuba_sqr.c | 6 +- libtommath/bn_mp_lcm.c | 6 +- libtommath/bn_mp_lshd.c | 6 +- libtommath/bn_mp_mod.c | 6 +- libtommath/bn_mp_mod_2d.c | 6 +- libtommath/bn_mp_mod_d.c | 6 +- libtommath/bn_mp_montgomery_calc_normalization.c | 6 +- libtommath/bn_mp_montgomery_reduce.c | 6 +- libtommath/bn_mp_montgomery_setup.c | 6 +- libtommath/bn_mp_mul.c | 6 +- libtommath/bn_mp_mul_2.c | 6 +- libtommath/bn_mp_mul_2d.c | 6 +- libtommath/bn_mp_mul_d.c | 6 +- libtommath/bn_mp_mulmod.c | 6 +- libtommath/bn_mp_n_root.c | 6 +- libtommath/bn_mp_n_root_ex.c | 6 +- libtommath/bn_mp_neg.c | 6 +- libtommath/bn_mp_or.c | 6 +- libtommath/bn_mp_prime_fermat.c | 6 +- libtommath/bn_mp_prime_is_divisible.c | 6 +- libtommath/bn_mp_prime_is_prime.c | 6 +- libtommath/bn_mp_prime_miller_rabin.c | 6 +- libtommath/bn_mp_prime_next_prime.c | 6 +- libtommath/bn_mp_prime_rabin_miller_trials.c | 6 +- libtommath/bn_mp_prime_random_ex.c | 6 +- libtommath/bn_mp_radix_size.c | 6 +- libtommath/bn_mp_radix_smap.c | 6 +- libtommath/bn_mp_rand.c | 6 +- libtommath/bn_mp_read_radix.c | 6 +- libtommath/bn_mp_read_signed_bin.c | 6 +- libtommath/bn_mp_read_unsigned_bin.c | 6 +- libtommath/bn_mp_reduce.c | 6 +- libtommath/bn_mp_reduce_2k.c | 6 +- libtommath/bn_mp_reduce_2k_l.c | 6 +- libtommath/bn_mp_reduce_2k_setup.c | 6 +- libtommath/bn_mp_reduce_2k_setup_l.c | 6 +- libtommath/bn_mp_reduce_is_2k.c | 6 +- libtommath/bn_mp_reduce_is_2k_l.c | 6 +- libtommath/bn_mp_reduce_setup.c | 6 +- libtommath/bn_mp_rshd.c | 6 +- libtommath/bn_mp_set.c | 6 +- libtommath/bn_mp_set_int.c | 6 +- libtommath/bn_mp_set_long.c | 6 +- libtommath/bn_mp_set_long_long.c | 6 +- libtommath/bn_mp_shrink.c | 6 +- libtommath/bn_mp_signed_bin_size.c | 6 +- libtommath/bn_mp_sqr.c | 6 +- libtommath/bn_mp_sqrmod.c | 6 +- libtommath/bn_mp_sqrt.c | 6 +- libtommath/bn_mp_sub.c | 6 +- libtommath/bn_mp_sub_d.c | 6 +- libtommath/bn_mp_submod.c | 6 +- libtommath/bn_mp_to_signed_bin.c | 6 +- libtommath/bn_mp_to_signed_bin_n.c | 6 +- libtommath/bn_mp_to_unsigned_bin.c | 6 +- libtommath/bn_mp_to_unsigned_bin_n.c | 6 +- libtommath/bn_mp_toom_mul.c | 6 +- libtommath/bn_mp_toom_sqr.c | 6 +- libtommath/bn_mp_toradix.c | 6 +- libtommath/bn_mp_toradix_n.c | 6 +- libtommath/bn_mp_unsigned_bin_size.c | 6 +- libtommath/bn_mp_xor.c | 6 +- libtommath/bn_mp_zero.c | 6 +- libtommath/bn_prime_tab.c | 6 +- libtommath/bn_reverse.c | 6 +- libtommath/bn_s_mp_add.c | 6 +- libtommath/bn_s_mp_exptmod.c | 6 +- libtommath/bn_s_mp_mul_digs.c | 6 +- libtommath/bn_s_mp_mul_high_digs.c | 6 +- libtommath/bn_s_mp_sqr.c | 6 +- libtommath/bn_s_mp_sub.c | 6 +- libtommath/bncore.c | 6 +- libtommath/makefile.include | 105 ----------------------- libtommath/tommath.h | 6 +- libtommath/tommath_private.h | 6 +- libtommath/tommath_superclass.h | 6 +- libtommath/updatemakes.sh | 6 +- 133 files changed, 407 insertions(+), 509 deletions(-) create mode 100644 .fossil-settings/crlf-glob delete mode 100644 libtommath/TODO delete mode 100644 libtommath/makefile.include diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob new file mode 100644 index 0000000..2041cb6 --- /dev/null +++ b/.fossil-settings/crlf-glob @@ -0,0 +1,17 @@ +compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +compat/zlib/contrib/vstudio/readme.txt +compat/zlib/contrib/vstudio/*/zlib.rc +compat/zlib/win32/*.txt +compat/zlib/win64/*.txt +libtommath/*.dsp +libtommath/*.sln +libtommath/*.vcproj +tools/tcl.hpj.in +tools/tcl.wse.in +win/buildall.vc.bat +win/coffbase.txt +win/makefile.vc +win/rules.vc +win/tcl.dsp +win/tcl.dsw +win/tcl.hpj.in \ No newline at end of file diff --git a/libtommath/README.md b/libtommath/README.md index 866f024..4c5da71 100644 --- a/libtommath/README.md +++ b/libtommath/README.md @@ -1,4 +1,6 @@ -[![Build Status](https://travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath) +[![Build Status - master](https://travis-ci.org/libtom/libtommath.png?branch=master)](https://travis-ci.org/libtom/libtommath) + +[![Build Status - develop](https://travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath) This is the git repository for [LibTomMath](http://www.libtom.org/), a free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C. diff --git a/libtommath/TODO b/libtommath/TODO deleted file mode 100644 index deffba1..0000000 --- a/libtommath/TODO +++ /dev/null @@ -1,16 +0,0 @@ -things for book in order of importance... - -- Fix up pseudo-code [only] for combas that are not consistent with source -- Start in chapter 3 [basics] and work up... - - re-write to prose [less abrupt] - - clean up pseudo code [spacing] - - more examples where appropriate and figures - -Goal: - - Get sync done by mid January [roughly 8-12 hours work] - - Finish ch3-6 by end of January [roughly 12-16 hours of work] - - Finish ch7-end by mid Feb [roughly 20-24 hours of work]. - -Goal isn't "first edition" but merely cleaner to read. - - diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 380f46a..0d77411 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -42,6 +42,6 @@ const char *mp_error_to_string(int code) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index c1d6271..12f42de 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -143,6 +143,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index 4d74630..16d5ff7 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -167,6 +167,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index 59cfa38..a1015af 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -102,6 +102,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 16f056c..08f0355 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -93,6 +93,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index 8fa8958..f435af9 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -109,6 +109,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index 36915bb..989bb9f 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -43,6 +43,6 @@ mp_2expt (mp_int * a, int b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index f3ec518..e7c5e25 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -38,6 +38,6 @@ mp_abs (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 2487aba..bdb166f 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -48,6 +48,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index b7c8ea8..fd1a186 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -107,6 +107,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 706e739..dc06788 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -36,6 +36,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 46c41a2..53008a5 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -52,6 +52,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index 149f1a8..2c0a1a6 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -39,6 +39,6 @@ mp_clamp (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index 37ce1e1..97f3db0 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -39,6 +39,6 @@ mp_clear (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index 583b1da..bd4b232 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -29,6 +29,6 @@ void mp_clear_multi(mp_int *mp, ...) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 538ba34..e757ddf 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -38,6 +38,6 @@ mp_cmp (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index e66b1e4..3f5ebae 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -39,6 +39,6 @@ int mp_cmp_d(mp_int * a, mp_digit b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index d46a1be..7ceda97 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -50,6 +50,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 1cf6159..bf201b5 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -48,6 +48,6 @@ int mp_cnt_lsb(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 1ba7381..84e839e 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -63,6 +63,6 @@ mp_copy (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index bd12a87..ff558eb 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -40,6 +40,6 @@ mp_count_bits (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 73f8779..0890e65 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -290,6 +290,6 @@ LBL_Q:mp_clear (&q); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index a428869..2b5bb49 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -63,6 +63,6 @@ int mp_div_2(mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index b8e27ba..635d374 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -81,6 +81,6 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index b716b22..e8504ea 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -74,6 +74,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index a2022ad..a5dbc59 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -110,6 +110,6 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index f6d39c1..ced330c 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -38,6 +38,6 @@ int mp_dr_is_modulus(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 920b52e..c85ee77 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -91,6 +91,6 @@ top: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 3aac30f..b0d4a14 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -27,6 +27,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index 5b5b359..fc26bae 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -29,6 +29,6 @@ mp_exch (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 2e71a27..4bbc8c5 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -83,6 +83,6 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index d5ca456..a311926 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -23,6 +23,6 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index dced5a1..c361b27 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -78,6 +78,6 @@ int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 0998ce7..25c389d 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -107,6 +107,6 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 3322544..5e5c7f2 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -316,6 +316,6 @@ LBL_M: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index d9951ec..3c9612e 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -78,6 +78,6 @@ LBL_ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index 4e38c6f..140721b 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -64,6 +64,6 @@ int mp_fread(mp_int *a, int radix, FILE *stream) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index daa15db..23b5f64 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -49,6 +49,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 40e7034..b0be8fb 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -100,6 +100,6 @@ LBL_U:mp_clear (&v); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index f99ffb2..5c820f8 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -40,6 +40,6 @@ unsigned long mp_get_int(mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index 3d47822..74e07b1 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -52,6 +52,6 @@ int mp_grow (mp_int * a, int size) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index 22e2342..df29389 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -68,6 +68,6 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index 0f628df..ee374ae 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -41,6 +41,6 @@ int mp_init (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index c918d46..37a57ec 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -32,6 +32,6 @@ int mp_init_copy (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index c121188..73d6a0f 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -51,6 +51,6 @@ int mp_init_multi(mp_int *mp, ...) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index 24dc8bb..ed4955c 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -27,6 +27,6 @@ int mp_init_set (mp_int * a, mp_digit b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index 5a75e3e..1bc1942 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -26,6 +26,6 @@ int mp_init_set_int (mp_int * a, unsigned long b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index 4e30a2b..4446773 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -43,6 +43,6 @@ int mp_init_size (mp_int * a, int size) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index 75763ab..36011d0 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -38,6 +38,6 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index cb7233d..ff0d5ae 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -170,6 +170,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 56d19c0..dd08d58 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -104,6 +104,6 @@ ERR:mp_clear(&t); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 8d147e0..5fc8593 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -112,6 +112,6 @@ LBL_A1:mp_clear (&a1); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 31ed2e3..4d982c7 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -162,6 +162,6 @@ ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 33a2bee..764e85a 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -116,6 +116,6 @@ ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index d4bb1b6..512e8ec 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -55,6 +55,6 @@ LBL_T: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index e4f9abc..0143e94 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -62,6 +62,6 @@ int mp_lshd (mp_int * a, int b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 0bc9530..06240a0 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -43,6 +43,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 472aa58..2bb86da 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -50,6 +50,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 6fbc2c3..bf2ccaa 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -22,6 +22,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 3e66d3f..679a871 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -54,6 +54,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index b64c80a..05e8bfa 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -113,6 +113,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index b15bafd..1c17445 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -54,6 +54,6 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index 3819c0a..cc3b9c8 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -62,6 +62,6 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index eba1450..d22fd89 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -77,6 +77,6 @@ int mp_mul_2(mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index 798a1da..c00fd7e 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -80,6 +80,6 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index fa918da..6954ed3 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -74,6 +74,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index 3c7e41b..d7a4d3c 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -35,6 +35,6 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index f8f9d13..f717f17 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -25,6 +25,6 @@ int mp_n_root (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 28d6b18..079b4f3 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -127,6 +127,6 @@ LBL_T1:mp_clear (&t1); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index f488b57..d03e92e 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -35,6 +35,6 @@ int mp_neg (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index aee9734..b9775ce 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -45,6 +45,6 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 5b992b5..d99feeb 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -57,6 +57,6 @@ LBL_T:mp_clear (&t); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index f97498f..eea4a27 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -45,6 +45,6 @@ int mp_prime_is_divisible (mp_int * a, int *result) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 29571ba..3eda4fd 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -78,6 +78,6 @@ LBL_B:mp_clear (&b); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index b168f01..7de0634 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -98,6 +98,6 @@ LBL_N1:mp_clear (&n1); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index 6515b1c..7a32d9b 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -165,6 +165,6 @@ LBL_ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index c98de6e..378ceb2 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -47,6 +47,6 @@ int mp_prime_rabin_miller_trials(int size) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index 04a7cf7..cf5272e 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -119,6 +119,6 @@ error: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index 4a58e41..cb0c134 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -73,6 +73,6 @@ int mp_radix_size (mp_int * a, int radix, int *size) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c index e351146..4c6e57c 100644 --- a/libtommath/bn_mp_radix_smap.c +++ b/libtommath/bn_mp_radix_smap.c @@ -19,6 +19,6 @@ const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index d5967c2..93e255a 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -75,6 +75,6 @@ mp_rand (mp_int * a, int digits) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index a4d1c8a..12aa499 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -86,6 +86,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index a034fbd..363e11f 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -36,6 +36,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index 27af256..1a50b58 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -50,6 +50,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index a87fc30..367383f 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -95,6 +95,6 @@ CLEANUP: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 4f13b07..6bc96d1 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -58,6 +58,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index b41677a..8e6eeb0 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -59,6 +59,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index a0c507f..bf810c0 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -42,6 +42,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 7083533..56d1ba8 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -39,6 +39,6 @@ ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index 2e61839..0499e83 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -47,6 +47,6 @@ int mp_reduce_is_2k(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index 65ae46e..48b3498 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -39,6 +39,6 @@ int mp_reduce_is_2k_l(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index ffddbce..8875698 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -29,6 +29,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index f412d93..4b598de 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -67,6 +67,6 @@ void mp_rshd (mp_int * a, int b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index 8eec001..dd4de3c 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -24,6 +24,6 @@ void mp_set (mp_int * a, mp_digit b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index f456a3a..3aafec9 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -43,6 +43,6 @@ int mp_set_int (mp_int * a, unsigned long b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set_long.c b/libtommath/bn_mp_set_long.c index fbf9f82..8cbb811 100644 --- a/libtommath/bn_mp_set_long.c +++ b/libtommath/bn_mp_set_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long, unsigned long) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 0a688c8..3566b45 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long_long, unsigned long long) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index 9422a54..0712c2b 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -36,6 +36,6 @@ int mp_shrink (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index bb63407..0910333 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -22,6 +22,6 @@ int mp_signed_bin_size (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index 299308d..ffe94e2 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -55,6 +55,6 @@ mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 05ea9e0..3b29fbc 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -36,6 +36,6 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 72d98f0..d3b5d62 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -76,6 +76,6 @@ E2: mp_clear(&t1); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 67da8da..2f73faa 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -54,6 +54,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index a4e1b1c..5e96030 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -88,6 +88,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index ec7885c..138863c 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -37,6 +37,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index 109d8f7..c49c87d 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -28,6 +28,6 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index bcbdf79..dc5ec26 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -26,6 +26,6 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index 0ac9887..d249359 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -43,6 +43,6 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index 19fe1e4..f671621 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -26,6 +26,6 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 9a347fa..4a574fc 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -281,6 +281,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 327a85f..0a38192 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -223,6 +223,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index baf0e3b..3337765 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -70,6 +70,6 @@ int mp_toradix (mp_int * a, char *str, int radix) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 881cb52..ae24ada 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -83,6 +83,6 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index 74f6ed0..f46d0ba 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -23,6 +23,6 @@ int mp_unsigned_bin_size (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 9c83126..f51fc8e 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -46,6 +46,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index a76c2a9..a7d59e4 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -31,6 +31,6 @@ void mp_zero (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index 77535c7..5252130 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -56,6 +56,6 @@ const mp_digit ltm_prime_tab[] = { }; #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index 9c00f2b..dc87a4e 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -34,6 +34,6 @@ bn_reverse (unsigned char *s, int len) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 2069d88..7a100e8 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -104,6 +104,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index 8b10003..ab820d4 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -247,6 +247,6 @@ LBL_M: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index 41bca7b..8f1bf97 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -85,6 +85,6 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 7e18680..031f17b 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -76,6 +76,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index 3bcc7c9..ac0e157 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -79,6 +79,6 @@ int s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 260a95f..8091f4a 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -84,6 +84,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bncore.c b/libtommath/bncore.c index b07c629..e80ec99 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -31,6 +31,6 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub TOOM_SQR_CUTOFF = 400; #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/makefile.include b/libtommath/makefile.include deleted file mode 100644 index c862f0f..0000000 --- a/libtommath/makefile.include +++ /dev/null @@ -1,105 +0,0 @@ -# -# Include makefile for libtommath -# - -#version of library -VERSION=1.0 -VERSION_SO=1:0 - -# default make target -default: ${LIBNAME} - -# Compiler and Linker Names -ifndef PREFIX - PREFIX= -endif - -ifeq ($(CC),cc) - CC = $(PREFIX)gcc -endif -LD=$(PREFIX)ld -AR=$(PREFIX)ar -RANLIB=$(PREFIX)ranlib - -ifndef MAKE - MAKE=make -endif - -CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow - -ifndef NO_ADDTL_WARNINGS -# additional warnings -CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -CFLAGS += -Wstrict-prototypes -Wpointer-arith -endif - -ifdef COMPILE_DEBUG -#debug -CFLAGS += -g3 -else - -ifdef COMPILE_SIZE -#for size -CFLAGS += -Os -else - -ifndef IGNORE_SPEED -#for speed -CFLAGS += -O3 -funroll-loops - -#x86 optimizations [should be valid for any GCC install though] -CFLAGS += -fomit-frame-pointer -endif - -endif # COMPILE_SIZE -endif # COMPILE_DEBUG - -# adjust coverage set -ifneq ($(filter $(shell arch), i386 i686 x86_64 amd64 ia64),) - COVERAGE = test_standalone timing - COVERAGE_APP = ./test && ./ltmtest -else - COVERAGE = test_standalone - COVERAGE_APP = ./test -endif - -HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h -HEADERS=tommath_private.h $(HEADERS_PUB) - -test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0 - -#LIBPATH-The directory for libtommath to be installed to. -#INCPATH-The directory to install the header files for libtommath. -#DATAPATH-The directory to install the pdf docs. -LIBPATH?=/usr/lib -INCPATH?=/usr/include -DATAPATH?=/usr/share/doc/libtommath/pdf - -#make the code coverage of the library -# -coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS -coverage: LFLAGS += -lgcov -coverage: LDFLAGS += -lgcov - -coverage: $(COVERAGE) - $(COVERAGE_APP) - -lcov: coverage - rm -f coverage.info - lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q - genhtml coverage.info --output-directory coverage -q - -# target that removes all coverage output -cleancov-clean: - rm -f `find . -type f -name "*.info" | xargs` - rm -rf coverage/ - -# cleans everything - coverage output and standard 'clean' -cleancov: cleancov-clean clean - -clean: - rm -f *.gcda *.gcno *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \ - *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la - rm -rf .libs/ - cd etc ; MAKE=${MAKE} ${MAKE} clean - cd pics ; MAKE=${MAKE} ${MAKE} clean diff --git a/libtommath/tommath.h b/libtommath/tommath.h index fc6b409..80bae69 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -565,6 +565,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 4c5389c..aeda684 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -118,6 +118,6 @@ int func_name (mp_int * a, type b) \ #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index 2489a07..a2f4d93 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -71,6 +71,6 @@ #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/updatemakes.sh b/libtommath/updatemakes.sh index 54c3b84..0f9520e 100755 --- a/libtommath/updatemakes.sh +++ b/libtommath/updatemakes.sh @@ -28,6 +28,6 @@ rm -f tmp.delme rm -f tmplist -# $Source$ -# $Revision$ -# $Date$ +# ref: $Format:%D$ +# git commit: $Format:%H$ +# commit time: $Format:%ai$ -- cgit v0.12 From ce32fdecb2337a3ce69b0fb71295c46478019e86 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Aug 2017 15:07:57 +0000 Subject: Ignore libtommath/doc directory. Add some VS-related makefiles, useful for testing --- .fossil-settings/ignore-glob | 47 + libtommath/libtommath.dsp | 572 +++++++ libtommath/libtommath.pc.in | 10 + libtommath/libtommath_VS2005.sln | 20 + libtommath/libtommath_VS2005.vcproj | 2847 +++++++++++++++++++++++++++++++++++ libtommath/libtommath_VS2008.sln | 20 + libtommath/libtommath_VS2008.vcproj | 2813 ++++++++++++++++++++++++++++++++++ 7 files changed, 6329 insertions(+) create mode 100644 .fossil-settings/ignore-glob create mode 100644 libtommath/libtommath.dsp create mode 100644 libtommath/libtommath.pc.in create mode 100644 libtommath/libtommath_VS2005.sln create mode 100644 libtommath/libtommath_VS2005.vcproj create mode 100644 libtommath/libtommath_VS2008.sln create mode 100644 libtommath/libtommath_VS2008.vcproj diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob new file mode 100644 index 0000000..68c48e5 --- /dev/null +++ b/.fossil-settings/ignore-glob @@ -0,0 +1,47 @@ +*.a +*.dll +*.dylib +*.exe +*.exp +*.lib +*.o +*.obj +*.pdb +*.res +*.sl +*.so +*/Makefile +*/config.cache +*/config.log +*/config.status +*/tclConfig.sh +*/tclsh* +*/tcltest* +*/versions.vc +html +libtommath/bn.ilg +libtommath/bn.ind +libtommath/doc +libtommath/pretty.build +libtommath/tommath.src +libtommath/*.pdf +libtommath/*.pl +libtommath/*.sh +libtommath/tombc/* +libtommath/pre_gen/* +libtommath/pics/* +libtommath/mtest/* +libtommath/logs/* +libtommath/etc/* +libtommath/demo/* +libtommath/*.out +libtommath/*.tex +unix/autoMkindex.tcl +unix/dltest.marker +unix/tcl.pc +unix/tclIndex +unix/pkgs/* +win/Debug_VC* +win/Release_VC* +win/pkgs/* +win/tcl.hpj \ No newline at end of file diff --git a/libtommath/libtommath.dsp b/libtommath/libtommath.dsp new file mode 100644 index 0000000..71ac243 --- /dev/null +++ b/libtommath/libtommath.dsp @@ -0,0 +1,572 @@ +# Microsoft Developer Studio Project File - Name="libtommath" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libtommath - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libtommath.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libtommath.mak" CFG="libtommath - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libtommath - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libtommath - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "libtommath" +# PROP Scc_LocalPath "." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libtommath - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"Release\tommath.lib" + +!ELSEIF "$(CFG)" == "libtommath - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"Debug\tommath.lib" + +!ENDIF + +# Begin Target + +# Name "libtommath - Win32 Release" +# Name "libtommath - Win32 Debug" +# Begin Source File + +SOURCE=.\bn_error.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_mp_invmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_mp_montgomery_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_s_mp_mul_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_s_mp_mul_high_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_s_mp_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_2expt.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_abs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_add.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_add_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_addmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_and.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_clamp.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_clear.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_clear_multi.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cmp.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cmp_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cmp_mag.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cnt_lsb.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_copy.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_count_bits.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_2.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_2d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_3.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_dr_is_modulus.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_dr_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_dr_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exch.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_expt_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exptmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exptmod_fast.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exteuclid.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_fread.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_fwrite.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_gcd.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_get_int.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_grow.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_copy.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_multi.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_set.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_set_int.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_invmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_invmod_slow.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_is_square.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_jacobi.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_karatsuba_mul.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_karatsuba_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_lcm.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_lshd.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mod_2d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mod_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_montgomery_calc_normalization.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_montgomery_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_montgomery_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul_2.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul_2d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mulmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_n_root.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_neg.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_or.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_fermat.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_is_divisible.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_is_prime.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_miller_rabin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_next_prime.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_rabin_miller_trials.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_random_ex.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_radix_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_radix_smap.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_rand.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_read_radix.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_read_signed_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_read_unsigned_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k_l.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k_setup_l.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_is_2k.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_is_2k_l.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_rshd.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_set.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_set_int.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_shrink.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_signed_bin_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sqrmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sqrt.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sub.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sub_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_submod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_signed_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_signed_bin_n.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_unsigned_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_unsigned_bin_n.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toom_mul.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toom_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toradix.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toradix_n.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_unsigned_bin_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_xor.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_zero.c +# End Source File +# Begin Source File + +SOURCE=.\bn_prime_tab.c +# End Source File +# Begin Source File + +SOURCE=.\bn_reverse.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_add.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_exptmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_mul_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_mul_high_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_sub.c +# End Source File +# Begin Source File + +SOURCE=.\bncore.c +# End Source File +# Begin Source File + +SOURCE=.\tommath.h +# End Source File +# Begin Source File + +SOURCE=.\tommath_class.h +# End Source File +# Begin Source File + +SOURCE=.\tommath_superclass.h +# End Source File +# End Target +# End Project diff --git a/libtommath/libtommath.pc.in b/libtommath/libtommath.pc.in new file mode 100644 index 0000000..099b1cd --- /dev/null +++ b/libtommath/libtommath.pc.in @@ -0,0 +1,10 @@ +prefix=@to-be-replaced@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: LibTomMath +Description: public domain library for manipulating large integer numbers +Version: @to-be-replaced@ +Libs: -L${libdir} -ltommath +Cflags: -I${includedir} diff --git a/libtommath/libtommath_VS2005.sln b/libtommath/libtommath_VS2005.sln new file mode 100644 index 0000000..21bc915 --- /dev/null +++ b/libtommath/libtommath_VS2005.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2005.vcproj", "{0272C9B2-D68B-4F24-B32D-C1FD552F7E51}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.ActiveCfg = Debug|Win32 + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.Build.0 = Debug|Win32 + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.ActiveCfg = Release|Win32 + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libtommath/libtommath_VS2005.vcproj b/libtommath/libtommath_VS2005.vcproj new file mode 100644 index 0000000..b977b4a --- /dev/null +++ b/libtommath/libtommath_VS2005.vcproj @@ -0,0 +1,2847 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libtommath/libtommath_VS2008.sln b/libtommath/libtommath_VS2008.sln new file mode 100644 index 0000000..1327ccf --- /dev/null +++ b/libtommath/libtommath_VS2008.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2008.vcproj", "{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.ActiveCfg = Debug|Win32 + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.Build.0 = Debug|Win32 + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.ActiveCfg = Release|Win32 + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libtommath/libtommath_VS2008.vcproj b/libtommath/libtommath_VS2008.vcproj new file mode 100644 index 0000000..34bf2ae --- /dev/null +++ b/libtommath/libtommath_VS2008.vcproj @@ -0,0 +1,2813 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v0.12 From ca70072a998804499323fd4f553f3b1709f5a9a7 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Sep 2017 15:38:02 +0000 Subject: update changes --- changes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changes b/changes index d1e6417..5cc49ea 100644 --- a/changes +++ b/changes @@ -8838,4 +8838,6 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann) => http 2.8.12 ---- Released 8.7a1, August ??, 2017 --- http://core.tcl.tk/tcl/ for details +2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter) + +--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 413fe66650f5b1467098f19daeee0c8843bebc4c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Sep 2017 15:02:24 +0000 Subject: Fix use of "long long" (manually) in MSVC --- generic/tclTomMath.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 39132ed..508fadd 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -277,13 +277,19 @@ int mp_set_long_long(mp_int *a, unsigned long long b); */ /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +/* +unsigned long mp_get_int(const mp_int * a); +*/ /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +/* +unsigned long mp_get_long(const mp_int * a); +*/ /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +/* +unsigned long long mp_get_long_long(const mp_int * a); +*/ /* initialize and set a digit */ /* @@ -339,7 +345,7 @@ int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ /* -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); */ /* c = a * 2**b, implemented as c = a << b */ @@ -349,7 +355,7 @@ int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ /* -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); */ /* c = a mod 2**b */ @@ -801,7 +807,7 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ -- cgit v0.12 From d03a4dcc88f0ffb3e882124dc89f33f138419653 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 8 Sep 2017 13:13:15 +0000 Subject: Bump to 8.7a2 to distinguish trunk from 8.7a1 release. --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.ac | 2 +- win/configure | 2 +- win/configure.ac | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README b/README index 59de34d..322666a 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.7a1 source distribution. + This is the Tcl 8.7a2 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 589a63f..07d841d 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 7 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TCL_RELEASE_SERIAL 1 +#define TCL_RELEASE_SERIAL 2 #define TCL_VERSION "8.7" -#define TCL_PATCH_LEVEL "8.7a1" +#define TCL_PATCH_LEVEL "8.7a2" #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* diff --git a/library/init.tcl b/library/init.tcl index b6e6e8b..e361645 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.7a1 +package require -exact Tcl 8.7a2 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index 0b22a43..129c283 100755 --- a/unix/configure +++ b/unix/configure @@ -2325,7 +2325,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.ac b/unix/configure.ac index d7aa50f..e14d85e 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/win/configure b/win/configure index a47ff23..fdd3adb 100755 --- a/win/configure +++ b/win/configure @@ -2102,7 +2102,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.ac b/win/configure.ac index e32dadc..d03695c 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From e86e8a501d19fb5963200791c3b575648c00090c Mon Sep 17 00:00:00 2001 From: gahr Date: Fri, 8 Sep 2017 13:30:29 +0000 Subject: Be consistent about how I am referred to. --- changes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changes b/changes index 5cc49ea..ec8beb1 100644 --- a/changes +++ b/changes @@ -8234,7 +8234,7 @@ Dropped support for OS X versions less than 10.4 (Tiger) (fellows) 2013-05-16 (platform support) mingw-4.0 (nijtmans) -2013-05-19 (platform support) FreeBSD updates (cerutti) +2013-05-19 (platform support) FreeBSD updates (gahr) 2013-05-20 (bug fix)[3613567] access error temp file creation (keene) @@ -8657,7 +8657,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows) -2016-06-02 (TIP 447) execution time verbosity option (cerutti) +2016-06-02 (TIP 447) execution time verbosity option (gahr) => tcltest 2.4.0 2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter) -- cgit v0.12 From b2446d8d4189bfbfe9103548ebf459f29089398e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 8 Sep 2017 14:15:13 +0000 Subject: Add some more functions from libtommath for availability within Tcl (mainly the 'long long' variants). Add more 'const' keywords there too. --- generic/tclStubInit.c | 2 ++ generic/tclTomMath.decls | 11 +++++++++-- generic/tclTomMath.h | 4 ++-- generic/tclTomMathDecls.h | 21 +++++++++++++++++---- libtommath/bn_mp_div_2.c | 2 +- libtommath/bn_mp_get_int.c | 2 +- libtommath/bn_mp_get_long.c | 2 +- libtommath/bn_mp_get_long_long.c | 6 +++--- libtommath/bn_mp_mul_2.c | 2 +- libtommath/bn_mp_set_long_long.c | 2 +- libtommath/tommath.h | 12 ++++++------ unix/Makefile.in | 16 ++++++++++++++-- unix/tcl.spec | 2 +- win/Makefile.in | 3 +++ win/makefile.vc | 3 +++ 15 files changed, 65 insertions(+), 25 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 8cc21aa..a2f1ed3 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -859,6 +859,8 @@ const TclTomMathStubs tclTomMathStubs = { TclBNInitBignumFromWideInt, /* 65 */ TclBNInitBignumFromWideUInt, /* 66 */ TclBN_mp_expt_d_ex, /* 67 */ + TclBN_mp_set_long_long, /* 68 */ + TclBN_mp_get_long_long, /* 69 */ }; static const TclStubHooks tclStubHooks = { diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 74ccefc..c4299d0 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -69,7 +69,7 @@ declare 14 { int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r) } declare 15 { - int TclBN_mp_div_2(mp_int *a, mp_int *q) + int TclBN_mp_div_2(const mp_int *a, mp_int *q) } declare 16 { int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) @@ -117,7 +117,7 @@ declare 30 { int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p) } declare 31 { - int TclBN_mp_mul_2(mp_int *a, mp_int *p) + int TclBN_mp_mul_2(const mp_int *a, mp_int *p) } declare 32 { int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p) @@ -237,6 +237,13 @@ declare 66 { declare 67 { int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } +# Added in libtommath 1.0.1 +declare 68 { + int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i) +} +declare 69 { + Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a) +} # Local Variables: # mode: tcl diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 508fadd..7e3c29e 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -273,7 +273,7 @@ int mp_set_long(mp_int *a, unsigned long b); /* set a platform dependent unsigned long long value */ /* -int mp_set_long_long(mp_int *a, unsigned long long b); +int mp_set_long_long(mp_int *a, Tcl_WideUInt b); */ /* get a 32-bit value */ @@ -288,7 +288,7 @@ unsigned long mp_get_long(const mp_int * a); /* get a platform dependent unsigned long long value */ /* -unsigned long long mp_get_long_long(const mp_int * a); +Tcl_WideUInt mp_get_long_long(const mp_int * a); */ /* initialize and set a digit */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 209c486..70de3b1 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -74,6 +74,8 @@ #define mp_exch TclBN_mp_exch #define mp_expt_d TclBN_mp_expt_d #define mp_expt_d_ex TclBN_mp_expt_d_ex +#define mp_get_int TclBN_mp_get_int +#define mp_get_long_long TclBN_mp_get_long_long #define mp_grow TclBN_mp_grow #define mp_init TclBN_mp_init #define mp_init_copy TclBN_mp_init_copy @@ -98,6 +100,7 @@ #define mp_s_rmap TclBNMpSRmap #define mp_set TclBN_mp_set #define mp_set_int TclBN_mp_set_int +#define mp_set_long_long TclBN_mp_set_long_long #define mp_shrink TclBN_mp_shrink #define mp_sqr TclBN_mp_sqr #define mp_sqrt TclBN_mp_sqrt @@ -176,7 +179,7 @@ EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 15 */ -EXTERN int TclBN_mp_div_2(mp_int *a, mp_int *q); +EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q); /* 16 */ EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r); @@ -209,7 +212,7 @@ EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p); /* 30 */ EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p); /* 31 */ -EXTERN int TclBN_mp_mul_2(mp_int *a, mp_int *p); +EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p); /* 32 */ EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); /* 33 */ @@ -292,6 +295,10 @@ EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, /* 67 */ EXTERN int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +/* 68 */ +EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); +/* 69 */ +EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a); typedef struct TclTomMathStubs { int magic; @@ -312,7 +319,7 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */ int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */ int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ - int (*tclBN_mp_div_2) (mp_int *a, mp_int *q); /* 15 */ + int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */ int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ @@ -328,7 +335,7 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */ int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */ int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */ - int (*tclBN_mp_mul_2) (mp_int *a, mp_int *p); /* 31 */ + int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */ int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */ int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */ int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */ @@ -365,6 +372,8 @@ typedef struct TclTomMathStubs { void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ + int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ + Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ } TclTomMathStubs; extern const TclTomMathStubs *tclTomMathStubsPtr; @@ -515,6 +524,10 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */ #define TclBN_mp_expt_d_ex \ (tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */ +#define TclBN_mp_set_long_long \ + (tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */ +#define TclBN_mp_get_long_long \ + (tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index 2b5bb49..0e981a0 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -16,7 +16,7 @@ */ /* b = a/2 */ -int mp_div_2(mp_int * a, mp_int * b) +int mp_div_2(const mp_int * a, mp_int * b) { int x, res, oldused; diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 5c820f8..abb7011 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -16,7 +16,7 @@ */ /* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int * a) +unsigned long mp_get_int(const mp_int * a) { int i; mp_min_u32 res; diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index 7c3d0fe..da69080 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -16,7 +16,7 @@ */ /* get the lower unsigned long of an mp_int, platform dependent */ -unsigned long mp_get_long(mp_int * a) +unsigned long mp_get_long(const mp_int * a) { int i; unsigned long res; diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 4b959e6..534c48c 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -16,17 +16,17 @@ */ /* get the lower unsigned long long of an mp_int, platform dependent */ -unsigned long long mp_get_long_long (mp_int * a) +Tcl_WideUInt mp_get_long_long (const mp_int * a) { int i; - unsigned long long res; + Tcl_WideUInt res; if (a->used == 0) { return 0; } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used,(int)(((sizeof(Tcl_WideUInt) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ res = DIGIT(a,i); diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index d22fd89..0c8c2e3 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -16,7 +16,7 @@ */ /* b = a*2 */ -int mp_mul_2(mp_int * a, mp_int * b) +int mp_mul_2(const mp_int * a, mp_int * b) { int x, res, oldused; diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 3566b45..0b8be33 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -16,7 +16,7 @@ */ /* set a platform dependent unsigned long long int */ -MP_SET_XLONG(mp_set_long_long, unsigned long long) +MP_SET_XLONG(mp_set_long_long, Tcl_WideUInt) #endif /* ref: $Format:%D$ */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 7d92d97..a8c9e21 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -220,16 +220,16 @@ int mp_set_int(mp_int *a, unsigned long b); int mp_set_long(mp_int *a, unsigned long b); /* set a platform dependent unsigned long long value */ -int mp_set_long_long(mp_int *a, unsigned long long b); +int mp_set_long_long(mp_int *a, Tcl_WideUInt b); /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +unsigned long mp_get_int(const mp_int * a); /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +unsigned long mp_get_long(const mp_int * a); /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +Tcl_WideUInt mp_get_long_long(const mp_int * a); /* initialize and set a digit */ int mp_init_set (mp_int * a, mp_digit b); @@ -264,13 +264,13 @@ int mp_lshd(mp_int *a, int b); int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); /* c = a * 2**b, implemented as c = a << b */ int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); /* c = a mod 2**b */ int mp_mod_2d(const mp_int *a, int b, mp_int *c); diff --git a/unix/Makefile.in b/unix/Makefile.in index fadc147..2f97bf5 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -320,7 +320,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_cnt_lsb.o bn_mp_copy.o \ bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o \ bn_mp_div_2d.o bn_mp_div_3.o \ - bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_grow.o bn_mp_init.o \ + bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_get_int.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_init.o \ bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \ bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_karatsuba_mul.o \ bn_mp_karatsuba_sqr.o \ @@ -328,7 +328,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.o \ bn_mp_radix_size.o bn_mp_radix_smap.o \ bn_mp_read_radix.o bn_mp_rshd.o bn_mp_set.o bn_mp_set_int.o \ - bn_mp_shrink.o \ + bn_mp_set_long_long.o bn_mp_shrink.o \ bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o \ bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \ bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix_n.o \ @@ -504,6 +504,8 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_exch.c \ $(TOMMATH_DIR)/bn_mp_expt_d.c \ $(TOMMATH_DIR)/bn_mp_expt_d_ex.c \ + $(TOMMATH_DIR)/bn_mp_get_int.c \ + $(TOMMATH_DIR)/bn_mp_get_long_long.c \ $(TOMMATH_DIR)/bn_mp_grow.c \ $(TOMMATH_DIR)/bn_mp_init.c \ $(TOMMATH_DIR)/bn_mp_init_copy.c \ @@ -528,6 +530,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_rshd.c \ $(TOMMATH_DIR)/bn_mp_set.c \ $(TOMMATH_DIR)/bn_mp_set_int.c \ + $(TOMMATH_DIR)/bn_mp_set_long_long.c \ $(TOMMATH_DIR)/bn_mp_shrink.c \ $(TOMMATH_DIR)/bn_mp_sqr.c \ $(TOMMATH_DIR)/bn_mp_sqrt.c \ @@ -1426,6 +1429,12 @@ bn_mp_expt_d.o: $(TOMMATH_DIR)/bn_mp_expt_d.c $(MATHHDRS) bn_mp_expt_d_ex.o: $(TOMMATH_DIR)/bn_mp_expt_d_ex.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_expt_d_ex.c +bn_mp_get_int.o: $(TOMMATH_DIR)/bn_mp_get_int.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_int.c + +bn_mp_get_long_long.o: $(TOMMATH_DIR)/bn_mp_get_long_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_long_long.c + bn_mp_grow.o: $(TOMMATH_DIR)/bn_mp_grow.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_grow.c @@ -1498,6 +1507,9 @@ bn_mp_set.o: $(TOMMATH_DIR)/bn_mp_set.c $(MATHHDRS) bn_mp_set_int.o: $(TOMMATH_DIR)/bn_mp_set_int.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_int.c +bn_mp_set_long_long.o: $(TOMMATH_DIR)/bn_mp_set_long_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_long_long.c + bn_mp_shrink.o: $(TOMMATH_DIR)/bn_mp_shrink.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_shrink.c diff --git a/unix/tcl.spec b/unix/tcl.spec index 868a226..265e4df 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -4,7 +4,7 @@ Name: tcl Summary: Tcl scripting language development environment -Version: 8.7a0 +Version: 8.7a2 Release: 2 License: BSD Group: Development/Languages diff --git a/win/Makefile.in b/win/Makefile.in index 24cb5b2..4a0f839 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -329,6 +329,8 @@ TOMMATH_OBJS = \ bn_mp_exch.${OBJEXT} \ bn_mp_expt_d.${OBJEXT} \ bn_mp_expt_d_ex.${OBJEXT} \ + bn_mp_get_int.${OBJEXT} \ + bn_mp_get_long_long.${OBJEXT} \ bn_mp_grow.${OBJEXT} \ bn_mp_init.${OBJEXT} \ bn_mp_init_copy.${OBJEXT} \ @@ -353,6 +355,7 @@ TOMMATH_OBJS = \ bn_mp_rshd.${OBJEXT} \ bn_mp_set.${OBJEXT} \ bn_mp_set_int.${OBJEXT} \ + bn_mp_set_long_long.${OBJEXT} \ bn_mp_shrink.${OBJEXT} \ bn_mp_sqr.${OBJEXT} \ bn_mp_sqrt.${OBJEXT} \ diff --git a/win/makefile.vc b/win/makefile.vc index 5566df2..ca8cc08 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -384,6 +384,8 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_exch.obj \ $(TMP_DIR)\bn_mp_expt_d.obj \ $(TMP_DIR)\bn_mp_expt_d_ex.obj \ + $(TMP_DIR)\bn_mp_get_int.obj \ + $(TMP_DIR)\bn_mp_get_long_long.obj \ $(TMP_DIR)\bn_mp_grow.obj \ $(TMP_DIR)\bn_mp_init.obj \ $(TMP_DIR)\bn_mp_init_copy.obj \ @@ -408,6 +410,7 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_rshd.obj \ $(TMP_DIR)\bn_mp_set.obj \ $(TMP_DIR)\bn_mp_set_int.obj \ + $(TMP_DIR)\bn_mp_set_long_long.obj \ $(TMP_DIR)\bn_mp_shrink.obj \ $(TMP_DIR)\bn_mp_sqr.obj \ $(TMP_DIR)\bn_mp_sqrt.obj \ -- cgit v0.12 From 3e55dbb18cf086d34207ca2e744ecea04cc67b38 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 11 Sep 2017 10:38:07 +0000 Subject: Many 'const' addtions in libtommath where it makes sense. To be submitted back to the libtommath guys. --- generic/tclTomMath.decls | 50 +++++++-------- generic/tclTomMath.h | 38 +++++------ generic/tclTomMathDecls.h | 125 ++++++++++++++++++++----------------- libtommath/bn_fast_s_mp_mul_digs.c | 2 +- libtommath/bn_fast_s_mp_sqr.c | 2 +- libtommath/bn_mp_add.c | 2 +- libtommath/bn_mp_and.c | 5 +- libtommath/bn_mp_div.c | 4 +- libtommath/bn_mp_div_3.c | 2 +- libtommath/bn_mp_div_d.c | 2 +- libtommath/bn_mp_expt_d.c | 2 +- libtommath/bn_mp_expt_d_ex.c | 2 +- libtommath/bn_mp_karatsuba_mul.c | 2 +- libtommath/bn_mp_karatsuba_sqr.c | 2 +- libtommath/bn_mp_mod.c | 2 +- libtommath/bn_mp_mul.c | 2 +- libtommath/bn_mp_mul_d.c | 2 +- libtommath/bn_mp_or.c | 5 +- libtommath/bn_mp_sqr.c | 2 +- libtommath/bn_mp_sqrt.c | 2 +- libtommath/bn_mp_sub.c | 2 +- libtommath/bn_mp_toom_mul.c | 2 +- libtommath/bn_mp_toom_sqr.c | 2 +- libtommath/bn_mp_xor.c | 5 +- libtommath/bn_s_mp_add.c | 4 +- libtommath/bn_s_mp_mul_digs.c | 2 +- libtommath/bn_s_mp_sqr.c | 2 +- libtommath/bn_s_mp_sub.c | 2 +- libtommath/tommath.h | 36 +++++------ libtommath/tommath_private.h | 20 +++--- 30 files changed, 174 insertions(+), 158 deletions(-) diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index c4299d0..5d1c8e8 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -30,13 +30,13 @@ declare 1 { } declare 2 { - int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 3 { int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c) } declare 4 { - int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c) } declare 5 { void TclBN_mp_clamp(mp_int *a) @@ -63,10 +63,10 @@ declare 12 { int TclBN_mp_count_bits(const mp_int *a) } declare 13 { - int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r) + int TclBN_mp_div(const mp_int *a, const mp_int *b, mp_int *q, mp_int *r) } declare 14 { - int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r) + int TclBN_mp_div_d(const mp_int *a, mp_digit b, mp_int *q, mp_digit *r) } declare 15 { int TclBN_mp_div_2(const mp_int *a, mp_int *q) @@ -75,13 +75,13 @@ declare 16 { int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) } declare 17 { - int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r) + int TclBN_mp_div_3(const mp_int *a, mp_int *q, mp_digit *r) } declare 18 { void TclBN_mp_exch(mp_int *a, mp_int *b) } declare 19 { - int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c) + int TclBN_mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) } declare 20 { int TclBN_mp_grow(mp_int *a, int size) @@ -105,16 +105,16 @@ declare 26 { int TclBN_mp_lshd(mp_int *a, int shift) } declare 27 { - int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r) + int TclBN_mp_mod(const mp_int *a, const mp_int *b, mp_int *r) } declare 28 { int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r) } declare 29 { - int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p) + int TclBN_mp_mul(const mp_int *a, const mp_int *b, mp_int *p) } declare 30 { - int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p) + int TclBN_mp_mul_d(const mp_int *a, mp_digit b, mp_int *p) } declare 31 { int TclBN_mp_mul_2(const mp_int *a, mp_int *p) @@ -126,7 +126,7 @@ declare 33 { int TclBN_mp_neg(const mp_int *a, mp_int *b) } declare 34 { - int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_or(const mp_int *a, const mp_int *b, mp_int *c) } declare 35 { int TclBN_mp_radix_size(const mp_int *a, int radix, int *size) @@ -144,13 +144,13 @@ declare 39 { void TclBN_mp_set(mp_int *a, mp_digit b) } declare 40 { - int TclBN_mp_sqr(mp_int *a, mp_int *b) + int TclBN_mp_sqr(const mp_int *a, mp_int *b) } declare 41 { - int TclBN_mp_sqrt(mp_int *a, mp_int *b) + int TclBN_mp_sqrt(const mp_int *a, mp_int *b) } declare 42 { - int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 43 { int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c) @@ -169,7 +169,7 @@ declare 47 { int TclBN_mp_unsigned_bin_size(mp_int *a) } declare 48 { - int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c) } declare 49 { void TclBN_mp_zero(mp_int *a) @@ -182,34 +182,34 @@ declare 50 { void TclBN_reverse(unsigned char *s, int len) } declare 51 { - int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) + int TclBN_fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) } declare 52 { - int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b) + int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b) } declare 53 { - int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c) } declare 54 { - int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b) + int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b) } declare 55 { - int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) } declare 56 { - int TclBN_mp_toom_sqr(mp_int *a, mp_int *b) + int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b) } declare 57 { - int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c) + int TclBN_s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 58 { - int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) + int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) } declare 59 { - int TclBN_s_mp_sqr(mp_int *a, mp_int *b) + int TclBN_s_mp_sqr(const mp_int *a, mp_int *b) } declare 60 { - int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c) + int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 61 { int TclBN_mp_init_set_int(mp_int *a, unsigned long i) @@ -235,7 +235,7 @@ declare 66 { # Added in libtommath 1.0 declare 67 { - int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) + int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) } # Added in libtommath 1.0.1 declare 68 { diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 7e3c29e..2ce8194 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -27,7 +27,7 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(NEVER) /* 128-bit ints fail in too many places */ +#if defined(NEVER) #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif @@ -383,17 +383,17 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ /* -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a OR b */ /* -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a AND b */ /* -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); */ /* ---> Basic arithmetic <--- */ @@ -405,7 +405,7 @@ int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ /* -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); */ /* compare a to b */ @@ -420,32 +420,32 @@ int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ /* -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a - b */ /* -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a * b */ /* -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); */ /* b = a*a */ /* -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); */ /* a/b => cb + d == a */ /* -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); */ /* c = a mod b, 0 <= c < b */ /* -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); */ /* ---> single digit functions <--- */ @@ -457,40 +457,40 @@ int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ /* -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); */ /* c = a - b */ /* -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); */ /* c = a * b */ /* -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); */ /* a/b => cb + d == a */ /* -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); */ /* a/3 => 3c + d == a */ /* -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); */ /* c = a**b */ /* -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +int mp_expt_d(const mp_int *a, const mp_digit b, mp_int *c); */ /* -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d_ex (const mp_int * a, const mp_digit b, mp_int * c, int fast); */ /* c = a mod b, 0 <= c < b */ /* -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); */ /* ---> number theory <--- */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 70de3b1..9d683dc 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -151,11 +151,13 @@ EXTERN int TclBN_epoch(void); /* 1 */ EXTERN int TclBN_revision(void); /* 2 */ -EXTERN int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b, + mp_int *c); /* 3 */ EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c); /* 4 */ -EXTERN int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b, + mp_int *c); /* 5 */ EXTERN void TclBN_mp_clamp(mp_int *a); /* 6 */ @@ -173,22 +175,24 @@ EXTERN int TclBN_mp_copy(const mp_int *a, mp_int *b); /* 12 */ EXTERN int TclBN_mp_count_bits(const mp_int *a); /* 13 */ -EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, - mp_int *r); +EXTERN int TclBN_mp_div(const mp_int *a, const mp_int *b, + mp_int *q, mp_int *r); /* 14 */ -EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, - mp_digit *r); +EXTERN int TclBN_mp_div_d(const mp_int *a, mp_digit b, + mp_int *q, mp_digit *r); /* 15 */ EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q); /* 16 */ EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r); /* 17 */ -EXTERN int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r); +EXTERN int TclBN_mp_div_3(const mp_int *a, mp_int *q, + mp_digit *r); /* 18 */ EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b); /* 19 */ -EXTERN int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_expt_d(const mp_int *a, mp_digit b, + mp_int *c); /* 20 */ EXTERN int TclBN_mp_grow(mp_int *a, int size); /* 21 */ @@ -204,13 +208,16 @@ EXTERN int TclBN_mp_init_size(mp_int *a, int size); /* 26 */ EXTERN int TclBN_mp_lshd(mp_int *a, int shift); /* 27 */ -EXTERN int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r); +EXTERN int TclBN_mp_mod(const mp_int *a, const mp_int *b, + mp_int *r); /* 28 */ EXTERN int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r); /* 29 */ -EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p); +EXTERN int TclBN_mp_mul(const mp_int *a, const mp_int *b, + mp_int *p); /* 30 */ -EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p); +EXTERN int TclBN_mp_mul_d(const mp_int *a, mp_digit b, + mp_int *p); /* 31 */ EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p); /* 32 */ @@ -218,7 +225,8 @@ EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); /* 33 */ EXTERN int TclBN_mp_neg(const mp_int *a, mp_int *b); /* 34 */ -EXTERN int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_or(const mp_int *a, const mp_int *b, + mp_int *c); /* 35 */ EXTERN int TclBN_mp_radix_size(const mp_int *a, int radix, int *size); @@ -232,11 +240,12 @@ EXTERN int TclBN_mp_shrink(mp_int *a); /* 39 */ EXTERN void TclBN_mp_set(mp_int *a, mp_digit b); /* 40 */ -EXTERN int TclBN_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_sqr(const mp_int *a, mp_int *b); /* 41 */ -EXTERN int TclBN_mp_sqrt(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b); /* 42 */ -EXTERN int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b, + mp_int *c); /* 43 */ EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c); /* 44 */ @@ -250,34 +259,38 @@ EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, /* 47 */ EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a); /* 48 */ -EXTERN int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b, + mp_int *c); /* 49 */ EXTERN void TclBN_mp_zero(mp_int *a); /* 50 */ EXTERN void TclBN_reverse(unsigned char *s, int len); /* 51 */ -EXTERN int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, - mp_int *c, int digs); +EXTERN int TclBN_fast_s_mp_mul_digs(const mp_int *a, + const mp_int *b, mp_int *c, int digs); /* 52 */ -EXTERN int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b); /* 53 */ -EXTERN int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, - mp_int *c); +EXTERN int TclBN_mp_karatsuba_mul(const mp_int *a, + const mp_int *b, mp_int *c); /* 54 */ -EXTERN int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b); /* 55 */ -EXTERN int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, + mp_int *c); /* 56 */ -EXTERN int TclBN_mp_toom_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b); /* 57 */ -EXTERN int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_s_mp_add(const mp_int *a, const mp_int *b, + mp_int *c); /* 58 */ -EXTERN int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, - int digs); +EXTERN int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, + mp_int *c, int digs); /* 59 */ -EXTERN int TclBN_s_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_s_mp_sqr(const mp_int *a, mp_int *b); /* 60 */ -EXTERN int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, + mp_int *c); /* 61 */ EXTERN int TclBN_mp_init_set_int(mp_int *a, unsigned long i); /* 62 */ @@ -293,8 +306,8 @@ EXTERN void TclBNInitBignumFromWideInt(mp_int *bignum, EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal); /* 67 */ -EXTERN int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, - int fast); +EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, + mp_int *c, int fast); /* 68 */ EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); /* 69 */ @@ -306,9 +319,9 @@ typedef struct TclTomMathStubs { int (*tclBN_epoch) (void); /* 0 */ int (*tclBN_revision) (void); /* 1 */ - int (*tclBN_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 2 */ + int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */ int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */ - int (*tclBN_mp_and) (mp_int *a, mp_int *b, mp_int *c); /* 4 */ + int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */ void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */ @@ -317,13 +330,13 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */ int (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */ int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */ - int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */ - int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ + int (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */ + int (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */ int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ - int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */ + int (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ - int (*tclBN_mp_expt_d) (mp_int *a, mp_digit b, mp_int *c); /* 19 */ + int (*tclBN_mp_expt_d) (const mp_int *a, mp_digit b, mp_int *c); /* 19 */ int (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */ int (*tclBN_mp_init) (mp_int *a); /* 21 */ int (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */ @@ -331,47 +344,47 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */ int (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */ int (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */ - int (*tclBN_mp_mod) (mp_int *a, mp_int *b, mp_int *r); /* 27 */ + int (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */ int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */ - int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */ - int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */ + int (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */ + int (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */ int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */ int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */ int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */ - int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */ + int (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */ int (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */ int (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */ void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */ int (*tclBN_mp_shrink) (mp_int *a); /* 38 */ void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */ - int (*tclBN_mp_sqr) (mp_int *a, mp_int *b); /* 40 */ - int (*tclBN_mp_sqrt) (mp_int *a, mp_int *b); /* 41 */ - int (*tclBN_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 42 */ + int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */ + int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */ + int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */ int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */ int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */ int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */ int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */ - int (*tclBN_mp_xor) (mp_int *a, mp_int *b, mp_int *c); /* 48 */ + int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */ void (*tclBN_mp_zero) (mp_int *a); /* 49 */ void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */ - int (*tclBN_fast_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 51 */ - int (*tclBN_fast_s_mp_sqr) (mp_int *a, mp_int *b); /* 52 */ - int (*tclBN_mp_karatsuba_mul) (mp_int *a, mp_int *b, mp_int *c); /* 53 */ - int (*tclBN_mp_karatsuba_sqr) (mp_int *a, mp_int *b); /* 54 */ - int (*tclBN_mp_toom_mul) (mp_int *a, mp_int *b, mp_int *c); /* 55 */ - int (*tclBN_mp_toom_sqr) (mp_int *a, mp_int *b); /* 56 */ - int (*tclBN_s_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 57 */ - int (*tclBN_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 58 */ - int (*tclBN_s_mp_sqr) (mp_int *a, mp_int *b); /* 59 */ - int (*tclBN_s_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 60 */ + int (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */ + int (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */ + int (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */ + int (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */ + int (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */ + int (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */ + int (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */ + int (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */ + int (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */ + int (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */ int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ - int (*tclBN_mp_expt_d_ex) (mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ + int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ } TclTomMathStubs; diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index a1015af..641b574 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -31,7 +31,7 @@ * Based on Algorithm 14.12 on pp.595 of HAC. * */ -int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int fast_s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index f435af9..282d303 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -25,7 +25,7 @@ After that loop you do the squares and add them in. */ -int fast_s_mp_sqr (mp_int * a, mp_int * b) +int fast_s_mp_sqr (const mp_int * a, mp_int * b) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY], *tmpx; diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index bdb166f..a68c02e 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -16,7 +16,7 @@ */ /* high level addition (handles signs) */ -int mp_add (mp_int * a, mp_int * b, mp_int * c) +int mp_add (const mp_int * a, const mp_int * b, mp_int * c) { int sa, sb, res; diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 53008a5..e90ab37 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -17,10 +17,11 @@ /* AND two ints together */ int -mp_and (mp_int * a, mp_int * b, mp_int * c) +mp_and (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 0890e65..30b36b6 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -18,7 +18,7 @@ #ifdef BN_MP_DIV_SMALL /* slower bit-bang division... also smaller */ -int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div(const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) { mp_int ta, tb, tq, q; int res, n, n2; @@ -100,7 +100,7 @@ LBL_ERR: * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) { mp_int q, x, y, t1, t2; int res, n, t, i, norm, neg; diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index e8504ea..5e75438 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -17,7 +17,7 @@ /* divide by three (based on routine from MPI and the GMP manual) */ int -mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) +mp_div_3 (const mp_int * a, mp_int *c, mp_digit * d) { mp_int q; mp_word w, t; diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index d1f2774..4767565 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -33,7 +33,7 @@ static int s_is_power_of_two(mp_digit b, int *p) } /* single digit division (based on routine from MPI) */ -int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) +int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d) { mp_int q; mp_word w; diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index a311926..ffa3b93 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -16,7 +16,7 @@ */ /* wrapper function for mp_expt_d_ex() */ -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) +int mp_expt_d (const mp_int * a, mp_digit b, mp_int * c) { return mp_expt_d_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index c361b27..545d156 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -16,7 +16,7 @@ */ /* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) +int mp_expt_d_ex (const mp_int * a, mp_digit b, mp_int * c, int fast) { int res; unsigned int x; diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 4d982c7..1e6a42b 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -44,7 +44,7 @@ * Generally though the overhead of this method doesn't pay off * until a certain size (N ~ 80) is reached. */ -int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_karatsuba_mul (const mp_int * a, const mp_int * b, mp_int * c) { mp_int x0, x1, y0, y1, t1, x0y0, x1y1; int B, err; diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 764e85a..90624d0 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -22,7 +22,7 @@ * is essentially the same algorithm but merely * tuned to perform recursive squarings. */ -int mp_karatsuba_sqr (mp_int * a, mp_int * b) +int mp_karatsuba_sqr (const mp_int * a, mp_int * b) { mp_int x0, x1, t1, t2, x0x0, x1x1; int B, err; diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 06240a0..fff0f92 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -17,7 +17,7 @@ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ int -mp_mod (mp_int * a, mp_int * b, mp_int * c) +mp_mod (const mp_int * a, const mp_int * b, mp_int * c) { mp_int t; int res; diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index cc3b9c8..b8b85c8 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -16,7 +16,7 @@ */ /* high level multiplication (handles sign) */ -int mp_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_mul (const mp_int * a, const mp_int * b, mp_int * c) { int res, neg; neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 6954ed3..266b082 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -17,7 +17,7 @@ /* multiply by a digit */ int -mp_mul_d (mp_int * a, mp_digit b, mp_int * c) +mp_mul_d (const mp_int * a, mp_digit b, mp_int * c) { mp_digit u, *tmpa, *tmpc; mp_word r; diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index b9775ce..afe8467 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -16,10 +16,11 @@ */ /* OR two ints together */ -int mp_or (mp_int * a, mp_int * b, mp_int * c) +int mp_or (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index ffe94e2..a61f506 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -17,7 +17,7 @@ /* computes b = a*a */ int -mp_sqr (mp_int * a, mp_int * b) +mp_sqr (const mp_int * a, mp_int * b) { int res; diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 775e85f..ce8bd0e 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -20,7 +20,7 @@ #endif /* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) +int mp_sqrt(const mp_int *arg, mp_int *ret) { int res; mp_int t1,t2; diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 2f73faa..9ff03d5 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -17,7 +17,7 @@ /* high level subtraction (handles signs) */ int -mp_sub (mp_int * a, mp_int * b, mp_int * c) +mp_sub (const mp_int * a, const mp_int * b, mp_int * c) { int sa, sb, res; diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 4a574fc..0bf940d 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -22,7 +22,7 @@ * only particularly useful on VERY large inputs * (we're talking 1000s of digits here...). */ -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) { mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; int res, B; diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 0a38192..842ae47 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -17,7 +17,7 @@ /* squaring using Toom-Cook 3-way algorithm */ int -mp_toom_sqr(mp_int *a, mp_int *b) +mp_toom_sqr(const mp_int *a, mp_int *b) { mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; int res, B; diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index f51fc8e..9f7b086 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -17,10 +17,11 @@ /* XOR two ints together */ int -mp_xor (mp_int * a, mp_int * b, mp_int * c) +mp_xor (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 7a100e8..432e3b4 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -17,9 +17,9 @@ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ int -s_mp_add (mp_int * a, mp_int * b, mp_int * c) +s_mp_add (const mp_int * a, const mp_int * b, mp_int * c) { - mp_int *x; + const mp_int *x; int olduse, res, min, max; /* find sizes, we let |a| <= |b| which means we have to sort diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index 8f1bf97..d32bf15 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -19,7 +19,7 @@ * HAC pp. 595, Algorithm 14.12 Modified so you can control how * many digits of output are created. */ -int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index ac0e157..de6a3ea 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -16,7 +16,7 @@ */ /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr (mp_int * a, mp_int * b) +int s_mp_sqr (const mp_int * a, mp_int * b) { mp_int t; int res, ix, iy, pa; diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 8091f4a..7f49d66 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -17,7 +17,7 @@ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ int -s_mp_sub (mp_int * a, mp_int * b, mp_int * c) +s_mp_sub (const mp_int * a, const mp_int * b, mp_int * c) { int olduse, res, min, max; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index a8c9e21..b183b8a 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -288,13 +288,13 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); /* c = a OR b */ -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); /* c = a AND b */ -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ @@ -302,7 +302,7 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c); int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); /* compare a to b */ int mp_cmp(const mp_int *a, const mp_int *b); @@ -311,22 +311,22 @@ int mp_cmp(const mp_int *a, const mp_int *b); int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* c = a - b */ -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* c = a * b */ -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); /* b = a*a */ -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); /* a/b => cb + d == a */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); /* c = a mod b, 0 <= c < b */ -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); /* ---> single digit functions <--- */ @@ -334,26 +334,26 @@ int mp_mod(mp_int *a, mp_int *b, mp_int *c); int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); /* c = a - b */ int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); /* a/b => cb + d == a */ -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); /* a/3 => 3c + d == a */ -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d(const mp_int *a, const mp_digit b, mp_int *c); +int mp_expt_d_ex (const mp_int * a, const mp_digit b, mp_int * c, int fast); /* c = a mod b, 0 <= c < b */ -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ @@ -389,7 +389,7 @@ int mp_n_root(mp_int *a, mp_digit b, mp_int *c); int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast); /* special sqrt algo */ -int mp_sqrt(mp_int *arg, mp_int *ret); +int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 3217ee7..07607a8 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -57,19 +57,19 @@ extern "C" { #endif /* lowlevel functions, do not call! */ -int s_mp_add(mp_int *a, mp_int *b, mp_int *c); -int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); +int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) -int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int fast_s_mp_sqr(mp_int *a, mp_int *b); -int s_mp_sqr(mp_int *a, mp_int *b); -int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_karatsuba_sqr(mp_int *a, mp_int *b); -int mp_toom_sqr(mp_int *a, mp_int *b); +int fast_s_mp_sqr(const mp_int *a, mp_int *b); +int s_mp_sqr(const mp_int *a, mp_int *b); +int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_karatsuba_sqr(const mp_int *a, mp_int *b); +int mp_toom_sqr(const mp_int *a, mp_int *b); int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); -- cgit v0.12 From c659b044b1e05ff3f4bcd0a94b01b3d2611c251c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 13 Sep 2017 10:14:31 +0000 Subject: Make mp_get_long and mp_set_long available to tommath-enabled Tcl extensions. Deprecate the internal TclBNInitBignumFrom* functions, in favor of the official tommath functions with the same purpose. --- generic/tclBasic.c | 4 +- generic/tclBinary.c | 2 +- generic/tclDecls.h | 9 +++++ generic/tclExecute.c | 6 +-- generic/tclInt.h | 4 ++ generic/tclObj.c | 6 +-- generic/tclStrToD.c | 32 ++++++++-------- generic/tclStubInit.c | 6 +++ generic/tclTomMath.decls | 12 ++++-- generic/tclTomMathDecls.h | 17 ++++++--- generic/tclTomMathInterface.c | 89 +++++++++++-------------------------------- unix/Makefile.in | 12 +++++- win/Makefile.in | 2 + win/makefile.vc | 2 + 14 files changed, 100 insertions(+), 103 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index cceef45..d4fa833 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7460,7 +7460,7 @@ ExprAbsFunc( } goto unChanged; } else if (l == LONG_MIN) { - TclBNInitBignumFromLong(&big, l); + TclInitBignumFromLong(&big, l); goto tooLarge; } Tcl_SetObjResult(interp, Tcl_NewLongObj(-l)); @@ -7495,7 +7495,7 @@ ExprAbsFunc( goto unChanged; } if (w == LLONG_MIN) { - TclBNInitBignumFromWideInt(&big, w); + TclInitBignumFromWideInt(&big, w); goto tooLarge; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-w)); diff --git a/generic/tclBinary.c b/generic/tclBinary.c index a693894..cb5a5cb 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -2284,7 +2284,7 @@ ScanNumber( Tcl_Obj *bigObj = NULL; mp_int big; - TclBNInitBignumFromWideUInt(&big, uwvalue); + TclInitBignumFromWideUInt(&big, uwvalue); bigObj = Tcl_NewBignumObj(&big); return bigObj; } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d543238..464fc0f 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -23,6 +23,15 @@ # endif #endif +#if !defined(BUILD_tcl) +# define TCL_DEPRECATED(msg) EXTERN TCL_DEPRECATED_API(msg) +#elif defined(TCL_NO_DEPRECATED) +# define TCL_DEPRECATED(msg) MODULE_SCOPE +#else +# define TCL_DEPRECATED(msg) EXTERN +#endif + + /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 0113b28..f4c71ec 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8218,7 +8218,7 @@ ExecuteExtendedBinaryMathOp( * Arguments are opposite sign; remainder is sum. */ - TclBNInitBignumFromWideInt(&big1, w1); + TclInitBignumFromWideInt(&big1, w1); mp_add(&big2, &big1, &big2); mp_clear(&big1); BIG_RESULT(&big2); @@ -9184,7 +9184,7 @@ ExecuteExtendedUnaryMathOp( if (w != LLONG_MIN) { WIDE_RESULT(-w); } - TclBNInitBignumFromLong(&big, *(const long *) ptr); + TclInitBignumFromLong(&big, *(const long *) ptr); break; #ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: @@ -9192,7 +9192,7 @@ ExecuteExtendedUnaryMathOp( if (w != LLONG_MIN) { WIDE_RESULT(-w); } - TclBNInitBignumFromWideInt(&big, w); + TclInitBignumFromWideInt(&big, w); break; #endif default: diff --git a/generic/tclInt.h b/generic/tclInt.h index 118af85..9a657de 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2757,6 +2757,10 @@ MODULE_SCOPE long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS]; MODULE_SCOPE char tclEmptyString; +MODULE_SCOPE void TclInitBignumFromLong(mp_int *, long); +MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt); +MODULE_SCOPE void TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt); + /* *---------------------------------------------------------------- * Procedures shared among Tcl modules but not used by the outside world, diff --git a/generic/tclObj.c b/generic/tclObj.c index f4b81f2..1a00011 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3038,7 +3038,7 @@ Tcl_SetWideIntObj( #else mp_int big; - TclBNInitBignumFromWideInt(&big, wideValue); + TclInitBignumFromWideInt(&big, wideValue); Tcl_SetBignumObj(objPtr, &big); #endif } @@ -3402,12 +3402,12 @@ GetBignumFromObj( return TCL_OK; } if (objPtr->typePtr == &tclIntType) { - TclBNInitBignumFromLong(bignumValue, objPtr->internalRep.longValue); + TclInitBignumFromLong(bignumValue, objPtr->internalRep.longValue); return TCL_OK; } #ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { - TclBNInitBignumFromWideInt(bignumValue, + TclInitBignumFromWideInt(bignumValue, objPtr->internalRep.wideValue); return TCL_OK; } diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 539a92c..630e498 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -711,7 +711,7 @@ TclParseNumber( || (octalSignificandWide > (~(Tcl_WideUInt)0 >> shift)))) { octalSignificandOverflow = 1; - TclBNInitBignumFromWideUInt(&octalSignificandBig, + TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); } } @@ -828,7 +828,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (~(Tcl_WideUInt)0 >> shift))) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, + TclInitBignumFromWideUInt(&significandBig, significandWide); } } @@ -869,7 +869,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (~(Tcl_WideUInt)0 >> shift))) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, + TclInitBignumFromWideUInt(&significandBig, significandWide); } } @@ -1214,7 +1214,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (MOST_BITS + signum) >> shift)) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, significandWide); + TclInitBignumFromWideUInt(&significandBig, significandWide); } if (shift) { if (!significandOverflow) { @@ -1235,7 +1235,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (MOST_BITS + signum) >> shift)) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, significandWide); + TclInitBignumFromWideUInt(&significandBig, significandWide); } if (shift) { if (!significandOverflow) { @@ -1256,7 +1256,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || octalSignificandWide > (MOST_BITS + signum) >> shift)) { octalSignificandOverflow = 1; - TclBNInitBignumFromWideUInt(&octalSignificandBig, + TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); } if (shift) { @@ -1283,7 +1283,7 @@ TclParseNumber( break; } #endif - TclBNInitBignumFromWideUInt(&octalSignificandBig, + TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); octalSignificandOverflow = 1; } else { @@ -1311,7 +1311,7 @@ TclParseNumber( &significandWide, &significandBig, significandOverflow); if (!significandOverflow && (significandWide > MOST_BITS+signum)){ significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, significandWide); + TclInitBignumFromWideUInt(&significandBig, significandWide); } returnInteger: if (!significandOverflow) { @@ -1330,7 +1330,7 @@ TclParseNumber( break; } #endif - TclBNInitBignumFromWideUInt(&significandBig, + TclInitBignumFromWideUInt(&significandBig, significandWide); significandOverflow = 1; } else { @@ -1485,7 +1485,7 @@ AccumulateDecimalDigit( * bignum and fall through into the bignum case. */ - TclBNInitBignumFromWideUInt(bignumRepPtr, w); + TclInitBignumFromWideUInt(bignumRepPtr, w); } else { /* * Wide multiplication. @@ -1628,7 +1628,7 @@ MakeLowPrecisionDouble( * call MakeHighPrecisionDouble to do it the hard way. */ - TclBNInitBignumFromWideUInt(&significandBig, significand); + TclInitBignumFromWideUInt(&significandBig, significand); retval = MakeHighPrecisionDouble(0, &significandBig, numSigDigs, exponent); mp_clear(&significandBig); @@ -3315,7 +3315,7 @@ ShorteningBignumConversionPowD( * mminus = 5**m5 */ - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); mp_init_set_int(&mminus, 1); MulPow5(&b, b5, &b); mp_mul_2d(&b, b2, &b); @@ -3502,7 +3502,7 @@ StrictBignumConversionPowD( * b = bw * 2**b2 * 5**b5 */ - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); MulPow5(&b, b5, &b); mp_mul_2d(&b, b2, &b); @@ -3710,7 +3710,7 @@ ShorteningBignumConversion( * S = 2**s2 * 5*s5 */ - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); mp_mul_2d(&b, b2, &b); mp_init_set_int(&S, 1); MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S); @@ -3923,7 +3923,7 @@ StrictBignumConversion( */ mp_init_multi(&temp, &dig, NULL); - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); mp_mul_2d(&b, b2, &b); mp_init_set_int(&S, 1); MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S); @@ -4579,7 +4579,7 @@ Tcl_InitBignumFromDouble( Tcl_WideInt w = (Tcl_WideInt) ldexp(fract, mantBits); int shift = expt - mantBits; - TclBNInitBignumFromWideInt(b, w); + TclInitBignumFromWideInt(b, w); if (shift < 0) { mp_div_2d(b, -shift, b, NULL); } else if (shift > 0) { diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a2f1ed3..2845441 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -69,6 +69,9 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclWinGetSockOpt 0 # define TclWinSetSockOpt 0 # define TclWinNToHS 0 +# define TclBNInitBignumFromWideUInt 0 +# define TclBNInitBignumFromWideInt 0 +# define TclBNInitBignumFromLong 0 #else #define TclSetStartupScriptPath setStartupScriptPath static void TclSetStartupScriptPath(Tcl_Obj *path) @@ -103,6 +106,9 @@ static unsigned short TclWinNToHS(unsigned short ns) { return ntohs(ns); } #endif +# define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt +# define TclBNInitBignumFromWideInt TclInitBignumFromWideInt +# define TclBNInitBignumFromLong TclInitBignumFromLong #endif /* TCL_NO_DEPRECATED */ #ifdef _WIN32 diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 5d1c8e8..d628cfe 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -223,13 +223,13 @@ declare 63 { # Formerly internal API to allow initialisation of bignums without knowing the # typedefs of how a bignum works internally. -declare 64 { +declare 64 {deprecated {Use mp_init() + mp_set_long_long()}} { void TclBNInitBignumFromLong(mp_int *bignum, long initVal) } -declare 65 { +declare 65 {deprecated {Use mp_init() + mp_set_long_long()}} { void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal) } -declare 66 { +declare 66 {deprecated {Use mp_init() + mp_set_long_long()}} { void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal) } @@ -244,6 +244,12 @@ declare 68 { declare 69 { Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a) } +declare 70 { + int TclBN_mp_set_long(mp_int *a, unsigned long i) +} +declare 71 { + unsigned long TclBN_mp_get_long(const mp_int *a) +} # Local Variables: # mode: tcl diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 9d683dc..03f383f 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -75,6 +75,7 @@ #define mp_expt_d TclBN_mp_expt_d #define mp_expt_d_ex TclBN_mp_expt_d_ex #define mp_get_int TclBN_mp_get_int +#define mp_get_long TclBN_mp_get_long #define mp_get_long_long TclBN_mp_get_long_long #define mp_grow TclBN_mp_grow #define mp_init TclBN_mp_init @@ -100,6 +101,7 @@ #define mp_s_rmap TclBNMpSRmap #define mp_set TclBN_mp_set #define mp_set_int TclBN_mp_set_int +#define mp_set_long TclBN_mp_set_long #define mp_set_long_long TclBN_mp_set_long_long #define mp_shrink TclBN_mp_shrink #define mp_sqr TclBN_mp_sqr @@ -298,12 +300,15 @@ EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i); /* 63 */ EXTERN int TclBN_mp_cnt_lsb(const mp_int *a); /* 64 */ -EXTERN void TclBNInitBignumFromLong(mp_int *bignum, long initVal); +TCL_DEPRECATED("Use mp_init() + mp_set_long() or mp_set_long_long()") +void TclBNInitBignumFromLong(mp_int *bignum, long initVal); /* 65 */ -EXTERN void TclBNInitBignumFromWideInt(mp_int *bignum, +TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") +void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal); /* 66 */ -EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, +TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") +void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal); /* 67 */ EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, @@ -381,9 +386,9 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ - void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ - void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ - void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long() or mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c index 48db8c3..78888a7 100644 --- a/generic/tclTomMathInterface.c +++ b/generic/tclTomMathInterface.c @@ -168,7 +168,7 @@ TclBNFree( /* *---------------------------------------------------------------------- * - * TclBNInitBignumFromLong -- + * TclInitBignumFromLong -- * * Allocate and initialize a 'bignum' from a native 'long'. * @@ -181,47 +181,20 @@ TclBNFree( *---------------------------------------------------------------------- */ -extern void -TclBNInitBignumFromLong( +void +TclInitBignumFromLong( mp_int *a, - long initVal) + long v) { - int status; - unsigned long v; - mp_digit *p; - - /* - * Allocate enough memory to hold the largest possible long - */ - - status = mp_init_size(a, - (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT); - if (status != MP_OKAY) { + if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); } - - /* - * Convert arg to sign and magnitude. - */ - - if (initVal < 0) { - a->sign = MP_NEG; - v = -initVal; + if (v < (long)0) { + mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v)); + mp_neg(a, a); } else { - a->sign = MP_ZPOS; - v = initVal; - } - - /* - * Store the magnitude in the bignum. - */ - - p = a->dp; - while (v) { - *p++ = (mp_digit) (v & MP_MASK); - v >>= MP_DIGIT_BIT; + mp_set_long_long(a, (Tcl_WideUInt)v); } - a->used = p - a->dp; } /* @@ -240,16 +213,19 @@ TclBNInitBignumFromLong( *---------------------------------------------------------------------- */ -extern void -TclBNInitBignumFromWideInt( +void +TclInitBignumFromWideInt( mp_int *a, /* Bignum to initialize */ Tcl_WideInt v) /* Initial value */ { + if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { + Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); + } if (v < (Tcl_WideInt)0) { - TclBNInitBignumFromWideUInt(a, (Tcl_WideUInt)(-v)); + mp_set_long_long(a, (Tcl_WideUInt)(-v)); mp_neg(a, a); } else { - TclBNInitBignumFromWideUInt(a, (Tcl_WideUInt)v); + mp_set_long_long(a, (Tcl_WideUInt)v); } } @@ -269,36 +245,15 @@ TclBNInitBignumFromWideInt( *---------------------------------------------------------------------- */ -extern void -TclBNInitBignumFromWideUInt( +void +TclInitBignumFromWideUInt( mp_int *a, /* Bignum to initialize */ Tcl_WideUInt v) /* Initial value */ { - int status; - mp_digit *p; - - /* - * Allocate enough memory to hold the largest possible Tcl_WideUInt. - */ - - status = mp_init_size(a, - (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT); - if (status != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); - } - - a->sign = MP_ZPOS; - - /* - * Store the magnitude in the bignum. - */ - - p = a->dp; - while (v) { - *p++ = (mp_digit) (v & MP_MASK); - v >>= MP_DIGIT_BIT; - } - a->used = p - a->dp; + if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { + Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); + } + mp_set_long_long(a, v); } /* diff --git a/unix/Makefile.in b/unix/Makefile.in index 2f97bf5..c31d128 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -320,7 +320,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_cnt_lsb.o bn_mp_copy.o \ bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o \ bn_mp_div_2d.o bn_mp_div_3.o \ - bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_get_int.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_init.o \ + bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_init.o \ bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \ bn_mp_init_set_int.o bn_mp_init_size.o bn_mp_karatsuba_mul.o \ bn_mp_karatsuba_sqr.o \ @@ -328,7 +328,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.o \ bn_mp_radix_size.o bn_mp_radix_smap.o \ bn_mp_read_radix.o bn_mp_rshd.o bn_mp_set.o bn_mp_set_int.o \ - bn_mp_set_long_long.o bn_mp_shrink.o \ + bn_mp_set_long.o bn_mp_set_long_long.o bn_mp_shrink.o \ bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o \ bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \ bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix_n.o \ @@ -505,6 +505,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_expt_d.c \ $(TOMMATH_DIR)/bn_mp_expt_d_ex.c \ $(TOMMATH_DIR)/bn_mp_get_int.c \ + $(TOMMATH_DIR)/bn_mp_get_long.c \ $(TOMMATH_DIR)/bn_mp_get_long_long.c \ $(TOMMATH_DIR)/bn_mp_grow.c \ $(TOMMATH_DIR)/bn_mp_init.c \ @@ -530,6 +531,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_rshd.c \ $(TOMMATH_DIR)/bn_mp_set.c \ $(TOMMATH_DIR)/bn_mp_set_int.c \ + $(TOMMATH_DIR)/bn_mp_set_long.c \ $(TOMMATH_DIR)/bn_mp_set_long_long.c \ $(TOMMATH_DIR)/bn_mp_shrink.c \ $(TOMMATH_DIR)/bn_mp_sqr.c \ @@ -1432,6 +1434,9 @@ bn_mp_expt_d_ex.o: $(TOMMATH_DIR)/bn_mp_expt_d_ex.c $(MATHHDRS) bn_mp_get_int.o: $(TOMMATH_DIR)/bn_mp_get_int.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_int.c +bn_mp_get_long.o: $(TOMMATH_DIR)/bn_mp_get_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_long.c + bn_mp_get_long_long.o: $(TOMMATH_DIR)/bn_mp_get_long_long.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_long_long.c @@ -1507,6 +1512,9 @@ bn_mp_set.o: $(TOMMATH_DIR)/bn_mp_set.c $(MATHHDRS) bn_mp_set_int.o: $(TOMMATH_DIR)/bn_mp_set_int.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_int.c +bn_mp_set_long.o: $(TOMMATH_DIR)/bn_mp_set_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_long.c + bn_mp_set_long_long.o: $(TOMMATH_DIR)/bn_mp_set_long_long.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_long_long.c diff --git a/win/Makefile.in b/win/Makefile.in index 4a0f839..a3275ba 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -330,6 +330,7 @@ TOMMATH_OBJS = \ bn_mp_expt_d.${OBJEXT} \ bn_mp_expt_d_ex.${OBJEXT} \ bn_mp_get_int.${OBJEXT} \ + bn_mp_get_long.${OBJEXT} \ bn_mp_get_long_long.${OBJEXT} \ bn_mp_grow.${OBJEXT} \ bn_mp_init.${OBJEXT} \ @@ -355,6 +356,7 @@ TOMMATH_OBJS = \ bn_mp_rshd.${OBJEXT} \ bn_mp_set.${OBJEXT} \ bn_mp_set_int.${OBJEXT} \ + bn_mp_set_long.${OBJEXT} \ bn_mp_set_long_long.${OBJEXT} \ bn_mp_shrink.${OBJEXT} \ bn_mp_sqr.${OBJEXT} \ diff --git a/win/makefile.vc b/win/makefile.vc index ca8cc08..2bff871 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -385,6 +385,7 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_expt_d.obj \ $(TMP_DIR)\bn_mp_expt_d_ex.obj \ $(TMP_DIR)\bn_mp_get_int.obj \ + $(TMP_DIR)\bn_mp_get_long.obj \ $(TMP_DIR)\bn_mp_get_long_long.obj \ $(TMP_DIR)\bn_mp_grow.obj \ $(TMP_DIR)\bn_mp_init.obj \ @@ -410,6 +411,7 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_rshd.obj \ $(TMP_DIR)\bn_mp_set.obj \ $(TMP_DIR)\bn_mp_set_int.obj \ + $(TMP_DIR)\bn_mp_set_long.obj \ $(TMP_DIR)\bn_mp_set_long_long.obj \ $(TMP_DIR)\bn_mp_shrink.obj \ $(TMP_DIR)\bn_mp_sqr.obj \ -- cgit v0.12 From 99d940211cdbe88b0459c4f15b9e6eb005b92a5a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 14 Sep 2017 08:05:32 +0000 Subject: Remove some unnecessary #if 0 sections. Fix comments and panic messages. No functional changes. --- generic/tclHash.c | 13 ------- generic/tclTomMath.h | 2 +- generic/tclTomMathInterface.c | 81 ++----------------------------------------- 3 files changed, 4 insertions(+), 92 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index 78ad514..3c820c0 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -46,19 +46,6 @@ static int CompareArrayKeys(void *keyPtr, Tcl_HashEntry *hPtr); static TCL_HASH_TYPE HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr); /* - * Prototypes for the one word hash key methods. Not actually declared because - * this is a critical path that is implemented in the core hash table access - * function. - */ - -#if 0 -static Tcl_HashEntry * AllocOneWordEntry(Tcl_HashTable *tablePtr, - void *keyPtr); -static int CompareOneWordKeys(void *keyPtr, Tcl_HashEntry *hPtr); -static unsigned int HashOneWordKey(Tcl_HashTable *tablePtr, void *keyPtr); -#endif - -/* * Prototypes for the string hash key methods. */ diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 2ce8194..f110490 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -27,7 +27,7 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(NEVER) +#if defined(NEVER) /* 128-bit ints fail in too many places */ #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c index 78888a7..9e7bf4b 100644 --- a/generic/tclTomMathInterface.c +++ b/generic/tclTomMathInterface.c @@ -89,81 +89,6 @@ TclBN_revision(void) { return TCLTOMMATH_REVISION; } -#if 0 - -/* - *---------------------------------------------------------------------- - * - * TclBNAlloc -- - * - * Allocate memory for libtommath. - * - * Results: - * Returns a pointer to the allocated block. - * - * This procedure is a wrapper around Tcl_Alloc, needed because of a - * mismatched type signature between Tcl_Alloc and malloc. - * - *---------------------------------------------------------------------- - */ - -extern void * -TclBNAlloc( - size_t x) -{ - return (void *) ckalloc((unsigned int) x); -} - -/* - *---------------------------------------------------------------------- - * - * TclBNRealloc -- - * - * Change the size of an allocated block of memory in libtommath - * - * Results: - * Returns a pointer to the allocated block. - * - * This procedure is a wrapper around Tcl_Realloc, needed because of a - * mismatched type signature between Tcl_Realloc and realloc. - * - *---------------------------------------------------------------------- - */ - -void * -TclBNRealloc( - void *p, - size_t s) -{ - return (void *) ckrealloc((char *) p, (unsigned int) s); -} - -/* - *---------------------------------------------------------------------- - * - * TclBNFree -- - * - * Free allocated memory in libtommath. - * - * Results: - * None. - * - * Side effects: - * Memory is freed. - * - * This function is simply a wrapper around Tcl_Free, needed in libtommath - * because of a type mismatch between free and Tcl_Free. - * - *---------------------------------------------------------------------- - */ - -extern void -TclBNFree( - void *p) -{ - ckree((char *) p); -} -#endif /* *---------------------------------------------------------------------- @@ -187,7 +112,7 @@ TclInitBignumFromLong( long v) { if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); + Tcl_Panic("initialization failure in TclInitBignumFromLong"); } if (v < (long)0) { mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v)); @@ -219,7 +144,7 @@ TclInitBignumFromWideInt( Tcl_WideInt v) /* Initial value */ { if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); + Tcl_Panic("initialization failure in TclInitBignumFromWideInt"); } if (v < (Tcl_WideInt)0) { mp_set_long_long(a, (Tcl_WideUInt)(-v)); @@ -251,7 +176,7 @@ TclInitBignumFromWideUInt( Tcl_WideUInt v) /* Initial value */ { if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); + Tcl_Panic("initialization failure in TclInitBignumFromWideUInt"); } mp_set_long_long(a, v); } -- cgit v0.12 From bf01a303da2833ef352dae626b2a8d4929aaca37 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 14 Sep 2017 14:02:12 +0000 Subject: Move new declarations to more conventional place for tidier merging. --- generic/tclInt.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 9a657de..0b5ff0c 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2757,10 +2757,6 @@ MODULE_SCOPE long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS]; MODULE_SCOPE char tclEmptyString; -MODULE_SCOPE void TclInitBignumFromLong(mp_int *, long); -MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt); -MODULE_SCOPE void TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt); - /* *---------------------------------------------------------------- * Procedures shared among Tcl modules but not used by the outside world, @@ -3011,6 +3007,9 @@ MODULE_SCOPE int TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp, MODULE_SCOPE int TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TclInitAlloc(void); +MODULE_SCOPE void TclInitBignumFromLong(mp_int *, long); +MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt); +MODULE_SCOPE void TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt); MODULE_SCOPE void TclInitDbCkalloc(void); MODULE_SCOPE void TclInitDoubleConversion(void); MODULE_SCOPE void TclInitEmbeddedConfigurationInformation( -- cgit v0.12 From 8f339500a2b79c84698261987f664ed30af94814 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 15 Sep 2017 13:08:31 +0000 Subject: 'const'ify more libtommath functions. All functions in generic/tclTomMath.decls (used by Tcl) are done now. --- generic/tclStubInit.c | 2 ++ generic/tclTomMath.decls | 12 +++++----- generic/tclTomMath.h | 16 +++++++------- generic/tclTomMathDecls.h | 43 +++++++++++++++++++++++------------- libtommath/bn_mp_add_d.c | 9 ++++---- libtommath/bn_mp_fwrite.c | 2 +- libtommath/bn_mp_signed_bin_size.c | 2 +- libtommath/bn_mp_sub_d.c | 9 ++++---- libtommath/bn_mp_to_signed_bin.c | 2 +- libtommath/bn_mp_to_signed_bin_n.c | 2 +- libtommath/bn_mp_to_unsigned_bin.c | 2 +- libtommath/bn_mp_to_unsigned_bin_n.c | 2 +- libtommath/bn_mp_toradix.c | 2 +- libtommath/bn_mp_toradix_n.c | 2 +- libtommath/bn_mp_unsigned_bin_size.c | 2 +- libtommath/tommath.h | 20 ++++++++--------- 16 files changed, 73 insertions(+), 56 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 2845441..ebd2086 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -867,6 +867,8 @@ const TclTomMathStubs tclTomMathStubs = { TclBN_mp_expt_d_ex, /* 67 */ TclBN_mp_set_long_long, /* 68 */ TclBN_mp_get_long_long, /* 69 */ + TclBN_mp_set_long, /* 70 */ + TclBN_mp_get_long, /* 71 */ }; static const TclStubHooks tclStubHooks = { diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index d628cfe..10df919 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -33,7 +33,7 @@ declare 2 { int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 3 { - int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c) + int TclBN_mp_add_d(const mp_int *a, mp_digit b, mp_int *c) } declare 4 { int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c) @@ -153,20 +153,20 @@ declare 42 { int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 43 { - int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c) + int TclBN_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) } declare 44 { - int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b) + int TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b) } declare 45 { - int TclBN_mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, + int TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) } declare 46 { - int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, int maxlen) + int TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) } declare 47 { - int TclBN_mp_unsigned_bin_size(mp_int *a) + int TclBN_mp_unsigned_bin_size(const mp_int *a) } declare 48 { int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index f110490..34ac1bb 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -747,33 +747,33 @@ int mp_unsigned_bin_size(mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); */ /* -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b); */ /* -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); */ /* -int mp_signed_bin_size(mp_int *a); +int mp_signed_bin_size(const mp_int *a); */ /* int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); */ /* -int mp_to_signed_bin(mp_int *a, unsigned char *b); +int mp_to_signed_bin(const mp_int *a, unsigned char *b); */ /* -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); */ /* int mp_read_radix(mp_int *a, const char *str, int radix); */ /* -int mp_toradix(mp_int *a, char *str, int radix); +int mp_toradix(const mp_int *a, char *str, int radix); */ /* -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +int mp_toradix_n(const mp_int * a, char *str, int radix, int maxlen); */ /* int mp_radix_size(const mp_int *a, int radix, int *size); @@ -784,7 +784,7 @@ int mp_radix_size(const mp_int *a, int radix, int *size); int mp_fread(mp_int *a, int radix, FILE *stream); */ /* -int mp_fwrite(mp_int *a, int radix, FILE *stream); +int mp_fwrite(const mp_int *a, int radix, FILE *stream); */ #endif diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 03f383f..f3145d7 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -156,7 +156,8 @@ EXTERN int TclBN_revision(void); EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* 3 */ -EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_add_d(const mp_int *a, mp_digit b, + mp_int *c); /* 4 */ EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c); @@ -249,17 +250,19 @@ EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b); EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* 43 */ -EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_sub_d(const mp_int *a, mp_digit b, + mp_int *c); /* 44 */ -EXTERN int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b); +EXTERN int TclBN_mp_to_unsigned_bin(const mp_int *a, + unsigned char *b); /* 45 */ -EXTERN int TclBN_mp_to_unsigned_bin_n(mp_int *a, +EXTERN int TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen); /* 46 */ -EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, - int maxlen); +EXTERN int TclBN_mp_toradix_n(const mp_int *a, char *str, + int radix, int maxlen); /* 47 */ -EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a); +EXTERN int TclBN_mp_unsigned_bin_size(const mp_int *a); /* 48 */ EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c); @@ -300,7 +303,7 @@ EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i); /* 63 */ EXTERN int TclBN_mp_cnt_lsb(const mp_int *a); /* 64 */ -TCL_DEPRECATED("Use mp_init() + mp_set_long() or mp_set_long_long()") +TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") void TclBNInitBignumFromLong(mp_int *bignum, long initVal); /* 65 */ TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") @@ -317,6 +320,10 @@ EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); /* 69 */ EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a); +/* 70 */ +EXTERN int TclBN_mp_set_long(mp_int *a, unsigned long i); +/* 71 */ +EXTERN unsigned long TclBN_mp_get_long(const mp_int *a); typedef struct TclTomMathStubs { int magic; @@ -325,7 +332,7 @@ typedef struct TclTomMathStubs { int (*tclBN_epoch) (void); /* 0 */ int (*tclBN_revision) (void); /* 1 */ int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */ - int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */ + int (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */ int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */ void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ @@ -365,11 +372,11 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */ int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */ int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */ - int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */ - int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */ - int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ - int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */ - int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */ + int (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */ + int (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */ + int (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ + int (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */ + int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */ int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */ void (*tclBN_mp_zero) (mp_int *a); /* 49 */ void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */ @@ -386,12 +393,14 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ - TCL_DEPRECATED_API("Use mp_init() + mp_set_long() or mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ + int (*tclBN_mp_set_long) (mp_int *a, unsigned long i); /* 70 */ + unsigned long (*tclBN_mp_get_long) (const mp_int *a); /* 71 */ } TclTomMathStubs; extern const TclTomMathStubs *tclTomMathStubsPtr; @@ -546,6 +555,10 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */ #define TclBN_mp_get_long_long \ (tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */ +#define TclBN_mp_set_long \ + (tclTomMathStubsPtr->tclBN_mp_set_long) /* 70 */ +#define TclBN_mp_get_long \ + (tclTomMathStubsPtr->tclBN_mp_get_long) /* 71 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index fd1a186..c2f2e0e 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -17,7 +17,7 @@ /* single digit addition */ int -mp_add_d (mp_int * a, mp_digit b, mp_int * c) +mp_add_d (const mp_int * a, mp_digit b, mp_int * c) { int res, ix, oldused; mp_digit *tmpa, *tmpc, mu; @@ -31,14 +31,15 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) /* if a is negative and |a| >= b, call c = |a| - b */ if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { + mp_int a_ = *a; /* temporarily fix sign of a */ - a->sign = MP_ZPOS; + a_.sign = MP_ZPOS; /* c = |a| - b */ - res = mp_sub_d(a, b, c); + res = mp_sub_d(&a_, b, c); /* fix sign */ - a->sign = c->sign = MP_NEG; + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 23b5f64..e2b5ec2 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -16,7 +16,7 @@ */ #ifndef LTM_NO_FILE -int mp_fwrite(mp_int *a, int radix, FILE *stream) +int mp_fwrite(const mp_int *a, int radix, FILE *stream) { char *buf; int err, len, x; diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 0910333..6b57bed 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an signed equivalent */ -int mp_signed_bin_size (mp_int * a) +int mp_signed_bin_size (const mp_int * a) { return 1 + mp_unsigned_bin_size (a); } diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 5e96030..2d24899 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -17,7 +17,7 @@ /* single digit subtraction */ int -mp_sub_d (mp_int * a, mp_digit b, mp_int * c) +mp_sub_d (const mp_int * a, mp_digit b, mp_int * c) { mp_digit *tmpa, *tmpc, mu; int res, ix, oldused; @@ -33,9 +33,10 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) * addition [with fudged signs] */ if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; + mp_int a_ = *a; + a_.sign = MP_ZPOS; + res = mp_add_d(&a_, b, c); + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index c49c87d..69f6423 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin (mp_int * a, unsigned char *b) +int mp_to_signed_bin (const mp_int * a, unsigned char *b) { int res; diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index dc5ec26..fc0e822 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_signed_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_signed_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index d249359..e8d9c4f 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin (mp_int * a, unsigned char *b) +int mp_to_unsigned_bin (const mp_int * a, unsigned char *b) { int x, res; mp_int t; diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index f671621..9e9eef5 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_unsigned_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 3337765..59676a7 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -16,7 +16,7 @@ */ /* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix (mp_int * a, char *str, int radix) +int mp_toradix (const mp_int * a, char *str, int radix) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index ae24ada..c0079c8 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -19,7 +19,7 @@ * * Stores upto maxlen-1 chars and always a NULL byte */ -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) +int mp_toradix_n(const mp_int * a, char *str, int radix, int maxlen) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index f46d0ba..74655e7 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size (mp_int * a) +int mp_unsigned_bin_size (const mp_int * a) { int size = mp_count_bits (a); return (size / 8) + (((size & 7) != 0) ? 1 : 0); diff --git a/libtommath/tommath.h b/libtommath/tommath.h index b183b8a..527f316 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -337,7 +337,7 @@ int mp_cmp_d(const mp_int *a, mp_digit b); int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); /* c = a - b */ -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); @@ -526,24 +526,24 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback /* ---> radix conversion <--- */ int mp_count_bits(const mp_int *a); -int mp_unsigned_bin_size(mp_int *a); +int mp_unsigned_bin_size(const mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b); +int mp_to_unsigned_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); -int mp_signed_bin_size(mp_int *a); +int mp_signed_bin_size(const mp_int *a); int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_signed_bin(mp_int *a, unsigned char *b); -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin(const mp_int *a, unsigned char *b); +int mp_to_signed_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); int mp_read_radix(mp_int *a, const char *str, int radix); -int mp_toradix(mp_int *a, char *str, int radix); -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +int mp_toradix(const mp_int *a, char *str, int radix); +int mp_toradix_n(const mp_int * a, char *str, int radix, int maxlen); int mp_radix_size(const mp_int *a, int radix, int *size); #ifndef LTM_NO_FILE int mp_fread(mp_int *a, int radix, FILE *stream); -int mp_fwrite(mp_int *a, int radix, FILE *stream); +int mp_fwrite(const mp_int *a, int radix, FILE *stream); #endif #define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) -- cgit v0.12 From d4e73bcab52ca3c76e007a1acc7cb76f50b8feb5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 15 Sep 2017 14:44:00 +0000 Subject: re-format everything through astyle. Taken from libtom/libtommath (pull request [https://github.com/libtom/libtommath/pull/85|85]) --- libtommath/astylerc | 27 + libtommath/bn_error.c | 16 +- libtommath/bn_fast_mp_invmod.c | 223 ++-- libtommath/bn_fast_mp_montgomery_reduce.c | 270 ++--- libtommath/bn_fast_s_mp_mul_digs.c | 80 +- libtommath/bn_fast_s_mp_mul_high_digs.c | 70 +- libtommath/bn_fast_s_mp_sqr.c | 80 +- libtommath/bn_mp_2expt.c | 29 +- libtommath/bn_mp_abs.c | 25 +- libtommath/bn_mp_add.c | 48 +- libtommath/bn_mp_add_d.c | 171 ++- libtommath/bn_mp_addmod.c | 27 +- libtommath/bn_mp_and.c | 55 +- libtommath/bn_mp_clamp.c | 25 +- libtommath/bn_mp_clear.c | 31 +- libtommath/bn_mp_clear_multi.c | 18 +- libtommath/bn_mp_cmp.c | 35 +- libtommath/bn_mp_cmp_d.c | 34 +- libtommath/bn_mp_cmp_mag.c | 54 +- libtommath/bn_mp_cnt_lsb.c | 2 +- libtommath/bn_mp_copy.c | 67 +- libtommath/bn_mp_count_bits.c | 35 +- libtommath/bn_mp_div.c | 453 ++++---- libtommath/bn_mp_div_2.c | 70 +- libtommath/bn_mp_div_2d.c | 100 +- libtommath/bn_mp_div_3.c | 87 +- libtommath/bn_mp_div_d.c | 128 +-- libtommath/bn_mp_dr_is_modulus.c | 6 +- libtommath/bn_mp_dr_reduce.c | 85 +- libtommath/bn_mp_dr_setup.c | 3 +- libtommath/bn_mp_exch.c | 13 +- libtommath/bn_mp_export.c | 121 +- libtommath/bn_mp_expt_d.c | 4 +- libtommath/bn_mp_expt_d_ex.c | 95 +- libtommath/bn_mp_exptmod.c | 114 +- libtommath/bn_mp_exptmod_fast.c | 487 ++++---- libtommath/bn_mp_exteuclid.c | 94 +- libtommath/bn_mp_fread.c | 18 +- libtommath/bn_mp_fwrite.c | 22 +- libtommath/bn_mp_gcd.c | 140 +-- libtommath/bn_mp_get_int.c | 30 +- libtommath/bn_mp_get_long.c | 28 +- libtommath/bn_mp_get_long_long.c | 28 +- libtommath/bn_mp_grow.c | 56 +- libtommath/bn_mp_import.c | 72 +- libtommath/bn_mp_init.c | 32 +- libtommath/bn_mp_init_copy.c | 18 +- libtommath/bn_mp_init_multi.c | 58 +- libtommath/bn_mp_init_set.c | 14 +- libtommath/bn_mp_init_set_int.c | 12 +- libtommath/bn_mp_init_size.c | 36 +- libtommath/bn_mp_invmod.c | 22 +- libtommath/bn_mp_invmod_slow.c | 247 ++-- libtommath/bn_mp_is_square.c | 137 +-- libtommath/bn_mp_jacobi.c | 152 +-- libtommath/bn_mp_karatsuba_mul.c | 263 ++--- libtommath/bn_mp_karatsuba_sqr.c | 190 ++-- libtommath/bn_mp_lcm.c | 66 +- libtommath/bn_mp_lshd.c | 68 +- libtommath/bn_mp_mod.c | 37 +- libtommath/bn_mp_mod_2d.c | 51 +- libtommath/bn_mp_mod_d.c | 5 +- libtommath/bn_mp_montgomery_calc_normalization.c | 46 +- libtommath/bn_mp_montgomery_reduce.c | 179 ++- libtommath/bn_mp_montgomery_setup.c | 45 +- libtommath/bn_mp_mul.c | 62 +- libtommath/bn_mp_mul_2.c | 100 +- libtommath/bn_mp_mul_2d.c | 100 +- libtommath/bn_mp_mul_d.c | 81 +- libtommath/bn_mp_mulmod.c | 26 +- libtommath/bn_mp_n_root.c | 4 +- libtommath/bn_mp_n_root_ex.c | 185 +-- libtommath/bn_mp_neg.c | 26 +- libtommath/bn_mp_or.c | 46 +- libtommath/bn_mp_prime_fermat.c | 63 +- libtommath/bn_mp_prime_is_divisible.c | 36 +- libtommath/bn_mp_prime_is_prime.c | 77 +- libtommath/bn_mp_prime_miller_rabin.c | 125 +- libtommath/bn_mp_prime_next_prime.c | 86 +- libtommath/bn_mp_prime_rabin_miller_trials.c | 26 +- libtommath/bn_mp_prime_random_ex.c | 38 +- libtommath/bn_mp_radix_size.c | 84 +- libtommath/bn_mp_rand.c | 75 +- libtommath/bn_mp_read_radix.c | 110 +- libtommath/bn_mp_read_signed_bin.c | 26 +- libtommath/bn_mp_read_unsigned_bin.c | 46 +- libtommath/bn_mp_reduce.c | 112 +- libtommath/bn_mp_reduce_2k_setup.c | 8 +- libtommath/bn_mp_reduce_2k_setup_l.c | 8 +- libtommath/bn_mp_reduce_is_2k.c | 20 +- libtommath/bn_mp_reduce_is_2k_l.c | 10 +- libtommath/bn_mp_reduce_setup.c | 14 +- libtommath/bn_mp_rshd.c | 76 +- libtommath/bn_mp_set.c | 8 +- libtommath/bn_mp_set_int.c | 38 +- libtommath/bn_mp_shrink.c | 32 +- libtommath/bn_mp_signed_bin_size.c | 4 +- libtommath/bn_mp_sqr.c | 49 +- libtommath/bn_mp_sqrmod.c | 27 +- libtommath/bn_mp_sqrt.c | 90 +- libtommath/bn_mp_sqrtmod_prime.c | 184 +-- libtommath/bn_mp_sub.c | 59 +- libtommath/bn_mp_sub_d.c | 113 +- libtommath/bn_mp_submod.c | 27 +- libtommath/bn_mp_to_signed_bin.c | 14 +- libtommath/bn_mp_to_signed_bin_n.c | 2 +- libtommath/bn_mp_to_unsigned_bin.c | 36 +- libtommath/bn_mp_to_unsigned_bin_n.c | 2 +- libtommath/bn_mp_toom_mul.c | 454 ++++---- libtommath/bn_mp_toom_sqr.c | 399 ++++--- libtommath/bn_mp_toradix.c | 82 +- libtommath/bn_mp_toradix_n.c | 104 +- libtommath/bn_mp_unsigned_bin_size.c | 6 +- libtommath/bn_mp_xor.c | 47 +- libtommath/bn_mp_zero.c | 18 +- libtommath/bn_prime_tab.c | 66 +- libtommath/bn_reverse.c | 25 +- libtommath/bn_s_mp_add.c | 159 ++- libtommath/bn_s_mp_exptmod.c | 412 +++---- libtommath/bn_s_mp_mul_digs.c | 106 +- libtommath/bn_s_mp_mul_high_digs.c | 85 +- libtommath/bn_s_mp_sqr.c | 96 +- libtommath/bn_s_mp_sub.c | 101 +- libtommath/bncore.c | 6 +- libtommath/makefile | 3 + libtommath/tommath.h | 154 +-- libtommath/tommath_class.h | 1315 +++++++++++----------- libtommath/tommath_private.h | 34 +- libtommath/tommath_superclass.h | 102 +- 129 files changed, 5787 insertions(+), 5696 deletions(-) create mode 100644 libtommath/astylerc diff --git a/libtommath/astylerc b/libtommath/astylerc new file mode 100644 index 0000000..5d63f7a --- /dev/null +++ b/libtommath/astylerc @@ -0,0 +1,27 @@ +# Artistic Style, see http://astyle.sourceforge.net/ +# full documentation, see: http://astyle.sourceforge.net/astyle.html +# +# usage: +# astyle --options=astylerc *.[ch] + +## Bracket Style Options +style=kr + +## Tab Options +indent=spaces=3 + +## Bracket Modify Options + +## Indentation Options +min-conditional-indent=0 + +## Padding Options +pad-header +unpad-paren +align-pointer=name + +## Formatting Options +break-after-logical +max-code-length=120 +convert-tabs +mode=c diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 0d77411..a51d712 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -16,12 +16,12 @@ */ static const struct { - int code; - const char *msg; + int code; + const char *msg; } msgs[] = { - { MP_OKAY, "Successful" }, - { MP_MEM, "Out of heap" }, - { MP_VAL, "Value out of range" } + { MP_OKAY, "Successful" }, + { MP_MEM, "Out of heap" }, + { MP_VAL, "Value out of range" } }; /* return a char * string for a given code */ @@ -31,9 +31,9 @@ const char *mp_error_to_string(int code) /* scan the lookup table for the given message */ for (x = 0; x < (int)(sizeof(msgs) / sizeof(msgs[0])); x++) { - if (msgs[x].code == code) { - return msgs[x].msg; - } + if (msgs[x].code == code) { + return msgs[x].msg; + } } /* generic reply for invalid code */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index 12f42de..7771136 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -15,131 +15,132 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* computes the modular inverse via binary extended euclidean algorithm, - * that is c = 1/a mod b +/* computes the modular inverse via binary extended euclidean algorithm, + * that is c = 1/a mod b * - * Based on slow invmod except this is optimized for the case where b is + * Based on slow invmod except this is optimized for the case where b is * odd as per HAC Note 14.64 on pp. 610 */ -int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c) +int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c) { - mp_int x, y, u, v, B, D; - int res, neg; - - /* 2. [modified] b must be odd */ - if (mp_iseven (b) == MP_YES) { - return MP_VAL; - } - - /* init all our temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x == modulus, y == value to invert */ - if ((res = mp_copy (b, &x)) != MP_OKAY) { - goto LBL_ERR; - } - - /* we need y = |a| */ - if ((res = mp_mod (a, b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&D, 1); + mp_int x, y, u, v, B, D; + int res, neg; -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == MP_YES) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { - goto LBL_ERR; - } - /* 4.2 if B is odd then */ - if (mp_isodd (&B) == MP_YES) { - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* B = B/2 */ - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } + /* 2. [modified] b must be odd */ + if (mp_iseven(b) == MP_YES) { + return MP_VAL; + } - /* 5. while v is even do */ - while (mp_iseven (&v) == MP_YES) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if D is odd then */ - if (mp_isodd (&D) == MP_YES) { - /* D = (D-x)/2 */ - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* D = D/2 */ - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { + /* init all our temps */ + if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) { + return res; + } + + /* x == modulus, y == value to invert */ + if ((res = mp_copy(b, &x)) != MP_OKAY) { goto LBL_ERR; - } - } + } - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { + /* we need y = |a| */ + if ((res = mp_mod(a, b, &y)) != MP_OKAY) { goto LBL_ERR; - } + } - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { + /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ + if ((res = mp_copy(&x, &u)) != MP_OKAY) { goto LBL_ERR; - } - } else { - /* v - v - u, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { + } + if ((res = mp_copy(&y, &v)) != MP_OKAY) { goto LBL_ERR; - } + } + mp_set(&D, 1); - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* if not zero goto step 4 */ - if (mp_iszero (&u) == MP_NO) { - goto top; - } - - /* now a = C, b = D, gcd == g*v */ - - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } - - /* b is now the inverse */ - neg = a->sign; - while (D.sign == MP_NEG) { - if ((res = mp_add (&D, b, &D)) != MP_OKAY) { +top: + /* 4. while u is even do */ + while (mp_iseven(&u) == MP_YES) { + /* 4.1 u = u/2 */ + if ((res = mp_div_2(&u, &u)) != MP_OKAY) { + goto LBL_ERR; + } + /* 4.2 if B is odd then */ + if (mp_isodd(&B) == MP_YES) { + if ((res = mp_sub(&B, &x, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* B = B/2 */ + if ((res = mp_div_2(&B, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } + + /* 5. while v is even do */ + while (mp_iseven(&v) == MP_YES) { + /* 5.1 v = v/2 */ + if ((res = mp_div_2(&v, &v)) != MP_OKAY) { + goto LBL_ERR; + } + /* 5.2 if D is odd then */ + if (mp_isodd(&D) == MP_YES) { + /* D = (D-x)/2 */ + if ((res = mp_sub(&D, &x, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* D = D/2 */ + if ((res = mp_div_2(&D, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + + /* 6. if u >= v then */ + if (mp_cmp(&u, &v) != MP_LT) { + /* u = u - v, B = B - D */ + if ((res = mp_sub(&u, &v, &u)) != MP_OKAY) { + goto LBL_ERR; + } + + if ((res = mp_sub(&B, &D, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } else { + /* v - v - u, D = D - B */ + if ((res = mp_sub(&v, &u, &v)) != MP_OKAY) { + goto LBL_ERR; + } + + if ((res = mp_sub(&D, &B, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + + /* if not zero goto step 4 */ + if (mp_iszero(&u) == MP_NO) { + goto top; + } + + /* now a = C, b = D, gcd == g*v */ + + /* if v != 1 then there is no inverse */ + if (mp_cmp_d(&v, 1) != MP_EQ) { + res = MP_VAL; goto LBL_ERR; - } - } - mp_exch (&D, c); - c->sign = neg; - res = MP_OKAY; - -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); - return res; + } + + /* b is now the inverse */ + neg = a->sign; + while (D.sign == MP_NEG) { + if ((res = mp_add(&D, b, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + mp_exch(&D, c); + c->sign = neg; + res = MP_OKAY; + +LBL_ERR: + mp_clear_multi(&x, &y, &u, &v, &B, &D, NULL); + return res; } #endif diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index 16d5ff7..f2c38bf 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -23,147 +23,147 @@ * * Based on Algorithm 14.32 on pp.601 of HAC. */ -int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) +int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) { - int ix, res, olduse; - mp_word W[MP_WARRAY]; - - /* get old used count */ - olduse = x->used; - - /* grow a as required */ - if (x->alloc < (n->used + 1)) { - if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { - return res; - } - } - - /* first we have to get the digits of the input into - * an array of double precision words W[...] - */ - { - mp_word *_W; - mp_digit *tmpx; - - /* alias for the W[] array */ - _W = W; - - /* alias for the digits of x*/ - tmpx = x->dp; - - /* copy the digits of a into W[0..a->used-1] */ - for (ix = 0; ix < x->used; ix++) { - *_W++ = *tmpx++; - } - - /* zero the high words of W[a->used..m->used*2] */ - for (; ix < ((n->used * 2) + 1); ix++) { - *_W++ = 0; - } - } - - /* now we proceed to zero successive digits - * from the least significant upwards - */ - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * m' mod b - * - * We avoid a double precision multiplication (which isn't required) - * by casting the value down to a mp_digit. Note this requires - * that W[ix-1] have the carry cleared (see after the inner loop) - */ - mp_digit mu; - mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); - - /* a = a + mu * m * b**i - * - * This is computed in place and on the fly. The multiplication - * by b**i is handled by offseting which columns the results - * are added to. - * - * Note the comba method normally doesn't handle carries in the - * inner loop In this case we fix the carry from the previous - * column since the Montgomery reduction requires digits of the - * result (so far) [see above] to work. This is - * handled by fixing up one carry after the inner loop. The - * carry fixups are done in order so after these loops the - * first m->used words of W[] have the carries fixed - */ - { - int iy; - mp_digit *tmpn; + int ix, res, olduse; + mp_word W[MP_WARRAY]; + + /* get old used count */ + olduse = x->used; + + /* grow a as required */ + if (x->alloc < (n->used + 1)) { + if ((res = mp_grow(x, n->used + 1)) != MP_OKAY) { + return res; + } + } + + /* first we have to get the digits of the input into + * an array of double precision words W[...] + */ + { mp_word *_W; + mp_digit *tmpx; + + /* alias for the W[] array */ + _W = W; - /* alias for the digits of the modulus */ - tmpn = n->dp; + /* alias for the digits of x*/ + tmpx = x->dp; - /* Alias for the columns set by an offset of ix */ - _W = W + ix; + /* copy the digits of a into W[0..a->used-1] */ + for (ix = 0; ix < x->used; ix++) { + *_W++ = *tmpx++; + } - /* inner loop */ - for (iy = 0; iy < n->used; iy++) { - *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); + /* zero the high words of W[a->used..m->used*2] */ + for (; ix < ((n->used * 2) + 1); ix++) { + *_W++ = 0; } - } - - /* now fix carry for next digit, W[ix+1] */ - W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); - } - - /* now we have to propagate the carries and - * shift the words downward [all those least - * significant digits we zeroed]. - */ - { - mp_digit *tmpx; - mp_word *_W, *_W1; - - /* nox fix rest of carries */ - - /* alias for current word */ - _W1 = W + ix; - - /* alias for next word, where the carry goes */ - _W = W + ++ix; - - for (; ix <= ((n->used * 2) + 1); ix++) { - *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); - } - - /* copy out, A = A/b**n - * - * The result is A/b**n but instead of converting from an - * array of mp_word to mp_digit than calling mp_rshd - * we just copy them in the right order - */ - - /* alias for destination word */ - tmpx = x->dp; - - /* alias for shifted double precision result */ - _W = W + n->used; - - for (ix = 0; ix < (n->used + 1); ix++) { - *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); - } - - /* zero oldused digits, if the input a was larger than - * m->used+1 we'll have to clear the digits - */ - for (; ix < olduse; ix++) { - *tmpx++ = 0; - } - } - - /* set the max used and clamp */ - x->used = n->used + 1; - mp_clamp (x); - - /* if A >= m then A = A - m */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - return MP_OKAY; + } + + /* now we proceed to zero successive digits + * from the least significant upwards + */ + for (ix = 0; ix < n->used; ix++) { + /* mu = ai * m' mod b + * + * We avoid a double precision multiplication (which isn't required) + * by casting the value down to a mp_digit. Note this requires + * that W[ix-1] have the carry cleared (see after the inner loop) + */ + mp_digit mu; + mu = (mp_digit)(((W[ix] & MP_MASK) * rho) & MP_MASK); + + /* a = a + mu * m * b**i + * + * This is computed in place and on the fly. The multiplication + * by b**i is handled by offseting which columns the results + * are added to. + * + * Note the comba method normally doesn't handle carries in the + * inner loop In this case we fix the carry from the previous + * column since the Montgomery reduction requires digits of the + * result (so far) [see above] to work. This is + * handled by fixing up one carry after the inner loop. The + * carry fixups are done in order so after these loops the + * first m->used words of W[] have the carries fixed + */ + { + int iy; + mp_digit *tmpn; + mp_word *_W; + + /* alias for the digits of the modulus */ + tmpn = n->dp; + + /* Alias for the columns set by an offset of ix */ + _W = W + ix; + + /* inner loop */ + for (iy = 0; iy < n->used; iy++) { + *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); + } + } + + /* now fix carry for next digit, W[ix+1] */ + W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); + } + + /* now we have to propagate the carries and + * shift the words downward [all those least + * significant digits we zeroed]. + */ + { + mp_digit *tmpx; + mp_word *_W, *_W1; + + /* nox fix rest of carries */ + + /* alias for current word */ + _W1 = W + ix; + + /* alias for next word, where the carry goes */ + _W = W + ++ix; + + for (; ix <= ((n->used * 2) + 1); ix++) { + *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); + } + + /* copy out, A = A/b**n + * + * The result is A/b**n but instead of converting from an + * array of mp_word to mp_digit than calling mp_rshd + * we just copy them in the right order + */ + + /* alias for destination word */ + tmpx = x->dp; + + /* alias for shifted double precision result */ + _W = W + n->used; + + for (ix = 0; ix < (n->used + 1); ix++) { + *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); + } + + /* zero oldused digits, if the input a was larger than + * m->used+1 we'll have to clear the digits + */ + for (; ix < olduse; ix++) { + *tmpx++ = 0; + } + } + + /* set the max used and clamp */ + x->used = n->used + 1; + mp_clamp(x); + + /* if A >= m then A = A - m */ + if (mp_cmp_mag(x, n) != MP_LT) { + return s_mp_sub(x, n, x); + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index a1015af..763dbb1 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -17,39 +17,39 @@ /* Fast (comba) multiplier * - * This is the fast column-array [comba] multiplier. It is - * designed to compute the columns of the product first - * then handle the carries afterwards. This has the effect + * This is the fast column-array [comba] multiplier. It is + * designed to compute the columns of the product first + * then handle the carries afterwards. This has the effect * of making the nested loops that compute the columns very * simple and schedulable on super-scalar processors. * - * This has been modified to produce a variable number of - * digits of output so if say only a half-product is required - * you don't have to compute the upper half (a feature + * This has been modified to produce a variable number of + * digits of output so if say only a half-product is required + * you don't have to compute the upper half (a feature * required for fast Barrett reduction). * * Based on Algorithm 14.12 on pp.595 of HAC. * */ -int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - mp_word _W; + int olduse, res, pa, ix, iz; + mp_digit W[MP_WARRAY]; + mp_word _W; - /* grow the destination as required */ - if (c->alloc < digs) { - if ((res = mp_grow (c, digs)) != MP_OKAY) { - return res; - } - } + /* grow the destination as required */ + if (c->alloc < digs) { + if ((res = mp_grow(c, digs)) != MP_OKAY) { + return res; + } + } - /* number of output digits to produce */ - pa = MIN(digs, a->used + b->used); + /* number of output digits to produce */ + pa = MIN(digs, a->used + b->used); - /* clear the carry */ - _W = 0; - for (ix = 0; ix < pa; ix++) { + /* clear the carry */ + _W = 0; + for (ix = 0; ix < pa; ix++) { int tx, ty; int iy; mp_digit *tmpx, *tmpy; @@ -62,7 +62,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) tmpx = a->dp + tx; tmpy = b->dp + ty; - /* this is the number of times the loop will iterrate, essentially + /* this is the number of times the loop will iterrate, essentially while (tx++ < a->used && ty-- >= 0) { ... } */ iy = MIN(a->used-tx, ty+1); @@ -78,27 +78,27 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) /* make next carry */ _W = _W >> ((mp_word)DIGIT_BIT); - } + } - /* setup dest */ - olduse = c->used; - c->used = pa; + /* setup dest */ + olduse = c->used; + c->used = pa; - { - mp_digit *tmpc; - tmpc = c->dp; - for (ix = 0; ix < (pa + 1); ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } + { + mp_digit *tmpc; + tmpc = c->dp; + for (ix = 0; ix < (pa + 1); ix++) { + /* now extract the previous digit [below the carry] */ + *tmpc++ = W[ix]; + } - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; + /* clear unused digits [that existed in the old copy of c] */ + for (; ix < olduse; ix++) { + *tmpc++ = 0; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 08f0355..588d80b 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -24,24 +24,24 @@ * * Based on Algorithm 14.12 on pp.595 of HAC. */ -int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - mp_word _W; + int olduse, res, pa, ix, iz; + mp_digit W[MP_WARRAY]; + mp_word _W; - /* grow the destination as required */ - pa = a->used + b->used; - if (c->alloc < pa) { - if ((res = mp_grow (c, pa)) != MP_OKAY) { - return res; - } - } + /* grow the destination as required */ + pa = a->used + b->used; + if (c->alloc < pa) { + if ((res = mp_grow(c, pa)) != MP_OKAY) { + return res; + } + } - /* number of output digits to produce */ - pa = a->used + b->used; - _W = 0; - for (ix = digs; ix < pa; ix++) { + /* number of output digits to produce */ + pa = a->used + b->used; + _W = 0; + for (ix = digs; ix < pa; ix++) { int tx, ty, iy; mp_digit *tmpx, *tmpy; @@ -53,7 +53,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) tmpx = a->dp + tx; tmpy = b->dp + ty; - /* this is the number of times the loop will iterrate, essentially its + /* this is the number of times the loop will iterrate, essentially its while (tx++ < a->used && ty-- >= 0) { ... } */ iy = MIN(a->used-tx, ty+1); @@ -68,28 +68,28 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) /* make next carry */ _W = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = c->used; - c->used = pa; + } + + /* setup dest */ + olduse = c->used; + c->used = pa; - { - mp_digit *tmpc; + { + mp_digit *tmpc; - tmpc = c->dp + digs; - for (ix = digs; ix < pa; ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } + tmpc = c->dp + digs; + for (ix = digs; ix < pa; ix++) { + /* now extract the previous digit [below the carry] */ + *tmpc++ = W[ix]; + } - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; + /* clear unused digits [that existed in the old copy of c] */ + for (; ix < olduse; ix++) { + *tmpc++ = 0; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index f435af9..ceed82b 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -16,32 +16,32 @@ */ /* the jist of squaring... - * you do like mult except the offset of the tmpx [one that - * starts closer to zero] can't equal the offset of tmpy. + * you do like mult except the offset of the tmpx [one that + * starts closer to zero] can't equal the offset of tmpy. * So basically you set up iy like before then you min it with - * (ty-tx) so that it never happens. You double all those + * (ty-tx) so that it never happens. You double all those * you add in the inner loop After that loop you do the squares and add them in. */ -int fast_s_mp_sqr (mp_int * a, mp_int * b) +int fast_s_mp_sqr(mp_int *a, mp_int *b) { - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY], *tmpx; - mp_word W1; - - /* grow the destination as required */ - pa = a->used + a->used; - if (b->alloc < pa) { - if ((res = mp_grow (b, pa)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - W1 = 0; - for (ix = 0; ix < pa; ix++) { + int olduse, res, pa, ix, iz; + mp_digit W[MP_WARRAY], *tmpx; + mp_word W1; + + /* grow the destination as required */ + pa = a->used + a->used; + if (b->alloc < pa) { + if ((res = mp_grow(b, pa)) != MP_OKAY) { + return res; + } + } + + /* number of output digits to produce */ + W1 = 0; + for (ix = 0; ix < pa; ix++) { int tx, ty, iy; mp_word _W; mp_digit *tmpy; @@ -62,7 +62,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) */ iy = MIN(a->used-tx, ty+1); - /* now for squaring tx can never equal ty + /* now for squaring tx can never equal ty * we halve the distance since they approach at a rate of 2x * and we have to round because odd cases need to be executed */ @@ -86,26 +86,26 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) /* make next carry */ W1 = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = b->used; - b->used = a->used+a->used; - - { - mp_digit *tmpb; - tmpb = b->dp; - for (ix = 0; ix < pa; ix++) { - *tmpb++ = W[ix] & MP_MASK; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpb++ = 0; - } - } - mp_clamp (b); - return MP_OKAY; + } + + /* setup dest */ + olduse = b->used; + b->used = a->used+a->used; + + { + mp_digit *tmpb; + tmpb = b->dp; + for (ix = 0; ix < pa; ix++) { + *tmpb++ = W[ix] & MP_MASK; + } + + /* clear unused digits [that existed in the old copy of c] */ + for (; ix < olduse; ix++) { + *tmpb++ = 0; + } + } + mp_clamp(b); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index 989bb9f..701144c 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -15,31 +15,30 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* computes a = 2**b +/* computes a = 2**b * * Simple algorithm which zeroes the int, grows it then just sets one bit * as required. */ -int -mp_2expt (mp_int * a, int b) +int mp_2expt(mp_int *a, int b) { - int res; + int res; - /* zero a as per default */ - mp_zero (a); + /* zero a as per default */ + mp_zero(a); - /* grow a to accomodate the single bit */ - if ((res = mp_grow (a, (b / DIGIT_BIT) + 1)) != MP_OKAY) { - return res; - } + /* grow a to accomodate the single bit */ + if ((res = mp_grow(a, (b / DIGIT_BIT) + 1)) != MP_OKAY) { + return res; + } - /* set the used count of where the bit will go */ - a->used = (b / DIGIT_BIT) + 1; + /* set the used count of where the bit will go */ + a->used = (b / DIGIT_BIT) + 1; - /* put the single bit in its place */ - a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); + /* put the single bit in its place */ + a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index e7c5e25..d5fc012 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -15,26 +15,25 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* b = |a| +/* b = |a| * * Simple function copies the input and fixes the sign to positive */ -int -mp_abs (mp_int * a, mp_int * b) +int mp_abs(mp_int *a, mp_int *b) { - int res; + int res; - /* copy a to b */ - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } + /* copy a to b */ + if (a != b) { + if ((res = mp_copy(a, b)) != MP_OKAY) { + return res; + } + } - /* force the sign of b to positive */ - b->sign = MP_ZPOS; + /* force the sign of b to positive */ + b->sign = MP_ZPOS; - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index bdb166f..4df4c81 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -16,34 +16,34 @@ */ /* high level addition (handles signs) */ -int mp_add (mp_int * a, mp_int * b, mp_int * c) +int mp_add(mp_int *a, mp_int *b, mp_int *c) { - int sa, sb, res; + int sa, sb, res; - /* get sign of both inputs */ - sa = a->sign; - sb = b->sign; + /* get sign of both inputs */ + sa = a->sign; + sb = b->sign; - /* handle two cases, not four */ - if (sa == sb) { - /* both positive or both negative */ - /* add their magnitudes, copy the sign */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* one positive, the other negative */ - /* subtract the one with the greater magnitude from */ - /* the one of the lesser magnitude. The result gets */ - /* the sign of the one with the greater magnitude. */ - if (mp_cmp_mag (a, b) == MP_LT) { - c->sign = sb; - res = s_mp_sub (b, a, c); - } else { + /* handle two cases, not four */ + if (sa == sb) { + /* both positive or both negative */ + /* add their magnitudes, copy the sign */ c->sign = sa; - res = s_mp_sub (a, b, c); - } - } - return res; + res = s_mp_add(a, b, c); + } else { + /* one positive, the other negative */ + /* subtract the one with the greater magnitude from */ + /* the one of the lesser magnitude. The result gets */ + /* the sign of the one with the greater magnitude. */ + if (mp_cmp_mag(a, b) == MP_LT) { + c->sign = sb; + res = s_mp_sub(b, a, c); + } else { + c->sign = sa; + res = s_mp_sub(a, b, c); + } + } + return res; } #endif diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index fd1a186..1e6ff63 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -16,93 +16,92 @@ */ /* single digit addition */ -int -mp_add_d (mp_int * a, mp_digit b, mp_int * c) +int mp_add_d(mp_int *a, mp_digit b, mp_int *c) { - int res, ix, oldused; - mp_digit *tmpa, *tmpc, mu; - - /* grow c as required */ - if (c->alloc < (a->used + 1)) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* if a is negative and |a| >= b, call c = |a| - b */ - if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { - /* temporarily fix sign of a */ - a->sign = MP_ZPOS; - - /* c = |a| - b */ - res = mp_sub_d(a, b, c); - - /* fix sign */ - a->sign = c->sign = MP_NEG; - - /* clamp */ - mp_clamp(c); - - return res; - } - - /* old number of used digits in c */ - oldused = c->used; - - /* source alias */ - tmpa = a->dp; - - /* destination alias */ - tmpc = c->dp; - - /* if a is positive */ - if (a->sign == MP_ZPOS) { - /* add digit, after this we're propagating - * the carry. - */ - *tmpc = *tmpa++ + b; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - - /* now handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ + mu; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - } - /* set final carry */ - ix++; - *tmpc++ = mu; - - /* setup size */ - c->used = a->used + 1; - } else { - /* a was negative and |a| < b */ - c->used = 1; - - /* the result is a single digit */ - if (a->used == 1) { - *tmpc++ = b - a->dp[0]; - } else { - *tmpc++ = b; - } - - /* setup count so the clearing of oldused - * can fall through correctly - */ - ix = 1; - } - - /* sign always positive */ - c->sign = MP_ZPOS; - - /* now zero to oldused */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - - return MP_OKAY; + int res, ix, oldused; + mp_digit *tmpa, *tmpc, mu; + + /* grow c as required */ + if (c->alloc < (a->used + 1)) { + if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { + return res; + } + } + + /* if a is negative and |a| >= b, call c = |a| - b */ + if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { + /* temporarily fix sign of a */ + a->sign = MP_ZPOS; + + /* c = |a| - b */ + res = mp_sub_d(a, b, c); + + /* fix sign */ + a->sign = c->sign = MP_NEG; + + /* clamp */ + mp_clamp(c); + + return res; + } + + /* old number of used digits in c */ + oldused = c->used; + + /* source alias */ + tmpa = a->dp; + + /* destination alias */ + tmpc = c->dp; + + /* if a is positive */ + if (a->sign == MP_ZPOS) { + /* add digit, after this we're propagating + * the carry. + */ + *tmpc = *tmpa++ + b; + mu = *tmpc >> DIGIT_BIT; + *tmpc++ &= MP_MASK; + + /* now handle rest of the digits */ + for (ix = 1; ix < a->used; ix++) { + *tmpc = *tmpa++ + mu; + mu = *tmpc >> DIGIT_BIT; + *tmpc++ &= MP_MASK; + } + /* set final carry */ + ix++; + *tmpc++ = mu; + + /* setup size */ + c->used = a->used + 1; + } else { + /* a was negative and |a| < b */ + c->used = 1; + + /* the result is a single digit */ + if (a->used == 1) { + *tmpc++ = b - a->dp[0]; + } else { + *tmpc++ = b; + } + + /* setup count so the clearing of oldused + * can fall through correctly + */ + ix = 1; + } + + /* sign always positive */ + c->sign = MP_ZPOS; + + /* now zero to oldused */ + while (ix++ < oldused) { + *tmpc++ = 0; + } + mp_clamp(c); + + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index dc06788..229a716 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -16,23 +16,22 @@ */ /* d = a + b (mod c) */ -int -mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } + if ((res = mp_init(&t)) != MP_OKAY) { + return res; + } - if ((res = mp_add (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; + if ((res = mp_add(a, b, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, c, d); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 53008a5..2f1472a 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -16,39 +16,38 @@ */ /* AND two ints together */ -int -mp_and (mp_int * a, mp_int * b, mp_int * c) +int mp_and(mp_int *a, mp_int *b, mp_int *c) { - int res, ix, px; - mp_int t, *x; + int res, ix, px; + mp_int t, *x; - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } + if (a->used > b->used) { + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } + px = b->used; + x = b; + } else { + if ((res = mp_init_copy(&t, b)) != MP_OKAY) { + return res; + } + px = a->used; + x = a; + } - for (ix = 0; ix < px; ix++) { - t.dp[ix] &= x->dp[ix]; - } + for (ix = 0; ix < px; ix++) { + t.dp[ix] &= x->dp[ix]; + } - /* zero digits above the last from the smallest mp_int */ - for (; ix < t.used; ix++) { - t.dp[ix] = 0; - } + /* zero digits above the last from the smallest mp_int */ + for (; ix < t.used; ix++) { + t.dp[ix] = 0; + } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; + mp_clamp(&t); + mp_exch(c, &t); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index 2c0a1a6..3853914 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -15,27 +15,26 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* trim unused digits +/* trim unused digits * * This is used to ensure that leading zero digits are * trimed and the leading "used" digit will be non-zero * Typically very fast. Also fixes the sign if there * are no more leading digits */ -void -mp_clamp (mp_int * a) +void mp_clamp(mp_int *a) { - /* decrease used while the most significant digit is - * zero. - */ - while ((a->used > 0) && (a->dp[a->used - 1] == 0)) { - --(a->used); - } + /* decrease used while the most significant digit is + * zero. + */ + while ((a->used > 0) && (a->dp[a->used - 1] == 0)) { + --(a->used); + } - /* reset the sign flag if used == 0 */ - if (a->used == 0) { - a->sign = MP_ZPOS; - } + /* reset the sign flag if used == 0 */ + if (a->used == 0) { + a->sign = MP_ZPOS; + } } #endif diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index 97f3db0..fcf4d61 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -16,26 +16,25 @@ */ /* clear one (frees) */ -void -mp_clear (mp_int * a) +void mp_clear(mp_int *a) { - int i; + int i; - /* only do anything if a hasn't been freed previously */ - if (a->dp != NULL) { - /* first zero the digits */ - for (i = 0; i < a->used; i++) { - a->dp[i] = 0; - } + /* only do anything if a hasn't been freed previously */ + if (a->dp != NULL) { + /* first zero the digits */ + for (i = 0; i < a->used; i++) { + a->dp[i] = 0; + } - /* free ram */ - XFREE(a->dp); + /* free ram */ + XFREE(a->dp); - /* reset members to make debugging easier */ - a->dp = NULL; - a->alloc = a->used = 0; - a->sign = MP_ZPOS; - } + /* reset members to make debugging easier */ + a->dp = NULL; + a->alloc = a->used = 0; + a->sign = MP_ZPOS; + } } #endif diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index bd4b232..284fab8 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -16,16 +16,16 @@ */ #include -void mp_clear_multi(mp_int *mp, ...) +void mp_clear_multi(mp_int *mp, ...) { - mp_int* next_mp = mp; - va_list args; - va_start(args, mp); - while (next_mp != NULL) { - mp_clear(next_mp); - next_mp = va_arg(args, mp_int*); - } - va_end(args); + mp_int *next_mp = mp; + va_list args; + va_start(args, mp); + while (next_mp != NULL) { + mp_clear(next_mp); + next_mp = va_arg(args, mp_int *); + } + va_end(args); } #endif diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index e757ddf..9047060 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -16,25 +16,24 @@ */ /* compare two ints (signed)*/ -int -mp_cmp (mp_int * a, mp_int * b) +int mp_cmp(mp_int *a, mp_int *b) { - /* compare based on sign */ - if (a->sign != b->sign) { - if (a->sign == MP_NEG) { - return MP_LT; - } else { - return MP_GT; - } - } - - /* compare digits */ - if (a->sign == MP_NEG) { - /* if negative compare opposite direction */ - return mp_cmp_mag(b, a); - } else { - return mp_cmp_mag(a, b); - } + /* compare based on sign */ + if (a->sign != b->sign) { + if (a->sign == MP_NEG) { + return MP_LT; + } else { + return MP_GT; + } + } + + /* compare digits */ + if (a->sign == MP_NEG) { + /* if negative compare opposite direction */ + return mp_cmp_mag(b, a); + } else { + return mp_cmp_mag(a, b); + } } #endif diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index 3f5ebae..27a546d 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -16,26 +16,26 @@ */ /* compare a digit */ -int mp_cmp_d(mp_int * a, mp_digit b) +int mp_cmp_d(mp_int *a, mp_digit b) { - /* compare based on sign */ - if (a->sign == MP_NEG) { - return MP_LT; - } + /* compare based on sign */ + if (a->sign == MP_NEG) { + return MP_LT; + } - /* compare based on magnitude */ - if (a->used > 1) { - return MP_GT; - } + /* compare based on magnitude */ + if (a->used > 1) { + return MP_GT; + } - /* compare the only digit of a to b */ - if (a->dp[0] > b) { - return MP_GT; - } else if (a->dp[0] < b) { - return MP_LT; - } else { - return MP_EQ; - } + /* compare the only digit of a to b */ + if (a->dp[0] > b) { + return MP_GT; + } else if (a->dp[0] < b) { + return MP_LT; + } else { + return MP_EQ; + } } #endif diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index 7ceda97..ca2bc88 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -16,37 +16,37 @@ */ /* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag (mp_int * a, mp_int * b) +int mp_cmp_mag(mp_int *a, mp_int *b) { - int n; - mp_digit *tmpa, *tmpb; - - /* compare based on # of non-zero digits */ - if (a->used > b->used) { - return MP_GT; - } - - if (a->used < b->used) { - return MP_LT; - } - - /* alias for a */ - tmpa = a->dp + (a->used - 1); - - /* alias for b */ - tmpb = b->dp + (a->used - 1); - - /* compare based on digits */ - for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { - if (*tmpa > *tmpb) { + int n; + mp_digit *tmpa, *tmpb; + + /* compare based on # of non-zero digits */ + if (a->used > b->used) { return MP_GT; - } + } - if (*tmpa < *tmpb) { + if (a->used < b->used) { return MP_LT; - } - } - return MP_EQ; + } + + /* alias for a */ + tmpa = a->dp + (a->used - 1); + + /* alias for b */ + tmpb = b->dp + (a->used - 1); + + /* compare based on digits */ + for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { + if (*tmpa > *tmpb) { + return MP_GT; + } + + if (*tmpa < *tmpb) { + return MP_LT; + } + } + return MP_EQ; } #endif diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index bf201b5..7273655 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -15,7 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -static const int lnz[16] = { +static const int lnz[16] = { 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 }; diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 84e839e..bed03b2 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -16,50 +16,49 @@ */ /* copy, b = a */ -int -mp_copy (mp_int * a, mp_int * b) +int mp_copy(mp_int *a, mp_int *b) { - int res, n; + int res, n; - /* if dst == src do nothing */ - if (a == b) { - return MP_OKAY; - } + /* if dst == src do nothing */ + if (a == b) { + return MP_OKAY; + } - /* grow dest */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } + /* grow dest */ + if (b->alloc < a->used) { + if ((res = mp_grow(b, a->used)) != MP_OKAY) { + return res; + } + } - /* zero b and copy the parameters over */ - { - mp_digit *tmpa, *tmpb; + /* zero b and copy the parameters over */ + { + mp_digit *tmpa, *tmpb; - /* pointer aliases */ + /* pointer aliases */ - /* source */ - tmpa = a->dp; + /* source */ + tmpa = a->dp; - /* destination */ - tmpb = b->dp; + /* destination */ + tmpb = b->dp; - /* copy all the digits */ - for (n = 0; n < a->used; n++) { - *tmpb++ = *tmpa++; - } + /* copy all the digits */ + for (n = 0; n < a->used; n++) { + *tmpb++ = *tmpa++; + } - /* clear high digits */ - for (; n < b->used; n++) { - *tmpb++ = 0; - } - } + /* clear high digits */ + for (; n < b->used; n++) { + *tmpb++ = 0; + } + } - /* copy used count and sign */ - b->used = a->used; - b->sign = a->sign; - return MP_OKAY; + /* copy used count and sign */ + b->used = a->used; + b->sign = a->sign; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index ff558eb..dea364f 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -16,27 +16,26 @@ */ /* returns the number of bits in an int */ -int -mp_count_bits (mp_int * a) +int mp_count_bits(mp_int *a) { - int r; - mp_digit q; + int r; + mp_digit q; - /* shortcut */ - if (a->used == 0) { - return 0; - } + /* shortcut */ + if (a->used == 0) { + return 0; + } - /* get number of digits and add that */ - r = (a->used - 1) * DIGIT_BIT; - - /* take the last digit and count the bits in it */ - q = a->dp[a->used - 1]; - while (q > ((mp_digit) 0)) { - ++r; - q >>= ((mp_digit) 1); - } - return r; + /* get number of digits and add that */ + r = (a->used - 1) * DIGIT_BIT; + + /* take the last digit and count the bits in it */ + q = a->dp[a->used - 1]; + while (q > ((mp_digit) 0)) { + ++r; + q >>= ((mp_digit) 1); + } + return r; } #endif diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 0890e65..fdb3453 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -18,68 +18,68 @@ #ifdef BN_MP_DIV_SMALL /* slower bit-bang division... also smaller */ -int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { mp_int ta, tb, tq, q; int res, n, n2; - /* is divisor zero ? */ - if (mp_iszero (b) == MP_YES) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - /* init our temps */ - if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL)) != MP_OKAY) { - return res; - } - - - mp_set(&tq, 1); - n = mp_count_bits(a) - mp_count_bits(b); - if (((res = mp_abs(a, &ta)) != MP_OKAY) || - ((res = mp_abs(b, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) { + /* is divisor zero ? */ + if (mp_iszero(b) == MP_YES) { + return MP_VAL; + } + + /* if a < b then q=0, r = a */ + if (mp_cmp_mag(a, b) == MP_LT) { + if (d != NULL) { + res = mp_copy(a, d); + } else { + res = MP_OKAY; + } + if (c != NULL) { + mp_zero(c); + } + return res; + } + + /* init our temps */ + if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL)) != MP_OKAY) { + return res; + } + + + mp_set(&tq, 1); + n = mp_count_bits(a) - mp_count_bits(b); + if (((res = mp_abs(a, &ta)) != MP_OKAY) || + ((res = mp_abs(b, &tb)) != MP_OKAY) || + ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || + ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) { goto LBL_ERR; - } - - while (n-- >= 0) { - if (mp_cmp(&tb, &ta) != MP_GT) { - if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || - ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) { - goto LBL_ERR; - } - } - if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || - ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) { - goto LBL_ERR; - } - } - - /* now q == quotient and ta == remainder */ - n = a->sign; - n2 = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - if (c != NULL) { - mp_exch(c, &q); - c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; - } - if (d != NULL) { - mp_exch(d, &ta); - d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; - } + } + + while (n-- >= 0) { + if (mp_cmp(&tb, &ta) != MP_GT) { + if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || + ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) { + goto LBL_ERR; + } + } + if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || + ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) { + goto LBL_ERR; + } + } + + /* now q == quotient and ta == remainder */ + n = a->sign; + n2 = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; + if (c != NULL) { + mp_exch(c, &q); + c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; + } + if (d != NULL) { + mp_exch(d, &ta); + d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; + } LBL_ERR: mp_clear_multi(&ta, &tb, &tq, &q, NULL); return res; @@ -100,190 +100,195 @@ LBL_ERR: * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - mp_int q, x, y, t1, t2; - int res, n, t, i, norm, neg; - - /* is divisor zero ? */ - if (mp_iszero (b) == MP_YES) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) { - return res; - } - q.used = a->used + 2; - - if ((res = mp_init (&t1)) != MP_OKAY) { - goto LBL_Q; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init_copy (&x, a)) != MP_OKAY) { - goto LBL_T2; - } - - if ((res = mp_init_copy (&y, b)) != MP_OKAY) { - goto LBL_X; - } - - /* fix the sign */ - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - x.sign = y.sign = MP_ZPOS; - - /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ - norm = mp_count_bits(&y) % DIGIT_BIT; - if (norm < (int)(DIGIT_BIT-1)) { - norm = (DIGIT_BIT-1) - norm; - if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) { - goto LBL_Y; - } - } else { - norm = 0; - } - - /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ - n = x.used - 1; - t = y.used - 1; - - /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ - if ((res = mp_lshd (&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ - goto LBL_Y; - } - - while (mp_cmp (&x, &y) != MP_LT) { - ++(q.dp[n - t]); - if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) { - goto LBL_Y; - } - } - - /* reset y by shifting it back down */ - mp_rshd (&y, n - t); - - /* step 3. for i from n down to (t + 1) */ - for (i = n; i >= (t + 1); i--) { - if (i > x.used) { - continue; - } - - /* step 3.1 if xi == yt then set q{i-t-1} to b-1, - * otherwise set q{i-t-1} to (xi*b + x{i-1})/yt */ - if (x.dp[i] == y.dp[t]) { - q.dp[(i - t) - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); - } else { - mp_word tmp; - tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); - tmp |= ((mp_word) x.dp[i - 1]); - tmp /= ((mp_word) y.dp[t]); - if (tmp > (mp_word) MP_MASK) { - tmp = MP_MASK; + mp_int q, x, y, t1, t2; + int res, n, t, i, norm, neg; + + /* is divisor zero ? */ + if (mp_iszero(b) == MP_YES) { + return MP_VAL; + } + + /* if a < b then q=0, r = a */ + if (mp_cmp_mag(a, b) == MP_LT) { + if (d != NULL) { + res = mp_copy(a, d); + } else { + res = MP_OKAY; } - q.dp[(i - t) - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK)); - } - - /* while (q{i-t-1} * (yt * b + y{t-1})) > - xi * b**2 + xi-1 * b + xi-2 - - do q{i-t-1} -= 1; - */ - q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] + 1) & MP_MASK; - do { - q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1) & MP_MASK; - - /* find left hand */ - mp_zero (&t1); - t1.dp[0] = ((t - 1) < 0) ? 0 : y.dp[t - 1]; - t1.dp[1] = y.dp[t]; - t1.used = 2; - if ((res = mp_mul_d (&t1, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { - goto LBL_Y; + if (c != NULL) { + mp_zero(c); } + return res; + } + + if ((res = mp_init_size(&q, a->used + 2)) != MP_OKAY) { + return res; + } + q.used = a->used + 2; + + if ((res = mp_init(&t1)) != MP_OKAY) { + goto LBL_Q; + } + + if ((res = mp_init(&t2)) != MP_OKAY) { + goto LBL_T1; + } + + if ((res = mp_init_copy(&x, a)) != MP_OKAY) { + goto LBL_T2; + } + + if ((res = mp_init_copy(&y, b)) != MP_OKAY) { + goto LBL_X; + } + + /* fix the sign */ + neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; + x.sign = y.sign = MP_ZPOS; + + /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ + norm = mp_count_bits(&y) % DIGIT_BIT; + if (norm < (int)(DIGIT_BIT-1)) { + norm = (DIGIT_BIT-1) - norm; + if ((res = mp_mul_2d(&x, norm, &x)) != MP_OKAY) { + goto LBL_Y; + } + if ((res = mp_mul_2d(&y, norm, &y)) != MP_OKAY) { + goto LBL_Y; + } + } else { + norm = 0; + } - /* find right hand */ - t2.dp[0] = ((i - 2) < 0) ? 0 : x.dp[i - 2]; - t2.dp[1] = ((i - 1) < 0) ? 0 : x.dp[i - 1]; - t2.dp[2] = x.dp[i]; - t2.used = 3; - } while (mp_cmp_mag(&t1, &t2) == MP_GT); + /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ + n = x.used - 1; + t = y.used - 1; - /* step 3.3 x = x - q{i-t-1} * y * b**{i-t-1} */ - if ((res = mp_mul_d (&y, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { + /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ + if ((res = mp_lshd(&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ goto LBL_Y; - } + } - if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) { - goto LBL_Y; - } + while (mp_cmp(&x, &y) != MP_LT) { + ++(q.dp[n - t]); + if ((res = mp_sub(&x, &y, &x)) != MP_OKAY) { + goto LBL_Y; + } + } - if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; - } + /* reset y by shifting it back down */ + mp_rshd(&y, n - t); - /* if x < 0 then { x = x + y*b**{i-t-1}; q{i-t-1} -= 1; } */ - if (x.sign == MP_NEG) { - if ((res = mp_copy (&y, &t1)) != MP_OKAY) { - goto LBL_Y; + /* step 3. for i from n down to (t + 1) */ + for (i = n; i >= (t + 1); i--) { + if (i > x.used) { + continue; } - if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) { - goto LBL_Y; + + /* step 3.1 if xi == yt then set q{i-t-1} to b-1, + * otherwise set q{i-t-1} to (xi*b + x{i-1})/yt */ + if (x.dp[i] == y.dp[t]) { + q.dp[(i - t) - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); + } else { + mp_word tmp; + tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); + tmp |= ((mp_word) x.dp[i - 1]); + tmp /= ((mp_word) y.dp[t]); + if (tmp > (mp_word) MP_MASK) { + tmp = MP_MASK; + } + q.dp[(i - t) - 1] = (mp_digit)(tmp & (mp_word)(MP_MASK)); } - if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; + + /* while (q{i-t-1} * (yt * b + y{t-1})) > + xi * b**2 + xi-1 * b + xi-2 + + do q{i-t-1} -= 1; + */ + q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] + 1) & MP_MASK; + do { + q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1) & MP_MASK; + + /* find left hand */ + mp_zero(&t1); + t1.dp[0] = ((t - 1) < 0) ? 0 : y.dp[t - 1]; + t1.dp[1] = y.dp[t]; + t1.used = 2; + if ((res = mp_mul_d(&t1, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { + goto LBL_Y; + } + + /* find right hand */ + t2.dp[0] = ((i - 2) < 0) ? 0 : x.dp[i - 2]; + t2.dp[1] = ((i - 1) < 0) ? 0 : x.dp[i - 1]; + t2.dp[2] = x.dp[i]; + t2.used = 3; + } while (mp_cmp_mag(&t1, &t2) == MP_GT); + + /* step 3.3 x = x - q{i-t-1} * y * b**{i-t-1} */ + if ((res = mp_mul_d(&y, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { + goto LBL_Y; } - q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1UL) & MP_MASK; - } - } + if ((res = mp_lshd(&t1, (i - t) - 1)) != MP_OKAY) { + goto LBL_Y; + } - /* now q is the quotient and x is the remainder - * [which we have to normalize] - */ + if ((res = mp_sub(&x, &t1, &x)) != MP_OKAY) { + goto LBL_Y; + } - /* get sign before writing to c */ - x.sign = (x.used == 0) ? MP_ZPOS : a->sign; + /* if x < 0 then { x = x + y*b**{i-t-1}; q{i-t-1} -= 1; } */ + if (x.sign == MP_NEG) { + if ((res = mp_copy(&y, &t1)) != MP_OKAY) { + goto LBL_Y; + } + if ((res = mp_lshd(&t1, (i - t) - 1)) != MP_OKAY) { + goto LBL_Y; + } + if ((res = mp_add(&x, &t1, &x)) != MP_OKAY) { + goto LBL_Y; + } + + q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1UL) & MP_MASK; + } + } - if (c != NULL) { - mp_clamp (&q); - mp_exch (&q, c); - c->sign = neg; - } + /* now q is the quotient and x is the remainder + * [which we have to normalize] + */ - if (d != NULL) { - if ((res = mp_div_2d (&x, norm, &x, NULL)) != MP_OKAY) { - goto LBL_Y; - } - mp_exch (&x, d); - } - - res = MP_OKAY; - -LBL_Y:mp_clear (&y); -LBL_X:mp_clear (&x); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); -LBL_Q:mp_clear (&q); - return res; + /* get sign before writing to c */ + x.sign = (x.used == 0) ? MP_ZPOS : a->sign; + + if (c != NULL) { + mp_clamp(&q); + mp_exch(&q, c); + c->sign = neg; + } + + if (d != NULL) { + if ((res = mp_div_2d(&x, norm, &x, NULL)) != MP_OKAY) { + goto LBL_Y; + } + mp_exch(&x, d); + } + + res = MP_OKAY; + +LBL_Y: + mp_clear(&y); +LBL_X: + mp_clear(&x); +LBL_T2: + mp_clear(&t2); +LBL_T1: + mp_clear(&t1); +LBL_Q: + mp_clear(&q); + return res; } #endif diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index 2b5bb49..b9d5339 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -16,50 +16,50 @@ */ /* b = a/2 */ -int mp_div_2(mp_int * a, mp_int * b) +int mp_div_2(mp_int *a, mp_int *b) { - int x, res, oldused; + int x, res, oldused; - /* copy */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } + /* copy */ + if (b->alloc < a->used) { + if ((res = mp_grow(b, a->used)) != MP_OKAY) { + return res; + } + } - oldused = b->used; - b->used = a->used; - { - mp_digit r, rr, *tmpa, *tmpb; + oldused = b->used; + b->used = a->used; + { + mp_digit r, rr, *tmpa, *tmpb; - /* source alias */ - tmpa = a->dp + b->used - 1; + /* source alias */ + tmpa = a->dp + b->used - 1; - /* dest alias */ - tmpb = b->dp + b->used - 1; + /* dest alias */ + tmpb = b->dp + b->used - 1; - /* carry */ - r = 0; - for (x = b->used - 1; x >= 0; x--) { - /* get the carry for the next iteration */ - rr = *tmpa & 1; + /* carry */ + r = 0; + for (x = b->used - 1; x >= 0; x--) { + /* get the carry for the next iteration */ + rr = *tmpa & 1; - /* shift the current digit, add in carry and store */ - *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); + /* shift the current digit, add in carry and store */ + *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); - /* forward carry to next iteration */ - r = rr; - } + /* forward carry to next iteration */ + r = rr; + } - /* zero excess digits */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - mp_clamp (b); - return MP_OKAY; + /* zero excess digits */ + tmpb = b->dp + b->used; + for (x = b->used; x < oldused; x++) { + *tmpb++ = 0; + } + } + b->sign = a->sign; + mp_clamp(b); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index 635d374..d6723ee 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -16,68 +16,68 @@ */ /* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) +int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d) { - mp_digit D, r, rr; - int x, res; + mp_digit D, r, rr; + int x, res; - /* if the shift count is <= 0 then we do no work */ - if (b <= 0) { - res = mp_copy (a, c); - if (d != NULL) { - mp_zero (d); - } - return res; - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - /* 'a' should not be used after here - it might be the same as d */ + /* if the shift count is <= 0 then we do no work */ + if (b <= 0) { + res = mp_copy(a, c); + if (d != NULL) { + mp_zero(d); + } + return res; + } - /* get the remainder */ - if (d != NULL) { - if ((res = mp_mod_2d (a, b, d)) != MP_OKAY) { + /* copy */ + if ((res = mp_copy(a, c)) != MP_OKAY) { return res; - } - } + } + /* 'a' should not be used after here - it might be the same as d */ + + /* get the remainder */ + if (d != NULL) { + if ((res = mp_mod_2d(a, b, d)) != MP_OKAY) { + return res; + } + } - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - mp_rshd (c, b / DIGIT_BIT); - } + /* shift by as many digits in the bit count */ + if (b >= (int)DIGIT_BIT) { + mp_rshd(c, b / DIGIT_BIT); + } - /* shift any bit count < DIGIT_BIT */ - D = (mp_digit) (b % DIGIT_BIT); - if (D != 0) { - mp_digit *tmpc, mask, shift; + /* shift any bit count < DIGIT_BIT */ + D = (mp_digit)(b % DIGIT_BIT); + if (D != 0) { + mp_digit *tmpc, mask, shift; - /* mask */ - mask = (((mp_digit)1) << D) - 1; + /* mask */ + mask = (((mp_digit)1) << D) - 1; - /* shift for lsb */ - shift = DIGIT_BIT - D; + /* shift for lsb */ + shift = DIGIT_BIT - D; - /* alias */ - tmpc = c->dp + (c->used - 1); + /* alias */ + tmpc = c->dp + (c->used - 1); - /* carry */ - r = 0; - for (x = c->used - 1; x >= 0; x--) { - /* get the lower bits of this word in a temp */ - rr = *tmpc & mask; + /* carry */ + r = 0; + for (x = c->used - 1; x >= 0; x--) { + /* get the lower bits of this word in a temp */ + rr = *tmpc & mask; - /* shift the current word and mix in the carry bits from the previous word */ - *tmpc = (*tmpc >> D) | (r << shift); - --tmpc; + /* shift the current word and mix in the carry bits from the previous word */ + *tmpc = (*tmpc >> D) | (r << shift); + --tmpc; - /* set the carry to the carry bits of the current word found above */ - r = rr; - } - } - mp_clamp (c); - return MP_OKAY; + /* set the carry to the carry bits of the current word found above */ + r = rr; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index e8504ea..c3a023a 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -16,60 +16,59 @@ */ /* divide by three (based on routine from MPI and the GMP manual) */ -int -mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) +int mp_div_3(mp_int *a, mp_int *c, mp_digit *d) { - mp_int q; - mp_word w, t; - mp_digit b; - int res, ix; - - /* b = 2**DIGIT_BIT / 3 */ - b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3); + mp_int q; + mp_word w, t; + mp_digit b; + int res, ix; - if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); + /* b = 2**DIGIT_BIT / 3 */ + b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3); - if (w >= 3) { - /* multiply w by [1/3] */ - t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT); + if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { + return res; + } - /* now subtract 3 * [w/3] from w, to get the remainder */ - w -= t+t+t; + q.used = a->used; + q.sign = a->sign; + w = 0; + for (ix = a->used - 1; ix >= 0; ix--) { + w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - /* fixup the remainder as required since - * the optimization is not exact. - */ - while (w >= 3) { - t += 1; - w -= 3; - } + if (w >= 3) { + /* multiply w by [1/3] */ + t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT); + + /* now subtract 3 * [w/3] from w, to get the remainder */ + w -= t+t+t; + + /* fixup the remainder as required since + * the optimization is not exact. + */ + while (w >= 3) { + t += 1; + w -= 3; + } } else { - t = 0; + t = 0; } q.dp[ix] = (mp_digit)t; - } + } + + /* [optional] store the remainder */ + if (d != NULL) { + *d = (mp_digit)w; + } - /* [optional] store the remainder */ - if (d != NULL) { - *d = (mp_digit)w; - } + /* [optional] store the quotient */ + if (c != NULL) { + mp_clamp(&q); + mp_exch(&q, c); + } + mp_clear(&q); - /* [optional] store the quotient */ - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; + return res; } #endif diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index a5dbc59..141db1d 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -34,78 +34,78 @@ static int s_is_power_of_two(mp_digit b, int *p) } /* single digit division (based on routine from MPI) */ -int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) +int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d) { - mp_int q; - mp_word w; - mp_digit t; - int res, ix; - - /* cannot divide by zero */ - if (b == 0) { - return MP_VAL; - } - - /* quick outs */ - if ((b == 1) || (mp_iszero(a) == MP_YES)) { - if (d != NULL) { - *d = 0; - } - if (c != NULL) { - return mp_copy(a, c); - } - return MP_OKAY; - } - - /* power of two ? */ - if (s_is_power_of_two(b, &ix) == 1) { - if (d != NULL) { - *d = a->dp[0] & ((((mp_digit)1)<dp[0] & ((((mp_digit)1)<used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - - if (w >= b) { - t = (mp_digit)(w / b); - w -= ((mp_word)t) * ((mp_word)b); + /* no easy answer [c'est la vie]. Just division */ + if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { + return res; + } + + q.used = a->used; + q.sign = a->sign; + w = 0; + for (ix = a->used - 1; ix >= 0; ix--) { + w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); + + if (w >= b) { + t = (mp_digit)(w / b); + w -= ((mp_word)t) * ((mp_word)b); } else { - t = 0; + t = 0; } q.dp[ix] = (mp_digit)t; - } - - if (d != NULL) { - *d = (mp_digit)w; - } - - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; + } + + if (d != NULL) { + *d = (mp_digit)w; + } + + if (c != NULL) { + mp_clamp(&q); + mp_exch(&q, c); + } + mp_clear(&q); + + return res; } #endif diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index ced330c..4631daa 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -29,9 +29,9 @@ int mp_dr_is_modulus(mp_int *a) * but the first digit must be equal to -1 (mod b). */ for (ix = 1; ix < a->used; ix++) { - if (a->dp[ix] != MP_MASK) { - return 0; - } + if (a->dp[ix] != MP_MASK) { + return 0; + } } return 1; } diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index c85ee77..25079be 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -29,65 +29,64 @@ * * Input x must be in the range 0 <= x <= (n-1)**2 */ -int -mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k) +int mp_dr_reduce(mp_int *x, mp_int *n, mp_digit k) { - int err, i, m; - mp_word r; - mp_digit mu, *tmpx1, *tmpx2; + int err, i, m; + mp_word r; + mp_digit mu, *tmpx1, *tmpx2; - /* m = digits in modulus */ - m = n->used; + /* m = digits in modulus */ + m = n->used; - /* ensure that "x" has at least 2m digits */ - if (x->alloc < (m + m)) { - if ((err = mp_grow (x, m + m)) != MP_OKAY) { - return err; - } - } + /* ensure that "x" has at least 2m digits */ + if (x->alloc < (m + m)) { + if ((err = mp_grow(x, m + m)) != MP_OKAY) { + return err; + } + } -/* top of loop, this is where the code resumes if - * another reduction pass is required. - */ + /* top of loop, this is where the code resumes if + * another reduction pass is required. + */ top: - /* aliases for digits */ - /* alias for lower half of x */ - tmpx1 = x->dp; + /* aliases for digits */ + /* alias for lower half of x */ + tmpx1 = x->dp; - /* alias for upper half of x, or x/B**m */ - tmpx2 = x->dp + m; + /* alias for upper half of x, or x/B**m */ + tmpx2 = x->dp + m; - /* set carry to zero */ - mu = 0; + /* set carry to zero */ + mu = 0; - /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ - for (i = 0; i < m; i++) { + /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ + for (i = 0; i < m; i++) { r = (((mp_word)*tmpx2++) * (mp_word)k) + *tmpx1 + mu; *tmpx1++ = (mp_digit)(r & MP_MASK); mu = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); - } + } - /* set final carry */ - *tmpx1++ = mu; + /* set final carry */ + *tmpx1++ = mu; - /* zero words above m */ - for (i = m + 1; i < x->used; i++) { + /* zero words above m */ + for (i = m + 1; i < x->used; i++) { *tmpx1++ = 0; - } + } - /* clamp, sub and return */ - mp_clamp (x); + /* clamp, sub and return */ + mp_clamp(x); - /* if x >= n then subtract and reduce again - * Each successive "recursion" makes the input smaller and smaller. - */ - if (mp_cmp_mag (x, n) != MP_LT) { - if ((err = s_mp_sub(x, n, x)) != MP_OKAY) { - return err; - } - goto top; - } - return MP_OKAY; + /* if x >= n then subtract and reduce again + * Each successive "recursion" makes the input smaller and smaller. + */ + if (mp_cmp_mag(x, n) != MP_LT) { + if ((err = s_mp_sub(x, n, x)) != MP_OKAY) { + return err; + } + goto top; + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index b0d4a14..97f31ba 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -21,8 +21,7 @@ void mp_dr_setup(mp_int *a, mp_digit *d) /* the casts are required if DIGIT_BIT is one less than * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] */ - *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - - ((mp_word)a->dp[0])); + *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - ((mp_word)a->dp[0])); } #endif diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index fc26bae..2bc635f 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -15,17 +15,16 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* swap the elements of two integers, for cases where you can't simply swap the +/* swap the elements of two integers, for cases where you can't simply swap the * mp_int pointers around */ -void -mp_exch (mp_int * a, mp_int * b) +void mp_exch(mp_int *a, mp_int *b) { - mp_int t; + mp_int t; - t = *a; - *a = *b; - *b = t; + t = *a; + *a = *b; + *b = t; } #endif diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 4bbc8c5..b69a4fb 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -18,67 +18,66 @@ /* based on gmp's mpz_export. * see http://gmplib.org/manual/Integer-Import-and-Export.html */ -int mp_export(void* rop, size_t* countp, int order, size_t size, - int endian, size_t nails, mp_int* op) { - int result; - size_t odd_nails, nail_bytes, i, j, bits, count; - unsigned char odd_nail_mask; - - mp_int t; - - if ((result = mp_init_copy(&t, op)) != MP_OKAY) { - return result; - } - - if (endian == 0) { - union { - unsigned int i; - char c[4]; - } lint; - lint.i = 0x01020304; - - endian = (lint.c[0] == 4) ? -1 : 1; - } - - odd_nails = (nails % 8); - odd_nail_mask = 0xff; - for (i = 0; i < odd_nails; ++i) { - odd_nail_mask ^= (1 << (7 - i)); - } - nail_bytes = nails / 8; - - bits = mp_count_bits(&t); - count = (bits / ((size * 8) - nails)) + (((bits % ((size * 8) - nails)) != 0) ? 1 : 0); - - for (i = 0; i < count; ++i) { - for (j = 0; j < size; ++j) { - unsigned char* byte = ( - (unsigned char*)rop + - (((order == -1) ? i : ((count - 1) - i)) * size) + - ((endian == -1) ? j : ((size - 1) - j)) - ); - - if (j >= (size - nail_bytes)) { - *byte = 0; - continue; - } - - *byte = (unsigned char)((j == ((size - nail_bytes) - 1)) ? (t.dp[0] & odd_nail_mask) : (t.dp[0] & 0xFF)); - - if ((result = mp_div_2d(&t, ((j == ((size - nail_bytes) - 1)) ? (8 - odd_nails) : 8), &t, NULL)) != MP_OKAY) { - mp_clear(&t); - return result; - } - } - } - - mp_clear(&t); - - if (countp != NULL) { - *countp = count; - } - - return MP_OKAY; +int mp_export(void *rop, size_t *countp, int order, size_t size, + int endian, size_t nails, mp_int *op) +{ + int result; + size_t odd_nails, nail_bytes, i, j, bits, count; + unsigned char odd_nail_mask; + + mp_int t; + + if ((result = mp_init_copy(&t, op)) != MP_OKAY) { + return result; + } + + if (endian == 0) { + union { + unsigned int i; + char c[4]; + } lint; + lint.i = 0x01020304; + + endian = (lint.c[0] == 4) ? -1 : 1; + } + + odd_nails = (nails % 8); + odd_nail_mask = 0xff; + for (i = 0; i < odd_nails; ++i) { + odd_nail_mask ^= (1 << (7 - i)); + } + nail_bytes = nails / 8; + + bits = mp_count_bits(&t); + count = (bits / ((size * 8) - nails)) + (((bits % ((size * 8) - nails)) != 0) ? 1 : 0); + + for (i = 0; i < count; ++i) { + for (j = 0; j < size; ++j) { + unsigned char *byte = (unsigned char *)rop + + (((order == -1) ? i : ((count - 1) - i)) * size) + + ((endian == -1) ? j : ((size - 1) - j)); + + if (j >= (size - nail_bytes)) { + *byte = 0; + continue; + } + + *byte = (unsigned char)((j == ((size - nail_bytes) - 1)) ? (t.dp[0] & odd_nail_mask) : (t.dp[0] & 0xFF)); + + if ((result = mp_div_2d(&t, ((j == ((size - nail_bytes) - 1)) ? (8 - odd_nails) : 8), &t, NULL)) != MP_OKAY) { + mp_clear(&t); + return result; + } + } + } + + mp_clear(&t); + + if (countp != NULL) { + *countp = count; + } + + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index a311926..38bf679 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -16,9 +16,9 @@ */ /* wrapper function for mp_expt_d_ex() */ -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) +int mp_expt_d(mp_int *a, mp_digit b, mp_int *c) { - return mp_expt_d_ex(a, b, c, 0); + return mp_expt_d_ex(a, b, c, 0); } #endif diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index c361b27..bece77b 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -16,65 +16,64 @@ */ /* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) +int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) { - int res; - unsigned int x; + int res; + unsigned int x; - mp_int g; + mp_int g; - if ((res = mp_init_copy (&g, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&g, a)) != MP_OKAY) { + return res; + } - /* set initial result */ - mp_set (c, 1); + /* set initial result */ + mp_set(c, 1); - if (fast != 0) { - while (b > 0) { - /* if the bit is set multiply */ - if ((b & 1) != 0) { - if ((res = mp_mul (c, &g, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } + if (fast != 0) { + while (b > 0) { + /* if the bit is set multiply */ + if ((b & 1) != 0) { + if ((res = mp_mul(c, &g, c)) != MP_OKAY) { + mp_clear(&g); + return res; + } + } - /* square */ - if (b > 1) { - if ((res = mp_sqr (&g, &g)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } + /* square */ + if (b > 1) { + if ((res = mp_sqr(&g, &g)) != MP_OKAY) { + mp_clear(&g); + return res; + } + } - /* shift to next bit */ - b >>= 1; - } - } - else { - for (x = 0; x < DIGIT_BIT; x++) { - /* square */ - if ((res = mp_sqr (c, c)) != MP_OKAY) { - mp_clear (&g); - return res; + /* shift to next bit */ + b >>= 1; } + } else { + for (x = 0; x < DIGIT_BIT; x++) { + /* square */ + if ((res = mp_sqr(c, c)) != MP_OKAY) { + mp_clear(&g); + return res; + } - /* if the bit is set multiply */ - if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) { - if ((res = mp_mul (c, &g, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } + /* if the bit is set multiply */ + if ((b & (mp_digit)(((mp_digit)1) << (DIGIT_BIT - 1))) != 0) { + if ((res = mp_mul(c, &g, c)) != MP_OKAY) { + mp_clear(&g); + return res; + } + } - /* shift to next bit */ - b <<= 1; - } - } /* if ... else */ + /* shift to next bit */ + b <<= 1; + } + } /* if ... else */ - mp_clear (&g); - return MP_OKAY; + mp_clear(&g); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 25c389d..c4f392b 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -21,87 +21,87 @@ * embedded in the normal function but that wasted alot of stack space * for nothing (since 99% of the time the Montgomery code would be called) */ -int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) +int mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y) { - int dr; + int dr; - /* modulus P must be positive */ - if (P->sign == MP_NEG) { - return MP_VAL; - } + /* modulus P must be positive */ + if (P->sign == MP_NEG) { + return MP_VAL; + } - /* if exponent X is negative we have to recurse */ - if (X->sign == MP_NEG) { + /* if exponent X is negative we have to recurse */ + if (X->sign == MP_NEG) { #ifdef BN_MP_INVMOD_C - mp_int tmpG, tmpX; - int err; + mp_int tmpG, tmpX; + int err; - /* first compute 1/G mod P */ - if ((err = mp_init(&tmpG)) != MP_OKAY) { - return err; - } - if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } + /* first compute 1/G mod P */ + if ((err = mp_init(&tmpG)) != MP_OKAY) { + return err; + } + if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) { + mp_clear(&tmpG); + return err; + } - /* now get |X| */ - if ((err = mp_init(&tmpX)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } - if ((err = mp_abs(X, &tmpX)) != MP_OKAY) { - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; - } + /* now get |X| */ + if ((err = mp_init(&tmpX)) != MP_OKAY) { + mp_clear(&tmpG); + return err; + } + if ((err = mp_abs(X, &tmpX)) != MP_OKAY) { + mp_clear_multi(&tmpG, &tmpX, NULL); + return err; + } - /* and now compute (1/G)**|X| instead of G**X [X < 0] */ - err = mp_exptmod(&tmpG, &tmpX, P, Y); - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; -#else - /* no invmod */ - return MP_VAL; + /* and now compute (1/G)**|X| instead of G**X [X < 0] */ + err = mp_exptmod(&tmpG, &tmpX, P, Y); + mp_clear_multi(&tmpG, &tmpX, NULL); + return err; +#else + /* no invmod */ + return MP_VAL; #endif - } + } -/* modified diminished radix reduction */ + /* modified diminished radix reduction */ #if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C) - if (mp_reduce_is_2k_l(P) == MP_YES) { - return s_mp_exptmod(G, X, P, Y, 1); - } + if (mp_reduce_is_2k_l(P) == MP_YES) { + return s_mp_exptmod(G, X, P, Y, 1); + } #endif #ifdef BN_MP_DR_IS_MODULUS_C - /* is it a DR modulus? */ - dr = mp_dr_is_modulus(P); + /* is it a DR modulus? */ + dr = mp_dr_is_modulus(P); #else - /* default to no */ - dr = 0; + /* default to no */ + dr = 0; #endif #ifdef BN_MP_REDUCE_IS_2K_C - /* if not, is it a unrestricted DR modulus? */ - if (dr == 0) { - dr = mp_reduce_is_2k(P) << 1; - } + /* if not, is it a unrestricted DR modulus? */ + if (dr == 0) { + dr = mp_reduce_is_2k(P) << 1; + } #endif - - /* if the modulus is odd or dr != 0 use the montgomery method */ + + /* if the modulus is odd or dr != 0 use the montgomery method */ #ifdef BN_MP_EXPTMOD_FAST_C - if ((mp_isodd (P) == MP_YES) || (dr != 0)) { - return mp_exptmod_fast (G, X, P, Y, dr); - } else { + if ((mp_isodd(P) == MP_YES) || (dr != 0)) { + return mp_exptmod_fast(G, X, P, Y, dr); + } else { #endif #ifdef BN_S_MP_EXPTMOD_C - /* otherwise use the generic Barrett reduction technique */ - return s_mp_exptmod (G, X, P, Y, 0); + /* otherwise use the generic Barrett reduction technique */ + return s_mp_exptmod(G, X, P, Y, 0); #else - /* no exptmod for evens */ - return MP_VAL; + /* no exptmod for evens */ + return MP_VAL; #endif #ifdef BN_MP_EXPTMOD_FAST_C - } + } #endif } diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 5e5c7f2..38e0265 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -24,294 +24,295 @@ */ #ifdef MP_LOW_MEM - #define TAB_SIZE 32 +# define TAB_SIZE 32 #else - #define TAB_SIZE 256 +# define TAB_SIZE 256 #endif -int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) +int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) { - mp_int M[TAB_SIZE], res; - mp_digit buf, mp; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - - /* use a pointer to the reduction algorithm. This allows us to use - * one of many reduction algorithms without modding the guts of - * the code with if statements everywhere. - */ - int (*redux)(mp_int*,mp_int*,mp_digit); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } + mp_int M[TAB_SIZE], res; + mp_digit buf, mp; + int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; + + /* use a pointer to the reduction algorithm. This allows us to use + * one of many reduction algorithms without modding the guts of + * the code with if statements everywhere. + */ + int (*redux)(mp_int *,mp_int *,mp_digit); + + /* find window size */ + x = mp_count_bits(X); + if (x <= 7) { + winsize = 2; + } else if (x <= 36) { + winsize = 3; + } else if (x <= 140) { + winsize = 4; + } else if (x <= 450) { + winsize = 5; + } else if (x <= 1303) { + winsize = 6; + } else if (x <= 3529) { + winsize = 7; + } else { + winsize = 8; + } #ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } + if (winsize > 5) { + winsize = 5; + } #endif - /* init M array */ - /* init first cell */ - if ((err = mp_init_size(&M[1], P->alloc)) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init_size(&M[x], P->alloc)) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); + /* init M array */ + /* init first cell */ + if ((err = mp_init_size(&M[1], P->alloc)) != MP_OKAY) { return err; - } - } - - /* determine and setup reduction code */ - if (redmode == 0) { -#ifdef BN_MP_MONTGOMERY_SETUP_C - /* now setup montgomery */ - if ((err = mp_montgomery_setup (P, &mp)) != MP_OKAY) { - goto LBL_M; - } + } + + /* now init the second half of the array */ + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + if ((err = mp_init_size(&M[x], P->alloc)) != MP_OKAY) { + for (y = 1<<(winsize-1); y < x; y++) { + mp_clear(&M[y]); + } + mp_clear(&M[1]); + return err; + } + } + + /* determine and setup reduction code */ + if (redmode == 0) { +#ifdef BN_MP_MONTGOMERY_SETUP_C + /* now setup montgomery */ + if ((err = mp_montgomery_setup(P, &mp)) != MP_OKAY) { + goto LBL_M; + } #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - /* automatically pick the comba one if available (saves quite a few calls/ifs) */ + /* automatically pick the comba one if available (saves quite a few calls/ifs) */ #ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C - if ((((P->used * 2) + 1) < MP_WARRAY) && + if ((((P->used * 2) + 1) < MP_WARRAY) && (P->used < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - redux = fast_mp_montgomery_reduce; - } else + redux = fast_mp_montgomery_reduce; + } else #endif - { + { #ifdef BN_MP_MONTGOMERY_REDUCE_C - /* use slower baseline Montgomery method */ - redux = mp_montgomery_reduce; + /* use slower baseline Montgomery method */ + redux = mp_montgomery_reduce; #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - } - } else if (redmode == 1) { + } + } else if (redmode == 1) { #if defined(BN_MP_DR_SETUP_C) && defined(BN_MP_DR_REDUCE_C) - /* setup DR reduction for moduli of the form B**k - b */ - mp_dr_setup(P, &mp); - redux = mp_dr_reduce; + /* setup DR reduction for moduli of the form B**k - b */ + mp_dr_setup(P, &mp); + redux = mp_dr_reduce; #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - } else { + } else { #if defined(BN_MP_REDUCE_2K_SETUP_C) && defined(BN_MP_REDUCE_2K_C) - /* setup DR reduction for moduli of the form 2**k - b */ - if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) { - goto LBL_M; - } - redux = mp_reduce_2k; + /* setup DR reduction for moduli of the form 2**k - b */ + if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) { + goto LBL_M; + } + redux = mp_reduce_2k; #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - } + } - /* setup result */ - if ((err = mp_init_size (&res, P->alloc)) != MP_OKAY) { - goto LBL_M; - } + /* setup result */ + if ((err = mp_init_size(&res, P->alloc)) != MP_OKAY) { + goto LBL_M; + } - /* create M table - * + /* create M table + * - * - * The first half of the table is not computed though accept for M[0] and M[1] - */ + * + * The first half of the table is not computed though accept for M[0] and M[1] + */ - if (redmode == 0) { + if (redmode == 0) { #ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C - /* now we need R mod m */ - if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) { - goto LBL_RES; - } - - /* now set M[1] to G * R mod m */ - if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } + /* now we need R mod m */ + if ((err = mp_montgomery_calc_normalization(&res, P)) != MP_OKAY) { + goto LBL_RES; + } + + /* now set M[1] to G * R mod m */ + if ((err = mp_mulmod(G, &res, P, &M[1])) != MP_OKAY) { + goto LBL_RES; + } #else - err = MP_VAL; - goto LBL_RES; -#endif - } else { - mp_set(&res, 1); - if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } - } - - /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - - for (x = 0; x < (winsize - 1); x++) { - if ((err = mp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { + err = MP_VAL; goto LBL_RES; - } - } +#endif + } else { + mp_set(&res, 1); + if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { + goto LBL_RES; + } + } - /* create upper table */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[x], P, mp)) != MP_OKAY) { + /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ + if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { goto LBL_RES; - } - } - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits so break */ - if (digidx == -1) { - break; + } + + for (x = 0; x < (winsize - 1); x++) { + if ((err = mp_sqr(&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { + goto LBL_RES; } - /* read next digit and reset bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int)DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if ((mode == 0) && (y == 0)) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if ((mode == 1) && (y == 0)) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; + if ((err = redux(&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { + goto LBL_RES; } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; + } + + /* create upper table */ + for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { + if ((err = mp_mul(&M[x - 1], &M[1], &M[x])) != MP_OKAY) { + goto LBL_RES; } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } + if ((err = redux(&M[x], P, mp)) != MP_OKAY) { + goto LBL_RES; + } + } + + /* set initial mode and bit cnt */ + mode = 0; + bitcnt = 1; + buf = 0; + digidx = X->used - 1; + bitcpy = 0; + bitbuf = 0; + + for (;;) { + /* grab next digit as required */ + if (--bitcnt == 0) { + /* if digidx == -1 we are out of digits so break */ + if (digidx == -1) { + break; + } + /* read next digit and reset bitcnt */ + buf = X->dp[digidx--]; + bitcnt = (int)DIGIT_BIT; } - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; + /* grab the next msb from the exponent */ + y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; + buf <<= (mp_digit)1; + + /* if the bit is zero and mode == 0 then we ignore it + * These represent the leading zero bits before the first 1 bit + * in the exponent. Technically this opt is not required but it + * does lower the # of trivial squaring/reductions used + */ + if ((mode == 0) && (y == 0)) { + continue; } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; + + /* if the bit is zero and mode == 1 then we square */ + if ((mode == 1) && (y == 0)) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + continue; } - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if ((mode == 2) && (bitcpy > 0)) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; + /* else we add it to the window */ + bitbuf |= (y << (winsize - ++bitcpy)); + mode = 2; + + if (bitcpy == winsize) { + /* ok window is filled so square as required and multiply */ + /* square first */ + for (x = 0; x < winsize; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + } + + /* then multiply */ + if ((err = mp_mul(&res, &M[bitbuf], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + + /* empty window and reset */ + bitcpy = 0; + bitbuf = 0; + mode = 1; } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; + } + + /* if bits remain then square/multiply */ + if ((mode == 2) && (bitcpy > 0)) { + /* square then multiply if the bit is set */ + for (x = 0; x < bitcpy; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + + /* get next bit of the window */ + bitbuf <<= 1; + if ((bitbuf & (1 << winsize)) != 0) { + /* then multiply */ + if ((err = mp_mul(&res, &M[1], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + } } - - /* get next bit of the window */ - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } + } + + if (redmode == 0) { + /* fixup result if Montgomery reduction is used + * recall that any value in a Montgomery system is + * actually multiplied by R mod n. So we have + * to reduce one more time to cancel out the factor + * of R. + */ + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; } - } - } - - if (redmode == 0) { - /* fixup result if Montgomery reduction is used - * recall that any value in a Montgomery system is - * actually multiplied by R mod n. So we have - * to reduce one more time to cancel out the factor - * of R. - */ - if ((err = redux(&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* swap res with Y */ - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); + } + + /* swap res with Y */ + mp_exch(&res, Y); + err = MP_OKAY; +LBL_RES: + mp_clear(&res); LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; + mp_clear(&M[1]); + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + mp_clear(&M[x]); + } + return err; } #endif diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index 3c9612e..98eef76 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -20,7 +20,7 @@ */ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { - mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; + mp_int u1, u2, u3, v1, v2, v3, t1, t2, t3, q, tmp; int err; if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { @@ -29,47 +29,89 @@ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) /* initialize, (u1,u2,u3) = (1,0,a) */ mp_set(&u1, 1); - if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(a, &u3)) != MP_OKAY) { + goto LBL_ERR; + } /* initialize, (v1,v2,v3) = (0,1,b) */ mp_set(&v2, 1); - if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(b, &v3)) != MP_OKAY) { + goto LBL_ERR; + } /* loop while v3 != 0 */ while (mp_iszero(&v3) == MP_NO) { - /* q = u3/v3 */ - if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto LBL_ERR; } + /* q = u3/v3 */ + if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { + goto LBL_ERR; + } - /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ - if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto LBL_ERR; } + /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ + if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { + goto LBL_ERR; + } - /* (u1,u2,u3) = (v1,v2,v3) */ - if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto LBL_ERR; } + /* (u1,u2,u3) = (v1,v2,v3) */ + if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { + goto LBL_ERR; + } - /* (v1,v2,v3) = (t1,t2,t3) */ - if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto LBL_ERR; } + /* (v1,v2,v3) = (t1,t2,t3) */ + if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { + goto LBL_ERR; + } } /* make sure U3 >= 0 */ if (u3.sign == MP_NEG) { - if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { + goto LBL_ERR; + } } /* copy result out */ - if (U1 != NULL) { mp_exch(U1, &u1); } - if (U2 != NULL) { mp_exch(U2, &u2); } - if (U3 != NULL) { mp_exch(U3, &u3); } + if (U1 != NULL) { + mp_exch(U1, &u1); + } + if (U2 != NULL) { + mp_exch(U2, &u2); + } + if (U3 != NULL) { + mp_exch(U3, &u3); + } err = MP_OKAY; LBL_ERR: diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index 140721b..d0de595 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -20,10 +20,10 @@ int mp_fread(mp_int *a, int radix, FILE *stream) { int err, ch, neg, y; - + /* clear a */ mp_zero(a); - + /* if first digit is - then set negative */ ch = fgetc(stream); if (ch == '-') { @@ -32,18 +32,18 @@ int mp_fread(mp_int *a, int radix, FILE *stream) } else { neg = MP_ZPOS; } - + for (;;) { /* find y in the radix map */ for (y = 0; y < radix; y++) { - if (mp_s_rmap[y] == ch) { - break; - } + if (mp_s_rmap[y] == ch) { + break; + } } if (y == radix) { break; } - + /* shift up and add */ if ((err = mp_mul_d(a, radix, a)) != MP_OKAY) { return err; @@ -51,13 +51,13 @@ int mp_fread(mp_int *a, int radix, FILE *stream) if ((err = mp_add_d(a, y, a)) != MP_OKAY) { return err; } - + ch = fgetc(stream); } if (mp_cmp_d(a, 0) != MP_EQ) { a->sign = neg; } - + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 23b5f64..3641823 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -20,29 +20,29 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) { char *buf; int err, len, x; - + if ((err = mp_radix_size(a, radix, &len)) != MP_OKAY) { return err; } - buf = OPT_CAST(char) XMALLOC (len); + buf = OPT_CAST(char) XMALLOC(len); if (buf == NULL) { return MP_MEM; } - + if ((err = mp_toradix(a, buf, radix)) != MP_OKAY) { - XFREE (buf); + XFREE(buf); return err; } - + for (x = 0; x < len; x++) { - if (fputc(buf[x], stream) == EOF) { - XFREE (buf); - return MP_VAL; - } + if (fputc(buf[x], stream) == EOF) { + XFREE(buf); + return MP_VAL; + } } - - XFREE (buf); + + XFREE(buf); return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index b0be8fb..18f6dc3 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -16,87 +16,89 @@ */ /* Greatest Common Divisor using the binary method */ -int mp_gcd (mp_int * a, mp_int * b, mp_int * c) +int mp_gcd(mp_int *a, mp_int *b, mp_int *c) { - mp_int u, v; - int k, u_lsb, v_lsb, res; + mp_int u, v; + int k, u_lsb, v_lsb, res; - /* either zero than gcd is the largest */ - if (mp_iszero (a) == MP_YES) { - return mp_abs (b, c); - } - if (mp_iszero (b) == MP_YES) { - return mp_abs (a, c); - } + /* either zero than gcd is the largest */ + if (mp_iszero(a) == MP_YES) { + return mp_abs(b, c); + } + if (mp_iszero(b) == MP_YES) { + return mp_abs(a, c); + } - /* get copies of a and b we can modify */ - if ((res = mp_init_copy (&u, a)) != MP_OKAY) { - return res; - } + /* get copies of a and b we can modify */ + if ((res = mp_init_copy(&u, a)) != MP_OKAY) { + return res; + } - if ((res = mp_init_copy (&v, b)) != MP_OKAY) { - goto LBL_U; - } + if ((res = mp_init_copy(&v, b)) != MP_OKAY) { + goto LBL_U; + } - /* must be positive for the remainder of the algorithm */ - u.sign = v.sign = MP_ZPOS; + /* must be positive for the remainder of the algorithm */ + u.sign = v.sign = MP_ZPOS; - /* B1. Find the common power of two for u and v */ - u_lsb = mp_cnt_lsb(&u); - v_lsb = mp_cnt_lsb(&v); - k = MIN(u_lsb, v_lsb); + /* B1. Find the common power of two for u and v */ + u_lsb = mp_cnt_lsb(&u); + v_lsb = mp_cnt_lsb(&v); + k = MIN(u_lsb, v_lsb); - if (k > 0) { - /* divide the power of two out */ - if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } + if (k > 0) { + /* divide the power of two out */ + if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) { + goto LBL_V; + } - if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) { + goto LBL_V; + } + } - /* divide any remaining factors of two out */ - if (u_lsb != k) { - if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + /* divide any remaining factors of two out */ + if (u_lsb != k) { + if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) { + goto LBL_V; + } + } - if (v_lsb != k) { - if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + if (v_lsb != k) { + if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) { + goto LBL_V; + } + } - while (mp_iszero(&v) == MP_NO) { - /* make sure v is the largest */ - if (mp_cmp_mag(&u, &v) == MP_GT) { - /* swap u and v to make sure v is >= u */ - mp_exch(&u, &v); - } - - /* subtract smallest from largest */ - if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) { - goto LBL_V; - } - - /* Divide out all factors of two */ - if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + while (mp_iszero(&v) == MP_NO) { + /* make sure v is the largest */ + if (mp_cmp_mag(&u, &v) == MP_GT) { + /* swap u and v to make sure v is >= u */ + mp_exch(&u, &v); + } - /* multiply by 2**k which we divided out at the beginning */ - if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) { - goto LBL_V; - } - c->sign = MP_ZPOS; - res = MP_OKAY; -LBL_V:mp_clear (&u); -LBL_U:mp_clear (&v); - return res; + /* subtract smallest from largest */ + if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) { + goto LBL_V; + } + + /* Divide out all factors of two */ + if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) { + goto LBL_V; + } + } + + /* multiply by 2**k which we divided out at the beginning */ + if ((res = mp_mul_2d(&u, k, c)) != MP_OKAY) { + goto LBL_V; + } + c->sign = MP_ZPOS; + res = MP_OKAY; +LBL_V: + mp_clear(&u); +LBL_U: + mp_clear(&v); + return res; } #endif diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 5c820f8..a3d1602 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -16,27 +16,27 @@ */ /* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int * a) +unsigned long mp_get_int(mp_int *a) { - int i; - mp_min_u32 res; + int i; + mp_min_u32 res; - if (a->used == 0) { - return 0; - } + if (a->used == 0) { + return 0; + } - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + /* get number of digits of the lsb we have to read */ + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; - /* get most significant digit of result */ - res = DIGIT(a,i); + /* get most significant digit of result */ + res = DIGIT(a, i); - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } + while (--i >= 0) { + res = (res << DIGIT_BIT) | DIGIT(a, i); + } - /* force result to 32-bits always so it is consistent on non 32-bit platforms */ - return res & 0xFFFFFFFFUL; + /* force result to 32-bits always so it is consistent on non 32-bit platforms */ + return res & 0xFFFFFFFFUL; } #endif diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index 7c3d0fe..053930c 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -16,26 +16,26 @@ */ /* get the lower unsigned long of an mp_int, platform dependent */ -unsigned long mp_get_long(mp_int * a) +unsigned long mp_get_long(mp_int *a) { - int i; - unsigned long res; + int i; + unsigned long res; - if (a->used == 0) { - return 0; - } + if (a->used == 0) { + return 0; + } - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + /* get number of digits of the lsb we have to read */ + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; - /* get most significant digit of result */ - res = DIGIT(a,i); + /* get most significant digit of result */ + res = DIGIT(a, i); #if (ULONG_MAX != 0xffffffffuL) || (DIGIT_BIT < 32) - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } + while (--i >= 0) { + res = (res << DIGIT_BIT) | DIGIT(a, i); + } #endif - return res; + return res; } #endif diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 4b959e6..131571a 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -16,26 +16,26 @@ */ /* get the lower unsigned long long of an mp_int, platform dependent */ -unsigned long long mp_get_long_long (mp_int * a) +unsigned long long mp_get_long_long(mp_int *a) { - int i; - unsigned long long res; + int i; + unsigned long long res; - if (a->used == 0) { - return 0; - } + if (a->used == 0) { + return 0; + } - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + /* get number of digits of the lsb we have to read */ + i = MIN(a->used, (int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; - /* get most significant digit of result */ - res = DIGIT(a,i); + /* get most significant digit of result */ + res = DIGIT(a, i); #if DIGIT_BIT < 64 - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } + while (--i >= 0) { + res = (res << DIGIT_BIT) | DIGIT(a, i); + } #endif - return res; + return res; } #endif diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index 74e07b1..0030931 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -16,39 +16,39 @@ */ /* grow as required */ -int mp_grow (mp_int * a, int size) +int mp_grow(mp_int *a, int size) { - int i; - mp_digit *tmp; + int i; + mp_digit *tmp; - /* if the alloc size is smaller alloc more ram */ - if (a->alloc < size) { - /* ensure there are always at least MP_PREC digits extra on top */ - size += (MP_PREC * 2) - (size % MP_PREC); + /* if the alloc size is smaller alloc more ram */ + if (a->alloc < size) { + /* ensure there are always at least MP_PREC digits extra on top */ + size += (MP_PREC * 2) - (size % MP_PREC); - /* reallocate the array a->dp - * - * We store the return in a temporary variable - * in case the operation failed we don't want - * to overwrite the dp member of a. - */ - tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size); - if (tmp == NULL) { - /* reallocation failed but "a" is still valid [can be freed] */ - return MP_MEM; - } + /* reallocate the array a->dp + * + * We store the return in a temporary variable + * in case the operation failed we don't want + * to overwrite the dp member of a. + */ + tmp = OPT_CAST(mp_digit) XREALLOC(a->dp, sizeof(mp_digit) * size); + if (tmp == NULL) { + /* reallocation failed but "a" is still valid [can be freed] */ + return MP_MEM; + } - /* reallocation succeeded so set a->dp */ - a->dp = tmp; + /* reallocation succeeded so set a->dp */ + a->dp = tmp; - /* zero excess digits */ - i = a->alloc; - a->alloc = size; - for (; i < a->alloc; i++) { - a->dp[i] = 0; - } - } - return MP_OKAY; + /* zero excess digits */ + i = a->alloc; + a->alloc = size; + for (; i < a->alloc; i++) { + a->dp[i] = 0; + } + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index df29389..afd735e 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -18,52 +18,50 @@ /* based on gmp's mpz_import. * see http://gmplib.org/manual/Integer-Import-and-Export.html */ -int mp_import(mp_int* rop, size_t count, int order, size_t size, - int endian, size_t nails, const void* op) { - int result; - size_t odd_nails, nail_bytes, i, j; - unsigned char odd_nail_mask; +int mp_import(mp_int *rop, size_t count, int order, size_t size, + int endian, size_t nails, const void *op) +{ + int result; + size_t odd_nails, nail_bytes, i, j; + unsigned char odd_nail_mask; - mp_zero(rop); + mp_zero(rop); - if (endian == 0) { - union { - unsigned int i; - char c[4]; - } lint; - lint.i = 0x01020304; + if (endian == 0) { + union { + unsigned int i; + char c[4]; + } lint; + lint.i = 0x01020304; - endian = (lint.c[0] == 4) ? -1 : 1; - } + endian = (lint.c[0] == 4) ? -1 : 1; + } - odd_nails = (nails % 8); - odd_nail_mask = 0xff; - for (i = 0; i < odd_nails; ++i) { - odd_nail_mask ^= (1 << (7 - i)); - } - nail_bytes = nails / 8; + odd_nails = (nails % 8); + odd_nail_mask = 0xff; + for (i = 0; i < odd_nails; ++i) { + odd_nail_mask ^= (1 << (7 - i)); + } + nail_bytes = nails / 8; - for (i = 0; i < count; ++i) { - for (j = 0; j < (size - nail_bytes); ++j) { - unsigned char byte = *( - (unsigned char*)op + - (((order == 1) ? i : ((count - 1) - i)) * size) + - ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes)) - ); + for (i = 0; i < count; ++i) { + for (j = 0; j < (size - nail_bytes); ++j) { + unsigned char byte = *((unsigned char *)op + + (((order == 1) ? i : ((count - 1) - i)) * size) + + ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes))); - if ( - (result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { - return result; - } + if ((result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { + return result; + } - rop->dp[0] |= (j == 0) ? (byte & odd_nail_mask) : byte; - rop->used += 1; - } - } + rop->dp[0] |= (j == 0) ? (byte & odd_nail_mask) : byte; + rop->used += 1; + } + } - mp_clamp(rop); + mp_clamp(rop); - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index ee374ae..0556aeb 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -16,28 +16,28 @@ */ /* init a new mp_int */ -int mp_init (mp_int * a) +int mp_init(mp_int *a) { - int i; + int i; - /* allocate memory required and clear it */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC); - if (a->dp == NULL) { - return MP_MEM; - } + /* allocate memory required and clear it */ + a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * MP_PREC); + if (a->dp == NULL) { + return MP_MEM; + } - /* set the digits to zero */ - for (i = 0; i < MP_PREC; i++) { + /* set the digits to zero */ + for (i = 0; i < MP_PREC; i++) { a->dp[i] = 0; - } + } - /* set the used to zero, allocated digits to the default precision - * and sign to positive */ - a->used = 0; - a->alloc = MP_PREC; - a->sign = MP_ZPOS; + /* set the used to zero, allocated digits to the default precision + * and sign to positive */ + a->used = 0; + a->alloc = MP_PREC; + a->sign = MP_ZPOS; - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index 37a57ec..c711e06 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -16,19 +16,19 @@ */ /* creates "a" then copies b into it */ -int mp_init_copy (mp_int * a, mp_int * b) +int mp_init_copy(mp_int *a, mp_int *b) { - int res; + int res; - if ((res = mp_init_size (a, b->used)) != MP_OKAY) { - return res; - } + if ((res = mp_init_size(a, b->used)) != MP_OKAY) { + return res; + } - if((res = mp_copy (b, a)) != MP_OKAY) { - mp_clear(a); - } + if ((res = mp_copy(b, a)) != MP_OKAY) { + mp_clear(a); + } - return res; + return res; } #endif diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index 73d6a0f..0da7803 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -16,37 +16,37 @@ */ #include -int mp_init_multi(mp_int *mp, ...) +int mp_init_multi(mp_int *mp, ...) { - mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ - int n = 0; /* Number of ok inits */ - mp_int* cur_arg = mp; - va_list args; + mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ + int n = 0; /* Number of ok inits */ + mp_int *cur_arg = mp; + va_list args; - va_start(args, mp); /* init args to next argument from caller */ - while (cur_arg != NULL) { - if (mp_init(cur_arg) != MP_OKAY) { - /* Oops - error! Back-track and mp_clear what we already - succeeded in init-ing, then return error. - */ - va_list clean_args; - - /* now start cleaning up */ - cur_arg = mp; - va_start(clean_args, mp); - while (n-- != 0) { - mp_clear(cur_arg); - cur_arg = va_arg(clean_args, mp_int*); - } - va_end(clean_args); - res = MP_MEM; - break; - } - n++; - cur_arg = va_arg(args, mp_int*); - } - va_end(args); - return res; /* Assumed ok, if error flagged above. */ + va_start(args, mp); /* init args to next argument from caller */ + while (cur_arg != NULL) { + if (mp_init(cur_arg) != MP_OKAY) { + /* Oops - error! Back-track and mp_clear what we already + succeeded in init-ing, then return error. + */ + va_list clean_args; + + /* now start cleaning up */ + cur_arg = mp; + va_start(clean_args, mp); + while (n-- != 0) { + mp_clear(cur_arg); + cur_arg = va_arg(clean_args, mp_int *); + } + va_end(clean_args); + res = MP_MEM; + break; + } + n++; + cur_arg = va_arg(args, mp_int *); + } + va_end(args); + return res; /* Assumed ok, if error flagged above. */ } #endif diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index ed4955c..e9c1b12 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -16,14 +16,14 @@ */ /* initialize and set a digit */ -int mp_init_set (mp_int * a, mp_digit b) +int mp_init_set(mp_int *a, mp_digit b) { - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - mp_set(a, b); - return err; + int err; + if ((err = mp_init(a)) != MP_OKAY) { + return err; + } + mp_set(a, b); + return err; } #endif diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index 1bc1942..8e7441a 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -16,13 +16,13 @@ */ /* initialize and set a digit */ -int mp_init_set_int (mp_int * a, unsigned long b) +int mp_init_set_int(mp_int *a, unsigned long b) { - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - return mp_set_int(a, b); + int err; + if ((err = mp_init(a)) != MP_OKAY) { + return err; + } + return mp_set_int(a, b); } #endif diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index 4446773..623a03f 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -16,30 +16,30 @@ */ /* init an mp_init for a given size */ -int mp_init_size (mp_int * a, int size) +int mp_init_size(mp_int *a, int size) { - int x; + int x; - /* pad size so there are always extra digits */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* alloc mem */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size); - if (a->dp == NULL) { - return MP_MEM; - } + /* pad size so there are always extra digits */ + size += (MP_PREC * 2) - (size % MP_PREC); - /* set the members */ - a->used = 0; - a->alloc = size; - a->sign = MP_ZPOS; + /* alloc mem */ + a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * size); + if (a->dp == NULL) { + return MP_MEM; + } - /* zero the digits */ - for (x = 0; x < size; x++) { + /* set the members */ + a->used = 0; + a->alloc = size; + a->sign = MP_ZPOS; + + /* zero the digits */ + for (x = 0; x < size; x++) { a->dp[x] = 0; - } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index 36011d0..b70fe18 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -16,24 +16,24 @@ */ /* hac 14.61, pp608 */ -int mp_invmod (mp_int * a, mp_int * b, mp_int * c) +int mp_invmod(mp_int *a, mp_int *b, mp_int *c) { - /* b cannot be negative */ - if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { - return MP_VAL; - } + /* b cannot be negative */ + if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { + return MP_VAL; + } #ifdef BN_FAST_MP_INVMOD_C - /* if the modulus is odd we can use a faster routine instead */ - if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { - return fast_mp_invmod (a, b, c); - } + /* if the modulus is odd we can use a faster routine instead */ + if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { + return fast_mp_invmod(a, b, c); + } #endif #ifdef BN_MP_INVMOD_SLOW_C - return mp_invmod_slow(a, b, c); + return mp_invmod_slow(a, b, c); #else - return MP_VAL; + return MP_VAL; #endif } #endif diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index ff0d5ae..2bdd2b1 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -16,157 +16,158 @@ */ /* hac 14.61, pp608 */ -int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c) +int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c) { - mp_int x, y, u, v, A, B, C, D; - int res; - - /* b cannot be negative */ - if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { - return MP_VAL; - } - - /* init temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, - &A, &B, &C, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x = a, y = b */ - if ((res = mp_mod(a, b, &x)) != MP_OKAY) { + mp_int x, y, u, v, A, B, C, D; + int res; + + /* b cannot be negative */ + if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { + return MP_VAL; + } + + /* init temps */ + if ((res = mp_init_multi(&x, &y, &u, &v, + &A, &B, &C, &D, NULL)) != MP_OKAY) { + return res; + } + + /* x = a, y = b */ + if ((res = mp_mod(a, b, &x)) != MP_OKAY) { goto LBL_ERR; - } - if ((res = mp_copy (b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 2. [modified] if x,y are both even then return an error! */ - if ((mp_iseven (&x) == MP_YES) && (mp_iseven (&y) == MP_YES)) { - res = MP_VAL; - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&A, 1); - mp_set (&D, 1); + } + if ((res = mp_copy(b, &y)) != MP_OKAY) { + goto LBL_ERR; + } -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == MP_YES) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { + /* 2. [modified] if x,y are both even then return an error! */ + if ((mp_iseven(&x) == MP_YES) && (mp_iseven(&y) == MP_YES)) { + res = MP_VAL; + goto LBL_ERR; + } + + /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ + if ((res = mp_copy(&x, &u)) != MP_OKAY) { + goto LBL_ERR; + } + if ((res = mp_copy(&y, &v)) != MP_OKAY) { goto LBL_ERR; - } - /* 4.2 if A or B is odd then */ - if ((mp_isodd (&A) == MP_YES) || (mp_isodd (&B) == MP_YES)) { - /* A = (A+y)/2, B = (B-x)/2 */ - if ((res = mp_add (&A, &y, &A)) != MP_OKAY) { + } + mp_set(&A, 1); + mp_set(&D, 1); + +top: + /* 4. while u is even do */ + while (mp_iseven(&u) == MP_YES) { + /* 4.1 u = u/2 */ + if ((res = mp_div_2(&u, &u)) != MP_OKAY) { goto LBL_ERR; } - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { + /* 4.2 if A or B is odd then */ + if ((mp_isodd(&A) == MP_YES) || (mp_isodd(&B) == MP_YES)) { + /* A = (A+y)/2, B = (B-x)/2 */ + if ((res = mp_add(&A, &y, &A)) != MP_OKAY) { + goto LBL_ERR; + } + if ((res = mp_sub(&B, &x, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* A = A/2, B = B/2 */ + if ((res = mp_div_2(&A, &A)) != MP_OKAY) { goto LBL_ERR; } - } - /* A = A/2, B = B/2 */ - if ((res = mp_div_2 (&A, &A)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } + if ((res = mp_div_2(&B, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } - /* 5. while v is even do */ - while (mp_iseven (&v) == MP_YES) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if C or D is odd then */ - if ((mp_isodd (&C) == MP_YES) || (mp_isodd (&D) == MP_YES)) { - /* C = (C+y)/2, D = (D-x)/2 */ - if ((res = mp_add (&C, &y, &C)) != MP_OKAY) { + /* 5. while v is even do */ + while (mp_iseven(&v) == MP_YES) { + /* 5.1 v = v/2 */ + if ((res = mp_div_2(&v, &v)) != MP_OKAY) { goto LBL_ERR; } - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { + /* 5.2 if C or D is odd then */ + if ((mp_isodd(&C) == MP_YES) || (mp_isodd(&D) == MP_YES)) { + /* C = (C+y)/2, D = (D-x)/2 */ + if ((res = mp_add(&C, &y, &C)) != MP_OKAY) { + goto LBL_ERR; + } + if ((res = mp_sub(&D, &x, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* C = C/2, D = D/2 */ + if ((res = mp_div_2(&C, &C)) != MP_OKAY) { goto LBL_ERR; } - } - /* C = C/2, D = D/2 */ - if ((res = mp_div_2 (&C, &C)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } + if ((res = mp_div_2(&D, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, A = A - C, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { - goto LBL_ERR; - } + /* 6. if u >= v then */ + if (mp_cmp(&u, &v) != MP_LT) { + /* u = u - v, A = A - C, B = B - D */ + if ((res = mp_sub(&u, &v, &u)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&A, &C, &A)) != MP_OKAY) { - goto LBL_ERR; - } + if ((res = mp_sub(&A, &C, &A)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } else { - /* v - v - u, C = C - A, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { - goto LBL_ERR; - } + if ((res = mp_sub(&B, &D, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } else { + /* v - v - u, C = C - A, D = D - B */ + if ((res = mp_sub(&v, &u, &v)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&C, &A, &C)) != MP_OKAY) { - goto LBL_ERR; - } + if ((res = mp_sub(&C, &A, &C)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } + if ((res = mp_sub(&D, &B, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } - /* if not zero goto step 4 */ - if (mp_iszero (&u) == MP_NO) - goto top; + /* if not zero goto step 4 */ + if (mp_iszero(&u) == MP_NO) + goto top; - /* now a = C, b = D, gcd == g*v */ + /* now a = C, b = D, gcd == g*v */ - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } + /* if v != 1 then there is no inverse */ + if (mp_cmp_d(&v, 1) != MP_EQ) { + res = MP_VAL; + goto LBL_ERR; + } - /* if its too low */ - while (mp_cmp_d(&C, 0) == MP_LT) { + /* if its too low */ + while (mp_cmp_d(&C, 0) == MP_LT) { if ((res = mp_add(&C, b, &C)) != MP_OKAY) { goto LBL_ERR; } - } - - /* too big */ - while (mp_cmp_mag(&C, b) != MP_LT) { + } + + /* too big */ + while (mp_cmp_mag(&C, b) != MP_LT) { if ((res = mp_sub(&C, b, &C)) != MP_OKAY) { goto LBL_ERR; } - } - - /* C is now the inverse */ - mp_exch (&C, c); - res = MP_OKAY; -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); - return res; + } + + /* C is now the inverse */ + mp_exch(&C, c); + res = MP_OKAY; +LBL_ERR: + mp_clear_multi(&x, &y, &u, &v, &A, &B, &C, &D, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index dd08d58..303fab6 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -17,90 +17,91 @@ /* Check if remainders are possible squares - fast exclude non-squares */ static const char rem_128[128] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 + 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }; static const char rem_105[105] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 + 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, + 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg,int *ret) +int mp_is_square(mp_int *arg, int *ret) { - int res; - mp_digit c; - mp_int t; - unsigned long r; + int res; + mp_digit c; + mp_int t; + unsigned long r; - /* Default to Non-square :) */ - *ret = MP_NO; + /* Default to Non-square :) */ + *ret = MP_NO; - if (arg->sign == MP_NEG) { - return MP_VAL; - } + if (arg->sign == MP_NEG) { + return MP_VAL; + } - /* digits used? (TSD) */ - if (arg->used == 0) { - return MP_OKAY; - } + /* digits used? (TSD) */ + if (arg->used == 0) { + return MP_OKAY; + } - /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127 & DIGIT(arg,0)] == 1) { - return MP_OKAY; - } + /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ + if (rem_128[127 & DIGIT(arg, 0)] == 1) { + return MP_OKAY; + } - /* Next check mod 105 (3*5*7) */ - if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { - return res; - } - if (rem_105[c] == 1) { - return MP_OKAY; - } + /* Next check mod 105 (3*5*7) */ + if ((res = mp_mod_d(arg, 105, &c)) != MP_OKAY) { + return res; + } + if (rem_105[c] == 1) { + return MP_OKAY; + } - if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { - return res; - } - if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { - goto ERR; - } - r = mp_get_int(&t); - /* Check for other prime modules, note it's not an ERROR but we must - * free "t" so the easiest way is to goto ERR. We know that res - * is already equal to MP_OKAY from the mp_mod call - */ - if (((1L<<(r%11)) & 0x5C4L) != 0L) goto ERR; - if (((1L<<(r%13)) & 0x9E4L) != 0L) goto ERR; - if (((1L<<(r%17)) & 0x5CE8L) != 0L) goto ERR; - if (((1L<<(r%19)) & 0x4F50CL) != 0L) goto ERR; - if (((1L<<(r%23)) & 0x7ACCA0L) != 0L) goto ERR; - if (((1L<<(r%29)) & 0xC2EDD0CL) != 0L) goto ERR; - if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR; + if ((res = mp_init_set_int(&t, 11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { + return res; + } + if ((res = mp_mod(arg, &t, &t)) != MP_OKAY) { + goto ERR; + } + r = mp_get_int(&t); + /* Check for other prime modules, note it's not an ERROR but we must + * free "t" so the easiest way is to goto ERR. We know that res + * is already equal to MP_OKAY from the mp_mod call + */ + if (((1L<<(r%11)) & 0x5C4L) != 0L) goto ERR; + if (((1L<<(r%13)) & 0x9E4L) != 0L) goto ERR; + if (((1L<<(r%17)) & 0x5CE8L) != 0L) goto ERR; + if (((1L<<(r%19)) & 0x4F50CL) != 0L) goto ERR; + if (((1L<<(r%23)) & 0x7ACCA0L) != 0L) goto ERR; + if (((1L<<(r%29)) & 0xC2EDD0CL) != 0L) goto ERR; + if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR; - /* Final check - is sqr(sqrt(arg)) == arg ? */ - if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&t,&t)) != MP_OKAY) { - goto ERR; - } + /* Final check - is sqr(sqrt(arg)) == arg ? */ + if ((res = mp_sqrt(arg, &t)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sqr(&t, &t)) != MP_OKAY) { + goto ERR; + } - *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO; -ERR:mp_clear(&t); - return res; + *ret = (mp_cmp_mag(&t, arg) == MP_EQ) ? MP_YES : MP_NO; +ERR: + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 5fc8593..8981393 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -20,95 +20,97 @@ * HAC is wrong here, as the special case of (0 | 1) is not * handled correctly. */ -int mp_jacobi (mp_int * a, mp_int * n, int *c) +int mp_jacobi(mp_int *a, mp_int *n, int *c) { - mp_int a1, p1; - int k, s, r, res; - mp_digit residue; + mp_int a1, p1; + int k, s, r, res; + mp_digit residue; - /* if a < 0 return MP_VAL */ - if (mp_isneg(a) == MP_YES) { - return MP_VAL; - } + /* if a < 0 return MP_VAL */ + if (mp_isneg(a) == MP_YES) { + return MP_VAL; + } - /* if n <= 0 return MP_VAL */ - if (mp_cmp_d(n, 0) != MP_GT) { - return MP_VAL; - } + /* if n <= 0 return MP_VAL */ + if (mp_cmp_d(n, 0) != MP_GT) { + return MP_VAL; + } - /* step 1. handle case of a == 0 */ - if (mp_iszero (a) == MP_YES) { - /* special case of a == 0 and n == 1 */ - if (mp_cmp_d (n, 1) == MP_EQ) { - *c = 1; - } else { - *c = 0; - } - return MP_OKAY; - } + /* step 1. handle case of a == 0 */ + if (mp_iszero(a) == MP_YES) { + /* special case of a == 0 and n == 1 */ + if (mp_cmp_d(n, 1) == MP_EQ) { + *c = 1; + } else { + *c = 0; + } + return MP_OKAY; + } - /* step 2. if a == 1, return 1 */ - if (mp_cmp_d (a, 1) == MP_EQ) { - *c = 1; - return MP_OKAY; - } + /* step 2. if a == 1, return 1 */ + if (mp_cmp_d(a, 1) == MP_EQ) { + *c = 1; + return MP_OKAY; + } - /* default */ - s = 0; + /* default */ + s = 0; - /* step 3. write a = a1 * 2**k */ - if ((res = mp_init_copy (&a1, a)) != MP_OKAY) { - return res; - } + /* step 3. write a = a1 * 2**k */ + if ((res = mp_init_copy(&a1, a)) != MP_OKAY) { + return res; + } - if ((res = mp_init (&p1)) != MP_OKAY) { - goto LBL_A1; - } + if ((res = mp_init(&p1)) != MP_OKAY) { + goto LBL_A1; + } - /* divide out larger power of two */ - k = mp_cnt_lsb(&a1); - if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) { - goto LBL_P1; - } - - /* step 4. if e is even set s=1 */ - if ((k & 1) == 0) { - s = 1; - } else { - /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ - residue = n->dp[0] & 7; + /* divide out larger power of two */ + k = mp_cnt_lsb(&a1); + if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) { + goto LBL_P1; + } - if ((residue == 1) || (residue == 7)) { + /* step 4. if e is even set s=1 */ + if ((k & 1) == 0) { s = 1; - } else if ((residue == 3) || (residue == 5)) { - s = -1; - } - } + } else { + /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ + residue = n->dp[0] & 7; - /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ - if ( ((n->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) { - s = -s; - } + if ((residue == 1) || (residue == 7)) { + s = 1; + } else if ((residue == 3) || (residue == 5)) { + s = -1; + } + } - /* if a1 == 1 we're done */ - if (mp_cmp_d (&a1, 1) == MP_EQ) { - *c = s; - } else { - /* n1 = n mod a1 */ - if ((res = mp_mod (n, &a1, &p1)) != MP_OKAY) { - goto LBL_P1; - } - if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) { - goto LBL_P1; - } - *c = s * r; - } + /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ + if (((n->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) { + s = -s; + } + + /* if a1 == 1 we're done */ + if (mp_cmp_d(&a1, 1) == MP_EQ) { + *c = s; + } else { + /* n1 = n mod a1 */ + if ((res = mp_mod(n, &a1, &p1)) != MP_OKAY) { + goto LBL_P1; + } + if ((res = mp_jacobi(&p1, &a1, &r)) != MP_OKAY) { + goto LBL_P1; + } + *c = s * r; + } - /* done */ - res = MP_OKAY; -LBL_P1:mp_clear (&p1); -LBL_A1:mp_clear (&a1); - return res; + /* done */ + res = MP_OKAY; +LBL_P1: + mp_clear(&p1); +LBL_A1: + mp_clear(&a1); + return res; } #endif diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 4d982c7..353c37c 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -15,150 +15,157 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* c = |a| * |b| using Karatsuba Multiplication using +/* c = |a| * |b| using Karatsuba Multiplication using * three half size multiplications * - * Let B represent the radix [e.g. 2**DIGIT_BIT] and - * let n represent half of the number of digits in + * Let B represent the radix [e.g. 2**DIGIT_BIT] and + * let n represent half of the number of digits in * the min(a,b) * * a = a1 * B**n + a0 * b = b1 * B**n + b0 * - * Then, a * b => + * Then, a * b => a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0 * - * Note that a1b1 and a0b0 are used twice and only need to be - * computed once. So in total three half size (half # of - * digit) multiplications are performed, a0b0, a1b1 and + * Note that a1b1 and a0b0 are used twice and only need to be + * computed once. So in total three half size (half # of + * digit) multiplications are performed, a0b0, a1b1 and * (a1+b1)(a0+b0) * * Note that a multiplication of half the digits requires - * 1/4th the number of single precision multiplications so in - * total after one call 25% of the single precision multiplications - * are saved. Note also that the call to mp_mul can end up back - * in this function if the a0, a1, b0, or b1 are above the threshold. - * This is known as divide-and-conquer and leads to the famous - * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than - * the standard O(N**2) that the baseline/comba methods use. - * Generally though the overhead of this method doesn't pay off + * 1/4th the number of single precision multiplications so in + * total after one call 25% of the single precision multiplications + * are saved. Note also that the call to mp_mul can end up back + * in this function if the a0, a1, b0, or b1 are above the threshold. + * This is known as divide-and-conquer and leads to the famous + * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than + * the standard O(N**2) that the baseline/comba methods use. + * Generally though the overhead of this method doesn't pay off * until a certain size (N ~ 80) is reached. */ -int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c) { - mp_int x0, x1, y0, y1, t1, x0y0, x1y1; - int B, err; - - /* default the return code to an error */ - err = MP_MEM; - - /* min # of digits */ - B = MIN (a->used, b->used); - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - if (mp_init_size (&y0, B) != MP_OKAY) - goto X1; - if (mp_init_size (&y1, b->used - B) != MP_OKAY) - goto Y0; - - /* init temps */ - if (mp_init_size (&t1, B * 2) != MP_OKAY) - goto Y1; - if (mp_init_size (&x0y0, B * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x1y1, B * 2) != MP_OKAY) - goto X0Y0; - - /* now shift the digits */ - x0.used = y0.used = B; - x1.used = a->used - B; - y1.used = b->used - B; - - { - int x; - mp_digit *tmpa, *tmpb, *tmpx, *tmpy; - - /* we copy the digits directly instead of using higher level functions - * since we also need to shift the digits - */ - tmpa = a->dp; - tmpb = b->dp; - - tmpx = x0.dp; - tmpy = y0.dp; - for (x = 0; x < B; x++) { - *tmpx++ = *tmpa++; - *tmpy++ = *tmpb++; - } - - tmpx = x1.dp; - for (x = B; x < a->used; x++) { - *tmpx++ = *tmpa++; - } - - tmpy = y1.dp; - for (x = B; x < b->used; x++) { - *tmpy++ = *tmpb++; - } - } - - /* only need to clamp the lower words since by definition the - * upper words x1/y1 must have a known number of digits - */ - mp_clamp (&x0); - mp_clamp (&y0); - - /* now calc the products x0y0 and x1y1 */ - /* after this x0 is no longer required, free temp [x0==t2]! */ - if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY) - goto X1Y1; /* x0y0 = x0*y0 */ - if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) - goto X1Y1; /* x1y1 = x1*y1 */ - - /* now calc x1+x0 and y1+y0 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = x1 - x0 */ - if (s_mp_add (&y1, &y0, &x0) != MP_OKAY) - goto X1Y1; /* t2 = y1 - y0 */ - if (mp_mul (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ - - /* add x0y0 */ - if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) - goto X1Y1; /* t2 = x0y0 + x1y1 */ - if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))<used, b->used); + + /* now divide in two */ + B = B >> 1; + + /* init copy all the temps */ + if (mp_init_size(&x0, B) != MP_OKAY) + goto ERR; + if (mp_init_size(&x1, a->used - B) != MP_OKAY) + goto X0; + if (mp_init_size(&y0, B) != MP_OKAY) + goto X1; + if (mp_init_size(&y1, b->used - B) != MP_OKAY) + goto Y0; + + /* init temps */ + if (mp_init_size(&t1, B * 2) != MP_OKAY) + goto Y1; + if (mp_init_size(&x0y0, B * 2) != MP_OKAY) + goto T1; + if (mp_init_size(&x1y1, B * 2) != MP_OKAY) + goto X0Y0; + + /* now shift the digits */ + x0.used = y0.used = B; + x1.used = a->used - B; + y1.used = b->used - B; + + { + int x; + mp_digit *tmpa, *tmpb, *tmpx, *tmpy; + + /* we copy the digits directly instead of using higher level functions + * since we also need to shift the digits + */ + tmpa = a->dp; + tmpb = b->dp; + + tmpx = x0.dp; + tmpy = y0.dp; + for (x = 0; x < B; x++) { + *tmpx++ = *tmpa++; + *tmpy++ = *tmpb++; + } + + tmpx = x1.dp; + for (x = B; x < a->used; x++) { + *tmpx++ = *tmpa++; + } + + tmpy = y1.dp; + for (x = B; x < b->used; x++) { + *tmpy++ = *tmpb++; + } + } + + /* only need to clamp the lower words since by definition the + * upper words x1/y1 must have a known number of digits + */ + mp_clamp(&x0); + mp_clamp(&y0); + + /* now calc the products x0y0 and x1y1 */ + /* after this x0 is no longer required, free temp [x0==t2]! */ + if (mp_mul(&x0, &y0, &x0y0) != MP_OKAY) + goto X1Y1; /* x0y0 = x0*y0 */ + if (mp_mul(&x1, &y1, &x1y1) != MP_OKAY) + goto X1Y1; /* x1y1 = x1*y1 */ + + /* now calc x1+x0 and y1+y0 */ + if (s_mp_add(&x1, &x0, &t1) != MP_OKAY) + goto X1Y1; /* t1 = x1 - x0 */ + if (s_mp_add(&y1, &y0, &x0) != MP_OKAY) + goto X1Y1; /* t2 = y1 - y0 */ + if (mp_mul(&t1, &x0, &t1) != MP_OKAY) + goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ + + /* add x0y0 */ + if (mp_add(&x0y0, &x1y1, &x0) != MP_OKAY) + goto X1Y1; /* t2 = x0y0 + x1y1 */ + if (s_mp_sub(&t1, &x0, &t1) != MP_OKAY) + goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ + + /* shift by B */ + if (mp_lshd(&t1, B) != MP_OKAY) + goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))<used; - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - - /* init temps */ - if (mp_init_size (&t1, a->used * 2) != MP_OKAY) - goto X1; - if (mp_init_size (&t2, a->used * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x0x0, B * 2) != MP_OKAY) - goto T2; - if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY) - goto X0X0; - - { - int x; - mp_digit *dst, *src; - - src = a->dp; - - /* now shift the digits */ - dst = x0.dp; - for (x = 0; x < B; x++) { - *dst++ = *src++; - } - - dst = x1.dp; - for (x = B; x < a->used; x++) { - *dst++ = *src++; - } - } - - x0.used = B; - x1.used = a->used - B; - - mp_clamp (&x0); - - /* now calc the products x0*x0 and x1*x1 */ - if (mp_sqr (&x0, &x0x0) != MP_OKAY) - goto X1X1; /* x0x0 = x0*x0 */ - if (mp_sqr (&x1, &x1x1) != MP_OKAY) - goto X1X1; /* x1x1 = x1*x1 */ - - /* now calc (x1+x0)**2 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1X1; /* t1 = x1 - x0 */ - if (mp_sqr (&t1, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ - - /* add x0y0 */ - if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) - goto X1X1; /* t2 = x0x0 + x1x1 */ - if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))<used; + + /* now divide in two */ + B = B >> 1; + + /* init copy all the temps */ + if (mp_init_size(&x0, B) != MP_OKAY) + goto ERR; + if (mp_init_size(&x1, a->used - B) != MP_OKAY) + goto X0; + + /* init temps */ + if (mp_init_size(&t1, a->used * 2) != MP_OKAY) + goto X1; + if (mp_init_size(&t2, a->used * 2) != MP_OKAY) + goto T1; + if (mp_init_size(&x0x0, B * 2) != MP_OKAY) + goto T2; + if (mp_init_size(&x1x1, (a->used - B) * 2) != MP_OKAY) + goto X0X0; + + { + int x; + mp_digit *dst, *src; + + src = a->dp; + + /* now shift the digits */ + dst = x0.dp; + for (x = 0; x < B; x++) { + *dst++ = *src++; + } + + dst = x1.dp; + for (x = B; x < a->used; x++) { + *dst++ = *src++; + } + } + + x0.used = B; + x1.used = a->used - B; + + mp_clamp(&x0); + + /* now calc the products x0*x0 and x1*x1 */ + if (mp_sqr(&x0, &x0x0) != MP_OKAY) + goto X1X1; /* x0x0 = x0*x0 */ + if (mp_sqr(&x1, &x1x1) != MP_OKAY) + goto X1X1; /* x1x1 = x1*x1 */ + + /* now calc (x1+x0)**2 */ + if (s_mp_add(&x1, &x0, &t1) != MP_OKAY) + goto X1X1; /* t1 = x1 - x0 */ + if (mp_sqr(&t1, &t1) != MP_OKAY) + goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ + + /* add x0y0 */ + if (s_mp_add(&x0x0, &x1x1, &t2) != MP_OKAY) + goto X1X1; /* t2 = x0x0 + x1x1 */ + if (s_mp_sub(&t1, &t2, &t1) != MP_OKAY) + goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ + + /* shift by B */ + if (mp_lshd(&t1, B) != MP_OKAY) + goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))<sign = MP_ZPOS; + int res; + mp_int t1, t2; + + + if ((res = mp_init_multi(&t1, &t2, NULL)) != MP_OKAY) { + return res; + } + + /* t1 = get the GCD of the two inputs */ + if ((res = mp_gcd(a, b, &t1)) != MP_OKAY) { + goto LBL_T; + } + + /* divide the smallest by the GCD */ + if (mp_cmp_mag(a, b) == MP_LT) { + /* store quotient in t2 such that t2 * b is the LCM */ + if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) { + goto LBL_T; + } + res = mp_mul(b, &t2, c); + } else { + /* store quotient in t2 such that t2 * a is the LCM */ + if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) { + goto LBL_T; + } + res = mp_mul(a, &t2, c); + } + + /* fix the sign to positive */ + c->sign = MP_ZPOS; LBL_T: - mp_clear_multi (&t1, &t2, NULL); - return res; + mp_clear_multi(&t1, &t2, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index 0143e94..888989a 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -16,49 +16,49 @@ */ /* shift left a certain amount of digits */ -int mp_lshd (mp_int * a, int b) +int mp_lshd(mp_int *a, int b) { - int x, res; + int x, res; - /* if its less than zero return */ - if (b <= 0) { - return MP_OKAY; - } + /* if its less than zero return */ + if (b <= 0) { + return MP_OKAY; + } - /* grow to fit the new digits */ - if (a->alloc < (a->used + b)) { - if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { - return res; - } - } + /* grow to fit the new digits */ + if (a->alloc < (a->used + b)) { + if ((res = mp_grow(a, a->used + b)) != MP_OKAY) { + return res; + } + } - { - mp_digit *top, *bottom; + { + mp_digit *top, *bottom; - /* increment the used by the shift amount then copy upwards */ - a->used += b; + /* increment the used by the shift amount then copy upwards */ + a->used += b; - /* top */ - top = a->dp + a->used - 1; + /* top */ + top = a->dp + a->used - 1; - /* base */ - bottom = (a->dp + a->used - 1) - b; + /* base */ + bottom = (a->dp + a->used - 1) - b; - /* much like mp_rshd this is implemented using a sliding window - * except the window goes the otherway around. Copying from - * the bottom to the top. see bn_mp_rshd.c for more info. - */ - for (x = a->used - 1; x >= b; x--) { - *top-- = *bottom--; - } + /* much like mp_rshd this is implemented using a sliding window + * except the window goes the otherway around. Copying from + * the bottom to the top. see bn_mp_rshd.c for more info. + */ + for (x = a->used - 1; x >= b; x--) { + *top-- = *bottom--; + } - /* zero the lower digits */ - top = a->dp; - for (x = 0; x < b; x++) { - *top++ = 0; - } - } - return MP_OKAY; + /* zero the lower digits */ + top = a->dp; + for (x = 0; x < b; x++) { + *top++ = 0; + } + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 06240a0..267688c 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -16,30 +16,29 @@ */ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ -int -mp_mod (mp_int * a, mp_int * b, mp_int * c) +int mp_mod(mp_int *a, mp_int *b, mp_int *c) { - mp_int t; - int res; + mp_int t; + int res; - if ((res = mp_init_size (&t, b->used)) != MP_OKAY) { - return res; - } + if ((res = mp_init_size(&t, b->used)) != MP_OKAY) { + return res; + } - if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } + if ((res = mp_div(a, b, NULL, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } - if ((mp_iszero(&t) != MP_NO) || (t.sign == b->sign)) { - res = MP_OKAY; - mp_exch (&t, c); - } else { - res = mp_add (b, &t, c); - } + if ((mp_iszero(&t) != MP_NO) || (t.sign == b->sign)) { + res = MP_OKAY; + mp_exch(&t, c); + } else { + res = mp_add(b, &t, c); + } - mp_clear (&t); - return res; + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 2bb86da..59270b9 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -16,37 +16,36 @@ */ /* calc a value mod 2**b */ -int -mp_mod_2d (mp_int * a, int b, mp_int * c) +int mp_mod_2d(mp_int *a, int b, mp_int *c) { - int x, res; + int x, res; - /* if b is <= 0 then zero the int */ - if (b <= 0) { - mp_zero (c); - return MP_OKAY; - } + /* if b is <= 0 then zero the int */ + if (b <= 0) { + mp_zero(c); + return MP_OKAY; + } - /* if the modulus is larger than the value than return */ - if (b >= (int) (a->used * DIGIT_BIT)) { - res = mp_copy (a, c); - return res; - } + /* if the modulus is larger than the value than return */ + if (b >= (int)(a->used * DIGIT_BIT)) { + res = mp_copy(a, c); + return res; + } - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } + /* copy */ + if ((res = mp_copy(a, c)) != MP_OKAY) { + return res; + } - /* zero digits above the last digit of the modulus */ - for (x = (b / DIGIT_BIT) + (((b % DIGIT_BIT) == 0) ? 0 : 1); x < c->used; x++) { - c->dp[x] = 0; - } - /* clear the digit that is not completely outside/inside the modulus */ - c->dp[b / DIGIT_BIT] &= - (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1)); - mp_clamp (c); - return MP_OKAY; + /* zero digits above the last digit of the modulus */ + for (x = (b / DIGIT_BIT) + (((b % DIGIT_BIT) == 0) ? 0 : 1); x < c->used; x++) { + c->dp[x] = 0; + } + /* clear the digit that is not completely outside/inside the modulus */ + c->dp[b / DIGIT_BIT] &= + (mp_digit)((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1)); + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index bf2ccaa..ff77346 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -15,10 +15,9 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -int -mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) +int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c) { - return mp_div_d(a, b, NULL, c); + return mp_div_d(a, b, NULL, c); } #endif diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 679a871..2d95140 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -21,36 +21,36 @@ * The method is slightly modified to shift B unconditionally upto just under * the leading bit of b. This saves alot of multiple precision shifting. */ -int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) +int mp_montgomery_calc_normalization(mp_int *a, mp_int *b) { - int x, bits, res; + int x, bits, res; - /* how many bits of last digit does b use */ - bits = mp_count_bits (b) % DIGIT_BIT; + /* how many bits of last digit does b use */ + bits = mp_count_bits(b) % DIGIT_BIT; - if (b->used > 1) { - if ((res = mp_2expt (a, ((b->used - 1) * DIGIT_BIT) + bits - 1)) != MP_OKAY) { - return res; - } - } else { - mp_set(a, 1); - bits = 1; - } + if (b->used > 1) { + if ((res = mp_2expt(a, ((b->used - 1) * DIGIT_BIT) + bits - 1)) != MP_OKAY) { + return res; + } + } else { + mp_set(a, 1); + bits = 1; + } - /* now compute C = A * B mod b */ - for (x = bits - 1; x < (int)DIGIT_BIT; x++) { - if ((res = mp_mul_2 (a, a)) != MP_OKAY) { - return res; - } - if (mp_cmp_mag (a, b) != MP_LT) { - if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { - return res; + /* now compute C = A * B mod b */ + for (x = bits - 1; x < (int)DIGIT_BIT; x++) { + if ((res = mp_mul_2(a, a)) != MP_OKAY) { + return res; + } + if (mp_cmp_mag(a, b) != MP_LT) { + if ((res = s_mp_sub(a, b, a)) != MP_OKAY) { + return res; + } } - } - } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index 05e8bfa..1909997 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -16,100 +16,99 @@ */ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int -mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) +int mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) { - int ix, res, digs; - mp_digit mu; - - /* can the fast reduction [comba] method be used? - * - * Note that unlike in mul you're safely allowed *less* - * than the available columns [255 per default] since carries - * are fixed up in the inner loop. - */ - digs = (n->used * 2) + 1; - if ((digs < MP_WARRAY) && - (n->used < - (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - return fast_mp_montgomery_reduce (x, n, rho); - } - - /* grow the input as required */ - if (x->alloc < digs) { - if ((res = mp_grow (x, digs)) != MP_OKAY) { - return res; - } - } - x->used = digs; - - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * rho mod b - * - * The value of rho must be precalculated via - * montgomery_setup() such that - * it equals -1/n0 mod b this allows the - * following inner loop to reduce the - * input one digit at a time - */ - mu = (mp_digit) (((mp_word)x->dp[ix] * (mp_word)rho) & MP_MASK); - - /* a = a + mu * m * b**i */ - { - int iy; - mp_digit *tmpn, *tmpx, u; - mp_word r; - - /* alias for digits of the modulus */ - tmpn = n->dp; - - /* alias for the digits of x [the input] */ - tmpx = x->dp + ix; - - /* set the carry to zero */ - u = 0; - - /* Multiply and add in place */ - for (iy = 0; iy < n->used; iy++) { - /* compute product and sum */ - r = ((mp_word)mu * (mp_word)*tmpn++) + - (mp_word) u + (mp_word) *tmpx; - - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - - /* fix digit */ - *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); + int ix, res, digs; + mp_digit mu; + + /* can the fast reduction [comba] method be used? + * + * Note that unlike in mul you're safely allowed *less* + * than the available columns [255 per default] since carries + * are fixed up in the inner loop. + */ + digs = (n->used * 2) + 1; + if ((digs < MP_WARRAY) && + (n->used < + (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + return fast_mp_montgomery_reduce(x, n, rho); + } + + /* grow the input as required */ + if (x->alloc < digs) { + if ((res = mp_grow(x, digs)) != MP_OKAY) { + return res; } - /* At this point the ix'th digit of x should be zero */ + } + x->used = digs; + + for (ix = 0; ix < n->used; ix++) { + /* mu = ai * rho mod b + * + * The value of rho must be precalculated via + * montgomery_setup() such that + * it equals -1/n0 mod b this allows the + * following inner loop to reduce the + * input one digit at a time + */ + mu = (mp_digit)(((mp_word)x->dp[ix] * (mp_word)rho) & MP_MASK); + + /* a = a + mu * m * b**i */ + { + int iy; + mp_digit *tmpn, *tmpx, u; + mp_word r; + + /* alias for digits of the modulus */ + tmpn = n->dp; + + /* alias for the digits of x [the input] */ + tmpx = x->dp + ix; + + /* set the carry to zero */ + u = 0; + + /* Multiply and add in place */ + for (iy = 0; iy < n->used; iy++) { + /* compute product and sum */ + r = ((mp_word)mu * (mp_word)*tmpn++) + + (mp_word) u + (mp_word) *tmpx; + + /* get carry */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + + /* fix digit */ + *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); + } + /* At this point the ix'th digit of x should be zero */ + + + /* propagate carries upwards as required*/ + while (u != 0) { + *tmpx += u; + u = *tmpx >> DIGIT_BIT; + *tmpx++ &= MP_MASK; + } + } + } + /* at this point the n.used'th least + * significant digits of x are all zero + * which means we can shift x to the + * right by n.used digits and the + * residue is unchanged. + */ - /* propagate carries upwards as required*/ - while (u != 0) { - *tmpx += u; - u = *tmpx >> DIGIT_BIT; - *tmpx++ &= MP_MASK; - } - } - } - - /* at this point the n.used'th least - * significant digits of x are all zero - * which means we can shift x to the - * right by n.used digits and the - * residue is unchanged. - */ - - /* x = x/b**n.used */ - mp_clamp(x); - mp_rshd (x, n->used); - - /* if x >= n then x = x - n */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - - return MP_OKAY; + /* x = x/b**n.used */ + mp_clamp(x); + mp_rshd(x, n->used); + + /* if x >= n then x = x - n */ + if (mp_cmp_mag(x, n) != MP_LT) { + return s_mp_sub(x, n, x); + } + + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 1c17445..46f560d 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -16,41 +16,40 @@ */ /* setups the montgomery reduction stuff */ -int -mp_montgomery_setup (mp_int * n, mp_digit * rho) +int mp_montgomery_setup(mp_int *n, mp_digit *rho) { - mp_digit x, b; + mp_digit x, b; -/* fast inversion mod 2**k - * - * Based on the fact that - * - * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) - * => 2*X*A - X*X*A*A = 1 - * => 2*(1) - (1) = 1 - */ - b = n->dp[0]; + /* fast inversion mod 2**k + * + * Based on the fact that + * + * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) + * => 2*X*A - X*X*A*A = 1 + * => 2*(1) - (1) = 1 + */ + b = n->dp[0]; - if ((b & 1) == 0) { - return MP_VAL; - } + if ((b & 1) == 0) { + return MP_VAL; + } - x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ - x *= 2 - (b * x); /* here x*a==1 mod 2**8 */ + x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**8 */ #if !defined(MP_8BIT) - x *= 2 - (b * x); /* here x*a==1 mod 2**16 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**16 */ #endif #if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) - x *= 2 - (b * x); /* here x*a==1 mod 2**32 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**32 */ #endif #ifdef MP_64BIT - x *= 2 - (b * x); /* here x*a==1 mod 2**64 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**64 */ #endif - /* rho = -1/m mod b */ - *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; + /* rho = -1/m mod b */ + *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index cc3b9c8..315a520 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -16,49 +16,49 @@ */ /* high level multiplication (handles sign) */ -int mp_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_mul(mp_int *a, mp_int *b, mp_int *c) { - int res, neg; - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; + int res, neg; + neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - /* use Toom-Cook? */ + /* use Toom-Cook? */ #ifdef BN_MP_TOOM_MUL_C - if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) { - res = mp_toom_mul(a, b, c); - } else + if (MIN(a->used, b->used) >= TOOM_MUL_CUTOFF) { + res = mp_toom_mul(a, b, c); + } else #endif #ifdef BN_MP_KARATSUBA_MUL_C - /* use Karatsuba? */ - if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { - res = mp_karatsuba_mul (a, b, c); - } else + /* use Karatsuba? */ + if (MIN(a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { + res = mp_karatsuba_mul(a, b, c); + } else #endif - { - /* can we use the fast multiplier? - * - * The fast multiplier can be used if the output will - * have less than MP_WARRAY digits and the number of - * digits won't affect carry propagation - */ - int digs = a->used + b->used + 1; + { + /* can we use the fast multiplier? + * + * The fast multiplier can be used if the output will + * have less than MP_WARRAY digits and the number of + * digits won't affect carry propagation + */ + int digs = a->used + b->used + 1; #ifdef BN_FAST_S_MP_MUL_DIGS_C - if ((digs < MP_WARRAY) && - (MIN(a->used, b->used) <= - (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - res = fast_s_mp_mul_digs (a, b, c, digs); - } else + if ((digs < MP_WARRAY) && + (MIN(a->used, b->used) <= + (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + res = fast_s_mp_mul_digs(a, b, c, digs); + } else #endif - { + { #ifdef BN_S_MP_MUL_DIGS_C - res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ + res = s_mp_mul(a, b, c); /* uses s_mp_mul_digs */ #else - res = MP_VAL; + res = MP_VAL; #endif - } - } - c->sign = (c->used > 0) ? neg : MP_ZPOS; - return res; + } + } + c->sign = (c->used > 0) ? neg : MP_ZPOS; + return res; } #endif diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index d22fd89..33bdc4c 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -16,64 +16,64 @@ */ /* b = a*2 */ -int mp_mul_2(mp_int * a, mp_int * b) +int mp_mul_2(mp_int *a, mp_int *b) { - int x, res, oldused; + int x, res, oldused; - /* grow to accomodate result */ - if (b->alloc < (a->used + 1)) { - if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { - return res; - } - } + /* grow to accomodate result */ + if (b->alloc < (a->used + 1)) { + if ((res = mp_grow(b, a->used + 1)) != MP_OKAY) { + return res; + } + } - oldused = b->used; - b->used = a->used; + oldused = b->used; + b->used = a->used; - { - mp_digit r, rr, *tmpa, *tmpb; + { + mp_digit r, rr, *tmpa, *tmpb; - /* alias for source */ - tmpa = a->dp; - - /* alias for dest */ - tmpb = b->dp; + /* alias for source */ + tmpa = a->dp; - /* carry */ - r = 0; - for (x = 0; x < a->used; x++) { - - /* get what will be the *next* carry bit from the - * MSB of the current digit - */ - rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); - - /* now shift up this digit, add in the carry [from the previous] */ - *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; - - /* copy the carry that would be from the source - * digit into the next iteration - */ - r = rr; - } + /* alias for dest */ + tmpb = b->dp; + + /* carry */ + r = 0; + for (x = 0; x < a->used; x++) { + + /* get what will be the *next* carry bit from the + * MSB of the current digit + */ + rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); - /* new leading digit? */ - if (r != 0) { - /* add a MSB which is always 1 at this point */ - *tmpb = 1; - ++(b->used); - } + /* now shift up this digit, add in the carry [from the previous] */ + *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; - /* now zero any excess digits on the destination - * that we didn't write to - */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - return MP_OKAY; + /* copy the carry that would be from the source + * digit into the next iteration + */ + r = rr; + } + + /* new leading digit? */ + if (r != 0) { + /* add a MSB which is always 1 at this point */ + *tmpb = 1; + ++(b->used); + } + + /* now zero any excess digits on the destination + * that we didn't write to + */ + tmpb = b->dp + b->used; + for (x = b->used; x < oldused; x++) { + *tmpb++ = 0; + } + } + b->sign = a->sign; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index c00fd7e..b3d92a9 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -16,67 +16,67 @@ */ /* shift left by a certain bit count */ -int mp_mul_2d (mp_int * a, int b, mp_int * c) +int mp_mul_2d(mp_int *a, int b, mp_int *c) { - mp_digit d; - int res; + mp_digit d; + int res; - /* copy */ - if (a != c) { - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - } + /* copy */ + if (a != c) { + if ((res = mp_copy(a, c)) != MP_OKAY) { + return res; + } + } - if (c->alloc < (int)(c->used + (b / DIGIT_BIT) + 1)) { - if ((res = mp_grow (c, c->used + (b / DIGIT_BIT) + 1)) != MP_OKAY) { - return res; - } - } + if (c->alloc < (int)(c->used + (b / DIGIT_BIT) + 1)) { + if ((res = mp_grow(c, c->used + (b / DIGIT_BIT) + 1)) != MP_OKAY) { + return res; + } + } - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { - return res; - } - } + /* shift by as many digits in the bit count */ + if (b >= (int)DIGIT_BIT) { + if ((res = mp_lshd(c, b / DIGIT_BIT)) != MP_OKAY) { + return res; + } + } - /* shift any bit count < DIGIT_BIT */ - d = (mp_digit) (b % DIGIT_BIT); - if (d != 0) { - mp_digit *tmpc, shift, mask, r, rr; - int x; + /* shift any bit count < DIGIT_BIT */ + d = (mp_digit)(b % DIGIT_BIT); + if (d != 0) { + mp_digit *tmpc, shift, mask, r, rr; + int x; - /* bitmask for carries */ - mask = (((mp_digit)1) << d) - 1; + /* bitmask for carries */ + mask = (((mp_digit)1) << d) - 1; - /* shift for msbs */ - shift = DIGIT_BIT - d; + /* shift for msbs */ + shift = DIGIT_BIT - d; - /* alias */ - tmpc = c->dp; + /* alias */ + tmpc = c->dp; - /* carry */ - r = 0; - for (x = 0; x < c->used; x++) { - /* get the higher bits of the current word */ - rr = (*tmpc >> shift) & mask; + /* carry */ + r = 0; + for (x = 0; x < c->used; x++) { + /* get the higher bits of the current word */ + rr = (*tmpc >> shift) & mask; - /* shift the current word and OR in the carry */ - *tmpc = ((*tmpc << d) | r) & MP_MASK; - ++tmpc; + /* shift the current word and OR in the carry */ + *tmpc = ((*tmpc << d) | r) & MP_MASK; + ++tmpc; - /* set the carry to the carry bits of the current word */ - r = rr; - } - - /* set final carry */ - if (r != 0) { - c->dp[(c->used)++] = r; - } - } - mp_clamp (c); - return MP_OKAY; + /* set the carry to the carry bits of the current word */ + r = rr; + } + + /* set final carry */ + if (r != 0) { + c->dp[(c->used)++] = r; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 6954ed3..1aa448c 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -16,61 +16,60 @@ */ /* multiply by a digit */ -int -mp_mul_d (mp_int * a, mp_digit b, mp_int * c) +int mp_mul_d(mp_int *a, mp_digit b, mp_int *c) { - mp_digit u, *tmpa, *tmpc; - mp_word r; - int ix, res, olduse; + mp_digit u, *tmpa, *tmpc; + mp_word r; + int ix, res, olduse; - /* make sure c is big enough to hold a*b */ - if (c->alloc < (a->used + 1)) { - if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { - return res; - } - } + /* make sure c is big enough to hold a*b */ + if (c->alloc < (a->used + 1)) { + if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { + return res; + } + } - /* get the original destinations used count */ - olduse = c->used; + /* get the original destinations used count */ + olduse = c->used; - /* set the sign */ - c->sign = a->sign; + /* set the sign */ + c->sign = a->sign; - /* alias for a->dp [source] */ - tmpa = a->dp; + /* alias for a->dp [source] */ + tmpa = a->dp; - /* alias for c->dp [dest] */ - tmpc = c->dp; + /* alias for c->dp [dest] */ + tmpc = c->dp; - /* zero carry */ - u = 0; + /* zero carry */ + u = 0; - /* compute columns */ - for (ix = 0; ix < a->used; ix++) { - /* compute product and carry sum for this term */ - r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); + /* compute columns */ + for (ix = 0; ix < a->used; ix++) { + /* compute product and carry sum for this term */ + r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); - /* mask off higher bits to get a single digit */ - *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* mask off higher bits to get a single digit */ + *tmpc++ = (mp_digit)(r & ((mp_word)MP_MASK)); - /* send carry into next iteration */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } + /* send carry into next iteration */ + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); + } - /* store final carry [if any] and increment ix offset */ - *tmpc++ = u; - ++ix; + /* store final carry [if any] and increment ix offset */ + *tmpc++ = u; + ++ix; - /* now zero digits above the top */ - while (ix++ < olduse) { - *tmpc++ = 0; - } + /* now zero digits above the top */ + while (ix++ < olduse) { + *tmpc++ = 0; + } - /* set used count */ - c->used = a->used + 1; - mp_clamp(c); + /* set used count */ + c->used = a->used + 1; + mp_clamp(c); - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index d7a4d3c..b1e6a33 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -16,22 +16,22 @@ */ /* d = a * b (mod c) */ -int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init_size (&t, c->used)) != MP_OKAY) { - return res; - } + if ((res = mp_init_size(&t, c->used)) != MP_OKAY) { + return res; + } - if ((res = mp_mul (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; + if ((res = mp_mul(a, b, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, c, d); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index f717f17..8211c0a 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -18,9 +18,9 @@ /* wrapper function for mp_n_root_ex() * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a */ -int mp_n_root (mp_int * a, mp_digit b, mp_int * c) +int mp_n_root(mp_int *a, mp_digit b, mp_int *c) { - return mp_n_root_ex(a, b, c, 0); + return mp_n_root_ex(a, b, c, 0); } #endif diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 079b4f3..9546745 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -25,105 +25,108 @@ * each step involves a fair bit. This is not meant to * find huge roots [square and cube, etc]. */ -int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast) +int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) { - mp_int t1, t2, t3; - int res, neg; - - /* input must be positive if b is even */ - if (((b & 1) == 0) && (a->sign == MP_NEG)) { - return MP_VAL; - } - - if ((res = mp_init (&t1)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init (&t3)) != MP_OKAY) { - goto LBL_T2; - } - - /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; - - /* t2 = 2 */ - mp_set (&t2, 2); - - do { - /* t1 = t2 */ - if ((res = mp_copy (&t2, &t1)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */ - - /* t3 = t1**(b-1) */ - if ((res = mp_expt_d_ex (&t1, b - 1, &t3, fast)) != MP_OKAY) { - goto LBL_T3; - } - - /* numerator */ - /* t2 = t1**b */ - if ((res = mp_mul (&t3, &t1, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1**b - a */ - if ((res = mp_sub (&t2, a, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* denominator */ - /* t3 = t1**(b-1) * b */ - if ((res = mp_mul_d (&t3, b, &t3)) != MP_OKAY) { - goto LBL_T3; - } - - /* t3 = (t1**b - a)/(b * t1**(b-1)) */ - if ((res = mp_div (&t2, &t3, &t3, NULL)) != MP_OKAY) { - goto LBL_T3; - } - - if ((res = mp_sub (&t1, &t3, &t2)) != MP_OKAY) { - goto LBL_T3; - } - } while (mp_cmp (&t1, &t2) != MP_EQ); - - /* result can be off by a few so check */ - for (;;) { - if ((res = mp_expt_d_ex (&t1, b, &t2, fast)) != MP_OKAY) { - goto LBL_T3; - } - - if (mp_cmp (&t2, a) == MP_GT) { - if ((res = mp_sub_d (&t1, 1, &t1)) != MP_OKAY) { + mp_int t1, t2, t3; + int res, neg; + + /* input must be positive if b is even */ + if (((b & 1) == 0) && (a->sign == MP_NEG)) { + return MP_VAL; + } + + if ((res = mp_init(&t1)) != MP_OKAY) { + return res; + } + + if ((res = mp_init(&t2)) != MP_OKAY) { + goto LBL_T1; + } + + if ((res = mp_init(&t3)) != MP_OKAY) { + goto LBL_T2; + } + + /* if a is negative fudge the sign but keep track */ + neg = a->sign; + a->sign = MP_ZPOS; + + /* t2 = 2 */ + mp_set(&t2, 2); + + do { + /* t1 = t2 */ + if ((res = mp_copy(&t2, &t1)) != MP_OKAY) { + goto LBL_T3; + } + + /* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */ + + /* t3 = t1**(b-1) */ + if ((res = mp_expt_d_ex(&t1, b - 1, &t3, fast)) != MP_OKAY) { + goto LBL_T3; + } + + /* numerator */ + /* t2 = t1**b */ + if ((res = mp_mul(&t3, &t1, &t2)) != MP_OKAY) { goto LBL_T3; } - } else { - break; - } - } - /* reset the sign of a first */ - a->sign = neg; + /* t2 = t1**b - a */ + if ((res = mp_sub(&t2, a, &t2)) != MP_OKAY) { + goto LBL_T3; + } + + /* denominator */ + /* t3 = t1**(b-1) * b */ + if ((res = mp_mul_d(&t3, b, &t3)) != MP_OKAY) { + goto LBL_T3; + } + + /* t3 = (t1**b - a)/(b * t1**(b-1)) */ + if ((res = mp_div(&t2, &t3, &t3, NULL)) != MP_OKAY) { + goto LBL_T3; + } + + if ((res = mp_sub(&t1, &t3, &t2)) != MP_OKAY) { + goto LBL_T3; + } + } while (mp_cmp(&t1, &t2) != MP_EQ); + + /* result can be off by a few so check */ + for (;;) { + if ((res = mp_expt_d_ex(&t1, b, &t2, fast)) != MP_OKAY) { + goto LBL_T3; + } + + if (mp_cmp(&t2, a) == MP_GT) { + if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) { + goto LBL_T3; + } + } else { + break; + } + } + + /* reset the sign of a first */ + a->sign = neg; - /* set the result */ - mp_exch (&t1, c); + /* set the result */ + mp_exch(&t1, c); - /* set the sign of the result */ - c->sign = neg; + /* set the sign of the result */ + c->sign = neg; - res = MP_OKAY; + res = MP_OKAY; -LBL_T3:mp_clear (&t3); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); - return res; +LBL_T3: + mp_clear(&t3); +LBL_T2: + mp_clear(&t2); +LBL_T1: + mp_clear(&t1); + return res; } #endif diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index d03e92e..b30d044 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -16,22 +16,22 @@ */ /* b = -a */ -int mp_neg (mp_int * a, mp_int * b) +int mp_neg(mp_int *a, mp_int *b) { - int res; - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } + int res; + if (a != b) { + if ((res = mp_copy(a, b)) != MP_OKAY) { + return res; + } + } - if (mp_iszero(b) != MP_YES) { - b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; - } else { - b->sign = MP_ZPOS; - } + if (mp_iszero(b) != MP_YES) { + b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; + } else { + b->sign = MP_ZPOS; + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index b9775ce..2318c79 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -16,32 +16,32 @@ */ /* OR two ints together */ -int mp_or (mp_int * a, mp_int * b, mp_int * c) +int mp_or(mp_int *a, mp_int *b, mp_int *c) { - int res, ix, px; - mp_int t, *x; + int res, ix, px; + mp_int t, *x; - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } + if (a->used > b->used) { + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } + px = b->used; + x = b; + } else { + if ((res = mp_init_copy(&t, b)) != MP_OKAY) { + return res; + } + px = a->used; + x = a; + } - for (ix = 0; ix < px; ix++) { - t.dp[ix] |= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; + for (ix = 0; ix < px; ix++) { + t.dp[ix] |= x->dp[ix]; + } + mp_clamp(&t); + mp_exch(c, &t); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index d99feeb..37ad6ec 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -16,44 +16,45 @@ */ /* performs one Fermat test. - * + * * If "a" were prime then b**a == b (mod a) since the order of * the multiplicative sub-group would be phi(a) = a-1. That means * it would be the same as b**(a mod (a-1)) == b**1 == b (mod a). * * Sets result to 1 if the congruence holds, or zero otherwise. */ -int mp_prime_fermat (mp_int * a, mp_int * b, int *result) +int mp_prime_fermat(mp_int *a, mp_int *b, int *result) { - mp_int t; - int err; - - /* default to composite */ - *result = MP_NO; - - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } - - /* init t */ - if ((err = mp_init (&t)) != MP_OKAY) { - return err; - } - - /* compute t = b**a mod a */ - if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) { - goto LBL_T; - } - - /* is it equal to b? */ - if (mp_cmp (&t, b) == MP_EQ) { - *result = MP_YES; - } - - err = MP_OKAY; -LBL_T:mp_clear (&t); - return err; + mp_int t; + int err; + + /* default to composite */ + *result = MP_NO; + + /* ensure b > 1 */ + if (mp_cmp_d(b, 1) != MP_GT) { + return MP_VAL; + } + + /* init t */ + if ((err = mp_init(&t)) != MP_OKAY) { + return err; + } + + /* compute t = b**a mod a */ + if ((err = mp_exptmod(b, a, a, &t)) != MP_OKAY) { + goto LBL_T; + } + + /* is it equal to b? */ + if (mp_cmp(&t, b) == MP_EQ) { + *result = MP_YES; + } + + err = MP_OKAY; +LBL_T: + mp_clear(&t); + return err; } #endif diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index eea4a27..92af330 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -15,33 +15,33 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* determines if an integers is divisible by one +/* determines if an integers is divisible by one * of the first PRIME_SIZE primes or not * * sets result to 0 if not, 1 if yes */ -int mp_prime_is_divisible (mp_int * a, int *result) +int mp_prime_is_divisible(mp_int *a, int *result) { - int err, ix; - mp_digit res; + int err, ix; + mp_digit res; - /* default to not */ - *result = MP_NO; + /* default to not */ + *result = MP_NO; - for (ix = 0; ix < PRIME_SIZE; ix++) { - /* what is a mod LBL_prime_tab[ix] */ - if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) { - return err; - } + for (ix = 0; ix < PRIME_SIZE; ix++) { + /* what is a mod LBL_prime_tab[ix] */ + if ((err = mp_mod_d(a, ltm_prime_tab[ix], &res)) != MP_OKAY) { + return err; + } - /* is the residue zero? */ - if (res == 0) { - *result = MP_YES; - return MP_OKAY; - } - } + /* is the residue zero? */ + if (res == 0) { + *result = MP_YES; + return MP_OKAY; + } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 3eda4fd..20a7d1f 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -22,59 +22,60 @@ * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime (mp_int * a, int t, int *result) +int mp_prime_is_prime(mp_int *a, int t, int *result) { - mp_int b; - int ix, err, res; + mp_int b; + int ix, err, res; - /* default to no */ - *result = MP_NO; + /* default to no */ + *result = MP_NO; - /* valid value of t? */ - if ((t <= 0) || (t > PRIME_SIZE)) { - return MP_VAL; - } + /* valid value of t? */ + if ((t <= 0) || (t > PRIME_SIZE)) { + return MP_VAL; + } - /* is the input equal to one of the primes in the table? */ - for (ix = 0; ix < PRIME_SIZE; ix++) { + /* is the input equal to one of the primes in the table? */ + for (ix = 0; ix < PRIME_SIZE; ix++) { if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) { *result = 1; return MP_OKAY; } - } + } - /* first perform trial division */ - if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { - return err; - } + /* first perform trial division */ + if ((err = mp_prime_is_divisible(a, &res)) != MP_OKAY) { + return err; + } - /* return if it was trivially divisible */ - if (res == MP_YES) { - return MP_OKAY; - } + /* return if it was trivially divisible */ + if (res == MP_YES) { + return MP_OKAY; + } - /* now perform the miller-rabin rounds */ - if ((err = mp_init (&b)) != MP_OKAY) { - return err; - } + /* now perform the miller-rabin rounds */ + if ((err = mp_init(&b)) != MP_OKAY) { + return err; + } - for (ix = 0; ix < t; ix++) { - /* set the prime */ - mp_set (&b, ltm_prime_tab[ix]); + for (ix = 0; ix < t; ix++) { + /* set the prime */ + mp_set(&b, ltm_prime_tab[ix]); - if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { - goto LBL_B; - } + if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) { + goto LBL_B; + } - if (res == MP_NO) { - goto LBL_B; - } - } + if (res == MP_NO) { + goto LBL_B; + } + } - /* passed the test */ - *result = MP_YES; -LBL_B:mp_clear (&b); - return err; + /* passed the test */ + *result = MP_YES; +LBL_B: + mp_clear(&b); + return err; } #endif diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 7de0634..917dc01 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -15,86 +15,89 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* Miller-Rabin test of "a" to the base of "b" as described in +/* Miller-Rabin test of "a" to the base of "b" as described in * HAC pp. 139 Algorithm 4.24 * * Sets result to 0 if definitely composite or 1 if probably prime. - * Randomly the chance of error is no more than 1/4 and often + * Randomly the chance of error is no more than 1/4 and often * very much lower. */ -int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) +int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result) { - mp_int n1, y, r; - int s, j, err; + mp_int n1, y, r; + int s, j, err; - /* default */ - *result = MP_NO; + /* default */ + *result = MP_NO; - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } + /* ensure b > 1 */ + if (mp_cmp_d(b, 1) != MP_GT) { + return MP_VAL; + } - /* get n1 = a - 1 */ - if ((err = mp_init_copy (&n1, a)) != MP_OKAY) { - return err; - } - if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) { - goto LBL_N1; - } + /* get n1 = a - 1 */ + if ((err = mp_init_copy(&n1, a)) != MP_OKAY) { + return err; + } + if ((err = mp_sub_d(&n1, 1, &n1)) != MP_OKAY) { + goto LBL_N1; + } - /* set 2**s * r = n1 */ - if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) { - goto LBL_N1; - } + /* set 2**s * r = n1 */ + if ((err = mp_init_copy(&r, &n1)) != MP_OKAY) { + goto LBL_N1; + } - /* count the number of least significant bits - * which are zero - */ - s = mp_cnt_lsb(&r); + /* count the number of least significant bits + * which are zero + */ + s = mp_cnt_lsb(&r); - /* now divide n - 1 by 2**s */ - if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) { - goto LBL_R; - } + /* now divide n - 1 by 2**s */ + if ((err = mp_div_2d(&r, s, &r, NULL)) != MP_OKAY) { + goto LBL_R; + } - /* compute y = b**r mod a */ - if ((err = mp_init (&y)) != MP_OKAY) { - goto LBL_R; - } - if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) { - goto LBL_Y; - } + /* compute y = b**r mod a */ + if ((err = mp_init(&y)) != MP_OKAY) { + goto LBL_R; + } + if ((err = mp_exptmod(b, &r, a, &y)) != MP_OKAY) { + goto LBL_Y; + } - /* if y != 1 and y != n1 do */ - if ((mp_cmp_d (&y, 1) != MP_EQ) && (mp_cmp (&y, &n1) != MP_EQ)) { - j = 1; - /* while j <= s-1 and y != n1 */ - while ((j <= (s - 1)) && (mp_cmp (&y, &n1) != MP_EQ)) { - if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) { - goto LBL_Y; + /* if y != 1 and y != n1 do */ + if ((mp_cmp_d(&y, 1) != MP_EQ) && (mp_cmp(&y, &n1) != MP_EQ)) { + j = 1; + /* while j <= s-1 and y != n1 */ + while ((j <= (s - 1)) && (mp_cmp(&y, &n1) != MP_EQ)) { + if ((err = mp_sqrmod(&y, a, &y)) != MP_OKAY) { + goto LBL_Y; + } + + /* if y == 1 then composite */ + if (mp_cmp_d(&y, 1) == MP_EQ) { + goto LBL_Y; + } + + ++j; } - /* if y == 1 then composite */ - if (mp_cmp_d (&y, 1) == MP_EQ) { + /* if y != n1 then composite */ + if (mp_cmp(&y, &n1) != MP_EQ) { goto LBL_Y; } + } - ++j; - } - - /* if y != n1 then composite */ - if (mp_cmp (&y, &n1) != MP_EQ) { - goto LBL_Y; - } - } - - /* probably prime now */ - *result = MP_YES; -LBL_Y:mp_clear (&y); -LBL_R:mp_clear (&r); -LBL_N1:mp_clear (&n1); - return err; + /* probably prime now */ + *result = MP_YES; +LBL_Y: + mp_clear(&y); +LBL_R: + mp_clear(&r); +LBL_N1: + mp_clear(&n1); + return err; } #endif diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index 7a32d9b..f383cbb 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -38,28 +38,28 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) if (mp_cmp_d(a, ltm_prime_tab[PRIME_SIZE-1]) == MP_LT) { /* find which prime it is bigger than */ for (x = PRIME_SIZE - 2; x >= 0; x--) { - if (mp_cmp_d(a, ltm_prime_tab[x]) != MP_LT) { - if (bbs_style == 1) { - /* ok we found a prime smaller or - * equal [so the next is larger] - * - * however, the prime must be - * congruent to 3 mod 4 - */ - if ((ltm_prime_tab[x + 1] & 3) != 3) { - /* scan upwards for a prime congruent to 3 mod 4 */ - for (y = x + 1; y < PRIME_SIZE; y++) { - if ((ltm_prime_tab[y] & 3) == 3) { - mp_set(a, ltm_prime_tab[y]); - return MP_OKAY; - } - } - } - } else { - mp_set(a, ltm_prime_tab[x + 1]); - return MP_OKAY; - } - } + if (mp_cmp_d(a, ltm_prime_tab[x]) != MP_LT) { + if (bbs_style == 1) { + /* ok we found a prime smaller or + * equal [so the next is larger] + * + * however, the prime must be + * congruent to 3 mod 4 + */ + if ((ltm_prime_tab[x + 1] & 3) != 3) { + /* scan upwards for a prime congruent to 3 mod 4 */ + for (y = x + 1; y < PRIME_SIZE; y++) { + if ((ltm_prime_tab[y] & 3) == 3) { + mp_set(a, ltm_prime_tab[y]); + return MP_OKAY; + } + } + } + } else { + mp_set(a, ltm_prime_tab[x + 1]); + return MP_OKAY; + } + } } /* at this point a maybe 1 */ if (mp_cmp_d(a, 1) == MP_EQ) { @@ -81,7 +81,9 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) if (bbs_style == 1) { /* if a mod 4 != 3 subtract the correct value to make it so */ if ((a->dp[0] & 3) != 3) { - if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { return err; }; + if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { + return err; + }; } } else { if (mp_iseven(a) == MP_YES) { @@ -116,18 +118,18 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) /* compute the new residue without using division */ for (x = 1; x < PRIME_SIZE; x++) { - /* add the step to each residue */ - res_tab[x] += kstep; - - /* subtract the modulus [instead of using division] */ - if (res_tab[x] >= ltm_prime_tab[x]) { - res_tab[x] -= ltm_prime_tab[x]; - } - - /* set flag if zero */ - if (res_tab[x] == 0) { - y = 1; - } + /* add the step to each residue */ + res_tab[x] += kstep; + + /* subtract the modulus [instead of using division] */ + if (res_tab[x] >= ltm_prime_tab[x]) { + res_tab[x] -= ltm_prime_tab[x]; + } + + /* set flag if zero */ + if (res_tab[x] == 0) { + y = 1; + } } } while ((y == 1) && (step < ((((mp_digit)1) << DIGIT_BIT) - kstep))); @@ -143,13 +145,13 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) /* is this prime? */ for (x = 0; x < t; x++) { - mp_set(&b, ltm_prime_tab[x]); - if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) { - goto LBL_ERR; - } - if (res == MP_NO) { - break; - } + mp_set(&b, ltm_prime_tab[x]); + if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) { + goto LBL_ERR; + } + if (res == MP_NO) { + break; + } } if (res == MP_YES) { diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index 378ceb2..cde309a 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -19,14 +19,14 @@ static const struct { int k, t; } sizes[] = { -{ 128, 28 }, -{ 256, 16 }, -{ 384, 10 }, -{ 512, 7 }, -{ 640, 6 }, -{ 768, 5 }, -{ 896, 4 }, -{ 1024, 4 } + { 128, 28 }, + { 256, 16 }, + { 384, 10 }, + { 512, 7 }, + { 640, 6 }, + { 768, 5 }, + { 896, 4 }, + { 1024, 4 } }; /* returns # of RM trials required for a given bit size */ @@ -35,11 +35,11 @@ int mp_prime_rabin_miller_trials(int size) int x; for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) { - if (sizes[x].k == size) { - return sizes[x].t; - } else if (sizes[x].k > size) { - return (x == 0) ? sizes[0].t : sizes[x - 1].t; - } + if (sizes[x].k == size) { + return sizes[x].t; + } else if (sizes[x].k > size) { + return (x == 0) ? sizes[0].t : sizes[x - 1].t; + } } return sizes[x-1].t + 1; } diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index cf5272e..d3d6f3d 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -18,7 +18,7 @@ /* makes a truly random prime of a given size (bits), * * Flags are as follows: - * + * * LTM_PRIME_BBS - make prime congruent to 3 mod 4 * LTM_PRIME_SAFE - make sure (p-1)/2 is prime as well (implies LTM_PRIME_BBS) * LTM_PRIME_2MSB_ON - make the 2nd highest bit one @@ -62,7 +62,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0; if ((flags & LTM_PRIME_2MSB_ON) != 0) { maskOR_msb |= 0x80 >> ((9 - size) & 7); - } + } /* get the maskOR_lsb */ maskOR_lsb = 1; @@ -76,7 +76,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback err = MP_VAL; goto error; } - + /* work over the MSbyte */ tmp[0] &= maskAND; tmp[0] |= 1 << ((size - 1) & 7); @@ -86,28 +86,42 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback tmp[bsize-1] |= maskOR_lsb; /* read it in */ - if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY) { goto error; } + if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY) { + goto error; + } /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } - if (res == MP_NO) { + if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { + goto error; + } + if (res == MP_NO) { continue; } if ((flags & LTM_PRIME_SAFE) != 0) { /* see if (a-1)/2 is prime */ - if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { goto error; } - if ((err = mp_div_2(a, a)) != MP_OKAY) { goto error; } - + if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { + goto error; + } + if ((err = mp_div_2(a, a)) != MP_OKAY) { + goto error; + } + /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } + if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { + goto error; + } } } while (res == MP_NO); if ((flags & LTM_PRIME_SAFE) != 0) { /* restore a to the original value */ - if ((err = mp_mul_2(a, a)) != MP_OKAY) { goto error; } - if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { goto error; } + if ((err = mp_mul_2(a, a)) != MP_OKAY) { + goto error; + } + if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { + goto error; + } } err = MP_OKAY; diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index cb0c134..a6e2f04 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -16,59 +16,59 @@ */ /* returns size of ASCII reprensentation */ -int mp_radix_size (mp_int * a, int radix, int *size) +int mp_radix_size(mp_int *a, int radix, int *size) { - int res, digs; - mp_int t; - mp_digit d; + int res, digs; + mp_int t; + mp_digit d; - *size = 0; + *size = 0; - /* make sure the radix is in range */ - if ((radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* make sure the radix is in range */ + if ((radix < 2) || (radix > 64)) { + return MP_VAL; + } - if (mp_iszero(a) == MP_YES) { - *size = 2; - return MP_OKAY; - } + if (mp_iszero(a) == MP_YES) { + *size = 2; + return MP_OKAY; + } - /* special case for binary */ - if (radix == 2) { - *size = mp_count_bits (a) + ((a->sign == MP_NEG) ? 1 : 0) + 1; - return MP_OKAY; - } + /* special case for binary */ + if (radix == 2) { + *size = mp_count_bits(a) + ((a->sign == MP_NEG) ? 1 : 0) + 1; + return MP_OKAY; + } - /* digs is the digit count */ - digs = 0; + /* digs is the digit count */ + digs = 0; - /* if it's negative add one for the sign */ - if (a->sign == MP_NEG) { - ++digs; - } + /* if it's negative add one for the sign */ + if (a->sign == MP_NEG) { + ++digs; + } - /* init a copy of the input */ - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + /* init a copy of the input */ + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - /* force temp to positive */ - t.sign = MP_ZPOS; + /* force temp to positive */ + t.sign = MP_ZPOS; - /* fetch out all of the digits */ - while (mp_iszero (&t) == MP_NO) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - ++digs; - } - mp_clear (&t); + /* fetch out all of the digits */ + while (mp_iszero(&t) == MP_NO) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { + mp_clear(&t); + return res; + } + ++digs; + } + mp_clear(&t); - /* return digs + 1, the 1 is for the NULL byte that would be required. */ - *size = digs + 1; - return MP_OKAY; + /* return digs + 1, the 1 is for the NULL byte that would be required. */ + *size = digs + 1; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 93e255a..92a9a97 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -16,13 +16,13 @@ */ #if MP_GEN_RANDOM_MAX == 0xffffffff - #define MP_GEN_RANDOM_SHIFT 32 +#define MP_GEN_RANDOM_SHIFT 32 #elif MP_GEN_RANDOM_MAX == 32767 - /* SHRT_MAX */ - #define MP_GEN_RANDOM_SHIFT 15 +/* SHRT_MAX */ +#define MP_GEN_RANDOM_SHIFT 15 #elif MP_GEN_RANDOM_MAX == 2147483647 - /* INT_MAX */ - #define MP_GEN_RANDOM_SHIFT 31 +/* INT_MAX */ +#define MP_GEN_RANDOM_SHIFT 31 #elif !defined(MP_GEN_RANDOM_SHIFT) #error Thou shalt define their own valid MP_GEN_RANDOM_SHIFT #endif @@ -30,48 +30,47 @@ /* makes a pseudo-random int of a given size */ static mp_digit s_gen_random(void) { - mp_digit d = 0, msk = 0; - do { - d <<= MP_GEN_RANDOM_SHIFT; - d |= ((mp_digit) MP_GEN_RANDOM()); - msk <<= MP_GEN_RANDOM_SHIFT; - msk |= (MP_MASK & MP_GEN_RANDOM_MAX); - } while ((MP_MASK & msk) != MP_MASK); - d &= MP_MASK; - return d; + mp_digit d = 0, msk = 0; + do { + d <<= MP_GEN_RANDOM_SHIFT; + d |= ((mp_digit) MP_GEN_RANDOM()); + msk <<= MP_GEN_RANDOM_SHIFT; + msk |= (MP_MASK & MP_GEN_RANDOM_MAX); + } while ((MP_MASK & msk) != MP_MASK); + d &= MP_MASK; + return d; } -int -mp_rand (mp_int * a, int digits) +int mp_rand(mp_int *a, int digits) { - int res; - mp_digit d; + int res; + mp_digit d; - mp_zero (a); - if (digits <= 0) { - return MP_OKAY; - } + mp_zero(a); + if (digits <= 0) { + return MP_OKAY; + } - /* first place a random non-zero digit */ - do { - d = s_gen_random(); - } while (d == 0); + /* first place a random non-zero digit */ + do { + d = s_gen_random(); + } while (d == 0); - if ((res = mp_add_d (a, d, a)) != MP_OKAY) { - return res; - } - - while (--digits > 0) { - if ((res = mp_lshd (a, 1)) != MP_OKAY) { + if ((res = mp_add_d(a, d, a)) != MP_OKAY) { return res; - } + } - if ((res = mp_add_d (a, s_gen_random(), a)) != MP_OKAY) { - return res; - } - } + while (--digits > 0) { + if ((res = mp_lshd(a, 1)) != MP_OKAY) { + return res; + } + + if ((res = mp_add_d(a, s_gen_random(), a)) != MP_OKAY) { + return res; + } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 12aa499..bc31cc5 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -16,73 +16,73 @@ */ /* read a string [ASCII] in a given radix */ -int mp_read_radix (mp_int * a, const char *str, int radix) +int mp_read_radix(mp_int *a, const char *str, int radix) { - int y, res, neg; - char ch; + int y, res, neg; + char ch; - /* zero the digit bignum */ - mp_zero(a); + /* zero the digit bignum */ + mp_zero(a); - /* make sure the radix is ok */ - if ((radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* make sure the radix is ok */ + if ((radix < 2) || (radix > 64)) { + return MP_VAL; + } - /* if the leading digit is a - * minus set the sign to negative. - */ - if (*str == '-') { - ++str; - neg = MP_NEG; - } else { - neg = MP_ZPOS; - } + /* if the leading digit is a + * minus set the sign to negative. + */ + if (*str == '-') { + ++str; + neg = MP_NEG; + } else { + neg = MP_ZPOS; + } - /* set the integer to the default of zero */ - mp_zero (a); - - /* process each digit of the string */ - while (*str != '\0') { - /* if the radix <= 36 the conversion is case insensitive - * this allows numbers like 1AB and 1ab to represent the same value - * [e.g. in hex] - */ - ch = (radix <= 36) ? (char)toupper((int)*str) : *str; - for (y = 0; y < 64; y++) { - if (ch == mp_s_rmap[y]) { - break; - } - } + /* set the integer to the default of zero */ + mp_zero(a); - /* if the char was found in the map - * and is less than the given radix add it - * to the number, otherwise exit the loop. - */ - if (y < radix) { - if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) { - return res; + /* process each digit of the string */ + while (*str != '\0') { + /* if the radix <= 36 the conversion is case insensitive + * this allows numbers like 1AB and 1ab to represent the same value + * [e.g. in hex] + */ + ch = (radix <= 36) ? (char)toupper((int)*str) : *str; + for (y = 0; y < 64; y++) { + if (ch == mp_s_rmap[y]) { + break; + } } - if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) { - return res; + + /* if the char was found in the map + * and is less than the given radix add it + * to the number, otherwise exit the loop. + */ + if (y < radix) { + if ((res = mp_mul_d(a, (mp_digit)radix, a)) != MP_OKAY) { + return res; + } + if ((res = mp_add_d(a, (mp_digit)y, a)) != MP_OKAY) { + return res; + } + } else { + break; } - } else { - break; - } - ++str; - } + ++str; + } - /* if an illegal character was found, fail. */ - if (!(*str == '\0' || *str == '\r' || *str == '\n')) { + /* if an illegal character was found, fail. */ + if (!(*str == '\0' || *str == '\r' || *str == '\n')) { mp_zero(a); return MP_VAL; - } + } - /* set the sign only if a != 0 */ - if (mp_iszero(a) != MP_YES) { - a->sign = neg; - } - return MP_OKAY; + /* set the sign only if a != 0 */ + if (mp_iszero(a) != MP_YES) { + a->sign = neg; + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index 363e11f..eabc803 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -16,23 +16,23 @@ */ /* read signed bin, big endian, first byte is 0==positive or 1==negative */ -int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) +int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c) { - int res; + int res; - /* read magnitude */ - if ((res = mp_read_unsigned_bin (a, b + 1, c - 1)) != MP_OKAY) { - return res; - } + /* read magnitude */ + if ((res = mp_read_unsigned_bin(a, b + 1, c - 1)) != MP_OKAY) { + return res; + } - /* first byte is 0 for positive, non-zero for negative */ - if (b[0] == 0) { - a->sign = MP_ZPOS; - } else { - a->sign = MP_NEG; - } + /* first byte is 0 for positive, non-zero for negative */ + if (b[0] == 0) { + a->sign = MP_ZPOS; + } else { + a->sign = MP_NEG; + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index 1a50b58..ad9f05f 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -16,37 +16,37 @@ */ /* reads a unsigned char array, assumes the msb is stored first [big endian] */ -int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) +int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c) { - int res; + int res; - /* make sure there are at least two digits */ - if (a->alloc < 2) { - if ((res = mp_grow(a, 2)) != MP_OKAY) { - return res; - } - } + /* make sure there are at least two digits */ + if (a->alloc < 2) { + if ((res = mp_grow(a, 2)) != MP_OKAY) { + return res; + } + } - /* zero the int */ - mp_zero (a); + /* zero the int */ + mp_zero(a); - /* read the bytes in */ - while (c-- > 0) { - if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) { - return res; - } + /* read the bytes in */ + while (c-- > 0) { + if ((res = mp_mul_2d(a, 8, a)) != MP_OKAY) { + return res; + } #ifndef MP_8BIT - a->dp[0] |= *b++; - a->used += 1; + a->dp[0] |= *b++; + a->used += 1; #else - a->dp[0] = (*b & MP_MASK); - a->dp[1] |= ((*b++ >> 7U) & 1); - a->used += 2; + a->dp[0] = (*b & MP_MASK); + a->dp[1] |= ((*b++ >> 7U) & 1); + a->used += 2; #endif - } - mp_clamp (a); - return MP_OKAY; + } + mp_clamp(a); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index 367383f..a2b9bf7 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -19,79 +19,79 @@ * precomputed via mp_reduce_setup. * From HAC pp.604 Algorithm 14.42 */ -int mp_reduce (mp_int * x, mp_int * m, mp_int * mu) +int mp_reduce(mp_int *x, mp_int *m, mp_int *mu) { - mp_int q; - int res, um = m->used; + mp_int q; + int res, um = m->used; - /* q = x */ - if ((res = mp_init_copy (&q, x)) != MP_OKAY) { - return res; - } + /* q = x */ + if ((res = mp_init_copy(&q, x)) != MP_OKAY) { + return res; + } - /* q1 = x / b**(k-1) */ - mp_rshd (&q, um - 1); + /* q1 = x / b**(k-1) */ + mp_rshd(&q, um - 1); - /* according to HAC this optimization is ok */ - if (((mp_digit) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) { - if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) { - goto CLEANUP; - } - } else { + /* according to HAC this optimization is ok */ + if (((mp_digit) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) { + if ((res = mp_mul(&q, mu, &q)) != MP_OKAY) { + goto CLEANUP; + } + } else { #ifdef BN_S_MP_MUL_HIGH_DIGS_C - if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } + if ((res = s_mp_mul_high_digs(&q, mu, &q, um)) != MP_OKAY) { + goto CLEANUP; + } #elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) - if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } + if ((res = fast_s_mp_mul_high_digs(&q, mu, &q, um)) != MP_OKAY) { + goto CLEANUP; + } #else - { - res = MP_VAL; - goto CLEANUP; - } + { + res = MP_VAL; + goto CLEANUP; + } #endif - } - - /* q3 = q2 / b**(k+1) */ - mp_rshd (&q, um + 1); + } - /* x = x mod b**(k+1), quick (no division) */ - if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { - goto CLEANUP; - } + /* q3 = q2 / b**(k+1) */ + mp_rshd(&q, um + 1); - /* q = q * m mod b**(k+1), quick (no division) */ - if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) { - goto CLEANUP; - } - - /* x = x - q */ - if ((res = mp_sub (x, &q, x)) != MP_OKAY) { - goto CLEANUP; - } - - /* If x < 0, add b**(k+1) to it */ - if (mp_cmp_d (x, 0) == MP_LT) { - mp_set (&q, 1); - if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) + /* x = x mod b**(k+1), quick (no division) */ + if ((res = mp_mod_2d(x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { goto CLEANUP; - if ((res = mp_add (x, &q, x)) != MP_OKAY) + } + + /* q = q * m mod b**(k+1), quick (no division) */ + if ((res = s_mp_mul_digs(&q, m, &q, um + 1)) != MP_OKAY) { goto CLEANUP; - } + } - /* Back off if it's too big */ - while (mp_cmp (x, m) != MP_LT) { - if ((res = s_mp_sub (x, m, x)) != MP_OKAY) { + /* x = x - q */ + if ((res = mp_sub(x, &q, x)) != MP_OKAY) { goto CLEANUP; - } - } + } + + /* If x < 0, add b**(k+1) to it */ + if (mp_cmp_d(x, 0) == MP_LT) { + mp_set(&q, 1); + if ((res = mp_lshd(&q, um + 1)) != MP_OKAY) + goto CLEANUP; + if ((res = mp_add(x, &q, x)) != MP_OKAY) + goto CLEANUP; + } + + /* Back off if it's too big */ + while (mp_cmp(x, m) != MP_LT) { + if ((res = s_mp_sub(x, m, x)) != MP_OKAY) { + goto CLEANUP; + } + } CLEANUP: - mp_clear (&q); + mp_clear(&q); - return res; + return res; } #endif diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index bf810c0..802a5ba 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -20,22 +20,22 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) { int res, p; mp_int tmp; - + if ((res = mp_init(&tmp)) != MP_OKAY) { return res; } - + p = mp_count_bits(a); if ((res = mp_2expt(&tmp, p)) != MP_OKAY) { mp_clear(&tmp); return res; } - + if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) { mp_clear(&tmp); return res; } - + *d = tmp.dp[0]; mp_clear(&tmp); return MP_OKAY; diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 56d1ba8..34367ed 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -20,19 +20,19 @@ int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) { int res; mp_int tmp; - + if ((res = mp_init(&tmp)) != MP_OKAY) { return res; } - + if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) { goto ERR; } - + if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) { goto ERR; } - + ERR: mp_clear(&tmp); return res; diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index 0499e83..c733ca9 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -20,7 +20,7 @@ int mp_reduce_is_2k(mp_int *a) { int ix, iy, iw; mp_digit iz; - + if (a->used == 0) { return MP_NO; } else if (a->used == 1) { @@ -29,17 +29,17 @@ int mp_reduce_is_2k(mp_int *a) iy = mp_count_bits(a); iz = 1; iw = 1; - + /* Test every bit from the second digit up, must be 1 */ for (ix = DIGIT_BIT; ix < iy; ix++) { - if ((a->dp[iw] & iz) == 0) { - return MP_NO; - } - iz <<= 1; - if (iz > (mp_digit)MP_MASK) { - ++iw; - iz = 1; - } + if ((a->dp[iw] & iz) == 0) { + return MP_NO; + } + iz <<= 1; + if (iz > (mp_digit)MP_MASK) { + ++iw; + iz = 1; + } } } return MP_YES; diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index 48b3498..d4804d5 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -19,7 +19,7 @@ int mp_reduce_is_2k_l(mp_int *a) { int ix, iy; - + if (a->used == 0) { return MP_NO; } else if (a->used == 1) { @@ -27,12 +27,12 @@ int mp_reduce_is_2k_l(mp_int *a) } else if (a->used > 1) { /* if more than half of the digits are -1 we're sold */ for (iy = ix = 0; ix < a->used; ix++) { - if (a->dp[ix] == MP_MASK) { - ++iy; - } + if (a->dp[ix] == MP_MASK) { + ++iy; + } } return (iy >= (a->used/2)) ? MP_YES : MP_NO; - + } return MP_NO; } diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index 8875698..00ff61c 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -18,14 +18,14 @@ /* pre-calculate the value required for Barrett reduction * For a given modulus "b" it calulates the value required in "a" */ -int mp_reduce_setup (mp_int * a, mp_int * b) +int mp_reduce_setup(mp_int *a, mp_int *b) { - int res; - - if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { - return res; - } - return mp_div (a, b, a, NULL); + int res; + + if ((res = mp_2expt(a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { + return res; + } + return mp_div(a, b, a, NULL); } #endif diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index 4b598de..fd06735 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -16,54 +16,54 @@ */ /* shift right a certain amount of digits */ -void mp_rshd (mp_int * a, int b) +void mp_rshd(mp_int *a, int b) { - int x; + int x; - /* if b <= 0 then ignore it */ - if (b <= 0) { - return; - } + /* if b <= 0 then ignore it */ + if (b <= 0) { + return; + } - /* if b > used then simply zero it and return */ - if (a->used <= b) { - mp_zero (a); - return; - } + /* if b > used then simply zero it and return */ + if (a->used <= b) { + mp_zero(a); + return; + } - { - mp_digit *bottom, *top; + { + mp_digit *bottom, *top; - /* shift the digits down */ + /* shift the digits down */ - /* bottom */ - bottom = a->dp; + /* bottom */ + bottom = a->dp; - /* top [offset into digits] */ - top = a->dp + b; + /* top [offset into digits] */ + top = a->dp + b; - /* this is implemented as a sliding window where - * the window is b-digits long and digits from - * the top of the window are copied to the bottom - * - * e.g. + /* this is implemented as a sliding window where + * the window is b-digits long and digits from + * the top of the window are copied to the bottom + * + * e.g. - b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> - /\ | ----> - \-------------------/ ----> - */ - for (x = 0; x < (a->used - b); x++) { - *bottom++ = *top++; - } + b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> + /\ | ----> + \-------------------/ ----> + */ + for (x = 0; x < (a->used - b); x++) { + *bottom++ = *top++; + } - /* zero the top digits */ - for (; x < a->used; x++) { - *bottom++ = 0; - } - } - - /* remove excess digits */ - a->used -= b; + /* zero the top digits */ + for (; x < a->used; x++) { + *bottom++ = 0; + } + } + + /* remove excess digits */ + a->used -= b; } #endif diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index dd4de3c..eaf7fed 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -16,11 +16,11 @@ */ /* set to a digit */ -void mp_set (mp_int * a, mp_digit b) +void mp_set(mp_int *a, mp_digit b) { - mp_zero (a); - a->dp[0] = b & MP_MASK; - a->used = (a->dp[0] != 0) ? 1 : 0; + mp_zero(a); + a->dp[0] = b & MP_MASK; + a->used = (a->dp[0] != 0) ? 1 : 0; } #endif diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index 3aafec9..4c71180 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -16,30 +16,30 @@ */ /* set a 32-bit const */ -int mp_set_int (mp_int * a, unsigned long b) +int mp_set_int(mp_int *a, unsigned long b) { - int x, res; + int x, res; - mp_zero (a); - - /* set four bits at a time */ - for (x = 0; x < 8; x++) { - /* shift the number up four bits */ - if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) { - return res; - } + mp_zero(a); - /* OR in the top four bits of the source */ - a->dp[0] |= (b >> 28) & 15; + /* set four bits at a time */ + for (x = 0; x < 8; x++) { + /* shift the number up four bits */ + if ((res = mp_mul_2d(a, 4, a)) != MP_OKAY) { + return res; + } - /* shift the source up to the next four bits */ - b <<= 4; + /* OR in the top four bits of the source */ + a->dp[0] |= (b >> 28) & 15; - /* ensure that digits are not clamped off */ - a->used += 1; - } - mp_clamp (a); - return MP_OKAY; + /* shift the source up to the next four bits */ + b <<= 4; + + /* ensure that digits are not clamped off */ + a->used += 1; + } + mp_clamp(a); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index 0712c2b..8ac1f33 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -16,23 +16,23 @@ */ /* shrink a bignum */ -int mp_shrink (mp_int * a) +int mp_shrink(mp_int *a) { - mp_digit *tmp; - int used = 1; - - if(a->used > 0) { - used = a->used; - } - - if (a->alloc != used) { - if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) { - return MP_MEM; - } - a->dp = tmp; - a->alloc = used; - } - return MP_OKAY; + mp_digit *tmp; + int used = 1; + + if (a->used > 0) { + used = a->used; + } + + if (a->alloc != used) { + if ((tmp = OPT_CAST(mp_digit) XREALLOC(a->dp, sizeof(mp_digit) * used)) == NULL) { + return MP_MEM; + } + a->dp = tmp; + a->alloc = used; + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 0910333..082aeca 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -16,9 +16,9 @@ */ /* get the size for an signed equivalent */ -int mp_signed_bin_size (mp_int * a) +int mp_signed_bin_size(mp_int *a) { - return 1 + mp_unsigned_bin_size (a); + return 1 + mp_unsigned_bin_size(a); } #endif diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index ffe94e2..e2e8641 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -16,42 +16,41 @@ */ /* computes b = a*a */ -int -mp_sqr (mp_int * a, mp_int * b) +int mp_sqr(mp_int *a, mp_int *b) { - int res; + int res; #ifdef BN_MP_TOOM_SQR_C - /* use Toom-Cook? */ - if (a->used >= TOOM_SQR_CUTOFF) { - res = mp_toom_sqr(a, b); - /* Karatsuba? */ - } else + /* use Toom-Cook? */ + if (a->used >= TOOM_SQR_CUTOFF) { + res = mp_toom_sqr(a, b); + /* Karatsuba? */ + } else #endif #ifdef BN_MP_KARATSUBA_SQR_C - if (a->used >= KARATSUBA_SQR_CUTOFF) { - res = mp_karatsuba_sqr (a, b); - } else + if (a->used >= KARATSUBA_SQR_CUTOFF) { + res = mp_karatsuba_sqr(a, b); + } else #endif - { + { #ifdef BN_FAST_S_MP_SQR_C - /* can we use the fast comba multiplier? */ - if ((((a->used * 2) + 1) < MP_WARRAY) && - (a->used < - (1 << (((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT)) - 1)))) { - res = fast_s_mp_sqr (a, b); - } else + /* can we use the fast comba multiplier? */ + if ((((a->used * 2) + 1) < MP_WARRAY) && + (a->used < + (1 << (((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT)) - 1)))) { + res = fast_s_mp_sqr(a, b); + } else #endif - { + { #ifdef BN_S_MP_SQR_C - res = s_mp_sqr (a, b); + res = s_mp_sqr(a, b); #else - res = MP_VAL; + res = MP_VAL; #endif - } - } - b->sign = MP_ZPOS; - return res; + } + } + b->sign = MP_ZPOS; + return res; } #endif diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 3b29fbc..96a7574 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -16,23 +16,22 @@ */ /* c = a * a (mod b) */ -int -mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) +int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } + if ((res = mp_init(&t)) != MP_OKAY) { + return res; + } - if ((res = mp_sqr (a, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, b, c); - mp_clear (&t); - return res; + if ((res = mp_sqr(a, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, b, c); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index d3b5d62..95a6892 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -16,62 +16,64 @@ */ /* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) +int mp_sqrt(mp_int *arg, mp_int *ret) { - int res; - mp_int t1,t2; + int res; + mp_int t1, t2; - /* must be positive */ - if (arg->sign == MP_NEG) { - return MP_VAL; - } + /* must be positive */ + if (arg->sign == MP_NEG) { + return MP_VAL; + } - /* easy out */ - if (mp_iszero(arg) == MP_YES) { - mp_zero(ret); - return MP_OKAY; - } + /* easy out */ + if (mp_iszero(arg) == MP_YES) { + mp_zero(ret); + return MP_OKAY; + } - if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) { + return res; + } - if ((res = mp_init(&t2)) != MP_OKAY) { - goto E2; - } + if ((res = mp_init(&t2)) != MP_OKAY) { + goto E2; + } - /* First approx. (not very bad for large arg) */ - mp_rshd (&t1,t1.used/2); + /* First approx. (not very bad for large arg) */ + mp_rshd(&t1, t1.used/2); - /* t1 > 0 */ - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { - goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { - goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { - goto E1; - } - /* And now t1 > sqrt(arg) */ - do { - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { + /* t1 > 0 */ + if ((res = mp_div(arg, &t1, &t2, NULL)) != MP_OKAY) { goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { + } + if ((res = mp_add(&t1, &t2, &t1)) != MP_OKAY) { goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { + } + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) { goto E1; - } - /* t1 >= sqrt(arg) >= t2 at this point */ - } while (mp_cmp_mag(&t1,&t2) == MP_GT); + } + /* And now t1 > sqrt(arg) */ + do { + if ((res = mp_div(arg, &t1, &t2, NULL)) != MP_OKAY) { + goto E1; + } + if ((res = mp_add(&t1, &t2, &t1)) != MP_OKAY) { + goto E1; + } + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) { + goto E1; + } + /* t1 >= sqrt(arg) >= t2 at this point */ + } while (mp_cmp_mag(&t1, &t2) == MP_GT); - mp_exch(&t1,ret); + mp_exch(&t1, ret); -E1: mp_clear(&t2); -E2: mp_clear(&t1); - return res; +E1: + mp_clear(&t2); +E2: + mp_clear(&t1); + return res; } #endif diff --git a/libtommath/bn_mp_sqrtmod_prime.c b/libtommath/bn_mp_sqrtmod_prime.c index 968729e..12b427c 100644 --- a/libtommath/bn_mp_sqrtmod_prime.c +++ b/libtommath/bn_mp_sqrtmod_prime.c @@ -17,108 +17,108 @@ int mp_sqrtmod_prime(mp_int *n, mp_int *prime, mp_int *ret) { - int res, legendre; - mp_int t1, C, Q, S, Z, M, T, R, two; - mp_digit i; + int res, legendre; + mp_int t1, C, Q, S, Z, M, T, R, two; + mp_digit i; - /* first handle the simple cases */ - if (mp_cmp_d(n, 0) == MP_EQ) { - mp_zero(ret); - return MP_OKAY; - } - if (mp_cmp_d(prime, 2) == MP_EQ) return MP_VAL; /* prime must be odd */ - if ((res = mp_jacobi(n, prime, &legendre)) != MP_OKAY) return res; - if (legendre == -1) return MP_VAL; /* quadratic non-residue mod prime */ + /* first handle the simple cases */ + if (mp_cmp_d(n, 0) == MP_EQ) { + mp_zero(ret); + return MP_OKAY; + } + if (mp_cmp_d(prime, 2) == MP_EQ) return MP_VAL; /* prime must be odd */ + if ((res = mp_jacobi(n, prime, &legendre)) != MP_OKAY) return res; + if (legendre == -1) return MP_VAL; /* quadratic non-residue mod prime */ - if ((res = mp_init_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL)) != MP_OKAY) { - return res; - } + if ((res = mp_init_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL)) != MP_OKAY) { + return res; + } - /* SPECIAL CASE: if prime mod 4 == 3 - * compute directly: res = n^(prime+1)/4 mod prime - * Handbook of Applied Cryptography algorithm 3.36 - */ - if ((res = mp_mod_d(prime, 4, &i)) != MP_OKAY) goto cleanup; - if (i == 3) { - if ((res = mp_add_d(prime, 1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_exptmod(n, &t1, prime, ret)) != MP_OKAY) goto cleanup; - res = MP_OKAY; - goto cleanup; - } + /* SPECIAL CASE: if prime mod 4 == 3 + * compute directly: res = n^(prime+1)/4 mod prime + * Handbook of Applied Cryptography algorithm 3.36 + */ + if ((res = mp_mod_d(prime, 4, &i)) != MP_OKAY) goto cleanup; + if (i == 3) { + if ((res = mp_add_d(prime, 1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_exptmod(n, &t1, prime, ret)) != MP_OKAY) goto cleanup; + res = MP_OKAY; + goto cleanup; + } - /* NOW: Tonelli-Shanks algorithm */ + /* NOW: Tonelli-Shanks algorithm */ - /* factor out powers of 2 from prime-1, defining Q and S as: prime-1 = Q*2^S */ - if ((res = mp_copy(prime, &Q)) != MP_OKAY) goto cleanup; - if ((res = mp_sub_d(&Q, 1, &Q)) != MP_OKAY) goto cleanup; - /* Q = prime - 1 */ - mp_zero(&S); - /* S = 0 */ - while (mp_iseven(&Q) != MP_NO) { - if ((res = mp_div_2(&Q, &Q)) != MP_OKAY) goto cleanup; - /* Q = Q / 2 */ - if ((res = mp_add_d(&S, 1, &S)) != MP_OKAY) goto cleanup; - /* S = S + 1 */ - } + /* factor out powers of 2 from prime-1, defining Q and S as: prime-1 = Q*2^S */ + if ((res = mp_copy(prime, &Q)) != MP_OKAY) goto cleanup; + if ((res = mp_sub_d(&Q, 1, &Q)) != MP_OKAY) goto cleanup; + /* Q = prime - 1 */ + mp_zero(&S); + /* S = 0 */ + while (mp_iseven(&Q) != MP_NO) { + if ((res = mp_div_2(&Q, &Q)) != MP_OKAY) goto cleanup; + /* Q = Q / 2 */ + if ((res = mp_add_d(&S, 1, &S)) != MP_OKAY) goto cleanup; + /* S = S + 1 */ + } - /* find a Z such that the Legendre symbol (Z|prime) == -1 */ - if ((res = mp_set_int(&Z, 2)) != MP_OKAY) goto cleanup; - /* Z = 2 */ - while(1) { - if ((res = mp_jacobi(&Z, prime, &legendre)) != MP_OKAY) goto cleanup; - if (legendre == -1) break; - if ((res = mp_add_d(&Z, 1, &Z)) != MP_OKAY) goto cleanup; - /* Z = Z + 1 */ - } + /* find a Z such that the Legendre symbol (Z|prime) == -1 */ + if ((res = mp_set_int(&Z, 2)) != MP_OKAY) goto cleanup; + /* Z = 2 */ + while (1) { + if ((res = mp_jacobi(&Z, prime, &legendre)) != MP_OKAY) goto cleanup; + if (legendre == -1) break; + if ((res = mp_add_d(&Z, 1, &Z)) != MP_OKAY) goto cleanup; + /* Z = Z + 1 */ + } - if ((res = mp_exptmod(&Z, &Q, prime, &C)) != MP_OKAY) goto cleanup; - /* C = Z ^ Q mod prime */ - if ((res = mp_add_d(&Q, 1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; - /* t1 = (Q + 1) / 2 */ - if ((res = mp_exptmod(n, &t1, prime, &R)) != MP_OKAY) goto cleanup; - /* R = n ^ ((Q + 1) / 2) mod prime */ - if ((res = mp_exptmod(n, &Q, prime, &T)) != MP_OKAY) goto cleanup; - /* T = n ^ Q mod prime */ - if ((res = mp_copy(&S, &M)) != MP_OKAY) goto cleanup; - /* M = S */ - if ((res = mp_set_int(&two, 2)) != MP_OKAY) goto cleanup; + if ((res = mp_exptmod(&Z, &Q, prime, &C)) != MP_OKAY) goto cleanup; + /* C = Z ^ Q mod prime */ + if ((res = mp_add_d(&Q, 1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; + /* t1 = (Q + 1) / 2 */ + if ((res = mp_exptmod(n, &t1, prime, &R)) != MP_OKAY) goto cleanup; + /* R = n ^ ((Q + 1) / 2) mod prime */ + if ((res = mp_exptmod(n, &Q, prime, &T)) != MP_OKAY) goto cleanup; + /* T = n ^ Q mod prime */ + if ((res = mp_copy(&S, &M)) != MP_OKAY) goto cleanup; + /* M = S */ + if ((res = mp_set_int(&two, 2)) != MP_OKAY) goto cleanup; - res = MP_VAL; - while (1) { - if ((res = mp_copy(&T, &t1)) != MP_OKAY) goto cleanup; - i = 0; - while (1) { - if (mp_cmp_d(&t1, 1) == MP_EQ) break; - if ((res = mp_exptmod(&t1, &two, prime, &t1)) != MP_OKAY) goto cleanup; - i++; - } - if (i == 0) { - if ((res = mp_copy(&R, ret)) != MP_OKAY) goto cleanup; - res = MP_OKAY; - goto cleanup; - } - if ((res = mp_sub_d(&M, i, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_exptmod(&two, &t1, prime, &t1)) != MP_OKAY) goto cleanup; - /* t1 = 2 ^ (M - i - 1) */ - if ((res = mp_exptmod(&C, &t1, prime, &t1)) != MP_OKAY) goto cleanup; - /* t1 = C ^ (2 ^ (M - i - 1)) mod prime */ - if ((res = mp_sqrmod(&t1, prime, &C)) != MP_OKAY) goto cleanup; - /* C = (t1 * t1) mod prime */ - if ((res = mp_mulmod(&R, &t1, prime, &R)) != MP_OKAY) goto cleanup; - /* R = (R * t1) mod prime */ - if ((res = mp_mulmod(&T, &C, prime, &T)) != MP_OKAY) goto cleanup; - /* T = (T * C) mod prime */ - mp_set(&M, i); - /* M = i */ - } + res = MP_VAL; + while (1) { + if ((res = mp_copy(&T, &t1)) != MP_OKAY) goto cleanup; + i = 0; + while (1) { + if (mp_cmp_d(&t1, 1) == MP_EQ) break; + if ((res = mp_exptmod(&t1, &two, prime, &t1)) != MP_OKAY) goto cleanup; + i++; + } + if (i == 0) { + if ((res = mp_copy(&R, ret)) != MP_OKAY) goto cleanup; + res = MP_OKAY; + goto cleanup; + } + if ((res = mp_sub_d(&M, i, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_exptmod(&two, &t1, prime, &t1)) != MP_OKAY) goto cleanup; + /* t1 = 2 ^ (M - i - 1) */ + if ((res = mp_exptmod(&C, &t1, prime, &t1)) != MP_OKAY) goto cleanup; + /* t1 = C ^ (2 ^ (M - i - 1)) mod prime */ + if ((res = mp_sqrmod(&t1, prime, &C)) != MP_OKAY) goto cleanup; + /* C = (t1 * t1) mod prime */ + if ((res = mp_mulmod(&R, &t1, prime, &R)) != MP_OKAY) goto cleanup; + /* R = (R * t1) mod prime */ + if ((res = mp_mulmod(&T, &C, prime, &T)) != MP_OKAY) goto cleanup; + /* T = (T * C) mod prime */ + mp_set(&M, i); + /* M = i */ + } cleanup: - mp_clear_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL); - return res; + mp_clear_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 2f73faa..75c7c2d 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -16,40 +16,39 @@ */ /* high level subtraction (handles signs) */ -int -mp_sub (mp_int * a, mp_int * b, mp_int * c) +int mp_sub(mp_int *a, mp_int *b, mp_int *c) { - int sa, sb, res; + int sa, sb, res; - sa = a->sign; - sb = b->sign; + sa = a->sign; + sb = b->sign; - if (sa != sb) { - /* subtract a negative from a positive, OR */ - /* subtract a positive from a negative. */ - /* In either case, ADD their magnitudes, */ - /* and use the sign of the first number. */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* subtract a positive from a positive, OR */ - /* subtract a negative from a negative. */ - /* First, take the difference between their */ - /* magnitudes, then... */ - if (mp_cmp_mag (a, b) != MP_LT) { - /* Copy the sign from the first */ + if (sa != sb) { + /* subtract a negative from a positive, OR */ + /* subtract a positive from a negative. */ + /* In either case, ADD their magnitudes, */ + /* and use the sign of the first number. */ c->sign = sa; - /* The first has a larger or equal magnitude */ - res = s_mp_sub (a, b, c); - } else { - /* The result has the *opposite* sign from */ - /* the first number. */ - c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; - /* The second has a larger magnitude */ - res = s_mp_sub (b, a, c); - } - } - return res; + res = s_mp_add(a, b, c); + } else { + /* subtract a positive from a positive, OR */ + /* subtract a negative from a negative. */ + /* First, take the difference between their */ + /* magnitudes, then... */ + if (mp_cmp_mag(a, b) != MP_LT) { + /* Copy the sign from the first */ + c->sign = sa; + /* The first has a larger or equal magnitude */ + res = s_mp_sub(a, b, c); + } else { + /* The result has the *opposite* sign from */ + /* the first number. */ + c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; + /* The second has a larger magnitude */ + res = s_mp_sub(b, a, c); + } + } + return res; } #endif diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 5e96030..7016abc 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -16,74 +16,73 @@ */ /* single digit subtraction */ -int -mp_sub_d (mp_int * a, mp_digit b, mp_int * c) +int mp_sub_d(mp_int *a, mp_digit b, mp_int *c) { - mp_digit *tmpa, *tmpc, mu; - int res, ix, oldused; + mp_digit *tmpa, *tmpc, mu; + int res, ix, oldused; - /* grow c as required */ - if (c->alloc < (a->used + 1)) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } + /* grow c as required */ + if (c->alloc < (a->used + 1)) { + if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { + return res; + } + } - /* if a is negative just do an unsigned - * addition [with fudged signs] - */ - if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; + /* if a is negative just do an unsigned + * addition [with fudged signs] + */ + if (a->sign == MP_NEG) { + a->sign = MP_ZPOS; + res = mp_add_d(a, b, c); + a->sign = c->sign = MP_NEG; - /* clamp */ - mp_clamp(c); + /* clamp */ + mp_clamp(c); - return res; - } + return res; + } - /* setup regs */ - oldused = c->used; - tmpa = a->dp; - tmpc = c->dp; + /* setup regs */ + oldused = c->used; + tmpa = a->dp; + tmpc = c->dp; - /* if a <= b simply fix the single digit */ - if (((a->used == 1) && (a->dp[0] <= b)) || (a->used == 0)) { - if (a->used == 1) { - *tmpc++ = b - *tmpa; - } else { - *tmpc++ = b; - } - ix = 1; + /* if a <= b simply fix the single digit */ + if (((a->used == 1) && (a->dp[0] <= b)) || (a->used == 0)) { + if (a->used == 1) { + *tmpc++ = b - *tmpa; + } else { + *tmpc++ = b; + } + ix = 1; - /* negative/1digit */ - c->sign = MP_NEG; - c->used = 1; - } else { - /* positive/size */ - c->sign = MP_ZPOS; - c->used = a->used; + /* negative/1digit */ + c->sign = MP_NEG; + c->used = 1; + } else { + /* positive/size */ + c->sign = MP_ZPOS; + c->used = a->used; - /* subtract first digit */ - *tmpc = *tmpa++ - b; - mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); - *tmpc++ &= MP_MASK; + /* subtract first digit */ + *tmpc = *tmpa++ - b; + mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); + *tmpc++ &= MP_MASK; - /* handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ - mu; - mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); - *tmpc++ &= MP_MASK; - } - } + /* handle rest of the digits */ + for (ix = 1; ix < a->used; ix++) { + *tmpc = *tmpa++ - mu; + mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); + *tmpc++ &= MP_MASK; + } + } - /* zero excess digits */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - return MP_OKAY; + /* zero excess digits */ + while (ix++ < oldused) { + *tmpc++ = 0; + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 138863c..510fb19 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -16,24 +16,23 @@ */ /* d = a - b (mod c) */ -int -mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } + if ((res = mp_init(&t)) != MP_OKAY) { + return res; + } - if ((res = mp_sub (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; + if ((res = mp_sub(a, b, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, c, d); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index c49c87d..615bf32 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -16,15 +16,15 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin (mp_int * a, unsigned char *b) +int mp_to_signed_bin(mp_int *a, unsigned char *b) { - int res; + int res; - if ((res = mp_to_unsigned_bin (a, b + 1)) != MP_OKAY) { - return res; - } - b[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1; - return MP_OKAY; + if ((res = mp_to_unsigned_bin(a, b + 1)) != MP_OKAY) { + return res; + } + b[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index dc5ec26..501f849 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_signed_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index d249359..e103383 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -16,30 +16,30 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin (mp_int * a, unsigned char *b) +int mp_to_unsigned_bin(mp_int *a, unsigned char *b) { - int x, res; - mp_int t; + int x, res; + mp_int t; - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - x = 0; - while (mp_iszero (&t) == MP_NO) { + x = 0; + while (mp_iszero(&t) == MP_NO) { #ifndef MP_8BIT - b[x++] = (unsigned char) (t.dp[0] & 255); + b[x++] = (unsigned char)(t.dp[0] & 255); #else - b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7)); + b[x++] = (unsigned char)(t.dp[0] | ((t.dp[1] & 0x01) << 7)); #endif - if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) { - mp_clear (&t); - return res; - } - } - bn_reverse (b, x); - mp_clear (&t); - return MP_OKAY; + if ((res = mp_div_2d(&t, 8, &t, NULL)) != MP_OKAY) { + mp_clear(&t); + return res; + } + } + bn_reverse(b, x); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index f671621..5ee28f1 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 4a574fc..8b771bc 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -24,259 +24,259 @@ */ int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) { - mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; - int res, B; + mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; + int res, B; - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) { - return res; - } + /* init temps */ + if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, + &a0, &a1, &a2, &b0, &b1, + &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) { + return res; + } - /* B */ - B = MIN(a->used, b->used) / 3; + /* B */ + B = MIN(a->used, b->used) / 3; - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } + /* a = a2 * B**2 + a1 * B + a0 */ + if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_copy(a, &a1)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a1, B); + if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); + if ((res = mp_copy(a, &a2)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a2, B*2); - /* b = b2 * B**2 + b1 * B + b0 */ - if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) { - goto ERR; - } + /* b = b2 * B**2 + b1 * B + b0 */ + if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_copy(b, &b1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b1, B); - (void)mp_mod_2d(&b1, DIGIT_BIT * B, &b1); + if ((res = mp_copy(b, &b1)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&b1, B); + (void)mp_mod_2d(&b1, DIGIT_BIT * B, &b1); - if ((res = mp_copy(b, &b2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b2, B*2); + if ((res = mp_copy(b, &b2)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&b2, B*2); - /* w0 = a0*b0 */ - if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) { - goto ERR; - } + /* w0 = a0*b0 */ + if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) { + goto ERR; + } - /* w4 = a2 * b2 */ - if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) { - goto ERR; - } + /* w4 = a2 * b2 */ + if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) { + goto ERR; + } - /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } + /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ + if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) { + goto ERR; + } - /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } + /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ + if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) { + goto ERR; + } - /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) { - goto ERR; - } + /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ + if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) { + goto ERR; + } - /* now solve the matrix + /* now solve the matrix - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 + 0 0 0 0 1 + 1 2 4 8 16 + 1 1 1 1 1 + 16 8 4 2 1 + 1 0 0 0 0 - using 12 subtractions, 4 shifts, - 2 small divisions and 1 small multiplication - */ + using 12 subtractions, 4 shifts, + 2 small divisions and 1 small multiplication + */ - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } + /* r1 - r4 */ + if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r0 */ + if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/2 */ + if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3/2 */ + if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { + goto ERR; + } + /* r2 - r0 - r4 */ + if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1 - 8r0 */ + if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - 8r4 */ + if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { + goto ERR; + } + /* 3r2 - r1 - r3 */ + if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/3 */ + if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { + goto ERR; + } + /* r3/3 */ + if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { + goto ERR; + } - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } + /* at this point shift W[n] by B*n */ + if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) { + goto ERR; + } ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL); - return res; + mp_clear_multi(&w0, &w1, &w2, &w3, &w4, + &a0, &a1, &a2, &b0, &b1, + &b2, &tmp1, &tmp2, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 0a38192..5e1e452 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -16,209 +16,208 @@ */ /* squaring using Toom-Cook 3-way algorithm */ -int -mp_toom_sqr(mp_int *a, mp_int *b) +int mp_toom_sqr(mp_int *a, mp_int *b) { - mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; - int res, B; - - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) { - return res; - } - - /* B */ - B = a->used / 3; - - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); - - /* w0 = a0*a0 */ - if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) { - goto ERR; - } - - /* w4 = a2 * a2 */ - if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) { - goto ERR; - } - - /* w1 = (a2 + 2(a1 + 2a0))**2 */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - - /* w3 = (a0 + 2(a1 + 2a2))**2 */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - - - /* w2 = (a2 + a1 + a0)**2 */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) { - goto ERR; - } - - /* now solve the matrix - - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 - - using 12 subtractions, 4 shifts, 2 small divisions and 1 small multiplication. - */ - - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } - - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) { - goto ERR; - } + mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; + int res, B; + + /* init temps */ + if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) { + return res; + } + + /* B */ + B = a->used / 3; + + /* a = a2 * B**2 + a1 * B + a0 */ + if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_copy(a, &a1)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a1, B); + if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_copy(a, &a2)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a2, B*2); + + /* w0 = a0*a0 */ + if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) { + goto ERR; + } + + /* w4 = a2 * a2 */ + if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) { + goto ERR; + } + + /* w1 = (a2 + 2(a1 + 2a0))**2 */ + if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) { + goto ERR; + } + + /* w3 = (a0 + 2(a1 + 2a2))**2 */ + if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) { + goto ERR; + } + + + /* w2 = (a2 + a1 + a0)**2 */ + if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) { + goto ERR; + } + + /* now solve the matrix + + 0 0 0 0 1 + 1 2 4 8 16 + 1 1 1 1 1 + 16 8 4 2 1 + 1 0 0 0 0 + + using 12 subtractions, 4 shifts, 2 small divisions and 1 small multiplication. + */ + + /* r1 - r4 */ + if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r0 */ + if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/2 */ + if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3/2 */ + if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { + goto ERR; + } + /* r2 - r0 - r4 */ + if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1 - 8r0 */ + if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - 8r4 */ + if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { + goto ERR; + } + /* 3r2 - r1 - r3 */ + if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/3 */ + if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { + goto ERR; + } + /* r3/3 */ + if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { + goto ERR; + } + + /* at this point shift W[n] by B*n */ + if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) { + goto ERR; + } ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL); - return res; + mp_clear_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 3337765..5016219 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -16,56 +16,56 @@ */ /* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix (mp_int * a, char *str, int radix) +int mp_toradix(mp_int *a, char *str, int radix) { - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; + int res, digs; + mp_int t; + mp_digit d; + char *_s = str; - /* check range of the radix */ - if ((radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* check range of the radix */ + if ((radix < 2) || (radix > 64)) { + return MP_VAL; + } - /* quick out if its zero */ - if (mp_iszero(a) == MP_YES) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } + /* quick out if its zero */ + if (mp_iszero(a) == MP_YES) { + *str++ = '0'; + *str = '\0'; + return MP_OKAY; + } - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - ++_s; - *str++ = '-'; - t.sign = MP_ZPOS; - } + /* if it is negative output a - */ + if (t.sign == MP_NEG) { + ++_s; + *str++ = '-'; + t.sign = MP_ZPOS; + } - digs = 0; - while (mp_iszero (&t) == MP_NO) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } + digs = 0; + while (mp_iszero(&t) == MP_NO) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { + mp_clear(&t); + return res; + } + *str++ = mp_s_rmap[d]; + ++digs; + } - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number] - */ - bn_reverse ((unsigned char *)_s, digs); + /* reverse the digits of the string. In this case _s points + * to the first digit [exluding the sign] of the number] + */ + bn_reverse((unsigned char *)_s, digs); - /* append a NULL so the string is properly terminated */ - *str = '\0'; + /* append a NULL so the string is properly terminated */ + *str = '\0'; - mp_clear (&t); - return MP_OKAY; + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index ae24ada..287d3f8 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -15,70 +15,70 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* stores a bignum as a ASCII string in a given radix (2..64) +/* stores a bignum as a ASCII string in a given radix (2..64) * - * Stores upto maxlen-1 chars and always a NULL byte + * Stores upto maxlen-1 chars and always a NULL byte */ -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) +int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen) { - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; + int res, digs; + mp_int t; + mp_digit d; + char *_s = str; - /* check range of the maxlen, radix */ - if ((maxlen < 2) || (radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* check range of the maxlen, radix */ + if ((maxlen < 2) || (radix < 2) || (radix > 64)) { + return MP_VAL; + } - /* quick out if its zero */ - if (mp_iszero(a) == MP_YES) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } + /* quick out if its zero */ + if (mp_iszero(a) == MP_YES) { + *str++ = '0'; + *str = '\0'; + return MP_OKAY; + } - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - /* we have to reverse our digits later... but not the - sign!! */ - ++_s; + /* if it is negative output a - */ + if (t.sign == MP_NEG) { + /* we have to reverse our digits later... but not the - sign!! */ + ++_s; - /* store the flag and mark the number as positive */ - *str++ = '-'; - t.sign = MP_ZPOS; - - /* subtract a char */ - --maxlen; - } + /* store the flag and mark the number as positive */ + *str++ = '-'; + t.sign = MP_ZPOS; - digs = 0; - while (mp_iszero (&t) == MP_NO) { - if (--maxlen < 1) { - /* no more room */ - break; - } - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } + /* subtract a char */ + --maxlen; + } + + digs = 0; + while (mp_iszero(&t) == MP_NO) { + if (--maxlen < 1) { + /* no more room */ + break; + } + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { + mp_clear(&t); + return res; + } + *str++ = mp_s_rmap[d]; + ++digs; + } - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number - */ - bn_reverse ((unsigned char *)_s, digs); + /* reverse the digits of the string. In this case _s points + * to the first digit [exluding the sign] of the number + */ + bn_reverse((unsigned char *)_s, digs); - /* append a NULL so the string is properly terminated */ - *str = '\0'; + /* append a NULL so the string is properly terminated */ + *str = '\0'; - mp_clear (&t); - return MP_OKAY; + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index f46d0ba..174cdc1 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -16,10 +16,10 @@ */ /* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size (mp_int * a) +int mp_unsigned_bin_size(mp_int *a) { - int size = mp_count_bits (a); - return (size / 8) + (((size & 7) != 0) ? 1 : 0); + int size = mp_count_bits(a); + return (size / 8) + (((size & 7) != 0) ? 1 : 0); } #endif diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index f51fc8e..4224a7f 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -16,33 +16,32 @@ */ /* XOR two ints together */ -int -mp_xor (mp_int * a, mp_int * b, mp_int * c) +int mp_xor(mp_int *a, mp_int *b, mp_int *c) { - int res, ix, px; - mp_int t, *x; + int res, ix, px; + mp_int t, *x; - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } + if (a->used > b->used) { + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } + px = b->used; + x = b; + } else { + if ((res = mp_init_copy(&t, b)) != MP_OKAY) { + return res; + } + px = a->used; + x = a; + } - for (ix = 0; ix < px; ix++) { - t.dp[ix] ^= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; + for (ix = 0; ix < px; ix++) { + t.dp[ix] ^= x->dp[ix]; + } + mp_clamp(&t); + mp_exch(c, &t); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index a7d59e4..08aac2a 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -16,18 +16,18 @@ */ /* set to zero */ -void mp_zero (mp_int * a) +void mp_zero(mp_int *a) { - int n; - mp_digit *tmp; + int n; + mp_digit *tmp; - a->sign = MP_ZPOS; - a->used = 0; + a->sign = MP_ZPOS; + a->used = 0; - tmp = a->dp; - for (n = 0; n < a->alloc; n++) { - *tmp++ = 0; - } + tmp = a->dp; + for (n = 0; n < a->alloc; n++) { + *tmp++ = 0; + } } #endif diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index 5252130..c8fadcd 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -15,43 +15,43 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ const mp_digit ltm_prime_tab[] = { - 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, - 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, - 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, - 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, + 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, + 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, + 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, + 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, #ifndef MP_8BIT - 0x0083, - 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, - 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, - 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, - 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, + 0x0083, + 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, + 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, + 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, + 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, - 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, - 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, - 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, - 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, - 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, - 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, - 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, - 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, + 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, + 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, + 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, + 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, + 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, + 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, + 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, + 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, - 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, - 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, - 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, - 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, - 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, - 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, - 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, - 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, + 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, + 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, + 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, + 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, + 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, + 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, + 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, + 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, - 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, - 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, - 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, - 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, - 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, - 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, - 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, - 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 + 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, + 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, + 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, + 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, + 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, + 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, + 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, + 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 #endif }; #endif diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index dc87a4e..71e3d03 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -16,21 +16,20 @@ */ /* reverse an array, used for radix code */ -void -bn_reverse (unsigned char *s, int len) +void bn_reverse(unsigned char *s, int len) { - int ix, iy; - unsigned char t; + int ix, iy; + unsigned char t; - ix = 0; - iy = len - 1; - while (ix < iy) { - t = s[ix]; - s[ix] = s[iy]; - s[iy] = t; - ++ix; - --iy; - } + ix = 0; + iy = len - 1; + while (ix < iy) { + t = s[ix]; + s[ix] = s[iy]; + s[iy] = t; + ++ix; + --iy; + } } #endif diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 7a100e8..6ba65da 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -16,91 +16,90 @@ */ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int -s_mp_add (mp_int * a, mp_int * b, mp_int * c) +int s_mp_add(mp_int *a, mp_int *b, mp_int *c) { - mp_int *x; - int olduse, res, min, max; - - /* find sizes, we let |a| <= |b| which means we have to sort - * them. "x" will point to the input with the most digits - */ - if (a->used > b->used) { - min = b->used; - max = a->used; - x = a; - } else { - min = a->used; - max = b->used; - x = b; - } - - /* init result */ - if (c->alloc < (max + 1)) { - if ((res = mp_grow (c, max + 1)) != MP_OKAY) { - return res; - } - } - - /* get old used digit count and set new one */ - olduse = c->used; - c->used = max + 1; - - { - mp_digit u, *tmpa, *tmpb, *tmpc; - int i; - - /* alias for digit pointers */ - - /* first input */ - tmpa = a->dp; - - /* second input */ - tmpb = b->dp; - - /* destination */ - tmpc = c->dp; - - /* zero the carry */ - u = 0; - for (i = 0; i < min; i++) { - /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ - *tmpc = *tmpa++ + *tmpb++ + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* now copy higher words if any, that is in A+B - * if A or B has more digits add those in - */ - if (min != max) { - for (; i < max; i++) { - /* T[i] = X[i] + U */ - *tmpc = x->dp[i] + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; + mp_int *x; + int olduse, res, min, max; + + /* find sizes, we let |a| <= |b| which means we have to sort + * them. "x" will point to the input with the most digits + */ + if (a->used > b->used) { + min = b->used; + max = a->used; + x = a; + } else { + min = a->used; + max = b->used; + x = b; + } + + /* init result */ + if (c->alloc < (max + 1)) { + if ((res = mp_grow(c, max + 1)) != MP_OKAY) { + return res; } - } + } - /* add carry */ - *tmpc++ = u; + /* get old used digit count and set new one */ + olduse = c->used; + c->used = max + 1; - /* clear digits above oldused */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } + { + mp_digit u, *tmpa, *tmpb, *tmpc; + int i; - mp_clamp (c); - return MP_OKAY; + /* alias for digit pointers */ + + /* first input */ + tmpa = a->dp; + + /* second input */ + tmpb = b->dp; + + /* destination */ + tmpc = c->dp; + + /* zero the carry */ + u = 0; + for (i = 0; i < min; i++) { + /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ + *tmpc = *tmpa++ + *tmpb++ + u; + + /* U = carry bit of T[i] */ + u = *tmpc >> ((mp_digit)DIGIT_BIT); + + /* take away carry bit from T[i] */ + *tmpc++ &= MP_MASK; + } + + /* now copy higher words if any, that is in A+B + * if A or B has more digits add those in + */ + if (min != max) { + for (; i < max; i++) { + /* T[i] = X[i] + U */ + *tmpc = x->dp[i] + u; + + /* U = carry bit of T[i] */ + u = *tmpc >> ((mp_digit)DIGIT_BIT); + + /* take away carry bit from T[i] */ + *tmpc++ &= MP_MASK; + } + } + + /* add carry */ + *tmpc++ = u; + + /* clear digits above oldused */ + for (i = c->used; i < olduse; i++) { + *tmpc++ = 0; + } + } + + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index ab820d4..f8e6b3b 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -15,235 +15,237 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ #ifdef MP_LOW_MEM - #define TAB_SIZE 32 +# define TAB_SIZE 32 #else - #define TAB_SIZE 256 +# define TAB_SIZE 256 #endif -int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) +int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) { - mp_int M[TAB_SIZE], res, mu; - mp_digit buf; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int*,mp_int*,mp_int*); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } + mp_int M[TAB_SIZE], res, mu; + mp_digit buf; + int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; + int (*redux)(mp_int *,mp_int *,mp_int *); + + /* find window size */ + x = mp_count_bits(X); + if (x <= 7) { + winsize = 2; + } else if (x <= 36) { + winsize = 3; + } else if (x <= 140) { + winsize = 4; + } else if (x <= 450) { + winsize = 5; + } else if (x <= 1303) { + winsize = 6; + } else if (x <= 3529) { + winsize = 7; + } else { + winsize = 8; + } #ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } + if (winsize > 5) { + winsize = 5; + } #endif - /* init M array */ - /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); + /* init M array */ + /* init first cell */ + if ((err = mp_init(&M[1])) != MP_OKAY) { return err; - } - } - - /* create mu, used for Barrett reduction */ - if ((err = mp_init (&mu)) != MP_OKAY) { - goto LBL_M; - } - - if (redmode == 0) { - if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce; - } else { - if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce_2k_l; - } - - /* create M table - * - * The M table contains powers of the base, - * e.g. M[x] = G**x mod P - * - * The first half of the table is not - * computed though accept for M[0] and M[1] - */ - if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) { - goto LBL_MU; - } - - /* compute the value at M[1<<(winsize-1)] by squaring - * M[1] (winsize-1) times - */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } - - for (x = 0; x < (winsize - 1); x++) { - /* square it */ - if ((err = mp_sqr (&M[1 << (winsize - 1)], - &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } + } + + /* now init the second half of the array */ + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + if ((err = mp_init(&M[x])) != MP_OKAY) { + for (y = 1<<(winsize-1); y < x; y++) { + mp_clear(&M[y]); + } + mp_clear(&M[1]); + return err; + } + } - /* reduce modulo P */ - if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) - * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) - */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { + /* create mu, used for Barrett reduction */ + if ((err = mp_init(&mu)) != MP_OKAY) { + goto LBL_M; + } + + if (redmode == 0) { + if ((err = mp_reduce_setup(&mu, P)) != MP_OKAY) { + goto LBL_MU; + } + redux = mp_reduce; + } else { + if ((err = mp_reduce_2k_setup_l(P, &mu)) != MP_OKAY) { + goto LBL_MU; + } + redux = mp_reduce_2k_l; + } + + /* create M table + * + * The M table contains powers of the base, + * e.g. M[x] = G**x mod P + * + * The first half of the table is not + * computed though accept for M[0] and M[1] + */ + if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { goto LBL_MU; - } - if ((err = redux (&M[x], P, &mu)) != MP_OKAY) { + } + + /* compute the value at M[1<<(winsize-1)] by squaring + * M[1] (winsize-1) times + */ + if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { goto LBL_MU; - } - } - - /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { - goto LBL_MU; - } - mp_set (&res, 1); - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits */ - if (digidx == -1) { - break; + } + + for (x = 0; x < (winsize - 1); x++) { + /* square it */ + if ((err = mp_sqr(&M[1 << (winsize - 1)], + &M[1 << (winsize - 1)])) != MP_OKAY) { + goto LBL_MU; } - /* read next digit and reset the bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int) DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if ((mode == 0) && (y == 0)) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if ((mode == 1) && (y == 0)) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; + + /* reduce modulo P */ + if ((err = redux(&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { + goto LBL_MU; } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; + } + + /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) + * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) + */ + for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { + if ((err = mp_mul(&M[x - 1], &M[1], &M[x])) != MP_OKAY) { + goto LBL_MU; } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } + if ((err = redux(&M[x], P, &mu)) != MP_OKAY) { + goto LBL_MU; } + } - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; + /* setup result */ + if ((err = mp_init(&res)) != MP_OKAY) { + goto LBL_MU; + } + mp_set(&res, 1); + + /* set initial mode and bit cnt */ + mode = 0; + bitcnt = 1; + buf = 0; + digidx = X->used - 1; + bitcpy = 0; + bitbuf = 0; + + for (;;) { + /* grab next digit as required */ + if (--bitcnt == 0) { + /* if digidx == -1 we are out of digits */ + if (digidx == -1) { + break; + } + /* read next digit and reset the bitcnt */ + buf = X->dp[digidx--]; + bitcnt = (int)DIGIT_BIT; } - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if ((mode == 2) && (bitcpy > 0)) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; + /* grab the next msb from the exponent */ + y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; + buf <<= (mp_digit)1; + + /* if the bit is zero and mode == 0 then we ignore it + * These represent the leading zero bits before the first 1 bit + * in the exponent. Technically this opt is not required but it + * does lower the # of trivial squaring/reductions used + */ + if ((mode == 0) && (y == 0)) { + continue; } - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } + /* if the bit is zero and mode == 1 then we square */ + if ((mode == 1) && (y == 0)) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + continue; } - } - } - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); -LBL_MU:mp_clear (&mu); + /* else we add it to the window */ + bitbuf |= (y << (winsize - ++bitcpy)); + mode = 2; + + if (bitcpy == winsize) { + /* ok window is filled so square as required and multiply */ + /* square first */ + for (x = 0; x < winsize; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + } + + /* then multiply */ + if ((err = mp_mul(&res, &M[bitbuf], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + + /* empty window and reset */ + bitcpy = 0; + bitbuf = 0; + mode = 1; + } + } + + /* if bits remain then square/multiply */ + if ((mode == 2) && (bitcpy > 0)) { + /* square then multiply if the bit is set */ + for (x = 0; x < bitcpy; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + + bitbuf <<= 1; + if ((bitbuf & (1 << winsize)) != 0) { + /* then multiply */ + if ((err = mp_mul(&res, &M[1], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + } + } + } + + mp_exch(&res, Y); + err = MP_OKAY; +LBL_RES: + mp_clear(&res); +LBL_MU: + mp_clear(&mu); LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; + mp_clear(&M[1]); + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + mp_clear(&M[x]); + } + return err; } #endif diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index 8f1bf97..c72c2a8 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -16,72 +16,72 @@ */ /* multiplies |a| * |b| and only computes upto digs digits of result - * HAC pp. 595, Algorithm 14.12 Modified so you can control how + * HAC pp. 595, Algorithm 14.12 Modified so you can control how * many digits of output are created. */ -int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; + mp_int t; + int res, pa, pb, ix, iy; + mp_digit u; + mp_word r; + mp_digit tmpx, *tmpt, *tmpy; - /* can we use the fast multiplier? */ - if (((digs) < MP_WARRAY) && - (MIN (a->used, b->used) < - (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - return fast_s_mp_mul_digs (a, b, c, digs); - } + /* can we use the fast multiplier? */ + if (((digs) < MP_WARRAY) && + (MIN(a->used, b->used) < + (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + return fast_s_mp_mul_digs(a, b, c, digs); + } - if ((res = mp_init_size (&t, digs)) != MP_OKAY) { - return res; - } - t.used = digs; + if ((res = mp_init_size(&t, digs)) != MP_OKAY) { + return res; + } + t.used = digs; - /* compute the digits of the product directly */ - pa = a->used; - for (ix = 0; ix < pa; ix++) { - /* set the carry to zero */ - u = 0; + /* compute the digits of the product directly */ + pa = a->used; + for (ix = 0; ix < pa; ix++) { + /* set the carry to zero */ + u = 0; - /* limit ourselves to making digs digits of output */ - pb = MIN (b->used, digs - ix); + /* limit ourselves to making digs digits of output */ + pb = MIN(b->used, digs - ix); - /* setup some aliases */ - /* copy of the digit from a used within the nested loop */ - tmpx = a->dp[ix]; - - /* an alias for the destination shifted ix places */ - tmpt = t.dp + ix; - - /* an alias for the digits of b */ - tmpy = b->dp; + /* setup some aliases */ + /* copy of the digit from a used within the nested loop */ + tmpx = a->dp[ix]; - /* compute the columns of the output and propagate the carry */ - for (iy = 0; iy < pb; iy++) { - /* compute the column as a mp_word */ - r = (mp_word)*tmpt + - ((mp_word)tmpx * (mp_word)*tmpy++) + - (mp_word)u; + /* an alias for the destination shifted ix places */ + tmpt = t.dp + ix; - /* the new column is the lower part of the result */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* an alias for the digits of b */ + tmpy = b->dp; - /* get the carry word from the result */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - /* set carry if it is placed below digs */ - if ((ix + iy) < digs) { - *tmpt = u; - } - } + /* compute the columns of the output and propagate the carry */ + for (iy = 0; iy < pb; iy++) { + /* compute the column as a mp_word */ + r = (mp_word)*tmpt + + ((mp_word)tmpx * (mp_word)*tmpy++) + + (mp_word)u; - mp_clamp (&t); - mp_exch (&t, c); + /* the new column is the lower part of the result */ + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); - mp_clear (&t); - return MP_OKAY; + /* get the carry word from the result */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + /* set carry if it is placed below digs */ + if ((ix + iy) < digs) { + *tmpt = u; + } + } + + mp_clamp(&t); + mp_exch(&t, c); + + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 031f17b..0e12f3b 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -18,61 +18,60 @@ /* multiplies |a| * |b| and does not compute the lower digs digits * [meant to get the higher part of the product] */ -int -s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; + mp_int t; + int res, pa, pb, ix, iy; + mp_digit u; + mp_word r; + mp_digit tmpx, *tmpt, *tmpy; - /* can we use the fast multiplier? */ + /* can we use the fast multiplier? */ #ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C - if (((a->used + b->used + 1) < MP_WARRAY) - && (MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - return fast_s_mp_mul_high_digs (a, b, c, digs); - } + if (((a->used + b->used + 1) < MP_WARRAY) + && (MIN(a->used, b->used) < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + return fast_s_mp_mul_high_digs(a, b, c, digs); + } #endif - if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) { - return res; - } - t.used = a->used + b->used + 1; + if ((res = mp_init_size(&t, a->used + b->used + 1)) != MP_OKAY) { + return res; + } + t.used = a->used + b->used + 1; - pa = a->used; - pb = b->used; - for (ix = 0; ix < pa; ix++) { - /* clear the carry */ - u = 0; + pa = a->used; + pb = b->used; + for (ix = 0; ix < pa; ix++) { + /* clear the carry */ + u = 0; - /* left hand side of A[ix] * B[iy] */ - tmpx = a->dp[ix]; + /* left hand side of A[ix] * B[iy] */ + tmpx = a->dp[ix]; - /* alias to the address of where the digits will be stored */ - tmpt = &(t.dp[digs]); + /* alias to the address of where the digits will be stored */ + tmpt = &(t.dp[digs]); - /* alias for where to read the right hand side from */ - tmpy = b->dp + (digs - ix); + /* alias for where to read the right hand side from */ + tmpy = b->dp + (digs - ix); - for (iy = digs - ix; iy < pb; iy++) { - /* calculate the double precision result */ - r = (mp_word)*tmpt + - ((mp_word)tmpx * (mp_word)*tmpy++) + - (mp_word)u; + for (iy = digs - ix; iy < pb; iy++) { + /* calculate the double precision result */ + r = (mp_word)*tmpt + + ((mp_word)tmpx * (mp_word)*tmpy++) + + (mp_word)u; - /* get the lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* get the lower part */ + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); - /* carry the carry */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - *tmpt = u; - } - mp_clamp (&t); - mp_exch (&t, c); - mp_clear (&t); - return MP_OKAY; + /* carry the carry */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + *tmpt = u; + } + mp_clamp(&t); + mp_exch(&t, c); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index ac0e157..2910f24 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -16,66 +16,66 @@ */ /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr (mp_int * a, mp_int * b) +int s_mp_sqr(mp_int *a, mp_int *b) { - mp_int t; - int res, ix, iy, pa; - mp_word r; - mp_digit u, tmpx, *tmpt; + mp_int t; + int res, ix, iy, pa; + mp_word r; + mp_digit u, tmpx, *tmpt; - pa = a->used; - if ((res = mp_init_size (&t, (2 * pa) + 1)) != MP_OKAY) { - return res; - } + pa = a->used; + if ((res = mp_init_size(&t, (2 * pa) + 1)) != MP_OKAY) { + return res; + } - /* default used is maximum possible size */ - t.used = (2 * pa) + 1; + /* default used is maximum possible size */ + t.used = (2 * pa) + 1; - for (ix = 0; ix < pa; ix++) { - /* first calculate the digit at 2*ix */ - /* calculate double precision result */ - r = (mp_word)t.dp[2*ix] + - ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); + for (ix = 0; ix < pa; ix++) { + /* first calculate the digit at 2*ix */ + /* calculate double precision result */ + r = (mp_word)t.dp[2*ix] + + ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); - /* store lower part in result */ - t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK)); + /* store lower part in result */ + t.dp[ix+ix] = (mp_digit)(r & ((mp_word)MP_MASK)); - /* get the carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + /* get the carry */ + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); - /* left hand side of A[ix] * A[iy] */ - tmpx = a->dp[ix]; + /* left hand side of A[ix] * A[iy] */ + tmpx = a->dp[ix]; - /* alias for where to store the results */ - tmpt = t.dp + ((2 * ix) + 1); - - for (iy = ix + 1; iy < pa; iy++) { - /* first calculate the product */ - r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); + /* alias for where to store the results */ + tmpt = t.dp + ((2 * ix) + 1); - /* now calculate the double precision result, note we use - * addition instead of *2 since it's easier to optimize - */ - r = ((mp_word) *tmpt) + r + r + ((mp_word) u); + for (iy = ix + 1; iy < pa; iy++) { + /* first calculate the product */ + r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); - /* store lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* now calculate the double precision result, note we use + * addition instead of *2 since it's easier to optimize + */ + r = ((mp_word) *tmpt) + r + r + ((mp_word) u); - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - /* propagate upwards */ - while (u != ((mp_digit) 0)) { - r = ((mp_word) *tmpt) + ((mp_word) u); - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - } + /* store lower part */ + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); - mp_clamp (&t); - mp_exch (&t, b); - mp_clear (&t); - return MP_OKAY; + /* get carry */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + /* propagate upwards */ + while (u != ((mp_digit) 0)) { + r = ((mp_word) *tmpt) + ((mp_word) u); + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + } + + mp_clamp(&t); + mp_exch(&t, b); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 8091f4a..f61aa83 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -16,70 +16,69 @@ */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int -s_mp_sub (mp_int * a, mp_int * b, mp_int * c) +int s_mp_sub(mp_int *a, mp_int *b, mp_int *c) { - int olduse, res, min, max; + int olduse, res, min, max; - /* find sizes */ - min = b->used; - max = a->used; + /* find sizes */ + min = b->used; + max = a->used; - /* init result */ - if (c->alloc < max) { - if ((res = mp_grow (c, max)) != MP_OKAY) { - return res; - } - } - olduse = c->used; - c->used = max; + /* init result */ + if (c->alloc < max) { + if ((res = mp_grow(c, max)) != MP_OKAY) { + return res; + } + } + olduse = c->used; + c->used = max; - { - mp_digit u, *tmpa, *tmpb, *tmpc; - int i; + { + mp_digit u, *tmpa, *tmpb, *tmpc; + int i; - /* alias for digit pointers */ - tmpa = a->dp; - tmpb = b->dp; - tmpc = c->dp; + /* alias for digit pointers */ + tmpa = a->dp; + tmpb = b->dp; + tmpc = c->dp; - /* set carry to zero */ - u = 0; - for (i = 0; i < min; i++) { - /* T[i] = A[i] - B[i] - U */ - *tmpc = (*tmpa++ - *tmpb++) - u; + /* set carry to zero */ + u = 0; + for (i = 0; i < min; i++) { + /* T[i] = A[i] - B[i] - U */ + *tmpc = (*tmpa++ - *tmpb++) - u; - /* U = carry bit of T[i] - * Note this saves performing an AND operation since - * if a carry does occur it will propagate all the way to the - * MSB. As a result a single shift is enough to get the carry - */ - u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); + /* U = carry bit of T[i] + * Note this saves performing an AND operation since + * if a carry does occur it will propagate all the way to the + * MSB. As a result a single shift is enough to get the carry + */ + u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } + /* Clear carry from T[i] */ + *tmpc++ &= MP_MASK; + } - /* now copy higher words if any, e.g. if A has more digits than B */ - for (; i < max; i++) { - /* T[i] = A[i] - U */ - *tmpc = *tmpa++ - u; + /* now copy higher words if any, e.g. if A has more digits than B */ + for (; i < max; i++) { + /* T[i] = A[i] - U */ + *tmpc = *tmpa++ - u; - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); + /* U = carry bit of T[i] */ + u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } + /* Clear carry from T[i] */ + *tmpc++ &= MP_MASK; + } - /* clear digits above used (since we may not have grown result above) */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } + /* clear digits above used (since we may not have grown result above) */ + for (i = c->used; i < olduse; i++) { + *tmpc++ = 0; + } + } - mp_clamp (c); - return MP_OKAY; + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bncore.c b/libtommath/bncore.c index e80ec99..cfd19f0 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -21,14 +21,14 @@ ------------------------------------------------------------- Intel P4 Northwood /GCC v3.4.1 / 88/ 128/LTM 0.32 ;-) AMD Athlon64 /GCC v3.4.4 / 80/ 120/LTM 0.35 - + */ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsuba multiplication is used. */ KARATSUBA_SQR_CUTOFF = 120, /* Min. number of digits before Karatsuba squaring is used. */ - + TOOM_MUL_CUTOFF = 350, /* no optimal values of these are known yet so set em high */ - TOOM_SQR_CUTOFF = 400; + TOOM_SQR_CUTOFF = 400; #endif /* ref: $Format:%D$ */ diff --git a/libtommath/makefile b/libtommath/makefile index fdd2435..64d8fcd 100644 --- a/libtommath/makefile +++ b/libtommath/makefile @@ -149,3 +149,6 @@ new_file: perlcritic: perlcritic *.pl + +astyle: + astyle --options=astylerc $(OBJECTS:.o=.c) diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 80bae69..2aaea5b 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -33,9 +33,9 @@ extern "C" { defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \ defined(__ia64) || defined(__ia64__) || defined(__itanium__) || defined(_M_IA64) || \ defined(__LP64__) || defined(_LP64) || defined(__64BIT__) - #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) - #define MP_64BIT - #endif +# if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) +# define MP_64BIT +# endif #endif /* some default configurations. @@ -47,68 +47,68 @@ extern "C" { * [any size beyond that is ok provided it doesn't overflow the data type] */ #ifdef MP_8BIT - typedef uint8_t mp_digit; - typedef uint16_t mp_word; -#define MP_SIZEOF_MP_DIGIT 1 -#ifdef DIGIT_BIT -#error You must not define DIGIT_BIT when using MP_8BIT -#endif +typedef uint8_t mp_digit; +typedef uint16_t mp_word; +# define MP_SIZEOF_MP_DIGIT 1 +# ifdef DIGIT_BIT +# error You must not define DIGIT_BIT when using MP_8BIT +# endif #elif defined(MP_16BIT) - typedef uint16_t mp_digit; - typedef uint32_t mp_word; -#define MP_SIZEOF_MP_DIGIT 2 -#ifdef DIGIT_BIT -#error You must not define DIGIT_BIT when using MP_16BIT -#endif +typedef uint16_t mp_digit; +typedef uint32_t mp_word; +# define MP_SIZEOF_MP_DIGIT 2 +# ifdef DIGIT_BIT +# error You must not define DIGIT_BIT when using MP_16BIT +# endif #elif defined(MP_64BIT) - /* for GCC only on supported platforms */ - typedef uint64_t mp_digit; -#if defined(_WIN32) - typedef unsigned __int128 mp_word; -#elif defined(__GNUC__) - typedef unsigned long mp_word __attribute__ ((mode(TI))); -#else - /* it seems you have a problem - * but we assume you can somewhere define your own uint128_t */ - typedef uint128_t mp_word; -#endif - - #define DIGIT_BIT 60 +/* for GCC only on supported platforms */ +typedef uint64_t mp_digit; +# if defined(_WIN32) +typedef unsigned __int128 mp_word; +# elif defined(__GNUC__) +typedef unsigned long mp_word __attribute__((mode(TI))); +# else +/* it seems you have a problem + * but we assume you can somewhere define your own uint128_t */ +typedef uint128_t mp_word; +# endif + +# define DIGIT_BIT 60 #else - /* this is the default case, 28-bit digits */ - - /* this is to make porting into LibTomCrypt easier :-) */ - typedef uint32_t mp_digit; - typedef uint64_t mp_word; - -#ifdef MP_31BIT - /* this is an extension that uses 31-bit digits */ - #define DIGIT_BIT 31 -#else - /* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */ - #define DIGIT_BIT 28 - #define MP_28BIT -#endif +/* this is the default case, 28-bit digits */ + +/* this is to make porting into LibTomCrypt easier :-) */ +typedef uint32_t mp_digit; +typedef uint64_t mp_word; + +# ifdef MP_31BIT +/* this is an extension that uses 31-bit digits */ +# define DIGIT_BIT 31 +# else +/* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */ +# define DIGIT_BIT 28 +# define MP_28BIT +# endif #endif /* otherwise the bits per digit is calculated automatically from the size of a mp_digit */ #ifndef DIGIT_BIT - #define DIGIT_BIT (((CHAR_BIT * MP_SIZEOF_MP_DIGIT) - 1)) /* bits per digit */ - typedef uint_least32_t mp_min_u32; +# define DIGIT_BIT (((CHAR_BIT * MP_SIZEOF_MP_DIGIT) - 1)) /* bits per digit */ +typedef uint_least32_t mp_min_u32; #else - typedef mp_digit mp_min_u32; +typedef mp_digit mp_min_u32; #endif /* use arc4random on platforms that support it */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) - #define MP_GEN_RANDOM() arc4random() - #define MP_GEN_RANDOM_MAX 0xffffffff +# define MP_GEN_RANDOM() arc4random() +# define MP_GEN_RANDOM_MAX 0xffffffff #endif /* use rand() as fall-back if there's no better rand function */ #ifndef MP_GEN_RANDOM - #define MP_GEN_RANDOM() rand() - #define MP_GEN_RANDOM_MAX RAND_MAX +# define MP_GEN_RANDOM() rand() +# define MP_GEN_RANDOM_MAX RAND_MAX #endif #define MP_DIGIT_BIT DIGIT_BIT @@ -140,20 +140,20 @@ typedef int mp_err; /* you'll have to tune these... */ extern int KARATSUBA_MUL_CUTOFF, - KARATSUBA_SQR_CUTOFF, - TOOM_MUL_CUTOFF, - TOOM_SQR_CUTOFF; + KARATSUBA_SQR_CUTOFF, + TOOM_MUL_CUTOFF, + TOOM_SQR_CUTOFF; /* define this to use lower memory usage routines (exptmods mostly) */ /* #define MP_LOW_MEM */ /* default precision */ #ifndef MP_PREC - #ifndef MP_LOW_MEM - #define MP_PREC 32 /* default digits of precision */ - #else - #define MP_PREC 8 /* default digits of precision */ - #endif +# ifndef MP_LOW_MEM +# define MP_PREC 32 /* default digits of precision */ +# else +# define MP_PREC 8 /* default digits of precision */ +# endif #endif /* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */ @@ -161,17 +161,17 @@ extern int KARATSUBA_MUL_CUTOFF, /* the infamous mp_int structure */ typedef struct { - int used, alloc, sign; - mp_digit *dp; + int used, alloc, sign; + mp_digit *dp; } mp_int; /* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */ typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat); -#define USED(m) ((m)->used) -#define DIGIT(m,k) ((m)->dp[(k)]) -#define SIGN(m) ((m)->sign) +#define USED(m) ((m)->used) +#define DIGIT(m, k) ((m)->dp[(k)]) +#define SIGN(m) ((m)->sign) /* error code to char* string */ const char *mp_error_to_string(int code); @@ -223,19 +223,19 @@ int mp_set_long(mp_int *a, unsigned long b); int mp_set_long_long(mp_int *a, unsigned long long b); /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +unsigned long mp_get_int(mp_int *a); /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +unsigned long mp_get_long(mp_int *a); /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +unsigned long long mp_get_long_long(mp_int *a); /* initialize and set a digit */ -int mp_init_set (mp_int * a, mp_digit b); +int mp_init_set(mp_int *a, mp_digit b); /* initialize and set 32-bit value */ -int mp_init_set_int (mp_int * a, unsigned long b); +int mp_init_set_int(mp_int *a, unsigned long b); /* copy, b = a */ int mp_copy(mp_int *a, mp_int *b); @@ -247,10 +247,10 @@ int mp_init_copy(mp_int *a, mp_int *b); void mp_clamp(mp_int *a); /* import binary data */ -int mp_import(mp_int* rop, size_t count, int order, size_t size, int endian, size_t nails, const void* op); +int mp_import(mp_int *rop, size_t count, int order, size_t size, int endian, size_t nails, const void *op); /* export binary data */ -int mp_export(void* rop, size_t* countp, int order, size_t size, int endian, size_t nails, mp_int* op); +int mp_export(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, mp_int *op); /* ---> digit manipulation <--- */ @@ -350,7 +350,7 @@ int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast); /* c = a mod b, 0 <= c < b */ int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); @@ -386,7 +386,7 @@ int mp_lcm(mp_int *a, mp_int *b, mp_int *c); * returns error if a < 0 and b is even */ int mp_n_root(mp_int *a, mp_digit b, mp_int *c); -int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); /* special sqrt algo */ int mp_sqrt(mp_int *arg, mp_int *ret); @@ -455,9 +455,9 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* number of primes */ #ifdef MP_8BIT - #define PRIME_SIZE 31 +# define PRIME_SIZE 31 #else - #define PRIME_SIZE 256 +# define PRIME_SIZE 256 #endif /* table of first PRIME_SIZE primes */ @@ -529,16 +529,16 @@ int mp_count_bits(mp_int *a); int mp_unsigned_bin_size(mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); int mp_signed_bin_size(mp_int *a); int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); int mp_to_signed_bin(mp_int *a, unsigned char *b); -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); int mp_read_radix(mp_int *a, const char *str, int radix); int mp_toradix(mp_int *a, char *str, int radix); -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen); int mp_radix_size(mp_int *a, int radix, int *size); #ifndef LTM_NO_FILE @@ -559,7 +559,7 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #define mp_tohex(M, S) mp_toradix((M), (S), 16) #ifdef __cplusplus - } +} #endif #endif diff --git a/libtommath/tommath_class.h b/libtommath/tommath_class.h index e860613..f700d66 100644 --- a/libtommath/tommath_class.h +++ b/libtommath/tommath_class.h @@ -1,220 +1,220 @@ #if !(defined(LTM1) && defined(LTM2) && defined(LTM3)) #if defined(LTM2) -#define LTM3 +# define LTM3 #endif #if defined(LTM1) -#define LTM2 +# define LTM2 #endif #define LTM1 #if defined(LTM_ALL) -#define BN_ERROR_C -#define BN_FAST_MP_INVMOD_C -#define BN_FAST_MP_MONTGOMERY_REDUCE_C -#define BN_FAST_S_MP_MUL_DIGS_C -#define BN_FAST_S_MP_MUL_HIGH_DIGS_C -#define BN_FAST_S_MP_SQR_C -#define BN_MP_2EXPT_C -#define BN_MP_ABS_C -#define BN_MP_ADD_C -#define BN_MP_ADD_D_C -#define BN_MP_ADDMOD_C -#define BN_MP_AND_C -#define BN_MP_CLAMP_C -#define BN_MP_CLEAR_C -#define BN_MP_CLEAR_MULTI_C -#define BN_MP_CMP_C -#define BN_MP_CMP_D_C -#define BN_MP_CMP_MAG_C -#define BN_MP_CNT_LSB_C -#define BN_MP_COPY_C -#define BN_MP_COUNT_BITS_C -#define BN_MP_DIV_C -#define BN_MP_DIV_2_C -#define BN_MP_DIV_2D_C -#define BN_MP_DIV_3_C -#define BN_MP_DIV_D_C -#define BN_MP_DR_IS_MODULUS_C -#define BN_MP_DR_REDUCE_C -#define BN_MP_DR_SETUP_C -#define BN_MP_EXCH_C -#define BN_MP_EXPORT_C -#define BN_MP_EXPT_D_C -#define BN_MP_EXPT_D_EX_C -#define BN_MP_EXPTMOD_C -#define BN_MP_EXPTMOD_FAST_C -#define BN_MP_EXTEUCLID_C -#define BN_MP_FREAD_C -#define BN_MP_FWRITE_C -#define BN_MP_GCD_C -#define BN_MP_GET_INT_C -#define BN_MP_GET_LONG_C -#define BN_MP_GET_LONG_LONG_C -#define BN_MP_GROW_C -#define BN_MP_IMPORT_C -#define BN_MP_INIT_C -#define BN_MP_INIT_COPY_C -#define BN_MP_INIT_MULTI_C -#define BN_MP_INIT_SET_C -#define BN_MP_INIT_SET_INT_C -#define BN_MP_INIT_SIZE_C -#define BN_MP_INVMOD_C -#define BN_MP_INVMOD_SLOW_C -#define BN_MP_IS_SQUARE_C -#define BN_MP_JACOBI_C -#define BN_MP_KARATSUBA_MUL_C -#define BN_MP_KARATSUBA_SQR_C -#define BN_MP_LCM_C -#define BN_MP_LSHD_C -#define BN_MP_MOD_C -#define BN_MP_MOD_2D_C -#define BN_MP_MOD_D_C -#define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -#define BN_MP_MONTGOMERY_REDUCE_C -#define BN_MP_MONTGOMERY_SETUP_C -#define BN_MP_MUL_C -#define BN_MP_MUL_2_C -#define BN_MP_MUL_2D_C -#define BN_MP_MUL_D_C -#define BN_MP_MULMOD_C -#define BN_MP_N_ROOT_C -#define BN_MP_N_ROOT_EX_C -#define BN_MP_NEG_C -#define BN_MP_OR_C -#define BN_MP_PRIME_FERMAT_C -#define BN_MP_PRIME_IS_DIVISIBLE_C -#define BN_MP_PRIME_IS_PRIME_C -#define BN_MP_PRIME_MILLER_RABIN_C -#define BN_MP_PRIME_NEXT_PRIME_C -#define BN_MP_PRIME_RABIN_MILLER_TRIALS_C -#define BN_MP_PRIME_RANDOM_EX_C -#define BN_MP_RADIX_SIZE_C -#define BN_MP_RADIX_SMAP_C -#define BN_MP_RAND_C -#define BN_MP_READ_RADIX_C -#define BN_MP_READ_SIGNED_BIN_C -#define BN_MP_READ_UNSIGNED_BIN_C -#define BN_MP_REDUCE_C -#define BN_MP_REDUCE_2K_C -#define BN_MP_REDUCE_2K_L_C -#define BN_MP_REDUCE_2K_SETUP_C -#define BN_MP_REDUCE_2K_SETUP_L_C -#define BN_MP_REDUCE_IS_2K_C -#define BN_MP_REDUCE_IS_2K_L_C -#define BN_MP_REDUCE_SETUP_C -#define BN_MP_RSHD_C -#define BN_MP_SET_C -#define BN_MP_SET_INT_C -#define BN_MP_SET_LONG_C -#define BN_MP_SET_LONG_LONG_C -#define BN_MP_SHRINK_C -#define BN_MP_SIGNED_BIN_SIZE_C -#define BN_MP_SQR_C -#define BN_MP_SQRMOD_C -#define BN_MP_SQRT_C -#define BN_MP_SQRTMOD_PRIME_C -#define BN_MP_SUB_C -#define BN_MP_SUB_D_C -#define BN_MP_SUBMOD_C -#define BN_MP_TO_SIGNED_BIN_C -#define BN_MP_TO_SIGNED_BIN_N_C -#define BN_MP_TO_UNSIGNED_BIN_C -#define BN_MP_TO_UNSIGNED_BIN_N_C -#define BN_MP_TOOM_MUL_C -#define BN_MP_TOOM_SQR_C -#define BN_MP_TORADIX_C -#define BN_MP_TORADIX_N_C -#define BN_MP_UNSIGNED_BIN_SIZE_C -#define BN_MP_XOR_C -#define BN_MP_ZERO_C -#define BN_PRIME_TAB_C -#define BN_REVERSE_C -#define BN_S_MP_ADD_C -#define BN_S_MP_EXPTMOD_C -#define BN_S_MP_MUL_DIGS_C -#define BN_S_MP_MUL_HIGH_DIGS_C -#define BN_S_MP_SQR_C -#define BN_S_MP_SUB_C -#define BNCORE_C +# define BN_ERROR_C +# define BN_FAST_MP_INVMOD_C +# define BN_FAST_MP_MONTGOMERY_REDUCE_C +# define BN_FAST_S_MP_MUL_DIGS_C +# define BN_FAST_S_MP_MUL_HIGH_DIGS_C +# define BN_FAST_S_MP_SQR_C +# define BN_MP_2EXPT_C +# define BN_MP_ABS_C +# define BN_MP_ADD_C +# define BN_MP_ADD_D_C +# define BN_MP_ADDMOD_C +# define BN_MP_AND_C +# define BN_MP_CLAMP_C +# define BN_MP_CLEAR_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_CMP_C +# define BN_MP_CMP_D_C +# define BN_MP_CMP_MAG_C +# define BN_MP_CNT_LSB_C +# define BN_MP_COPY_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_C +# define BN_MP_DIV_2_C +# define BN_MP_DIV_2D_C +# define BN_MP_DIV_3_C +# define BN_MP_DIV_D_C +# define BN_MP_DR_IS_MODULUS_C +# define BN_MP_DR_REDUCE_C +# define BN_MP_DR_SETUP_C +# define BN_MP_EXCH_C +# define BN_MP_EXPORT_C +# define BN_MP_EXPT_D_C +# define BN_MP_EXPT_D_EX_C +# define BN_MP_EXPTMOD_C +# define BN_MP_EXPTMOD_FAST_C +# define BN_MP_EXTEUCLID_C +# define BN_MP_FREAD_C +# define BN_MP_FWRITE_C +# define BN_MP_GCD_C +# define BN_MP_GET_INT_C +# define BN_MP_GET_LONG_C +# define BN_MP_GET_LONG_LONG_C +# define BN_MP_GROW_C +# define BN_MP_IMPORT_C +# define BN_MP_INIT_C +# define BN_MP_INIT_COPY_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_INIT_SET_C +# define BN_MP_INIT_SET_INT_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_INVMOD_C +# define BN_MP_INVMOD_SLOW_C +# define BN_MP_IS_SQUARE_C +# define BN_MP_JACOBI_C +# define BN_MP_KARATSUBA_MUL_C +# define BN_MP_KARATSUBA_SQR_C +# define BN_MP_LCM_C +# define BN_MP_LSHD_C +# define BN_MP_MOD_C +# define BN_MP_MOD_2D_C +# define BN_MP_MOD_D_C +# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +# define BN_MP_MONTGOMERY_REDUCE_C +# define BN_MP_MONTGOMERY_SETUP_C +# define BN_MP_MUL_C +# define BN_MP_MUL_2_C +# define BN_MP_MUL_2D_C +# define BN_MP_MUL_D_C +# define BN_MP_MULMOD_C +# define BN_MP_N_ROOT_C +# define BN_MP_N_ROOT_EX_C +# define BN_MP_NEG_C +# define BN_MP_OR_C +# define BN_MP_PRIME_FERMAT_C +# define BN_MP_PRIME_IS_DIVISIBLE_C +# define BN_MP_PRIME_IS_PRIME_C +# define BN_MP_PRIME_MILLER_RABIN_C +# define BN_MP_PRIME_NEXT_PRIME_C +# define BN_MP_PRIME_RABIN_MILLER_TRIALS_C +# define BN_MP_PRIME_RANDOM_EX_C +# define BN_MP_RADIX_SIZE_C +# define BN_MP_RADIX_SMAP_C +# define BN_MP_RAND_C +# define BN_MP_READ_RADIX_C +# define BN_MP_READ_SIGNED_BIN_C +# define BN_MP_READ_UNSIGNED_BIN_C +# define BN_MP_REDUCE_C +# define BN_MP_REDUCE_2K_C +# define BN_MP_REDUCE_2K_L_C +# define BN_MP_REDUCE_2K_SETUP_C +# define BN_MP_REDUCE_2K_SETUP_L_C +# define BN_MP_REDUCE_IS_2K_C +# define BN_MP_REDUCE_IS_2K_L_C +# define BN_MP_REDUCE_SETUP_C +# define BN_MP_RSHD_C +# define BN_MP_SET_C +# define BN_MP_SET_INT_C +# define BN_MP_SET_LONG_C +# define BN_MP_SET_LONG_LONG_C +# define BN_MP_SHRINK_C +# define BN_MP_SIGNED_BIN_SIZE_C +# define BN_MP_SQR_C +# define BN_MP_SQRMOD_C +# define BN_MP_SQRT_C +# define BN_MP_SQRTMOD_PRIME_C +# define BN_MP_SUB_C +# define BN_MP_SUB_D_C +# define BN_MP_SUBMOD_C +# define BN_MP_TO_SIGNED_BIN_C +# define BN_MP_TO_SIGNED_BIN_N_C +# define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_TO_UNSIGNED_BIN_N_C +# define BN_MP_TOOM_MUL_C +# define BN_MP_TOOM_SQR_C +# define BN_MP_TORADIX_C +# define BN_MP_TORADIX_N_C +# define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_XOR_C +# define BN_MP_ZERO_C +# define BN_PRIME_TAB_C +# define BN_REVERSE_C +# define BN_S_MP_ADD_C +# define BN_S_MP_EXPTMOD_C +# define BN_S_MP_MUL_DIGS_C +# define BN_S_MP_MUL_HIGH_DIGS_C +# define BN_S_MP_SQR_C +# define BN_S_MP_SUB_C +# define BNCORE_C #endif #if defined(BN_ERROR_C) - #define BN_MP_ERROR_TO_STRING_C +# define BN_MP_ERROR_TO_STRING_C #endif #if defined(BN_FAST_MP_INVMOD_C) - #define BN_MP_ISEVEN_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_COPY_C - #define BN_MP_MOD_C - #define BN_MP_SET_C - #define BN_MP_DIV_2_C - #define BN_MP_ISODD_C - #define BN_MP_SUB_C - #define BN_MP_CMP_C - #define BN_MP_ISZERO_C - #define BN_MP_CMP_D_C - #define BN_MP_ADD_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_ISEVEN_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_COPY_C +# define BN_MP_MOD_C +# define BN_MP_SET_C +# define BN_MP_DIV_2_C +# define BN_MP_ISODD_C +# define BN_MP_SUB_C +# define BN_MP_CMP_C +# define BN_MP_ISZERO_C +# define BN_MP_CMP_D_C +# define BN_MP_ADD_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_FAST_MP_MONTGOMERY_REDUCE_C) - #define BN_MP_GROW_C - #define BN_MP_RSHD_C - #define BN_MP_CLAMP_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_MP_GROW_C +# define BN_MP_RSHD_C +# define BN_MP_CLAMP_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_FAST_S_MP_MUL_DIGS_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_FAST_S_MP_SQR_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_2EXPT_C) - #define BN_MP_ZERO_C - #define BN_MP_GROW_C +# define BN_MP_ZERO_C +# define BN_MP_GROW_C #endif #if defined(BN_MP_ABS_C) - #define BN_MP_COPY_C +# define BN_MP_COPY_C #endif #if defined(BN_MP_ADD_C) - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_ADD_D_C) - #define BN_MP_GROW_C - #define BN_MP_SUB_D_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_SUB_D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_ADDMOD_C) - #define BN_MP_INIT_C - #define BN_MP_ADD_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_C +# define BN_MP_ADD_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_AND_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_CLAMP_C) @@ -224,11 +224,11 @@ #endif #if defined(BN_MP_CLEAR_MULTI_C) - #define BN_MP_CLEAR_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_CMP_C) - #define BN_MP_CMP_MAG_C +# define BN_MP_CMP_MAG_C #endif #if defined(BN_MP_CMP_D_C) @@ -238,81 +238,81 @@ #endif #if defined(BN_MP_CNT_LSB_C) - #define BN_MP_ISZERO_C +# define BN_MP_ISZERO_C #endif #if defined(BN_MP_COPY_C) - #define BN_MP_GROW_C +# define BN_MP_GROW_C #endif #if defined(BN_MP_COUNT_BITS_C) #endif #if defined(BN_MP_DIV_C) - #define BN_MP_ISZERO_C - #define BN_MP_CMP_MAG_C - #define BN_MP_COPY_C - #define BN_MP_ZERO_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_SET_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_ABS_C - #define BN_MP_MUL_2D_C - #define BN_MP_CMP_C - #define BN_MP_SUB_C - #define BN_MP_ADD_C - #define BN_MP_DIV_2D_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_INIT_C - #define BN_MP_INIT_COPY_C - #define BN_MP_LSHD_C - #define BN_MP_RSHD_C - #define BN_MP_MUL_D_C - #define BN_MP_CLAMP_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_CMP_MAG_C +# define BN_MP_COPY_C +# define BN_MP_ZERO_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_SET_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_ABS_C +# define BN_MP_MUL_2D_C +# define BN_MP_CMP_C +# define BN_MP_SUB_C +# define BN_MP_ADD_C +# define BN_MP_DIV_2D_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_INIT_C +# define BN_MP_INIT_COPY_C +# define BN_MP_LSHD_C +# define BN_MP_RSHD_C +# define BN_MP_MUL_D_C +# define BN_MP_CLAMP_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_DIV_2_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_DIV_2D_C) - #define BN_MP_COPY_C - #define BN_MP_ZERO_C - #define BN_MP_MOD_2D_C - #define BN_MP_RSHD_C - #define BN_MP_CLAMP_C +# define BN_MP_COPY_C +# define BN_MP_ZERO_C +# define BN_MP_MOD_2D_C +# define BN_MP_RSHD_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_DIV_3_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_DIV_D_C) - #define BN_MP_ISZERO_C - #define BN_MP_COPY_C - #define BN_MP_DIV_2D_C - #define BN_MP_DIV_3_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_COPY_C +# define BN_MP_DIV_2D_C +# define BN_MP_DIV_3_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_DR_IS_MODULUS_C) #endif #if defined(BN_MP_DR_REDUCE_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_DR_SETUP_C) @@ -322,96 +322,96 @@ #endif #if defined(BN_MP_EXPORT_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_DIV_2D_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_2D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_EXPT_D_C) - #define BN_MP_EXPT_D_EX_C +# define BN_MP_EXPT_D_EX_C #endif #if defined(BN_MP_EXPT_D_EX_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_SET_C - #define BN_MP_MUL_C - #define BN_MP_CLEAR_C - #define BN_MP_SQR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_SET_C +# define BN_MP_MUL_C +# define BN_MP_CLEAR_C +# define BN_MP_SQR_C #endif #if defined(BN_MP_EXPTMOD_C) - #define BN_MP_INIT_C - #define BN_MP_INVMOD_C - #define BN_MP_CLEAR_C - #define BN_MP_ABS_C - #define BN_MP_CLEAR_MULTI_C - #define BN_MP_REDUCE_IS_2K_L_C - #define BN_S_MP_EXPTMOD_C - #define BN_MP_DR_IS_MODULUS_C - #define BN_MP_REDUCE_IS_2K_C - #define BN_MP_ISODD_C - #define BN_MP_EXPTMOD_FAST_C +# define BN_MP_INIT_C +# define BN_MP_INVMOD_C +# define BN_MP_CLEAR_C +# define BN_MP_ABS_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_REDUCE_IS_2K_L_C +# define BN_S_MP_EXPTMOD_C +# define BN_MP_DR_IS_MODULUS_C +# define BN_MP_REDUCE_IS_2K_C +# define BN_MP_ISODD_C +# define BN_MP_EXPTMOD_FAST_C #endif #if defined(BN_MP_EXPTMOD_FAST_C) - #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLEAR_C - #define BN_MP_MONTGOMERY_SETUP_C - #define BN_FAST_MP_MONTGOMERY_REDUCE_C - #define BN_MP_MONTGOMERY_REDUCE_C - #define BN_MP_DR_SETUP_C - #define BN_MP_DR_REDUCE_C - #define BN_MP_REDUCE_2K_SETUP_C - #define BN_MP_REDUCE_2K_C - #define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C - #define BN_MP_MULMOD_C - #define BN_MP_SET_C - #define BN_MP_MOD_C - #define BN_MP_COPY_C - #define BN_MP_SQR_C - #define BN_MP_MUL_C - #define BN_MP_EXCH_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLEAR_C +# define BN_MP_MONTGOMERY_SETUP_C +# define BN_FAST_MP_MONTGOMERY_REDUCE_C +# define BN_MP_MONTGOMERY_REDUCE_C +# define BN_MP_DR_SETUP_C +# define BN_MP_DR_REDUCE_C +# define BN_MP_REDUCE_2K_SETUP_C +# define BN_MP_REDUCE_2K_C +# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +# define BN_MP_MULMOD_C +# define BN_MP_SET_C +# define BN_MP_MOD_C +# define BN_MP_COPY_C +# define BN_MP_SQR_C +# define BN_MP_MUL_C +# define BN_MP_EXCH_C #endif #if defined(BN_MP_EXTEUCLID_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_SET_C - #define BN_MP_COPY_C - #define BN_MP_ISZERO_C - #define BN_MP_DIV_C - #define BN_MP_MUL_C - #define BN_MP_SUB_C - #define BN_MP_NEG_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_SET_C +# define BN_MP_COPY_C +# define BN_MP_ISZERO_C +# define BN_MP_DIV_C +# define BN_MP_MUL_C +# define BN_MP_SUB_C +# define BN_MP_NEG_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_FREAD_C) - #define BN_MP_ZERO_C - #define BN_MP_S_RMAP_C - #define BN_MP_MUL_D_C - #define BN_MP_ADD_D_C - #define BN_MP_CMP_D_C +# define BN_MP_ZERO_C +# define BN_MP_S_RMAP_C +# define BN_MP_MUL_D_C +# define BN_MP_ADD_D_C +# define BN_MP_CMP_D_C #endif #if defined(BN_MP_FWRITE_C) - #define BN_MP_RADIX_SIZE_C - #define BN_MP_TORADIX_C +# define BN_MP_RADIX_SIZE_C +# define BN_MP_TORADIX_C #endif #if defined(BN_MP_GCD_C) - #define BN_MP_ISZERO_C - #define BN_MP_ABS_C - #define BN_MP_INIT_COPY_C - #define BN_MP_CNT_LSB_C - #define BN_MP_DIV_2D_C - #define BN_MP_CMP_MAG_C - #define BN_MP_EXCH_C - #define BN_S_MP_SUB_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_ABS_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CNT_LSB_C +# define BN_MP_DIV_2D_C +# define BN_MP_CMP_MAG_C +# define BN_MP_EXCH_C +# define BN_S_MP_SUB_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_GET_INT_C) @@ -427,402 +427,402 @@ #endif #if defined(BN_MP_IMPORT_C) - #define BN_MP_ZERO_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLAMP_C +# define BN_MP_ZERO_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_INIT_C) #endif #if defined(BN_MP_INIT_COPY_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_COPY_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_COPY_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_INIT_MULTI_C) - #define BN_MP_ERR_C - #define BN_MP_INIT_C - #define BN_MP_CLEAR_C +# define BN_MP_ERR_C +# define BN_MP_INIT_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_INIT_SET_C) - #define BN_MP_INIT_C - #define BN_MP_SET_C +# define BN_MP_INIT_C +# define BN_MP_SET_C #endif #if defined(BN_MP_INIT_SET_INT_C) - #define BN_MP_INIT_C - #define BN_MP_SET_INT_C +# define BN_MP_INIT_C +# define BN_MP_SET_INT_C #endif #if defined(BN_MP_INIT_SIZE_C) - #define BN_MP_INIT_C +# define BN_MP_INIT_C #endif #if defined(BN_MP_INVMOD_C) - #define BN_MP_ISZERO_C - #define BN_MP_ISODD_C - #define BN_MP_CMP_D_C - #define BN_FAST_MP_INVMOD_C - #define BN_MP_INVMOD_SLOW_C +# define BN_MP_ISZERO_C +# define BN_MP_ISODD_C +# define BN_MP_CMP_D_C +# define BN_FAST_MP_INVMOD_C +# define BN_MP_INVMOD_SLOW_C #endif #if defined(BN_MP_INVMOD_SLOW_C) - #define BN_MP_ISZERO_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_C - #define BN_MP_COPY_C - #define BN_MP_ISEVEN_C - #define BN_MP_SET_C - #define BN_MP_DIV_2_C - #define BN_MP_ISODD_C - #define BN_MP_ADD_C - #define BN_MP_SUB_C - #define BN_MP_CMP_C - #define BN_MP_CMP_D_C - #define BN_MP_CMP_MAG_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_C +# define BN_MP_COPY_C +# define BN_MP_ISEVEN_C +# define BN_MP_SET_C +# define BN_MP_DIV_2_C +# define BN_MP_ISODD_C +# define BN_MP_ADD_C +# define BN_MP_SUB_C +# define BN_MP_CMP_C +# define BN_MP_CMP_D_C +# define BN_MP_CMP_MAG_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_IS_SQUARE_C) - #define BN_MP_MOD_D_C - #define BN_MP_INIT_SET_INT_C - #define BN_MP_MOD_C - #define BN_MP_GET_INT_C - #define BN_MP_SQRT_C - #define BN_MP_SQR_C - #define BN_MP_CMP_MAG_C - #define BN_MP_CLEAR_C +# define BN_MP_MOD_D_C +# define BN_MP_INIT_SET_INT_C +# define BN_MP_MOD_C +# define BN_MP_GET_INT_C +# define BN_MP_SQRT_C +# define BN_MP_SQR_C +# define BN_MP_CMP_MAG_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_JACOBI_C) - #define BN_MP_ISNEG_C - #define BN_MP_CMP_D_C - #define BN_MP_ISZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_CNT_LSB_C - #define BN_MP_DIV_2D_C - #define BN_MP_MOD_C - #define BN_MP_CLEAR_C +# define BN_MP_ISNEG_C +# define BN_MP_CMP_D_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CNT_LSB_C +# define BN_MP_DIV_2D_C +# define BN_MP_MOD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_KARATSUBA_MUL_C) - #define BN_MP_MUL_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_S_MP_ADD_C - #define BN_MP_ADD_C - #define BN_S_MP_SUB_C - #define BN_MP_LSHD_C - #define BN_MP_CLEAR_C +# define BN_MP_MUL_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_S_MP_ADD_C +# define BN_MP_ADD_C +# define BN_S_MP_SUB_C +# define BN_MP_LSHD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_KARATSUBA_SQR_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_SQR_C - #define BN_S_MP_ADD_C - #define BN_S_MP_SUB_C - #define BN_MP_LSHD_C - #define BN_MP_ADD_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_SQR_C +# define BN_S_MP_ADD_C +# define BN_S_MP_SUB_C +# define BN_MP_LSHD_C +# define BN_MP_ADD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_LCM_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_GCD_C - #define BN_MP_CMP_MAG_C - #define BN_MP_DIV_C - #define BN_MP_MUL_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_GCD_C +# define BN_MP_CMP_MAG_C +# define BN_MP_DIV_C +# define BN_MP_MUL_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_LSHD_C) - #define BN_MP_GROW_C - #define BN_MP_RSHD_C +# define BN_MP_GROW_C +# define BN_MP_RSHD_C #endif #if defined(BN_MP_MOD_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_DIV_C - #define BN_MP_CLEAR_C - #define BN_MP_ISZERO_C - #define BN_MP_EXCH_C - #define BN_MP_ADD_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_DIV_C +# define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_EXCH_C +# define BN_MP_ADD_C #endif #if defined(BN_MP_MOD_2D_C) - #define BN_MP_ZERO_C - #define BN_MP_COPY_C - #define BN_MP_CLAMP_C +# define BN_MP_ZERO_C +# define BN_MP_COPY_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_MOD_D_C) - #define BN_MP_DIV_D_C +# define BN_MP_DIV_D_C #endif #if defined(BN_MP_MONTGOMERY_CALC_NORMALIZATION_C) - #define BN_MP_COUNT_BITS_C - #define BN_MP_2EXPT_C - #define BN_MP_SET_C - #define BN_MP_MUL_2_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_2EXPT_C +# define BN_MP_SET_C +# define BN_MP_MUL_2_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_MONTGOMERY_REDUCE_C) - #define BN_FAST_MP_MONTGOMERY_REDUCE_C - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C - #define BN_MP_RSHD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_FAST_MP_MONTGOMERY_REDUCE_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C +# define BN_MP_RSHD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_MONTGOMERY_SETUP_C) #endif #if defined(BN_MP_MUL_C) - #define BN_MP_TOOM_MUL_C - #define BN_MP_KARATSUBA_MUL_C - #define BN_FAST_S_MP_MUL_DIGS_C - #define BN_S_MP_MUL_C - #define BN_S_MP_MUL_DIGS_C +# define BN_MP_TOOM_MUL_C +# define BN_MP_KARATSUBA_MUL_C +# define BN_FAST_S_MP_MUL_DIGS_C +# define BN_S_MP_MUL_C +# define BN_S_MP_MUL_DIGS_C #endif #if defined(BN_MP_MUL_2_C) - #define BN_MP_GROW_C +# define BN_MP_GROW_C #endif #if defined(BN_MP_MUL_2D_C) - #define BN_MP_COPY_C - #define BN_MP_GROW_C - #define BN_MP_LSHD_C - #define BN_MP_CLAMP_C +# define BN_MP_COPY_C +# define BN_MP_GROW_C +# define BN_MP_LSHD_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_MUL_D_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_MULMOD_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_MUL_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_MUL_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_N_ROOT_C) - #define BN_MP_N_ROOT_EX_C +# define BN_MP_N_ROOT_EX_C #endif #if defined(BN_MP_N_ROOT_EX_C) - #define BN_MP_INIT_C - #define BN_MP_SET_C - #define BN_MP_COPY_C - #define BN_MP_EXPT_D_EX_C - #define BN_MP_MUL_C - #define BN_MP_SUB_C - #define BN_MP_MUL_D_C - #define BN_MP_DIV_C - #define BN_MP_CMP_C - #define BN_MP_SUB_D_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_SET_C +# define BN_MP_COPY_C +# define BN_MP_EXPT_D_EX_C +# define BN_MP_MUL_C +# define BN_MP_SUB_C +# define BN_MP_MUL_D_C +# define BN_MP_DIV_C +# define BN_MP_CMP_C +# define BN_MP_SUB_D_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_NEG_C) - #define BN_MP_COPY_C - #define BN_MP_ISZERO_C +# define BN_MP_COPY_C +# define BN_MP_ISZERO_C #endif #if defined(BN_MP_OR_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_FERMAT_C) - #define BN_MP_CMP_D_C - #define BN_MP_INIT_C - #define BN_MP_EXPTMOD_C - #define BN_MP_CMP_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_INIT_C +# define BN_MP_EXPTMOD_C +# define BN_MP_CMP_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_IS_DIVISIBLE_C) - #define BN_MP_MOD_D_C +# define BN_MP_MOD_D_C #endif #if defined(BN_MP_PRIME_IS_PRIME_C) - #define BN_MP_CMP_D_C - #define BN_MP_PRIME_IS_DIVISIBLE_C - #define BN_MP_INIT_C - #define BN_MP_SET_C - #define BN_MP_PRIME_MILLER_RABIN_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_PRIME_IS_DIVISIBLE_C +# define BN_MP_INIT_C +# define BN_MP_SET_C +# define BN_MP_PRIME_MILLER_RABIN_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_MILLER_RABIN_C) - #define BN_MP_CMP_D_C - #define BN_MP_INIT_COPY_C - #define BN_MP_SUB_D_C - #define BN_MP_CNT_LSB_C - #define BN_MP_DIV_2D_C - #define BN_MP_EXPTMOD_C - #define BN_MP_CMP_C - #define BN_MP_SQRMOD_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_INIT_COPY_C +# define BN_MP_SUB_D_C +# define BN_MP_CNT_LSB_C +# define BN_MP_DIV_2D_C +# define BN_MP_EXPTMOD_C +# define BN_MP_CMP_C +# define BN_MP_SQRMOD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_NEXT_PRIME_C) - #define BN_MP_CMP_D_C - #define BN_MP_SET_C - #define BN_MP_SUB_D_C - #define BN_MP_ISEVEN_C - #define BN_MP_MOD_D_C - #define BN_MP_INIT_C - #define BN_MP_ADD_D_C - #define BN_MP_PRIME_MILLER_RABIN_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_SET_C +# define BN_MP_SUB_D_C +# define BN_MP_ISEVEN_C +# define BN_MP_MOD_D_C +# define BN_MP_INIT_C +# define BN_MP_ADD_D_C +# define BN_MP_PRIME_MILLER_RABIN_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_RABIN_MILLER_TRIALS_C) #endif #if defined(BN_MP_PRIME_RANDOM_EX_C) - #define BN_MP_READ_UNSIGNED_BIN_C - #define BN_MP_PRIME_IS_PRIME_C - #define BN_MP_SUB_D_C - #define BN_MP_DIV_2_C - #define BN_MP_MUL_2_C - #define BN_MP_ADD_D_C +# define BN_MP_READ_UNSIGNED_BIN_C +# define BN_MP_PRIME_IS_PRIME_C +# define BN_MP_SUB_D_C +# define BN_MP_DIV_2_C +# define BN_MP_MUL_2_C +# define BN_MP_ADD_D_C #endif #if defined(BN_MP_RADIX_SIZE_C) - #define BN_MP_ISZERO_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_COPY_C - #define BN_MP_DIV_D_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_INIT_COPY_C +# define BN_MP_DIV_D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_RADIX_SMAP_C) - #define BN_MP_S_RMAP_C +# define BN_MP_S_RMAP_C #endif #if defined(BN_MP_RAND_C) - #define BN_MP_ZERO_C - #define BN_MP_ADD_D_C - #define BN_MP_LSHD_C +# define BN_MP_ZERO_C +# define BN_MP_ADD_D_C +# define BN_MP_LSHD_C #endif #if defined(BN_MP_READ_RADIX_C) - #define BN_MP_ZERO_C - #define BN_MP_S_RMAP_C - #define BN_MP_MUL_D_C - #define BN_MP_ADD_D_C - #define BN_MP_ISZERO_C +# define BN_MP_ZERO_C +# define BN_MP_S_RMAP_C +# define BN_MP_MUL_D_C +# define BN_MP_ADD_D_C +# define BN_MP_ISZERO_C #endif #if defined(BN_MP_READ_SIGNED_BIN_C) - #define BN_MP_READ_UNSIGNED_BIN_C +# define BN_MP_READ_UNSIGNED_BIN_C #endif #if defined(BN_MP_READ_UNSIGNED_BIN_C) - #define BN_MP_GROW_C - #define BN_MP_ZERO_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_ZERO_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_REDUCE_C) - #define BN_MP_REDUCE_SETUP_C - #define BN_MP_INIT_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_MUL_C - #define BN_S_MP_MUL_HIGH_DIGS_C - #define BN_FAST_S_MP_MUL_HIGH_DIGS_C - #define BN_MP_MOD_2D_C - #define BN_S_MP_MUL_DIGS_C - #define BN_MP_SUB_C - #define BN_MP_CMP_D_C - #define BN_MP_SET_C - #define BN_MP_LSHD_C - #define BN_MP_ADD_C - #define BN_MP_CMP_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_REDUCE_SETUP_C +# define BN_MP_INIT_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_MUL_C +# define BN_S_MP_MUL_HIGH_DIGS_C +# define BN_FAST_S_MP_MUL_HIGH_DIGS_C +# define BN_MP_MOD_2D_C +# define BN_S_MP_MUL_DIGS_C +# define BN_MP_SUB_C +# define BN_MP_CMP_D_C +# define BN_MP_SET_C +# define BN_MP_LSHD_C +# define BN_MP_ADD_C +# define BN_MP_CMP_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_2K_C) - #define BN_MP_INIT_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_DIV_2D_C - #define BN_MP_MUL_D_C - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_2D_C +# define BN_MP_MUL_D_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_2K_L_C) - #define BN_MP_INIT_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_DIV_2D_C - #define BN_MP_MUL_C - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_2D_C +# define BN_MP_MUL_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_2K_SETUP_C) - #define BN_MP_INIT_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_2EXPT_C - #define BN_MP_CLEAR_C - #define BN_S_MP_SUB_C +# define BN_MP_INIT_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_2EXPT_C +# define BN_MP_CLEAR_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_REDUCE_2K_SETUP_L_C) - #define BN_MP_INIT_C - #define BN_MP_2EXPT_C - #define BN_MP_COUNT_BITS_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_2EXPT_C +# define BN_MP_COUNT_BITS_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_IS_2K_C) - #define BN_MP_REDUCE_2K_C - #define BN_MP_COUNT_BITS_C +# define BN_MP_REDUCE_2K_C +# define BN_MP_COUNT_BITS_C #endif #if defined(BN_MP_REDUCE_IS_2K_L_C) #endif #if defined(BN_MP_REDUCE_SETUP_C) - #define BN_MP_2EXPT_C - #define BN_MP_DIV_C +# define BN_MP_2EXPT_C +# define BN_MP_DIV_C #endif #if defined(BN_MP_RSHD_C) - #define BN_MP_ZERO_C +# define BN_MP_ZERO_C #endif #if defined(BN_MP_SET_C) - #define BN_MP_ZERO_C +# define BN_MP_ZERO_C #endif #if defined(BN_MP_SET_INT_C) - #define BN_MP_ZERO_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLAMP_C +# define BN_MP_ZERO_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_SET_LONG_C) @@ -835,155 +835,155 @@ #endif #if defined(BN_MP_SIGNED_BIN_SIZE_C) - #define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_UNSIGNED_BIN_SIZE_C #endif #if defined(BN_MP_SQR_C) - #define BN_MP_TOOM_SQR_C - #define BN_MP_KARATSUBA_SQR_C - #define BN_FAST_S_MP_SQR_C - #define BN_S_MP_SQR_C +# define BN_MP_TOOM_SQR_C +# define BN_MP_KARATSUBA_SQR_C +# define BN_FAST_S_MP_SQR_C +# define BN_S_MP_SQR_C #endif #if defined(BN_MP_SQRMOD_C) - #define BN_MP_INIT_C - #define BN_MP_SQR_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_C +# define BN_MP_SQR_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_SQRT_C) - #define BN_MP_N_ROOT_C - #define BN_MP_ISZERO_C - #define BN_MP_ZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_DIV_C - #define BN_MP_ADD_C - #define BN_MP_DIV_2_C - #define BN_MP_CMP_MAG_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_N_ROOT_C +# define BN_MP_ISZERO_C +# define BN_MP_ZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_DIV_C +# define BN_MP_ADD_C +# define BN_MP_DIV_2_C +# define BN_MP_CMP_MAG_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_SQRTMOD_PRIME_C) - #define BN_MP_CMP_D_C - #define BN_MP_ZERO_C - #define BN_MP_JACOBI_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_D_C - #define BN_MP_ADD_D_C - #define BN_MP_DIV_2_C - #define BN_MP_EXPTMOD_C - #define BN_MP_COPY_C - #define BN_MP_SUB_D_C - #define BN_MP_ISEVEN_C - #define BN_MP_SET_INT_C - #define BN_MP_SQRMOD_C - #define BN_MP_MULMOD_C - #define BN_MP_SET_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_CMP_D_C +# define BN_MP_ZERO_C +# define BN_MP_JACOBI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_D_C +# define BN_MP_ADD_D_C +# define BN_MP_DIV_2_C +# define BN_MP_EXPTMOD_C +# define BN_MP_COPY_C +# define BN_MP_SUB_D_C +# define BN_MP_ISEVEN_C +# define BN_MP_SET_INT_C +# define BN_MP_SQRMOD_C +# define BN_MP_MULMOD_C +# define BN_MP_SET_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_SUB_C) - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_SUB_D_C) - #define BN_MP_GROW_C - #define BN_MP_ADD_D_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_ADD_D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_SUBMOD_C) - #define BN_MP_INIT_C - #define BN_MP_SUB_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_C +# define BN_MP_SUB_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_TO_SIGNED_BIN_C) - #define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_TO_UNSIGNED_BIN_C #endif #if defined(BN_MP_TO_SIGNED_BIN_N_C) - #define BN_MP_SIGNED_BIN_SIZE_C - #define BN_MP_TO_SIGNED_BIN_C +# define BN_MP_SIGNED_BIN_SIZE_C +# define BN_MP_TO_SIGNED_BIN_C #endif #if defined(BN_MP_TO_UNSIGNED_BIN_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_ISZERO_C - #define BN_MP_DIV_2D_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_ISZERO_C +# define BN_MP_DIV_2D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_TO_UNSIGNED_BIN_N_C) - #define BN_MP_UNSIGNED_BIN_SIZE_C - #define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_TO_UNSIGNED_BIN_C #endif #if defined(BN_MP_TOOM_MUL_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_2D_C - #define BN_MP_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_MUL_C - #define BN_MP_MUL_2_C - #define BN_MP_ADD_C - #define BN_MP_SUB_C - #define BN_MP_DIV_2_C - #define BN_MP_MUL_2D_C - #define BN_MP_MUL_D_C - #define BN_MP_DIV_3_C - #define BN_MP_LSHD_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_2D_C +# define BN_MP_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_MUL_C +# define BN_MP_MUL_2_C +# define BN_MP_ADD_C +# define BN_MP_SUB_C +# define BN_MP_DIV_2_C +# define BN_MP_MUL_2D_C +# define BN_MP_MUL_D_C +# define BN_MP_DIV_3_C +# define BN_MP_LSHD_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_TOOM_SQR_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_2D_C - #define BN_MP_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_SQR_C - #define BN_MP_MUL_2_C - #define BN_MP_ADD_C - #define BN_MP_SUB_C - #define BN_MP_DIV_2_C - #define BN_MP_MUL_2D_C - #define BN_MP_MUL_D_C - #define BN_MP_DIV_3_C - #define BN_MP_LSHD_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_2D_C +# define BN_MP_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_SQR_C +# define BN_MP_MUL_2_C +# define BN_MP_ADD_C +# define BN_MP_SUB_C +# define BN_MP_DIV_2_C +# define BN_MP_MUL_2D_C +# define BN_MP_MUL_D_C +# define BN_MP_DIV_3_C +# define BN_MP_LSHD_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_TORADIX_C) - #define BN_MP_ISZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_DIV_D_C - #define BN_MP_CLEAR_C - #define BN_MP_S_RMAP_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_DIV_D_C +# define BN_MP_CLEAR_C +# define BN_MP_S_RMAP_C #endif #if defined(BN_MP_TORADIX_N_C) - #define BN_MP_ISZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_DIV_D_C - #define BN_MP_CLEAR_C - #define BN_MP_S_RMAP_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_DIV_D_C +# define BN_MP_CLEAR_C +# define BN_MP_S_RMAP_C #endif #if defined(BN_MP_UNSIGNED_BIN_SIZE_C) - #define BN_MP_COUNT_BITS_C +# define BN_MP_COUNT_BITS_C #endif #if defined(BN_MP_XOR_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_ZERO_C) @@ -996,62 +996,63 @@ #endif #if defined(BN_S_MP_ADD_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_S_MP_EXPTMOD_C) - #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_C - #define BN_MP_CLEAR_C - #define BN_MP_REDUCE_SETUP_C - #define BN_MP_REDUCE_C - #define BN_MP_REDUCE_2K_SETUP_L_C - #define BN_MP_REDUCE_2K_L_C - #define BN_MP_MOD_C - #define BN_MP_COPY_C - #define BN_MP_SQR_C - #define BN_MP_MUL_C - #define BN_MP_SET_C - #define BN_MP_EXCH_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_INIT_C +# define BN_MP_CLEAR_C +# define BN_MP_REDUCE_SETUP_C +# define BN_MP_REDUCE_C +# define BN_MP_REDUCE_2K_SETUP_L_C +# define BN_MP_REDUCE_2K_L_C +# define BN_MP_MOD_C +# define BN_MP_COPY_C +# define BN_MP_SQR_C +# define BN_MP_MUL_C +# define BN_MP_SET_C +# define BN_MP_EXCH_C #endif #if defined(BN_S_MP_MUL_DIGS_C) - #define BN_FAST_S_MP_MUL_DIGS_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_FAST_S_MP_MUL_DIGS_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_S_MP_MUL_HIGH_DIGS_C) - #define BN_FAST_S_MP_MUL_HIGH_DIGS_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_FAST_S_MP_MUL_HIGH_DIGS_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_S_MP_SQR_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_S_MP_SUB_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BNCORE_C) #endif #ifdef LTM3 -#define LTM_LAST +# define LTM_LAST #endif + #include #include #else -#define LTM_LAST +# define LTM_LAST #endif diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index aeda684..ee39694 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -19,39 +19,39 @@ #include #ifndef MIN - #define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) #endif #ifndef MAX - #define MAX(x,y) (((x) > (y)) ? (x) : (y)) +#define MAX(x, y) (((x) > (y)) ? (x) : (y)) #endif #ifdef __cplusplus extern "C" { /* C++ compilers don't like assigning void * to mp_digit * */ -#define OPT_CAST(x) (x *) +#define OPT_CAST(x) (x *) #else /* C on the other hand doesn't care */ -#define OPT_CAST(x) +#define OPT_CAST(x) #endif /* define heap macros */ #ifndef XMALLOC - /* default to libc stuff */ - #define XMALLOC malloc - #define XFREE free - #define XREALLOC realloc - #define XCALLOC calloc +/* default to libc stuff */ +# define XMALLOC malloc +# define XFREE free +# define XREALLOC realloc +# define XCALLOC calloc #else - /* prototypes for our heap functions */ - extern void *XMALLOC(size_t n); - extern void *XREALLOC(void *p, size_t n); - extern void *XCALLOC(size_t n, size_t s); - extern void XFREE(void *p); +/* prototypes for our heap functions */ +extern void *XMALLOC(size_t n); +extern void *XREALLOC(void *p, size_t n); +extern void *XCALLOC(size_t n, size_t s); +extern void XFREE(void *p); #endif /* lowlevel functions, do not call! */ @@ -69,10 +69,10 @@ int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); int mp_karatsuba_sqr(mp_int *a, mp_int *b); int mp_toom_sqr(mp_int *a, mp_int *b); int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); -int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); +int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c); int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); -int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode); +int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; @@ -112,7 +112,7 @@ int func_name (mp_int * a, type b) \ } #ifdef __cplusplus - } +} #endif #endif diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index a2f4d93..da53793 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -14,60 +14,60 @@ /* Works for RSA only, mpi.o is 68KiB */ #ifdef SC_RSA_1 - #define BN_MP_SHRINK_C - #define BN_MP_LCM_C - #define BN_MP_PRIME_RANDOM_EX_C - #define BN_MP_INVMOD_C - #define BN_MP_GCD_C - #define BN_MP_MOD_C - #define BN_MP_MULMOD_C - #define BN_MP_ADDMOD_C - #define BN_MP_EXPTMOD_C - #define BN_MP_SET_INT_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_CLEAR_MULTI_C - #define BN_MP_UNSIGNED_BIN_SIZE_C - #define BN_MP_TO_UNSIGNED_BIN_C - #define BN_MP_MOD_D_C - #define BN_MP_PRIME_RABIN_MILLER_TRIALS_C - #define BN_REVERSE_C - #define BN_PRIME_TAB_C +# define BN_MP_SHRINK_C +# define BN_MP_LCM_C +# define BN_MP_PRIME_RANDOM_EX_C +# define BN_MP_INVMOD_C +# define BN_MP_GCD_C +# define BN_MP_MOD_C +# define BN_MP_MULMOD_C +# define BN_MP_ADDMOD_C +# define BN_MP_EXPTMOD_C +# define BN_MP_SET_INT_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_MOD_D_C +# define BN_MP_PRIME_RABIN_MILLER_TRIALS_C +# define BN_REVERSE_C +# define BN_PRIME_TAB_C - /* other modifiers */ - #define BN_MP_DIV_SMALL /* Slower division, not critical */ +/* other modifiers */ +# define BN_MP_DIV_SMALL /* Slower division, not critical */ - /* here we are on the last pass so we turn things off. The functions classes are still there - * but we remove them specifically from the build. This also invokes tweaks in functions - * like removing support for even moduli, etc... - */ -#ifdef LTM_LAST - #undef BN_MP_TOOM_MUL_C - #undef BN_MP_TOOM_SQR_C - #undef BN_MP_KARATSUBA_MUL_C - #undef BN_MP_KARATSUBA_SQR_C - #undef BN_MP_REDUCE_C - #undef BN_MP_REDUCE_SETUP_C - #undef BN_MP_DR_IS_MODULUS_C - #undef BN_MP_DR_SETUP_C - #undef BN_MP_DR_REDUCE_C - #undef BN_MP_REDUCE_IS_2K_C - #undef BN_MP_REDUCE_2K_SETUP_C - #undef BN_MP_REDUCE_2K_C - #undef BN_S_MP_EXPTMOD_C - #undef BN_MP_DIV_3_C - #undef BN_S_MP_MUL_HIGH_DIGS_C - #undef BN_FAST_S_MP_MUL_HIGH_DIGS_C - #undef BN_FAST_MP_INVMOD_C +/* here we are on the last pass so we turn things off. The functions classes are still there + * but we remove them specifically from the build. This also invokes tweaks in functions + * like removing support for even moduli, etc... + */ +# ifdef LTM_LAST +# undef BN_MP_TOOM_MUL_C +# undef BN_MP_TOOM_SQR_C +# undef BN_MP_KARATSUBA_MUL_C +# undef BN_MP_KARATSUBA_SQR_C +# undef BN_MP_REDUCE_C +# undef BN_MP_REDUCE_SETUP_C +# undef BN_MP_DR_IS_MODULUS_C +# undef BN_MP_DR_SETUP_C +# undef BN_MP_DR_REDUCE_C +# undef BN_MP_REDUCE_IS_2K_C +# undef BN_MP_REDUCE_2K_SETUP_C +# undef BN_MP_REDUCE_2K_C +# undef BN_S_MP_EXPTMOD_C +# undef BN_MP_DIV_3_C +# undef BN_S_MP_MUL_HIGH_DIGS_C +# undef BN_FAST_S_MP_MUL_HIGH_DIGS_C +# undef BN_FAST_MP_INVMOD_C - /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold - * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] - * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without - * trouble. - */ - #undef BN_S_MP_MUL_DIGS_C - #undef BN_S_MP_SQR_C - #undef BN_MP_MONTGOMERY_REDUCE_C -#endif +/* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold + * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] + * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without + * trouble. + */ +# undef BN_S_MP_MUL_DIGS_C +# undef BN_S_MP_SQR_C +# undef BN_MP_MONTGOMERY_REDUCE_C +# endif #endif -- cgit v0.12 From f5ea63343e4245c7b8e5a0872e65c867e5e9d6f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Sep 2017 12:53:48 +0000 Subject: Another round of libtommath const'ification. To be submitted to the libtommath folks --- generic/tclTomMath.h | 56 ++++++++++++------------ libtommath/bn_fast_mp_invmod.c | 2 +- libtommath/bn_fast_mp_montgomery_reduce.c | 2 +- libtommath/bn_mp_abs.c | 2 +- libtommath/bn_mp_addmod.c | 2 +- libtommath/bn_mp_dr_is_modulus.c | 2 +- libtommath/bn_mp_dr_reduce.c | 2 +- libtommath/bn_mp_dr_setup.c | 2 +- libtommath/bn_mp_exptmod.c | 2 +- libtommath/bn_mp_exptmod_fast.c | 4 +- libtommath/bn_mp_exteuclid.c | 2 +- libtommath/bn_mp_gcd.c | 2 +- libtommath/bn_mp_invmod.c | 2 +- libtommath/bn_mp_invmod_slow.c | 2 +- libtommath/bn_mp_is_square.c | 2 +- libtommath/bn_mp_jacobi.c | 2 +- libtommath/bn_mp_lcm.c | 2 +- libtommath/bn_mp_mod_d.c | 2 +- libtommath/bn_mp_montgomery_calc_normalization.c | 2 +- libtommath/bn_mp_montgomery_reduce.c | 2 +- libtommath/bn_mp_montgomery_setup.c | 2 +- libtommath/bn_mp_mulmod.c | 2 +- libtommath/bn_mp_n_root.c | 2 +- libtommath/bn_mp_n_root_ex.c | 19 ++++---- libtommath/bn_mp_reduce.c | 2 +- libtommath/bn_mp_reduce_2k.c | 2 +- libtommath/bn_mp_reduce_2k_l.c | 2 +- libtommath/bn_mp_reduce_2k_setup.c | 2 +- libtommath/bn_mp_reduce_2k_setup_l.c | 2 +- libtommath/bn_mp_reduce_is_2k.c | 2 +- libtommath/bn_mp_reduce_is_2k_l.c | 2 +- libtommath/bn_mp_reduce_setup.c | 2 +- libtommath/bn_mp_sqrmod.c | 2 +- libtommath/bn_mp_sqrtmod_prime.c | 2 +- libtommath/bn_mp_submod.c | 2 +- libtommath/bn_s_mp_exptmod.c | 4 +- libtommath/tommath.h | 56 ++++++++++++------------ libtommath/tommath_private.h | 10 ++--- 38 files changed, 105 insertions(+), 108 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 14cf5b6..1f22d6f 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -497,42 +497,42 @@ int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* d = a + b (mod c) */ /* -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* d = a - b (mod c) */ /* -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* d = a * b (mod c) */ /* -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* c = a * a (mod b) */ /* -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = 1/a (mod b) */ /* -int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = (a, b) */ /* -int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c); */ /* produces value such that U1*a + U2*b = U3 */ /* -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); */ /* c = [a, b] or (a*b)/(a, b) */ /* -int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c); */ /* finds one of the b'th root of a, such that |c|**b <= |a| @@ -540,10 +540,10 @@ int mp_lcm(mp_int *a, mp_int *b, mp_int *c); * returns error if a < 0 and b is even */ /* -int mp_n_root(mp_int *a, mp_digit b, mp_int *c); +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c); */ /* -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); */ /* special sqrt algo */ @@ -553,22 +553,22 @@ int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ /* -int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); +int mp_sqrtmod_prime(const mp_int *arg, const mp_int *prime, mp_int *ret); */ /* is number a square? */ /* -int mp_is_square(mp_int *arg, int *ret); +int mp_is_square(const mp_int *arg, int *ret); */ /* computes the jacobi c = (a | n) (or Legendre if b is prime) */ /* -int mp_jacobi(mp_int *a, mp_int *n, int *c); +int mp_jacobi(const mp_int *a, const mp_int *n, int *c); */ /* used to setup the Barrett reduction for a given modulus b */ /* -int mp_reduce_setup(mp_int *a, mp_int *b); +int mp_reduce_setup(mp_int *a, const mp_int *b); */ /* Barrett Reduction, computes a (mod b) with a precomputed value c @@ -577,74 +577,74 @@ int mp_reduce_setup(mp_int *a, mp_int *b); * compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code]. */ /* -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +int mp_reduce(mp_int *a, const mp_int *b, mp_int *c); */ /* setups the montgomery reduction */ /* -int mp_montgomery_setup(mp_int *a, mp_digit *mp); +int mp_montgomery_setup(const mp_int *a, mp_digit *mp); */ /* computes a = B**n mod b without division or multiplication useful for * normalizing numbers in a Montgomery system. */ /* -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b); */ /* computes x/R == x (mod N) via Montgomery Reduction */ /* -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp); */ /* returns 1 if a is a valid DR modulus */ /* -int mp_dr_is_modulus(mp_int *a); +int mp_dr_is_modulus(const mp_int *a); */ /* sets the value of "d" required for mp_dr_reduce */ /* -void mp_dr_setup(mp_int *a, mp_digit *d); +void mp_dr_setup(const mp_int *a, mp_digit *d); */ /* reduces a modulo b using the Diminished Radix method */ /* -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp); */ /* returns true if a can be reduced with mp_reduce_2k */ /* -int mp_reduce_is_2k(mp_int *a); +int mp_reduce_is_2k(const mp_int *a); */ /* determines k value for 2k reduction */ /* -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d); */ /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ /* -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d); */ /* returns true if a can be reduced with mp_reduce_2k_l */ /* -int mp_reduce_is_2k_l(mp_int *a); +int mp_reduce_is_2k_l(const mp_int *a); */ /* determines k value for 2k reduction */ /* -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d); */ /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ /* -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +int mp_reduce_2k_l(mp_int *a, const mp_int *n, mp_int *d); */ /* d = a**b (mod c) */ /* -int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* ---> Primes <--- */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index 7771136..08389dd 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -21,7 +21,7 @@ * Based on slow invmod except this is optimized for the case where b is * odd as per HAC Note 14.64 on pp. 610 */ -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, B, D; int res, neg; diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index f2c38bf..54d9b0a 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -23,7 +23,7 @@ * * Based on Algorithm 14.32 on pp.601 of HAC. */ -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, olduse; mp_word W[MP_WARRAY]; diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index 343a102..03904d2 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -20,7 +20,7 @@ * Simple function copies the input and fixes the sign to positive */ int -mp_abs(mp_int *a, mp_int *b) +mp_abs(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 0521974..5aee233 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -17,7 +17,7 @@ /* d = a + b (mod c) */ int -mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index 4631daa..bf4ed8b 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -16,7 +16,7 @@ */ /* determines if a number is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a) +int mp_dr_is_modulus(const mp_int *a) { int ix; diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index e90dc55..17ab289 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -30,7 +30,7 @@ * Input x must be in the range 0 <= x <= (n-1)**2 */ int -mp_dr_reduce(mp_int *x, mp_int *n, mp_digit k) +mp_dr_reduce(mp_int *x, const mp_int *n, mp_digit k) { int err, i, m; mp_word r; diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index b49c81a..5dff995 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -void mp_dr_setup(mp_int *a, mp_digit *d) +void mp_dr_setup(const mp_int *a, mp_digit *d) { /* the casts are required if DIGIT_BIT is one less than * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index c4f392b..934fd25 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -21,7 +21,7 @@ * embedded in the normal function but that wasted alot of stack space * for nothing (since 99% of the time the Montgomery code would be called) */ -int mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y) +int mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y) { int dr; diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 7278b9f..08c6bc3 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -29,7 +29,7 @@ #define TAB_SIZE 256 #endif -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res; mp_digit buf, mp; @@ -39,7 +39,7 @@ int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) * one of many reduction algorithms without modding the guts of * the code with if statements everywhere. */ - int (*redux)(mp_int *,mp_int *,mp_digit); + int (*redux)(mp_int *,const mp_int *,mp_digit); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index 419146b..adaea86 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -18,7 +18,7 @@ /* Extended euclidean algorithm of (a, b) produces a*u1 + b*u2 = u3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; int err; diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 18f6dc3..f5aa78b 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -16,7 +16,7 @@ */ /* Greatest Common Divisor using the binary method */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c) +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c) { mp_int u, v; int k, u_lsb, v_lsb, res; diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index b70fe18..525493a 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { /* b cannot be negative */ if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index 2bdd2b1..2bb5196 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, A, B, C, D; int res; diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 84229bf..4d8612f 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -38,7 +38,7 @@ static const char rem_105[105] = { }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg,int *ret) +int mp_is_square(const mp_int *arg,int *ret) { int res; mp_digit c; diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 8981393..c314c82 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -20,7 +20,7 @@ * HAC is wrong here, as the special case of (0 | 1) is not * handled correctly. */ -int mp_jacobi(mp_int *a, mp_int *n, int *c) +int mp_jacobi(const mp_int *a, const mp_int *n, int *c) { mp_int a1, p1; int k, s, r, res; diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index dc661f3..24b621c 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -16,7 +16,7 @@ */ /* computes least common multiple as |a*b|/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c) +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t1, t2; diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 6afe4f1..5217aa4 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -16,7 +16,7 @@ */ int -mp_mod_d(mp_int *a, mp_digit b, mp_digit *c) +mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) { return mp_div_d(a, b, NULL, c); } diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 2d95140..f2b0856 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -21,7 +21,7 @@ * The method is slightly modified to shift B unconditionally upto just under * the leading bit of b. This saves alot of multiple precision shifting. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b) +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b) { int x, bits, res; diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index 1ee69b2..e9f6c1c 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -17,7 +17,7 @@ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ int -mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, digs; mp_digit mu; diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index fac71a6..37069c3 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -17,7 +17,7 @@ /* setups the montgomery reduction stuff */ int -mp_montgomery_setup(mp_int *n, mp_digit *rho) +mp_montgomery_setup(const mp_int *n, mp_digit *rho) { mp_digit x, b; diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index b1e6a33..aeee4ee 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -16,7 +16,7 @@ */ /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index 8211c0a..a09804f 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -18,7 +18,7 @@ /* wrapper function for mp_n_root_ex() * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c) +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c) { return mp_n_root_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 9546745..ca50649 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -25,10 +25,10 @@ * each step involves a fair bit. This is not meant to * find huge roots [square and cube, etc]. */ -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { - mp_int t1, t2, t3; - int res, neg; + mp_int t1, t2, t3, a_; + int res; /* input must be positive if b is even */ if (((b & 1) == 0) && (a->sign == MP_NEG)) { @@ -48,8 +48,8 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; + a_ = *a; + a_.sign = MP_ZPOS; /* t2 = 2 */ mp_set(&t2, 2); @@ -74,7 +74,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* t2 = t1**b - a */ - if ((res = mp_sub(&t2, a, &t2)) != MP_OKAY) { + if ((res = mp_sub(&t2, &a_, &t2)) != MP_OKAY) { goto LBL_T3; } @@ -100,7 +100,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) goto LBL_T3; } - if (mp_cmp(&t2, a) == MP_GT) { + if (mp_cmp(&t2, &a_) == MP_GT) { if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) { goto LBL_T3; } @@ -109,14 +109,11 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } } - /* reset the sign of a first */ - a->sign = neg; - /* set the result */ mp_exch(&t1, c); /* set the sign of the result */ - c->sign = neg; + c->sign = a->sign; res = MP_OKAY; diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index a2b9bf7..6665acb 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -19,7 +19,7 @@ * precomputed via mp_reduce_setup. * From HAC pp.604 Algorithm 14.42 */ -int mp_reduce(mp_int *x, mp_int *m, mp_int *mu) +int mp_reduce(mp_int *x, const mp_int *m, mp_int *mu) { mp_int q; int res, um = m->used; diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 6bc96d1..2922cad 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -16,7 +16,7 @@ */ /* reduces a modulo n where n is of the form 2**p - d */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index 8e6eeb0..3b23a37 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -19,7 +19,7 @@ This differs from reduce_2k since "d" can be larger than a single digit. */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d) +int mp_reduce_2k_l(mp_int *a, const mp_int *n, mp_int *d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index 802a5ba..e6ae839 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d) +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d) { int res, p; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 34367ed..af81b5b 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d) { int res; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index c733ca9..932521e 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -16,7 +16,7 @@ */ /* determines if mp_reduce_2k can be used */ -int mp_reduce_is_2k(mp_int *a) +int mp_reduce_is_2k(const mp_int *a) { int ix, iy, iw; mp_digit iz; diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index d4804d5..22c7582 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -16,7 +16,7 @@ */ /* determines if reduce_2k_l can be used */ -int mp_reduce_is_2k_l(mp_int *a) +int mp_reduce_is_2k_l(const mp_int *a) { int ix, iy; diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index 00ff61c..70e193a 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -18,7 +18,7 @@ /* pre-calculate the value required for Barrett reduction * For a given modulus "b" it calulates the value required in "a" */ -int mp_reduce_setup(mp_int *a, mp_int *b) +int mp_reduce_setup(mp_int *a, const mp_int *b) { int res; diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index ebb1b53..b8265fe 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -17,7 +17,7 @@ /* c = a * a (mod b) */ int -mp_sqrmod(mp_int *a, mp_int *b, mp_int *c) +mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t; diff --git a/libtommath/bn_mp_sqrtmod_prime.c b/libtommath/bn_mp_sqrtmod_prime.c index 12b427c..261723e 100644 --- a/libtommath/bn_mp_sqrtmod_prime.c +++ b/libtommath/bn_mp_sqrtmod_prime.c @@ -15,7 +15,7 @@ * */ -int mp_sqrtmod_prime(mp_int *n, mp_int *prime, mp_int *ret) +int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret) { int res, legendre; mp_int t1, C, Q, S, Z, M, T, R, two; diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 96a3a1b..9a45f6d 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -17,7 +17,7 @@ /* d = a - b (mod c) */ int -mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index bd37169..e73c12e 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -20,12 +20,12 @@ #define TAB_SIZE 256 #endif -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res, mu; mp_digit buf; int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int *,mp_int *,mp_int *); + int (*redux)(mp_int *,const mp_int *,mp_int *); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 9d811fa..513b5b9 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -358,98 +358,98 @@ int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ /* d = a + b (mod c) */ -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a - b (mod c) */ -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* c = a * a (mod b) */ -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = 1/a (mod b) */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = (a, b) */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c); /* produces value such that U1*a + U2*b = U3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); /* c = [a, b] or (a*b)/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c); /* finds one of the b'th root of a, such that |c|**b <= |a| * * returns error if a < 0 and b is even */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c); -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c); +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); /* special sqrt algo */ int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ -int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); +int mp_sqrtmod_prime(const mp_int *arg, const mp_int *prime, mp_int *ret); /* is number a square? */ -int mp_is_square(mp_int *arg, int *ret); +int mp_is_square(const mp_int *arg, int *ret); /* computes the jacobi c = (a | n) (or Legendre if b is prime) */ -int mp_jacobi(mp_int *a, mp_int *n, int *c); +int mp_jacobi(const mp_int *a, const mp_int *n, int *c); /* used to setup the Barrett reduction for a given modulus b */ -int mp_reduce_setup(mp_int *a, mp_int *b); +int mp_reduce_setup(mp_int *a, const mp_int *b); /* Barrett Reduction, computes a (mod b) with a precomputed value c * * Assumes that 0 < a <= b*b, note if 0 > a > -(b*b) then you can merely * compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code]. */ -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +int mp_reduce(mp_int *a, const mp_int *b, mp_int *c); /* setups the montgomery reduction */ -int mp_montgomery_setup(mp_int *a, mp_digit *mp); +int mp_montgomery_setup(const mp_int *a, mp_digit *mp); /* computes a = B**n mod b without division or multiplication useful for * normalizing numbers in a Montgomery system. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b); /* computes x/R == x (mod N) via Montgomery Reduction */ -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp); /* returns 1 if a is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a); +int mp_dr_is_modulus(const mp_int *a); /* sets the value of "d" required for mp_dr_reduce */ -void mp_dr_setup(mp_int *a, mp_digit *d); +void mp_dr_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b using the Diminished Radix method */ -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp); /* returns true if a can be reduced with mp_reduce_2k */ -int mp_reduce_is_2k(mp_int *a); +int mp_reduce_is_2k(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d); /* returns true if a can be reduced with mp_reduce_2k_l */ -int mp_reduce_is_2k_l(mp_int *a); +int mp_reduce_is_2k_l(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +int mp_reduce_2k_l(mp_int *a, const mp_int *n, mp_int *d); /* d = a**b (mod c) */ -int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* ---> Primes <--- */ diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 7f33fab..58846bf 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -70,11 +70,11 @@ int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c); int mp_karatsuba_sqr(const mp_int *a, mp_int *b); int mp_toom_sqr(const mp_int *a, mp_int *b); -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c); -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c); +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho); +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; -- cgit v0.12 From f75f76c9d479632f92d722036fdb45311338021f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Sep 2017 14:38:26 +0000 Subject: Finish libtommath's constification work. All done (hopefully). And make sure that C preprocessor directives have the '#' as first character on the line. --- generic/tclTomMath.h | 8 ++++---- libtommath/bn_fast_s_mp_mul_high_digs.c | 2 +- libtommath/bn_mp_prime_fermat.c | 2 +- libtommath/bn_mp_prime_is_divisible.c | 2 +- libtommath/bn_mp_prime_is_prime.c | 2 +- libtommath/bn_mp_prime_miller_rabin.c | 2 +- libtommath/bn_s_mp_mul_high_digs.c | 2 +- libtommath/tommath.h | 8 ++++---- libtommath/tommath_private.h | 8 +++----- win/tclAppInit.c | 4 ++-- win/tclWinPipe.c | 12 ++++++------ 11 files changed, 25 insertions(+), 27 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 1f22d6f..c8b2a87 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -663,21 +663,21 @@ MODULE_SCOPE const mp_digit ltm_prime_tab[PRIME_SIZE]; /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ /* -int mp_prime_is_divisible(mp_int *a, int *result); +int mp_prime_is_divisible(const mp_int *a, int *result); */ /* performs one Fermat test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ /* -int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result); */ /* performs one Miller-Rabin test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ /* -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result); */ /* This gives [for a given bit size] the number of trials required @@ -695,7 +695,7 @@ int mp_prime_rabin_miller_trials(int size); * Sets result to 1 if probably prime, 0 otherwise */ /* -int mp_prime_is_prime(mp_int *a, int t, int *result); +int mp_prime_is_prime(const mp_int *a, int t, int *result); */ /* finds the next prime after the number "a" using "t" trials diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 588d80b..8b662ed 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -24,7 +24,7 @@ * * Based on Algorithm 14.12 on pp.595 of HAC. */ -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 37ad6ec..9c15435 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -23,7 +23,7 @@ * * Sets result to 1 if the congruence holds, or zero otherwise. */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result) +int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result) { mp_int t; int err; diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index 92af330..c1e1158 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -20,7 +20,7 @@ * * sets result to 0 if not, 1 if yes */ -int mp_prime_is_divisible(mp_int *a, int *result) +int mp_prime_is_divisible(const mp_int *a, int *result) { int err, ix; mp_digit res; diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 20a7d1f..e97712d 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -22,7 +22,7 @@ * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result) +int mp_prime_is_prime(const mp_int *a, int t, int *result) { mp_int b; int ix, err, res; diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 917dc01..5de5f05 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -22,7 +22,7 @@ * Randomly the chance of error is no more than 1/4 and often * very much lower. */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result) +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result) { mp_int n1, y, r; int s, j, err; diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 44d0d21..0a829b9 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -19,7 +19,7 @@ * [meant to get the higher part of the product] */ int -s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 513b5b9..dee7ab5 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -464,17 +464,17 @@ int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); extern const mp_digit ltm_prime_tab[PRIME_SIZE]; /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ -int mp_prime_is_divisible(mp_int *a, int *result); +int mp_prime_is_divisible(const mp_int *a, int *result); /* performs one Fermat test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result); /* performs one Miller-Rabin test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result); /* This gives [for a given bit size] the number of trials required * such that Miller-Rabin gives a prob of failure lower than 2^-96 @@ -488,7 +488,7 @@ int mp_prime_rabin_miller_trials(int size); * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result); +int mp_prime_is_prime(const mp_int *a, int t, int *result); /* finds the next prime after the number "a" using "t" trials * of Miller-Rabin. diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 58846bf..be065cd 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -40,21 +40,19 @@ extern "C" { #endif /* define heap macros */ -#if 0 #ifndef XMALLOC /* default to libc stuff */ # define XMALLOC malloc # define XFREE free # define XREALLOC realloc # define XCALLOC calloc -#else +#elif 0 /* prototypes for our heap functions */ extern void *XMALLOC(size_t n); extern void *XREALLOC(void *p, size_t n); extern void *XCALLOC(size_t n, size_t s); extern void XFREE(void *p); #endif -#endif /* lowlevel functions, do not call! */ int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); @@ -62,8 +60,8 @@ int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); int fast_s_mp_sqr(const mp_int *a, mp_int *b); int s_mp_sqr(const mp_int *a, mp_int *b); int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); diff --git a/win/tclAppInit.c b/win/tclAppInit.c index e06eaf5..ef9f98b 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -263,8 +263,8 @@ setargv( } /* Make sure we don't call ckalloc through the (not yet initialized) stub table */ - #undef Tcl_Alloc - #undef Tcl_DbCkalloc +# undef Tcl_Alloc +# undef Tcl_DbCkalloc argSpace = ckalloc(size * sizeof(char *) + (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR)); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4b372a5..5f1aa70 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -3392,11 +3392,11 @@ TclPipeThreadStop( SetEvent(pipeTI->evWakeUp); } CloseHandle(pipeTI->evControl); - #ifndef _PTI_USE_CKALLOC +# ifndef _PTI_USE_CKALLOC free(pipeTI); - #else +# else ckfree(pipeTI); - #endif +# endif } } @@ -3440,13 +3440,13 @@ TclPipeThreadExit( if (pipeTI->evWakeUp) { SetEvent(pipeTI->evWakeUp); } - #ifndef _PTI_USE_CKALLOC +# ifndef _PTI_USE_CKALLOC free(pipeTI); - #else +# else ckfree(pipeTI); /* be sure all subsystems used are finalized */ Tcl_FinalizeThread(); - #endif +# endif } } -- cgit v0.12 From 65703d1f87d85eea842224137695c20c320c7bd7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Sep 2017 09:07:35 +0000 Subject: Further astyle formatting of libtommath. No functional changes. --- libtommath/bn_mp_2expt.c | 3 +-- libtommath/bn_mp_abs.c | 3 +-- libtommath/bn_mp_add_d.c | 3 +-- libtommath/bn_mp_addmod.c | 3 +-- libtommath/bn_mp_and.c | 3 +-- libtommath/bn_mp_clamp.c | 3 +-- libtommath/bn_mp_clear.c | 3 +-- libtommath/bn_mp_cmp.c | 3 +-- libtommath/bn_mp_copy.c | 3 +-- libtommath/bn_mp_count_bits.c | 3 +-- libtommath/bn_mp_div.c | 2 +- libtommath/bn_mp_div_3.c | 3 +-- libtommath/bn_mp_div_d.c | 7 +++++-- libtommath/bn_mp_dr_reduce.c | 3 +-- libtommath/bn_mp_dr_setup.c | 3 +-- libtommath/bn_mp_exch.c | 3 +-- libtommath/bn_mp_export.c | 8 +++----- libtommath/bn_mp_exptmod_fast.c | 4 ++-- libtommath/bn_mp_exteuclid.c | 2 +- libtommath/bn_mp_get_int.c | 6 +++--- libtommath/bn_mp_get_long.c | 6 +++--- libtommath/bn_mp_get_long_long.c | 6 +++--- libtommath/bn_mp_import.c | 11 ++++------- libtommath/bn_mp_is_square.c | 16 ++++++++-------- libtommath/bn_mp_mod.c | 3 +-- libtommath/bn_mp_mod_2d.c | 3 +-- libtommath/bn_mp_mod_d.c | 3 +-- libtommath/bn_mp_montgomery_reduce.c | 3 +-- libtommath/bn_mp_montgomery_setup.c | 3 +-- libtommath/bn_mp_mul.c | 2 +- libtommath/bn_mp_mul_d.c | 7 +++---- libtommath/bn_mp_radix_size.c | 2 +- libtommath/bn_mp_rand.c | 3 +-- libtommath/bn_mp_read_radix.c | 4 ++-- libtommath/bn_mp_sqr.c | 3 +-- libtommath/bn_mp_sqrmod.c | 3 +-- libtommath/bn_mp_sub.c | 3 +-- libtommath/bn_mp_sub_d.c | 3 +-- libtommath/bn_mp_submod.c | 3 +-- libtommath/bn_mp_toom_sqr.c | 3 +-- libtommath/bn_mp_toradix.c | 2 +- libtommath/bn_mp_toradix_n.c | 2 +- libtommath/bn_mp_xor.c | 3 +-- libtommath/bn_reverse.c | 3 +-- libtommath/bn_s_mp_add.c | 3 +-- libtommath/bn_s_mp_exptmod.c | 6 +++--- libtommath/bn_s_mp_mul_high_digs.c | 3 +-- libtommath/bn_s_mp_sqr.c | 4 ++-- libtommath/bn_s_mp_sub.c | 3 +-- 49 files changed, 78 insertions(+), 112 deletions(-) diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index bdc868f..701144c 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -20,8 +20,7 @@ * Simple algorithm which zeroes the int, grows it then just sets one bit * as required. */ -int -mp_2expt(mp_int *a, int b) +int mp_2expt(mp_int *a, int b) { int res; diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index 03904d2..9b6bcec 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -19,8 +19,7 @@ * * Simple function copies the input and fixes the sign to positive */ -int -mp_abs(const mp_int *a, mp_int *b) +int mp_abs(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 5270d27..e5ede1f 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -16,8 +16,7 @@ */ /* single digit addition */ -int -mp_add_d(const mp_int *a, mp_digit b, mp_int *c) +int mp_add_d(const mp_int *a, mp_digit b, mp_int *c) { int res, ix, oldused; mp_digit *tmpa, *tmpc, mu; diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 5aee233..0d612c3 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -16,8 +16,7 @@ */ /* d = a + b (mod c) */ -int -mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index c6e8cf7..09ff772 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -16,8 +16,7 @@ */ /* AND two ints together */ -int -mp_and(const mp_int *a, const mp_int *b, mp_int *c) +int mp_and(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; mp_int t; diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index e5c8907..3853914 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -22,8 +22,7 @@ * Typically very fast. Also fixes the sign if there * are no more leading digits */ -void -mp_clamp(mp_int *a) +void mp_clamp(mp_int *a) { /* decrease used while the most significant digit is * zero. diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index eada2d7..fcf4d61 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -16,8 +16,7 @@ */ /* clear one (frees) */ -void -mp_clear(mp_int *a) +void mp_clear(mp_int *a) { int i; diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 37f616e..a33d483 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -16,8 +16,7 @@ */ /* compare two ints (signed)*/ -int -mp_cmp(const mp_int *a, const mp_int *b) +int mp_cmp(const mp_int *a, const mp_int *b) { /* compare based on sign */ if (a->sign != b->sign) { diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 0f31138..17816e8 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -16,8 +16,7 @@ */ /* copy, b = a */ -int -mp_copy(const mp_int *a, mp_int *b) +int mp_copy(const mp_int *a, mp_int *b) { int res, n; diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index f2cd190..7424581 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -16,8 +16,7 @@ */ /* returns the number of bits in an int */ -int -mp_count_bits(const mp_int *a) +int mp_count_bits(const mp_int *a) { int r; mp_digit q; diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 6bad443..dbfdc03 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -167,7 +167,7 @@ int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d) t = y.used - 1; /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ - if ((res = mp_lshd(&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ + if ((res = mp_lshd(&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ goto LBL_Y; } diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index 8011965..9cc8caa 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -16,8 +16,7 @@ */ /* divide by three (based on routine from MPI and the GMP manual) */ -int -mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) { mp_int q; mp_word w, t; diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 9997646..0e9dc95 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -19,10 +19,13 @@ static int s_is_power_of_two(mp_digit b, int *p) { int x; - /* quick out - if (b & (b-1)) isn't zero, b isn't a power of two */ - if ((b == 0) || ((b & (b-1)) != 0)) { + /* fast return if no power of two */ + if ((b & (b-1)) != 0) { return 0; } + + /* This loops gives the wrong result for b==1, + * but this function is never called for those values. */ for (x = 1; x < DIGIT_BIT; x++) { if (b == (((mp_digit)1)<dp[0])); + *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - ((mp_word)a->dp[0])); } #endif diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index a95560a..2bc635f 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -18,8 +18,7 @@ /* swap the elements of two integers, for cases where you can't simply swap the * mp_int pointers around */ -void -mp_exch(mp_int *a, mp_int *b) +void mp_exch(mp_int *a, mp_int *b) { mp_int t; diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 43228a8..b69a4fb 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -53,11 +53,9 @@ int mp_export(void *rop, size_t *countp, int order, size_t size, for (i = 0; i < count; ++i) { for (j = 0; j < size; ++j) { - unsigned char *byte = ( - (unsigned char *)rop + - (((order == -1) ? i : ((count - 1) - i)) * size) + - ((endian == -1) ? j : ((size - 1) - j)) - ); + unsigned char *byte = (unsigned char *)rop + + (((order == -1) ? i : ((count - 1) - i)) * size) + + ((endian == -1) ? j : ((size - 1) - j)); if (j >= (size - nail_bytes)) { *byte = 0; diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 08c6bc3..4a188d0 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -24,9 +24,9 @@ */ #ifdef MP_LOW_MEM -#define TAB_SIZE 32 +# define TAB_SIZE 32 #else -#define TAB_SIZE 256 +# define TAB_SIZE 256 #endif int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index adaea86..08e5ff2 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -20,7 +20,7 @@ */ int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { - mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; + mp_int u1, u2, u3, v1, v2, v3, t1, t2, t3, q, tmp; int err; if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 5d26ce9..f4a347f 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -26,13 +26,13 @@ unsigned long mp_get_int(const mp_int *a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } /* force result to 32-bits always so it is consistent on non 32-bit platforms */ diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index ea9ac43..3fc7c35 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -26,14 +26,14 @@ unsigned long mp_get_long(const mp_int *a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); #if (ULONG_MAX != 0xffffffffuL) || (DIGIT_BIT < 32) while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } #endif return res; diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 111b469..a363f60 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -26,14 +26,14 @@ Tcl_WideUInt mp_get_long_long(const mp_int *a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(Tcl_WideUInt) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(Tcl_WideUInt) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); #if DIGIT_BIT < 64 while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } #endif return res; diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index 50bee2e..afd735e 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -46,14 +46,11 @@ int mp_import(mp_int *rop, size_t count, int order, size_t size, for (i = 0; i < count; ++i) { for (j = 0; j < (size - nail_bytes); ++j) { - unsigned char byte = *( - (unsigned char *)op + - (((order == 1) ? i : ((count - 1) - i)) * size) + - ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes)) - ); + unsigned char byte = *((unsigned char *)op + + (((order == 1) ? i : ((count - 1) - i)) * size) + + ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes))); - if ( - (result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { + if ((result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { return result; } diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 4d8612f..dd5150e 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -38,7 +38,7 @@ static const char rem_105[105] = { }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(const mp_int *arg,int *ret) +int mp_is_square(const mp_int *arg, int *ret) { int res; mp_digit c; @@ -58,12 +58,12 @@ int mp_is_square(const mp_int *arg,int *ret) } /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127 & DIGIT(arg,0)] == 1) { + if (rem_128[127 & DIGIT(arg, 0)] == 1) { return MP_OKAY; } /* Next check mod 105 (3*5*7) */ - if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { + if ((res = mp_mod_d(arg, 105, &c)) != MP_OKAY) { return res; } if (rem_105[c] == 1) { @@ -71,10 +71,10 @@ int mp_is_square(const mp_int *arg,int *ret) } - if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { + if ((res = mp_init_set_int(&t, 11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { return res; } - if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { + if ((res = mp_mod(arg, &t, &t)) != MP_OKAY) { goto ERR; } r = mp_get_int(&t); @@ -91,14 +91,14 @@ int mp_is_square(const mp_int *arg,int *ret) if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR; /* Final check - is sqr(sqrt(arg)) == arg ? */ - if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { + if ((res = mp_sqrt(arg, &t)) != MP_OKAY) { goto ERR; } - if ((res = mp_sqr(&t,&t)) != MP_OKAY) { + if ((res = mp_sqr(&t, &t)) != MP_OKAY) { goto ERR; } - *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO; + *ret = (mp_cmp_mag(&t, arg) == MP_EQ) ? MP_YES : MP_NO; ERR: mp_clear(&t); return res; diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index a7525c0..64e73ea 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -16,8 +16,7 @@ */ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ -int -mp_mod(const mp_int *a, const mp_int *b, mp_int *c) +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int t; int res; diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 31997d3..8e69757 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -16,8 +16,7 @@ */ /* calc a value mod 2**b */ -int -mp_mod_2d(const mp_int *a, int b, mp_int *c) +int mp_mod_2d(const mp_int *a, int b, mp_int *c) { int x, res; diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 5217aa4..9a24e78 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -15,8 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -int -mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) { return mp_div_d(a, b, NULL, c); } diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index e9f6c1c..a38173e 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -16,8 +16,7 @@ */ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int -mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) +int mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, digs; mp_digit mu; diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 37069c3..685ba51 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -16,8 +16,7 @@ */ /* setups the montgomery reduction stuff */ -int -mp_montgomery_setup(const mp_int *n, mp_digit *rho) +int mp_montgomery_setup(const mp_int *n, mp_digit *rho) { mp_digit x, b; diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index 6e7f956..71d523d 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -51,7 +51,7 @@ int mp_mul(const mp_int *a, const mp_int *b, mp_int *c) #endif { #ifdef BN_S_MP_MUL_DIGS_C - res = s_mp_mul(a, b, c); /* uses s_mp_mul_digs */ + res = s_mp_mul(a, b, c); /* uses s_mp_mul_digs */ #else res = MP_VAL; #endif diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 98b99c9..0f6d03e 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -16,8 +16,7 @@ */ /* multiply by a digit */ -int -mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit u, *tmpa, *tmpc; mp_word r; @@ -51,10 +50,10 @@ mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); /* mask off higher bits to get a single digit */ - *tmpc++ = (mp_digit)(r & ((mp_word) MP_MASK)); + *tmpc++ = (mp_digit)(r & ((mp_word)MP_MASK)); /* send carry into next iteration */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); } /* store final carry [if any] and increment ix offset */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index edcf618..29355cb 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -58,7 +58,7 @@ int mp_radix_size(const mp_int *a, int radix, int *size) /* fetch out all of the digits */ while (mp_iszero(&t) == MP_NO) { - if ((res = mp_div_d(&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { mp_clear(&t); return res; } diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 7ac01dc..92a9a97 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -41,8 +41,7 @@ static mp_digit s_gen_random(void) return d; } -int -mp_rand(mp_int *a, int digits) +int mp_rand(mp_int *a, int digits) { int res; mp_digit d; diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 6e57ed5..bc31cc5 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -60,10 +60,10 @@ int mp_read_radix(mp_int *a, const char *str, int radix) * to the number, otherwise exit the loop. */ if (y < radix) { - if ((res = mp_mul_d(a, (mp_digit) radix, a)) != MP_OKAY) { + if ((res = mp_mul_d(a, (mp_digit)radix, a)) != MP_OKAY) { return res; } - if ((res = mp_add_d(a, (mp_digit) y, a)) != MP_OKAY) { + if ((res = mp_add_d(a, (mp_digit)y, a)) != MP_OKAY) { return res; } } else { diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index 0fd077c..2b71097 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -16,8 +16,7 @@ */ /* computes b = a*a */ -int -mp_sqr(const mp_int *a, mp_int *b) +int mp_sqr(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index b8265fe..c3c7ec9 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -16,8 +16,7 @@ */ /* c = a * a (mod b) */ -int -mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t; diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index b865dbd..19cb65e 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -16,8 +16,7 @@ */ /* high level subtraction (handles signs) */ -int -mp_sub(const mp_int *a, const mp_int *b, mp_int *c) +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int sa, sb, res; diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index e22c35c..4d66a90 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -16,8 +16,7 @@ */ /* single digit subtraction */ -int -mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit *tmpa, *tmpc, mu; int res, ix, oldused; diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 9a45f6d..c4db397 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -16,8 +16,7 @@ */ /* d = a - b (mod c) */ -int -mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 921d6a5..b985435 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -16,8 +16,7 @@ */ /* squaring using Toom-Cook 3-way algorithm */ -int -mp_toom_sqr(const mp_int *a, mp_int *b) +int mp_toom_sqr(const mp_int *a, mp_int *b) { mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; int res, B; diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 79960f0..7dd6e4f 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -48,7 +48,7 @@ int mp_toradix(const mp_int *a, char *str, int radix) digs = 0; while (mp_iszero(&t) == MP_NO) { - if ((res = mp_div_d(&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { mp_clear(&t); return res; } diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 5d766bd..ef885fc 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -61,7 +61,7 @@ int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) /* no more room */ break; } - if ((res = mp_div_d(&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { mp_clear(&t); return res; } diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 91bcd02..9ebc53a 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -16,8 +16,7 @@ */ /* XOR two ints together */ -int -mp_xor(const mp_int *a, const mp_int *b, mp_int *c) +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; mp_int t; diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index c3e7cf2..71e3d03 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -16,8 +16,7 @@ */ /* reverse an array, used for radix code */ -void -bn_reverse(unsigned char *s, int len) +void bn_reverse(unsigned char *s, int len) { int ix, iy; unsigned char t; diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 415521f..2046722 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -16,8 +16,7 @@ */ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int -s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) { const mp_int *x; int olduse, res, min, max; diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index e73c12e..0d0145d 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -15,9 +15,9 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ #ifdef MP_LOW_MEM -#define TAB_SIZE 32 +# define TAB_SIZE 32 #else -#define TAB_SIZE 256 +# define TAB_SIZE 256 #endif int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) @@ -152,7 +152,7 @@ int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, i } /* read next digit and reset the bitcnt */ buf = X->dp[digidx--]; - bitcnt = (int) DIGIT_BIT; + bitcnt = (int)DIGIT_BIT; } /* grab the next msb from the exponent */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 0a829b9..37c108e 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -18,8 +18,7 @@ /* multiplies |a| * |b| and does not compute the lower digs digits * [meant to get the higher part of the product] */ -int -s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index e07bf1c..aae06eb 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -38,10 +38,10 @@ int s_mp_sqr(const mp_int *a, mp_int *b) ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); /* store lower part in result */ - t.dp[ix+ix] = (mp_digit)(r & ((mp_word) MP_MASK)); + t.dp[ix+ix] = (mp_digit)(r & ((mp_word)MP_MASK)); /* get the carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); /* left hand side of A[ix] * A[iy] */ tmpx = a->dp[ix]; diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 8373025..52b8096 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -16,8 +16,7 @@ */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int -s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) +int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int olduse, res, min, max; -- cgit v0.12 From 1b28405773771365e5ad486b41fe5f2c43703d27 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Sep 2017 09:21:54 +0000 Subject: Move fast return from s_is_power_of_two() to mp_div_d(). This saves a function call in the common case where b is not a power of 2. --- libtommath/bn_mp_div_d.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 0e9dc95..d0131c3 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -19,13 +19,8 @@ static int s_is_power_of_two(mp_digit b, int *p) { int x; - /* fast return if no power of two */ - if ((b & (b-1)) != 0) { - return 0; - } - - /* This loops gives the wrong result for b==1, - * but this function is never called for those values. */ + /* Gives the wrong result for b==1, but this function + * is never called for this value anyway. */ for (x = 1; x < DIGIT_BIT; x++) { if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)< Date: Thu, 21 Sep 2017 19:05:11 +0000 Subject: RFE [566a999189] - better error message for 32/64 bit mismatch on load. --- win/tclWinLoad.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 26512b1..3ad6328 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -66,6 +66,7 @@ TclpDlopen( HINSTANCE hInstance; const TCHAR *nativeName; Tcl_LoadHandle handlePtr; + DWORD firstError; /* * First try the full path the user gave us. This is particularly @@ -84,6 +85,12 @@ TclpDlopen( Tcl_DString ds; + /* + * Remember the first error on load attempt to be used if the + * second load attempt below also fails. + */ + firstError = GetLastError(); + nativeName = Tcl_WinUtfToTChar(Tcl_GetString(pathPtr), -1, &ds); hInstance = LoadLibraryEx(nativeName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); @@ -91,8 +98,21 @@ TclpDlopen( } if (hInstance == NULL) { - DWORD lastError = GetLastError(); - Tcl_Obj *errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ", + DWORD lastError; + Tcl_Obj *errMsg; + + /* + * We choose to only use the error from the second call if the first + * call failed due to the file not being found. Else stick to the + * first error for reporting purposes. + */ + if (firstError == ERROR_MOD_NOT_FOUND || + firstError == ERROR_DLL_NOT_FOUND) + lastError = GetLastError(); + else + lastError = firstError; + + errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ", Tcl_GetString(pathPtr)); /* @@ -129,7 +149,11 @@ TclpDlopen( Tcl_AppendToObj(errMsg, "the library initialization" " routine failed", -1); break; - default: + case ERROR_BAD_EXE_FORMAT: + Tcl_SetErrorCode(interp, "WIN_LOAD", "BAD_EXE_FORMAT", NULL); + Tcl_AppendToObj(errMsg, "Bad exe format. Possibly a 32/64-bit mismatch.", -1); + break; + default: TclWinConvertError(lastError); Tcl_AppendToObj(errMsg, Tcl_PosixError(interp), -1); } -- cgit v0.12 From b0fe49c36dde40613283049b38e045f4f251c283 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 22 Sep 2017 08:48:23 +0000 Subject: Make libtommath's "make" work in Tcl environment (for testing). Eliminate internal s_is_power_of_two(), which can better be done inline. Fix tommath.h for _MSC_VER. --- libtommath/bn_mp_div_d.c | 22 ++++++---------------- libtommath/tommath.h | 4 +++- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index d0131c3..c408602 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -15,21 +15,6 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -static int s_is_power_of_two(mp_digit b, int *p) -{ - int x; - - /* Gives the wrong result for b==1, but this function - * is never called for this value anyway. */ - for (x = 1; x < DIGIT_BIT; x++) { - if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)< Date: Mon, 2 Oct 2017 15:22:27 +0000 Subject: 'const'ify all libtommath functions, will appear in next libtommath version. See: pull request [https://github.com/libtom/libtommath/pull/88|88] --- libtommath/bn_fast_mp_invmod.c | 2 +- libtommath/bn_fast_mp_montgomery_reduce.c | 2 +- libtommath/bn_fast_s_mp_mul_digs.c | 2 +- libtommath/bn_fast_s_mp_mul_high_digs.c | 2 +- libtommath/bn_fast_s_mp_sqr.c | 2 +- libtommath/bn_mp_abs.c | 2 +- libtommath/bn_mp_add.c | 2 +- libtommath/bn_mp_add_d.c | 9 +- libtommath/bn_mp_addmod.c | 2 +- libtommath/bn_mp_and.c | 5 +- libtommath/bn_mp_cmp.c | 2 +- libtommath/bn_mp_cmp_d.c | 2 +- libtommath/bn_mp_cmp_mag.c | 2 +- libtommath/bn_mp_cnt_lsb.c | 2 +- libtommath/bn_mp_copy.c | 2 +- libtommath/bn_mp_count_bits.c | 2 +- libtommath/bn_mp_div.c | 4 +- libtommath/bn_mp_div_2.c | 2 +- libtommath/bn_mp_div_2d.c | 2 +- libtommath/bn_mp_div_3.c | 2 +- libtommath/bn_mp_div_d.c | 2 +- libtommath/bn_mp_dr_is_modulus.c | 2 +- libtommath/bn_mp_dr_reduce.c | 2 +- libtommath/bn_mp_dr_setup.c | 2 +- libtommath/bn_mp_export.c | 2 +- libtommath/bn_mp_expt_d.c | 2 +- libtommath/bn_mp_expt_d_ex.c | 2 +- libtommath/bn_mp_exptmod.c | 2 +- libtommath/bn_mp_exptmod_fast.c | 4 +- libtommath/bn_mp_exteuclid.c | 2 +- libtommath/bn_mp_fwrite.c | 2 +- libtommath/bn_mp_gcd.c | 2 +- libtommath/bn_mp_get_int.c | 2 +- libtommath/bn_mp_get_long.c | 2 +- libtommath/bn_mp_get_long_long.c | 2 +- libtommath/bn_mp_init_copy.c | 2 +- libtommath/bn_mp_invmod.c | 2 +- libtommath/bn_mp_invmod_slow.c | 2 +- libtommath/bn_mp_is_square.c | 2 +- libtommath/bn_mp_jacobi.c | 2 +- libtommath/bn_mp_karatsuba_mul.c | 2 +- libtommath/bn_mp_karatsuba_sqr.c | 2 +- libtommath/bn_mp_lcm.c | 2 +- libtommath/bn_mp_mod.c | 2 +- libtommath/bn_mp_mod_2d.c | 2 +- libtommath/bn_mp_mod_d.c | 2 +- libtommath/bn_mp_montgomery_calc_normalization.c | 2 +- libtommath/bn_mp_montgomery_reduce.c | 2 +- libtommath/bn_mp_montgomery_setup.c | 2 +- libtommath/bn_mp_mul.c | 2 +- libtommath/bn_mp_mul_2.c | 2 +- libtommath/bn_mp_mul_2d.c | 2 +- libtommath/bn_mp_mul_d.c | 2 +- libtommath/bn_mp_mulmod.c | 2 +- libtommath/bn_mp_n_root.c | 2 +- libtommath/bn_mp_n_root_ex.c | 19 ++- libtommath/bn_mp_neg.c | 2 +- libtommath/bn_mp_or.c | 5 +- libtommath/bn_mp_prime_fermat.c | 2 +- libtommath/bn_mp_prime_is_divisible.c | 2 +- libtommath/bn_mp_prime_is_prime.c | 2 +- libtommath/bn_mp_prime_miller_rabin.c | 2 +- libtommath/bn_mp_radix_size.c | 2 +- libtommath/bn_mp_reduce.c | 2 +- libtommath/bn_mp_reduce_2k.c | 2 +- libtommath/bn_mp_reduce_2k_l.c | 2 +- libtommath/bn_mp_reduce_2k_setup.c | 2 +- libtommath/bn_mp_reduce_2k_setup_l.c | 2 +- libtommath/bn_mp_reduce_is_2k.c | 2 +- libtommath/bn_mp_reduce_is_2k_l.c | 2 +- libtommath/bn_mp_reduce_setup.c | 2 +- libtommath/bn_mp_signed_bin_size.c | 2 +- libtommath/bn_mp_sqr.c | 2 +- libtommath/bn_mp_sqrmod.c | 2 +- libtommath/bn_mp_sqrt.c | 2 +- libtommath/bn_mp_sqrtmod_prime.c | 2 +- libtommath/bn_mp_sub.c | 2 +- libtommath/bn_mp_sub_d.c | 9 +- libtommath/bn_mp_submod.c | 2 +- libtommath/bn_mp_to_signed_bin.c | 2 +- libtommath/bn_mp_to_signed_bin_n.c | 2 +- libtommath/bn_mp_to_unsigned_bin.c | 2 +- libtommath/bn_mp_to_unsigned_bin_n.c | 2 +- libtommath/bn_mp_toom_mul.c | 2 +- libtommath/bn_mp_toom_sqr.c | 2 +- libtommath/bn_mp_toradix.c | 2 +- libtommath/bn_mp_toradix_n.c | 2 +- libtommath/bn_mp_unsigned_bin_size.c | 2 +- libtommath/bn_mp_xor.c | 5 +- libtommath/bn_s_mp_add.c | 4 +- libtommath/bn_s_mp_exptmod.c | 4 +- libtommath/bn_s_mp_mul_digs.c | 2 +- libtommath/bn_s_mp_mul_high_digs.c | 2 +- libtommath/bn_s_mp_sqr.c | 2 +- libtommath/bn_s_mp_sub.c | 2 +- libtommath/tommath.h | 156 +++++++++++------------ libtommath/tommath_private.h | 34 ++--- 97 files changed, 215 insertions(+), 213 deletions(-) diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index 7771136..08389dd 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -21,7 +21,7 @@ * Based on slow invmod except this is optimized for the case where b is * odd as per HAC Note 14.64 on pp. 610 */ -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, B, D; int res, neg; diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index f2c38bf..54d9b0a 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -23,7 +23,7 @@ * * Based on Algorithm 14.32 on pp.601 of HAC. */ -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, olduse; mp_word W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index 763dbb1..558d151 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -31,7 +31,7 @@ * Based on Algorithm 14.12 on pp.595 of HAC. * */ -int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 588d80b..8b662ed 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -24,7 +24,7 @@ * * Based on Algorithm 14.12 on pp.595 of HAC. */ -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index ceed82b..161f785 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -25,7 +25,7 @@ After that loop you do the squares and add them in. */ -int fast_s_mp_sqr(mp_int *a, mp_int *b) +int fast_s_mp_sqr(const mp_int *a, mp_int *b) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY], *tmpx; diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index d5fc012..9b6bcec 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -19,7 +19,7 @@ * * Simple function copies the input and fixes the sign to positive */ -int mp_abs(mp_int *a, mp_int *b) +int mp_abs(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 4df4c81..d31d5a0 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -16,7 +16,7 @@ */ /* high level addition (handles signs) */ -int mp_add(mp_int *a, mp_int *b, mp_int *c) +int mp_add(const mp_int *a, const mp_int *b, mp_int *c) { int sa, sb, res; diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 1e6ff63..e5ede1f 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -16,7 +16,7 @@ */ /* single digit addition */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c) +int mp_add_d(const mp_int *a, mp_digit b, mp_int *c) { int res, ix, oldused; mp_digit *tmpa, *tmpc, mu; @@ -30,14 +30,15 @@ int mp_add_d(mp_int *a, mp_digit b, mp_int *c) /* if a is negative and |a| >= b, call c = |a| - b */ if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { + mp_int a_ = *a; /* temporarily fix sign of a */ - a->sign = MP_ZPOS; + a_.sign = MP_ZPOS; /* c = |a| - b */ - res = mp_sub_d(a, b, c); + res = mp_sub_d(&a_, b, c); /* fix sign */ - a->sign = c->sign = MP_NEG; + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 229a716..0d612c3 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -16,7 +16,7 @@ */ /* d = a + b (mod c) */ -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 2f1472a..09ff772 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -16,10 +16,11 @@ */ /* AND two ints together */ -int mp_and(mp_int *a, mp_int *b, mp_int *c) +int mp_and(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy(&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 9047060..a33d483 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -16,7 +16,7 @@ */ /* compare two ints (signed)*/ -int mp_cmp(mp_int *a, mp_int *b) +int mp_cmp(const mp_int *a, const mp_int *b) { /* compare based on sign */ if (a->sign != b->sign) { diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index 27a546d..576a073 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -16,7 +16,7 @@ */ /* compare a digit */ -int mp_cmp_d(mp_int *a, mp_digit b) +int mp_cmp_d(const mp_int *a, mp_digit b) { /* compare based on sign */ if (a->sign == MP_NEG) { diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index ca2bc88..e2c723f 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -16,7 +16,7 @@ */ /* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag(mp_int *a, mp_int *b) +int mp_cmp_mag(const mp_int *a, const mp_int *b) { int n; mp_digit *tmpa, *tmpb; diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 7273655..9a94d3d 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -20,7 +20,7 @@ static const int lnz[16] = { }; /* Counts the number of lsbs which are zero before the first zero bit */ -int mp_cnt_lsb(mp_int *a) +int mp_cnt_lsb(const mp_int *a) { int x; mp_digit q, qq; diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index bed03b2..17816e8 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -16,7 +16,7 @@ */ /* copy, b = a */ -int mp_copy(mp_int *a, mp_int *b) +int mp_copy(const mp_int *a, mp_int *b) { int res, n; diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index dea364f..7424581 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -16,7 +16,7 @@ */ /* returns the number of bits in an int */ -int mp_count_bits(mp_int *a) +int mp_count_bits(const mp_int *a) { int r; mp_digit q; diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index fdb3453..dbfdc03 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -18,7 +18,7 @@ #ifdef BN_MP_DIV_SMALL /* slower bit-bang division... also smaller */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d) { mp_int ta, tb, tq, q; int res, n, n2; @@ -100,7 +100,7 @@ LBL_ERR: * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d) { mp_int q, x, y, t1, t2; int res, n, t, i, norm, neg; diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index b9d5339..edc8982 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -16,7 +16,7 @@ */ /* b = a/2 */ -int mp_div_2(mp_int *a, mp_int *b) +int mp_div_2(const mp_int *a, mp_int *b) { int x, res, oldused; diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index d6723ee..eae3498 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -16,7 +16,7 @@ */ /* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d) +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d) { mp_digit D, r, rr; int x, res; diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index c3a023a..9cc8caa 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -16,7 +16,7 @@ */ /* divide by three (based on routine from MPI and the GMP manual) */ -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d) +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) { mp_int q; mp_word w, t; diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 141db1d..db4a0a2 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -34,7 +34,7 @@ static int s_is_power_of_two(mp_digit b, int *p) } /* single digit division (based on routine from MPI) */ -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d) +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d) { mp_int q; mp_word w; diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index 4631daa..bf4ed8b 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -16,7 +16,7 @@ */ /* determines if a number is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a) +int mp_dr_is_modulus(const mp_int *a) { int ix; diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 25079be..1ccb669 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -29,7 +29,7 @@ * * Input x must be in the range 0 <= x <= (n-1)**2 */ -int mp_dr_reduce(mp_int *x, mp_int *n, mp_digit k) +int mp_dr_reduce(mp_int *x, const mp_int *n, mp_digit k) { int err, i, m; mp_word r; diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 97f31ba..af0e213 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -void mp_dr_setup(mp_int *a, mp_digit *d) +void mp_dr_setup(const mp_int *a, mp_digit *d) { /* the casts are required if DIGIT_BIT is one less than * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index b69a4fb..4276f4f 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -19,7 +19,7 @@ * see http://gmplib.org/manual/Integer-Import-and-Export.html */ int mp_export(void *rop, size_t *countp, int order, size_t size, - int endian, size_t nails, mp_int *op) + int endian, size_t nails, const mp_int *op) { int result; size_t odd_nails, nail_bytes, i, j, bits, count; diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index 38bf679..f5ce3c1 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -16,7 +16,7 @@ */ /* wrapper function for mp_expt_d_ex() */ -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c) +int mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) { return mp_expt_d_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index bece77b..99319a5 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -16,7 +16,7 @@ */ /* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) +int mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { int res; unsigned int x; diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index c4f392b..934fd25 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -21,7 +21,7 @@ * embedded in the normal function but that wasted alot of stack space * for nothing (since 99% of the time the Montgomery code would be called) */ -int mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y) +int mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y) { int dr; diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 38e0265..4a188d0 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -29,7 +29,7 @@ # define TAB_SIZE 256 #endif -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res; mp_digit buf, mp; @@ -39,7 +39,7 @@ int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) * one of many reduction algorithms without modding the guts of * the code with if statements everywhere. */ - int (*redux)(mp_int *,mp_int *,mp_digit); + int (*redux)(mp_int *,const mp_int *,mp_digit); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index 98eef76..08e5ff2 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -18,7 +18,7 @@ /* Extended euclidean algorithm of (a, b) produces a*u1 + b*u2 = u3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { mp_int u1, u2, u3, v1, v2, v3, t1, t2, t3, q, tmp; int err; diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 3641823..829dd4a 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -16,7 +16,7 @@ */ #ifndef LTM_NO_FILE -int mp_fwrite(mp_int *a, int radix, FILE *stream) +int mp_fwrite(const mp_int *a, int radix, FILE *stream) { char *buf; int err, len, x; diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 18f6dc3..f5aa78b 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -16,7 +16,7 @@ */ /* Greatest Common Divisor using the binary method */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c) +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c) { mp_int u, v; int k, u_lsb, v_lsb, res; diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index a3d1602..f4a347f 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -16,7 +16,7 @@ */ /* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int *a) +unsigned long mp_get_int(const mp_int *a) { int i; mp_min_u32 res; diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index 053930c..3fc7c35 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -16,7 +16,7 @@ */ /* get the lower unsigned long of an mp_int, platform dependent */ -unsigned long mp_get_long(mp_int *a) +unsigned long mp_get_long(const mp_int *a) { int i; unsigned long res; diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 131571a..838c3c3 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -16,7 +16,7 @@ */ /* get the lower unsigned long long of an mp_int, platform dependent */ -unsigned long long mp_get_long_long(mp_int *a) +unsigned long long mp_get_long_long(const mp_int *a) { int i; unsigned long long res; diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index c711e06..5681015 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -16,7 +16,7 @@ */ /* creates "a" then copies b into it */ -int mp_init_copy(mp_int *a, mp_int *b) +int mp_init_copy(mp_int *a, const mp_int *b) { int res; diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index b70fe18..525493a 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { /* b cannot be negative */ if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index 2bdd2b1..2bb5196 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, A, B, C, D; int res; diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 303fab6..dd5150e 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -38,7 +38,7 @@ static const char rem_105[105] = { }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg, int *ret) +int mp_is_square(const mp_int *arg, int *ret) { int res; mp_digit c; diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 8981393..c314c82 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -20,7 +20,7 @@ * HAC is wrong here, as the special case of (0 | 1) is not * handled correctly. */ -int mp_jacobi(mp_int *a, mp_int *n, int *c) +int mp_jacobi(const mp_int *a, const mp_int *n, int *c) { mp_int a1, p1; int k, s, r, res; diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 353c37c..1a84211 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -44,7 +44,7 @@ * Generally though the overhead of this method doesn't pay off * until a certain size (N ~ 80) is reached. */ -int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x0, x1, y0, y1, t1, x0y0, x1y1; int B, err; diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index fe39a33..c566b06 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -22,7 +22,7 @@ * is essentially the same algorithm but merely * tuned to perform recursive squarings. */ -int mp_karatsuba_sqr(mp_int *a, mp_int *b) +int mp_karatsuba_sqr(const mp_int *a, mp_int *b) { mp_int x0, x1, t1, t2, x0x0, x1x1; int B, err; diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index dc661f3..24b621c 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -16,7 +16,7 @@ */ /* computes least common multiple as |a*b|/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c) +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t1, t2; diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 267688c..64e73ea 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -16,7 +16,7 @@ */ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ -int mp_mod(mp_int *a, mp_int *b, mp_int *c) +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int t; int res; diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 59270b9..8e69757 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -16,7 +16,7 @@ */ /* calc a value mod 2**b */ -int mp_mod_2d(mp_int *a, int b, mp_int *c) +int mp_mod_2d(const mp_int *a, int b, mp_int *c) { int x, res; diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index ff77346..9a24e78 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -15,7 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c) +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) { return mp_div_d(a, b, NULL, c); } diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 2d95140..f2b0856 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -21,7 +21,7 @@ * The method is slightly modified to shift B unconditionally upto just under * the leading bit of b. This saves alot of multiple precision shifting. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b) +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b) { int x, bits, res; diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index 1909997..a38173e 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -16,7 +16,7 @@ */ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +int mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, digs; mp_digit mu; diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 46f560d..685ba51 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -16,7 +16,7 @@ */ /* setups the montgomery reduction stuff */ -int mp_montgomery_setup(mp_int *n, mp_digit *rho) +int mp_montgomery_setup(const mp_int *n, mp_digit *rho) { mp_digit x, b; diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index 315a520..71d523d 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -16,7 +16,7 @@ */ /* high level multiplication (handles sign) */ -int mp_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c) { int res, neg; neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index 33bdc4c..1744681 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -16,7 +16,7 @@ */ /* b = a*2 */ -int mp_mul_2(mp_int *a, mp_int *b) +int mp_mul_2(const mp_int *a, mp_int *b) { int x, res, oldused; diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index b3d92a9..4938e57 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -16,7 +16,7 @@ */ /* shift left by a certain bit count */ -int mp_mul_2d(mp_int *a, int b, mp_int *c) +int mp_mul_2d(const mp_int *a, int b, mp_int *c) { mp_digit d; int res; diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 1aa448c..0f6d03e 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -16,7 +16,7 @@ */ /* multiply by a digit */ -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c) +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit u, *tmpa, *tmpc; mp_word r; diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index b1e6a33..aeee4ee 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -16,7 +16,7 @@ */ /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index 8211c0a..a09804f 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -18,7 +18,7 @@ /* wrapper function for mp_n_root_ex() * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c) +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c) { return mp_n_root_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 9546745..ca50649 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -25,10 +25,10 @@ * each step involves a fair bit. This is not meant to * find huge roots [square and cube, etc]. */ -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { - mp_int t1, t2, t3; - int res, neg; + mp_int t1, t2, t3, a_; + int res; /* input must be positive if b is even */ if (((b & 1) == 0) && (a->sign == MP_NEG)) { @@ -48,8 +48,8 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; + a_ = *a; + a_.sign = MP_ZPOS; /* t2 = 2 */ mp_set(&t2, 2); @@ -74,7 +74,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* t2 = t1**b - a */ - if ((res = mp_sub(&t2, a, &t2)) != MP_OKAY) { + if ((res = mp_sub(&t2, &a_, &t2)) != MP_OKAY) { goto LBL_T3; } @@ -100,7 +100,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) goto LBL_T3; } - if (mp_cmp(&t2, a) == MP_GT) { + if (mp_cmp(&t2, &a_) == MP_GT) { if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) { goto LBL_T3; } @@ -109,14 +109,11 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } } - /* reset the sign of a first */ - a->sign = neg; - /* set the result */ mp_exch(&t1, c); /* set the sign of the result */ - c->sign = neg; + c->sign = a->sign; res = MP_OKAY; diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index b30d044..75f8bbd 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -16,7 +16,7 @@ */ /* b = -a */ -int mp_neg(mp_int *a, mp_int *b) +int mp_neg(const mp_int *a, mp_int *b) { int res; if (a != b) { diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index 2318c79..f411509 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -16,10 +16,11 @@ */ /* OR two ints together */ -int mp_or(mp_int *a, mp_int *b, mp_int *c) +int mp_or(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy(&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 37ad6ec..9c15435 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -23,7 +23,7 @@ * * Sets result to 1 if the congruence holds, or zero otherwise. */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result) +int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result) { mp_int t; int err; diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index 92af330..c1e1158 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -20,7 +20,7 @@ * * sets result to 0 if not, 1 if yes */ -int mp_prime_is_divisible(mp_int *a, int *result) +int mp_prime_is_divisible(const mp_int *a, int *result) { int err, ix; mp_digit res; diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 20a7d1f..e97712d 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -22,7 +22,7 @@ * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result) +int mp_prime_is_prime(const mp_int *a, int t, int *result) { mp_int b; int ix, err, res; diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 917dc01..5de5f05 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -22,7 +22,7 @@ * Randomly the chance of error is no more than 1/4 and often * very much lower. */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result) +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result) { mp_int n1, y, r; int s, j, err; diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index a6e2f04..29355cb 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -16,7 +16,7 @@ */ /* returns size of ASCII reprensentation */ -int mp_radix_size(mp_int *a, int radix, int *size) +int mp_radix_size(const mp_int *a, int radix, int *size) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index a2b9bf7..bbc521f 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -19,7 +19,7 @@ * precomputed via mp_reduce_setup. * From HAC pp.604 Algorithm 14.42 */ -int mp_reduce(mp_int *x, mp_int *m, mp_int *mu) +int mp_reduce(mp_int *x, const mp_int *m, const mp_int *mu) { mp_int q; int res, um = m->used; diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 6bc96d1..2922cad 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -16,7 +16,7 @@ */ /* reduces a modulo n where n is of the form 2**p - d */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index 8e6eeb0..23381bf 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -19,7 +19,7 @@ This differs from reduce_2k since "d" can be larger than a single digit. */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d) +int mp_reduce_2k_l(mp_int *a, const mp_int *n, const mp_int *d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index 802a5ba..e6ae839 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d) +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d) { int res, p; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 34367ed..af81b5b 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d) { int res; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index c733ca9..932521e 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -16,7 +16,7 @@ */ /* determines if mp_reduce_2k can be used */ -int mp_reduce_is_2k(mp_int *a) +int mp_reduce_is_2k(const mp_int *a) { int ix, iy, iw; mp_digit iz; diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index d4804d5..22c7582 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -16,7 +16,7 @@ */ /* determines if reduce_2k_l can be used */ -int mp_reduce_is_2k_l(mp_int *a) +int mp_reduce_is_2k_l(const mp_int *a) { int ix, iy; diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index 00ff61c..70e193a 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -18,7 +18,7 @@ /* pre-calculate the value required for Barrett reduction * For a given modulus "b" it calulates the value required in "a" */ -int mp_reduce_setup(mp_int *a, mp_int *b) +int mp_reduce_setup(mp_int *a, const mp_int *b) { int res; diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 082aeca..1fdfd85 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an signed equivalent */ -int mp_signed_bin_size(mp_int *a) +int mp_signed_bin_size(const mp_int *a) { return 1 + mp_unsigned_bin_size(a); } diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index e2e8641..2b71097 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -16,7 +16,7 @@ */ /* computes b = a*a */ -int mp_sqr(mp_int *a, mp_int *b) +int mp_sqr(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 96a7574..c3c7ec9 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -16,7 +16,7 @@ */ /* c = a * a (mod b) */ -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c) +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t; diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 95a6892..d70c523 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -16,7 +16,7 @@ */ /* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) +int mp_sqrt(const mp_int *arg, mp_int *ret) { int res; mp_int t1, t2; diff --git a/libtommath/bn_mp_sqrtmod_prime.c b/libtommath/bn_mp_sqrtmod_prime.c index 12b427c..261723e 100644 --- a/libtommath/bn_mp_sqrtmod_prime.c +++ b/libtommath/bn_mp_sqrtmod_prime.c @@ -15,7 +15,7 @@ * */ -int mp_sqrtmod_prime(mp_int *n, mp_int *prime, mp_int *ret) +int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret) { int res, legendre; mp_int t1, C, Q, S, Z, M, T, R, two; diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 75c7c2d..19cb65e 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -16,7 +16,7 @@ */ /* high level subtraction (handles signs) */ -int mp_sub(mp_int *a, mp_int *b, mp_int *c) +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int sa, sb, res; diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 7016abc..4d66a90 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -16,7 +16,7 @@ */ /* single digit subtraction */ -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c) +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit *tmpa, *tmpc, mu; int res, ix, oldused; @@ -32,9 +32,10 @@ int mp_sub_d(mp_int *a, mp_digit b, mp_int *c) * addition [with fudged signs] */ if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; + mp_int a_ = *a; + a_.sign = MP_ZPOS; + res = mp_add_d(&a_, b, c); + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 510fb19..c4db397 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -16,7 +16,7 @@ */ /* d = a - b (mod c) */ -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index 615bf32..4d4be88 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin(mp_int *a, unsigned char *b) +int mp_to_signed_bin(const mp_int *a, unsigned char *b) { int res; diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index 501f849..1447624 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) +int mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_signed_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index e103383..9339cce 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin(mp_int *a, unsigned char *b) +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b) { int x, res; mp_int t; diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index 5ee28f1..707dc82 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) +int mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 8b771bc..3554ea8 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -22,7 +22,7 @@ * only particularly useful on VERY large inputs * (we're talking 1000s of digits here...). */ -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) { mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; int res, B; diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 5e1e452..b985435 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -16,7 +16,7 @@ */ /* squaring using Toom-Cook 3-way algorithm */ -int mp_toom_sqr(mp_int *a, mp_int *b) +int mp_toom_sqr(const mp_int *a, mp_int *b) { mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; int res, B; diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 5016219..7dd6e4f 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -16,7 +16,7 @@ */ /* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix(mp_int *a, char *str, int radix) +int mp_toradix(const mp_int *a, char *str, int radix) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 287d3f8..ef885fc 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -19,7 +19,7 @@ * * Stores upto maxlen-1 chars and always a NULL byte */ -int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen) +int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index 174cdc1..04107fe 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size(mp_int *a) +int mp_unsigned_bin_size(const mp_int *a) { int size = mp_count_bits(a); return (size / 8) + (((size & 7) != 0) ? 1 : 0); diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 4224a7f..9ebc53a 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -16,10 +16,11 @@ */ /* XOR two ints together */ -int mp_xor(mp_int *a, mp_int *b, mp_int *c) +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy(&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 6ba65da..2046722 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -16,9 +16,9 @@ */ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int s_mp_add(mp_int *a, mp_int *b, mp_int *c) +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) { - mp_int *x; + const mp_int *x; int olduse, res, min, max; /* find sizes, we let |a| <= |b| which means we have to sort diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index f8e6b3b..a886361 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -20,12 +20,12 @@ # define TAB_SIZE 256 #endif -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res, mu; mp_digit buf; int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int *,mp_int *,mp_int *); + int (*redux)(mp_int *, const mp_int *, const mp_int *); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index c72c2a8..af13a02 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -19,7 +19,7 @@ * HAC pp. 595, Algorithm 14.12 Modified so you can control how * many digits of output are created. */ -int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 0e12f3b..37c108e 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -18,7 +18,7 @@ /* multiplies |a| * |b| and does not compute the lower digs digits * [meant to get the higher part of the product] */ -int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index 2910f24..aae06eb 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -16,7 +16,7 @@ */ /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr(mp_int *a, mp_int *b) +int s_mp_sqr(const mp_int *a, mp_int *b) { mp_int t; int res, ix, iy, pa; diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index f61aa83..52b8096 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -16,7 +16,7 @@ */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int s_mp_sub(mp_int *a, mp_int *b, mp_int *c) +int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int olduse, res, min, max; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 2aaea5b..591076e 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -223,13 +223,13 @@ int mp_set_long(mp_int *a, unsigned long b); int mp_set_long_long(mp_int *a, unsigned long long b); /* get a 32-bit value */ -unsigned long mp_get_int(mp_int *a); +unsigned long mp_get_int(const mp_int *a); /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int *a); +unsigned long mp_get_long(const mp_int *a); /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int *a); +unsigned long long mp_get_long_long(const mp_int *a); /* initialize and set a digit */ int mp_init_set(mp_int *a, mp_digit b); @@ -238,10 +238,10 @@ int mp_init_set(mp_int *a, mp_digit b); int mp_init_set_int(mp_int *a, unsigned long b); /* copy, b = a */ -int mp_copy(mp_int *a, mp_int *b); +int mp_copy(const mp_int *a, mp_int *b); /* inits and copies, a = b */ -int mp_init_copy(mp_int *a, mp_int *b); +int mp_init_copy(mp_int *a, const mp_int *b); /* trim unused digits */ void mp_clamp(mp_int *a); @@ -250,7 +250,7 @@ void mp_clamp(mp_int *a); int mp_import(mp_int *rop, size_t count, int order, size_t size, int endian, size_t nails, const void *op); /* export binary data */ -int mp_export(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, mp_int *op); +int mp_export(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, const mp_int *op); /* ---> digit manipulation <--- */ @@ -261,25 +261,25 @@ void mp_rshd(mp_int *a, int b); int mp_lshd(mp_int *a, int b); /* c = a / 2**b, implemented as c = a >> b */ -int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d); +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); /* c = a * 2**b, implemented as c = a << b */ -int mp_mul_2d(mp_int *a, int b, mp_int *c); +int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); /* c = a mod 2**b */ -int mp_mod_2d(mp_int *a, int b, mp_int *c); +int mp_mod_2d(const mp_int *a, int b, mp_int *c); /* computes a = 2**b */ int mp_2expt(mp_int *a, int b); /* Counts the number of lsbs which are zero before the first zero bit */ -int mp_cnt_lsb(mp_int *a); +int mp_cnt_lsb(const mp_int *a); /* I Love Earth! */ @@ -288,168 +288,168 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); /* c = a OR b */ -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); /* c = a AND b */ -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ /* b = -a */ -int mp_neg(mp_int *a, mp_int *b); +int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); /* compare a to b */ -int mp_cmp(mp_int *a, mp_int *b); +int mp_cmp(const mp_int *a, const mp_int *b); /* compare |a| to |b| */ -int mp_cmp_mag(mp_int *a, mp_int *b); +int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* c = a - b */ -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* c = a * b */ -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); /* b = a*a */ -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); /* a/b => cb + d == a */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); /* c = a mod b, 0 <= c < b */ -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); /* ---> single digit functions <--- */ /* compare against a single digit */ -int mp_cmp_d(mp_int *a, mp_digit b); +int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, mp_digit b, mp_int *c); /* c = a - b */ -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); /* a/b => cb + d == a */ -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); /* a/3 => 3c + d == a */ -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_expt_d(const mp_int *a, mp_digit b, mp_int *c); +int mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); /* c = a mod b, 0 <= c < b */ -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ /* d = a + b (mod c) */ -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a - b (mod c) */ -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* c = a * a (mod b) */ -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = 1/a (mod b) */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = (a, b) */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c); /* produces value such that U1*a + U2*b = U3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); /* c = [a, b] or (a*b)/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c); /* finds one of the b'th root of a, such that |c|**b <= |a| * * returns error if a < 0 and b is even */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c); -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c); +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); /* special sqrt algo */ -int mp_sqrt(mp_int *arg, mp_int *ret); +int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ -int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); +int mp_sqrtmod_prime(const mp_int *arg, const mp_int *prime, mp_int *ret); /* is number a square? */ -int mp_is_square(mp_int *arg, int *ret); +int mp_is_square(const mp_int *arg, int *ret); /* computes the jacobi c = (a | n) (or Legendre if b is prime) */ -int mp_jacobi(mp_int *a, mp_int *n, int *c); +int mp_jacobi(const mp_int *a, const mp_int *n, int *c); /* used to setup the Barrett reduction for a given modulus b */ -int mp_reduce_setup(mp_int *a, mp_int *b); +int mp_reduce_setup(mp_int *a, const mp_int *b); /* Barrett Reduction, computes a (mod b) with a precomputed value c * * Assumes that 0 < a <= b*b, note if 0 > a > -(b*b) then you can merely * compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code]. */ -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +int mp_reduce(mp_int *a, const mp_int *b, const mp_int *c); /* setups the montgomery reduction */ -int mp_montgomery_setup(mp_int *a, mp_digit *mp); +int mp_montgomery_setup(const mp_int *a, mp_digit *mp); /* computes a = B**n mod b without division or multiplication useful for * normalizing numbers in a Montgomery system. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b); /* computes x/R == x (mod N) via Montgomery Reduction */ -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp); /* returns 1 if a is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a); +int mp_dr_is_modulus(const mp_int *a); /* sets the value of "d" required for mp_dr_reduce */ -void mp_dr_setup(mp_int *a, mp_digit *d); +void mp_dr_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b using the Diminished Radix method */ -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp); /* returns true if a can be reduced with mp_reduce_2k */ -int mp_reduce_is_2k(mp_int *a); +int mp_reduce_is_2k(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d); /* returns true if a can be reduced with mp_reduce_2k_l */ -int mp_reduce_is_2k_l(mp_int *a); +int mp_reduce_is_2k_l(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +int mp_reduce_2k_l(mp_int *a, const mp_int *n, const mp_int *d); /* d = a**b (mod c) */ -int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* ---> Primes <--- */ @@ -464,17 +464,17 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); extern const mp_digit ltm_prime_tab[PRIME_SIZE]; /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ -int mp_prime_is_divisible(mp_int *a, int *result); +int mp_prime_is_divisible(const mp_int *a, int *result); /* performs one Fermat test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result); /* performs one Miller-Rabin test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result); /* This gives [for a given bit size] the number of trials required * such that Miller-Rabin gives a prob of failure lower than 2^-96 @@ -488,7 +488,7 @@ int mp_prime_rabin_miller_trials(int size); * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result); +int mp_prime_is_prime(const mp_int *a, int t, int *result); /* finds the next prime after the number "a" using "t" trials * of Miller-Rabin. @@ -524,26 +524,26 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style); int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat); /* ---> radix conversion <--- */ -int mp_count_bits(mp_int *a); +int mp_count_bits(const mp_int *a); -int mp_unsigned_bin_size(mp_int *a); +int mp_unsigned_bin_size(const mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b); +int mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen); -int mp_signed_bin_size(mp_int *a); +int mp_signed_bin_size(const mp_int *a); int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_signed_bin(mp_int *a, unsigned char *b); -int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin(const mp_int *a, unsigned char *b); +int mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen); int mp_read_radix(mp_int *a, const char *str, int radix); -int mp_toradix(mp_int *a, char *str, int radix); -int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen); -int mp_radix_size(mp_int *a, int radix, int *size); +int mp_toradix(const mp_int *a, char *str, int radix); +int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen); +int mp_radix_size(const mp_int *a, int radix, int *size); #ifndef LTM_NO_FILE int mp_fread(mp_int *a, int radix, FILE *stream); -int mp_fwrite(mp_int *a, int radix, FILE *stream); +int mp_fwrite(const mp_int *a, int radix, FILE *stream); #endif #define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index ee39694..087ddcd 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -55,24 +55,24 @@ extern void XFREE(void *p); #endif /* lowlevel functions, do not call! */ -int s_mp_add(mp_int *a, mp_int *b, mp_int *c); -int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); +int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) -int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int fast_s_mp_sqr(mp_int *a, mp_int *b); -int s_mp_sqr(mp_int *a, mp_int *b); -int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_karatsuba_sqr(mp_int *a, mp_int *b); -int mp_toom_sqr(mp_int *a, mp_int *b); -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c); -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); +int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int fast_s_mp_sqr(const mp_int *a, mp_int *b); +int s_mp_sqr(const mp_int *a, mp_int *b); +int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_karatsuba_sqr(const mp_int *a, mp_int *b); +int mp_toom_sqr(const mp_int *a, mp_int *b); +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c); +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho); +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; -- cgit v0.12 From e7582d10c6c53ea496551d815b3fb83bf984fd02 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Oct 2017 15:20:42 +0000 Subject: Eliminate variable which is only used once. And a minor end-of-line space reduction. No functional change. --- win/tclWinFCmd.c | 4 +--- win/tclWinLoad.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 01af950..319ecf9 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1611,13 +1611,11 @@ ConvertFileNameFormat( for (i = 0; i < pathc; i++) { Tcl_Obj *elt; char *pathv; - size_t pathLen; Tcl_ListObjIndex(NULL, splitPath, i, &elt); pathv = TclGetString(elt); - pathLen = elt->length; - if ((pathv[0] == '/') || ((pathLen == 3) && (pathv[1] == ':')) + if ((pathv[0] == '/') || ((elt->length == 3) && (pathv[1] == ':')) || (strcmp(pathv, ".") == 0) || (strcmp(pathv, "..") == 0)) { /* * Handle "/", "//machine/export", "c:/", "." or ".." by just diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 3ad6328..27eb8f3 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -85,7 +85,7 @@ TclpDlopen( Tcl_DString ds; - /* + /* * Remember the first error on load attempt to be used if the * second load attempt below also fails. */ -- cgit v0.12 From 8a910c1a53dec36b9d3dd4b7a378017251c3ef56 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 13 Oct 2017 16:15:52 +0000 Subject: Plug some memleaks. --- generic/tclDictObj.c | 2 ++ generic/tclStringObj.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index c82f88a..1c74c5f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2331,7 +2331,9 @@ DictAppendCmd( valuePtr = Tcl_DuplicateObj(valuePtr); } + Tcl_IncrRefCount(appendObjPtr); Tcl_AppendObjToObj(valuePtr, appendObjPtr); + Tcl_DecrRefCount(appendObjPtr); } Tcl_DictObjPut(NULL, dictPtr, objv[2], valuePtr); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 59758bb..7c1d42b 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3102,6 +3102,7 @@ TclStringCatObjv( /* Ugly interface! No scheme to init array size. */ objResultPtr = Tcl_NewUnicodeObj(&ch, 0); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { + Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" @@ -3149,6 +3150,7 @@ TclStringCatObjv( } else { objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { + Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %u bytes", -- cgit v0.12 From 45d0977a5ca8ae0ead48b66feeb51c65d1ce45b4 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 23 Oct 2017 17:06:57 +0000 Subject: Implementation branch for TIP 345: Kill the "identity" encoding. This checkin, completely does that. Bad news is it causes huge failures. We're still making a lot of use of this encoding, and cannot complete this TIP until the branch is repaired. --- generic/tclEncoding.c | 77 --------------------------------------------------- 1 file changed, 77 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index e328340..37d5fb6 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -195,11 +195,6 @@ static unsigned short emptyPage[256]; * Functions used only in this module. */ -static int BinaryProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); static void DupEncodingIntRep(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); static void EscapeFreeProc(ClientData clientData); static int EscapeFromUtfProc(ClientData clientData, @@ -563,14 +558,6 @@ TclInitEncodingSubsystem(void) * formed UTF-8 into a properly formed stream. */ - type.encodingName = "identity"; - type.toUtfProc = BinaryProc; - type.fromUtfProc = BinaryProc; - type.freeProc = NULL; - type.nullSize = 1; - type.clientData = NULL; - tclIdentityEncoding = Tcl_CreateEncoding(&type); - type.encodingName = "utf-8"; type.toUtfProc = UtfExtToUtfIntProc; type.fromUtfProc = UtfIntToUtfExtProc; @@ -2083,70 +2070,6 @@ LoadEscapeEncoding( /* *------------------------------------------------------------------------- * - * BinaryProc -- - * - * The default conversion when no other conversion is specified. No - * translation is done; source bytes are copied directly to destination - * bytes. - * - * Results: - * Returns TCL_OK if conversion was successful. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -BinaryProc( - ClientData clientData, /* Not used. */ - const char *src, /* Source string (unknown encoding). */ - int srcLen, /* Source string length in bytes. */ - int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ - char *dst, /* Output buffer in which converted string is - * stored. */ - int dstLen, /* The maximum length of output buffer in - * bytes. */ - int *srcReadPtr, /* Filled with the number of bytes from the - * source string that were converted. */ - int *dstWrotePtr, /* Filled with the number of bytes that were - * stored in the output buffer as a result of - * the conversion. */ - int *dstCharsPtr) /* Filled with the number of characters that - * correspond to the bytes stored in the - * output buffer. */ -{ - int result; - - result = TCL_OK; - dstLen -= TCL_UTF_MAX - 1; - if (dstLen < 0) { - dstLen = 0; - } - if ((flags & TCL_ENCODING_CHAR_LIMIT) && srcLen > *dstCharsPtr) { - srcLen = *dstCharsPtr; - } - if (srcLen > dstLen) { - srcLen = dstLen; - result = TCL_CONVERT_NOSPACE; - } - - *srcReadPtr = srcLen; - *dstWrotePtr = srcLen; - *dstCharsPtr = srcLen; - memcpy(dst, src, (size_t) srcLen); - return result; -} - -/* - *------------------------------------------------------------------------- - * * UtfExtToUtfIntProc -- * * Convert from UTF-8 to UTF-8. While converting null-bytes from the -- cgit v0.12 From 319b71965b6c3a38ef712ac4e6b58fa7dae7e6f4 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 23 Oct 2017 17:58:07 +0000 Subject: backout initial commit; need more care. Binary writes internally make use of this encoding. Need to hide it instead of destroy it. --- generic/tclEncoding.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 37d5fb6..e328340 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -195,6 +195,11 @@ static unsigned short emptyPage[256]; * Functions used only in this module. */ +static int BinaryProc(ClientData clientData, + const char *src, int srcLen, int flags, + Tcl_EncodingState *statePtr, char *dst, int dstLen, + int *srcReadPtr, int *dstWrotePtr, + int *dstCharsPtr); static void DupEncodingIntRep(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); static void EscapeFreeProc(ClientData clientData); static int EscapeFromUtfProc(ClientData clientData, @@ -558,6 +563,14 @@ TclInitEncodingSubsystem(void) * formed UTF-8 into a properly formed stream. */ + type.encodingName = "identity"; + type.toUtfProc = BinaryProc; + type.fromUtfProc = BinaryProc; + type.freeProc = NULL; + type.nullSize = 1; + type.clientData = NULL; + tclIdentityEncoding = Tcl_CreateEncoding(&type); + type.encodingName = "utf-8"; type.toUtfProc = UtfExtToUtfIntProc; type.fromUtfProc = UtfIntToUtfExtProc; @@ -2070,6 +2083,70 @@ LoadEscapeEncoding( /* *------------------------------------------------------------------------- * + * BinaryProc -- + * + * The default conversion when no other conversion is specified. No + * translation is done; source bytes are copied directly to destination + * bytes. + * + * Results: + * Returns TCL_OK if conversion was successful. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +BinaryProc( + ClientData clientData, /* Not used. */ + const char *src, /* Source string (unknown encoding). */ + int srcLen, /* Source string length in bytes. */ + int flags, /* Conversion control flags. */ + Tcl_EncodingState *statePtr,/* Place for conversion routine to store state + * information used during a piecewise + * conversion. Contents of statePtr are + * initialized and/or reset by conversion + * routine under control of flags argument. */ + char *dst, /* Output buffer in which converted string is + * stored. */ + int dstLen, /* The maximum length of output buffer in + * bytes. */ + int *srcReadPtr, /* Filled with the number of bytes from the + * source string that were converted. */ + int *dstWrotePtr, /* Filled with the number of bytes that were + * stored in the output buffer as a result of + * the conversion. */ + int *dstCharsPtr) /* Filled with the number of characters that + * correspond to the bytes stored in the + * output buffer. */ +{ + int result; + + result = TCL_OK; + dstLen -= TCL_UTF_MAX - 1; + if (dstLen < 0) { + dstLen = 0; + } + if ((flags & TCL_ENCODING_CHAR_LIMIT) && srcLen > *dstCharsPtr) { + srcLen = *dstCharsPtr; + } + if (srcLen > dstLen) { + srcLen = dstLen; + result = TCL_CONVERT_NOSPACE; + } + + *srcReadPtr = srcLen; + *dstWrotePtr = srcLen; + *dstCharsPtr = srcLen; + memcpy(dst, src, (size_t) srcLen); + return result; +} + +/* + *------------------------------------------------------------------------- + * * UtfExtToUtfIntProc -- * * Convert from UTF-8 to UTF-8. While converting null-bytes from the -- cgit v0.12 From fada61905269aa299f85ae2a25a2786b6cbe4053 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 24 Oct 2017 08:38:17 +0000 Subject: [fc1409fc91]: TclOO method with non-literal value for body argument causes segmentation fault --- generic/tclOOMethod.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 9c49caa..e8fad82 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -1314,6 +1314,7 @@ CloneProcedureMethod( */ bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr); + Tcl_GetString(bodyObj); TclFreeIntRep(bodyObj); /* -- cgit v0.12 From 8e537759cf8215fe82bd51ca374f580d8b2c4a99 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 24 Oct 2017 11:23:54 +0000 Subject: Added test case. --- tests/oo.test | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/oo.test b/tests/oo.test index b538b60..2a6eb80 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2048,6 +2048,17 @@ test oo-15.14 {OO: object cloning with target NS} -setup { } -cleanup { Cls destroy } -result {{} ::dupens::test-15.14} +test oo-15.15 {method cloning must ensure that there is a string representation of bodies} -setup { + oo::class create cls +} -body { + cls create foo + oo::objdefine foo { + method m1 {} [string map {a b} {return hello}] + } + [oo::copy foo] m1 +} -cleanup { + cls destroy +} -result hello test oo-16.1 {OO: object introspection} -body { info object -- cgit v0.12 From d5f679a3f608fabb7954ae203eff8f37b2e1747b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 24 Oct 2017 13:56:26 +0000 Subject: Change (internal) refCount field from TclRegexp to type size_t: this allows more references on 64-bit platforms. Remove unused macro "xxx" in regguts.h. Remove superflouous eol-space in oo.test. --- generic/regguts.h | 1 - generic/tclRegexp.h | 2 +- tests/oo.test | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/generic/regguts.h b/generic/regguts.h index ad9d5b9..b3dbaa4 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -70,7 +70,6 @@ */ #define NOTREACHED 0 -#define xxx 1 #define DUPMAX _POSIX2_RE_DUP_MAX #define DUPINF (DUPMAX+1) diff --git a/generic/tclRegexp.h b/generic/tclRegexp.h index eac0aaa..a263dfd 100644 --- a/generic/tclRegexp.h +++ b/generic/tclRegexp.h @@ -37,7 +37,7 @@ typedef struct TclRegexp { * of subexpressions. */ rm_detail_t details; /* Detailed information on match (currently * used only for REG_EXPECT). */ - unsigned int refCount; /* Count of number of references to this + size_t refCount; /* Count of number of references to this * compiled regexp. */ } TclRegexp; diff --git a/tests/oo.test b/tests/oo.test index 2a6eb80..54c4b75 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2053,7 +2053,7 @@ test oo-15.15 {method cloning must ensure that there is a string representation } -body { cls create foo oo::objdefine foo { - method m1 {} [string map {a b} {return hello}] + method m1 {} [string map {a b} {return hello}] } [oo::copy foo] m1 } -cleanup { -- cgit v0.12 From 1552384787fef03116569d8281bc0a69a02d6e3f Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 24 Oct 2017 23:16:23 +0000 Subject: Extend Tcl_CreateEncoding() to be able to create an encoding without registering it when it has no name. Then use this to create "identity" encoding without naming it "identity". Then no one can look it up by that name. --- generic/tclEncoding.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index e328340..f43c0e1 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -563,7 +563,7 @@ TclInitEncodingSubsystem(void) * formed UTF-8 into a properly formed stream. */ - type.encodingName = "identity"; + type.encodingName = NULL; type.toUtfProc = BinaryProc; type.fromUtfProc = BinaryProc; type.freeProc = NULL; @@ -851,7 +851,9 @@ FreeEncoding( if (encodingPtr->hPtr != NULL) { Tcl_DeleteHashEntry(encodingPtr->hPtr); } - ckfree(encodingPtr->name); + if (encodingPtr->name) { + ckfree(encodingPtr->name); + } ckfree(encodingPtr); } } @@ -1040,9 +1042,24 @@ Tcl_CreateEncoding( const Tcl_EncodingType *typePtr) /* The encoding type. */ { + Encoding *encodingPtr = ckalloc(sizeof(Encoding)); + encodingPtr->name = NULL; + encodingPtr->toUtfProc = typePtr->toUtfProc; + encodingPtr->fromUtfProc = typePtr->fromUtfProc; + encodingPtr->freeProc = typePtr->freeProc; + encodingPtr->nullSize = typePtr->nullSize; + encodingPtr->clientData = typePtr->clientData; + if (typePtr->nullSize == 1) { + encodingPtr->lengthProc = (LengthProc *) strlen; + } else { + encodingPtr->lengthProc = (LengthProc *) unilen; + } + encodingPtr->refCount = 1; + encodingPtr->hPtr = NULL; + + if (typePtr->encodingName) { Tcl_HashEntry *hPtr; int isNew; - Encoding *encodingPtr; char *name; Tcl_MutexLock(&encodingMutex); @@ -1058,25 +1075,12 @@ Tcl_CreateEncoding( } name = ckalloc(strlen(typePtr->encodingName) + 1); - - encodingPtr = ckalloc(sizeof(Encoding)); encodingPtr->name = strcpy(name, typePtr->encodingName); - encodingPtr->toUtfProc = typePtr->toUtfProc; - encodingPtr->fromUtfProc = typePtr->fromUtfProc; - encodingPtr->freeProc = typePtr->freeProc; - encodingPtr->nullSize = typePtr->nullSize; - encodingPtr->clientData = typePtr->clientData; - if (typePtr->nullSize == 1) { - encodingPtr->lengthProc = (LengthProc *) strlen; - } else { - encodingPtr->lengthProc = (LengthProc *) unilen; - } - encodingPtr->refCount = 1; encodingPtr->hPtr = hPtr; Tcl_SetHashValue(hPtr, encodingPtr); Tcl_MutexUnlock(&encodingMutex); - + } return (Tcl_Encoding) encodingPtr; } -- cgit v0.12 From 40d9b81e23c10ebc3abfe4ac12af411d01318fb9 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 24 Oct 2017 23:30:35 +0000 Subject: Stop using "identity" as an encoding to test basic functionng of the [encoding] command. "iso8859-1" is another one always available. --- tests/cmdAH.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 3c58c1b..03f4d66 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -188,7 +188,7 @@ test cmdAH-4.5 {Tcl_EncodingObjCmd} -setup { test cmdAH-4.6 {Tcl_EncodingObjCmd} -setup { set system [encoding system] } -body { - encoding system identity + encoding system iso8859-1 encoding convertto jis0208 \u4e4e } -cleanup { encoding system $system @@ -210,7 +210,7 @@ test cmdAH-4.9 {Tcl_EncodingObjCmd} -setup { test cmdAH-4.10 {Tcl_EncodingObjCmd} -setup { set system [encoding system] } -body { - encoding system identity + encoding system iso8859-1 encoding convertfrom jis0208 8C } -cleanup { encoding system $system @@ -224,11 +224,11 @@ test cmdAH-4.12 {Tcl_EncodingObjCmd} -returnCodes error -body { test cmdAH-4.13 {Tcl_EncodingObjCmd} -setup { set system [encoding system] } -body { - encoding system identity + encoding system iso8859-1 encoding system } -cleanup { encoding system $system -} -result identity +} -result iso8859-1 test cmdAH-5.1 {Tcl_FileObjCmd} -returnCodes error -body { file -- cgit v0.12 From eb2cfa3e6f2fc11362ae54a2004ade43a57c86de Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 25 Oct 2017 02:23:12 +0000 Subject: Repair Tcl_CreateEncoding(); Modernize [testencoding]; Update most tests toying with identity encoding. --- generic/tclEncoding.c | 4 ++-- generic/tclTest.c | 9 ++++++--- tests/encoding.test | 12 ++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index f43c0e1..1f48a1c 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1070,8 +1070,8 @@ Tcl_CreateEncoding( * reference goes away. */ - encodingPtr = Tcl_GetHashValue(hPtr); - encodingPtr->hPtr = NULL; + Encoding *replaceMe = Tcl_GetHashValue(hPtr); + replaceMe->hPtr = NULL; } name = ckalloc(strlen(typePtr->encodingName) + 1); diff --git a/generic/tclTest.c b/generic/tclTest.c index ebd90ae..c455d42 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1985,9 +1985,12 @@ TestencodingObjCmd( if (objc != 3) { return TCL_ERROR; } - encoding = Tcl_GetEncoding(NULL, Tcl_GetString(objv[2])); - Tcl_FreeEncoding(encoding); - Tcl_FreeEncoding(encoding); + if (TCL_OK != Tcl_GetEncodingFromObj(interp, objv[2], &encoding)) { + return TCL_ERROR; + } + Tcl_FreeEncoding(encoding); /* Free returned reference */ + Tcl_FreeEncoding(encoding); /* Free to match CREATE */ + TclFreeIntRep(objv[2]); /* Free the cached ref */ break; } return TCL_OK; diff --git a/tests/encoding.test b/tests/encoding.test index be1f4d5..0ee08b6 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -75,11 +75,11 @@ test encoding-2.2 {Tcl_FreeEncoding: refcount != 0} -setup { encoding system shiftjis ;# incr ref count encoding dirs [list [pwd]] set x [encoding convertto shiftjis \u4e4e] ;# old one found - encoding system identity + encoding system iso8859-1 llength shiftjis ;# Shimmer away any cache of Tcl_Encoding lappend x [catch {encoding convertto shiftjis \u4e4e} msg] $msg } -cleanup { - encoding system identity + encoding system iso8859-1 encoding dirs $path encoding system $system } -result "\u008c\u00c1 1 {unknown encoding \"shiftjis\"}" @@ -136,7 +136,7 @@ test encoding-5.1 {Tcl_SetSystemEncoding} -setup { encoding system jis0208 encoding convertto \u4e4e } -cleanup { - encoding system identity + encoding system iso8859-1 encoding system $old } -result {8C} test encoding-5.2 {Tcl_SetSystemEncoding: test ref count} { @@ -259,7 +259,7 @@ test encoding-11.5.1 {LoadEncodingFile: escape file} { test encoding-11.6 {LoadEncodingFile: invalid file} -constraints {testencoding} -setup { set system [encoding system] set path [encoding dirs] - encoding system identity + encoding system iso8859-1 } -body { cd [temporaryDirectory] encoding dirs [file join tmp encoding] @@ -308,10 +308,6 @@ test encoding-13.1 {LoadEscapeTable} { viewable [set x [encoding convertto iso2022 ab\u4e4e\u68d9g]] } [viewable "ab\x1b\$B8C\x1b\$\(DD%\x1b(Bg"] -test encoding-14.1 {BinaryProc} { - encoding convertto identity \x12\x34\x56\xff\x69 -} "\x12\x34\x56\xc3\xbf\x69" - test encoding-15.1 {UtfToUtfProc} { encoding convertto utf-8 \xa3 } "\xc2\xa3" -- cgit v0.12 From 30c6827ee17807b25e79676f049f66877bf3d4ff Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 25 Oct 2017 02:54:24 +0000 Subject: Convert remaining tests to use [testbytestring]. encoding-15.3 still needs replacement for [encoding convertto identity]. That is, some testing command to expose objPtr->bytes. --- tests/encoding.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/encoding.test b/tests/encoding.test index 0ee08b6..11f08ef 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -34,6 +34,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] +testConstraint testbytestring [llength [info commands testbytestring]] testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] testConstraint exec [llength [info commands exec]] testConstraint testgetencpath [llength [info commands testgetencpath]] @@ -311,15 +312,14 @@ test encoding-13.1 {LoadEscapeTable} { test encoding-15.1 {UtfToUtfProc} { encoding convertto utf-8 \xa3 } "\xc2\xa3" -test encoding-15.2 {UtfToUtfProc null character output} { +test encoding-15.2 {UtfToUtfProc null character output} testbytestring { set x \u0000 - set y [encoding convertto utf-8 \u0000] - set y [encoding convertfrom identity $y] + set y [testbytestring [encoding convertto utf-8 \u0000]] binary scan $y H* z list [string bytelength $x] [string bytelength $y] $z } {2 1 00} -test encoding-15.3 {UtfToUtfProc null character input} { - set x [encoding convertfrom identity \x00] +test encoding-15.3 {UtfToUtfProc null character input} testbytestring { + set x [testbytestring \x00] set y [encoding convertfrom utf-8 $x] binary scan [encoding convertto identity $y] H* z list [string bytelength $x] [string bytelength $y] $z -- cgit v0.12 From 053a74e0facac37a830c2c317c90d11bc13e5264 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 26 Oct 2017 02:08:27 +0000 Subject: Create new testing command [teststringbytes] to probe the things that otherwise require [encoding convertto identity]. adapt encoding-15.3 to use. --- generic/tclTest.c | 38 ++++++++++++++++++++++++++++++++++++++ tests/encoding.test | 20 +++++++++----------- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index c455d42..834cd79 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -227,6 +227,9 @@ static int TestasyncCmd(ClientData dummy, static int TestbytestringObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int TeststringbytesObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); static int TestcmdinfoCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); static int TestcmdtokenCmd(ClientData dummy, @@ -581,6 +584,7 @@ Tcltest_Init( Tcl_CreateCommand(interp, "noop", NoopCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "noop", NoopObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testbytestring", TestbytestringObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "teststringbytes", TeststringbytesObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testwrongnumargs", TestWrongNumArgsObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testfilesystem", TestFilesystemObjCmd, @@ -5049,6 +5053,40 @@ NoopObjCmd( /* *---------------------------------------------------------------------- * + * TeststringbytesObjCmd -- + * Returns bytearray value of the bytes in argument string rep + * + * Results: + * Returns the TCL_OK result code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TeststringbytesObjCmd( + ClientData unused, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* The argument objects. */ +{ + int n; + const unsigned char *p; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "value"); + return TCL_ERROR; + } + p = (const unsigned char *)Tcl_GetStringFromObj(objv[1], &n); + Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(p, n)); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * TestbytestringObjCmd -- * * This object-based procedure constructs a string which can diff --git a/tests/encoding.test b/tests/encoding.test index 11f08ef..e447c20 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -35,6 +35,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] testConstraint testbytestring [llength [info commands testbytestring]] +testConstraint teststringbytes [llength [info commands teststringbytes]] testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] testConstraint exec [llength [info commands exec]] testConstraint testgetencpath [llength [info commands testgetencpath]] @@ -313,17 +314,14 @@ test encoding-15.1 {UtfToUtfProc} { encoding convertto utf-8 \xa3 } "\xc2\xa3" test encoding-15.2 {UtfToUtfProc null character output} testbytestring { - set x \u0000 - set y [testbytestring [encoding convertto utf-8 \u0000]] - binary scan $y H* z - list [string bytelength $x] [string bytelength $y] $z -} {2 1 00} -test encoding-15.3 {UtfToUtfProc null character input} testbytestring { - set x [testbytestring \x00] - set y [encoding convertfrom utf-8 $x] - binary scan [encoding convertto identity $y] H* z - list [string bytelength $x] [string bytelength $y] $z -} {1 2 c080} + binary scan [testbytestring [encoding convertto utf-8 \u0000]] H* z + set z +} 00 +test encoding-15.3 {UtfToUtfProc null character input} teststringbytes { + set y [encoding convertfrom utf-8 [encoding convertto utf-8 \u0000]] + binary scan [teststringbytes $y] H* z + set z +} c080 test encoding-16.1 {UnicodeToUtfProc} { set val [encoding convertfrom unicode NN] -- cgit v0.12 From fa2e7e8949ad5728da4d3dfdd796a4f7e3e0e811 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Oct 2017 07:26:15 +0000 Subject: =?UTF-8?q?Fix=20timeout=20calculation=20in=20epoll-based=20notifi?= =?UTF-8?q?er.=20Proposed=20fix=20for=20[1a6a36d901dedead248ea96df09d5dc15?= =?UTF-8?q?9532652|1a6a36d901].=20Patch=20by=20Lucio=20Andr=C3=A9s=20Illan?= =?UTF-8?q?es=20Albornoz.=20Thanks!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unix/tclEpollNotfy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 088f314..9d0053c 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -462,7 +462,10 @@ PlatformEventsWait( } else if (!timePtr->tv_sec && !timePtr->tv_usec) { timeout = 0; } else { - timeout = (int)timePtr->tv_sec; + timeout = (int)timePtr->tv_sec * 1000; + if (timePtr->tv_usec) { + timeout += (int)timePtr->tv_usec / 1000; + } } /* -- cgit v0.12 From a79bc3c8ce1f7c5fc723d0ab7e256cb9090433a8 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 30 Oct 2017 05:19:55 +0000 Subject: Fix for issue 9fd5c629c1, TclOO - aborts when a trace on command deletion deletes the object's namespace. --- generic/tclBasic.c | 8 ++++---- generic/tclFileName.c | 2 +- generic/tclOO.c | 35 ++++++++++++++++++++++++++--------- generic/tclOOCall.c | 8 ++++---- generic/tclOOInt.h | 16 ++++++++-------- tests/oo.test | 12 ++++++++++++ 6 files changed, 55 insertions(+), 26 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index d4fa833..e6022ac 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3112,7 +3112,7 @@ Tcl_DeleteCommandFromToken( /* * We must delete this command, even though both traces and delete procs * may try to avoid this (renaming the command etc). Also traces and - * delete procs may try to delete the command themsevles. This flag + * delete procs may try to delete the command themselves. This flag * declares that a delete is in progress and that recursive deletes should * be ignored. */ @@ -7722,8 +7722,8 @@ ExprRandFunc( iPtr->flags |= RAND_SEED_INITIALIZED; /* - * Take into consideration the thread this interp is running in order - * to insure different seeds in different threads (bug #416643) + * To ensure different seeds in different threads (bug #416643), + * take into consideration the thread this interp is running in. */ iPtr->randSeed = TclpGetClicks() + (PTR2INT(Tcl_GetCurrentThread())<<12); @@ -9091,7 +9091,7 @@ TclNRCoroutineObjCmd( TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr, NULL, NULL, NULL); - /* insure that the command is looked up in the correct namespace */ + /* ensure that the command is looked up in the correct namespace */ iPtr->lookupNsPtr = lookupNsPtr; Tcl_NREvalObj(interp, Tcl_NewListObj(objc-2, objv+2), 0); iPtr->numLevels--; diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 150fb8c..15fcde7 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1904,7 +1904,7 @@ TclGlob( } /* - * To process a [glob] invokation, this function may be called multiple + * To process a [glob] invocation, this function may be called multiple * times. Each time, the previously discovered filenames are in the * interpreter result. We stash that away here so the result is free for * error messsages. diff --git a/generic/tclOO.c b/generic/tclOO.c index 73acce8..e9ef2ce 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -880,7 +880,7 @@ ObjectRenamedTrace( * 2950259] */ - if (((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) { + if (oPtr->namespacePtr && ((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) { Tcl_DeleteNamespace(oPtr->namespacePtr); } if (oPtr->classPtr) { @@ -1168,7 +1168,7 @@ ObjectNamespaceDeleted( Class *clsPtr = oPtr->classPtr, *mixinPtr; Method *mPtr; Tcl_Obj *filterObj, *variableObj; - int i; + int deleteAlreadyInProgress = 0, i; /* * Instruct everyone to no longer use any allocated fields of the object. @@ -1178,6 +1178,14 @@ ObjectNamespaceDeleted( */ if (oPtr->command) { + if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { + /* + * Namespace deletion must have been triggered by a trace on command + * deletion , meaning that + */ + deleteAlreadyInProgress = 1; + } + Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command); } if (oPtr->myCommand) { @@ -1273,14 +1281,17 @@ ObjectNamespaceDeleted( if (clsPtr->subclasses.list) { ckfree(clsPtr->subclasses.list); + clsPtr->subclasses.list = NULL; clsPtr->subclasses.num = 0; } if (clsPtr->instances.list) { ckfree(clsPtr->instances.list); + clsPtr->instances.list = NULL; clsPtr->instances.num = 0; } if (clsPtr->mixinSubs.list) { ckfree(clsPtr->mixinSubs.list); + clsPtr->mixinSubs.list = NULL; clsPtr->mixinSubs.num = 0; } @@ -1305,7 +1316,13 @@ ObjectNamespaceDeleted( * Delete the object structure itself. */ - DelRef(oPtr); + if (deleteAlreadyInProgress) { + oPtr->classPtr = NULL; + oPtr->namespacePtr = NULL; + } else { + DelRef(oPtr); + } + } /* @@ -2433,7 +2450,7 @@ Tcl_ObjectSetMetadata( * * PublicObjectCmd, PrivateObjectCmd, TclOOInvokeObject -- * - * Main entry point for object invokations. The Public* and Private* + * Main entry point for object invocations. The Public* and Private* * wrapper functions (implementations of both object instance commands * and [my]) are just thin wrappers round the main TclOOObjectCmdCore * function. Note that the core is function is NRE-aware. @@ -2518,8 +2535,8 @@ TclOOInvokeObject( * * TclOOObjectCmdCore, FinalizeObjectCall -- * - * Main function for object invokations. Does call chain creation, - * management and invokation. The function FinalizeObjectCall exists to + * Main function for object invocations. Does call chain creation, + * management and invocation. The function FinalizeObjectCall exists to * clean up after the non-recursive processing of TclOOObjectCmdCore. * * ---------------------------------------------------------------------- @@ -2531,7 +2548,7 @@ TclOOObjectCmdCore( Tcl_Interp *interp, /* The interpreter containing the object. */ int objc, /* How many arguments are being passed in. */ Tcl_Obj *const *objv, /* The array of arguments. */ - int flags, /* Whether this is an invokation through the + int flags, /* Whether this is an invocation through the * public or the private command interface. */ Class *startCls) /* Where to start in the call chain, or NULL * if we are to start at the front with @@ -2720,7 +2737,7 @@ Tcl_ObjectContextInvokeNext( * call context while we process the body. However, need to adjust the * argument-skip control because we're guaranteed to have a single prefix * arg (i.e., 'next') and not the variable amount that can happen because - * method invokations (i.e., '$obj meth' and 'my meth'), constructors + * method invocations (i.e., '$obj meth' and 'my meth'), constructors * (i.e., '$cls new' and '$cls create obj') and destructors (no args at * all) come through the same code. */ @@ -2789,7 +2806,7 @@ TclNRObjectContextInvokeNext( * call context while we process the body. However, need to adjust the * argument-skip control because we're guaranteed to have a single prefix * arg (i.e., 'next') and not the variable amount that can happen because - * method invokations (i.e., '$obj meth' and 'my meth'), constructors + * method invocations (i.e., '$obj meth' and 'my meth'), constructors * (i.e., '$cls new' and '$cls create obj') and destructors (no args at * all) come through the same code. */ diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 3e4f561..d4e1e34 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -233,7 +233,7 @@ FreeMethodNameRep( * TclOOInvokeContext -- * * Invokes a single step along a method call-chain context. Note that the - * invokation of a step along the chain can cause further steps along the + * invocation of a step along the chain can cause further steps along the * chain to be invoked. Note that this function is written to be as light * in stack usage as possible. * @@ -830,7 +830,7 @@ AddMethodToCallChain( * Call chain semantics states that methods come as *late* in the * call chain as possible. This is done by copying down the * following methods. Note that this does not change the number of - * method invokations in the call chain; it just rearranges them. + * method invocations in the call chain; it just rearranges them. */ Class *declCls = callPtr->chain[i].filterDeclarer; @@ -935,7 +935,7 @@ IsStillValid( * TclOOGetCallContext -- * * Responsible for constructing the call context, an ordered list of all - * method implementations to be called as part of a method invokation. + * method implementations to be called as part of a method invocation. * This method is central to the whole operation of the OO system. * * ---------------------------------------------------------------------- @@ -1517,7 +1517,7 @@ TclOORenderCallChain( /* * Do the actual construction of the descriptions. They consist of a list * of triples that describe the details of how a method is understood. For - * each triple, the first word is the type of invokation ("method" is + * each triple, the first word is the type of invocation ("method" is * normal, "unknown" is special because it adds the method name as an * extra argument when handled by some method types, and "filter" is * special because it's a filter method). The second word is the name of diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 476446d..11ba698 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -149,8 +149,8 @@ typedef struct Object { struct Foundation *fPtr; /* The basis for the object system. Putting * this here allows the avoidance of quite a * lot of hash lookups on the critical path - * for object invokation and creation. */ - Tcl_Namespace *namespacePtr;/* This object's tame namespace. */ + * for object invocation and creation. */ + Tcl_Namespace *namespacePtr;/* This object's namespace. */ Tcl_Command command; /* Reference to this object's public * command. */ Tcl_Command myCommand; /* Reference to this object's internal @@ -162,12 +162,12 @@ typedef struct Object { /* Classes mixed into this object. */ LIST_STATIC(Tcl_Obj *) filters; /* List of filter names. */ - struct Class *classPtr; /* All classes have this non-NULL; it points - * to the class structure. Everything else has - * this NULL. */ + struct Class *classPtr; /* This is non-NULL for all classes, and NULL + * for everything else. It points to the class + * structure. */ int refCount; /* Number of strong references to this object. * Note that there may be many more weak - * references; this mechanism is there to + * references; this mechanism exists to * avoid Tcl_Preserve. */ int flags; int creationEpoch; /* Unique value to make comparisons of objects @@ -323,7 +323,7 @@ typedef struct Foundation { } Foundation; /* - * A call context structure is built when a method is called. They contain the + * A call context structure is built when a method is called. It contains the * chain of method implementations that are to be invoked by a particular * call, and the process of calling walks the chain, with the [next] command * proceeding to the next entry in the chain. @@ -334,7 +334,7 @@ typedef struct Foundation { struct MInvoke { Method *mPtr; /* Reference to the method implementation * record. */ - int isFilter; /* Whether this is a filter invokation. */ + int isFilter; /* Whether this is a filter invocation. */ Class *filterDeclarer; /* What class decided to add the filter; if * NULL, it was added by the object. */ }; diff --git a/tests/oo.test b/tests/oo.test index 2a6eb80..6268dc6 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1482,6 +1482,18 @@ test oo-11.4 {OO: cleanup} { lappend result [bar0 destroy] [oo::object create foo] [foo destroy] \ [oo::object create bar2] [bar2 destroy] } {1 {can't create object "foo": command already exists with that name} destroyed {} ::foo {} ::bar2 {}} +test oo-11.5 {OO: cleanup} { + oo::class create obj1 + + trace add command obj1 delete {apply {{name1 name2 action} { + set namespace [info object namespace $name1] + namespace delete $namespace + }}} + + rename obj1 {} + # No segmentation fault + return done +} done test oo-12.1 {OO: filters} { oo::class create Aclass -- cgit v0.12 From 8bb421f959a1a5cb8a552a423341b4a7896b042c Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 1 Nov 2017 21:05:32 +0000 Subject: Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one of its instances. --- generic/tclOO.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index e9ef2ce..51731d3 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1006,8 +1006,18 @@ ReleaseClassContents( } for(j=0 ; jmixins.num ; j++) { Class *mixin = instancePtr->mixins.list[j]; + Class *nextMixin = NULL; if (mixin == clsPtr) { - instancePtr->mixins.list[j] = NULL; + if (j < instancePtr->mixins.num - 1) { + nextMixin = instancePtr->mixins.list[j+1]; + } + if (j == 0) { + instancePtr->mixins.num = 0; + instancePtr->mixins.list = NULL; + } else { + instancePtr->mixins.list[j-1] = nextMixin; + } + instancePtr->mixins.num -= 1; } } if (instancePtr != NULL && !IsRoot(instancePtr)) { @@ -1181,7 +1191,8 @@ ObjectNamespaceDeleted( if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { /* * Namespace deletion must have been triggered by a trace on command - * deletion , meaning that + * deletion , meaning that ObjectRenamedTrace() is eventually going + * to be called . */ deleteAlreadyInProgress = 1; } -- cgit v0.12 From d33ee7bc07e1c461c4292dfe866e2400f2536367 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 1 Nov 2017 22:21:50 +0000 Subject: Unit test for issue 3c32a3f8bd, Segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one of its instances. --- tests/oo.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/oo.test b/tests/oo.test index 6413094..b6af1ee 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1495,6 +1495,24 @@ test oo-11.5 {OO: cleanup} { return done } done +test oo-11.6 { + OO: cleanup ReleaseClassContents() where class is mixed into one of its + instances +} { + oo::class create obj1 + ::oo::define obj1 {self mixin [self]} + + ::oo::copy obj1 obj2 + ::oo::objdefine obj2 {mixin [self]} + + ::oo::copy obj2 obj3 + trace add command obj3 delete [list obj3 dying] + rename obj2 {} + + # No segmentation fault + return done +} done + test oo-12.1 {OO: filters} { oo::class create Aclass Aclass create Aobject -- cgit v0.12 From 0480b5d79b11a26b00e355bc15655e9cfabdbeb9 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 3 Nov 2017 17:02:49 +0000 Subject: Revise a few stray packages not yet ready to tolerate a Tcl 9 bump. --- library/opt/optparse.tcl | 4 ++-- library/opt/pkgIndex.tcl | 4 ++-- library/tcltest/pkgIndex.tcl | 4 ++-- library/tcltest/tcltest.tcl | 2 +- unix/Makefile.in | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/library/opt/optparse.tcl b/library/opt/optparse.tcl index 869a2b6..e5ce052 100644 --- a/library/opt/optparse.tcl +++ b/library/opt/optparse.tcl @@ -8,10 +8,10 @@ # on it. If your code does rely on this package you # may directly incorporate this code into your application. -package require Tcl 8.2 +package require Tcl 8.2- # When this version number changes, update the pkgIndex.tcl file # and the install directory in the Makefiles. -package provide opt 0.4.6 +package provide opt 0.4.7 namespace eval ::tcl { diff --git a/library/opt/pkgIndex.tcl b/library/opt/pkgIndex.tcl index 107d4c6..d6ecdd6 100644 --- a/library/opt/pkgIndex.tcl +++ b/library/opt/pkgIndex.tcl @@ -8,5 +8,5 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -if {![package vsatisfies [package provide Tcl] 8.2]} {return} -package ifneeded opt 0.4.6 [list source [file join $dir optparse.tcl]] +if {![package vsatisfies [package provide Tcl] 8.2-]} {return} +package ifneeded opt 0.4.7 [list source [file join $dir optparse.tcl]] diff --git a/library/tcltest/pkgIndex.tcl b/library/tcltest/pkgIndex.tcl index 5ac8823..eadb1bd 100644 --- a/library/tcltest/pkgIndex.tcl +++ b/library/tcltest/pkgIndex.tcl @@ -8,5 +8,5 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -if {![package vsatisfies [package provide Tcl] 8.5]} {return} -package ifneeded tcltest 2.4.0 [list source [file join $dir tcltest.tcl]] +if {![package vsatisfies [package provide Tcl] 8.5-]} {return} +package ifneeded tcltest 2.4.1 [list source [file join $dir tcltest.tcl]] diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 75975d2..f1b6082 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -22,7 +22,7 @@ namespace eval tcltest { # When the version number changes, be sure to update the pkgIndex.tcl file, # and the install directory in the Makefiles. When the minor version # changes (new feature) be sure to update the man page as well. - variable Version 2.4.0 + variable Version 2.4.1 # Compatibility support for dumb variables defined in tcltest 1 # Do not use these. Call [package provide Tcl] and [info patchlevel] diff --git a/unix/Makefile.in b/unix/Makefile.in index c31d128..032b5ac 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -857,8 +857,8 @@ install-libraries: libraries done; @echo "Installing package msgcat 1.6.1 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.1.tm; - @echo "Installing package tcltest 2.4.0 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.0.tm; + @echo "Installing package tcltest 2.4.1 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.14.tm; -- cgit v0.12 From e4356f7d64ab9d2c871b3015e10ecf3955d7f539 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 4 Nov 2017 00:25:43 +0000 Subject: Detected bug in [string first] with unicode. Pat Thoyts found it. --- tests/string.test | 16 +++++++++++++--- tests/stringObj.test | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/string.test b/tests/string.test index 549944d..cb901b9 100644 --- a/tests/string.test +++ b/tests/string.test @@ -28,6 +28,11 @@ testConstraint testindexobj [expr {[info commands testindexobj] != {}}] # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] +proc representationpoke s { + set r [::tcl::unsupported::representation $s] + list [lindex $r 3] [string match {*, string representation "*"} $r] +} + test string-1.1 {error conditions} { list [catch {string gorp a b} msg] $msg } {1 {unknown or ambiguous subcommand "gorp": must be bytelength, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}} @@ -224,6 +229,13 @@ test string-4.15 {string first, ability to two-byte encoded utf-8 chars} { set uchar \u057e ;# character with two-byte encoding in utf-8 string first % %#$uchar$uchar#$uchar$uchar#% 3 } 8 +test string-4.16 {string first, normal string vs pure unicode string} { + set s hello + regexp ll $s m + # Representation checks are canaries + list [representationpoke $s] [representationpoke $m] \ + [string first $m $s] +} {{string 1} {string 0} 2} test string-5.1 {string index} { list [catch {string index} msg] $msg @@ -2042,9 +2054,7 @@ test string-29.15 {string cat, efficiency} -setup { } -body { tcl::unsupported::representation [string cat $e $f $e $f [list x]] } -match glob -result {*no string representation} - - - + # cleanup rename MemStress {} catch {rename foo {}} diff --git a/tests/stringObj.test b/tests/stringObj.test index 49f268e..a78b5f8 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -480,7 +480,6 @@ test stringObj-15.8 {Tcl_Append*ToObj: self appends} testobj { teststringobj set 1 foo teststringobj appendself2 1 3 } foo - if {[testConstraint testobj]} { testobj freeallvars @@ -489,3 +488,7 @@ if {[testConstraint testobj]} { # cleanup ::tcltest::cleanupTests return + +# Local Variables: +# mode: tcl +# End: -- cgit v0.12 From b55d5cc57eba5295979ff84c7256c577f2a24cc8 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 4 Nov 2017 00:34:48 +0000 Subject: Fix for the weird [string first] behaviour. --- generic/tclStringObj.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7c1d42b..3a35bcf 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3242,40 +3242,44 @@ TclStringFind( return -1; } + /* + * Check if we have two strings of single-byte characters. If we have, we + * can use strstr() to do the search. Note that we can sometimes have + * multibyte characters when the string could be minimally represented + * using single byte characters; we can't assume that a mismatch here + * means no match. + */ + lh = Tcl_GetCharLength(haystack); - if (haystack->bytes && (lh == haystack->length)) { - /* haystack is all single-byte chars */ + if (haystack->bytes && (lh == haystack->length) && needle->bytes + && (ln == needle->length)) { + /* + * Both haystack and needle are all single-byte chars. + */ - if (needle->bytes && (ln == needle->length)) { - /* needle is also all single-byte chars */ - char *found = strstr(haystack->bytes + start, needle->bytes); + char *found = strstr(haystack->bytes + start, needle->bytes); - if (found) { - return (found - haystack->bytes); - } else { - return -1; - } + if (found) { + return (found - haystack->bytes); } else { - /* - * Cannot find substring with a multi-byte char inside - * a string with no multi-byte chars. - */ return -1; } } else { + /* + * Do the search on the unicode representation for simplicity. + */ + Tcl_UniChar *try, *end, *uh; Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); uh = Tcl_GetUnicodeFromObj(haystack, &lh); end = uh + lh; - try = uh + start; - while (try + ln <= end) { - if ((*try == *un) - && (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { + for (try = uh + start; try + ln <= end; try++) { + if ((*try == *un) && (0 == + memcmp(try + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) { return (try - uh); } - try++; } return -1; } -- cgit v0.12 From ded2a799663066ed98c0a0b07d5fc5a661f988d8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 5 Nov 2017 14:14:23 +0000 Subject: update .project file with branch name. Make clear that optparse doesnt work with 8.4 any more --- .project | 2 +- library/opt/optparse.tcl | 2 +- library/opt/pkgIndex.tcl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.project b/.project index a9d6ecf..eddd834 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - tcl8.7 + tcl8 diff --git a/library/opt/optparse.tcl b/library/opt/optparse.tcl index e5ce052..c8946fd 100644 --- a/library/opt/optparse.tcl +++ b/library/opt/optparse.tcl @@ -8,7 +8,7 @@ # on it. If your code does rely on this package you # may directly incorporate this code into your application. -package require Tcl 8.2- +package require Tcl 8.5- # When this version number changes, update the pkgIndex.tcl file # and the install directory in the Makefiles. package provide opt 0.4.7 diff --git a/library/opt/pkgIndex.tcl b/library/opt/pkgIndex.tcl index d6ecdd6..daf9aa9 100644 --- a/library/opt/pkgIndex.tcl +++ b/library/opt/pkgIndex.tcl @@ -8,5 +8,5 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -if {![package vsatisfies [package provide Tcl] 8.2-]} {return} +if {![package vsatisfies [package provide Tcl] 8.5-]} {return} package ifneeded opt 0.4.7 [list source [file join $dir optparse.tcl]] -- cgit v0.12 From c06751fdf8ec42ead80c501c199817370fbef853 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 6 Nov 2017 14:46:49 +0000 Subject: Fix version number of Windows Help file (not sure if it's actually used, but better safe than sorry) --- win/tcl.hpj.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/tcl.hpj.in b/win/tcl.hpj.in index a94cea6..08d411d 100644 --- a/win/tcl.hpj.in +++ b/win/tcl.hpj.in @@ -5,9 +5,9 @@ HCW=0 LCID=0x409 0x0 0x0 ;English (United States) REPORT=Yes TITLE=Tcl/Tk Reference Manual -CNT=tcl86.cnt +CNT=tcl87.cnt COPYRIGHT=Copyright © 2000 Ajuba Solutions -HLP=tcl86.hlp +HLP=tcl87.hlp [FILES] tcl.rtf -- cgit v0.12 From 45808db8dcbdfbee40971863bf92da08d2217966 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 7 Nov 2017 09:08:48 +0000 Subject: TIP #422 implementation, Tcl 8.7 part. --- generic/tcl.decls | 10 +++++----- generic/tclDecls.h | 25 +++++++++++++++---------- generic/tclStubInit.c | 5 +++++ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..0bdffec 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -945,10 +945,10 @@ declare 265 { declare 266 { void Tcl_ValidateAllMemory(const char *file, int line) } -declare 267 { +declare 267 {deprecated {see TIP #422}} { void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList) } -declare 268 { +declare 268 {deprecated {see TIP #422}} { void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList) } declare 269 { @@ -976,16 +976,16 @@ declare 274 { CONST84_RETURN char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name, const char *version, int exact) } -declare 275 { +declare 275 {deprecated {see TIP #422}} { void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList) } -declare 276 { +declare 276 {deprecated {see TIP #422}} { int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList) } declare 277 { Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options) } -declare 278 { +declare 278 {deprecated {see TIP #422}} { TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList) } declare 279 { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..dc48dd5 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -812,10 +812,12 @@ EXTERN int Tcl_DumpActiveMemory(const char *fileName); /* 266 */ EXTERN void Tcl_ValidateAllMemory(const char *file, int line); /* 267 */ -EXTERN void Tcl_AppendResultVA(Tcl_Interp *interp, +TCL_DEPRECATED("see TIP #422") +void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList); /* 268 */ -EXTERN void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, +TCL_DEPRECATED("see TIP #422") +void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList); /* 269 */ EXTERN char * Tcl_HashStats(Tcl_HashTable *tablePtr); @@ -838,14 +840,17 @@ EXTERN CONST84_RETURN char * Tcl_PkgRequire(Tcl_Interp *interp, const char *name, const char *version, int exact); /* 275 */ -EXTERN void Tcl_SetErrorCodeVA(Tcl_Interp *interp, +TCL_DEPRECATED("see TIP #422") +void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList); /* 276 */ -EXTERN int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList); +TCL_DEPRECATED("see TIP #422") +int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList); /* 277 */ EXTERN Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options); /* 278 */ -EXTERN TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList); +TCL_DEPRECATED("see TIP #422") +TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList); /* 279 */ EXTERN void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type); @@ -2133,18 +2138,18 @@ typedef struct TclStubs { void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */ int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */ void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */ - void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */ - void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */ + TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */ + TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */ char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */ CONST84_RETURN char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, CONST84 char **termPtr); /* 270 */ CONST84_RETURN char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */ CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */ int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */ CONST84_RETURN char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */ - void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */ - int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */ + TCL_DEPRECATED_API("see TIP #422") void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */ + TCL_DEPRECATED_API("see TIP #422") int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */ Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */ - TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */ + TCL_DEPRECATED_API("see TIP #422") TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */ void (*tcl_GetVersion) (int *major, int *minor, int *patchLevel, int *type); /* 279 */ void (*tcl_InitMemory) (Tcl_Interp *interp); /* 280 */ Tcl_Channel (*tcl_StackChannel) (Tcl_Interp *interp, const Tcl_ChannelType *typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan); /* 281 */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ebd2086..24b28e5 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -72,6 +72,11 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclBNInitBignumFromWideUInt 0 # define TclBNInitBignumFromWideInt 0 # define TclBNInitBignumFromLong 0 +# define Tcl_AppendResultVA 0 +# define Tcl_AppendStringsToObjVA 0 +# define Tcl_SetErrorCodeVA 0 +# define Tcl_PanicVA 0 +# define Tcl_VarEvalVA 0 #else #define TclSetStartupScriptPath setStartupScriptPath static void TclSetStartupScriptPath(Tcl_Obj *path) -- cgit v0.12 From 2ba5fab30eefc4f31112e67aeba2dd49a178ff4c Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 8 Nov 2017 02:25:40 +0000 Subject: Modify TclCreateProc to handle arbitrary argument names, not just ASCII. --- generic/tclExecute.c | 4 +-- generic/tclInt.h | 2 +- generic/tclProc.c | 96 +++++++++++++++++++++++----------------------------- 3 files changed, 45 insertions(+), 57 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f4c71ec..54c73fd 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1333,12 +1333,12 @@ TclStackAlloc( int numBytes) { Interp *iPtr = (Interp *) interp; - int numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); + int numWords; if (iPtr == NULL || iPtr->execEnvPtr == NULL) { return (void *) ckalloc(numBytes); } - + numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); return (void *) StackAllocWords(interp, numWords); } diff --git a/generic/tclInt.h b/generic/tclInt.h index 0d68e8e..29392b6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4483,7 +4483,7 @@ MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr); /* *---------------------------------------------------------------- - * Macro used by the Tcl core to increment a namespace's export export epoch + * Macro used by the Tcl core to increment a namespace's export epoch * counter. The ANSI C "prototype" for this macro is: * * MODULE_SCOPE void TclInvalidateNsCmdLookup(Namespace *nsPtr); diff --git a/generic/tclProc.c b/generic/tclProc.c index 96bdcf3..8fc6dcb 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -393,13 +393,13 @@ TclCreateProc( Proc **procPtrPtr) /* Returns: pointer to proc data. */ { Interp *iPtr = (Interp *) interp; - const char **argArray = NULL; register Proc *procPtr; - int i, length, result, numArgs; - const char *args, *bytes, *p; + int i, result, numArgs, plen; + const char *bytes, *argname, *argnamei; + char argnamelast; register CompiledLocal *localPtr = NULL; - Tcl_Obj *defPtr; + Tcl_Obj *defPtr, *errorObj, **argArray; int precompiled = 0; if (bodyPtr->typePtr == &tclProcBodyType) { @@ -436,6 +436,7 @@ TclCreateProc( */ if (Tcl_IsShared(bodyPtr)) { + int length; Tcl_Obj *sharedBodyPtr = bodyPtr; bytes = TclGetStringFromObj(bodyPtr, &length); @@ -473,12 +474,9 @@ TclCreateProc( * argument specifier. If the body is precompiled, processing is limited * to checking that the parsed argument is consistent with the one stored * in the Proc. - * - * THIS FAILS IF THE ARG LIST OBJECT'S STRING REP CONTAINS NULS. */ - args = TclGetStringFromObj(argsPtr, &length); - result = Tcl_SplitList(interp, args, &numArgs, &argArray); + result = Tcl_ListObjGetElements(interp , argsPtr ,&numArgs ,&argArray); if (result != TCL_OK) { goto procError; } @@ -502,28 +500,28 @@ TclCreateProc( for (i = 0; i < numArgs; i++) { int fieldCount, nameLength; size_t valueLength; - const char **fieldValues; + Tcl_Obj **fieldValues; /* * Now divide the specifier up into name and default. */ - result = Tcl_SplitList(interp, argArray[i], &fieldCount, + result = Tcl_ListObjGetElements(interp, argArray[i], &fieldCount, &fieldValues); if (result != TCL_OK) { goto procError; } if (fieldCount > 2) { - ckfree(fieldValues); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "too many fields in argument specifier \"%s\"", - argArray[i])); + errorObj = Tcl_NewStringObj( + "too many fields in argument specifier \"", -1); + Tcl_AppendObjToObj(errorObj, argArray[i]); + Tcl_AppendToObj(errorObj, "\"", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - if ((fieldCount == 0) || (*fieldValues[0] == 0)) { - ckfree(fieldValues); + if ((fieldCount == 0) || (fieldValues[0]->length == 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument with no name", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", @@ -531,9 +529,10 @@ TclCreateProc( goto procError; } - nameLength = strlen(fieldValues[0]); + nameLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[0]), fieldValues[0]->length); if (fieldCount == 2) { - valueLength = strlen(fieldValues[1]); + valueLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[1]), + fieldValues[1]->length); } else { valueLength = 0; } @@ -542,33 +541,29 @@ TclCreateProc( * Check that the formal parameter name is a scalar. */ - p = fieldValues[0]; - while (*p != '\0') { - if (*p == '(') { - const char *q = p; - do { - q++; - } while (*q != '\0'); - q--; - if (*q == ')') { /* We have an array element. */ + argname = Tcl_GetStringFromObj(fieldValues[0], &plen); + argnamei = argname; + argnamelast = argname[plen-1]; + while (plen--) { + if (argnamei[0] == '(') { + if (argnamelast == ')') { /* We have an array element. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "formal parameter \"%s\" is an array element", - fieldValues[0])); - ckfree(fieldValues); + Tcl_GetString(fieldValues[0]))); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - } else if ((*p == ':') && (*(p+1) == ':')) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "formal parameter \"%s\" is not a simple name", - fieldValues[0])); - ckfree(fieldValues); + } else if ((argnamei[0] == ':') && (argnamei[1] == ':')) { + errorObj = Tcl_NewStringObj("formal parameter \"", -1); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" is not a simple name", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - p++; + argnamei = Tcl_UtfNext(argnamei); } if (precompiled) { @@ -584,7 +579,7 @@ TclCreateProc( */ if ((localPtr->nameLength != nameLength) - || (strcmp(localPtr->name, fieldValues[0])) + || (Tcl_UtfNcmp(localPtr->name, argname, nameLength)) || (localPtr->frameIndex != i) || !(localPtr->flags & VAR_ARGUMENT) || (localPtr->defValuePtr == NULL && fieldCount == 2) @@ -592,7 +587,6 @@ TclCreateProc( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "procedure \"%s\": formal parameter %d is " "inconsistent with precompiled body", procName, i)); - ckfree(fieldValues); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -607,12 +601,13 @@ TclCreateProc( size_t tmpLength = localPtr->defValuePtr->length; if ((valueLength != tmpLength) || - strncmp(fieldValues[1], tmpPtr, tmpLength)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "procedure \"%s\": formal parameter \"%s\" has " - "default value inconsistent with precompiled body", - procName, fieldValues[0])); - ckfree(fieldValues); + Tcl_UtfNcmp(Tcl_GetString(fieldValues[1]), tmpPtr, tmpLength)) { + errorObj = Tcl_ObjPrintf( + "procedure \"%s\": formal parameter \"" ,procName); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" has " + "default value inconsistent with precompiled body", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -632,7 +627,7 @@ TclCreateProc( * local variables for the argument. */ - localPtr = ckalloc(TclOffset(CompiledLocal, name) + nameLength+1); + localPtr = ckalloc(TclOffset(CompiledLocal, name) + fieldValues[0]->length +1); if (procPtr->firstLocalPtr == NULL) { procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr; } else { @@ -640,19 +635,18 @@ TclCreateProc( procPtr->lastLocalPtr = localPtr; } localPtr->nextPtr = NULL; - localPtr->nameLength = nameLength; + localPtr->nameLength = Tcl_NumUtfChars(argname, fieldValues[0]->length); localPtr->frameIndex = i; localPtr->flags = VAR_ARGUMENT; localPtr->resolveInfo = NULL; if (fieldCount == 2) { - localPtr->defValuePtr = - Tcl_NewStringObj(fieldValues[1], valueLength); + localPtr->defValuePtr = fieldValues[1]; Tcl_IncrRefCount(localPtr->defValuePtr); } else { localPtr->defValuePtr = NULL; } - memcpy(localPtr->name, fieldValues[0], nameLength + 1); + memcpy(localPtr->name, argname, fieldValues[0]->length + 1); if ((i == numArgs - 1) && (localPtr->nameLength == 4) && (localPtr->name[0] == 'a') @@ -660,12 +654,9 @@ TclCreateProc( localPtr->flags |= VAR_IS_ARGS; } } - - ckfree(fieldValues); } *procPtrPtr = procPtr; - ckfree(argArray); return TCL_OK; procError: @@ -686,9 +677,6 @@ TclCreateProc( } ckfree(procPtr); } - if (argArray != NULL) { - ckfree(argArray); - } return TCL_ERROR; } -- cgit v0.12 From 12d3a7d307b177672437966afd5673f994b757f8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Nov 2017 09:37:31 +0000 Subject: Change "epoch" field for dicts from "int" to "unsigned int". This doubles the number of available epoch's before overflow. Also make 0 the special value in stead of -1, meaning "dict search done". That also means that epoch counting starts with 1. --- generic/tcl.h | 4 ++-- generic/tclDictObj.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 07d841d..80c8dcb 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1344,8 +1344,8 @@ typedef struct Tcl_HashSearch { typedef struct { void *next; /* Search position for underlying hash * table. */ - int epoch; /* Epoch marker for dictionary being searched, - * or -1 if search has terminated. */ + unsigned int epoch; /* Epoch marker for dictionary being searched, + * or 0 if search has terminated. */ Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ } Tcl_DictSearch; diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 1c74c5f..b1962e6 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -141,7 +141,7 @@ typedef struct Dict { * the dictionary. Used for doing traversal of * the entries in the order that they are * created. */ - int epoch; /* Epoch counter */ + unsigned int epoch; /* Epoch counter */ size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested @@ -390,7 +390,7 @@ DupDictInternalRep( * Initialise other fields. */ - newDict->epoch = 0; + newDict->epoch = 1; newDict->chain = NULL; newDict->refCount = 1; @@ -710,7 +710,7 @@ SetDictFromAny( */ TclFreeIntRep(objPtr); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; dict->refCount = 1; DICT(objPtr) = dict; @@ -1109,7 +1109,7 @@ Tcl_DictObjFirst( dict = DICT(dictPtr); cPtr = dict->entryChainHead; if (cPtr == NULL) { - searchPtr->epoch = -1; + searchPtr->epoch = 0; *donePtr = 1; } else { *donePtr = 0; @@ -1170,7 +1170,7 @@ Tcl_DictObjNext( * If the searh is done; we do no work. */ - if (searchPtr->epoch == -1) { + if (!searchPtr->epoch) { *donePtr = 1; return; } @@ -1227,8 +1227,8 @@ Tcl_DictObjDone( { Dict *dict; - if (searchPtr->epoch != -1) { - searchPtr->epoch = -1; + if (searchPtr->epoch) { + searchPtr->epoch = 0; dict = (Dict *) searchPtr->dictionaryPtr; if (dict->refCount-- <= 1) { DeleteDict(dict); @@ -1380,7 +1380,7 @@ Tcl_NewDictObj(void) TclInvalidateStringRep(dictPtr); dict = ckalloc(sizeof(Dict)); InitChainTable(dict); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; dict->refCount = 1; DICT(dictPtr) = dict; @@ -1430,7 +1430,7 @@ Tcl_DbNewDictObj( TclInvalidateStringRep(dictPtr); dict = ckalloc(sizeof(Dict)); InitChainTable(dict); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; dict->refCount = 1; DICT(dictPtr) = dict; -- cgit v0.12 From c59b3f3bc10dd286aed6474e627a9613dc69bb44 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Nov 2017 12:37:20 +0000 Subject: For alpha/beta versions of Tcl, stub-enabled extensions are only allowed to run on the EXACT the same Tcl versions as compiled: The stubs might still be in flux, they are not guaranteed to work on future Tcl versions anyway. Backported from "novem" (which already had this special protection). For final releases (8.7.0) everything works as before. --- generic/tcl.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 80c8dcb..a6a8c94 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2409,14 +2409,27 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, const char *version, int epoch, int revision); #ifdef USE_TCL_STUBS -#define Tcl_InitStubs(interp, version, exact) \ - (Tcl_InitStubs)(interp, version, \ +#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE +# define Tcl_InitStubs(interp, version, exact) \ + (Tcl_InitStubs)(interp, version, \ (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ TCL_STUB_MAGIC) #else -#define Tcl_InitStubs(interp, version, exact) \ - Tcl_PkgInitStubsCheck(interp, version, \ - (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +# define Tcl_InitStubs(interp, version, exact) \ + (Tcl_InitStubs)(interp, TCL_PATCH_LEVEL, \ + 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ + TCL_STUB_MAGIC) +#endif +#else +#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE +# define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, version, \ + (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +#else +# define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, TCL_PATCH_LEVEL, \ + 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +#endif #endif /* -- cgit v0.12 From 01fd6594cf127d8b79a5747c73469af626bdccd8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 13 Nov 2017 08:37:55 +0000 Subject: Add a lot of "deprecation" marks to internal API which will be removed in Tcl 9.0 (see also tcl-9-cleanup branch). Extensions still using this API will get a compiler warning, but everything will continue to work fine for all future 8.x releases. --- generic/tcl.decls | 6 ++---- generic/tclDecls.h | 10 +++++---- generic/tclInt.decls | 56 +++++++++++++++++++------------------------------- generic/tclIntDecls.h | 57 ++++++++++++++++++++++++++++++--------------------- 4 files changed, 63 insertions(+), 66 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..7c9935a 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -780,8 +780,7 @@ declare 218 { declare 219 { int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr) } -# Obsolete -declare 220 { +declare 220 {deprecated {}} { int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode) } declare 221 { @@ -868,8 +867,7 @@ declare 244 { declare 245 { int Tcl_StringMatch(const char *str, const char *pattern) } -# Obsolete -declare 246 { +declare 246 {deprecated {}} { int Tcl_TellOld(Tcl_Channel chan) } declare 247 { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..864cad8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -669,7 +669,8 @@ EXTERN int Tcl_ScanElement(const char *src, int *flagPtr); EXTERN int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr); /* 220 */ -EXTERN int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode); +TCL_DEPRECATED("") +int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode); /* 221 */ EXTERN int Tcl_ServiceAll(void); /* 222 */ @@ -741,7 +742,8 @@ EXTERN void Tcl_StaticPackage(Tcl_Interp *interp, /* 245 */ EXTERN int Tcl_StringMatch(const char *str, const char *pattern); /* 246 */ -EXTERN int Tcl_TellOld(Tcl_Channel chan); +TCL_DEPRECATED("") +int Tcl_TellOld(Tcl_Channel chan); /* 247 */ EXTERN int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, @@ -2086,7 +2088,7 @@ typedef struct TclStubs { void (*tcl_ResetResult) (Tcl_Interp *interp); /* 217 */ int (*tcl_ScanElement) (const char *src, int *flagPtr); /* 218 */ int (*tcl_ScanCountedElement) (const char *src, int length, int *flagPtr); /* 219 */ - int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */ + TCL_DEPRECATED_API("") int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */ int (*tcl_ServiceAll) (void); /* 221 */ int (*tcl_ServiceEvent) (int flags); /* 222 */ void (*tcl_SetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 223 */ @@ -2112,7 +2114,7 @@ typedef struct TclStubs { void (*tcl_SplitPath) (const char *path, int *argcPtr, CONST84 char ***argvPtr); /* 243 */ void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */ int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */ - int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */ + TCL_DEPRECATED_API("") int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */ int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */ int (*tcl_TraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 248 */ char * (*tcl_TranslateFileName) (Tcl_Interp *interp, const char *name, Tcl_DString *bufferPtr); /* 249 */ diff --git a/generic/tclInt.decls b/generic/tclInt.decls index dea698c..b683a29 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -50,7 +50,7 @@ declare 6 { declare 7 { int TclCopyAndCollapse(int count, const char *src, char *dst) } -declare 8 { +declare 8 {deprecated {}} { int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr) } @@ -73,7 +73,7 @@ declare 11 { declare 12 { void TclDeleteVars(Interp *iPtr, TclVarHashTable *tablePtr) } -# Removed in 8.5 +# Removed in 8.5: #declare 13 { # int TclDoGlob(Tcl_Interp *interp, char *separators, # Tcl_DString *headPtr, char *tail, Tcl_GlobTypeData *types) @@ -88,7 +88,7 @@ declare 14 { declare 16 { void TclExprFloatError(Tcl_Interp *interp, double value) } -# Removed in 8.4 +# Removed in 8.4: #declare 17 { # int TclFileAttrsCmd(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) #} @@ -123,7 +123,7 @@ declare 25 { # declare 26 { # char *TclGetCwd(Tcl_Interp *interp) # } -# Removed in 8.5 +# Removed in 8.5: #declare 27 { # int TclGetDate(char *p, unsigned long now, long zone, # unsigned long *timePtr) @@ -147,7 +147,7 @@ declare 32 { int TclGetFrame(Tcl_Interp *interp, const char *str, CallFrame **framePtrPtr) } -# Removed in Tcl 8.5 +# Removed in 8.5: #declare 33 { # TclCmdProcType TclGetInterpProc(void) #} @@ -160,7 +160,7 @@ declare 34 { # Tcl_Obj *TclGetIndexedScalar(Tcl_Interp *interp, int localIndex, # int flags) #} -# Removed in 8.6a2 +# Removed in 8.6a2: #declare 36 { # int TclGetLong(Tcl_Interp *interp, const char *str, long *longPtr) #} @@ -185,7 +185,7 @@ declare 41 { declare 42 { CONST86 char *TclpGetUserHome(const char *name, Tcl_DString *bufferPtr) } -# Removed in Tcl 8.5a2 +# Removed in 8.5a2: #declare 43 { # int TclGlobalInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) @@ -220,7 +220,7 @@ declare 50 { declare 51 { int TclInterpInit(Tcl_Interp *interp) } -# Removed in Tcl 8.5a2 +# Removed in 8.5a2: #declare 52 { # int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) @@ -273,7 +273,7 @@ declare 64 { int TclObjInvoke(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags) } -# Removed in Tcl 8.5a2 +# Removed in 8.5a2: #declare 65 { # int TclObjInvokeGlobal(Tcl_Interp *interp, int objc, # Tcl_Obj *const objv[], int flags) @@ -313,9 +313,7 @@ declare 75 { declare 76 { unsigned long TclpGetSeconds(void) } - -# deprecated -declare 77 { +declare 77 {deprecated {}} { void TclpGetTime(Tcl_Time *time) } # Removed in 8.6: @@ -380,7 +378,7 @@ declare 92 { declare 93 { void TclProcDeleteProc(ClientData clientData) } -# Removed in Tcl 8.5: +# Removed in 8.5: #declare 94 { # int TclProcInterpProc(ClientData clientData, Tcl_Interp *interp, # int argc, const char **argv) @@ -419,7 +417,7 @@ declare 103 { int TclSockGetPort(Tcl_Interp *interp, const char *str, const char *proto, int *portPtr) } -declare 104 { +declare 104 {deprecated {}} { int TclSockMinimumBuffersOld(int sock, int size) } # Replaced by Tcl_FSStat in 8.4: @@ -532,7 +530,7 @@ declare 131 { declare 132 { int TclpHasSockets(Tcl_Interp *interp) } -declare 133 { +declare 133 {deprecated {}} { struct tm *TclpGetDate(const time_t *time, int useGMT) } # Removed in 8.5 @@ -625,12 +623,10 @@ declare 156 { declare 157 { Var *TclVarTraceExists(Tcl_Interp *interp, const char *varName) } -# REMOVED (except from stub table) - use public Tcl_SetStartupScript() -declare 158 { +declare 158 {deprecated {use public Tcl_SetStartupScript()}} { void TclSetStartupScriptFileName(const char *filename) } -# REMOVED (except from stub table) - use public Tcl_GetStartupScript() -declare 159 { +declare 159 {deprecated {use public Tcl_GetStartupScript()}} { const char *TclGetStartupScriptFileName(void) } #declare 160 { @@ -676,13 +672,10 @@ declare 166 { int index, Tcl_Obj *valuePtr) } -# VFS-aware versions of Tcl*StartupScriptFileName (158 and 159 above) -# REMOVED (except from stub table) - use public Tcl_SetStartupScript() -declare 167 { +declare 167 {deprecated {use public Tcl_SetStartupScript()}} { void TclSetStartupScriptPath(Tcl_Obj *pathPtr) } -# REMOVED (except from stub table) - use public Tcl_GetStartupScript() -declare 168 { +declare 168 {deprecated {use public Tcl_GetStartupScript()}} { Tcl_Obj *TclGetStartupScriptPath(void) } # variant of Tcl_UtfNCmp that takes n as bytes, not chars @@ -730,7 +723,6 @@ declare 177 { void TclVarErrMsg(Tcl_Interp *interp, const char *part1, const char *part2, const char *operation, const char *reason) } -# TIP 338 made these public - now declared in tcl.h too declare 178 { void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName) } @@ -748,12 +740,10 @@ declare 179 { # const char *file, int line) #} -# TclpGmtime and TclpLocaltime promoted to the generic interface from unix - -declare 182 { +declare 182 {deprecated {}} { struct tm *TclpLocaltime(const time_t *clock) } -declare 183 { +declare 183 {deprecated {}} { struct tm *TclpGmtime(const time_t *clock) } @@ -937,10 +927,7 @@ declare 234 { declare 235 { void TclInitVarHashTable(TclVarHashTable *tablePtr, Namespace *nsPtr) } - - -# TIP 337 made this one public -declare 236 { +declare 236 {deprecated {use Tcl_BackgroundException}} { void TclBackgroundException(Tcl_Interp *interp, int code) } @@ -1090,7 +1077,7 @@ declare 9 win { declare 10 win { Tcl_DirEntry *TclpReaddir(DIR *dir) } -# Removed in 8.3.1 (for Win32s only) +# Removed in 8.3.1 (for Win32s only): #declare 10 win { # int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr) #} @@ -1140,7 +1127,6 @@ declare 19 win { declare 20 win { void TclWinAddProcess(HANDLE hProcess, DWORD id) } -# new for 8.4.20+/8.5.12+ declare 21 win { char *TclpInetNtoa(struct in_addr addr) } diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 5bccfe5..4244362 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -75,7 +75,8 @@ EXTERN void TclCleanupCommand(Command *cmdPtr); EXTERN int TclCopyAndCollapse(int count, const char *src, char *dst); /* 8 */ -EXTERN int TclCopyChannelOld(Tcl_Interp *interp, +TCL_DEPRECATED("") +int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 9 */ @@ -218,7 +219,8 @@ EXTERN unsigned long TclpGetClicks(void); /* 76 */ EXTERN unsigned long TclpGetSeconds(void); /* 77 */ -EXTERN void TclpGetTime(Tcl_Time *time); +TCL_DEPRECATED("") +void TclpGetTime(Tcl_Time *time); /* Slot 78 is reserved */ /* Slot 79 is reserved */ /* Slot 80 is reserved */ @@ -267,7 +269,8 @@ EXTERN void TclSetupEnv(Tcl_Interp *interp); EXTERN int TclSockGetPort(Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 104 */ -EXTERN int TclSockMinimumBuffersOld(int sock, int size); +TCL_DEPRECATED("") +int TclSockMinimumBuffersOld(int sock, int size); /* Slot 105 is reserved */ /* Slot 106 is reserved */ /* Slot 107 is reserved */ @@ -350,7 +353,8 @@ EXTERN void Tcl_SetNamespaceResolvers( /* 132 */ EXTERN int TclpHasSockets(Tcl_Interp *interp); /* 133 */ -EXTERN struct tm * TclpGetDate(const time_t *time, int useGMT); +TCL_DEPRECATED("") +struct tm * TclpGetDate(const time_t *time, int useGMT); /* Slot 134 is reserved */ /* Slot 135 is reserved */ /* Slot 136 is reserved */ @@ -401,9 +405,11 @@ EXTERN void TclRegError(Tcl_Interp *interp, const char *msg, EXTERN Var * TclVarTraceExists(Tcl_Interp *interp, const char *varName); /* 158 */ -EXTERN void TclSetStartupScriptFileName(const char *filename); +TCL_DEPRECATED("use public Tcl_SetStartupScript()") +void TclSetStartupScriptFileName(const char *filename); /* 159 */ -EXTERN const char * TclGetStartupScriptFileName(void); +TCL_DEPRECATED("use public Tcl_GetStartupScript()") +const char * TclGetStartupScriptFileName(void); /* Slot 160 is reserved */ /* 161 */ EXTERN int TclChannelTransform(Tcl_Interp *interp, @@ -422,9 +428,11 @@ EXTERN int TclListObjSetElement(Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 167 */ -EXTERN void TclSetStartupScriptPath(Tcl_Obj *pathPtr); +TCL_DEPRECATED("use public Tcl_SetStartupScript()") +void TclSetStartupScriptPath(Tcl_Obj *pathPtr); /* 168 */ -EXTERN Tcl_Obj * TclGetStartupScriptPath(void); +TCL_DEPRECATED("use public Tcl_GetStartupScript()") +Tcl_Obj * TclGetStartupScriptPath(void); /* 169 */ EXTERN int TclpUtfNcmp2(const char *s1, const char *s2, unsigned long n); @@ -464,9 +472,11 @@ EXTERN Tcl_Obj * Tcl_GetStartupScript(const char **encodingNamePtr); /* Slot 180 is reserved */ /* Slot 181 is reserved */ /* 182 */ -EXTERN struct tm * TclpLocaltime(const time_t *clock); +TCL_DEPRECATED("") +struct tm * TclpLocaltime(const time_t *clock); /* 183 */ -EXTERN struct tm * TclpGmtime(const time_t *clock); +TCL_DEPRECATED("") +struct tm * TclpGmtime(const time_t *clock); /* Slot 184 is reserved */ /* Slot 185 is reserved */ /* Slot 186 is reserved */ @@ -570,7 +580,8 @@ EXTERN Var * TclVarHashCreateVar(TclVarHashTable *tablePtr, EXTERN void TclInitVarHashTable(TclVarHashTable *tablePtr, Namespace *nsPtr); /* 236 */ -EXTERN void TclBackgroundException(Tcl_Interp *interp, int code); +TCL_DEPRECATED("use Tcl_BackgroundException") +void TclBackgroundException(Tcl_Interp *interp, int code); /* 237 */ EXTERN int TclResetCancellation(Tcl_Interp *interp, int force); /* 238 */ @@ -652,7 +663,7 @@ typedef struct TclIntStubs { int (*tclCleanupChildren) (Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 5 */ void (*tclCleanupCommand) (Command *cmdPtr); /* 6 */ int (*tclCopyAndCollapse) (int count, const char *src, char *dst); /* 7 */ - int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */ + TCL_DEPRECATED_API("") int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */ int (*tclCreatePipeline) (Tcl_Interp *interp, int argc, const char **argv, Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, TclFile *errFilePtr); /* 9 */ int (*tclCreateProc) (Tcl_Interp *interp, Namespace *nsPtr, const char *procName, Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr); /* 10 */ void (*tclDeleteCompiledLocalVars) (Interp *iPtr, CallFrame *framePtr); /* 11 */ @@ -721,7 +732,7 @@ typedef struct TclIntStubs { void (*tclpFree) (char *ptr); /* 74 */ unsigned long (*tclpGetClicks) (void); /* 75 */ unsigned long (*tclpGetSeconds) (void); /* 76 */ - void (*tclpGetTime) (Tcl_Time *time); /* 77 */ + TCL_DEPRECATED_API("") void (*tclpGetTime) (Tcl_Time *time); /* 77 */ void (*reserved78)(void); void (*reserved79)(void); void (*reserved80)(void); @@ -748,7 +759,7 @@ typedef struct TclIntStubs { CONST86 char * (*tclSetPreInitScript) (const char *string); /* 101 */ void (*tclSetupEnv) (Tcl_Interp *interp); /* 102 */ int (*tclSockGetPort) (Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 103 */ - int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */ + TCL_DEPRECATED_API("") int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */ void (*reserved105)(void); void (*reserved106)(void); void (*reserved107)(void); @@ -777,7 +788,7 @@ typedef struct TclIntStubs { int (*tcl_RemoveInterpResolvers) (Tcl_Interp *interp, const char *name); /* 130 */ void (*tcl_SetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 131 */ int (*tclpHasSockets) (Tcl_Interp *interp); /* 132 */ - struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */ + TCL_DEPRECATED_API("") struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */ void (*reserved134)(void); void (*reserved135)(void); void (*reserved136)(void); @@ -802,8 +813,8 @@ typedef struct TclIntStubs { void (*reserved155)(void); void (*tclRegError) (Tcl_Interp *interp, const char *msg, int status); /* 156 */ Var * (*tclVarTraceExists) (Tcl_Interp *interp, const char *varName); /* 157 */ - void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */ - const char * (*tclGetStartupScriptFileName) (void); /* 159 */ + TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */ + TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") const char * (*tclGetStartupScriptFileName) (void); /* 159 */ void (*reserved160)(void); int (*tclChannelTransform) (Tcl_Interp *interp, Tcl_Channel chan, Tcl_Obj *cmdObjPtr); /* 161 */ void (*tclChannelEventScriptInvoker) (ClientData clientData, int flags); /* 162 */ @@ -811,8 +822,8 @@ typedef struct TclIntStubs { void (*tclExpandCodeArray) (void *envPtr); /* 164 */ void (*tclpSetInitialEncodings) (void); /* 165 */ int (*tclListObjSetElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 166 */ - void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */ - Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */ + TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */ + TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */ int (*tclpUtfNcmp2) (const char *s1, const char *s2, unsigned long n); /* 169 */ int (*tclCheckInterpTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 170 */ int (*tclCheckExecutionTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 171 */ @@ -826,8 +837,8 @@ typedef struct TclIntStubs { Tcl_Obj * (*tcl_GetStartupScript) (const char **encodingNamePtr); /* 179 */ void (*reserved180)(void); void (*reserved181)(void); - struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */ - struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */ + TCL_DEPRECATED_API("") struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */ + TCL_DEPRECATED_API("") struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */ void (*reserved184)(void); void (*reserved185)(void); void (*reserved186)(void); @@ -880,7 +891,7 @@ typedef struct TclIntStubs { void (*tclGetSrcInfoForPc) (CmdFrame *contextPtr); /* 233 */ Var * (*tclVarHashCreateVar) (TclVarHashTable *tablePtr, const char *key, int *newPtr); /* 234 */ void (*tclInitVarHashTable) (TclVarHashTable *tablePtr, Namespace *nsPtr); /* 235 */ - void (*tclBackgroundException) (Tcl_Interp *interp, int code); /* 236 */ + TCL_DEPRECATED_API("use Tcl_BackgroundException") void (*tclBackgroundException) (Tcl_Interp *interp, int code); /* 236 */ int (*tclResetCancellation) (Tcl_Interp *interp, int force); /* 237 */ int (*tclNRInterpProc) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 238 */ int (*tclNRInterpProcCore) (Tcl_Interp *interp, Tcl_Obj *procNameObj, int skip, ProcErrorProc *errorProc); /* 239 */ @@ -1356,7 +1367,7 @@ extern const TclIntStubs *tclIntStubsPtr; #undef TclSetStartupScriptPath #undef TclBackgroundException -#if defined(USE_TCL_STUBS) && defined(TCL_NO_DEPRECATED) +#if defined(USE_TCL_STUBS) # undef Tcl_SetStartupScript # define Tcl_SetStartupScript \ (tclStubsPtr->tcl_SetStartupScript) /* 622 */ -- cgit v0.12 From 9f6573581348d2a8ceb4647ad9781d35644aee8b Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 14 Nov 2017 17:09:49 +0000 Subject: Repair lost of broken [package prefer] testing. --- tests/package.test | 125 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 100 insertions(+), 25 deletions(-) diff --git a/tests/package.test b/tests/package.test index faa15ec..bb938b8 100644 --- a/tests/package.test +++ b/tests/package.test @@ -20,18 +20,19 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -testConstraint testpreferstable [llength [info commands testpreferstable]] - # Do all this in a slave interp to avoid garbaging the package list set i [interp create] tcltest::loadIntoSlaveInterpreter $i {*}$argv +load {} Tcltest $i interp eval $i { namespace import -force ::tcltest::* -package forget {*}[package names] +#package forget {*}[package names] set oldPkgUnknown [package unknown] package unknown {} set oldPath $auto_path set auto_path "" + +testConstraint testpreferstable [llength [info commands testpreferstable]] test package-1.1 {pkg::create gives error on insufficient args} -body { ::pkg::create @@ -575,15 +576,23 @@ test package-3.44 {Tcl_PkgRequire: exact version matching (1578344)} -setup { package forget demo } -result {version conflict for package "demo": have 1.2.3, need exactly 1.2} test package-3.50 {Tcl_PkgRequire procedure, picking best stable version} -constraints testpreferstable -setup { + interp create child + load {} Tcltest child + child eval { testpreferstable package forget t set x xxx + } } -body { + child eval { foreach i {1.4 3.4 4.0a1 2.3 2.4 2.2} { package ifneeded t $i "set x $i; package provide t $i" } package require t set x + } +} -cleanup { + interp delete child } -result {3.4} test package-3.51 {Tcl_PkgRequire procedure, picking best stable version} -setup { package forget t @@ -621,28 +630,51 @@ test pkg-3.53 {Tcl_PkgRequire procedure, picking best stable version} -constrain test package-4.1 {Tcl_PackageCmd procedure} -returnCodes error -body { package } -result {wrong # args: should be "package option ?arg ...?"} -test package-4.2 {Tcl_PackageCmd procedure, "forget" option} { +test package-4.2 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] package names -} {} -test package-4.3 {Tcl_PackageCmd procedure, "forget" option} { + } +} -cleanup { + interp delete child +} -result {} +test package-4.3 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] package forget foo -} {} + } +} -cleanup { + interp delete child +} -result {} test package-4.4 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child + child eval { package forget {*}[package names] set result {} + } } -body { + child eval { package ifneeded t 1.1 {first script} package ifneeded t 2.3 {second script} package ifneeded x 1.4 {x's script} lappend result [lsort [package names]] [package versions t] package forget t lappend result [lsort [package names]] [package versions t] + } +} -cleanup { + interp delete child } -result {{t x} {1.1 2.3} x {}} test package-4.5 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child + child eval { package forget {*}[package names] + } } -body { + child eval { package ifneeded a 1.1 {first script} package ifneeded b 2.3 {second script} package ifneeded c 1.4 {third script} @@ -650,6 +682,9 @@ test package-4.5 {Tcl_PackageCmd procedure, "forget" option} -setup { set result [list [lsort [package names]]] package forget a c lappend result [lsort [package names]] + } +} -cleanup { + interp delete child } -result {{a b c} b} test package-4.5.1 {Tcl_PackageCmd procedure, "forget" option} -body { # Test for Bug 415273 @@ -668,28 +703,55 @@ test package-4.7 {Tcl_PackageCmd procedure, "ifneeded" option} -body { test package-4.8 {Tcl_PackageCmd procedure, "ifneeded" option} -body { package ifneeded t xyz } -returnCodes error -result {expected version number but got "xyz"} -test package-4.9 {Tcl_PackageCmd procedure, "ifneeded" option} { +test package-4.9 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] list [package ifneeded foo 1.1] [package names] -} {{} {}} + } +} -cleanup { + interp delete child +} -result {{} {}} test package-4.10 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { - package forget t + interp create child + child eval { + package forget {*}[package names] + } } -body { + child eval { package ifneeded t 1.4 "script for t 1.4" list [package names] [package ifneeded t 1.4] [package versions t] + } +} -cleanup { + interp delete child } -result {t {script for t 1.4} 1.4} test package-4.11 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { - package forget t + interp create child + child eval { + package forget {*}[package names] + } } -body { + child eval { package ifneeded t 1.4 "script for t 1.4" list [package ifneeded t 1.5] [package names] [package versions t] + } +} -cleanup { + interp delete child } -result {{} t 1.4} test package-4.12 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { - package forget t + interp create child + child eval { + package forget {*}[package names] + } } -body { + child eval { package ifneeded t 1.4 "script for t 1.4" package ifneeded t 1.4 "second script for t 1.4" list [package ifneeded t 1.4] [package names] [package versions t] + } +} -cleanup { + interp delete child } -result {{second script for t 1.4} t 1.4} test package-4.13 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { package forget t @@ -702,18 +764,31 @@ test package-4.13 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { test package-4.14 {Tcl_PackageCmd procedure, "names" option} -body { package names a } -returnCodes error -result {wrong # args: should be "package names"} -test package-4.15 {Tcl_PackageCmd procedure, "names" option} { +test package-4.15 {Tcl_PackageCmd procedure, "names" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] package names -} {} + } +} -cleanup { + interp delete child +} -result {} test package-4.16 {Tcl_PackageCmd procedure, "names" option} -setup { + interp create child + child eval { package forget {*}[package names] + } } -body { + child eval { package ifneeded x 1.2 {dummy} package provide x 1.3 package provide y 2.4 catch {package require z 47.16} lsort [package names] + } +} -cleanup { + interp delete child } -result {x y} test package-4.17 {Tcl_PackageCmd procedure, "provide" option} -body { package provide @@ -1251,11 +1326,9 @@ proc prefer {args} { } } -test package-13.0 {package prefer defaults} -constraints testpreferstable -setup { - testpreferstable -} -body { +test package-13.0 {package prefer defaults} -body { prefer -} -result stable +} -result [expr {[string match {*[ab]*} [package provide Tcl]] ? "latest" : "stable"}] test package-13.1 {package prefer defaults} -body { set ::env(TCL_PKG_PREFER_LATEST) stable ;# value not relevant! prefer @@ -1272,23 +1345,25 @@ test package-14.1 {bogus argument} -returnCodes error -body { test package-15.0 {set, keep} -constraints testpreferstable -setup { testpreferstable -} -body {package prefer stable} -result stable +} -body {package prefer} -result stable test package-15.1 {set stable, keep} -constraints testpreferstable -setup { testpreferstable -} -body {prefer stable} -result {stable stable} +} -body {package prefer stable} -result stable test package-15.2 {set latest, change} -constraints testpreferstable -setup { testpreferstable -} -body {prefer latest} -result {stable latest} +} -body {package prefer latest} -result latest test package-15.3 {set latest, keep} -constraints testpreferstable -setup { testpreferstable } -body { - prefer latest latest -} -result {stable latest latest} + package prefer latest + package prefer latest +} -result latest test package-15.4 {set stable, rejected} -constraints testpreferstable -setup { testpreferstable } -body { - prefer latest stable -} -result {stable latest latest} + package prefer latest + package prefer stable +} -result latest rename prefer {} -- cgit v0.12 From 346cce57455de92d12fcef5ea4115a9657458b84 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 Nov 2017 09:42:07 +0000 Subject: Remove compat/float.h and related machinery. The last system known where this was needed was SunOS-4, which is not supported by Tcl any more for a long ... long time .... Also, fix a typo in generic/tclInt.h and remove some end-of-line spacing. --- compat/float.h | 14 -------------- generic/tclBasic.c | 2 +- generic/tclInt.h | 2 +- generic/tclPkg.c | 6 +++--- unix/configure | 10 ---------- unix/tcl.m4 | 1 - unix/tclConfig.h.in | 3 --- unix/tclUnixPort.h | 5 +---- win/tcl.dsp | 4 ---- win/tclWinThrd.c | 2 -- 10 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 compat/float.h diff --git a/compat/float.h b/compat/float.h deleted file mode 100644 index 411edbf..0000000 --- a/compat/float.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * float.h -- - * - * This is a dummy header file to #include in Tcl when there - * is no float.h in /usr/include. Right now this file is empty: - * Tcl contains #ifdefs to deal with the lack of definitions; - * all it needs is for the #include statement to work. - * - * Copyright (c) 1993 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e6022ac..fe29db0 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7722,7 +7722,7 @@ ExprRandFunc( iPtr->flags |= RAND_SEED_INITIALIZED; /* - * To ensure different seeds in different threads (bug #416643), + * To ensure different seeds in different threads (bug #416643), * take into consideration the thread this interp is running in. */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 6426c21..23a20e6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2922,7 +2922,7 @@ MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp, const char *dict, int dictLength, const char **elementPtr, const char **nextPtr, int *sizePtr, int *literalPtr); -/* TIP #280 - Modified token based evulation, with line information. */ +/* TIP #280 - Modified token based evaluation, with line information. */ MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script, int numBytes, int flags, int line, int *clNextOuter, const char *outerScript); diff --git a/generic/tclPkg.c b/generic/tclPkg.c index ea95320..fb721a0 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -480,7 +480,7 @@ PkgRequireCore( continue; } - + /* Check satisfaction of requirements before considering the current version further. */ if (reqc > 0) { satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); @@ -490,7 +490,7 @@ PkgRequireCore( continue; } } - + if (bestPtr != NULL) { int res = CompareVersions(availVersion, bestVersion, NULL); @@ -547,7 +547,7 @@ PkgRequireCore( /* * Clean up memorized internal reps, if any. */ - + if (bestVersion != NULL) { ckfree(bestVersion); bestVersion = NULL; diff --git a/unix/configure b/unix/configure index 129c283..51d694f 100755 --- a/unix/configure +++ b/unix/configure @@ -3733,16 +3733,6 @@ $as_echo "#define NO_DIRENT_H 1" >>confdefs.h fi - ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes; then : - -else - -$as_echo "#define NO_FLOAT_H 1" >>confdefs.h - -fi - - ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" if test "x$ac_cv_header_values_h" = xyes; then : diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 45922e0..9aa3eb2 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2078,7 +2078,6 @@ closedir(d); AC_DEFINE(NO_DIRENT_H, 1, [Do we have ?]) fi - AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have ?])]) AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have ?])]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index adbc80d..28ce012 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -295,9 +295,6 @@ /* Do we have fd_set? */ #undef NO_FD_SET -/* Do we have ? */ -#undef NO_FLOAT_H - /* Do we have fstatfs()? */ #undef NO_FSTATFS diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index ba56089..8b766d6 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -181,13 +181,10 @@ extern int TclUnixSetBlockingMode(int fd, int mode); *--------------------------------------------------------------------------- */ -#ifndef NO_FLOAT_H -# include -#else +#include #ifndef NO_VALUES_H # include #endif -#endif #ifndef FLT_MAX # ifdef MAXFLOAT diff --git a/win/tcl.dsp b/win/tcl.dsp index 48eae9d..ad9c764 100644 --- a/win/tcl.dsp +++ b/win/tcl.dsp @@ -152,10 +152,6 @@ SOURCE=..\compat\fixstrtod.c # End Source File # Begin Source File -SOURCE=..\compat\float.h -# End Source File -# Begin Source File - SOURCE=..\compat\gettod.c # End Source File # Begin Source File diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index b9cde72..8c130a7 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -13,8 +13,6 @@ #include "tclWinInt.h" -#include - /* Workaround for mingw versions which don't provide this in float.h */ #ifndef _MCW_EM # define _MCW_EM 0x0008001F /* Error masks */ -- cgit v0.12 From b946ce971fbde11b9739fc0b77237ed382e24bd0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Nov 2017 08:58:39 +0000 Subject: Fix [e058307eef73cf21cf6805ad7c778e1024f9eb7d|e058307eef]: Use of values.h breaks build of Tk trunk on macOS --- unix/configure | 10 ---------- unix/tcl.m4 | 2 -- unix/tclConfig.h.in | 3 --- unix/tclUnixPort.h | 3 --- 4 files changed, 18 deletions(-) diff --git a/unix/configure b/unix/configure index 51d694f..90116c8 100755 --- a/unix/configure +++ b/unix/configure @@ -3733,16 +3733,6 @@ $as_echo "#define NO_DIRENT_H 1" >>confdefs.h fi - ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" -if test "x$ac_cv_header_values_h" = xyes; then : - -else - -$as_echo "#define NO_VALUES_H 1" >>confdefs.h - -fi - - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : tcl_ok=1 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 9aa3eb2..51459c9 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2040,7 +2040,6 @@ dnl # preprocessing tests use only CPPFLAGS. # # Defines some of the following vars: # NO_DIRENT_H -# NO_VALUES_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H @@ -2078,7 +2077,6 @@ closedir(d); AC_DEFINE(NO_DIRENT_H, 1, [Do we have ?]) fi - AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have ?])]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 28ce012..4902083 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -331,9 +331,6 @@ /* Do we have a usable 'union wait'? */ #undef NO_UNION_WAIT -/* Do we have ? */ -#undef NO_VALUES_H - /* Do we have wait3() */ #undef NO_WAIT3 diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 8b766d6..d464f05 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -182,9 +182,6 @@ extern int TclUnixSetBlockingMode(int fd, int mode); */ #include -#ifndef NO_VALUES_H -# include -#endif #ifndef FLT_MAX # ifdef MAXFLOAT -- cgit v0.12 From bc3e198cba9e40c015a6acfa992c69434274dde6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Nov 2017 10:15:59 +0000 Subject: Fix error-message for min/math functions: "to" -> "for", for consistancy with the error-messages for other math functions. --- library/init.tcl | 4 ++-- tests/expr-old.test | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index 87d9f14..13a4300 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -79,7 +79,7 @@ namespace eval tcl { proc min {args} { if {![llength $args]} { return -code error \ - "too few arguments to math function \"min\"" + "too few arguments for math function \"min\"" } set val Inf foreach arg $args { @@ -95,7 +95,7 @@ namespace eval tcl { proc max {args} { if {![llength $args]} { return -code error \ - "too few arguments to math function \"max\"" + "too few arguments for math function \"max\"" } set val -Inf foreach arg $args { diff --git a/tests/expr-old.test b/tests/expr-old.test index 3adfb63..8c159b2 100644 --- a/tests/expr-old.test +++ b/tests/expr-old.test @@ -1159,8 +1159,8 @@ test expr-old-40.2 {min math function} -body { expr {min(0.0)} } -result 0.0 test expr-old-40.3 {min math function} -body { - list [catch {expr {min()}} msg] $msg -} -result {1 {too few arguments to math function "min"}} + expr {min()} +} -returnCodes error -result {too few arguments for math function "min"} test expr-old-40.4 {min math function} -body { expr {min(wide(-1) << 30, 4.5, -10)} } -result [expr {wide(-1) << 30}] @@ -1170,6 +1170,12 @@ test expr-old-40.5 {min math function} -body { test expr-old-40.6 {min math function} -body { expr {min(300, "0xFF")} } -result 255 +test expr-old-40.7 {min math function} -body { + expr min(1[string repeat 0 10000], 1e300) +} -result 1e+300 +test expr-old-40.8 {min math function} -body { + expr {min(0, "a")} +} -returnCodes error -match glob -result * test expr-old-41.1 {max math function} -body { expr {max(0)} @@ -1178,8 +1184,8 @@ test expr-old-41.2 {max math function} -body { expr {max(0.0)} } -result 0.0 test expr-old-41.3 {max math function} -body { - list [catch {expr {max()}} msg] $msg -} -result {1 {too few arguments to math function "max"}} + expr {max()} +} -returnCodes error -result {too few arguments for math function "max"} test expr-old-41.4 {max math function} -body { expr {max(wide(1) << 30, 4.5, -10)} } -result [expr {wide(1) << 30}] @@ -1189,6 +1195,12 @@ test expr-old-41.5 {max math function} -body { test expr-old-41.6 {max math function} -body { expr {max(200, "0xFF")} } -result 255 +test expr-old-41.7 {max math function} -body { + expr max(1[string repeat 0 10000], 1e300) +} -result 1[string repeat 0 10000] +test expr-old-41.8 {max math function} -body { + expr {max(0, "a")} +} -returnCodes error -match glob -result * # Special test for Pentium arithmetic bug of 1994: -- cgit v0.12