Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ Write a compression function that reads in an array of numbers where each number is from 0 to 3 (2 bits). Compress into

in c++

Write a compression function that reads in an array of numbers where each number is from 0 to 3 (2 bits). Compress into a single 64-bit word then write out to output. 65 numbers in a, write out 3 numbers into output, the first two are full, and the last one has only a single value

uint64_t compress(const uint32_t in[], uint32_t len, uint64_t out[]){

};

main(){

uint32_t a[65];

uint64_t out[3] = {0,0,0};

for (int i = 0; i < 65; i++) {

a[i] = i % 4;

}

uint64_t out_len = compress(a, 65, out);

for (uint32_t i = 0; i < out_len; i++) {

cout << bitset<64>(out[i]) << '\t';

cout << ' ';

}

}

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

l Define job evaluation and discuss four methods of performing it.

Answered: 1 week ago

Question

Briefly explain the various types of leadership ?

Answered: 1 week ago

Question

Explain the need for and importance of co-ordination?

Answered: 1 week ago

Question

Explain the contribution of Peter F. Drucker to Management .

Answered: 1 week ago

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago