source: git/kernel/p_MemCopy.h @ 3a67ea7

spielwiese
Last change on this file since 3a67ea7 was 35aab3, checked in by Hans Schönemann <hannes@…>, 21 years ago
This commit was generated by cvs2svn to compensate for changes in r6879, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6880 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.2 KB
Line 
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 *  Version: $Id: p_MemCopy.h,v 1.1.1.1 2003-10-06 12:15:59 Singular Exp $
10 *******************************************************************/
11#ifndef P_MEM_COPY_H
12#define P_MEM_COPY_H
13
14#define _p_MemCopy(i, d, s) d[i] = s[i]
15
16#define _p_MemCopy_LengthOne(d, s) _p_MemCopy(0, d, s)
17#define _p_MemCopy_LengthTwo(d, s) do{_p_MemCopy_LengthOne(d, s); _p_MemCopy(1, d, s);} while(0)
18#define _p_MemCopy_LengthThree(d, s) do{_p_MemCopy_LengthTwo(d, s); _p_MemCopy(2, d, s);} while(0)
19#define _p_MemCopy_LengthFour(d, s) do{_p_MemCopy_LengthThree(d, s); _p_MemCopy(3, d, s);} while(0)
20#define _p_MemCopy_LengthFive(d, s) do{_p_MemCopy_LengthFour(d, s); _p_MemCopy(4, d, s);} while(0)
21#define _p_MemCopy_LengthSix(d, s) do{_p_MemCopy_LengthFive(d, s); _p_MemCopy(5, d, s);} while(0)
22#define _p_MemCopy_LengthSeven(d, s) do{_p_MemCopy_LengthSix(d, s); _p_MemCopy(6, d, s);} while(0)
23#define _p_MemCopy_LengthEight(d, s) do{_p_MemCopy_LengthSeven(d, s); _p_MemCopy(7, d, s);} while(0)
24
25#define _p_MemCopy_Declare(d, s)                \
26  unsigned long* _d = ((unsigned long*) d); \
27  const unsigned long* _s = ((unsigned long*) s)
28
29#define p_MemCopy_LengthOne(d, s, length) _p_MemCopy_LengthOne(d, s)
30#define p_MemCopy_LengthTwo(d, s, length)   \
31do                                              \
32{                                               \
33  _p_MemCopy_Declare(d,s);                    \
34  _p_MemCopy_LengthTwo(_d, _s);            \
35}                                               \
36while (0)
37#define p_MemCopy_LengthThree(d, s, length) \
38do                                              \
39{                                               \
40  _p_MemCopy_Declare(d,s);                    \
41  _p_MemCopy_LengthThree(_d, _s);          \
42}                                               \
43while (0)
44#define p_MemCopy_LengthFour(d, s, length)  \
45do                                              \
46{                                               \
47  _p_MemCopy_Declare(d,s);                    \
48  _p_MemCopy_LengthFour(_d, _s);           \
49}                                               \
50while (0)
51#define p_MemCopy_LengthFive(d, s, length)  \
52do                                              \
53{                                               \
54  _p_MemCopy_Declare(d,s);                    \
55  _p_MemCopy_LengthFive(_d, _s);           \
56}                                               \
57while (0)
58#define p_MemCopy_LengthSix(d, s, length)   \
59do                                              \
60{                                               \
61  _p_MemCopy_Declare(d,s);                    \
62  _p_MemCopy_LengthSix(_d, _s);            \
63}                                               \
64while (0)
65#define p_MemCopy_LengthSeven(d, s, length) \
66do                                              \
67{                                               \
68  _p_MemCopy_Declare(d,s);                    \
69  _p_MemCopy_LengthSeven(_d, _s);          \
70}                                               \
71while (0)
72#define p_MemCopy_LengthEight(d, s, length) \
73do                                              \
74{                                               \
75  _p_MemCopy_Declare(d,s);                    \
76  _p_MemCopy_LengthEight(_d, _s);          \
77}                                               \
78while (0)
79
80#define p_MemCopy_LengthGeneral(d, s, length)   \
81do                                              \
82{                                               \
83  _p_MemCopy_Declare(d,s);                      \
84  const unsigned long _l = (unsigned long) length;   \
85  unsigned long _i = 0;                         \
86                                                \
87  do                                            \
88  {                                             \
89    _d[_i] = _s[_i];                            \
90    _i++;                                       \
91  }                                             \
92  while (_i != _l);                             \
93}                                               \
94while (0)
95
96#endif // P_MEM_COPY_H
Note: See TracBrowser for help on using the repository browser.