Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
9404962c
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9404962c
编写于
9月 24, 2020
作者:
H
huzhiqiang
提交者:
GitHub
9月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[windows] Fix compiling error on windows (#4415)
上级
30ef0e05
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
25 deletion
+21
-25
cmake/external/flatbuffers.cmake
cmake/external/flatbuffers.cmake
+1
-8
lite/backends/x86/cpu_info.cc
lite/backends/x86/cpu_info.cc
+1
-0
lite/utils/charconv.h
lite/utils/charconv.h
+19
-17
未找到文件。
cmake/external/flatbuffers.cmake
浏览文件 @
9404962c
...
...
@@ -27,7 +27,7 @@ SET(FLATBUFFERS_SOURCES_DIR ${CMAKE_SOURCE_DIR}/third-party/flatbuffers)
SET
(
FLATBUFFERS_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/flatbuffers
)
SET
(
FLATBUFFERS_INCLUDE_DIR
"
${
FLATBUFFERS_SOURCES_DIR
}
/include"
CACHE PATH
"flatbuffers include directory."
FORCE
)
IF
(
WIN32
)
set
(
FLATBUFFERS_LIBRARIES
"
${
FLATBUFFERS_INSTALL_DIR
}
/
${
LIBDIR
}
/
lib
flatbuffers.lib"
CACHE FILEPATH
"FLATBUFFERS_LIBRARIES"
FORCE
)
set
(
FLATBUFFERS_LIBRARIES
"
${
FLATBUFFERS_INSTALL_DIR
}
/
${
LIBDIR
}
/flatbuffers.lib"
CACHE FILEPATH
"FLATBUFFERS_LIBRARIES"
FORCE
)
ELSE
(
WIN32
)
set
(
FLATBUFFERS_LIBRARIES
"
${
FLATBUFFERS_INSTALL_DIR
}
/
${
LIBDIR
}
/libflatbuffers.a"
CACHE FILEPATH
"FLATBUFFERS_LIBRARIES"
FORCE
)
ENDIF
(
WIN32
)
...
...
@@ -64,13 +64,6 @@ ExternalProject_Add(
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
)
IF
(
WIN32
)
IF
(
NOT EXISTS
"
${
FLATBUFFERS_INSTALL_DIR
}
/
${
LIBDIR
}
/libflatbuffers.lib"
)
add_custom_command
(
TARGET extern_flatbuffers POST_BUILD
COMMAND cmake -E copy
${
FLATBUFFERS_INSTALL_DIR
}
/
${
LIBDIR
}
/flatbuffers_static.lib
${
FLATBUFFERS_INSTALL_DIR
}
/
${
LIBDIR
}
/libflatbuffers.lib
)
ENDIF
()
ENDIF
(
WIN32
)
ADD_LIBRARY
(
flatbuffers STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET flatbuffers PROPERTY IMPORTED_LOCATION
${
FLATBUFFERS_LIBRARIES
}
)
ADD_DEPENDENCIES
(
flatbuffers extern_flatbuffers
)
...
...
lite/backends/x86/cpu_info.cc
浏览文件 @
9404962c
...
...
@@ -24,6 +24,7 @@
#include <sys/types.h>
#elif defined(_WIN32)
#define NOMINMAX // msvc max/min macro conflict with std::min/max
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <windows.h>
#else
#include <unistd.h>
...
...
lite/utils/charconv.h
浏览文件 @
9404962c
...
...
@@ -144,9 +144,9 @@ from_chars_result aton_unsigned(const char* str,
// basic type.
if
(
UNLIKELY
(
i
>
std
::
numeric_limits
<
uint32_t
>::
digits10
+
1
)
&&
i
==
std
::
numeric_limits
<
uint64_t
>::
digits10
)
{
uint64_t
mx
=
static_cast
<
uint64_t
>
(
std
::
numeric_limits
<
T
>::
max
());
uint64_t
mx
=
static_cast
<
uint64_t
>
(
(
std
::
numeric_limits
<
T
>::
max
)
());
if
(
val
>
mx
/
10
||
mx
-
(
val
*
base
)
<
cv
)
{
value
=
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
max
());
value
=
static_cast
<
T
>
(
(
std
::
numeric_limits
<
T
>::
max
)
());
result
.
ec
=
std
::
errc
::
result_out_of_range
;
return
result
;
}
...
...
@@ -156,10 +156,11 @@ from_chars_result aton_unsigned(const char* str,
}
val
+=
cv
;
}
if
(
UNLIKELY
(
i
>
std
::
numeric_limits
<
T
>::
digits10
+
1
||
(
i
>
std
::
numeric_limits
<
T
>::
digits10
&&
val
>
static_cast
<
uint64_t
>
(
std
::
numeric_limits
<
T
>::
max
()))))
{
value
=
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
max
());
if
(
UNLIKELY
(
i
>
std
::
numeric_limits
<
T
>::
digits10
+
1
||
(
i
>
std
::
numeric_limits
<
T
>::
digits10
&&
val
>
static_cast
<
uint64_t
>
((
std
::
numeric_limits
<
T
>::
max
)()))))
{
value
=
static_cast
<
T
>
((
std
::
numeric_limits
<
T
>::
max
)());
result
.
ec
=
std
::
errc
::
result_out_of_range
;
return
result
;
}
...
...
@@ -209,10 +210,11 @@ from_chars_result aton_signed(const char* str,
val
+=
cv
;
}
if
(
LIKELY
(
!
negative
))
{
if
(
UNLIKELY
(
i
>
std
::
numeric_limits
<
T
>::
digits10
+
1
||
(
i
>
std
::
numeric_limits
<
T
>::
digits10
&&
val
>
static_cast
<
int64_t
>
(
std
::
numeric_limits
<
T
>::
max
()))))
{
value
=
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
max
());
if
(
UNLIKELY
(
i
>
std
::
numeric_limits
<
T
>::
digits10
+
1
||
(
i
>
std
::
numeric_limits
<
T
>::
digits10
&&
val
>
static_cast
<
int64_t
>
((
std
::
numeric_limits
<
T
>::
max
)()))))
{
value
=
static_cast
<
T
>
((
std
::
numeric_limits
<
T
>::
max
)());
result
.
ec
=
std
::
errc
::
result_out_of_range
;
return
result
;
}
...
...
@@ -224,8 +226,8 @@ from_chars_result aton_signed(const char* str,
ret
*=
-
1
;
}
if
(
i
>
std
::
numeric_limits
<
T
>::
digits10
+
1
||
ret
<
static_cast
<
int64_t
>
(
std
::
numeric_limits
<
T
>::
min
()))
{
value
=
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
min
());
ret
<
static_cast
<
int64_t
>
(
(
std
::
numeric_limits
<
T
>::
min
)
()))
{
value
=
static_cast
<
T
>
(
(
std
::
numeric_limits
<
T
>::
min
)
());
result
.
ec
=
std
::
errc
::
result_out_of_range
;
return
result
;
}
...
...
@@ -260,7 +262,7 @@ from_chars_result aton_float(const char* str, int len, T& value) { // NOLINT
++
str
;
--
len
;
}
ssize
_t
dot_pos
=
-
1
;
int16
_t
dot_pos
=
-
1
;
int
i
=
0
;
for
(;
i
<
len
;
++
i
)
{
char
c
=
str
[
i
];
...
...
@@ -297,8 +299,8 @@ from_chars_result aton_float(const char* str, int len, T& value) { // NOLINT
val
+=
static_cast
<
double
>
(
rval
)
/
rdiv
;
}
if
(
!
negative
&&
val
>
static_cast
<
double
>
(
std
::
numeric_limits
<
T
>::
max
()))
{
value
=
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
max
());
if
(
!
negative
&&
val
>
static_cast
<
double
>
(
(
std
::
numeric_limits
<
T
>::
max
)
()))
{
value
=
static_cast
<
T
>
(
(
std
::
numeric_limits
<
T
>::
max
)
());
result
.
ec
=
std
::
errc
::
result_out_of_range
;
return
result
;
}
...
...
@@ -307,8 +309,8 @@ from_chars_result aton_float(const char* str, int len, T& value) { // NOLINT
return
result
;
}
val
*=
-
1
;
if
(
val
<
static_cast
<
double
>
(
-
std
::
numeric_limits
<
T
>::
max
()))
{
value
=
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
min
());
if
(
val
<
static_cast
<
double
>
(
-
(
std
::
numeric_limits
<
T
>::
max
)
()))
{
value
=
static_cast
<
T
>
(
(
std
::
numeric_limits
<
T
>::
min
)
());
result
.
ec
=
std
::
errc
::
result_out_of_range
;
return
result
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录