You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/08/08 20:54:19 UTC

svn commit: r563981 - in /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util: BigInt.cpp BigInt.h

Author: tabish
Date: Wed Aug  8 11:54:18 2007
New Revision: 563981

URL: http://svn.apache.org/viewvc?view=rev&rev=563981
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Implementing the Primitive Wrappers fully

Added:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.h

Added: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.cpp?view=auto&rev=563981
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.cpp (added)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.cpp Wed Aug  8 11:54:18 2007
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#include "BigInt.h"
+
+using namespace decaf;
+using namespace decaf::internal;
+using namespace decaf::internal::util;
+
+////////////////////////////////////////////////////////////////////////////////
+BigInt::BigInt() {
+}

Added: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.h?view=auto&rev=563981
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.h (added)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/internal/util/BigInt.h Wed Aug  8 11:54:18 2007
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#ifndef _DECAF_INTERNAL_UTIL_BIGINT_H_
+#define _DECAF_INTERNAL_UTIL_BIGINT_H_
+
+#include <decaf/util/Config.h>
+#include <apr.h>
+
+namespace decaf{
+namespace internal{
+namespace util{
+
+    class BigInt {
+    private:
+
+        // Used to make masking easier
+        typedef union {
+            unsigned long long longValue;
+            unsigned int intValue[2];
+            double doubleValue;
+        } LONG_UNION;
+
+        #ifdef APR_IS_BIGENDIAN
+            static const int HiWord = 0;
+            static const int LoWord = 1;
+        #else
+            static const int HiWord = 1;
+            static const int LoWord = 0;
+        #endif
+
+    public:
+
+        BigInt();
+        virtual ~BigInt() {}
+
+        static void multiplyHighPrecision( unsigned long long* arg1,
+                                           int length1,
+                                           unsigned long long* arg2,
+                                           int length2,
+                                           unsigned long long* result,
+                                           int length );
+
+        static unsigned int simpleAppendDecimalDigitHighPrecision(
+                unsigned long long* arg1, int length, unsigned long long digit );
+
+        static double toDoubleHighPrecision( unsigned long long* arg, int length );
+
+        static int tenToTheEHighPrecision( unsigned long long * result,
+                                           int length,
+                                           int e );
+
+        static unsigned long long doubleMantissa( double z );
+
+        static int compareHighPrecision( unsigned long long* arg1,
+                                         int length1,
+                                         unsigned long long* arg2,
+                                         int length2 );
+
+        static int highestSetBitHighPrecision(unsigned long long* arg, int length );
+        static void subtractHighPrecision(unsigned long long* arg1, int length1, unsigned long long* arg2,
+                                    int length2);
+        static int doubleExponent(double z);
+        static unsigned int simpleMultiplyHighPrecision(unsigned long long* arg1, int length, unsigned long long arg2 );
+        static int addHighPrecision(unsigned long long * arg1, int length1, unsigned long long* arg2,
+                                int length2);
+        static void simpleMultiplyAddHighPrecisionBigEndianFix(unsigned long long* arg1, int length,
+                                                         unsigned long long arg2, unsigned int* result );
+        static int lowestSetBit(unsigned long long* y);
+        static int timesTenToTheEHighPrecision(unsigned long long * result, int length, jint e );
+        static void simpleMultiplyAddHighPrecision(unsigned long long * arg1, int length, unsigned long long arg2,
+                                             unsigned int * result);
+        static int highestSetBit(unsigned long long * y );
+        static int lowestSetBitHighPrecision(unsigned long long* arg, int length );
+        static void simpleShiftLeftHighPrecision(unsigned long long* arg1, int length, int arg2 );
+        static unsigned int floatMantissa( float z );
+        static unsigned long long simpleMultiplyHighPrecision64( unsigned long long* arg1, int length, unsigned long long arg2 );
+        static int simpleAddHighPrecision( unsigned long long* arg1, int length, unsigned long long arg2 );
+        static int floatExponent( float z );
+
+    };
+
+}}}
+
+#endif /*_DECAF_INTERNAL_UTIL_BIGINT_H_*/