My Project
Loading...
Searching...
No Matches
p_MemCopy.h
Go to the documentation of this file.
1/****************************************
2* Computer Algebra System SINGULAR *
3****************************************/
4/***************************************************************
5 * File: p_MemCopy.h
6 * Purpose: macros for memory addition
7 * Author: obachman (Olaf Bachmann)
8 * Created: 8/00
9 *******************************************************************/
10#ifndef P_MEM_COPY_H
11#define P_MEM_COPY_H
12
13#define _p_MemCopy(i, d, s) d[i] = s[i]
14
15#define _p_MemCopy_LengthOne(d, s) _p_MemCopy(0, d, s)
16#define _p_MemCopy_LengthTwo(d, s) do{_p_MemCopy_LengthOne(d, s); _p_MemCopy(1, d, s);} while(0)
17#define _p_MemCopy_LengthThree(d, s) do{_p_MemCopy_LengthTwo(d, s); _p_MemCopy(2, d, s);} while(0)
18#define _p_MemCopy_LengthFour(d, s) do{_p_MemCopy_LengthThree(d, s); _p_MemCopy(3, d, s);} while(0)
19#define _p_MemCopy_LengthFive(d, s) do{_p_MemCopy_LengthFour(d, s); _p_MemCopy(4, d, s);} while(0)
20#define _p_MemCopy_LengthSix(d, s) do{_p_MemCopy_LengthFive(d, s); _p_MemCopy(5, d, s);} while(0)
21#define _p_MemCopy_LengthSeven(d, s) do{_p_MemCopy_LengthSix(d, s); _p_MemCopy(6, d, s);} while(0)
22#define _p_MemCopy_LengthEight(d, s) do{_p_MemCopy_LengthSeven(d, s); _p_MemCopy(7, d, s);} while(0)
23
24#define _p_MemCopy_Declare(d, s) \
25 unsigned long* _d = ((unsigned long*) d); \
26 const unsigned long* _s = ((unsigned long*) s)
27
28#define p_MemCopy_LengthOne(d, s, length) _p_MemCopy_LengthOne(d, s)
29#define p_MemCopy_LengthTwo(d, s, length) \
30do \
31{ \
32 _p_MemCopy_Declare(d,s); \
33 _p_MemCopy_LengthTwo(_d, _s); \
34} \
35while (0)
36#define p_MemCopy_LengthThree(d, s, length) \
37do \
38{ \
39 _p_MemCopy_Declare(d,s); \
40 _p_MemCopy_LengthThree(_d, _s); \
41} \
42while (0)
43#define p_MemCopy_LengthFour(d, s, length) \
44do \
45{ \
46 _p_MemCopy_Declare(d,s); \
47 _p_MemCopy_LengthFour(_d, _s); \
48} \
49while (0)
50#define p_MemCopy_LengthFive(d, s, length) \
51do \
52{ \
53 _p_MemCopy_Declare(d,s); \
54 _p_MemCopy_LengthFive(_d, _s); \
55} \
56while (0)
57#define p_MemCopy_LengthSix(d, s, length) \
58do \
59{ \
60 _p_MemCopy_Declare(d,s); \
61 _p_MemCopy_LengthSix(_d, _s); \
62} \
63while (0)
64#define p_MemCopy_LengthSeven(d, s, length) \
65do \
66{ \
67 _p_MemCopy_Declare(d,s); \
68 _p_MemCopy_LengthSeven(_d, _s); \
69} \
70while (0)
71#define p_MemCopy_LengthEight(d, s, length) \
72do \
73{ \
74 _p_MemCopy_Declare(d,s); \
75 _p_MemCopy_LengthEight(_d, _s); \
76} \
77while (0)
78
79#define p_MemCopy_LengthGeneral(d, s, length) \
80do \
81{ \
82 _p_MemCopy_Declare(d,s); \
83 const unsigned long _l = (unsigned long) length; \
84 unsigned long _i = 0; \
85 do \
86 { \
87 _d[_i] = _s[_i]; \
88 _i++; \
89 } \
90 while (_i != _l); \
91} \
92while (0)
93
94#endif // P_MEM_COPY_H