title: NumPy: 3-byte, 6-byte types (aka uint24, uint48)
body: <p>NumPy seems to lack built-in support for 3-byte and 6-byte types, aka <code>uint24</code> and <code>uint48</code>.
  I have a large data set using these types and want to feed it to numpy. What I currently do (for uint24):</p>
  
  <pre><code>import numpy as np
  dt = np.dtype([('head', '&lt;u2'), ('data', '&lt;u2', (3,))])
  # I would like to be able to write
  #  dt = np.dtype([('head', '&lt;u2'), ('data', '&lt;u3', (2,))])
  #  dt = np.dtype([('head', '&lt;u2'), ('data', '&lt;u6')])
  a = np.memmap("filename", mode='r', dtype=dt)
  # convert 3 x 2byte data to 2 x 3byte
  # w1 is LSB, w3 is MSB
  w1, w2, w3 = a['data'].swapaxes(0,1)
  a2 = np.ndarray((2,a.size), dtype='u4')
  # 3 LSB
  a2[0] = w2 % 256
  a2[0] &lt;&lt;= 16
  a2[0] += w1
  # 3 MSB
  a2[1] = w3
  a2[1] &lt;&lt;=8
  a2[1] += w2 &gt;&gt; 8
  # now a2 contains "uint24" matrix
  </code></pre>
  
  <p>While it works for 100MB input, it looks inefficient (think of 100s GBs of data). Is there a more efficient way? For example, creating a special kind of read-only view which masks part of the data would be useful (kind of "uint64 with two MSBs always zero" type). I only need read-only access to the data.</p>