Find Jobs
Hire Freelancers

Bit-level operations used in system programming

$25-30 USD

Completed
Posted over 20 years ago

$25-30 USD

Paid on delivery
Objective: In this assignment, you will do some bit-level operations, commonly used in system programming. DESCRIPTION Part-1 ------ - The left-shift operator can be used to pack two characters values into an unsigned integer variable. Write a program that inputs two characters from the keyboard and passes them to function packCharacters(). - To pack two characters into an unsigned integer variable, assign the first character to the unsigned variable, shift the unsigned variable left by 8 bit positions and combine the unsigned variable with the second character using the bitwise inclusive-OR operator. - The program should output the characters in their bit format before and after they are packed into the unsigned integer to prove that the characters are in fact packed correctly in the unsigned variable. Part-2 ------ - Using the right-shift operator, the bitwise AND operator and a mask, write a function unpackCharacters that takes the unsigned integer from first part and unpacks it into two characters. To unpack two characters from an unsigned integer, combine the unsigned integer with the mask 65280 (11111111 00000000) and right-shift the result 8 bits. Assign the resulting value to a char variable. - Then, combine the unsigned integer with the mask 255 (00000000 11111111). Assign the result to another char variable. The program should print the unsigned integer in bits before it is unpacked, then print the characters in bits to confirm that they were unpacked correctly. DisplayBits(unsigned value) function: - Write a separate function, which displays unsigned number in bits. This function can be used whenever you have to display the number in bit form. Hints: '<<' is the left shift operator and '>>' is the right shift operator in C. '|' (vertical split bar) is bitwise OR and '&' is bitwise AND operator. '^' is Exclusive-OR and '~' is not operator ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform Unix
Project ID: 3093763

About the project

4 proposals
Remote project
Active 20 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$7 USD in 3 days
4.7 (7 reviews)
2.2
2.2
4 freelancers are bidding on average $14 USD for this job
User Avatar
See private message.
$17 USD in 3 days
5.0 (23 reviews)
3.4
3.4
User Avatar
See private message.
$17 USD in 3 days
5.0 (2 reviews)
0.7
0.7
User Avatar
See private message.
$15.30 USD in 3 days
0.0 (3 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
4.9
11
Member since Feb 5, 2004

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.