Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tadpole operators
Search
taiseiue
May 24, 2024
Programming
0
61
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
280
Kotlinのデフォルト引数の話
taiseiue
0
65
.NETの上でお手製の言語を動かす技術
taiseiue
0
89
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
360
振り向き美人
taiseiue
0
24
(自作の)プログラミング言語ができるまで
taiseiue
1
510
Other Decks in Programming
See All in Programming
ゲームの物理 剛体編
fadis
0
160
配送計画の均等化機能を提供する取り組みについて(⽩⾦鉱業 Meetup Vol.21@六本⽊(数理最適化編))
izu_nori
0
130
30分でDoctrineの仕組みと使い方を完全にマスターする / phpconkagawa 2025 Doctrine
ttskch
3
730
俺流レスポンシブコーディング 2025
tak_dcxi
13
7.9k
All(?) About Point Sets
hole
0
270
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
6.3k
社内オペレーション改善のためのTypeScript / TSKaigi Hokuriku 2025
dachi023
1
500
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
270
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
190
無秩序からの脱却 / Emergence from chaos
nrslib
2
12k
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
25
21k
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
150
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Site-Speed That Sticks
csswizardry
13
990
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
How to Ace a Technical Interview
jacobian
280
24k
Practical Orchestrator
shlominoach
190
11k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.8k
Rails Girls Zürich Keynote
gr2m
95
14k
How to Think Like a Performance Engineer
csswizardry
28
2.3k
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 ビット 反転 移項 β α