repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* builtins.def (BUILT_IN_SETJMP): Revert latest change.
[official-gcc.git]
/
libgcc
/
config
/
msp430
/
mpy.c
blob
3842d86fc356fd74966f7e59656d63e9be91e509
1
/* Public domain. */
2
extern
int
__mulhi3
(
int
,
int
);
3
4
int
5
__mulhi3
(
int
x
,
int
y
)
6
{
7
char
bit
;
8
int
neg
=
0
;
9
int
rv
=
0
;
10
11
if
(
y
<
0
)
12
{
13
y
= -
y
;
14
neg
=
1
;
15
}
16
17
for
(
bit
=
0
;
y
&&
bit
<
sizeof
(
y
) *
8
;
bit
++)
18
{
19
if
(
y
&
1
)
20
rv
+=
x
;
21
x
<<=
1
;
22
y
>>=
1
;
23
}
24
25
return
neg
? -
rv
:
rv
;
26
}