summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorArnie97 <arnie97@gmail.com>2015-04-11 13:09:50 +0800
committerArnie97 <arnie97@gmail.com>2015-04-11 13:09:50 +0800
commitc7f085ee34ebce89e523b10a56f9f6d5b1e4cd3a (patch)
tree7739ad481e099b59dd0393c61e898c51c35f9356 /c.html.markdown
parentc38d8d93135561e8c0afbe20a5b16b39917ee06c (diff)
parentf0540b93b16311ca39cf4f0ad5a9abf8dc13f223 (diff)
Merge pull request #1 from adambard/master
Fetch updates from upstream
Diffstat (limited to 'c.html.markdown')
-rw-r--r--c.html.markdown4
1 files changed, 2 insertions, 2 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 1696d28f..d3f20eda 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -234,7 +234,7 @@ int main() {
// same with j-- and --j
// Bitwise operators!
- ~0x0F; // => 0xF0 (bitwise negation, "1's complement")
+ ~0x0F; // => 0xFFFFFFF0 (bitwise negation, "1's complement", example result for 32-bit int)
0x0F & 0xF0; // => 0x00 (bitwise AND)
0x0F | 0xF0; // => 0xFF (bitwise OR)
0x04 ^ 0x0F; // => 0x0B (bitwise XOR)
@@ -242,7 +242,7 @@ int main() {
0x02 >> 1; // => 0x01 (bitwise right shift (by 1))
// Be careful when shifting signed integers - the following are undefined:
- // - shifting into the sign bit of a signed integer (int a = 1 << 32)
+ // - shifting into the sign bit of a signed integer (int a = 1 << 31)
// - left-shifting a negative number (int a = -1 << 2)
// - shifting by an offset which is >= the width of the type of the LHS:
// int a = 1 << 32; // UB if int is 32 bits wide