On Nov 16, 6:07pm, campbell+netbsd-source-change...@mumble.net (Taylor R Campbell) wrote: -- Subject: Re: CVS commit: src/sys/arch/atari/stand/installboot
| Date: Mon, 17 Nov 2014 01:37:37 +0900 | From: Izumi Tsutsui <tsut...@ceres.dti.ne.jp> | | > Changing `*(uint16_t *)p = v' to `memcpy(p, &v, 2)' doesn't change any | > of that. | | The formar can be easily changed | *(uint16_t *)p = htobe16(v); | but the latter can't. You might be able to use functions like | host16enc and target16enc for streaming data, but the target | cksum is not stream but just calculated in uint16_t. | | So write this? | | host16enc(bb->bb_xxboot + 510, 0); | host16enc(bb->bb_xxboot + 510, 0x1234 - abcksum(bb->bb_xxboot)); | | I don't see the problem. Yes be16enc() should work just fine, I think. christos