host_to_network (pulong -w target, ulong source)
{
  asm () / R0, R1, R24
  {
    SETPTR R24, &source, DT_DWORD; LOAD R1, R24, DT_DWORD                      /* R1 = source              */
    REVERSE R0, R1, CONVERT_TO | BIG_ENDIAN, DT_DWORD                          /* R0 = bits_to (R1, ...)   */

    SETPTR R24, &target, DT_DWORD; LOADPTR R24, R24                            /* R24 = target             */
    STORE R24, R0, DT_DWORD                                                    /* R24^ = R0                */
  }
}

network_to_host (pulong -w target, ulong source)
{
  asm () / R0, R1, R24
  {
    SETPTR R24, &source, DT_DWORD; LOAD R1, R24, DT_DWORD                      /* R1 = source              */
    REVERSE R0, R1, CONVERT_FROM | BIG_ENDIAN, DT_DWORD                        /* R0 = bits_from (R1, ...) */

    SETPTR R24, &target, DT_DWORD; LOADPTR R24, R24                            /* R24 = target             */
    STORE R24, R0, DT_DWORD                                                    /* R24^ = R0                */
  }
}
