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
53
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
220
Kotlinのデフォルト引数の話
taiseiue
0
58
.NETの上でお手製の言語を動かす技術
taiseiue
0
83
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
330
振り向き美人
taiseiue
0
21
(自作の)プログラミング言語ができるまで
taiseiue
1
410
Other Decks in Programming
See All in Programming
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
230
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
350
機能追加とリーダー業務の類似性
rinchoku
2
1.3k
🔨 小さなビルドシステムを作る
momeemt
4
690
Rancher と Terraform
fufuhu
2
550
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
560
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
130
スケールする組織の実現に向けた インナーソース育成術 - ISGT2025
teamlab
PRO
2
160
Kiroで始めるAI-DLC
kaonash
2
620
Swift Updates - Learn Languages 2025
koher
2
510
Zendeskのチケットを Amazon Bedrockで 解析した
ryokosuge
3
320
Navigating Dependency Injection with Metro
zacsweers
3
2.5k
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
530
Practical Orchestrator
shlominoach
190
11k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
Site-Speed That Sticks
csswizardry
10
820
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 ビット 反転 移項 β α