[Include] DBits - 16-bit and 8-bit arrays support.
#9

Thanks for the comments.



Quote:
Originally Posted by Double-O-Seven
Посмотреть сообщение
Very nice!

//Edit: To the speed comparator above:
This is no WTF. 8-bit and 32-bit is already built in in PAWN, 16-bit not. So 16-bit needs some calculations and this takes time.

//Edit 2: Why is there a DBIT_VAR?
pawn Код:
#define Bit16_Get(%0,%1)                                                        \
        (((DBITS_VAR=(%1)),DBITS_VAR&1)?(%0[(%1)/2]&0x0000FFFF):((%0[(%1)/2]>>>16)&0x0000FFFF))
You could just do this:
pawn Код:
#define Bit16_Get(%0,%1)                                                        \
        ((((%1)&1)?(%0[(%1)/2]&0x0000FFFF):((%0[(%1)/2]>>>16)&0x0000FFFF))
//Edit 3:
pawn Код:
#define Bit16:%0<%1>                                                            \
        %0[(%1)/2]
I'm not sure, but maybe you should round the real array size up:
pawn Код:
#define Bit16:%0<%1>                                                            \
        %0[((%1)+2)/2] // Round up here
If I didn't use DBITS_VAR, the compiler gives a warning because that's like doing:
pawn Код:
if (1 == 1)
EDIT: I added the round up. Thanks.




Quote:
Originally Posted by Anzipane!
Посмотреть сообщение
Nice, but I ran a speed test and the results are that your bit system is slower than the normal 32-bit array system. (Maybe I made some mistakes)

Here's the script I used: http://pastebin.com/biN6NUC6
And the results are:
Код:
8Bit:  115ms
16Bit: 768ms (wtf?)
32Bit: 107ms
There isn't support for 16-bit, like Double-O-Seven said. That's the reason of why it's slow.
Reply


Messages In This Thread
DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 11:26
Re: DBits - 16-bit and 8-bit arrays support. - by SpiderWalk - 14.06.2011, 11:41
Re: DBits - 16-bit and 8-bit arrays support. - by Edvin - 14.06.2011, 11:44
Re: DBits - 16-bit and 8-bit arrays support. - by Mr.GeEk - 14.06.2011, 12:07
Re: DBits - 16-bit and 8-bit arrays support. - by tarmo - 14.06.2011, 12:25
Re: DBits - 16-bit and 8-bit arrays support. - by Anzipane! - 14.06.2011, 13:07
Re: DBits - 16-bit and 8-bit arrays support. - by Double-O-Seven - 14.06.2011, 13:08
Re: DBits - 16-bit and 8-bit arrays support. - by Anzipane! - 14.06.2011, 13:11
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 13:22
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 13:46
Re: DBits - 16-bit and 8-bit arrays support. - by Double-O-Seven - 14.06.2011, 13:54
Re: DBits - 16-bit and 8-bit arrays support. - by ylleron - 14.06.2011, 14:20
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 14:23
Re: DBits - 16-bit and 8-bit arrays support. - by Double-O-Seven - 14.06.2011, 14:29
Re: DBits - 16-bit and 8-bit arrays support. - by GangsTa_ - 14.06.2011, 15:56
Re: DBits - 16-bit and 8-bit arrays support. - by ZeQualX - 14.06.2011, 18:04
Re: DBits - 16-bit and 8-bit arrays support. - by MrDeath537 - 14.06.2011, 21:20
Re: DBits - 16-bit and 8-bit arrays support. - by Lorenc_ - 15.06.2011, 08:59
Re: DBits - 16-bit and 8-bit arrays support. - by leong124 - 15.06.2011, 09:21
Re: DBits - 16-bit and 8-bit arrays support. - by RyDeR` - 15.06.2011, 09:52
Re: DBits - 16-bit and 8-bit arrays support. - by leong124 - 15.06.2011, 11:59
AW: DBits - 16-bit and 8-bit arrays support. - by Forbidden - 15.06.2011, 12:39

Forum Jump:


Users browsing this thread: 4 Guest(s)