OSDN Git Service
(root)
/
oi-wiki
/
main.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fc5eb04
)
改善代碼
author
Voile
<voileexperiments@gmail.com>
Mon, 4 Mar 2019 08:44:34 +0000
(16:44 +0800)
committer
GitHub
<noreply@github.com>
Mon, 4 Mar 2019 08:44:34 +0000
(16:44 +0800)
`cond1 ? cond2 : false`甚麼鬼, 太醜了
docs/math/bit.md
patch
|
blob
|
history
diff --git
a/docs/math/bit.md
b/docs/math/bit.md
index
91d3538
..
75543c5
100644
(file)
--- a/
docs/math/bit.md
+++ b/
docs/math/bit.md
@@
-203,7
+203,7
@@
void swap(int &a, int &b) {
```cpp
boolean isFactorialofTwo(int n) {
- return n > 0
? (n & (n - 1)) == 0 : false
;
+ return n > 0
&& (n & (n - 1)) == 0
;
/* 如果是 2 的幂,n 一定是 100... n-1 就是 1111....
所以做与运算结果为 0 */
}