mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-30 03:37:44 +00:00
1. Enable warning "4503" # Decorated name length exceeded. 2. Enable warning "4146" # unary minus operator applied to unsigned type. 3. Enable float64 support for the Softmax operator 4. Enable compliance checks for Windows x86 32bits build 5. Use TryBatchParallelFor to replace some fallback code in mlas pooling.cc 6. Fix Android CI pipeline.
32 lines
No EOL
1.3 KiB
C++
32 lines
No EOL
1.3 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
#ifdef _WIN32
|
|
#include "core/common/common.h"
|
|
#include <Windows.h>
|
|
#include <assert.h>
|
|
|
|
namespace onnxruntime {
|
|
std::string ToMBString(const std::wstring& s) {
|
|
if (s.size() >= static_cast<size_t>(std::numeric_limits<int>::max())) throw std::runtime_error("length overflow");
|
|
const int src_len = static_cast<int>(s.size() + 1);
|
|
const int len = WideCharToMultiByte(CP_ACP, 0, s.data(), src_len, nullptr, 0, nullptr, nullptr);
|
|
assert(len > 0);
|
|
std::string ret(static_cast<size_t>(len) - 1, '\0');
|
|
const int r = WideCharToMultiByte(CP_ACP, 0, s.data(), src_len, (char*)ret.data(), len, nullptr, nullptr);
|
|
assert(len == r);
|
|
return ret;
|
|
}
|
|
|
|
std::wstring ToWideString(const std::string& s) {
|
|
if (s.size() >= static_cast<size_t>(std::numeric_limits<int>::max())) throw std::runtime_error("length overflow");
|
|
const int src_len = static_cast<int>(s.size() + 1);
|
|
const int len = MultiByteToWideChar(CP_ACP, 0, s.data(), src_len, nullptr, 0);
|
|
assert(len > 0);
|
|
std::wstring ret(static_cast<size_t>(len) - 1, '\0');
|
|
const int r = MultiByteToWideChar(CP_ACP, 0, s.data(), src_len, (wchar_t*)ret.data(), len);
|
|
assert(len == r);
|
|
return ret;
|
|
}
|
|
|
|
} // namespace onnxruntime
|
|
#endif |