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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
310
Kotlinのデフォルト引数の話
taiseiue
0
76
.NETの上でお手製の言語を動かす技術
taiseiue
0
94
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
390
振り向き美人
taiseiue
0
24
(自作の)プログラミング言語ができるまで
taiseiue
1
550
Other Decks in Programming
See All in Programming
CSC307 Lecture 04
javiergs
PRO
0
650
高速開発のためのコード整理術
sutetotanuki
1
340
MUSUBIXとは
nahisaho
0
100
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
1.9k
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
170
CSC307 Lecture 05
javiergs
PRO
0
490
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
CSC307 Lecture 03
javiergs
PRO
1
480
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
560
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
AgentCoreとHuman in the Loop
har1101
5
200
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.8k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
420
Ruling the World: When Life Gets Gamed
codingconduct
0
130
Six Lessons from altMBA
skipperchong
29
4.1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
53
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
61
49k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
150
BBQ
matthewcrist
89
10k
Unsuck your backbone
ammeep
671
58k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
320
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
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 ビット 反転 移項 β α