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
70
0
Share
Tadpole operators
taiseiue
May 24, 2024
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
370
Kotlinのデフォルト引数の話
taiseiue
0
87
.NETの上でお手製の言語を動かす技術
taiseiue
0
100
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
420
振り向き美人
taiseiue
0
29
(自作の)プログラミング言語ができるまで
taiseiue
1
610
Other Decks in Programming
See All in Programming
tRPCの概要と少しだけパフォーマンス
misoton665
2
240
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
150
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.1k
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
860
エラー処理の温故知新 / history of error handling technic
ryotanakaya
6
1.5k
Running Swift without an OS
kishikawakatsumi
0
850
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
360
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
350
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
150
Kingdom of the Machine
yui_knk
2
900
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
650
🦞OpenClaw works with AWS
licux
1
230
Featured
See All Featured
Building AI with AI
inesmontani
PRO
1
920
Navigating Weather and Climate Data
rabernat
0
170
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
99
We Have a Design System, Now What?
morganepeng
55
8.1k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
The browser strikes back
jonoalderson
0
990
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
260
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
170
Music & Morning Musume
bryan
47
7.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Being A Developer After 40
akosma
91
590k
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 ビット 反転 移項 β α