Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
饶先宏
hdl4se
提交
4f694da1
H
hdl4se
项目概览
饶先宏
/
hdl4se
通知
12
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hdl4se
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4f694da1
编写于
5月 27, 2021
作者:
饶先宏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
202105271557
上级
77987d73
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
21 deletion
+25
-21
bignumber/src/bignumber.c
bignumber/src/bignumber.c
+22
-19
hdl4secell/src/hdl4se_const.c
hdl4secell/src/hdl4se_const.c
+3
-2
未找到文件。
bignumber/src/bignumber.c
浏览文件 @
4f694da1
...
@@ -180,12 +180,14 @@ static int bigint_bn_SetWidth(HOBJECT object, int width, int signexpand)
...
@@ -180,12 +180,14 @@ static int bigint_bn_SetWidth(HOBJECT object, int width, int signexpand)
pobj
->
buf
=
buf
;
pobj
->
buf
=
buf
;
}
}
blen
=
pobj
->
width
/
CELL_WIDTH
;
blen
=
width
/
CELL_WIDTH
;
bc
=
pobj
->
width
&
(
CELL_WIDTH
-
1
);
if
(
blen
<
pobj
->
buflen
)
{
if
(
sign
)
bc
=
width
&
(
CELL_WIDTH
-
1
);
pobj
->
buf
[
blen
]
|=
CELL_MASK
<<
bc
;
if
(
sign
)
else
pobj
->
buf
[
blen
]
|=
CELL_MASK
<<
bc
;
pobj
->
buf
[
blen
]
&=
CELL_MASK
>>
(
CELL_WIDTH
-
bc
);
else
pobj
->
buf
[
blen
]
&=
CELL_MASK
>>
(
CELL_WIDTH
-
bc
);
}
for
(
i
=
blen
+
1
;
i
<
pobj
->
buflen
;
i
++
)
{
for
(
i
=
blen
+
1
;
i
<
pobj
->
buflen
;
i
++
)
{
pobj
->
buf
[
i
]
=
sign
?
CELL_MASK
:
0
;
pobj
->
buf
[
i
]
=
sign
?
CELL_MASK
:
0
;
}
}
...
@@ -393,7 +395,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
...
@@ -393,7 +395,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
objwidth
=
pobj
->
width
;
objwidth
=
pobj
->
width
;
if
(
autowidth
==
0
&&
objwidth
<=
0
)
if
(
autowidth
==
0
&&
objwidth
<=
0
)
return
-
1
;
return
-
1
;
bigint_bn_SetWidth
(
object
,
64
,
0
);
if
(
autowidth
)
bigint_bn_SetWidth
(
object
,
64
,
0
);
state
=
TOKEN_INITIAL
;
state
=
TOKEN_INITIAL
;
sign
=
0
;
sign
=
0
;
while
(
*
strt
!=
0
)
{
while
(
*
strt
!=
0
)
{
...
@@ -494,8 +497,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
...
@@ -494,8 +497,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
return
-
1
;
return
-
1
;
}
}
}
}
bigint_bn_Mul
Ui
nt32
(
object
,
object
,
2
);
bigint_bn_Mul
I
nt32
(
object
,
object
,
2
);
bigint_bn_Add
Ui
nt32
(
object
,
object
,
ch
-
'0'
);
bigint_bn_Add
I
nt32
(
object
,
object
,
ch
-
'0'
);
numvalid
=
1
;
numvalid
=
1
;
}
}
else
if
(
ch
==
'_'
)
{
else
if
(
ch
==
'_'
)
{
...
@@ -517,8 +520,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
...
@@ -517,8 +520,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
return
-
1
;
return
-
1
;
}
}
}
}
bigint_bn_Mul
Ui
nt32
(
object
,
object
,
8
);
bigint_bn_Mul
I
nt32
(
object
,
object
,
8
);
bigint_bn_Add
Ui
nt32
(
object
,
object
,
ch
-
'0'
);
bigint_bn_Add
I
nt32
(
object
,
object
,
ch
-
'0'
);
numvalid
=
1
;
numvalid
=
1
;
}
}
else
if
(
ch
==
'_'
)
{
else
if
(
ch
==
'_'
)
{
...
@@ -540,8 +543,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
...
@@ -540,8 +543,8 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
return
-
1
;
return
-
1
;
}
}
}
}
bigint_bn_Mul
Ui
nt32
(
object
,
object
,
10
);
bigint_bn_Mul
I
nt32
(
object
,
object
,
10
);
bigint_bn_Add
Ui
nt32
(
object
,
object
,
ch
-
'0'
);
bigint_bn_Add
I
nt32
(
object
,
object
,
ch
-
'0'
);
numvalid
=
1
;
numvalid
=
1
;
}
}
else
{
else
{
...
@@ -562,13 +565,13 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
...
@@ -562,13 +565,13 @@ static int bigint_bn_AssignStr(HOBJECT object, const char* str, const char **nst
return
-
1
;
return
-
1
;
}
}
}
}
bigint_bn_Mul
Ui
nt32
(
object
,
object
,
16
);
bigint_bn_Mul
I
nt32
(
object
,
object
,
16
);
if
(
ch
>
'0'
&&
ch
<=
'9'
)
if
(
ch
>
'0'
&&
ch
<=
'9'
)
bigint_bn_Add
Ui
nt32
(
object
,
object
,
ch
-
'0'
);
bigint_bn_Add
I
nt32
(
object
,
object
,
ch
-
'0'
);
else
if
(
ch
>=
'a'
&&
ch
<=
'f'
)
else
if
(
ch
>=
'a'
&&
ch
<=
'f'
)
bigint_bn_Add
Ui
nt32
(
object
,
object
,
ch
-
'a'
+
10
);
bigint_bn_Add
I
nt32
(
object
,
object
,
ch
-
'a'
+
10
);
else
if
(
ch
>=
'A'
&&
ch
<=
'F'
)
else
if
(
ch
>=
'A'
&&
ch
<=
'F'
)
bigint_bn_Add
Ui
nt32
(
object
,
object
,
ch
-
'A'
+
10
);
bigint_bn_Add
I
nt32
(
object
,
object
,
ch
-
'A'
+
10
);
}
}
else
if
(
ch
==
'_'
)
{
else
if
(
ch
==
'_'
)
{
}
}
...
@@ -601,7 +604,7 @@ lastnum:
...
@@ -601,7 +604,7 @@ lastnum:
width
++
;
width
++
;
}
}
else
{
else
{
width
=
pobj
->
width
;
width
=
obj
width
;
}
}
bigint_bn_SetWidth
(
object
,
width
,
sign
);
bigint_bn_SetWidth
(
object
,
width
,
sign
);
return
0
;
return
0
;
...
@@ -796,7 +799,7 @@ static int bigint_bn_SubUint32(HOBJECT object, HOBJECT src, unsigned int value)
...
@@ -796,7 +799,7 @@ static int bigint_bn_SubUint32(HOBJECT object, HOBJECT src, unsigned int value)
{
{
bigint_bn_AssignUint32
(
object
,
value
);
bigint_bn_AssignUint32
(
object
,
value
);
bigint_bn_Neg
(
object
,
object
);
bigint_bn_Neg
(
object
,
object
);
bigint_bn_AddU
int32
(
object
,
object
,
src
);
bigint_bn_AddU
(
object
,
object
,
src
);
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_const.c
浏览文件 @
4f694da1
...
@@ -114,11 +114,12 @@ static int hdl4se_constCreate(const PARAMITEM* pParams, int paramcount, HOBJECT*
...
@@ -114,11 +114,12 @@ static int hdl4se_constCreate(const PARAMITEM* pParams, int paramcount, HOBJECT*
if
(
0
==
objectCall3
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
,
0
))
{
if
(
0
==
objectCall3
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
,
0
))
{
objectCall1
(
temp
,
GetInt32
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt32
,
&
pobj
->
width
);
}
}
if
(
pobj
->
width
<=
0
||
pobj
->
width
>
(
1
<<
24
))
objectRelease
(
temp
);
if
(
pobj
->
width
<=
0
||
pobj
->
width
>
(
1
<<
24
))
{
return
-
1
;
return
-
1
;
}
pobj
->
out_data
=
bigintegerCreate
(
pobj
->
width
);
pobj
->
out_data
=
bigintegerCreate
(
pobj
->
width
);
objectCall3
(
pobj
->
out_data
,
AssignStr
,
nstr
,
NULL
,
0
);
objectCall3
(
pobj
->
out_data
,
AssignStr
,
nstr
,
NULL
,
0
);
objectRelease
(
temp
);
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录