タグ

!tumblr-techとaliasingに関するtyruのブックマーク (4)

  • Understanding Strict Aliasing - CellPerformance

    One pointer is said to alias another pointer when both refer to the same location or object. In this example, 0uint32_t 1swap_words( uint32_t arg ) 2{ 3 uint16_t* const sp = (uint16_t*)&arg; 4 uint16_t hi = sp[0]; 5 uint16_t lo = sp[1]; 6 7 sp[1] = hi; 8 sp[0] = lo; 9 10 return (arg); 11} The memory referred to by sp is an alias of arg because they refer to the same address in memory. In C99, it i

  • What is the strict aliasing rule?

    A typical situation where you encounter strict aliasing problems is when overlaying a struct (like a device/network msg) onto a buffer of the word size of your system (like a pointer to uint32_ts or uint16_ts). When you overlay a struct onto such a buffer, or a buffer onto such a struct through pointer casting you can easily violate strict aliasing rules. So in this kind of setup, if I want to sen

    What is the strict aliasing rule?
  • type punning と strict aliasing - memologue

    /.JのGCC-3.4リリースの話題を追っていたら、GCC3では-O2で-fstrict-aliasingが有効だから注意せよというポスト(http://slashdot.jp/comments.pl?sid=175355&cid=537217)があった。 strict aliasing については、Radium Software Developmentさんが詳しい。これは気にしておいたほうがよさそうだ。GCCの -fstrict-aliasing の説明は次。 コンパイルされている言語に適用可能な別名規則(aliasing rule)のうち最も厳密なものをコンパイラが前提することを許します。これによって、 C(およびC++)では式の型に基く最適化を動作させることになります。例えば、ある型のオブジェクトが別の型のオブジェクトと同一アドレスに位置することは、それら2つの型がほとんど同一でない

    type punning と strict aliasing - memologue
  • ホワット・ア・ワンダフル・ワールド strict aliasing rule

    来週からは後期スタートだというのに,生活ペースはメチャクチャ.昨日は 17 時に起きてしまい,今日は 22 時半ごろに起きてしまった今日この頃,皆様いかがお過ごしでしたでしょうか ? まぁ,順調に 6 時間ずつズレているので,明日には元に戻るかなと. しっかし,なんで夜型の方には一瞬で 6 時間とか 12 時間とか平気でズレるのに,朝方の方には意識しないと絶対にズレないんでしょうかね ? まぁ,朝の 3 時とかにバリバリ活動しているってのは,ある意味朝型と言えなくもないような (ことはない). 僕は夜はあんまり生産的な方面にやる気が出ない人なので,夜型になると研究がさっぱり進まないと言う.いろいろ危機です. あと,Debian にテキトーなパッケージをいっぱい突っ込んでいたら,何故か日語の TTF (フォント) が表示されなくなってしまいました.そんなこんなで今はビットマップな生活なんで

  • 1