summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/jau/basic_types.hpp2
-rw-r--r--include/jau/counting_allocator.hpp6
-rw-r--r--include/jau/counting_callocator.hpp8
-rw-r--r--include/jau/cow_darray.hpp2
-rw-r--r--include/jau/cow_iterator.hpp8
-rw-r--r--include/jau/darray.hpp10
-rw-r--r--include/jau/function_def.hpp8
-rw-r--r--include/jau/java_uplink.hpp2
-rw-r--r--include/jau/jni/helper_jni.hpp2
-rw-r--r--include/jau/string_util.hpp143
-rw-r--r--scripts/rebuild.sh2
-rw-r--r--src/debug.cpp20
-rw-r--r--test/test_basictypeconv.cpp12
-rw-r--r--test/test_cow_darray_perf01.cpp2
-rw-r--r--test/test_cow_iterator_01.cpp16
-rw-r--r--test/test_hashset_perf01.cpp2
-rw-r--r--test/test_intdecstring01.cpp8
-rw-r--r--test/test_to_string.cpp4
18 files changed, 87 insertions, 170 deletions
diff --git a/include/jau/basic_types.hpp b/include/jau/basic_types.hpp
index 2b54aee..a86725a 100644
--- a/include/jau/basic_types.hpp
+++ b/include/jau/basic_types.hpp
@@ -227,7 +227,7 @@ namespace jau {
} // namespace jau
/** \example test_intdecstring01.cpp
- * This C++ unit test validates the jau::to_decimal_string implementation
+ * This C++ unit test validates the jau::to_decstring implementation
*/
#endif /* JAU_BASIC_TYPES_HPP_ */
diff --git a/include/jau/counting_allocator.hpp b/include/jau/counting_allocator.hpp
index d5b6d20..d6e9f0e 100644
--- a/include/jau/counting_allocator.hpp
+++ b/include/jau/counting_allocator.hpp
@@ -86,9 +86,9 @@ struct counting_allocator : public std::allocator<T>
public:
std::string toString(const nsize_t mem_width=0, const nsize_t count_width=0) {
- return "CAlloc["/*+std::to_string(id)+", "*/+uint64DecString(memory_usage, ',', mem_width)+" bytes, alloc[balance "+
- int64DecString(alloc_balance, ',', count_width)+" = "+
- uint64DecString(alloc_count, ',', count_width)+" - "+uint64DecString(dealloc_count, ',', count_width)+"]]";
+ return "CAlloc["/*+std::to_string(id)+", "*/+to_decstring(memory_usage, ',', mem_width)+" bytes, alloc[balance "+
+ to_decstring(alloc_balance, ',', count_width)+" = "+
+ to_decstring(alloc_count, ',', count_width)+" - "+to_decstring(dealloc_count, ',', count_width)+"]]";
}
counting_allocator() noexcept
diff --git a/include/jau/counting_callocator.hpp b/include/jau/counting_callocator.hpp
index fd1ffcf..da9ff7d 100644
--- a/include/jau/counting_callocator.hpp
+++ b/include/jau/counting_callocator.hpp
@@ -88,10 +88,10 @@ struct counting_callocator : public jau::callocator<T>
public:
std::string toString(const nsize_t mem_width=0, const nsize_t count_width=0) {
- return "CAlloc["/*+std::to_string(id)+", "*/+uint64DecString(memory_usage, ',', mem_width)+" bytes, alloc[balance "+
- int64DecString(alloc_balance, ',', count_width)+" = "+
- uint64DecString(alloc_count, ',', count_width)+" - "+uint64DecString(dealloc_count, ',', count_width)+
- ", realloc = "+uint64DecString(realloc_count, ',', count_width)+"]]";
+ return "CAlloc["/*+std::to_string(id)+", "*/+to_decstring(memory_usage, ',', mem_width)+" bytes, alloc[balance "+
+ to_decstring(alloc_balance, ',', count_width)+" = "+
+ to_decstring(alloc_count, ',', count_width)+" - "+to_decstring(dealloc_count, ',', count_width)+
+ ", realloc = "+to_decstring(realloc_count, ',', count_width)+"]]";
}
counting_callocator() noexcept
diff --git a/include/jau/cow_darray.hpp b/include/jau/cow_darray.hpp
index 6c45b69..a206554 100644
--- a/include/jau/cow_darray.hpp
+++ b/include/jau/cow_darray.hpp
@@ -1016,7 +1016,7 @@ namespace jau {
}
constexpr_cxx20 std::string get_info() const noexcept {
- return ("cow_darray[this "+jau::aptrHexString(this)+
+ return ("cow_darray[this "+jau::to_hexstring(this)+
", "+store_ref->get_info()+
"]");
}
diff --git a/include/jau/cow_iterator.hpp b/include/jau/cow_iterator.hpp
index 55a623a..ebc60af 100644
--- a/include/jau/cow_iterator.hpp
+++ b/include/jau/cow_iterator.hpp
@@ -465,8 +465,8 @@ namespace jau {
}
#endif
constexpr_cxx20 std::string get_info() const noexcept {
- return "cow_rw_iterator[this "+jau::aptrHexString(this)+", CoW "+jau::aptrHexString(&cow_parent_)+
- ", store "+jau::aptrHexString(&store_ref_)+
+ return "cow_rw_iterator[this "+jau::to_hexstring(this)+", CoW "+jau::to_hexstring(&cow_parent_)+
+ ", store "+jau::to_hexstring(&store_ref_)+
", "+jau::to_string(iterator_)+"]";
}
@@ -931,8 +931,8 @@ namespace jau {
}
#endif
constexpr_cxx20 std::string get_info() const noexcept {
- return "cow_ro_iterator[this "+jau::aptrHexString(this)+
- ", store "+jau::aptrHexString(&store_ref_)+
+ return "cow_ro_iterator[this "+jau::to_hexstring(this)+
+ ", store "+jau::to_hexstring(&store_ref_)+
", "+jau::to_string(iterator_)+"]";
}
};
diff --git a/include/jau/darray.hpp b/include/jau/darray.hpp
index c0d993a..144dd37 100644
--- a/include/jau/darray.hpp
+++ b/include/jau/darray.hpp
@@ -260,7 +260,7 @@ namespace jau {
constexpr void ctor_copy_range_check(pointer dest, iterator first, const_iterator last) {
DARRAY_PRINTF("ctor_copy_range_check [%zd .. %zd] -> ??, dist %zd\n", (first-begin_), (last-begin_)-1, (last-first));
if( first > last ) {
- throw jau::IllegalArgumentException("first "+aptrHexString(first)+" > last "+aptrHexString(last), E_FILE_LINE);
+ throw jau::IllegalArgumentException("first "+to_hexstring(first)+" > last "+to_hexstring(last), E_FILE_LINE);
}
for(; first < last; ++dest, ++first) {
new (dest) value_type( *first ); // placement new
@@ -1136,15 +1136,15 @@ namespace jau {
constexpr_cxx20 std::string get_info() const noexcept {
difference_type cap_ = (storage_end_-begin_);
difference_type size_ = (end_-begin_);
- std::string res("darray[this "+jau::aptrHexString(this)+
+ std::string res("darray[this "+jau::to_hexstring(this)+
", size "+std::to_string(size_)+"/"+std::to_string(cap_)+
", growth "+std::to_string(growth_factor_)+
", uses[mmm "+std::to_string(uses_memmove)+
", ralloc "+std::to_string(uses_realloc)+
", smem "+std::to_string(sec_mem)+
- "], begin "+jau::aptrHexString(begin_)+
- ", end "+jau::aptrHexString(end_)+
- ", send "+jau::aptrHexString(storage_end_)+
+ "], begin "+jau::to_hexstring(begin_)+
+ ", end "+jau::to_hexstring(end_)+
+ ", send "+jau::to_hexstring(storage_end_)+
"]");
return res;
}
diff --git a/include/jau/function_def.hpp b/include/jau/function_def.hpp
index cee2e12..3d80225 100644
--- a/include/jau/function_def.hpp
+++ b/include/jau/function_def.hpp
@@ -167,7 +167,7 @@ namespace jau {
std::string toString() const override {
// hack to convert member pointer to void *: '*((void**)&member)'
- return "ClassInvocation "+uint64HexString((uint64_t)base)+"->"+aptrHexString( *((void**)&member) );
+ return "ClassInvocation "+to_hexstring((uint64_t)base)+"->"+to_hexstring( *((void**)&member) );
}
};
@@ -208,7 +208,7 @@ namespace jau {
std::string toString() const override {
// hack to convert function pointer to void *: '*((void**)&function)'
- return "PlainInvocation "+aptrHexString( *((void**)&function) );
+ return "PlainInvocation "+to_hexstring( *((void**)&function) );
}
};
@@ -257,7 +257,7 @@ namespace jau {
std::string toString() const override {
// hack to convert function pointer to void *: '*((void**)&function)'
- return "CaptureInvocation "+aptrHexString( *((void**)&function) );
+ return "CaptureInvocation "+to_hexstring( *((void**)&function) );
}
};
@@ -301,7 +301,7 @@ namespace jau {
}
std::string toString() const override {
- return "StdInvocation "+uint64HexString( id );
+ return "StdInvocation "+to_hexstring( id );
}
};
diff --git a/include/jau/java_uplink.hpp b/include/jau/java_uplink.hpp
index d66a9ac..8baca17 100644
--- a/include/jau/java_uplink.hpp
+++ b/include/jau/java_uplink.hpp
@@ -59,7 +59,7 @@ namespace jau {
std::shared_ptr<JavaAnon> javaObjectRef;
public:
- virtual std::string toString() const noexcept { return "JavaUplink["+jau::aptrHexString(this)+"]"; }
+ virtual std::string toString() const noexcept { return "JavaUplink["+jau::to_hexstring(this)+"]"; }
virtual std::string get_java_class() const noexcept = 0;
diff --git a/include/jau/jni/helper_jni.hpp b/include/jau/jni/helper_jni.hpp
index c90c816..b5689c9 100644
--- a/include/jau/jni/helper_jni.hpp
+++ b/include/jau/jni/helper_jni.hpp
@@ -173,7 +173,7 @@ namespace jau {
std::string toString() const noexcept override {
const uint64_t ref = (uint64_t)(void*)javaObjectRef.getObject();
- return "JavaGlobalObj["+uint64HexString(ref)+"]";
+ return "JavaGlobalObj["+to_hexstring(ref)+"]";
}
/** Clears the java reference, i.e. nulling it, without deleting the global reference via JNI. */
diff --git a/include/jau/string_util.hpp b/include/jau/string_util.hpp
index 54578a8..f6045d6 100644
--- a/include/jau/string_util.hpp
+++ b/include/jau/string_util.hpp
@@ -92,74 +92,33 @@ namespace jau {
std::string& byteHexString(std::string& dest, const uint8_t value, const bool lowerCase) noexcept;
/**
- * Produce a lower-case hexadecimal string representation of the given uint8_t values.
- * @param v the value
+ * Produce a lower-case hexadecimal string representation of the given pointer.
+ * @tparam value_type a pointer type
+ * @param v the pointer of given pointer type
* @return the hex-string representation of the value
+ * @see bytesHexString()
*/
- inline std::string uint8HexString(const uint8_t v) noexcept {
- return bytesHexString(pointer_cast<const uint8_t*>(&v), 0, sizeof(v), false /* lsbFirst */);
- }
-
- /**
- * Produce a lower-case hexadecimal string representation of the given uint16_t value.
- * @param v the value
- * @return the hex-string representation of the value
- */
- inline std::string uint16HexString(const uint16_t v) noexcept {
- return bytesHexString(pointer_cast<const uint8_t*>(&v), 0, sizeof(v), false /* lsbFirst */);
- }
-
- /**
- * Produce a lower-case hexadecimal string representation of the given uint32_t value.
- * @param v the value
- * @return the hex-string representation of the value
- */
- inline std::string uint32HexString(const uint32_t v) noexcept {
- return bytesHexString(pointer_cast<const uint8_t*>(&v), 0, sizeof(v), false /* lsbFirst */);
- }
-
- /**
- * Produce a lower-case hexadecimal string representation of the given uint64_t value.
- * @param v the value
- * @return the hex-string representation of the value
- */
- inline std::string uint64HexString(const uint64_t& v) noexcept {
- return bytesHexString(pointer_cast<const uint8_t*>(&v), 0, sizeof(v), false /* lsbFirst */);
- }
-
- /**
- * Produce a lower-case hexadecimal string representation of the given 'void *' value.
- * @param v the value
- * @return the hex-string representation of the value
- */
- inline std::string aptrHexString(const void * v) noexcept {
- return uint64HexString(reinterpret_cast<uint64_t>(v));
- }
-
- /**
- * Produce a lower-case hexadecimal string representation of the given uint128_t value.
- * @param v the value
- * @return the hex-string representation of the value
- */
- inline std::string uint128HexString(const uint128_t& v) noexcept {
- return bytesHexString(v.data, 0, sizeof(v.data), false /* lsbFirst */);
+ template< class value_type,
+ std::enable_if_t<std::is_pointer_v<value_type>,
+ bool> = true>
+ std::string to_hexstring(value_type const & v) noexcept
+ {
+ const uint64_t v2 = reinterpret_cast<uint64_t>(v);
+ return bytesHexString(pointer_cast<const uint8_t*>(&v2), 0, sizeof(v), false /* lsbFirst */);
}
/**
- * Produce a lower-case hexadecimal string representation of the given uint256_t value.
- * @param v the value
+ * Produce a lower-case hexadecimal string representation of the given value with standard layout.
+ * @tparam value_type a standard layout value type
+ * @param v the value of given standard layout type
* @return the hex-string representation of the value
+ * @see bytesHexString()
*/
- inline std::string uint256HexString(const uint256_t& v) noexcept {
- return bytesHexString(v.data, 0, sizeof(v.data), false /* lsbFirst */);
- }
-
- template<typename T>
- inline
- typename std::enable_if_t<
- std::is_standard_layout_v<T>,
- std::string>
- to_hex_string(T const & v) noexcept
+ template< class value_type,
+ std::enable_if_t<!std::is_pointer_v<value_type> &&
+ std::is_standard_layout_v<value_type>,
+ bool> = true>
+ std::string to_hexstring(value_type const & v) noexcept
{
return bytesHexString(pointer_cast<const uint8_t*>(&v), 0, sizeof(v), false /* lsbFirst */);
}
@@ -178,10 +137,12 @@ namespace jau {
* @param width the minimum number of characters to be printed. Add padding with blank space if result is shorter.
* @return the string representation of the integral integer value
*/
- template<class T>
- std::string to_decimal_string(const T& v, const char separator=',', const nsize_t width=0) noexcept {
- const snsize_t v_sign = jau::sign<T>(v);
- const nsize_t digit10_count1 = jau::digits10<T>(v, v_sign, true /* sign_is_digit */);
+ template< class value_type,
+ std::enable_if_t< std::is_integral_v<value_type>,
+ bool> = true>
+ std::string to_decstring(const value_type& v, const char separator=',', const nsize_t width=0) noexcept {
+ const snsize_t v_sign = jau::sign<value_type>(v);
+ const nsize_t digit10_count1 = jau::digits10<value_type>(v, v_sign, true /* sign_is_digit */);
const nsize_t digit10_count2 = v_sign < 0 ? digit10_count1 - 1 : digit10_count1; // less sign
const nsize_t comma_count = 0 == separator ? 0 : ( digit10_count1 - 1 ) / 3;
@@ -189,7 +150,7 @@ namespace jau {
const nsize_t total_chars = std::max<nsize_t>(width, net_chars);
std::string res(total_chars, ' ');
- T n = v;
+ value_type n = v;
nsize_t char_iter = 0;
for(nsize_t digit10_iter = 0; digit10_iter < digit10_count2 /* && char_iter < total_chars */; digit10_iter++ ) {
@@ -207,50 +168,6 @@ namespace jau {
}
/**
- * Produce a decimal string representation of an int32_t value.
- * @param v the value
- * @param separator if not 0, use as separation character, otherwise no separation characters are being used
- * @param width the minimum number of characters to be printed. Add padding with blank space if result is shorter.
- * @return the string representation of the value
- */
- inline std::string int32DecString(const int32_t v, const char separator=',', const nsize_t width=0) noexcept {
- return to_decimal_string<int32_t>(v, separator, width);
- }
-
- /**
- * Produce a decimal string representation of a uint32_t value.
- * @param v the value
- * @param separator if not 0, use as separation character, otherwise no separation characters are being used
- * @param width the minimum number of characters to be printed. Add padding with blank space if result is shorter.
- * @return the string representation of the value
- */
- inline std::string uint32DecString(const uint32_t v, const char separator=',', const nsize_t width=0) noexcept {
- return to_decimal_string<uint32_t>(v, separator, width);
- }
-
- /**
- * Produce a decimal string representation of an int64_t value.
- * @param v the value
- * @param separator if not 0, use as separation character, otherwise no separation characters are being used
- * @param width the minimum number of characters to be printed. Add padding with blank space if result is shorter.
- * @return the string representation of the value
- */
- inline std::string int64DecString(const int64_t& v, const char separator=',', const nsize_t width=0) noexcept {
- return to_decimal_string<int64_t>(v, separator, width);
- }
-
- /**
- * Produce a decimal string representation of a uint64_t value.
- * @param v the value
- * @param separator if not 0, use as separation character, otherwise no separation characters are being used
- * @param width the minimum number of characters to be printed. Add padding with blank space if result is shorter.
- * @return the string representation of the value
- */
- inline std::string uint64DecString(const uint64_t& v, const char separator=',', const nsize_t width=0) noexcept {
- return to_decimal_string<uint64_t>(v, separator, width);
- }
-
- /**
// *************************************************
// *************************************************
// *************************************************
@@ -271,7 +188,7 @@ namespace jau {
bool> = true>
std::string to_string(const value_type & ref)
{
- return aptrHexString((void*)ref);
+ return to_hexstring((void*)ref);
}
template< class value_type,
@@ -304,7 +221,7 @@ namespace jau {
jau::has_member_of_pointer_v<value_type>,
bool> = true>
std::string to_string(const value_type & ref) {
- return aptrHexString((void*)ref.operator->());
+ return to_hexstring((void*)ref.operator->());
}
template< class value_type,
@@ -323,7 +240,7 @@ namespace jau {
} // namespace jau
/** \example test_intdecstring01.cpp
- * This C++ unit test validates the jau::to_decimal_string implementation
+ * This C++ unit test validates the jau::to_decstring implementation
*/
#endif /* JAU_STRING_UTIL_HPP_ */
diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh
index a4a0a65..64c5d68 100644
--- a/scripts/rebuild.sh
+++ b/scripts/rebuild.sh
@@ -26,7 +26,7 @@ buildit() {
echo CPU_COUNT $CPU_COUNT
cd $rootdir/build-$archabi
- make -j $CPU_COUNT install test
+ make -j $CPU_COUNT install
if [ $? -eq 0 ] ; then
echo "REBUILD SUCCESS $bname $archabi"
cd $rootdir
diff --git a/src/debug.cpp b/src/debug.cpp
index dd51186..4cc228e 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -94,7 +94,7 @@ void jau::print_backtrace(const bool skip_anon_frames, const jau::snsize_t max_f
}
void jau::DBG_PRINT_impl(const char * format, ...) noexcept {
- fprintf(stderr, "[%s] Debug: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str());
+ fprintf(stderr, "[%s] Debug: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str());
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
@@ -104,7 +104,7 @@ void jau::DBG_PRINT_impl(const char * format, ...) noexcept {
}
void jau::WORDY_PRINT_impl(const char * format, ...) noexcept {
- fprintf(stderr, "[%s] Wordy: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str());
+ fprintf(stderr, "[%s] Wordy: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str());
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
@@ -114,7 +114,7 @@ void jau::WORDY_PRINT_impl(const char * format, ...) noexcept {
}
void jau::ABORT_impl(const char *func, const char *file, const int line, const char * format, ...) noexcept {
- fprintf(stderr, "[%s] ABORT @ %s:%d %s: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
+ fprintf(stderr, "[%s] ABORT @ %s:%d %s: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
@@ -126,7 +126,7 @@ void jau::ABORT_impl(const char *func, const char *file, const int line, const c
}
void jau::ERR_PRINTv(const char *func, const char *file, const int line, const char * format, va_list args) noexcept {
- fprintf(stderr, "[%s] Error @ %s:%d %s: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
+ fprintf(stderr, "[%s] Error @ %s:%d %s: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
vfprintf(stderr, format, args);
fprintf(stderr, "; last errno %d %s\n", errno, strerror(errno));
fflush(stderr);
@@ -134,7 +134,7 @@ void jau::ERR_PRINTv(const char *func, const char *file, const int line, const c
}
void jau::ERR_PRINT_impl(const char *prefix, const bool backtrace, const char *func, const char *file, const int line, const char * format, ...) noexcept {
- fprintf(stderr, "[%s] %s @ %s:%d %s: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str(), prefix, file, line, func);
+ fprintf(stderr, "[%s] %s @ %s:%d %s: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str(), prefix, file, line, func);
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
@@ -147,14 +147,14 @@ void jau::ERR_PRINT_impl(const char *prefix, const bool backtrace, const char *f
}
void jau::WARN_PRINTv(const char *func, const char *file, const int line, const char * format, va_list args) noexcept {
- fprintf(stderr, "[%s] Warning @ %s:%d %s: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
+ fprintf(stderr, "[%s] Warning @ %s:%d %s: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
fflush(stderr);
}
void jau::WARN_PRINT_impl(const char *func, const char *file, const int line, const char * format, ...) noexcept {
- fprintf(stderr, "[%s] Warning @ %s:%d %s: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
+ fprintf(stderr, "[%s] Warning @ %s:%d %s: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str(), file, line, func);
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
@@ -164,7 +164,7 @@ void jau::WARN_PRINT_impl(const char *func, const char *file, const int line, co
}
void jau::INFO_PRINT(const char * format, ...) noexcept {
- fprintf(stderr, "[%s] Info: ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str());
+ fprintf(stderr, "[%s] Info: ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str());
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
@@ -175,7 +175,7 @@ void jau::INFO_PRINT(const char * format, ...) noexcept {
void jau::PLAIN_PRINT(const bool printPrefix, const char * format, ...) noexcept {
if( printPrefix ) {
- fprintf(stderr, "[%s] ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str());
+ fprintf(stderr, "[%s] ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str());
}
va_list args;
va_start (args, format);
@@ -186,7 +186,7 @@ void jau::PLAIN_PRINT(const bool printPrefix, const char * format, ...) noexcept
}
void jau::COND_PRINT_impl(const char * format, ...) noexcept {
- fprintf(stderr, "[%s] ", jau::uint64DecString(environment::getElapsedMillisecond(), ',', 9).c_str());
+ fprintf(stderr, "[%s] ", jau::to_decstring(environment::getElapsedMillisecond(), ',', 9).c_str());
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
diff --git a/test/test_basictypeconv.cpp b/test/test_basictypeconv.cpp
index 6d56287..6859089 100644
--- a/test/test_basictypeconv.cpp
+++ b/test/test_basictypeconv.cpp
@@ -112,9 +112,9 @@ static void test_byteorder(const Value_type v_cpu,
{
if( VERBOSE ) {
fprintf(stderr, "test_byteorder: sizeof %zu; platform littleEndian %d", sizeof(Value_type), jau::isLittleEndian());
- fprintf(stderr, "\ncpu: %s: ", jau::to_hex_string(v_cpu).c_str()); print(v_cpu);
- fprintf(stderr, "\nle_: %s: ", jau::to_hex_string(v_le).c_str()); print(v_le);
- fprintf(stderr, "\nbe_: %s: ", jau::to_hex_string(v_be).c_str()); print(v_be);
+ fprintf(stderr, "\ncpu: %s: ", jau::to_hexstring(v_cpu).c_str()); print(v_cpu);
+ fprintf(stderr, "\nle_: %s: ", jau::to_hexstring(v_le).c_str()); print(v_le);
+ fprintf(stderr, "\nbe_: %s: ", jau::to_hexstring(v_be).c_str()); print(v_be);
fprintf(stderr, "\n");
}
{
@@ -284,9 +284,9 @@ template<typename Value_type>
static void test_value_littlebig(const Value_type v_cpu, const Value_type v_le, const Value_type v_be) {
if( VERBOSE ) {
fprintf(stderr, "test_value_littlebig: sizeof %zu; platform littleEndian %d", sizeof(Value_type), jau::isLittleEndian());
- fprintf(stderr, "\ncpu: %s: ", jau::to_hex_string(v_cpu).c_str()); print(v_cpu);
- fprintf(stderr, "\nle_: %s: ", jau::to_hex_string(v_le).c_str()); print(v_le);
- fprintf(stderr, "\nbe_: %s: ", jau::to_hex_string(v_be).c_str()); print(v_be);
+ fprintf(stderr, "\ncpu: %s: ", jau::to_hexstring(v_cpu).c_str()); print(v_cpu);
+ fprintf(stderr, "\nle_: %s: ", jau::to_hexstring(v_le).c_str()); print(v_le);
+ fprintf(stderr, "\nbe_: %s: ", jau::to_hexstring(v_be).c_str()); print(v_be);
fprintf(stderr, "\n");
}
uint8_t buffer[2 * sizeof(Value_type)];
diff --git a/test/test_cow_darray_perf01.cpp b/test/test_cow_darray_perf01.cpp
index 4de9906..ca121e5 100644
--- a/test/test_cow_darray_perf01.cpp
+++ b/test/test_cow_darray_perf01.cpp
@@ -298,7 +298,7 @@ static void print_mem(const std::string& pre, const T& data) {
std::size_t bytes_total = data.get_allocator().memory_usage;
double overhead = 0 == bytes_total ? 0.0 : ( 0 == bytes_net ? 10.0 : (double)bytes_total / (double)bytes_net );
printf("Mem: %s: Elements %s x %zu bytes; %s, %lf ratio\n",
- pre.c_str(), int64DecString(elements, ',', 5).c_str(),
+ pre.c_str(), to_decstring(elements, ',', 5).c_str(),
bytes_element, data.get_allocator().toString(10, 5).c_str(), overhead);
// 5: 1,000
// 7: 100,000
diff --git a/test/test_cow_iterator_01.cpp b/test/test_cow_iterator_01.cpp
index 48c5a6b..da82e5d 100644
--- a/test/test_cow_iterator_01.cpp
+++ b/test/test_cow_iterator_01.cpp
@@ -66,7 +66,7 @@ template<class T>
static void print_list(T& data) {
printf("list: %d { ", (int)data.size());
jau::for_each_const(data, [](const uint64_t & e) {
- printf("%s, ", uint64DecString(e, ',', 2).c_str());
+ printf("%s, ", to_decstring(e, ',', 2).c_str());
} );
printf("}\n");
}
@@ -75,7 +75,7 @@ template<class T>
static void print_list(const std::string& pre, T& data) {
printf("%s: %d { ", pre.c_str(), (int)data.size());
jau::for_each_const(data, [](const uint64_t & e) {
- printf("%s, ", uint64DecString(e, ',', 2).c_str());
+ printf("%s, ", to_decstring(e, ',', 2).c_str());
} );
printf("}\n");
}
@@ -1214,7 +1214,7 @@ static bool test_01_cow_iterator_properties(const std::string& type_id) {
REQUIRE( c_begin1 == m_begin1);
REQUIRE( ( c_begin1 - m_begin1 ) == 0);
printf(" 1st store: %s == %s, dist %u\n",
- uint64DecString(*c_begin1, ',', 2).c_str(), uint64DecString(*m_begin1, ',', 2).c_str(), (unsigned int)(c_begin1 - m_begin1));
+ to_decstring(*c_begin1, ',', 2).c_str(), to_decstring(*m_begin1, ',', 2).c_str(), (unsigned int)(c_begin1 - m_begin1));
citer_type c_begin2;
{
iter_type m_begin2 = data.begin(); // mutable new_store non-const iterator, gets held until write_back() or destruction
@@ -1224,13 +1224,13 @@ static bool test_01_cow_iterator_properties(const std::string& type_id) {
REQUIRE( c_begin2 == m_begin2);
REQUIRE( ( c_begin2 - m_begin2 ) == 0);
printf(" 2nd store: %s == %s, dist %u\n",
- uint64DecString(*c_begin2, ',', 2).c_str(), uint64DecString(*m_begin2, ',', 2).c_str(), (unsigned int)(c_begin2 - m_begin2));
+ to_decstring(*c_begin2, ',', 2).c_str(), to_decstring(*m_begin2, ',', 2).c_str(), (unsigned int)(c_begin2 - m_begin2));
REQUIRE(*c_begin2 == *c_begin1);
REQUIRE( c_begin2 != c_begin1);
REQUIRE( ( c_begin2 - c_begin1 ) != 0);
printf("2nd -> 1st store: %s == %s, dist %u\n",
- uint64DecString(*c_begin2, ',', 2).c_str(), uint64DecString(*c_begin1, ',', 2).c_str(), (unsigned int)(c_begin2 - c_begin1));
+ to_decstring(*c_begin2, ',', 2).c_str(), to_decstring(*c_begin1, ',', 2).c_str(), (unsigned int)(c_begin2 - c_begin1));
m_begin2.write_back(); // write back storage of m_begin2 to parent CoW and invalidate m_begin2
}
@@ -1240,16 +1240,16 @@ static bool test_01_cow_iterator_properties(const std::string& type_id) {
REQUIRE( c_begin2 == c_begin2b);
REQUIRE( ( c_begin2 - c_begin2b ) == 0);
printf("2nd -> cow == cbegin: %s == %s, dist %u\n",
- uint64DecString(*c_begin2, ',', 2).c_str(), uint64DecString(*c_begin2b, ',', 2).c_str(), (unsigned int)(c_begin2 - c_begin2b));
+ to_decstring(*c_begin2, ',', 2).c_str(), to_decstring(*c_begin2b, ',', 2).c_str(), (unsigned int)(c_begin2 - c_begin2b));
printf("2nd -> 1st : %s == %s, dist %u\n",
- uint64DecString(*c_begin1, ',', 2).c_str(), uint64DecString(*c_begin2, ',', 2).c_str(), (unsigned int)(c_begin1 - c_begin2));
+ to_decstring(*c_begin1, ',', 2).c_str(), to_decstring(*c_begin2, ',', 2).c_str(), (unsigned int)(c_begin1 - c_begin2));
m_begin1.write_back(); // write back storage of m_begin1 to parent CoW and invalidate m_begin2
}
// 1st store -> cow_xxx
citer_type c_begin1b = data.cbegin();
printf("1st -> cow == cbegin: %s == %s, dist %u\n",
- uint64DecString(*c_begin1, ',', 2).c_str(), uint64DecString(*c_begin1b, ',', 2).c_str(), (unsigned int)(c_begin1 - c_begin1b));
+ to_decstring(*c_begin1, ',', 2).c_str(), to_decstring(*c_begin1b, ',', 2).c_str(), (unsigned int)(c_begin1 - c_begin1b));
REQUIRE(*c_begin1 == *c_begin1b);
REQUIRE( c_begin1 == c_begin1b);
REQUIRE( ( c_begin1 - c_begin1b ) == 0);
diff --git a/test/test_hashset_perf01.cpp b/test/test_hashset_perf01.cpp
index 223c05d..0ae3e4f 100644
--- a/test/test_hashset_perf01.cpp
+++ b/test/test_hashset_perf01.cpp
@@ -156,7 +156,7 @@ static void print_mem(const std::string& pre, const T& data) {
std::size_t bytes_total = data.get_allocator().memory_usage;
double overhead = 0 == bytes_total ? 0.0 : ( 0 == bytes_net ? 10.0 : (double)bytes_total / (double)bytes_net );
printf("Mem: %s: Elements %s x %zu bytes; %s, %lf ratio\n",
- pre.c_str(), int64DecString(elements, ',', 5).c_str(),
+ pre.c_str(), to_decstring(elements, ',', 5).c_str(),
bytes_element, data.get_allocator().toString(10, 5).c_str(), overhead);
// 5: 1,000
// 7: 100,000
diff --git a/test/test_intdecstring01.cpp b/test/test_intdecstring01.cpp
index 2f4dd5c..64abffb 100644
--- a/test/test_intdecstring01.cpp
+++ b/test/test_intdecstring01.cpp
@@ -66,7 +66,7 @@ using namespace jau;
INFO(msg+": value commas "+std::to_string(comma_count));
INFO(msg+": value net_chars "+std::to_string(net_chars));
INFO(msg+": value total_chars "+std::to_string(total_chars));
- std::string s = to_decimal_string<T>(value, use_separator ? ',' : 0, min_width);
+ std::string s = to_decstring<T>(value, use_separator ? ',' : 0, min_width);
INFO(msg+": result '"+s+"', len "+std::to_string(s.length()));
}
#endif
@@ -75,7 +75,7 @@ static void test_int32_t(const std::string msg, const int32_t v, const size_t ex
#if SHOW_DECIMAL_STRING_STATS
show_decimal_string_stats<int32_t>(msg, v, true /* use_separator */, 0 /* min_width */);
#endif
- const std::string str = int32DecString(v);
+ const std::string str = to_decstring(v);
INFO(msg+": has '"+str+"', len "+std::to_string(str.length()));
INFO(msg+": exp '"+expStr+"', len "+std::to_string(expStr.length())+", equal: "+std::to_string(str==expStr));
REQUIRE(str.length() == expStrLen);
@@ -87,7 +87,7 @@ static void test_uint32_t(const std::string msg, const uint32_t v, const size_t
show_decimal_string_stats<uint32_t>(msg, v, true /* use_separator */, 0 /* min_width */);
#endif
- const std::string str = uint32DecString(v);
+ const std::string str = to_decstring(v);
INFO(msg+": has '"+str+"', len "+std::to_string(str.length()));
INFO(msg+": exp '"+expStr+"', len "+std::to_string(expStr.length())+", equal: "+std::to_string(str==expStr));
REQUIRE(str.length() == expStrLen);
@@ -99,7 +99,7 @@ static void test_uint64_t(const std::string msg, const uint64_t v, const size_t
show_decimal_string_stats<uint64_t>(msg, v, true /* use_separator */, 0 /* min_width */);
#endif
- const std::string str = uint64DecString(v);
+ const std::string str = to_decstring(v);
INFO(msg+": has '"+str+"', len "+std::to_string(str.length()));
INFO(msg+": exp '"+expStr+"', len "+std::to_string(expStr.length())+", equal: "+std::to_string(str==expStr));
REQUIRE(str.length() == expStrLen);
diff --git a/test/test_to_string.cpp b/test/test_to_string.cpp
index e00d2f0..a08f7c8 100644
--- a/test/test_to_string.cpp
+++ b/test/test_to_string.cpp
@@ -80,11 +80,11 @@ TEST_CASE( "JAU to_string() Test 00 - jau::to_string() std::string conversion",
vec_int_1.push_back(1); vec_int_1.push_back(2); vec_int_1.push_back(3);
std_vec_int_citer vec_int_citer_1B = vec_int_1.cbegin();
uint8_t* vec_int_citer_1B_ptr = (uint8_t*)(vec_int_citer_1B.operator->());
- std::string vec_int_citer_1B_str = aptrHexString(vec_int_citer_1B_ptr);
+ std::string vec_int_citer_1B_str = to_hexstring(vec_int_citer_1B_ptr);
std_vec_int_citer vec_int_citer_1E = vec_int_1.cend();
uint8_t* vec_int_citer_1E_ptr = (uint8_t*)(vec_int_citer_1E.operator->());
- std::string vec_int_citer_1E_str = aptrHexString(vec_int_citer_1E_ptr);
+ std::string vec_int_citer_1E_str = to_hexstring(vec_int_citer_1E_ptr);
std::ptrdiff_t vec_int_citer_1E_1B_ptrdiff = vec_int_citer_1E_ptr - vec_int_citer_1B_ptr;
int vec_int_citer_1E_1B_ptr_count = vec_int_citer_1E_1B_ptrdiff / sizeof(int);