- Added some hipadab array math
- Added missing cnvrt files, stolen from Markus - Debugged the new sinqhttpopt driver for SINQ HTTP HM - Debugged the driver for the new S7 Siemens SPS - Added handling of hexadecimal terminators to ascon.c - Increased the write buffer size in asynnet again - Fixed a core dump in lld.c - Added writing of second gen HM to nxscript.c - Added doubletime command to SICS - Fixed a core dump issue in sicshdbadapter.c on dimension changes - Modified sicsobj to look for lower case keys too SKIPPED: psi/cnvrt.c psi/cnvrt.h psi/el734hp.c psi/make_gen psi/sinqhttpopt.c psi/sinqhttpprot.c psi/spss7.c psi/swmotor.c
This commit is contained in:
46
arrayutil.c
Normal file
46
arrayutil.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* arrayutil.c
|
||||
*
|
||||
* copyright: see file COPYRIGHT
|
||||
*
|
||||
* some utilities for dealing with arrays
|
||||
*
|
||||
* Created on: Mar 16, 2011
|
||||
* Author: koennecke
|
||||
*/
|
||||
|
||||
long sumWindow(int *data, int xstart, int xend, int xlength,
|
||||
int ystart, int yend, int ylength)
|
||||
{
|
||||
int i,j;
|
||||
long result = 0;
|
||||
int *row;
|
||||
|
||||
if(xstart < 0 || xstart > xlength){
|
||||
return -2;
|
||||
}
|
||||
if(xend < 0 || xend > xlength){
|
||||
return -2;
|
||||
}
|
||||
if(xend < xstart){
|
||||
return -2;
|
||||
}
|
||||
if(ystart < 0 || ystart > ylength){
|
||||
return -2;
|
||||
}
|
||||
if(yend < 0 || yend > ylength){
|
||||
return -2;
|
||||
}
|
||||
if(yend < ystart){
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
for(j = ystart; j < yend; j++){
|
||||
row = data + j*xlength;
|
||||
for(i = xstart; i < xend; i++){
|
||||
result += row[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user