Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tadpole operators
Search
taiseiue
May 24, 2024
Programming
0
56
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
250
Kotlinのデフォルト引数の話
taiseiue
0
63
.NETの上でお手製の言語を動かす技術
taiseiue
0
89
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
350
振り向き美人
taiseiue
0
23
(自作の)プログラミング言語ができるまで
taiseiue
1
470
Other Decks in Programming
See All in Programming
Introducing RemoteCompose: break your UI out of the app sandbox.
camaelon
2
270
Google Opal解体新書
mickey_kubo
3
100
Leading Effective Engineering Teams in the AI Era
addyosmani
7
680
kiroとCodexで最高のSpec駆動開発を!!数時間で web3ネイティブなミニゲームを作ってみたよ!
mashharuki
0
1k
React Nativeならぬ"Vue Native"が実現するかも?_新世代マルチプラットフォーム開発フレームワークのLynxとLynxのVue.js対応を追ってみよう_Vue Lynx
yut0naga1_fa
2
1.9k
AI時代に必須!状況言語化スキル / ai-context-verbalization
minodriven
2
260
Amazon Verified Permissions実践入門 〜Cedar活用とAppSync導入事例/Practical Introduction to Amazon Verified Permissions
fossamagna
2
110
品質ワークショップをやってみた
nealle
0
810
Go言語はstack overflowの夢を見るか?
logica0419
0
670
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
110
NIKKEI Tech Talk#38
cipepser
0
350
CSC509 Lecture 07
javiergs
PRO
0
250
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.3k
Unsuck your backbone
ammeep
671
58k
Code Review Best Practice
trishagee
72
19k
It's Worth the Effort
3n
187
28k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Speed Design
sergeychernyshev
32
1.2k
Facilitating Awesome Meetings
lara
57
6.6k
The Invisible Side of Design
smashingmag
302
51k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Testing 201, or: Great Expectations
jmmastey
46
7.7k
Navigating Team Friction
lara
190
15k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.5k
Transcript
Tadpole operators ⾮変インクリメント/デクリメント
Tadpole Operators†とは? • 副作⽤を起こさないインクリメント/デクリメントのこと • ⽇本語では⾮変インクリメント / ⾮変デクリメント • ⾒た⽬からtadpole(おたまじゃくし)演算⼦とも
値が書きかわらない 演算⼦ 同じ意味の式 意味 -~x X + 1 Xに向かって値が⼊って いくイメージ ~-x X - 1 Xから値が出ていく イメージ †https://devblogs.microsoft.com/oldnewthing/20150525-00/?p=45044
Tadpole Operators:利点 • 単項演算⼦なので優先順位が⾼い • (x + 1) * (x
- 1) なら -~x * ~-x と書ける • インクリメント/デクリメントと違い副作⽤がない
ネタバラシ シンキングタイムいる?
ネタバラシ • 本当は`~`(ビット反転)と`-`(符号反転)の組み合わせ • かっこで整理すると ‒(~x)、~(-x)に -(~x) == x+1 ~x
+ 1 == -x を常に満たす x + ~x + 1 == 0 X=5 0101 0011 Y=~X +1010 1100 Z=X+Y 1111 1111 α=Z+1 + 1 β 1 0000 0000 ビット 反転 移項 β α