Hi,

I try to port this c code:
*(uint16_t *)(ptr+FSP_OFFSET_KEY)=htons(p->key);
    *(uint16_t *)(ptr+FSP_OFFSET_SEQ)=htons(p->seq);
    *(uint16_t *)(ptr+FSP_OFFSET_LEN)=htons(p->len);
    *(uint32_t *)(ptr+FSP_OFFSET_POS)=htonl(p->pos);

About uint16_t, I have bit-struct library. But htons messed up my
head.

I found this link:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/18681

But that is 2001, maybe right now we have the function in standard
library. Another point is that library is not portable. It will mess
up in big endian machine. I know I can check the type of machine easy
enough in ruby. But.... still..... I feel better if there is a
function who do the checking for me.

Thank you.