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
taiseiue
May 24, 2024
Programming
86
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Tadpole operators
taiseiue
May 24, 2024
More Decks by taiseiue
See All by taiseiue
同人サークルを作って 8年経った僕らの現在地
taiseiue
0
130
RustでもVJしたい!
taiseiue
0
75
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
440
Kotlinのデフォルト引数の話
taiseiue
0
110
.NETの上でお手製の言語を動かす技術
taiseiue
0
120
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
470
振り向き美人
taiseiue
0
37
(自作の)プログラミング言語ができるまで
taiseiue
1
670
Other Decks in Programming
See All in Programming
源内ハンズオン概要編
hideg
0
210
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
170
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
110
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
250
Cloudflare is Agents
chimame
0
180
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
500
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
210
初めての模倣学習とVLA
natsutan
0
240
ソフトウェアラスタライザ
fadis
1
660
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.7k
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
260
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
610
Featured
See All Featured
Practical Orchestrator
shlominoach
191
12k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Speed Design
sergeychernyshev
33
2k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
470
Exploring anti-patterns in Rails
aemeredith
3
470
Build your cross-platform service in a week with App Engine
jlugia
234
19k
How to Talk to Developers About Accessibility
jct
2
520
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Believing is Seeing
oripsolob
1
200
The Mindset for Success: Future Career Progression
greggifford
PRO
0
480
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 ビット 反転 移項 β α