Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
dbbd1ddc
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dbbd1ddc
编写于
2月 15, 2018
作者:
A
arhag
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compilation issues regarding uint256 usage
上级
f6e4e3a0
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
48 addition
and
48 deletion
+48
-48
contracts/eosiolib/types.h
contracts/eosiolib/types.h
+7
-15
contracts/eosiolib/types.hpp
contracts/eosiolib/types.hpp
+8
-0
contracts/identity/identity.hpp
contracts/identity/identity.hpp
+27
-27
contracts/multi_index_test/multi_index_test.cpp
contracts/multi_index_test/multi_index_test.cpp
+6
-6
未找到文件。
contracts/eosiolib/types.h
浏览文件 @
dbbd1ddc
...
...
@@ -64,21 +64,13 @@ struct account_permission {
permission_name
permission
;
};
union
{
uint8_t
bytes
[
8
];
uint16_t
uint16
[
8
];
uint32_t
uint32
[
8
];
uint64_t
uint64
[
4
];
uint128_t
uint128
[
2
];
}
typedef
uint256
;
bool
operator
==
(
const
uint256
&
a
,
const
uint256
&
b
)
{
return
a
.
uint128
[
0
]
==
b
.
uint128
[
0
]
&&
a
.
uint128
[
1
]
==
b
.
uint128
[
1
];
}
bool
operator
!=
(
const
uint256
&
a
,
const
uint256
&
b
)
{
return
!
(
a
==
b
);
}
typedef
union
{
uint8_t
bytes
[
32
];
uint16_t
uint16s
[
16
];
uint32_t
uint32s
[
8
];
uint64_t
uint64s
[
4
];
uint128_t
uint128s
[
2
];
}
uint256
;
#ifdef __cplusplus
}
/// extern "C"
...
...
contracts/eosiolib/types.hpp
浏览文件 @
dbbd1ddc
...
...
@@ -89,5 +89,13 @@ namespace eosio {
};
/// @}
bool
operator
==
(
const
uint256
&
a
,
const
uint256
&
b
)
{
return
a
.
uint128s
[
0
]
==
b
.
uint128s
[
0
]
&&
a
.
uint128s
[
1
]
==
b
.
uint128s
[
1
];
}
bool
operator
!=
(
const
uint256
&
a
,
const
uint256
&
b
)
{
return
!
(
a
==
b
);
}
}
// namespace eos
contracts/identity/identity.hpp
浏览文件 @
dbbd1ddc
...
...
@@ -135,10 +135,10 @@ namespace identity {
uint64_t
primary_key
()
const
{
return
id
;
}
constexpr
static
uint256
key
(
uint64_t
property
,
uint64_t
trusted
,
uint64_t
certifier
)
{
uint256
key
;
key
.
uint64
[
0
]
=
property
;
key
.
uint64
[
1
]
=
trusted
;
key
.
uint64
[
2
]
=
certifier
;
key
.
uint64
[
3
]
=
0
;
key
.
uint64
s
[
0
]
=
property
;
key
.
uint64
s
[
1
]
=
trusted
;
key
.
uint64
s
[
2
]
=
certifier
;
key
.
uint64
s
[
3
]
=
0
;
return
key
;
}
uint256
get_key
()
const
{
return
key
(
property
,
trusted
,
certifier
);
};
...
...
contracts/multi_index_test/multi_index_test.cpp
浏览文件 @
dbbd1ddc
...
...
@@ -104,17 +104,17 @@ namespace multi_index_test {
const
auto
&
entry1
=
testtable
.
emplace
(
payer
,
[
&
](
auto
&
o
)
{
o
.
id
=
1
;
o
.
val
=
uint256
{.
word
s
=
{
0
,
0
,
0
,
42
}};
o
.
val
=
uint256
{.
uint64
s
=
{
0
,
0
,
0
,
42
}};
});
const
auto
&
entry2
=
testtable
.
emplace
(
payer
,
[
&
](
auto
&
o
)
{
o
.
id
=
2
;
o
.
val
=
uint256
{.
word
s
=
{
1
,
2
,
3
,
4
}};
o
.
val
=
uint256
{.
uint64
s
=
{
1
,
2
,
3
,
4
}};
});
const
auto
&
entry3
=
testtable
.
emplace
(
payer
,
[
&
](
auto
&
o
)
{
o
.
id
=
3
;
o
.
val
=
uint256
{.
word
s
=
{
0
,
0
,
0
,
42
}};
o
.
val
=
uint256
{.
uint64
s
=
{
0
,
0
,
0
,
42
}};
});
const
auto
*
e
=
testtable
.
find
(
2
);
...
...
@@ -126,10 +126,10 @@ namespace multi_index_test {
auto
validx
=
testtable
.
get_index
<
N
(
byval
)
>
();
auto
lower1
=
validx
.
lower_bound
(
uint256
{.
word
s
=
{
0
,
0
,
0
,
40
}});
auto
lower1
=
validx
.
lower_bound
(
uint256
{.
uint64
s
=
{
0
,
0
,
0
,
40
}});
print
(
"First entry with a val of at least 40 has ID="
,
lower1
->
id
,
".
\n
"
);
auto
lower2
=
validx
.
lower_bound
(
uint256
{.
word
s
=
{
0
,
0
,
0
,
50
}});
auto
lower2
=
validx
.
lower_bound
(
uint256
{.
uint64
s
=
{
0
,
0
,
0
,
50
}});
print
(
"First entry with a val of at least 50 has ID="
,
lower2
->
id
,
".
\n
"
);
if
(
&*
lower2
==
e
)
{
...
...
@@ -142,7 +142,7 @@ namespace multi_index_test {
cout
<<
item
.
val
<<
"
\n
"
;
}
auto
upper
=
validx
.
upper_bound
(
uint256
{.
word
s
=
{
0
,
0
,
0
,
42
}});
auto
upper
=
validx
.
upper_bound
(
uint256
{.
uint64
s
=
{
0
,
0
,
0
,
42
}});
print
(
"First entry with a val greater than 42 has ID="
,
upper
->
id
,
".
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录