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
66
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
“⾞が通れるほど⼤きな”セキュリティーホールを抑えながらログインしたい
taiseiue
0
330
Kotlinのデフォルト引数の話
taiseiue
0
81
.NETの上でお手製の言語を動かす技術
taiseiue
0
100
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
400
振り向き美人
taiseiue
0
28
(自作の)プログラミング言語ができるまで
taiseiue
1
580
Other Decks in Programming
See All in Programming
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
830
AIプロダクト時代のQAエンジニアに求められること
imtnd
1
510
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
120
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
310
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
500
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
0
200
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
CopilotKit + AG-UIを学ぶ
nearme_tech
PRO
1
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
140
CSC307 Lecture 13
javiergs
PRO
0
310
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
12
7k
atmaCup #23でAIコーディングを活用した話
ml_bear
4
720
Featured
See All Featured
Balancing Empowerment & Direction
lara
5
920
Unsuck your backbone
ammeep
672
58k
Crafting Experiences
bethany
1
74
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
270
Bash Introduction
62gerente
615
210k
Between Models and Reality
mayunak
2
210
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
ラッコキーワード サービス紹介資料
rakko
1
2.5M
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
110
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
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 ビット 反転 移項 β α