Actual source code: setval.h

  1: /* $Id: setval.h,v 1.4 1999/05/12 03:25:57 bsmith Exp $ */

  3: /* This file contains definitions for INLINING some popular operations
  4:    All arguments should be simple and in register if possible.
  5:  */

  7: #ifndef SET

  9: #ifdef PETSC_USE_UNROLL_KERNELS
 10: #define SET(v,n,val) \
 11: switch (n&0x3) { \
 12: case 3: *v++ = val;\
 13: case 2: *v++ = val;\
 14: case 1: *v++ = val;n-=4;\
 15: case 0: while (n>0) {v[0]=val;v[1]=val;v[2]=val;v[3]=val;v+=4;n-=4;}}

 17: #elif defined(PETSC_USE_WHILE_KERNELS)
 18: #define SET(v,n,val) while (n--) *v++ = val;

 20: #else
 21: #define SET(v,n,val) {int __i;for(__i=0;__i<n;__i++)v[__i] = val;}
 22: #endif

 24: #endif