Main C file
//-Global definition area of the C file-
#include "ALops_func.h"
//include the user defined header file containing adder function
//---main of the program---
int main(void){
volatile unsigned int temp0=0x9F00,temp1=0X6A0,temp2=0x0;
//define 13 variable of the data type long
volatile unsigned int temp3=0x0,temp5=0x0,temp6=0x0,temp7=0x0;
volatile unsigned int temp8=0x0,temp9=0x0,temp10=0x0,temp11=0x0;
volatile unsigned int temp12=0x0;
volatile unsigned long long temp4=0x0;
//define a variable of the data type long
temp2=add2(temp0,temp1);
temp3=sub2(temp0,temp1);
temp4=mul2(temp0,temp1);
temp5=div2(temp0,temp1);
temp6=rem (temp0,temp1);
temp7=and2(temp0,temp1);
temp8=or2(temp0,temp1);
temp9=xor2(temp0,temp1);
temp10=inv(temp0);
//left shift by 2 bit
temp11=left_shift(temp0,2);
//right shift by 2 bit
temp12=right_shift(temp0,2);
return(0);
}
// now you need to create header file same like C file you are creating
procedure: goto new file -> create new file -> paste code below mentioned -> save it with name ALops_func.h -> header file is ready to use
//Function defined in global definition area
unsigned int add2(unsigned int ,unsigned int );
unsigned int sub2(unsigned int ,unsigned int );
unsigned long long mul2(unsigned int ,unsigned int );
unsigned int div2(unsigned int ,unsigned int );
unsigned int rem (unsigned int ,unsigned int );
unsigned int and2(unsigned int ,unsigned int );
unsigned int or2(unsigned int ,unsigned int );
unsigned int xor2(unsigned int ,unsigned int );
unsigned int inv(unsigned int );
unsigned int left_shift(unsigned int ,unsigned int );
unsigned int right_shift(unsigned int ,unsigned int );
/*starting of the header file*/
#if!defined(ALops_func_h_)
/*Check if memory map has not been already included */
#define ALops_func_h_
//-bodyofheaderfile-
//addition of two unsigned integer
unsigned int add2(unsigned int x,unsigned int y){return(x+y);}
//subtraction of two unsigned integer
unsigned int sub2(unsigned int x,unsigned int y){return(x-y);}
//multiplicationof two unsigned integer
unsigned long long mul2(unsigned int x,unsigned int y){return(x*y);}
//divisonoftwo unsigned integer
unsigned int div2(unsigned int x,unsigned int y){return(x/y);}
//Modulus(remainder) of two unsigned integer
unsigned int rem (unsigned int x,unsigned int y){return(x%y);}
//AND of two unsigned integer
unsigned int and2(unsigned int x,unsigned int y){return(x&y);}
//OR of two unsigned integer
unsigned int or2(unsigned int x,unsigned int y){return(x|y);}
//XOR of two unsigned integer
unsigned int xor2(unsigned int x,unsigned int y){return(x^y);}
//invert the unsigned integer
unsigned int inv(unsigned int x){return(~x);}
//left shift by Y bits
unsigned int left_shift(unsigned int x,unsigned int y){return(x<<y);}
//right shift by Y bits
unsigned int right_shift(unsigned int x,unsigned int y){return(x>>y);}
//--endofthebody--
#endif