home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_11_09 / 1109086a < prev    next >
Text File  |  1993-07-08  |  1KB  |  39 lines

  1. sun_vaddosb(vect_in1,incr_in1,vect_in2,incr_in2,
  2.                 vect_out,incr_out,vect_length)
  3. float *vect_in1, *vect_in2, *vect_out;
  4. int vect_length, incr_in1, incr_in2, incr_out;
  5.  
  6. {
  7.  
  8.         register float tmp,
  9.                  tmp_1,
  10.                  tmp_2;
  11.  
  12.         if((incr_in1 == 1) && (incr_in2 == 1) && (incr_out == 1))
  13.         {
  14.                 while(vect_length--)
  15.                 {
  16.                         tmp_1 = *vect_in1++;
  17.                         tmp_2 = *vect_in2++;
  18.                         tmp   = tmp_1 - tmp_2;
  19.          
  20.                                 *vect_out++ =  (tmp_1 + tmp_2) / tmp;
  21.                 }
  22.         }
  23.         else
  24.         {
  25.         while(vect_length--)
  26.                 {
  27.                 tmp_1 = *vect_in1;
  28.                 tmp_2 = *vect_in2;
  29.                 tmp   = tmp_1 - tmp_2;
  30.              
  31.                         *vect_out =  (tmp_1 + tmp_2) / tmp;
  32.  
  33.                         vect_in1 += incr_in1;
  34.                         vect_in2 += incr_in2;
  35.                         vect_out += incr_out;
  36.         }
  37.       }
  38.  }
  39.