Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/** Class: ense352 Description: Test code for as1 q1.cpp */ #include #include #include #include q1.h // students must write this file //////////////////////////////////////////////////////////////// // test code

/** Class: ense352 Description: Test code for as1 q1.cpp */

#include #include #include

#include "q1.h" // students must write this file

//////////////////////////////////////////////////////////////// // test code

// FIXME: should rewrite so the type of x can be changed throughout to // short int or simply int. Perhaps a template class

void test_0x89abcdef_0x76543210() { int res = shuffle_words(0x89abcdef, 0x76543210); assert(res == 0x895432ef); } void test_0x00000000_0xfefefefe() { int res = shuffle_words(0x00000000, 0xfefefefe); // the cast to signed is necessary to avoid a compiler warning about // comparison between signed and unsigned integers. assert(res == (signed)0x00fefe00); }

int main() { std::cout

image text in transcribed

1. (5 marks) Implement a C function with the following prototype * Given words x and y, assumed to be at least 32-bits in size, return * a word composed of bytes 0 and 3 of x, and the remaining bytes taken * from y. * For operands \texttt{x = Ox89ABCDEF} and \texttt{y = 0x76543210, this would give \texttt10x895432EF int shufflel_words(int x, int y)

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_2

Step: 3

blur-text-image_3

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

1. Identify an organization to analyze, preferably your employer.

Answered: 1 week ago