|
@@ -10,11 +10,8 @@ namespace Core {
|
|
|
class ArrayString final {
|
|
|
int length;
|
|
|
u32 hash;
|
|
|
- static constexpr int DATA_LENGTH =
|
|
|
- (N - Math::max(CORE_SIZE(length), CORE_SIZE(hash))) /
|
|
|
- CORE_SIZE(u32);
|
|
|
- static_assert(DATA_LENGTH > 0, "Size of array string too small");
|
|
|
- u32 data[static_cast<unsigned int>(DATA_LENGTH)];
|
|
|
+ static_assert(N > 0, "size of array string must be positive");
|
|
|
+ u32 data[static_cast<unsigned int>(N)];
|
|
|
|
|
|
public:
|
|
|
ArrayString() : length(0), hash(0) {
|
|
@@ -62,7 +59,7 @@ namespace Core {
|
|
|
}
|
|
|
|
|
|
constexpr int getCapacity() const {
|
|
|
- return DATA_LENGTH;
|
|
|
+ return N;
|
|
|
}
|
|
|
|
|
|
check_return Error append(char c) {
|
|
@@ -151,7 +148,7 @@ namespace Core {
|
|
|
}
|
|
|
|
|
|
check_return Error appendUnicode(u32 c) {
|
|
|
- if(length >= DATA_LENGTH) {
|
|
|
+ if(length >= N) {
|
|
|
return Error::CAPACITY_REACHED;
|
|
|
}
|
|
|
data[length++] = c;
|