Last modified: 19 August 2010
Name: H5Tset_offset
Signature:
  herr_t `H5Tset_offset`( hid_t `dtype_id`, size_t `offset` )

Purpose:
  Sets the bit offset of the first significant bit.

Description:
  `H5Tset_offset` sets the bit offset of the first significant bit. The significant bits of an atomic datum can be offset from the beginning of the memory for that datum by an amount of padding. The `offset` property specifies the number of bits of padding that appear “to the right of” the value. That is, if we have a 32-bit datum with 16-bits of precision having the value `0x1122`, then it will be laid out in memory as (from small byte address toward larger byte addresses):

  Byte Position | Big-Endian Offset=0 | Big-Endian Offset=16 | Little-Endian Offset=0 | Little-Endian Offset=16
  --- | --- | --- | --- | ---
  0 | [ pad] | [0x11] | [0x22] | [ pad]
  1 | [ pad] | [0x22] | [0x11] | [ pad]
  2 | [0x11] | [ pad] | [ pad] | [0x22]
  3 | [0x22] | [ pad] | [ pad] | [0x11]

  If the offset is incremented then the total size is incremented also if necessary to prevent significant bits of the value from hanging over the edge of the datatype.

  The offset of an H5T_STRING cannot be set to anything but zero.

Parameters:

  hid_t `dtype_id` | IN: Identifier of datatype to set.
  size_t `offset` | IN: Offset of first significant bit.

Returns:
  Returns a non-negative value if successful; otherwise returns a negative value.

Fortran90 Interface: h5tset_offset_f

      SUBROUTINE h5tset_offset_f(type_id, offset, hdferr)
        IMPLICIT NONE
        INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier
        INTEGER(SIZE_T), INTENT(IN) :: offset ! Datatype bit offset of
                                              ! the first significant bit
        INTEGER, INTENT(OUT) :: hdferr        ! Error code
      END SUBROUTINE h5tset_offset_f