some features

in main.cpp fastest Variant implementation
This commit is contained in:
2020-08-05 00:53:27 +03:00
parent 9cd108cf20
commit 70a7363f76
5 changed files with 262 additions and 97 deletions

View File

@@ -371,4 +371,7 @@
* \fn bool PIMapIterator::next()
* \brief Jump to next entry and return if new position is valid.
* \fn void PIMapIterator::reset()
* \brief Reset iterator to initial position.
* */

View File

@@ -364,6 +364,13 @@ public:
}
return false;
}
inline void reset() {
if (rev) {
pos = m.size_s();
} else {
pos = -1;
}
}
private:
const MapType & m;
ssize_t pos;

View File

@@ -467,7 +467,7 @@ uint letobe_i(uint v) {return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF
#endif
/// \brief Generic hash function, impements murmur3/32 algorithm
/// \brief Generic hash function, implements murmur3/32 algorithm
inline uint piHashData(const uchar * data, uint len, uint seed = 0) {
if (!data || len <= 0) return 0u;
uint h = seed;

View File

@@ -337,6 +337,16 @@ public:
* \sa \a expandRightTo() */
PIString & expandLeftTo(const int len, const PIChar c) {if (len > length()) insert(0, PIString(len - length(), c)); return *this;}
/*! \brief Enlarge and returns copy of this string to length "len"
* by addition sequence of symbols "c" at the end of string
* \sa \a expandRightTo() */
PIString expandedRightTo(const int len, const PIChar c) const {return PIString(*this).expandRightTo(len, c);}
/*! \brief Enlarge and returns copy of this string to length "len"
* by addition sequence of symbols "c" at the beginning of string
* \sa \a expandLeftTo() */
PIString expandedLeftTo(const int len, const PIChar c) const {return PIString(*this).expandLeftTo(len, c);}
/*! \brief Add "c" symbols at the beginning and end of the string, and return this string
* \sa \a quoted() */
PIString & quote(PIChar c = PIChar('"')) {insert(0, c); *this += c; return *this;}