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
Ruby on cygwin 2025-02
fd0
0
140
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
SwiftUI Viewの責務分離
elmetal
PRO
1
230
負債になりにくいCSSをデザイナとつくるには?
fsubal
9
2.4k
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
210
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
370
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
140
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
11
1.9k
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
380
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
120
なぜイベント駆動が必要なのか - CQRS/ESで解く複雑系システムの課題 -
j5ik2o
10
3.5k
時計仕掛けのCompose
mkeeda
1
290
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
Building Your Own Lightsaber
phodgson
104
6.2k
We Have a Design System, Now What?
morganepeng
51
7.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
Rails Girls Zürich Keynote
gr2m
94
13k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
BBQ
matthewcrist
87
9.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
Bash Introduction
62gerente
611
210k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
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 ビット 反転 移項 β α