Correct ua_ntohs.

This commit is contained in:
brian 1998-09-15 17:22:20 +00:00
parent 6790e73331
commit 006c4708c8

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id:$ * $Id: ua.h,v 1.1 1998/09/04 18:26:00 brian Exp $
*/ */
#ifdef __i386__ /* Do any other archs not care about alignment ? */ #ifdef __i386__ /* Do any other archs not care about alignment ? */
@ -65,9 +65,9 @@
# define ua_ntohs(src, tgt) \ # define ua_ntohs(src, tgt) \
do { \ do { \
u_int32_t __nh; \ u_int16_t __nh; \
__nh = ((u_int32_t)*(u_char *)(src) << 8) | \ __nh = ((u_int16_t)*(u_char *)(src) << 8) | \
(u_int32_t)*((u_char *)(src) + 1); \ (u_int16_t)*((u_char *)(src) + 1); \
memcpy((tgt), &__nh, sizeof __nh); \ memcpy((tgt), &__nh, sizeof __nh); \
} while (0) } while (0)