$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tadpole operators
Search
taiseiue
May 24, 2024
Programming
0
64
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
290
Kotlinのデフォルト引数の話
taiseiue
0
73
.NETの上でお手製の言語を動かす技術
taiseiue
0
91
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
370
振り向き美人
taiseiue
0
24
(自作の)プログラミング言語ができるまで
taiseiue
1
530
Other Decks in Programming
See All in Programming
AIコーディングエージェント(skywork)
kondai24
0
200
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
1.8k
実はマルチモーダルだった。ブラウザの組み込みAI🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
3
1.3k
AtCoder Conference 2025
shindannin
0
560
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
140
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
410
愛される翻訳の秘訣
kishikawakatsumi
3
350
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
150
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
590
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
170
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
3
600
Python札幌 LT資料
t3tra
7
1k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
92
So, you think you're a good person
axbom
PRO
0
1.8k
sira's awesome portfolio website redesign presentation
elsirapls
0
89
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
A designer walks into a library…
pauljervisheath
210
24k
My Coaching Mixtape
mlcsv
0
13
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
30
Mobile First: as difficult as doing things right
swwweet
225
10k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
0
1k
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 ビット 反転 移項 β α