Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Introduction The purpose of this assignment is to become more familiar with bit-level operations and bit-level representations of integers. Youll do this by solving

1 Introduction

The purpose of this assignment is to become more familiar with bit-level operations and bit-level representations of integers. Youll do this by solving a series of programming puzzles. Many of these puzzles are quite artificial, but youll find yourself thinking much more about bits in working your way through them.

2 Logistics

This is an individual project. All handins are electronic. Clarifications and corrections will be posted to the discussion forum on D2L.

3 Handout Instructions

When you login, you should see a directory named datalab in your home directory. It contains a number of files, but the only file you will be modifying and turning in is bits.c.

The bits.c file contains a skeleton for each of the 11 programming puzzles. Your assignment is to complete each function skeleton using only straightline code (i.e., no loops or conditionals) and a limited number of C arithmetic and logical operators. Specifically, you are only allowed to use the following eight operators:

! & | + >

A few of the functions further restrict this list. Also, you are not allowed to use any constants longer than 8 bits. See the comments in bits.c for detailed rules and a discussion of the desired coding style. 1

image text in transcribed

image text in transcribed

minusThree return a value of 3 Legal ops: &+>> Max ops: 2 Rating: 10 / int minusThree(void) \{ return 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions