Find Jobs
Hire Freelancers

Bit-level operations used in system programming

$25-30 USD

Concluído
Publicado há aproximadamente 20 anos

$25-30 USD

Pago na entrega
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
ID do Projeto: 3093763

Sobre o projeto

4 propostas
Projeto remoto
Ativo há 20 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
Concedido a:
Avatar do Usuário
See private message.
$7 USD em 3 dias
4,7 (7 avaliações)
2,2
2,2
4 freelancers estão ofertando em média $14 USD for esse trabalho
Avatar do Usuário
See private message.
$17 USD em 3 dias
5,0 (23 avaliações)
3,4
3,4
Avatar do Usuário
See private message.
$17 USD em 3 dias
5,0 (2 avaliações)
0,7
0,7
Avatar do Usuário
See private message.
$15,30 USD em 3 dias
0,0 (3 avaliações)
0,0
0,0

Sobre o cliente

Bandeira do(a) UNITED STATES
United States
4,9
11
Membro desde fev. 5, 2004

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.