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
0
47
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
.NETの上でお手製の言語を動かす技術
taiseiue
0
48
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
240
振り向き美人
taiseiue
0
13
(自作の)プログラミング言語ができるまで
taiseiue
1
320
Other Decks in Programming
See All in Programming
RuboCop: Modularity and AST Insights
koic
2
2.3k
Cline with Amazon Bedrockで爆速開発体験ハンズオン/ 株式会社ブリューアス登壇資料
mhan
0
110
エンジニア向けCursor勉強会 @ SmartHR
yukisnow1823
3
12k
Empowering Developers with HTML-Aware ERB Tooling @ RubyKaigi 2025, Matsuyama, Ehime
marcoroth
2
940
API for docs
soutaro
3
1.6k
Flutterでllama.cppをつかってローカルLLMを試してみた
sakuraidayo
0
120
M5UnitUnified 最新動向 2025/05
gob
0
120
状態と共に暮らす:ステートフルへの挑戦
ypresto
3
1.1k
Fiber Scheduler vs. General-Purpose Parallel Client
hayaokimura
1
280
Golangci-lint v2爆誕: 君たちはどうすべきか
logica0419
1
230
[NG India] Event-Based State Management with NgRx SignalStore
markostanimirovic
1
190
Ruby's Line Breaks
yui_knk
4
2.7k
Featured
See All Featured
Fireside Chat
paigeccino
37
3.4k
Visualization
eitanlees
146
16k
Making Projects Easy
brettharned
116
6.2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Thoughts on Productivity
jonyablonski
69
4.6k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
690
Testing 201, or: Great Expectations
jmmastey
42
7.5k
The Invisible Side of Design
smashingmag
299
50k
Code Review Best Practice
trishagee
67
18k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
105
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.4k
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 ビット 反転 移項 β α