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
73
0
Share
Tadpole operators
taiseiue
May 24, 2024
More Decks by taiseiue
See All by taiseiue
RustでもVJしたい!
taiseiue
0
49
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
390
Kotlinのデフォルト引数の話
taiseiue
0
90
.NETの上でお手製の言語を動かす技術
taiseiue
0
110
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
430
振り向き美人
taiseiue
0
34
(自作の)プログラミング言語ができるまで
taiseiue
1
620
Other Decks in Programming
See All in Programming
SkillsをS3 Filesに置く時のあれこれ
watany
4
1.8k
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
360
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
240
AWSはOSSをどのように 考えているのか?
akihisaikeda
1
140
[BalkanRuby 2026] Drop your app/services!
palkan
3
660
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
320
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
0
250
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
110
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.6k
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
360
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
4
610
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
HDC tutorial
michielstock
2
670
Paper Plane
katiecoart
PRO
1
50k
The Spectacular Lies of Maps
axbom
PRO
1
760
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
First, design no harm
axbom
PRO
2
1.2k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
340
It's Worth the Effort
3n
188
29k
Building Adaptive Systems
keathley
44
3k
Mobile First: as difficult as doing things right
swwweet
225
10k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.5k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
150
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 ビット 反転 移項 β α