1 // General vectors of integers.
3 #ifndef _CL_GV_INTEGER_H
4 #define _CL_GV_INTEGER_H
7 #include "cl_GV_rational.h"
8 #include "cl_integer_class.h"
11 // A vector of integers is *not* just a normal vector of numbers (the vectorops
12 // support the maxbits() operation), but we treat can it like this nevertheless.
14 #ifdef HAVE_TEMPLATE_NULL
17 struct cl_heap_GV<cl_I> : cl_heap {
19 // here room for the elements
20 sintL maxbits () const;
22 typedef cl_heap_GV<cl_I> cl_heap_GV_I;
24 struct cl_GV_I : public cl_GV<cl_I,cl_GV_RA> {
28 cl_GV_I (const cl_GV_I&);
29 // Create a vector of unconstrained integers.
30 explicit cl_GV_I (uintL len);
31 // Create a vector of m-bit integers (>=0, <2^m).
32 cl_GV_I (uintL len, sintL m);
33 // Assignment operators.
34 cl_GV_I& operator= (const cl_GV_I&);
35 // Number m of bits allowed per element (-1 if unconstrained).
36 sintL maxbits () const
38 return ((const cl_heap_GV_I *) pointer)->maxbits();
40 // Private pointer manipulations.
41 cl_GV_I (cl_heap_GV_I* p) : cl_GV<cl_I,cl_GV_RA> (p) {}
42 cl_GV_I (cl_private_thing p) : cl_GV<cl_I,cl_GV_RA> (p) {}
44 inline cl_GV_I::cl_GV_I (const cl_GV_I& x) : cl_GV<cl_I,cl_GV_RA> (as_cl_private_thing(x)) {}
45 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_I,cl_GV_I)
46 extern cl_heap_GV_I* cl_make_heap_GV_I (uintL len);
47 inline cl_GV_I::cl_GV_I (uintL len)
48 : cl_GV<cl_I,cl_GV_RA> (cl_make_heap_GV_I(len)) {}
49 extern cl_heap_GV_I* cl_make_heap_GV_I (uintL len, sintL m);
50 inline cl_GV_I::cl_GV_I (uintL len, sintL m)
51 : cl_GV<cl_I,cl_GV_RA> (cl_make_heap_GV_I(len,m)) {}
53 // Private pointer manipulations. Never throw away a `struct cl_heap_GV_I *'!
54 extern const cl_GV_I cl_null_GV_I;
55 inline cl_GV_I::cl_GV_I ()
56 : cl_GV<cl_I,cl_GV_RA> ((cl_heap_GV_I*) cl_null_GV_I) {}
60 extern const cl_GV_I copy (const cl_GV_I&);
63 inline void fprint (cl_ostream stream, const cl_GV_I& x)
65 extern cl_print_flags cl_default_print_flags;
66 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);
67 extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z);
68 print_vector(stream, cl_default_print_flags,
69 (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
70 (void (*) (cl_ostream, const cl_print_flags&, const cl_I&))
74 CL_DEFINE_PRINT_OPERATOR(cl_GV_I)
78 extern int cl_GV_I_debug_module;
79 static void* const cl_GV_I_debug_dummy[] = { &cl_GV_I_debug_dummy,
84 #endif /* _CL_GV_INTEGER_H */