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
38
Tadpole operators
taiseiue
May 24, 2024
Tweet
Share
More Decks by taiseiue
See All by taiseiue
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
振り向き美人
taiseiue
0
4
(自作の)プログラミング言語ができるまで
taiseiue
1
260
Other Decks in Programming
See All in Programming
CI改善もDatadogとともに
taumu
0
110
Djangoアプリケーション 運用のリアル 〜問題発生から可視化、最適化への道〜 #pyconshizu
kashewnuts
1
250
Multi Step Form, Decentralized Autonomous Organization
pumpkiinbell
1
730
DROBEの生成AI活用事例 with AWS
ippey
0
130
Pulsar2 を雰囲気で使ってみよう
anoken
0
240
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
110
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
120
ARA Ansible for the teams
kksat
0
150
PHPカンファレンス名古屋2025 タスク分解の試行錯誤〜レビュー負荷を下げるために〜
soichi
1
180
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.2k
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.8k
Honoとフロントエンドの 型安全性について
yodaka
7
1.1k
Featured
See All Featured
Writing Fast Ruby
sferik
628
61k
Faster Mobile Websites
deanohume
306
31k
Agile that works and the tools we love
rasmusluckow
328
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
410
What's in a price? How to price your products and services
michaelherold
244
12k
Visualization
eitanlees
146
15k
Fireside Chat
paigeccino
34
3.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
Building Adaptive Systems
keathley
40
2.4k
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 ビット 反転 移項 β α