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
66
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
330
Kotlinのデフォルト引数の話
taiseiue
0
81
.NETの上でお手製の言語を動かす技術
taiseiue
0
100
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
400
振り向き美人
taiseiue
0
28
(自作の)プログラミング言語ができるまで
taiseiue
1
580
Other Decks in Programming
See All in Programming
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
380
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
Raku Raku Notion 20260128
hareyakayuruyaka
0
430
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
140
PJのドキュメントを全部Git管理にしたら、一番喜んだのはAIだった
nanaism
0
230
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
330
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
430
Claude Codeと2つの巻き戻し戦略 / Two Rewind Strategies with Claude Code
fruitriin
0
200
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
12
7k
NOT A HOTEL - 建築や人と融合し、自由を創り出すソフトウェア
not_a_hokuts
2
510
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
280
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.2k
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Building the Perfect Custom Keyboard
takai
2
700
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
480
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
220
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
65
How to build a perfect <img>
jonoalderson
1
5.2k
Bash Introduction
62gerente
615
210k
Un-Boring Meetings
codingconduct
0
220
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
850
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
400
Site-Speed That Sticks
csswizardry
13
1.1k
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 ビット 反転 移項 β α