3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +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) {
unsigned Li = lhs[i];
unsigned Ri = rhs[i];
if (Li < Ri) {
return true;
}
else if (Li > Ri) {
return false;
}
if (Li != Ri)
return Li < Ri;
}
// at this point, all compared characters are equal,
// so decide based on the relative lengths
return lhs.length() < rhs.length();
}

View file

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