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
76
0
Share
Tadpole operators
taiseiue
May 24, 2024
More Decks by taiseiue
See All by taiseiue
RustでもVJしたい!
taiseiue
0
56
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
400
Kotlinのデフォルト引数の話
taiseiue
0
94
.NETの上でお手製の言語を動かす技術
taiseiue
0
110
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
440
振り向き美人
taiseiue
0
35
(自作の)プログラミング言語ができるまで
taiseiue
1
630
Other Decks in Programming
See All in Programming
New "Type" system on PicoRuby
pocke
1
450
dRuby over BLE
makicamel
2
300
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
610
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
350
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
540
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
110
AIとRubyの静的型付け
ukin0k0
0
530
エージェンティックRAGにAWSで入門しよう!
har1101
7
640
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.2k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
170
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
200
LLM Plugin for Node-REDの利用方法と開発について
404background
0
160
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
エンジニアに許された特別な時間の終わり
watany
107
250k
WENDY [Excerpt]
tessaabrams
11
38k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
320
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
350
GraphQLとの向き合い方2022年版
quramy
50
15k
A Soul's Torment
seathinner
6
2.9k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
260
Designing for humans not robots
tammielis
254
26k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
150
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 ビット 反転 移項 β α