SlideShare a Scribd company logo
Can you help me write these functions in C? I do not need the main function. Thank you. The
language is C, NOT C++ in vertBits Description: Accepts a pointer of size uint32 tand inverts
eachbit of the input data passed Preconditions: Input argument is passed as a pointer Post-
conditions: The number of 1s returned Calls: N/A Called by: main int countNumberofones
(uint32 t intData) Write a function that counts numberof ls in an integerpassed setBit
Description: The functionsets the bit in the specified bit position in an to the specifid value. ue
can be a or 0. bitPosition will be between U an Postconditions: The bit of inData at position
biPosition will be set to walue Calls: N/A Called by main void setBit(uint32 t inData, uint32
tbitPosition.uint32 t alue hammingDistance Description: Function hammingDistance calculates
total number of bits that need to be inverted in order to change inData1 into inData2 orvice versa.
Preconditions: The function accepts two unsigned integers as input Postconditions: Thefunction
returns the hamming distance Calls N/A Called by: main int hammi tinDatal, unint32 tinData2)
Solution
int countNumberofOnes(uint32_t *intData)
{
*intData = ~(*intData); // inverts each bit in input
uint32_t num = *intData;
int count =0;
while(number)
{
number &= (number-1);
count ++;
}
return count;
// return number of 1s in the number
}
void setBit(uint32_t *intData, uint32_t bitPosition,uint32_t value)
{
(*intData) ^= (-value ^ ((*intData)) & (1 << bitPosition);
return (*intData);
}
int hammingDistance(uint32_t inData1,uint32_t inData2)
{
char * d1 =(char *)intData1;
char * d2 =(char *)intData2;
int count =0;
// considering both of same length
for (int i=0;i

More Related Content

Similar to Can you help me write these functions in C I do not need the main f.pdf

Bitwise Operations(1).pdf
Bitwise Operations(1).pdfBitwise Operations(1).pdf
Bitwise Operations(1).pdf
DalvinCalvin
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
ShashiShash2
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
Abubakar524802
 
C Programming - Refresher - Part III
C Programming - Refresher - Part IIIC Programming - Refresher - Part III
C Programming - Refresher - Part III
Emertxe Information Technologies Pvt Ltd
 
UNIT3.pptx
UNIT3.pptxUNIT3.pptx
UNIT3.pptx
NagasaiT
 
Computer Programming- Lecture 3
Computer Programming- Lecture 3Computer Programming- Lecture 3
Computer Programming- Lecture 3
Dr. Md. Shohel Sayeed
 
C Programming Language
C Programming LanguageC Programming Language
C Programming Language
RTS Tech
 
C++ Overview
C++ OverviewC++ Overview
C++ Overviewkelleyc3
 
Number formats for signals and coefficients in DSP system
Number formats for signals and coefficients in DSP systemNumber formats for signals and coefficients in DSP system
Number formats for signals and coefficients in DSP system
sarithabanala
 
Math cl ccw_siemens_rev01_fa16
Math cl ccw_siemens_rev01_fa16Math cl ccw_siemens_rev01_fa16
Math cl ccw_siemens_rev01_fa16
John Todora
 
Implementation of character translation integer and floating point values
Implementation of character translation integer and floating point valuesImplementation of character translation integer and floating point values
Implementation of character translation integer and floating point values
غزالة
 
Unit iv functions
Unit  iv functionsUnit  iv functions
Unit iv functions
indra Kishor
 
User defined functions
User defined functionsUser defined functions
User defined functions
Rokonuzzaman Rony
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
simenehanmut
 
Fundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programmingFundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programming
LidetAdmassu
 
II Floating Point Representation Using Strings Understanding how float.pdf
II Floating Point Representation Using Strings Understanding how float.pdfII Floating Point Representation Using Strings Understanding how float.pdf
II Floating Point Representation Using Strings Understanding how float.pdf
asarudheen07
 
C++ Language
C++ LanguageC++ Language
C++ Language
Syed Zaid Irshad
 
Module_2_dspgggffffggggggggggggggga.pptx
Module_2_dspgggffffggggggggggggggga.pptxModule_2_dspgggffffggggggggggggggga.pptx
Module_2_dspgggffffggggggggggggggga.pptx
realme6igamerr
 

Similar to Can you help me write these functions in C I do not need the main f.pdf (20)

Bitwise Operations(1).pdf
Bitwise Operations(1).pdfBitwise Operations(1).pdf
Bitwise Operations(1).pdf
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
 
C Programming - Refresher - Part III
C Programming - Refresher - Part IIIC Programming - Refresher - Part III
C Programming - Refresher - Part III
 
Pointers
PointersPointers
Pointers
 
UNIT3.pptx
UNIT3.pptxUNIT3.pptx
UNIT3.pptx
 
Computer Programming- Lecture 3
Computer Programming- Lecture 3Computer Programming- Lecture 3
Computer Programming- Lecture 3
 
C Programming Language
C Programming LanguageC Programming Language
C Programming Language
 
C++ Overview
C++ OverviewC++ Overview
C++ Overview
 
Number formats for signals and coefficients in DSP system
Number formats for signals and coefficients in DSP systemNumber formats for signals and coefficients in DSP system
Number formats for signals and coefficients in DSP system
 
Math cl ccw_siemens_rev01_fa16
Math cl ccw_siemens_rev01_fa16Math cl ccw_siemens_rev01_fa16
Math cl ccw_siemens_rev01_fa16
 
Implementation of character translation integer and floating point values
Implementation of character translation integer and floating point valuesImplementation of character translation integer and floating point values
Implementation of character translation integer and floating point values
 
Unit iv functions
Unit  iv functionsUnit  iv functions
Unit iv functions
 
C++ programming
C++ programmingC++ programming
C++ programming
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
 
Fundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programmingFundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programming
 
II Floating Point Representation Using Strings Understanding how float.pdf
II Floating Point Representation Using Strings Understanding how float.pdfII Floating Point Representation Using Strings Understanding how float.pdf
II Floating Point Representation Using Strings Understanding how float.pdf
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Module_2_dspgggffffggggggggggggggga.pptx
Module_2_dspgggffffggggggggggggggga.pptxModule_2_dspgggffffggggggggggggggga.pptx
Module_2_dspgggffffggggggggggggggga.pptx
 

More from eyebolloptics

How does law enforcement, courts and corrections work to complemen.pdf
How does law enforcement, courts and corrections work to complemen.pdfHow does law enforcement, courts and corrections work to complemen.pdf
How does law enforcement, courts and corrections work to complemen.pdf
eyebolloptics
 
Check all that apply to different sets of genes that are homologous..pdf
Check all that apply to different sets of genes that are homologous..pdfCheck all that apply to different sets of genes that are homologous..pdf
Check all that apply to different sets of genes that are homologous..pdf
eyebolloptics
 
For the following matrices, determine a cot of basis vectors for the.pdf
For the following matrices, determine a cot of basis vectors for  the.pdfFor the following matrices, determine a cot of basis vectors for  the.pdf
For the following matrices, determine a cot of basis vectors for the.pdf
eyebolloptics
 
Exploring Organizational Culture Research the ITT Tech Virtual Lib.pdf
Exploring Organizational Culture Research the ITT Tech Virtual Lib.pdfExploring Organizational Culture Research the ITT Tech Virtual Lib.pdf
Exploring Organizational Culture Research the ITT Tech Virtual Lib.pdf
eyebolloptics
 
Drag the term or statement to the correct column SolutionC.pdf
Drag the term or statement to the correct column  SolutionC.pdfDrag the term or statement to the correct column  SolutionC.pdf
Drag the term or statement to the correct column SolutionC.pdf
eyebolloptics
 
Define the labor relations processSolutionThe labor relations.pdf
Define the labor relations processSolutionThe labor relations.pdfDefine the labor relations processSolutionThe labor relations.pdf
Define the labor relations processSolutionThe labor relations.pdf
eyebolloptics
 
Accounting 5205Solution Depreciation aims to recognize in the.pdf
Accounting 5205Solution Depreciation aims to recognize in the.pdfAccounting 5205Solution Depreciation aims to recognize in the.pdf
Accounting 5205Solution Depreciation aims to recognize in the.pdf
eyebolloptics
 
Aiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdf
Aiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdfAiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdf
Aiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdf
eyebolloptics
 
an encryption scheme distributes randomly over the Ascii characters .pdf
an encryption scheme distributes randomly over the Ascii characters .pdfan encryption scheme distributes randomly over the Ascii characters .pdf
an encryption scheme distributes randomly over the Ascii characters .pdf
eyebolloptics
 
A class has 40 students aged 17 to 34. What is the probabilty that a.pdf
A class has 40 students aged 17 to 34. What is the probabilty that a.pdfA class has 40 students aged 17 to 34. What is the probabilty that a.pdf
A class has 40 students aged 17 to 34. What is the probabilty that a.pdf
eyebolloptics
 
A microbial geneticist isolates a new mutation in E. coli and wishes.pdf
A microbial geneticist isolates a new mutation in E. coli and wishes.pdfA microbial geneticist isolates a new mutation in E. coli and wishes.pdf
A microbial geneticist isolates a new mutation in E. coli and wishes.pdf
eyebolloptics
 
30. The vouching of recorded payables to supporting documentation wil.pdf
30. The vouching of recorded payables to supporting documentation wil.pdf30. The vouching of recorded payables to supporting documentation wil.pdf
30. The vouching of recorded payables to supporting documentation wil.pdf
eyebolloptics
 
3. Observe that every cation was initially part of a nitrate compound.pdf
3. Observe that every cation was initially part of a nitrate compound.pdf3. Observe that every cation was initially part of a nitrate compound.pdf
3. Observe that every cation was initially part of a nitrate compound.pdf
eyebolloptics
 
1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf
1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf
1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf
eyebolloptics
 
At what point does commercialization start to create inequality Ple.pdf
At what point does commercialization start to create inequality Ple.pdfAt what point does commercialization start to create inequality Ple.pdf
At what point does commercialization start to create inequality Ple.pdf
eyebolloptics
 
A benefit of an activity received by people not participating in the.pdf
A benefit of an activity received by people not participating in the.pdfA benefit of an activity received by people not participating in the.pdf
A benefit of an activity received by people not participating in the.pdf
eyebolloptics
 
You are given a specification for some Java classes as follows.  A.pdf
You are given a specification for some Java classes as follows.  A.pdfYou are given a specification for some Java classes as follows.  A.pdf
You are given a specification for some Java classes as follows.  A.pdf
eyebolloptics
 
8. Would the following cell have a spontaneous reaction Explain. .pdf
8. Would the following cell have a spontaneous reaction Explain. .pdf8. Would the following cell have a spontaneous reaction Explain. .pdf
8. Would the following cell have a spontaneous reaction Explain. .pdf
eyebolloptics
 
Write a command to find out how many users in etcpasswd have the l.pdf
Write a command to find out how many users in etcpasswd have the l.pdfWrite a command to find out how many users in etcpasswd have the l.pdf
Write a command to find out how many users in etcpasswd have the l.pdf
eyebolloptics
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
eyebolloptics
 

More from eyebolloptics (20)

How does law enforcement, courts and corrections work to complemen.pdf
How does law enforcement, courts and corrections work to complemen.pdfHow does law enforcement, courts and corrections work to complemen.pdf
How does law enforcement, courts and corrections work to complemen.pdf
 
Check all that apply to different sets of genes that are homologous..pdf
Check all that apply to different sets of genes that are homologous..pdfCheck all that apply to different sets of genes that are homologous..pdf
Check all that apply to different sets of genes that are homologous..pdf
 
For the following matrices, determine a cot of basis vectors for the.pdf
For the following matrices, determine a cot of basis vectors for  the.pdfFor the following matrices, determine a cot of basis vectors for  the.pdf
For the following matrices, determine a cot of basis vectors for the.pdf
 
Exploring Organizational Culture Research the ITT Tech Virtual Lib.pdf
Exploring Organizational Culture Research the ITT Tech Virtual Lib.pdfExploring Organizational Culture Research the ITT Tech Virtual Lib.pdf
Exploring Organizational Culture Research the ITT Tech Virtual Lib.pdf
 
Drag the term or statement to the correct column SolutionC.pdf
Drag the term or statement to the correct column  SolutionC.pdfDrag the term or statement to the correct column  SolutionC.pdf
Drag the term or statement to the correct column SolutionC.pdf
 
Define the labor relations processSolutionThe labor relations.pdf
Define the labor relations processSolutionThe labor relations.pdfDefine the labor relations processSolutionThe labor relations.pdf
Define the labor relations processSolutionThe labor relations.pdf
 
Accounting 5205Solution Depreciation aims to recognize in the.pdf
Accounting 5205Solution Depreciation aims to recognize in the.pdfAccounting 5205Solution Depreciation aims to recognize in the.pdf
Accounting 5205Solution Depreciation aims to recognize in the.pdf
 
Aiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdf
Aiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdfAiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdf
Aiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdf
 
an encryption scheme distributes randomly over the Ascii characters .pdf
an encryption scheme distributes randomly over the Ascii characters .pdfan encryption scheme distributes randomly over the Ascii characters .pdf
an encryption scheme distributes randomly over the Ascii characters .pdf
 
A class has 40 students aged 17 to 34. What is the probabilty that a.pdf
A class has 40 students aged 17 to 34. What is the probabilty that a.pdfA class has 40 students aged 17 to 34. What is the probabilty that a.pdf
A class has 40 students aged 17 to 34. What is the probabilty that a.pdf
 
A microbial geneticist isolates a new mutation in E. coli and wishes.pdf
A microbial geneticist isolates a new mutation in E. coli and wishes.pdfA microbial geneticist isolates a new mutation in E. coli and wishes.pdf
A microbial geneticist isolates a new mutation in E. coli and wishes.pdf
 
30. The vouching of recorded payables to supporting documentation wil.pdf
30. The vouching of recorded payables to supporting documentation wil.pdf30. The vouching of recorded payables to supporting documentation wil.pdf
30. The vouching of recorded payables to supporting documentation wil.pdf
 
3. Observe that every cation was initially part of a nitrate compound.pdf
3. Observe that every cation was initially part of a nitrate compound.pdf3. Observe that every cation was initially part of a nitrate compound.pdf
3. Observe that every cation was initially part of a nitrate compound.pdf
 
1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf
1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf
1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdf
 
At what point does commercialization start to create inequality Ple.pdf
At what point does commercialization start to create inequality Ple.pdfAt what point does commercialization start to create inequality Ple.pdf
At what point does commercialization start to create inequality Ple.pdf
 
A benefit of an activity received by people not participating in the.pdf
A benefit of an activity received by people not participating in the.pdfA benefit of an activity received by people not participating in the.pdf
A benefit of an activity received by people not participating in the.pdf
 
You are given a specification for some Java classes as follows.  A.pdf
You are given a specification for some Java classes as follows.  A.pdfYou are given a specification for some Java classes as follows.  A.pdf
You are given a specification for some Java classes as follows.  A.pdf
 
8. Would the following cell have a spontaneous reaction Explain. .pdf
8. Would the following cell have a spontaneous reaction Explain. .pdf8. Would the following cell have a spontaneous reaction Explain. .pdf
8. Would the following cell have a spontaneous reaction Explain. .pdf
 
Write a command to find out how many users in etcpasswd have the l.pdf
Write a command to find out how many users in etcpasswd have the l.pdfWrite a command to find out how many users in etcpasswd have the l.pdf
Write a command to find out how many users in etcpasswd have the l.pdf
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
 

Recently uploaded

Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 

Recently uploaded (20)

Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 

Can you help me write these functions in C I do not need the main f.pdf

  • 1. Can you help me write these functions in C? I do not need the main function. Thank you. The language is C, NOT C++ in vertBits Description: Accepts a pointer of size uint32 tand inverts eachbit of the input data passed Preconditions: Input argument is passed as a pointer Post- conditions: The number of 1s returned Calls: N/A Called by: main int countNumberofones (uint32 t intData) Write a function that counts numberof ls in an integerpassed setBit Description: The functionsets the bit in the specified bit position in an to the specifid value. ue can be a or 0. bitPosition will be between U an Postconditions: The bit of inData at position biPosition will be set to walue Calls: N/A Called by main void setBit(uint32 t inData, uint32 tbitPosition.uint32 t alue hammingDistance Description: Function hammingDistance calculates total number of bits that need to be inverted in order to change inData1 into inData2 orvice versa. Preconditions: The function accepts two unsigned integers as input Postconditions: Thefunction returns the hamming distance Calls N/A Called by: main int hammi tinDatal, unint32 tinData2) Solution int countNumberofOnes(uint32_t *intData) { *intData = ~(*intData); // inverts each bit in input uint32_t num = *intData; int count =0; while(number) { number &= (number-1); count ++; } return count; // return number of 1s in the number } void setBit(uint32_t *intData, uint32_t bitPosition,uint32_t value) { (*intData) ^= (-value ^ ((*intData)) & (1 << bitPosition); return (*intData);
  • 2. } int hammingDistance(uint32_t inData1,uint32_t inData2) { char * d1 =(char *)intData1; char * d2 =(char *)intData2; int count =0; // considering both of same length for (int i=0;i