mirror of
https://github.com/reactos/reactos.git
synced 2025-06-25 12:09:44 +00:00
[UCRT] Import Microsoft.Windows.SDK.CRTSource version 10.0.22621.3
Imported from https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource/10.0.22621.3 License: MIT
This commit is contained in:
parent
f1b60c66f0
commit
04e0dc4a7a
568 changed files with 115483 additions and 0 deletions
30
sdk/lib/ucrt/string/wcsrev.cpp
Normal file
30
sdk/lib/ucrt/string/wcsrev.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// wcsrev.cpp
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Defines _wcsrev(), which reverses a wide chraacter string in place. The
|
||||
// pointer to the string is returned.
|
||||
//
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
extern "C" wchar_t* __cdecl _wcsrev(wchar_t* const string)
|
||||
{
|
||||
// Find the end of the string:
|
||||
wchar_t* right = string;
|
||||
while (*right++) { }
|
||||
right -= 2;
|
||||
|
||||
// Reverse the strong:
|
||||
wchar_t* left = string;
|
||||
while (left < right)
|
||||
{
|
||||
wchar_t const c = *left;
|
||||
*left++ = *right;
|
||||
*right-- = c;
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue