--- parser3/src/include/pa_array.h 2024/09/16 23:22:52 1.94 +++ parser3/src/include/pa_array.h 2024/10/07 23:46:24 1.97 @@ -8,7 +8,7 @@ #ifndef PA_ARRAY_H #define PA_ARRAY_H -#define IDENT_PA_ARRAY_H "$Id: pa_array.h,v 1.94 2024/09/16 23:22:52 moko Exp $" +#define IDENT_PA_ARRAY_H "$Id: pa_array.h,v 1.97 2024/10/07 23:46:24 moko Exp $" // includes @@ -53,9 +53,9 @@ public: bool defined; Action_options( - size_t aoffset=0, - size_t alimit=ARRAY_OPTION_LIMIT_ALL, - bool areverse=false): + size_t aoffset=0, + size_t alimit=ARRAY_OPTION_LIMIT_ALL, + bool areverse=false): offset(aoffset), limit(alimit), reverse(areverse), defined(false) {} @@ -71,7 +71,7 @@ public: if(!m) return false; // fix limit - if(limit==ARRAY_OPTION_LIMIT_ALL || limit>m) + if(limit>m) limit=m; return true; @@ -110,7 +110,7 @@ public: /// append other Array portion to this one. starting from offset Array& append(const Array& src, size_t offset=0, - size_t limit=ARRAY_OPTION_LIMIT_ALL) { //< negative limit means 'all'. zero limit means 'nothing' + size_t limit=ARRAY_OPTION_LIMIT_ALL) { //< zero limit means 'nothing' size_t src_count=src.count(); // skip tivials @@ -119,7 +119,7 @@ public: // max(limit) size_t m=src_count-offset; // fix limit - if(limit==ARRAY_OPTION_LIMIT_ALL || limit>m) + if(limit>m) limit=m; fit(fsize-1+limit); @@ -221,7 +221,7 @@ protected: } inline void expand() { - resize(fallocated>0 ? fallocated+fallocated/4+2 : 3); // 3 is PAF default, confirmed by tests + resize(fallocated>0 ? fallocated+fallocated/2+2 : 3); // 3 is PAF default, confirmed by tests } inline void fit(size_t index){ @@ -259,7 +259,7 @@ template char* pa_itoa(T n, } do { - *(--pos)=(n % base) + '0'; + *(--pos)=(char)(n % base) + '0'; n/=base; } while (n > 0); @@ -275,7 +275,7 @@ template char* pa_uitoa(T n, *pos='\0'; do { - *(--pos)=(n % base) + '0'; + *(--pos)=(char)(n % base) + '0'; n/=base; } while (n > 0);