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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
taiseiue
May 24, 2024
Programming
0
65
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
320
Kotlinのデフォルト引数の話
taiseiue
0
79
.NETの上でお手製の言語を動かす技術
taiseiue
0
98
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
390
振り向き美人
taiseiue
0
26
(自作の)プログラミング言語ができるまで
taiseiue
1
560
Other Decks in Programming
See All in Programming
Package Management Learnings from Homebrew
mikemcquaid
0
220
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
AgentCoreとHuman in the Loop
har1101
5
230
CSC307 Lecture 06
javiergs
PRO
0
680
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
230
Fluid Templating in TYPO3 14
s2b
0
130
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
CSC307 Lecture 08
javiergs
PRO
0
670
Apache Iceberg V3 and migration to V3
tomtanaka
0
160
AI & Enginnering
codelynx
0
110
組織で育むオブザーバビリティ
ryota_hnk
0
170
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
94
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Tell your own story through comics
letsgokoyo
1
810
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
430
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
99
Faster Mobile Websites
deanohume
310
31k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
110
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
120
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 ビット 反転 移項 β α