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
50
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
180
Kotlinのデフォルト引数の話
taiseiue
0
51
.NETの上でお手製の言語を動かす技術
taiseiue
0
74
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
300
振り向き美人
taiseiue
0
19
(自作の)プログラミング言語ができるまで
taiseiue
1
370
Other Decks in Programming
See All in Programming
AIともっと楽するE2Eテスト
myohei
6
2.6k
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
320
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
1
10k
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
820
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
790
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
820
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
590
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
510
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
190
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
530
A2A プロトコルを試してみる
azukiazusa1
2
1.4k
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Git: the NoSQL Database
bkeepers
PRO
430
65k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Designing for Performance
lara
610
69k
Embracing the Ebb and Flow
colly
86
4.7k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
Bash Introduction
62gerente
613
210k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
970
Adopting Sorbet at Scale
ufuk
77
9.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.4k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
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 ビット 反転 移項 β α