source: git/libpolys/misc/int64vec.h @ 45cc512

spielwiese
Last change on this file since 45cc512 was d101b1, checked in by Oleksandr Motsak <http://goo.gl/mcpzY>, 11 years ago
Silence some warnings about statements without effect Insired by [039a51b3aa3c77c2b7bae73d24de8521df45aed2]
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef INT64VEC_H
2#define INT64VEC_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/*
7* ABSTRACT: class intvec: lists/vectors of int64
8*/
9#include <string.h>
10#include <omalloc/omalloc.h>
11#include <misc/auxiliary.h>
12#include <misc/intvec.h>
13
14class int64vec
15{
16private:
17  int64 *v;
18  int row;
19  int col;
20public:
21
22  int64vec(int l = 1)
23    {
24      v = (int64 *)omAlloc0(sizeof(int64)*l);
25      row = l;
26      col = 1;
27    }
28  int64vec(int r, int c, int64 init);
29  int64vec(int64vec* iv);
30  int64vec(intvec* iv);
31  int64& operator[](int i)
32    {
33#ifndef NDEBUG
34      if((i<0)||(i>=row*col))
35      {
36        Werror("wrong int64vec index:%d\n",i);
37      }
38#endif
39      return v[i];
40    }
41  inline const int64& operator[](int i) const
42    {
43#ifndef NDEBUG
44      if((i<0)||(i>=row*col))
45      {
46        Werror("wrong int64vec index:%d\n",i);
47      }
48#endif
49      return v[i];
50    }
51  void operator*=(int64 intop);
52  void operator/=(int64 intop);
53  // -2: not compatible, -1: <, 0:=, 1: >
54  int compare(const int64vec* o) const;
55  int  length() const { return col*row; }
56  int  cols() const { return col; }
57  int  rows() const { return row; }
58  void show(int mat=0,int spaces=0);
59  char * String(int dim = 2);
60  char * iv64String(int not_mat=1,int mat=0,int spaces=0, int dim=2);
61  int64 * iv64GetVec() { return v; }
62  ~int64vec()
63    {
64      if (v!=NULL)
65      {
66        omFreeSize((ADDRESS)v,sizeof(int64)*row*col);
67        v=NULL;
68      }
69    }
70  void iv64TEST()
71    {
72      omCheckAddrSize((ADDRESS)v,sizeof(int64)*row*col);
73    }
74};
75inline int64vec * iv64Copy(int64vec * o)
76{
77  int64vec * iv=new int64vec(o);
78  return iv;
79}
80
81int64vec * iv64Add(int64vec * a, int64vec * b);
82int64vec * iv64Sub(int64vec * a, int64vec * b);
83
84#ifdef MDEBUG
85#define iv64Test(v) v->iv64TEST()
86#else
87#define iv64Test(v)   do {} while (0)
88#endif
89
90#endif
91
92
93
94
95
96
97
98
99
100
101
Note: See TracBrowser for help on using the repository browser.