3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-22 05:43:39 +00:00
This commit is contained in:
Nuno Lopes 2021-05-23 12:01:04 +01:00
parent fd0778c3d0
commit 34e8a2f0f6
2 changed files with 5 additions and 11 deletions

View file

@ -276,16 +276,10 @@ bool operator<(const zstring& lhs, const zstring& rhs) {
for (unsigned i = 0; i < len; ++i) { for (unsigned i = 0; i < len; ++i) {
unsigned Li = lhs[i]; unsigned Li = lhs[i];
unsigned Ri = rhs[i]; unsigned Ri = rhs[i];
if (Li < Ri) { if (Li != Ri)
return true; return Li < Ri;
}
else if (Li > Ri) {
return false;
}
} }
// at this point, all compared characters are equal, // at this point, all compared characters are equal,
// so decide based on the relative lengths // so decide based on the relative lengths
return lhs.length() < rhs.length(); return lhs.length() < rhs.length();
} }

View file

@ -16,14 +16,14 @@ Author:
--*/ --*/
#pragma once #pragma once
#include <cstdint>
#include <string> #include <string>
#include "util/vector.h"
#include "util/buffer.h" #include "util/buffer.h"
#include "util/rational.h" #include "util/rational.h"
class zstring { class zstring {
private: private:
buffer<unsigned> m_buffer; buffer<uint32_t> m_buffer;
bool well_formed() const; bool well_formed() const;
bool uses_unicode() const; bool uses_unicode() const;
bool is_escape_char(char const *& s, unsigned& result); bool is_escape_char(char const *& s, unsigned& result);
@ -32,7 +32,7 @@ public:
static unsigned unicode_num_bits() { return 18; } static unsigned unicode_num_bits() { return 18; }
static unsigned ascii_max_char() { return 255; } static unsigned ascii_max_char() { return 255; }
static unsigned ascii_num_bits() { return 8; } static unsigned ascii_num_bits() { return 8; }
zstring() {} zstring() = default;
zstring(char const* s); zstring(char const* s);
zstring(const std::string &str) : zstring(str.c_str()) {} zstring(const std::string &str) : zstring(str.c_str()) {}
zstring(rational const& r): zstring(r.to_string()) {} zstring(rational const& r): zstring(r.to_string()) {}