51 unsigned short safeAdd(
unsigned short addend1,
unsigned short addend2){
53 return addend1 + addend2;
67 unsigned short safeTrim(
unsigned short addend1,
signed short addend2){
70 if(addend1 > -addend2){
71 return addend1 + addend2;
75 }
else if(addend2 > 0){
77 return addend1 + addend2;
97 unsigned short safeScale(
unsigned short baseValue,
unsigned short dividend,
unsigned short divisor){
99 unsigned short scaled = ((
unsigned long)baseValue * dividend) / divisor;
103 if((dividend > divisor) && (baseValue > scaled)){
187 unsigned short addr = (
unsigned short)Arrays;
194 for(loop=0;loop<16;loop += 2){
261 unsigned char checksum(
unsigned char *block,
unsigned short length){
262 unsigned char sum = 0;
263 while (length-- > 0){
279 unsigned short stringCopy(
unsigned char* dest,
unsigned char* source){
280 unsigned short length = 0;
284 }
while(*(source-1) != 0);
293 unsigned short compare(
unsigned char* original,
unsigned char* toCheck,
unsigned short length){
295 for(i=0;i<length;i++){
296 if(original[i] != toCheck[i]){