<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mzp</author_name>
  <author_url>https://blog.hatena.ne.jp/mzp/</author_url>
  <blog_title>みずぴー日記</blog_title>
  <blog_url>https://mzp.hatenadiary.org/</blog_url>
  <categories>
    <anon>OCaml</anon>
  </categories>
  <description>ABCをパースする際に、24ビットの整数を32ビットの整数に符号拡張したくなった。とりあえず、算術シフトをつかって実現してみた。7ビットシフトなのは、OCamlの整数が31ビットだから。 let s_extend d = (d lsl 7) asr 7 これでもいいんだけど、CPUによっては符号拡張命令をもっているらしいから、なんかもったいないような気がする。 id:selvaggio方式 http://twitter.com/selvaggio/statuses/950446367で教えてもらった。 let s_extend d = 0x1fe * (0x00800000 land d) l…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmzp.hatenadiary.org%2Fentry%2F20081008%2Fsignextend&quot; title=&quot;符号拡張がしたい - みずぴー日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2008-10-08 00:00:01</published>
  <title>符号拡張がしたい</title>
  <type>rich</type>
  <url>https://mzp.hatenadiary.org/entry/20081008/signextend</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
