Changeset 2f436b in git for Singular/p_MemCmp.h


Ignore:
Timestamp:
Dec 31, 2000, 4:14:47 PM (23 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e609098c45a74ac91c002ffa7ece5eebe7f8c002
Parents:
33ec1145a109507ad3e3cf4a69a847b703358e93
Message:
* version 1-3-13: sparsemat improivements


git-svn-id: file:///usr/local/Singular/svn/trunk@5003 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/p_MemCmp.h

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: p_MemCmp.h,v 1.1 2000-09-04 14:08:17 obachman Exp $
     9 *  Version: $Id: p_MemCmp.h,v 1.2 2000-12-31 15:14:37 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef P_MEM_CMP_H
     
    765765while (0)
    766766
     767/***************************************************************
     768 * 
     769 *  Bitmask
     770 * 
     771 *******************************************************************/
     772#define _p_MemCmp_Bitmask_Declare(s1, s2, bitmask)  \
     773  const unsigned long* _s1 = ((unsigned long*) s1); \
     774  const unsigned long* _s2 = ((unsigned long*) s2); \
     775  register const unsigned long _bitmask = bitmask;  \
     776  register unsigned long _v1;                       \
     777  register unsigned long _v2;                       \
     778  register unsigned long _i                         \
     779
     780
     781#define p_MemCmp_Bitmask_LengthGeneral(s1, s2, bitmask, length, actionG, actionS)   \
     782do                                                                                  \
     783{                                                                                   \
     784  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                             \
     785  const unsigned long _l = (unsigned long) length;                                  \
     786                                                                                    \
     787  _i=0;                                                                             \
     788                                                                                    \
     789  while (_i < _l)                                                                   \
     790  {                                                                                 \
     791    _v1 = _s1[_i];                                                                  \
     792    _v2 = _s2[_i];                                                                  \
     793                                                                                    \
     794    if ((_v1 > _v2) ||                                                              \
     795        (((_v1 & _bitmask) ^ (_v2 & _bitmask)) != ((_v2 - _v1) & _bitmask)))           \
     796      actionS;                                                                      \
     797    _i++;                                                                           \
     798  }                                                                                 \
     799  actionG;                                                                          \
     800}                                                                                   \
     801while (0)
     802
     803
     804#define _p_MemCmp_Bitmask(i, actionS)                                       \
     805do                                                                          \
     806{                                                                           \
     807  _i = i;                                                                   \
     808  _v1 = _s1[i];                                                             \
     809  _v2 = _s2[i];                                                             \
     810  if ((_v1 > _v2) ||                                                        \
     811      (((_v1 & _bitmask) ^ (_v2 & _bitmask)) != ((_v2 - _v1) & _bitmask)))     \
     812    actionS;                                                               \
     813}                                                                           \
     814while (0)
     815 
     816#define _p_MemCmp_Bitmask_LengthTwo(actionS)    \
     817  do                                            \
     818{                                               \
     819  _p_MemCmp_Bitmask(0, actionS);                \
     820  _p_MemCmp_Bitmask(1, actionS);                \
     821}                                               \
     822while (0)
     823
     824#define _p_MemCmp_Bitmask_LengthThree(actionS)  \
     825  do                                            \
     826{                                               \
     827  _p_MemCmp_Bitmask_LengthTwo(actionS);         \
     828  _p_MemCmp_Bitmask(2, actionS);                \
     829}                                               \
     830while (0)
     831
     832#define _p_MemCmp_Bitmask_LengthFour(actionS)   \
     833  do                                            \
     834{                                               \
     835  _p_MemCmp_Bitmask_LengthThree(actionS);    \
     836  _p_MemCmp_Bitmask(3, actionS);                \
     837}                                               \
     838while (0)
     839
     840
     841#define _p_MemCmp_Bitmask_LengthFive(actionS)   \
     842  do                                            \
     843{                                               \
     844  _p_MemCmp_Bitmask_LengthFour(actionS);     \
     845  _p_MemCmp_Bitmask(4, actionS);                \
     846}                                               \
     847while (0)
     848
     849
     850#define _p_MemCmp_Bitmask_LengthSix(actionS)    \
     851  do                                            \
     852{                                               \
     853  _p_MemCmp_Bitmask_LengthFive(actionS);     \
     854  _p_MemCmp_Bitmask(5, actionS);                \
     855}                                               \
     856while (0)
     857
     858#define _p_MemCmp_Bitmask_LengthSeven(actionS)  \
     859  do                                            \
     860{                                               \
     861  _p_MemCmp_Bitmask_LengthSix(actionS);      \
     862  _p_MemCmp_Bitmask(6, actionS);                \
     863}                                               \
     864while (0)
     865
     866#define _p_MemCmp_Bitmask_LengthEight(actionS)  \
     867do                                              \
     868{                                               \
     869  _p_MemCmp_Bitmask_LengthSeven(actionS);    \
     870  _p_MemCmp_Bitmask(7, actionS);                \
     871}                                               \
     872while (0)
     873
     874#define p_MemCmp_Bitmask_LengthZero(s1, s2, bitmask, length, actionG, actionS) actionG
     875
     876#define p_MemCmp_Bitmask_LengthOne(s1, s2, bitmask, length, actionG, actionS)   \
     877do                                                                              \
     878{                                                                               \
     879  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     880  _p_MemCmp_Bitmask(0, actionS);                                                \
     881  actionG;                                                                      \
     882}                                                                               \
     883while (0)
     884
     885#define p_MemCmp_Bitmask_LengthTwo(s1, s2, bitmask, length, actionG, actionS)   \
     886do                                                                              \
     887{                                                                               \
     888  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     889  _p_MemCmp_Bitmask_LengthTwo(actionS);                                         \
     890  actionG;                                                                      \
     891}                                                                               \
     892while (0)
     893
     894#define p_MemCmp_Bitmask_LengthThree(s1, s2, bitmask, length, actionG, actionS)   \
     895do                                                                              \
     896{                                                                               \
     897  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     898  _p_MemCmp_Bitmask_LengthThree(actionS);                                         \
     899  actionG;                                                                      \
     900}                                                                               \
     901while (0)
     902
     903#define p_MemCmp_Bitmask_LengthFour(s1, s2, bitmask, length, actionG, actionS)   \
     904do                                                                              \
     905{                                                                               \
     906  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     907  _p_MemCmp_Bitmask_LengthFour(actionS);                                         \
     908  actionG;                                                                      \
     909}                                                                               \
     910while (0)
     911
     912#define p_MemCmp_Bitmask_LengthFive(s1, s2, bitmask, length, actionG, actionS)   \
     913do                                                                              \
     914{                                                                               \
     915  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     916  _p_MemCmp_Bitmask_LengthFive(actionS);                                         \
     917  actionG;                                                                      \
     918}                                                                               \
     919while (0)
     920
     921#define p_MemCmp_Bitmask_LengthSix(s1, s2, bitmask, length, actionG, actionS)   \
     922do                                                                              \
     923{                                                                               \
     924  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     925  _p_MemCmp_Bitmask_LengthSix(actionS);                                         \
     926  actionG;                                                                      \
     927}                                                                               \
     928while (0)
     929
     930#define p_MemCmp_Bitmask_LengthSeven(s1, s2, bitmask, length, actionG, actionS) \
     931do                                                                              \
     932{                                                                               \
     933  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     934  _p_MemCmp_Bitmask_LengthSeven(actionS);                                       \
     935  actionG;                                                                      \
     936}                                                                               \
     937while (0)
     938
     939#define p_MemCmp_Bitmask_LengthEigth(s1, s2, bitmask, length, actionG, actionS) \
     940do                                                                              \
     941{                                                                               \
     942  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     943  _p_MemCmp_Bitmask_LengthEigth(actionS);                                       \
     944  actionG;                                                                      \
     945}                                                                               \
     946while (0)
     947
     948
    767949#endif // P_MEM_CMP
Note: See TracChangeset for help on using the changeset viewer.