Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SML pls! A bitwise AND takes two equal-length binary representations and performs the logical AND operation on each pair of the corresponding bits. Thus, if

SML pls!

A bitwise AND takes two equal-length binary representations and performs the logical AND operation on each pair of the corresponding bits. Thus, if both bits in the compared position are 1, the bit in the resulting binary representation is 1. Otherwise, the result is 0. For example the bitwise AND of 10110 and 10011 is 10010. Write an SML function bitwise_and that takes two integers as parameters and returns the 8-bit bitwise AND of the two integers' binary representations as a list of 1s and 0s. You may assume that both parameters are in the range 0 through 255, inclusive. Examples:

bitwise_and(31, 12) would return [0,0,0,0,1,1,0,0]

bitwise_and(45, 172) would return [0,0,1,0,1,1,0,0]

bitwise_and(65, 255) would return [0,1,0,0,0,0,0,1]

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions