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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
taiseiue
May 24, 2024
Programming
0
67
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
340
Kotlinのデフォルト引数の話
taiseiue
0
82
.NETの上でお手製の言語を動かす技術
taiseiue
0
100
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
400
振り向き美人
taiseiue
0
28
(自作の)プログラミング言語ができるまで
taiseiue
1
580
Other Decks in Programming
See All in Programming
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
410
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
6
1.1k
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2k
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.4k
Claude Codeログ基盤の構築
giginet
PRO
7
3.5k
AHC061解説
shun_pi
0
410
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
150
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
370
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
750
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
140
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Tell your own story through comics
letsgokoyo
1
850
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
290
エンジニアに許された特別な時間の終わり
watany
106
240k
The untapped power of vector embeddings
frankvandijk
2
1.6k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
Building an army of robots
kneath
306
46k
Faster Mobile Websites
deanohume
310
31k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
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 ビット 反転 移項 β α