Permalink
Browse files

Refactor String::GetHex

  • Loading branch information...
mbasaglia committed Nov 2, 2015
1 parent c514048 commit 1ba367e08e1964a948777451be4403828c1aa669
Showing with 8 additions and 8 deletions.
  1. +6 −6 daemon/src/common/Color.cpp
  2. +1 −1 daemon/src/common/String.h
  3. +1 −1 daemon/src/engine/server/CryptoChallege.h
@@ -245,9 +245,9 @@ TokenIterator::value_type TokenIterator::NextToken(const char* input)
Str::cisxdigit( input[3] ) && Str::cisxdigit( input[4] ) )
{
return value_type( input, input+5, Color(
Str::gethex( input[2] ) / 15.f,
Str::gethex( input[3] ) / 15.f,
Str::gethex( input[4] ) / 15.f,
Str::GetHex( input[2] ) / 15.f,
Str::GetHex( input[3] ) / 15.f,
Str::GetHex( input[4] ) / 15.f,
1
) );
}
@@ -265,9 +265,9 @@ TokenIterator::value_type TokenIterator::NextToken(const char* input)
if ( long_hex )
{
return value_type( input, input+8, Color(
( (Str::gethex( input[2] ) << 4) | Str::gethex( input[3] ) ) / 255.f,
( (Str::gethex( input[4] ) << 4) | Str::gethex( input[5] ) ) / 255.f,
( (Str::gethex( input[6] ) << 4) | Str::gethex( input[7] ) ) / 255.f,
( (Str::GetHex( input[2] ) << 4) | Str::GetHex( input[3] ) ) / 255.f,
( (Str::GetHex( input[4] ) << 4) | Str::GetHex( input[5] ) ) / 255.f,
( (Str::GetHex( input[6] ) << 4) | Str::GetHex( input[7] ) ) / 255.f,
1
) );
}
@@ -238,7 +238,7 @@ namespace Str {
* Converts a hexadecimal character to the value of the digit it represents.
* Pre: cisxdigit(ch)
*/
inline CONSTEXPR_FUNCTION int gethex( char ch )
inline CONSTEXPR_FUNCTION int GetHex(char ch)
{
return ch > '9' ?
( ch >= 'a' ? ch - 'a' + 10 : ch - 'A' + 10 )
@@ -129,7 +129,7 @@ inline Data HexDecode( const std::string& input )
throw Error( "Invalid Hex string" );
}
output[ i / 2 ] = ( Str::gethex( input[i] ) << 4 ) | Str::gethex( input[i+1] );
output[ i / 2 ] = ( Str::GetHex( input[i] ) << 4 ) | Str::GetHex( input[i+1] );
}
return output;

0 comments on commit 1ba367e

Please sign in to comment.