Browse Source

Equip vectors (cl_[SG]V_*) with STL-alike size() method.

master
Alexei Sheplyakov 16 years ago
parent
commit
2ed9ef84d3
  1. 6
      doc/cln.texi
  2. 10
      include/cln/GV.h
  3. 10
      include/cln/SV.h
  4. 8
      include/cln/string.h
  5. 4
      src/base/string/cl_spushstring.h
  6. 2
      src/base/string/cl_st_debug.cc
  7. 2
      src/base/string/cl_st_hashcode.cc
  8. 2
      src/base/string/output/cl_st_print.cc
  9. 16
      src/polynomial/elem/cl_UP_GF2.h
  10. 38
      src/polynomial/elem/cl_UP_MI.h
  11. 38
      src/polynomial/elem/cl_UP_gen.h
  12. 38
      src/polynomial/elem/cl_UP_number.h
  13. 10
      src/vector/cl_GV_I.cc
  14. 2
      src/vector/cl_GV_I_copy.cc
  15. 6
      src/vector/cl_GV_number.cc
  16. 2
      src/vector/cl_GV_number_copy.cc
  17. 2
      src/vector/cl_SV_copy.cc
  18. 2
      src/vector/output/cl_GV_number_aprint.cc
  19. 2
      src/vector/output/cl_SV_aprint.cc
  20. 2
      src/vector/output/cl_SV_number_aprint.cc

6
doc/cln.texi

@ -3151,8 +3151,8 @@ The following functions are available on strings:
@item operator = @item operator =
Assignment from @code{cl_string} and @code{const char *}. Assignment from @code{cl_string} and @code{const char *}.
@item s.length()
@cindex @code{length ()}
@item s.size()
@cindex @code{size()}
@itemx strlen(s) @itemx strlen(s)
@cindex @code{strlen ()} @cindex @code{strlen ()}
Returns the length of the string @code{s}. Returns the length of the string @code{s}.
@ -3160,7 +3160,7 @@ Returns the length of the string @code{s}.
@item s[i] @item s[i]
@cindex @code{operator [] ()} @cindex @code{operator [] ()}
Returns the @code{i}th character of the string @code{s}. Returns the @code{i}th character of the string @code{s}.
@code{i} must be in the range @code{0 <= i < s.length()}.
@code{i} must be in the range @code{0 <= i < s.size()}.
@item bool equal (const cl_string& s1, const cl_string& s2) @item bool equal (const cl_string& s1, const cl_string& s2)
@cindex @code{equal ()} @cindex @code{equal ()}

10
include/cln/GV.h

@ -11,7 +11,7 @@
namespace cln { namespace cln {
// A vector is a structure having the following interface: // A vector is a structure having the following interface:
// v.length() returns the number of elements
// v.size() returns the number of elements
// v[i] returns the i-th element (0<=i<length), as a // v[i] returns the i-th element (0<=i<length), as a
// pseudo-lvalue (you can assign to it, but not take its // pseudo-lvalue (you can assign to it, but not take its
// address - exactly what you want for bit-vectors) // address - exactly what you want for bit-vectors)
@ -27,7 +27,7 @@ class cl_GV_inner {
protected: protected:
uintC len; // number of elements uintC len; // number of elements
public: public:
uintC length () const; // number of elements
uintC size() const; // number of elements
cl_GV_vectorops<T>* vectorops; // get/set element cl_GV_vectorops<T>* vectorops; // get/set element
const cl_GV_index<T> operator[] (unsigned long index); const cl_GV_index<T> operator[] (unsigned long index);
const cl_GV_constindex<T> operator[] (unsigned long index) const; const cl_GV_constindex<T> operator[] (unsigned long index) const;
@ -109,7 +109,7 @@ struct cl_GV_vectorops {
// All member functions are inline. // All member functions are inline.
template <class T> template <class T>
inline uintC cl_GV_inner<T>::length () const
inline uintC cl_GV_inner<T>::size() const
{ {
return len; return len;
} }
@ -219,9 +219,9 @@ template <class T, class BASE>
struct cl_GV : public BASE { struct cl_GV : public BASE {
public: public:
// Length. // Length.
uintC length () const
uintC size() const
{ {
return ((const cl_heap_GV<T> *) this->pointer)->v.length();
return ((const cl_heap_GV<T> *) this->pointer)->v.size();
} }
// Reference. Forbid modification of `const cl_GV&' arguments. // Reference. Forbid modification of `const cl_GV&' arguments.
const cl_GV_constindex<T> operator[] (unsigned long index) const const cl_GV_constindex<T> operator[] (unsigned long index) const

10
include/cln/SV.h

@ -46,18 +46,18 @@ private:
T * data() { return (T *) (this+1); } T * data() { return (T *) (this+1); }
const T * data() const { return (const T *) (this+1); } const T * data() const { return (const T *) (this+1); }
public: public:
uintC length () const { return len; } // number of elements
uintC size() const { return len; } // number of elements
const T & operator[] (unsigned long index) const const T & operator[] (unsigned long index) const
{ {
#ifndef CL_SV_NO_RANGECHECKS #ifndef CL_SV_NO_RANGECHECKS
if (!(index < length())) throw runtime_exception();
if (!(index < size())) throw runtime_exception();
#endif #endif
return data()[index]; return data()[index];
} }
T & operator[] (unsigned long index) T & operator[] (unsigned long index)
{ {
#ifndef CL_SV_NO_RANGECHECKS #ifndef CL_SV_NO_RANGECHECKS
if (!(index < length())) throw runtime_exception();
if (!(index < size())) throw runtime_exception();
#endif #endif
return data()[index]; return data()[index];
} }
@ -115,9 +115,9 @@ template <class T, class BASE>
struct cl_SV : public BASE { struct cl_SV : public BASE {
public: public:
// Length. // Length.
uintC length () const
uintC size() const
{ {
return ((const cl_heap_SV<T> *) this->pointer)->v.length();
return ((const cl_heap_SV<T> *) this->pointer)->v.size();
} }
// Reference. Forbid modification of `const cl_SV&' arguments. // Reference. Forbid modification of `const cl_SV&' arguments.
const T & operator[] (unsigned long index) const const T & operator[] (unsigned long index) const

8
include/cln/string.h

@ -45,14 +45,14 @@ public:
return &((cl_heap_string*)pointer)->data[0]; return &((cl_heap_string*)pointer)->data[0];
} }
// Return the length (number of characters). // Return the length (number of characters).
unsigned long length () const
unsigned long size() const
{ {
return ((cl_heap_string*)pointer)->length; return ((cl_heap_string*)pointer)->length;
} }
// Return a specific character. // Return a specific character.
char operator[] (unsigned long i) const char operator[] (unsigned long i) const
{ {
if (!(i < length())) throw runtime_exception(); // Range check.
if (!(i < size())) throw runtime_exception(); // Range check.
return ((cl_heap_string*)pointer)->data[i]; return ((cl_heap_string*)pointer)->data[i];
} }
// New ANSI C++ compilers also want the following. // New ANSI C++ compilers also want the following.
@ -94,7 +94,7 @@ inline cl_string& cl_string::operator= (const char * s)
// Length. // Length.
inline unsigned long strlen (const cl_string& str) inline unsigned long strlen (const cl_string& str)
{ {
return str.length();
return str.size();
} }
// Conversion to `const char *'. // Conversion to `const char *'.
inline const char * asciz (const char * s) { return s; } inline const char * asciz (const char * s) { return s; }
@ -103,7 +103,7 @@ inline const char * asciz (const cl_string& s) { return s.asciz(); }
// Comparison. // Comparison.
inline bool equal (const cl_string& str1, const cl_string& str2) inline bool equal (const cl_string& str1, const cl_string& str2)
{ {
return str1.length() == str2.length()
return str1.size() == str2.size()
&& !strcmp(str1.asciz(), str2.asciz()); && !strcmp(str1.asciz(), str2.asciz());
} }
inline bool equal (const char * str1, const cl_string& str2) inline bool equal (const char * str1, const cl_string& str2)

4
src/base/string/cl_spushstring.h

@ -29,7 +29,7 @@ public:
// Get the contents as a string. Free it using free_hook() when done. // Get the contents as a string. Free it using free_hook() when done.
char* contents (); char* contents ();
// Look at the contents. // Look at the contents.
uintL length () const;
uintL size() const;
char operator[] (uintL i) const; char operator[] (uintL i) const;
}; };
inline cl_spushstring::cl_spushstring () inline cl_spushstring::cl_spushstring ()
@ -50,7 +50,7 @@ inline char* cl_spushstring::contents ()
{ {
return cl_sstring(buffer,index); return cl_sstring(buffer,index);
} }
inline uintL cl_spushstring::length () const
inline uintL cl_spushstring::size() const
{ {
return index; return index;
} }

2
src/base/string/cl_st_debug.cc

@ -18,7 +18,7 @@ static void dprint (cl_heap* pointer)
{ {
var const cl_string& obj = *(const cl_string*)&pointer; var const cl_string& obj = *(const cl_string*)&pointer;
fprint(cl_debugout, "(cl_string) \""); fprint(cl_debugout, "(cl_string) \"");
var unsigned long l = obj.length();
var unsigned long l = obj.size();
for (var unsigned long i = 0; i < l; i++) { for (var unsigned long i = 0; i < l; i++) {
var unsigned char c = obj[i]; var unsigned char c = obj[i];
if (c >= 0x20) { if (c >= 0x20) {

2
src/base/string/cl_st_hashcode.cc

@ -16,7 +16,7 @@ unsigned long hashcode (const cl_string& str)
var unsigned long code = 0x61284AF3; var unsigned long code = 0x61284AF3;
// We walk through all characters. It may take some time for very // We walk through all characters. It may take some time for very
// long strings, but it's better than completely ignoring some characters. // long strings, but it's better than completely ignoring some characters.
var long len = str.length();
var long len = str.size();
var const char * ptr = str.asciz(); var const char * ptr = str.asciz();
for (; len > 0; len--) { for (; len > 0; len--) {
var unsigned char c = *ptr++; var unsigned char c = *ptr++;

2
src/base/string/output/cl_st_print.cc

@ -15,7 +15,7 @@ namespace cln {
void fprint (std::ostream& stream, const cl_string& str) void fprint (std::ostream& stream, const cl_string& str)
{ {
stream.write(str.asciz(),str.length());
stream.write(str.asciz(),str.size());
} }
} // namespace cln } // namespace cln

16
src/polynomial/elem/cl_UP_GF2.h

@ -20,8 +20,8 @@ static bool gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP
unused UPR; unused UPR;
var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer; var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer; var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer;
var uintL xlen = xv->v.length();
var uintL ylen = yv->v.length();
var uintL xlen = xv->v.size();
var uintL ylen = yv->v.size();
if (!(xlen == ylen)) if (!(xlen == ylen))
return false; return false;
// We can compare full words since unused bits in the last word are 0. // We can compare full words since unused bits in the last word are 0.
@ -37,8 +37,8 @@ static const _cl_UP gf2_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
DeclarePoly(cl_GV_MI,y); DeclarePoly(cl_GV_MI,y);
var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer; var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer; var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer;
var uintL xlen = xv->v.length();
var uintL ylen = yv->v.length();
var uintL xlen = xv->v.size();
var uintL ylen = yv->v.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, y); return _cl_UP(UPR, y);
if (ylen == 0) if (ylen == 0)
@ -822,8 +822,8 @@ static const _cl_UP gf2_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
DeclarePoly(cl_GV_MI,y); DeclarePoly(cl_GV_MI,y);
var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer; var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer; var const cl_heap_GV_I_bits1 * yv = (const cl_heap_GV_I_bits1 *) y.heappointer;
var uintL xlen = xv->v.length();
var uintL ylen = yv->v.length();
var uintL xlen = xv->v.size();
var uintL ylen = yv->v.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
if (ylen == 0) if (ylen == 0)
@ -943,7 +943,7 @@ static const _cl_UP gf2_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer; var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
var uintL xlen = xv->v.length();
var uintL xlen = xv->v.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
@ -985,7 +985,7 @@ static const cl_ring_element gf2_eval (cl_heap_univpoly_ring* UPR, const _cl_UP&
{ DeclarePoly(_cl_MI,y); { DeclarePoly(_cl_MI,y);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer; var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;
var uintL len = xv->v.length();
var uintL len = xv->v.size();
if (len==0) if (len==0)
return R->zero(); return R->zero();
if (R->_zerop(y)) if (R->_zerop(y))

38
src/polynomial/elem/cl_UP_MI.h

@ -36,7 +36,7 @@ static void modint_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, con
{{ {{
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
fprint(stream, "0"); fprint(stream, "0");
else { else {
@ -65,8 +65,8 @@ static bool modint_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
DeclarePoly(cl_GV_MI,y); DeclarePoly(cl_GV_MI,y);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (!(xlen == ylen)) if (!(xlen == ylen))
return false; return false;
for (var sintL i = xlen-1; i >= 0; i--) for (var sintL i = xlen-1; i >= 0; i--)
@ -84,7 +84,7 @@ static bool modint_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{ {
unused UPR; unused UPR;
{ DeclarePoly(cl_GV_MI,x); { DeclarePoly(cl_GV_MI,x);
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return true; return true;
else else
@ -96,8 +96,8 @@ static const _cl_UP modint_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, co
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
DeclarePoly(cl_GV_MI,y); DeclarePoly(cl_GV_MI,y);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, y); return _cl_UP(UPR, y);
if (ylen == 0) if (ylen == 0)
@ -147,7 +147,7 @@ static const _cl_UP modint_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
// Now xlen > 0. // Now xlen > 0.
@ -167,8 +167,8 @@ static const _cl_UP modint_minus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, c
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
DeclarePoly(cl_GV_MI,y); DeclarePoly(cl_GV_MI,y);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (ylen == 0) if (ylen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
if (xlen == 0) if (xlen == 0)
@ -231,8 +231,8 @@ static const _cl_UP modint_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, con
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
DeclarePoly(cl_GV_MI,y); DeclarePoly(cl_GV_MI,y);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
if (ylen == 0) if (ylen == 0)
@ -277,7 +277,7 @@ static const _cl_UP modint_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return cl_UP(UPR, x); return cl_UP(UPR, x);
var sintL len = 2*xlen-1; var sintL len = 2*xlen-1;
@ -333,7 +333,7 @@ static const _cl_UP modint_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_el
DeclarePoly(_cl_MI,x); DeclarePoly(_cl_MI,x);
DeclarePoly(cl_GV_MI,y); DeclarePoly(cl_GV_MI,y);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL ylen = y.length();
var sintL ylen = y.size();
if (ylen == 0) if (ylen == 0)
return _cl_UP(UPR, y); return _cl_UP(UPR, y);
if (R->_zerop(x)) if (R->_zerop(x))
@ -350,14 +350,14 @@ static sintL modint_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{ {
unused UPR; unused UPR;
{ DeclarePoly(cl_GV_MI,x); { DeclarePoly(cl_GV_MI,x);
return (sintL) x.length() - 1;
return (sintL) x.size() - 1;
}} }}
static sintL modint_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x) static sintL modint_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
for (sintL i = 0; i < xlen; i++) { for (sintL i = 0; i < xlen; i++) {
if (!R->_zerop(x[i])) if (!R->_zerop(x[i]))
return i; return i;
@ -384,7 +384,7 @@ static const cl_ring_element modint_coeff (cl_heap_univpoly_ring* UPR, const _cl
{{ {{
DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,x);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
if (index < x.length())
if (index < x.size())
return cl_MI(R, x[index]); return cl_MI(R, x[index]);
else else
return R->zero(); return R->zero();
@ -406,7 +406,7 @@ static void modint_set_coeff (cl_heap_univpoly_ring* UPR, _cl_UP& x, uintL index
DeclareMutablePoly(cl_GV_MI,x); DeclareMutablePoly(cl_GV_MI,x);
if (!(UPR->basering() == y.ring())) throw runtime_exception(); if (!(UPR->basering() == y.ring())) throw runtime_exception();
{ DeclarePoly(_cl_MI,y); { DeclarePoly(_cl_MI,y);
if (!(index < x.length())) throw runtime_exception();
if (!(index < x.size())) throw runtime_exception();
x[index] = y; x[index] = y;
}}} }}}
@ -414,7 +414,7 @@ static void modint_finalize (cl_heap_univpoly_ring* UPR, _cl_UP& x)
{{ {{
DeclareMutablePoly(cl_GV_MI,x); // NB: x is modified by reference! DeclareMutablePoly(cl_GV_MI,x); // NB: x is modified by reference!
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var uintL len = x.length();
var uintL len = x.size();
if (len > 0) if (len > 0)
modint_normalize(R,x,len); modint_normalize(R,x,len);
}} }}
@ -429,7 +429,7 @@ static const cl_ring_element modint_eval (cl_heap_univpoly_ring* UPR, const _cl_
if (!(UPR->basering() == y.ring())) throw runtime_exception(); if (!(UPR->basering() == y.ring())) throw runtime_exception();
{ DeclarePoly(_cl_MI,y); { DeclarePoly(_cl_MI,y);
var cl_heap_modint_ring* R = TheModintRing(UPR->basering()); var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
var uintL len = x.length();
var uintL len = x.size();
if (len==0) if (len==0)
return R->zero(); return R->zero();
if (R->_zerop(y)) if (R->_zerop(y))

38
src/polynomial/elem/cl_UP_gen.h

@ -32,7 +32,7 @@ static void gen_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const
{{ {{
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
fprint(stream, "0"); fprint(stream, "0");
else { else {
@ -61,8 +61,8 @@ static bool gen_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
DeclarePoly(cl_SV_ringelt,y); DeclarePoly(cl_SV_ringelt,y);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (!(xlen == ylen)) if (!(xlen == ylen))
return false; return false;
for (var sintL i = xlen-1; i >= 0; i--) for (var sintL i = xlen-1; i >= 0; i--)
@ -80,7 +80,7 @@ static bool gen_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{ {
unused UPR; unused UPR;
{ DeclarePoly(cl_SV_ringelt,x); { DeclarePoly(cl_SV_ringelt,x);
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return true; return true;
else else
@ -92,8 +92,8 @@ static const _cl_UP gen_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
DeclarePoly(cl_SV_ringelt,y); DeclarePoly(cl_SV_ringelt,y);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, y); return _cl_UP(UPR, y);
if (ylen == 0) if (ylen == 0)
@ -135,7 +135,7 @@ static const _cl_UP gen_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
// Now xlen > 0. // Now xlen > 0.
@ -155,8 +155,8 @@ static const _cl_UP gen_minus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, cons
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
DeclarePoly(cl_SV_ringelt,y); DeclarePoly(cl_SV_ringelt,y);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (ylen == 0) if (ylen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
if (xlen == 0) if (xlen == 0)
@ -215,8 +215,8 @@ static const _cl_UP gen_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
DeclarePoly(cl_SV_ringelt,y); DeclarePoly(cl_SV_ringelt,y);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
if (ylen == 0) if (ylen == 0)
@ -261,7 +261,7 @@ static const _cl_UP gen_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return cl_UP(UPR, x); return cl_UP(UPR, x);
var sintL len = 2*xlen-1; var sintL len = 2*xlen-1;
@ -316,7 +316,7 @@ static const _cl_UP gen_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_eleme
{ {
DeclarePoly(cl_SV_ringelt,y); DeclarePoly(cl_SV_ringelt,y);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL ylen = y.length();
var sintL ylen = y.size();
if (ylen == 0) if (ylen == 0)
return _cl_UP(UPR, y); return _cl_UP(UPR, y);
if (R->zerop(x)) if (R->zerop(x))
@ -334,13 +334,13 @@ static sintL gen_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{ {
unused UPR; unused UPR;
{ DeclarePoly(cl_SV_ringelt,x); { DeclarePoly(cl_SV_ringelt,x);
return (sintL) x.length() - 1;
return (sintL) x.size() - 1;
}} }}
static sintL gen_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x) static sintL gen_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ DeclarePoly(cl_SV_ringelt,x); {{ DeclarePoly(cl_SV_ringelt,x);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var sintL xlen = x.length();
var sintL xlen = x.size();
for (sintL i = 0; i < xlen; i++) { for (sintL i = 0; i < xlen; i++) {
if (!R->_zerop(x[i])) if (!R->_zerop(x[i]))
return i; return i;
@ -366,7 +366,7 @@ static const cl_ring_element gen_coeff (cl_heap_univpoly_ring* UPR, const _cl_UP
{{ {{
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
if (index < x.length())
if (index < x.size())
return cl_ring_element(R, x[index]); return cl_ring_element(R, x[index]);
else else
return R->zero(); return R->zero();
@ -386,7 +386,7 @@ static void gen_set_coeff (cl_heap_univpoly_ring* UPR, _cl_UP& x, uintL index, c
{{ {{
DeclareMutablePoly(cl_SV_ringelt,x); DeclareMutablePoly(cl_SV_ringelt,x);
if (!(UPR->basering() == y.ring())) throw runtime_exception(); if (!(UPR->basering() == y.ring())) throw runtime_exception();
if (!(index < x.length())) throw runtime_exception();
if (!(index < x.size())) throw runtime_exception();
x[index] = y; x[index] = y;
}} }}
@ -394,7 +394,7 @@ static void gen_finalize (cl_heap_univpoly_ring* UPR, _cl_UP& x)
{{ {{
DeclareMutablePoly(cl_SV_ringelt,x); // NB: x is modified by reference! DeclareMutablePoly(cl_SV_ringelt,x); // NB: x is modified by reference!
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
var uintL len = x.length();
var uintL len = x.size();
if (len > 0) if (len > 0)
gen_normalize(R,x,len); gen_normalize(R,x,len);
}} }}
@ -408,7 +408,7 @@ static const cl_ring_element gen_eval (cl_heap_univpoly_ring* UPR, const _cl_UP&
DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,x);
var cl_heap_ring* R = TheRing(UPR->basering()); var cl_heap_ring* R = TheRing(UPR->basering());
if (!(y.ring() == R)) throw runtime_exception(); if (!(y.ring() == R)) throw runtime_exception();
var uintL len = x.length();
var uintL len = x.size();
if (len==0) if (len==0)
return R->zero(); return R->zero();
if (R->_zerop(y)) if (R->_zerop(y))

38
src/polynomial/elem/cl_UP_number.h

@ -33,7 +33,7 @@ static void num_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const
{{ {{
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
fprint(stream, "0"); fprint(stream, "0");
else { else {
@ -61,8 +61,8 @@ static bool num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
DeclarePoly(cl_SV_number,y); DeclarePoly(cl_SV_number,y);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (!(xlen == ylen)) if (!(xlen == ylen))
return false; return false;
for (var sintL i = xlen-1; i >= 0; i--) for (var sintL i = xlen-1; i >= 0; i--)
@ -80,7 +80,7 @@ static bool num_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{ {
unused UPR; unused UPR;
{ DeclarePoly(cl_SV_number,x); { DeclarePoly(cl_SV_number,x);
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return true; return true;
else else
@ -92,8 +92,8 @@ static const _cl_UP num_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
DeclarePoly(cl_SV_number,y); DeclarePoly(cl_SV_number,y);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, y); return _cl_UP(UPR, y);
if (ylen == 0) if (ylen == 0)
@ -135,7 +135,7 @@ static const _cl_UP num_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
// Now xlen > 0. // Now xlen > 0.
@ -155,8 +155,8 @@ static const _cl_UP num_minus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, cons
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
DeclarePoly(cl_SV_number,y); DeclarePoly(cl_SV_number,y);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (ylen == 0) if (ylen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
if (xlen == 0) if (xlen == 0)
@ -213,8 +213,8 @@ static const _cl_UP num_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
DeclarePoly(cl_SV_number,y); DeclarePoly(cl_SV_number,y);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL ylen = y.length();
var sintL xlen = x.size();
var sintL ylen = y.size();
if (xlen == 0) if (xlen == 0)
return _cl_UP(UPR, x); return _cl_UP(UPR, x);
if (ylen == 0) if (ylen == 0)
@ -259,7 +259,7 @@ static const _cl_UP num_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL xlen = x.size();
if (xlen == 0) if (xlen == 0)
return cl_UP(UPR, x); return cl_UP(UPR, x);
var sintL len = 2*xlen-1; var sintL len = 2*xlen-1;
@ -315,7 +315,7 @@ static const _cl_UP num_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_eleme
DeclarePoly(cl_number,x); DeclarePoly(cl_number,x);
DeclarePoly(cl_SV_number,y); DeclarePoly(cl_SV_number,y);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL ylen = y.length();
var sintL ylen = y.size();
if (ylen == 0) if (ylen == 0)
return _cl_UP(UPR, y); return _cl_UP(UPR, y);
if (ops.zerop(x)) if (ops.zerop(x))
@ -332,14 +332,14 @@ static sintL num_degree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{ {
unused UPR; unused UPR;
{ DeclarePoly(cl_SV_number,x); { DeclarePoly(cl_SV_number,x);
return (sintL) x.length() - 1;
return (sintL) x.size() - 1;
}} }}
static sintL num_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x) static sintL num_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
{{ {{
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var sintL xlen = x.length();
var sintL xlen = x.size();
for (sintL i = 0; i < xlen; i++) { for (sintL i = 0; i < xlen; i++) {
if (!ops.zerop(x[i])) if (!ops.zerop(x[i]))
return i; return i;
@ -366,7 +366,7 @@ static const cl_ring_element num_coeff (cl_heap_univpoly_ring* UPR, const _cl_UP
{{ {{
DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,x);
var cl_heap_number_ring* R = TheNumberRing(UPR->basering()); var cl_heap_number_ring* R = TheNumberRing(UPR->basering());
if (index < x.length())
if (index < x.size())
return cl_ring_element(R, x[index]); return cl_ring_element(R, x[index]);
else else
return R->zero(); return R->zero();
@ -387,7 +387,7 @@ static void num_set_coeff (cl_heap_univpoly_ring* UPR, _cl_UP& x, uintL index, c
DeclareMutablePoly(cl_SV_number,x); DeclareMutablePoly(cl_SV_number,x);
if (!(UPR->basering() == y.ring())) throw runtime_exception(); if (!(UPR->basering() == y.ring())) throw runtime_exception();
{ DeclarePoly(cl_number,y); { DeclarePoly(cl_number,y);
if (!(index < x.length())) throw runtime_exception();
if (!(index < x.size())) throw runtime_exception();
x[index] = y; x[index] = y;
}}} }}}
@ -395,7 +395,7 @@ static void num_finalize (cl_heap_univpoly_ring* UPR, _cl_UP& x)
{{ {{
DeclareMutablePoly(cl_SV_number,x); // NB: x is modified by reference! DeclareMutablePoly(cl_SV_number,x); // NB: x is modified by reference!
var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops; var cl_number_ring_ops<cl_number>& ops = *TheNumberRing(UPR->basering())->ops;
var uintL len = x.length();
var uintL len = x.size();
if (len > 0) if (len > 0)
num_normalize(ops,x,len); num_normalize(ops,x,len);
}} }}
@ -411,7 +411,7 @@ static const cl_ring_element num_eval (cl_heap_univpoly_ring* UPR, const _cl_UP&
{ DeclarePoly(cl_number,y); { DeclarePoly(cl_number,y);
var cl_heap_number_ring* R = TheNumberRing(UPR->basering()); var cl_heap_number_ring* R = TheNumberRing(UPR->basering());
var cl_number_ring_ops<cl_number>& ops = *R->ops; var cl_number_ring_ops<cl_number>& ops = *R->ops;
var uintL len = x.length();
var uintL len = x.size();
if (len==0) if (len==0)
return R->zero(); return R->zero();
if (ops.zerop(y)) if (ops.zerop(y))

10
src/vector/cl_GV_I.cc

@ -93,7 +93,7 @@ static void general_set_element (cl_GV_inner<cl_I>* vec, uintC index, const cl_I
static void general_do_delete (cl_GV_inner<cl_I>* vec) static void general_do_delete (cl_GV_inner<cl_I>* vec)
{ {
var cl_heap_GV_I_general* hv = (cl_heap_GV_I_general *) outcast(vec); var cl_heap_GV_I_general* hv = (cl_heap_GV_I_general *) outcast(vec);
var uintC len = hv->v.length();
var uintC len = hv->v.size();
for (var uintC i = 0; i < len; i++) for (var uintC i = 0; i < len; i++)
hv->data[i].~cl_I(); hv->data[i].~cl_I();
} }
@ -105,8 +105,8 @@ static void general_copy_elements (const cl_GV_inner<cl_I>* srcvec, uintC srcind
(const cl_heap_GV_I_general *) outcast(srcvec); (const cl_heap_GV_I_general *) outcast(srcvec);
var cl_heap_GV_I_general* destv = var cl_heap_GV_I_general* destv =
(cl_heap_GV_I_general *) outcast(destvec); (cl_heap_GV_I_general *) outcast(destvec);
var uintC srclen = srcv->v.length();
var uintC destlen = destv->v.length();
var uintC srclen = srcv->v.size();
var uintC destlen = destv->v.size();
if (!(srcindex <= srcindex+count && srcindex+count <= srclen)) if (!(srcindex <= srcindex+count && srcindex+count <= srclen))
throw runtime_exception(); throw runtime_exception();
if (!(destindex <= destindex+count && destindex+count <= destlen)) if (!(destindex <= destindex+count && destindex+count <= destlen))
@ -158,8 +158,8 @@ static void bits##m##_copy_elements (const cl_GV_inner<cl_I>* srcvec, uintC srci
(const cl_heap_GV_I_bits##m *) outcast(srcvec); \ (const cl_heap_GV_I_bits##m *) outcast(srcvec); \
var cl_heap_GV_I_bits##m * destv = \ var cl_heap_GV_I_bits##m * destv = \
(cl_heap_GV_I_bits##m *) outcast(destvec); \ (cl_heap_GV_I_bits##m *) outcast(destvec); \
var uintC srclen = srcv->v.length(); \
var uintC destlen = destv->v.length(); \
var uintC srclen = srcv->v.size(); \
var uintC destlen = destv->v.size(); \
if (!(srcindex <= srcindex+count && srcindex+count <= srclen)) \ if (!(srcindex <= srcindex+count && srcindex+count <= srclen)) \
throw runtime_exception(); \ throw runtime_exception(); \
if (!(destindex <= destindex+count && destindex+count <= destlen)) \ if (!(destindex <= destindex+count && destindex+count <= destlen)) \

2
src/vector/cl_GV_I_copy.cc

@ -14,7 +14,7 @@ namespace cln {
const cl_GV_I copy (const cl_GV_I& v) const cl_GV_I copy (const cl_GV_I& v)
{ {
var uintC len = v.length();
var uintC len = v.size();
var cl_GV_I w = cl_GV_I(len,v.maxbits()); var cl_GV_I w = cl_GV_I(len,v.maxbits());
cl_GV_I::copy_elements(v,0,w,0,len); cl_GV_I::copy_elements(v,0,w,0,len);
return w; return w;

6
src/vector/cl_GV_number.cc

@ -69,7 +69,7 @@ static void general_set_element (cl_GV_inner<cl_number>* vec, uintC index, const
static void general_do_delete (cl_GV_inner<cl_number>* vec) static void general_do_delete (cl_GV_inner<cl_number>* vec)
{ {
var cl_heap_GV_number_general* hv = (cl_heap_GV_number_general *) outcast(vec); var cl_heap_GV_number_general* hv = (cl_heap_GV_number_general *) outcast(vec);
var uintC len = hv->v.length();
var uintC len = hv->v.size();
for (var uintC i = 0; i < len; i++) for (var uintC i = 0; i < len; i++)
hv->data[i].~cl_number(); hv->data[i].~cl_number();
} }
@ -81,8 +81,8 @@ static void general_copy_elements (const cl_GV_inner<cl_number>* srcvec, uintC s
(const cl_heap_GV_number_general *) outcast(srcvec); (const cl_heap_GV_number_general *) outcast(srcvec);
var cl_heap_GV_number_general* destv = var cl_heap_GV_number_general* destv =
(cl_heap_GV_number_general *) outcast(destvec); (cl_heap_GV_number_general *) outcast(destvec);
var uintC srclen = srcv->v.length();
var uintC destlen = destv->v.length();
var uintC srclen = srcv->v.size();
var uintC destlen = destv->v.size();
if (!(srcindex <= srcindex+count && srcindex+count <= srclen)) if (!(srcindex <= srcindex+count && srcindex+count <= srclen))
throw runtime_exception(); throw runtime_exception();
if (!(destindex <= destindex+count && destindex+count <= destlen)) if (!(destindex <= destindex+count && destindex+count <= destlen))

2
src/vector/cl_GV_number_copy.cc

@ -14,7 +14,7 @@ namespace cln {
const cl_GV_number copy (const cl_GV_number& v) const cl_GV_number copy (const cl_GV_number& v)
{ {
var uintC len = v.length();
var uintC len = v.size();
var cl_GV_number w = cl_GV_number(len); var cl_GV_number w = cl_GV_number(len);
cl_GV_number::copy_elements(v,0,w,0,len); cl_GV_number::copy_elements(v,0,w,0,len);
return w; return w;

2
src/vector/cl_SV_copy.cc

@ -16,7 +16,7 @@ namespace cln {
const cl_SV_any copy (const cl_SV_any& src) const cl_SV_any copy (const cl_SV_any& src)
{ {
var uintC len = src.length();
var uintC len = src.size();
var cl_heap_SV_any* hv = (cl_heap_SV_any*) malloc_hook(sizeof(cl_heap_SV_any)+sizeof(cl_gcobject)*len); var cl_heap_SV_any* hv = (cl_heap_SV_any*) malloc_hook(sizeof(cl_heap_SV_any)+sizeof(cl_gcobject)*len);
hv->refcount = 1; hv->refcount = 1;
hv->type = src.pointer_type(); hv->type = src.pointer_type();

2
src/vector/output/cl_GV_number_aprint.cc

@ -19,7 +19,7 @@ namespace cln {
void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector) void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector)
{ {
var uintC len = vector.length();
var uintC len = vector.size();
if (flags.vector_syntax == vsyntax_commonlisp) { if (flags.vector_syntax == vsyntax_commonlisp) {
fprintchar(stream,'#'); fprintchar(stream,'#');
fprintchar(stream,'('); fprintchar(stream,'(');

2
src/vector/output/cl_SV_aprint.cc

@ -16,7 +16,7 @@ namespace cln {
void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& vector) void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& vector)
{ {
var const cl_print_flags& flags = default_print_flags; var const cl_print_flags& flags = default_print_flags;
var uintC len = vector.length();
var uintC len = vector.size();
if (flags.vector_syntax == vsyntax_commonlisp) { if (flags.vector_syntax == vsyntax_commonlisp) {
fprintchar(stream,'#'); fprintchar(stream,'#');
fprintchar(stream,'('); fprintchar(stream,'(');

2
src/vector/output/cl_SV_number_aprint.cc

@ -19,7 +19,7 @@ namespace cln {
void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector) void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* printfun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector)
{ {
var uintC len = vector.length();
var uintC len = vector.size();
if (flags.vector_syntax == vsyntax_commonlisp) { if (flags.vector_syntax == vsyntax_commonlisp) {
fprintchar(stream,'#'); fprintchar(stream,'#');
fprintchar(stream,'('); fprintchar(stream,'(');

Loading…
Cancel
Save