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/01 15:02:05 UTC
svn commit: r561791 - in
/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang: Integer.cpp
Integer.h
Author: tabish
Date: Wed Aug 1 06:02:03 2007
New Revision: 561791
URL: http://svn.apache.org/viewvc?view=rev&rev=561791
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103
Implementing the Primitive Wrappers fully
Modified:
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.cpp
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.cpp?view=diff&rev=561791&r1=561790&r2=561791
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.cpp Wed Aug 1 06:02:03 2007
@@ -134,7 +134,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-std::string toBinaryString( int value ) {
+std::string Integer::toBinaryString( int value ) {
int count = 1;
int j = value;
@@ -166,7 +166,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-std::string toOctalString( int value ) {
+std::string Integer::toOctalString( int value ) {
int count = 1, j = value;
@@ -197,7 +197,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-std::string toHexString( int value ) {
+std::string Integer::toHexString( int value ) {
int count = 1;
int j = value;
@@ -413,13 +413,17 @@
}
////////////////////////////////////////////////////////////////////////////////
-int Integer::rotateLeft( int value ) {
- return value; // TODO
+int Integer::rotateLeft( int value, int distance ) {
+ unsigned int i = (unsigned int)value;
+ int j = distance & 0x1F;
+ return ( i << j ) | ( i >> (-j & 0x1F ) );
}
////////////////////////////////////////////////////////////////////////////////
-int Integer::rotateRight( int value ) {
- return value; // TODO
+int Integer::rotateRight( int value, int distance ) {
+ unsigned int i = (unsigned int)value;
+ int j = distance & 0x1F;
+ return ( i >> j ) | ( i << (-j & 0x1F ) );
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h?view=diff&rev=561791&r1=561790&r2=561791
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h Wed Aug 1 06:02:03 2007
@@ -410,9 +410,10 @@
* five bits of the rotation distance can be ignored, even if the distance
* is negative: rotateLeft(val, distance) == rotateLeft(val, distance & 0x1F).
* @param value - the int to be inspected
+ * @param distance - the number of bits to rotate
* @return
*/
- static int rotateLeft( int value );
+ static int rotateLeft( int value, int distance );
/**
* Returns the value obtained by rotating the two's complement binary
@@ -426,11 +427,12 @@
* five bits of the rotation distance can be ignored, even if the distance is
* negative: rotateRight(val, distance) == rotateRight(val, distance & 0x1F).
* @param value - the int to be inspected
+ * @param distance - the number of bits to rotate
* @return the value obtained by rotating the two's complement binary
* representation of the specified int value right by the specified number
* of bits.
*/
- static int rotateRight( int value );
+ static int rotateRight( int value, int distance );
/**
* Returns the signum function of the specified int value. (The return value