Skip to content

Commit

Permalink
Fix and CR #68
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Eilemann authored and Stefan Eilemann committed Jan 4, 2017
1 parent 92e83b9 commit 1bc2a80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 2 additions & 1 deletion servus/types.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2015-2016, Human Brain Project
/* Copyright (c) 2015-2017, Human Brain Project
* Stefan.Eilemann@epfl.ch
* Juan Hernando <jhernando@fi.upm.es>
*
Expand Down Expand Up @@ -56,6 +56,7 @@ class Servus;
class URI;
class uint128_t;

typedef unsigned long long ull_t;
typedef std::vector< std::string > Strings;
}

Expand Down
13 changes: 5 additions & 8 deletions servus/uint128_t.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2010-2016, Cedric Stalder <cedric.stalder@gmail.com>
/* Copyright (c) 2010-2017, Cedric Stalder <cedric.stalder@gmail.com>
* Stefan Eilemann <eile@eyescale.ch>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
Expand All @@ -22,6 +22,7 @@
#define SERVUS_UINT128_H

#include <servus/api.h>
#include <servus/types.h>

#include <sstream>
#ifdef _MSC_VER
Expand Down Expand Up @@ -235,13 +236,9 @@ class uint128_t
/** @return the full string representation of the value. */
std::string getString() const
{
// OPT: snprintf is faster then using std::stringstream
char buffer[ 34 ] /* 16 bytes + : + \0 */;
#ifdef _MSC_VER
snprintf( buffer, 34, "%llx:%llx", high(), low( ));
#else
snprintf( buffer, 34, "%lx:%lx", high(), low( ));
#endif
// OPT: snprintf is faster than using std::stringstream
char buffer[ 34 ] /* 2 x 16 bytes + : + \0 */;
snprintf( buffer, 34, "%llx:%llx", ull_t( high( )), ull_t( low( )));
return std::string( buffer );
}

Expand Down

0 comments on commit 1bc2a80

Please sign in to comment.