Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
66
.NETの上でお手製の言語を動かす技術
taiseiue
0
89
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
360
振り向き美人
taiseiue
0
24
(自作の)プログラミング言語ができるまで
taiseiue
1
510
Other Decks in Programming
See All in Programming
AIと協働し、イベントソーシングとアクターモデルで作る後悔しないアーキテクチャ Regret-Free Architecture with AI, Event Sourcing, and Actors
tomohisa
5
19k
AIコーディングエージェント(Manus)
kondai24
0
150
CSC509 Lecture 14
javiergs
PRO
0
220
Reactive Thinking with Signals and the new Resource API
manfredsteyer
PRO
0
170
俺流レスポンシブコーディング 2025
tak_dcxi
13
8.2k
20 years of Symfony, what's next?
fabpot
2
330
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
100
FluorTracer / RayTracingCamp11
kugimasa
0
200
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
1
210
AI時代もSEOを頑張っている話
shirahama_x
0
260
Level up your Gemini CLI - D&D Style!
palladius
1
180
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
140
Featured
See All Featured
A better future with KSS
kneath
240
18k
[SF Ruby Conf 2025] Rails X
palkan
0
470
Building Flexible Design Systems
yeseniaperezcruz
329
39k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Mobile First: as difficult as doing things right
swwweet
225
10k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The Cost Of JavaScript in 2023
addyosmani
55
9.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 ビット 反転 移項 β α