[SOLVED] CS代考计算机代写 /* Creates a 128 kB file and repeatedly shuffles data in it

30 $

File Name: CS代考计算机代写_/*_Creates_a_128_kB_file_and_repeatedly_shuffles_data_in_it.zip
File Size: 781.86 KB

SKU: 1799556382 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


/* Creates a 128 kB file and repeatedly shuffles data in it
through a memory mapping. */

#include
#include
#include
#include “tests/arc4.h”
#include “tests/cksum.h”
#include “tests/lib.h”
#include “tests/main.h”

#define SIZE (128 * 1024)

static char *buf = (char *) 0x10000000;

void
test_main (void)
{
size_t i;
int handle;

/* Create file, mmap. */
CHECK (create (“buffer”, SIZE), “create ”buffer””);
CHECK ((handle = open (“buffer”)) > 1, “open ”buffer””);
CHECK (mmap (handle, buf) != MAP_FAILED, “mmap ”buffer””);

/* Initialize. */
for (i = 0; i < SIZE; i++)buf[i] = i * 257;msg (“init: cksum=%lu”, cksum (buf, SIZE));/* Shuffle repeatedly. */for (i = 0; i < 10; i++){shuffle (buf, SIZE, 1);msg (“shuffle %zu: cksum=%lu”, i, cksum (buf, SIZE));}}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考计算机代写 /* Creates a 128 kB file and repeatedly shuffles data in it
30 $