📄 sock.c
字号:
/* Copyright (c) 2002-2005 Vladislav Goncharov.
*
* Redistribution and use in source forms, with and without modification,
* are permitted provided that this entire comment appears intact.
*
* Redistribution in binary form may occur without any restrictions.
*
* This software is provided ``AS IS'' without any warranties of any kind.
*/
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
//
// $Id: sock.c,v 1.2 2002/12/03 12:14:28 dev Exp $
/*
* Some helpers from sockets
*/
#include <stdlib.h>
#include <string.h>
#include "sock.h"
u_long ntohl (u_long netlong)
{
u_long result = 0;
((char *)&result)[0] = ((char *)&netlong)[3];
((char *)&result)[1] = ((char *)&netlong)[2];
((char *)&result)[2] = ((char *)&netlong)[1];
((char *)&result)[3] = ((char *)&netlong)[0];
return result;
}
u_short ntohs (u_short netshort)
{
u_short result = 0;
((char *)&result)[0] = ((char *)&netshort)[1];
((char *)&result)[1] = ((char *)&netshort)[0];
return result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -