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
350
Kotlinのデフォルト引数の話
taiseiue
0
82
.NETの上でお手製の言語を動かす技術
taiseiue
0
100
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
410
振り向き美人
taiseiue
0
28
(自作の)プログラミング言語ができるまで
taiseiue
1
590
Other Decks in Programming
See All in Programming
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
340
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
830
安いハードウェアでVulkan
fadis
1
810
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
190
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
370
Codex の「自走力」を高める
yorifuji
0
1.3k
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
100
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
110
KagglerがMixSeekを触ってみた
morim
0
320
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
130
ファインチューニングせずメインコンペを解く方法
pokutuna
0
190
Featured
See All Featured
Bash Introduction
62gerente
615
210k
Google's AI Overviews - The New Search
badams
0
950
Making Projects Easy
brettharned
120
6.6k
How STYLIGHT went responsive
nonsquared
100
6k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
68
38k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
850
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
How to make the Groovebox
asonas
2
2k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
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 ビット 反転 移項 β α