ReactOS 0.4.16-dev-927-g467dec4
swab.cpp
Go to the documentation of this file.
1//
2// swab.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines the _swab function, which copies a source buffer into a destination
7// buffer, swapping the odd and even bytes of each word as it does so.
8//
9#include <corecrt_internal.h>
10#include <stdlib.h>
11
12
13
14extern "C" void __cdecl _swab(
15 char* source,
16 char* destination,
17 int bytes
18 )
19{
21 _VALIDATE_RETURN_VOID(destination != nullptr, EINVAL);
23
24 while (bytes > 1)
25 {
26 char const b1 = *source++;
27 char const b2 = *source++;
28
29 *destination++ = b2;
30 *destination++ = b1;
31
32 bytes -= 2;
33 }
34}
#define EINVAL
Definition: acclib.h:90
#define __cdecl
Definition: accygwin.h:79
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define _VALIDATE_RETURN_VOID(expr, errorcode)
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
void __cdecl _swab(char *source, char *destination, int bytes)
Definition: swab.cpp:14