diff options
author | Adrian Thurston <thurston@complang.org> | 2012-12-29 11:45:28 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2012-12-29 11:45:28 -0500 |
commit | 7b55404259cdc07af52bee0aff5976c2b1ed5162 (patch) | |
tree | b92901d83f19d5c8eccf655bafd7355ad7734d74 | |
parent | 18b00e0bb07c49c918f3308c4e3eac2d81af846d (diff) | |
download | colm-7b55404259cdc07af52bee0aff5976c2b1ed5162.tar.gz |
some simplification of fsm graph key operators
-rw-r--r-- | colm/keyops.h | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/colm/keyops.h b/colm/keyops.h index 1808c6a6..81610b42 100644 --- a/colm/keyops.h +++ b/colm/keyops.h @@ -41,8 +41,6 @@ private: public: friend inline Key operator+(const Key key1, const Key key2); friend inline Key operator-(const Key key1, const Key key2); - friend inline Key operator/(const Key key1, const Key key2); - friend inline long operator&(const Key key1, const Key key2); friend inline bool operator<( const Key key1, const Key key2 ); friend inline bool operator<=( const Key key1, const Key key2 ); @@ -75,22 +73,13 @@ public: { return Key( 'a' + ( key - 'A' ) ); } void operator+=( const Key other ) - { - /* FIXME: must be made aware of isSigned. */ - key += other.key; - } + { key += other.key; } void operator-=( const Key other ) - { - /* FIXME: must be made aware of isSigned. */ - key -= other.key; - } + { key -= other.key; } void operator|=( const Key other ) - { - /* FIXME: must be made aware of isSigned. */ - key |= other.key; - } + { key |= other.key; } /* Decrement. Needed only for ranges. */ inline void decrement(); @@ -200,30 +189,24 @@ struct KeyOps } }; -extern KeyOps *keyOps; - inline bool operator<( const Key key1, const Key key2 ) { - return keyOps->isSigned ? key1.key < key2.key : - (unsigned long)key1.key < (unsigned long)key2.key; + return key1.key < key2.key; } inline bool operator<=( const Key key1, const Key key2 ) { - return keyOps->isSigned ? key1.key <= key2.key : - (unsigned long)key1.key <= (unsigned long)key2.key; + return key1.key <= key2.key; } inline bool operator>( const Key key1, const Key key2 ) { - return keyOps->isSigned ? key1.key > key2.key : - (unsigned long)key1.key > (unsigned long)key2.key; + return key1.key > key2.key; } inline bool operator>=( const Key key1, const Key key2 ) { - return keyOps->isSigned ? key1.key >= key2.key : - (unsigned long)key1.key >= (unsigned long)key2.key; + return key1.key >= key2.key; } inline bool operator==( const Key key1, const Key key2 ) @@ -239,44 +222,30 @@ inline bool operator!=( const Key key1, const Key key2 ) /* Decrement. Needed only for ranges. */ inline void Key::decrement() { - key = keyOps->isSigned ? key - 1 : ((unsigned long)key)-1; + key = key - 1; } /* Increment. Needed only for ranges. */ inline void Key::increment() { - key = keyOps->isSigned ? key+1 : ((unsigned long)key)+1; + key = key + 1; } inline long long Key::getLongLong() const { - return keyOps->isSigned ? (long long)key : (long long)(unsigned long)key; + return (long long) key; } inline Key operator+(const Key key1, const Key key2) { - /* FIXME: must be made aware of isSigned. */ return Key( key1.key + key2.key ); } inline Key operator-(const Key key1, const Key key2) { - /* FIXME: must be made aware of isSigned. */ return Key( key1.key - key2.key ); } -inline long operator&(const Key key1, const Key key2) -{ - /* FIXME: must be made aware of isSigned. */ - return key1.key & key2.key; -} - -inline Key operator/(const Key key1, const Key key2) -{ - /* FIXME: must be made aware of isSigned. */ - return key1.key / key2.key; -} - const char *findFileExtension( const char *stemFile ); char *fileNameFromStem( const char *stemFile, const char *suffix ); |