Skip to content
This repository was archived by the owner on Oct 1, 2023. It is now read-only.

Commit bb19910

Browse files
committed
Add positive shift example
1 parent 4101e0c commit bb19910

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Standard integer types are supported for pedantic C99.
2525
sari(-63, 3); /* -8 */
2626
sarl(-0x200000000l, 1); /* -0x100000000l */
2727
sarfast32(-0xDECAF, 8); /* -0xDED */
28+
sar8(15, 2); /* 3 */
2829
```
2930

3031
<details>

test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ main()
112112
assert(sari(-63, 3) == -8);
113113
assert(sarl(-0x200000000l, 1) == -0x100000000l);
114114
assert(sarfast32(-0xDECAF, 8) == -0xDED);
115+
assert(sar8(15, 2) == 3);
115116

116117
assert(sarui(-63, 3) == -8);
117118
assert(sarul(-0x200000000l, 1) == -0x100000000l);
118119
assert(sarufast32(-0xDECAF, 8) == -0xDED);
120+
assert(saru8(15, 2) == 3);
119121

120122
return 0;
121123
}

0 commit comments

Comments
 (0)