X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=include%2Fcln%2FGV_integer.h;h=dcecfdeaa5d4f59c770c03b169842a2e46941f84;hb=HEAD;hp=e2adf95f364554902b6a24e14d7db4d5b88ab1ba;hpb=850abfde7f0d985ba01526c346bcd0d733562943;p=cln.git diff --git a/include/cln/GV_integer.h b/include/cln/GV_integer.h index e2adf95..dcecfde 100644 --- a/include/cln/GV_integer.h +++ b/include/cln/GV_integer.h @@ -13,13 +13,11 @@ namespace cln { // A vector of integers is *not* just a normal vector of numbers (the vectorops // support the maxbits() operation), but we treat can it like this nevertheless. -#ifdef HAVE_TEMPLATE_NULL template <> -#endif struct cl_heap_GV : cl_heap { cl_GV_inner v; // here room for the elements - sintL maxbits () const; + sintC maxbits () const; }; typedef cl_heap_GV cl_heap_GV_I; @@ -29,13 +27,13 @@ public: cl_GV_I (); cl_GV_I (const cl_GV_I&); // Create a vector of unconstrained integers. - explicit cl_GV_I (uintL len); + explicit cl_GV_I (std::size_t len); // Create a vector of m-bit integers (>=0, <2^m). - cl_GV_I (uintL len, sintL m); + cl_GV_I (std::size_t len, sintC m); // Assignment operators. cl_GV_I& operator= (const cl_GV_I&); // Number m of bits allowed per element (-1 if unconstrained). - sintL maxbits () const + sintC maxbits () const { return ((const cl_heap_GV_I *) pointer)->maxbits(); } @@ -45,31 +43,38 @@ public: }; inline cl_GV_I::cl_GV_I (const cl_GV_I& x) : cl_GV (as_cl_private_thing(x)) {} CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_I,cl_GV_I) -extern cl_heap_GV_I* cl_make_heap_GV_I (uintL len); -inline cl_GV_I::cl_GV_I (uintL len) +extern cl_heap_GV_I* cl_make_heap_GV_I (std::size_t len); +inline cl_GV_I::cl_GV_I (std::size_t len) : cl_GV (cl_make_heap_GV_I(len)) {} -extern cl_heap_GV_I* cl_make_heap_GV_I (uintL len, sintL m); -inline cl_GV_I::cl_GV_I (uintL len, sintL m) +extern cl_heap_GV_I* cl_make_heap_GV_I (std::size_t len, sintC m); +inline cl_GV_I::cl_GV_I (std::size_t len, sintC m) : cl_GV (cl_make_heap_GV_I(len,m)) {} // Private pointer manipulations. Never throw away a `struct cl_heap_GV_I *'! extern const cl_GV_I cl_null_GV_I; inline cl_GV_I::cl_GV_I () : cl_GV ((cl_heap_GV_I*) cl_null_GV_I) {} -CL_REQUIRE(cl_GV_I) +class cl_GV_I_init_helper +{ + static int count; +public: + cl_GV_I_init_helper(); + ~cl_GV_I_init_helper(); +}; +static cl_GV_I_init_helper cl_GV_I_init_helper_instance; // Copy a vector. extern const cl_GV_I copy (const cl_GV_I&); // Output. -inline void fprint (cl_ostream stream, const cl_GV_I& x) +inline void fprint (std::ostream& stream, const cl_GV_I& x) { extern cl_print_flags default_print_flags; - extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); - extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z); + extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); + extern void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z); print_vector(stream, default_print_flags, - (void (*) (cl_ostream, const cl_print_flags&, const cl_number&)) - (void (*) (cl_ostream, const cl_print_flags&, const cl_I&)) + (void (*) (std::ostream&, const cl_print_flags&, const cl_number&)) + (void (*) (std::ostream&, const cl_print_flags&, const cl_I&)) &print_integer, x); } @@ -78,9 +83,7 @@ CL_DEFINE_PRINT_OPERATOR(cl_GV_I) // Debugging support. #ifdef CL_DEBUG extern int cl_GV_I_debug_module; -static void* const cl_GV_I_debug_dummy[] = { &cl_GV_I_debug_dummy, - &cl_GV_I_debug_module -}; +CL_FORCE_LINK(cl_GV_I_debug_dummy, cl_GV_I_debug_module) #endif } // namespace cln