subject

The C library function memset(p, c,n) writes (uint8_t)(c) repeatedly n times begininig at the address held in pointer p. Sometimes it is more efficient or convenient to copy a multibyte quantity instead of a single byte one. Implement the following function. void memset16(void *b, int num_bytes, void *pattern16)
In this function, b has the address of a memory buffer that is num_bytes long. The function should repeatedly copy the 16 byte pattern that pattern16 points at into the memory buffer until num_bytes have been written. If num_bytes is not a multple of 16, the final wriite of the 16 byte pattern should be truncated to finish filling the buffer.
For example if the 16 bytes that pattern16 points at is 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff, then memset(b, 20, pattern16) should write to the buffer pointed at by p the 20 bytes 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 00 11 22 33.
Use SSE instructions to improve efficiency. Here's pseudocode.
x = SSE unaligned load from pattern16
while (num_bytes >= 16)
SSE unaligned store x to p
advance p by 16 bytes
decrement num_bytes by 16
while (num_bytes > 0)
store 1 byte from pattern16 to p
advance p by 1 byte
advance pattern16 by 1 byte
decrement num_bytes by 1
void memset16(void *p, void *pattern16, int num_bytes)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 15:30
Some of the items below indicate the steps required to move a slide to a different location in a presentation. select those steps and indicate the order in which they should be performed to move the slide. (for example, if an item describes what you do first, select 1.) included in the list are items that are not part of the process. for these items, select n/a, an abbreviation for not applicable. 1 — first 2 — second 3 — third 4 — fourth 5 — fifth 6 — sixth n/a — not applicable drag the slide to the desired place. enter the slide position desired. hold the mouse button down. select move from the tools menu. select the slide. switch to the notes view.
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
In the context of the box model, what is the difference between a margin and a padding? a. a padding lies outside a box border, while a margin lies inside it. b. a padding lies inside a box border, while a margin lies outside it. c. a padding can be adjusted independently, while a margin depends on the size of its box. d. a padding depends on the size of its box, while a margin can be adjusted independently.
Answers: 3
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe what
Answers: 1
You know the right answer?
The C library function memset(p, c,n) writes (uint8_t)(c) repeatedly n times begininig at the addres...
Questions
question
Chemistry, 07.12.2020 03:50
question
Business, 07.12.2020 03:50
question
Arts, 07.12.2020 03:50
question
Mathematics, 07.12.2020 03:50
question
Mathematics, 07.12.2020 03:50
Questions on the website: 13722362