游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2985|回复: 2

站长有空看一下blog系统的问题

[复制链接]

12

主题

124

帖子

124

积分

注册会员

Rank: 2

积分
124
QQ
发表于 2006-5-7 16:21:00 | 显示全部楼层 |阅读模式
我在blog中用XB代码总是有问题,比如字号有时候正常,有时候乱其八糟,还有贴代码用
  1. 代码
复制代码
时多贴一些代码就不知怎么一团糟了,很是打击俺的积极性啊!

还有我在blog中写的文章,有的我自己删掉了,直接在博客上看不到了,可是用百度搜索可以出来,而且还可以继续正常访问,实在是不明白。系统回收站到底多长时间才清空一次?

1万

主题

1万

帖子

2万

积分

管理员

中级会员

Rank: 9Rank: 9Rank: 9

积分
20517
发表于 2006-5-8 10:20:00 | 显示全部楼层

Re:站长有空看一下blog系统的问题

在论坛发能正常显示吗?

另外关于百度搜索,那个是他们的缓存,只能看他们多久刷新了。

12

主题

124

帖子

124

积分

注册会员

Rank: 2

积分
124
QQ
 楼主| 发表于 2006-5-8 11:24:00 | 显示全部楼层

Re:站长有空看一下blog系统的问题

没想到和站长碰个正着。

论坛上也不正常,看看下面的文字就知道了,主要问题集中体现在 SIZE 和 CODE 标志上。CODE标志好像不能嵌套。其他标志不知道是否也存在这样的问题。

另外想问一下站长,GameRes最近是否在进行大的调整?亦或遇到了一些困难,我们能否帮上忙?

§3  Writing Endian Independent Code

So we finally get down to the most important part; how does one go about writing code that isn't bound to a certain endian? There are many different ways of doing this; the one I'm going to present here was used in Quake 2, and most of the code you'll see here is somewhat modified code out of the Quake 2 source code. It's mostly geared towards fixing files that are written in a certain endian, since the type casting problem is much harder to deal with. The best thing to do is to avoid casts that assume a certain byte order.

3.1  Step 1: Switching Endians

The first step is to write functions that will automatically switch the endian of a given parameter. First, ShortSwap:


  1.     short ShortSwap( short s )
  2.     {
  3.         unsigned char b1, b2;

  4.         b1 = s & 255;
  5.         b2 = (s >> 8) & 255;

  6.         return (b1 << 8) + b2;
  7.     }
复制代码


This function is fairly straightforward once you wrap your head around the bit math. We take apart the two bytes of the short parameter s with some simple bit math and then glue them back together in reverse order. If you understand bit shifts and bit ANDs, this should make perfect sense. As a companion to ShortSwap, we'll have ShortNoSwap, which is very simple:


  1.     short ShortNoSwap( short s )
  2.     {
  3.         return s;
  4.     }
复制代码


This seems utterly pointless at the moment, but you'll see why we need this function in a moment.

Next, we want to swap longs:


  1.     int LongSwap (int i)
  2.     {
  3.         unsigned char b1, b2, b3, b4;

  4.         b1 = i & 255;
  5.         b2 = ( i >> 8 ) & 255;
  6.         b3 = ( i>>16 ) & 255;
  7.         b4 = ( i>>24 ) & 255;

  8.         return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;
  9.     }

  10.     int LongNoSwap( int i )
  11.     {
  12.         return i;
  13.     }
复制代码


LongSwap is more or less the same idea as ShortSwap, but it switches around 4 bytes instead of 2. Again, this is straightforward bit math.

Lastly, we need to be able to swap floats:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-16 13:55

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表