repo.or.cz
/
sdcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
struct / union in initializer, RFE #901.
[sdcc.git]
/
sdcc
/
device
/
lib
/
mos6502-stack-auto
/
_srulonglong.c
blob
2f5d151b97bfe967c1d58e324c6933e5f42b9a50
1
#include <stdint.h>
2
3
#ifdef __SDCC_LONGLONG
4
5
unsigned long long
_srulonglong
(
unsigned long long
l
,
char
s
)
6
{
7
uint8_t
*
const
b
= (
uint8_t
*)(&
l
);
8
unsigned char
shift
,
t1
,
t2
;
9
signed char
zb
,
i
;
10
11
zb
=
s
>>
3
;
12
if
(
zb
) {
13
for
(
i
=
0
;
i
<(
8
-
zb
);
i
++) {
14
b
[
i
]=
b
[
zb
+
i
];
15
}
16
17
for
(;
i
<
8
;
i
++)
18
b
[
i
]=
0
;
19
}
20
21
shift
=
s
&
0x7
;
22
while
(
shift
--) {
23
t2
=
0
;
24
for
(
i
=
7
-
zb
;
i
>=
0
;
i
--) {
25
t1
=
b
[
i
]&
1
;
26
b
[
i
]=(
b
[
i
]>>
1
)|
t2
;
27
t2
=
t1
?
0x80
:
0
;
28
}
29
}
30
31
return
(
l
);
32
}
33
34
#endif