Search found 2269 matches

by jj2007
Feb 22, 2019 14:07
Forum: Beginners
Topic: Random numbers not the same
Replies: 26
Views: 4379

Re: Random numbers not the same

How can you print 200 unique numbers between 0 and 99?! Difficult indeed, especially with integers! Another little problem: Dim MyInt() As DWORD ; tested pseudo code For_ ct=0 To 999 ; load a unique random number between 1000 and 1999 into the array Rand(1000, 2000, MyInt(ct), unique) Next ArraySor...
by jj2007
Feb 20, 2019 10:56
Forum: General
Topic: Checking if a computer is ON on the network
Replies: 11
Views: 1910

Re: Checking if a computer is ON on the network

(if you know that it is local, you can reduce the timeout with -w <ms>) Thanks. I had tested that before and saw no effect. Now I retried, and got it to work (no idea what was different...). Interesting: - without any wait interval (no "-w"), the answer is "host cannot be reached&quo...
by jj2007
Feb 20, 2019 2:19
Forum: Sources, Examples, Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 5449

Re: Numerical optimizer

Code: Select all

TmpFb.bas(62) error 57: Type mismatch, at parameter 2
Is this a demo why code should be thoroughly tested for T+T?
by jj2007
Feb 19, 2019 14:09
Forum: Sources, Examples, Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 5449

Re: Numerical optimizer

You can't expect people to maintain 2 systems and two compilers before they post some code. You can expect people who post here in the Tips & Tricks section that they compile their code at least with standard Gas, Gcc32 and Gcc64. It's only a mouseclick or a keystroke away, right? People who co...
by jj2007
Feb 19, 2019 13:07
Forum: Sources, Examples, Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 3085

Re: Bit duplication

Multiplication is costly (and division is much worse).
by jj2007
Feb 19, 2019 12:10
Forum: Sources, Examples, Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 5449

Re: Numerical optimizer

deltarho[1859] wrote:Actually, I did not write that
Sorry, I quoted badly - of course, I support the spirit of your comment.
by jj2007
Feb 19, 2019 8:51
Forum: Sources, Examples, Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 5449

Re: Numerical optimizer

deltarho[1859] wrote:don't post your code without including an explanation
Exactly. And don't post code that isn't thoroughly tested. This code compiles in 32-bit land but then throws exceptions, definitely no good for the Tips & Tricks section.
by jj2007
Feb 18, 2019 21:46
Forum: Sources, Examples, Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 3085

Re: Bit duplication

dodicat wrote:Here is a string variety.
What do you mean with "string variety"? The lookup code? It's blazingly fast, nice idea...
by jj2007
Feb 18, 2019 8:59
Forum: Sources, Examples, Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 3085

Re: Bit duplication

coderJeff wrote:specify a low optimization level
That distorts the result in favour of the "naked" assembly routines. What often works instead is to fake an interest in the results generated in the loop by adding them up and displaying the sum after the loop has finished.
by jj2007
Feb 17, 2019 23:49
Forum: Sources, Examples, Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 3085

Re: Bit duplication

Assembly version, it's pretty fast. That's an understatement, it's almost three times as fast as mine ;-) function dup8bits naked cdecl ( byval x as ulong ) as ulong 'CoderJeff asm #ifdef __FB_64BIT__ .align 16 #ifdef __FB_LINUX__ mov rax, rdi #else mov rax, rcx #endif #else .align 4 mov eax, [esp+...
by jj2007
Feb 17, 2019 3:13
Forum: Sources, Examples, Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 3085

Re: Bit duplication

dodicat wrote:You should reset t for Badidea B
Done, thanks.
by jj2007
Feb 17, 2019 1:10
Forum: Sources, Examples, Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 3085

Re: Bit duplication

Duplicate bits 0->00, 1->11. Example: 1001 0001 -> 11000011 00000011 What's wrong with assembly? You want it fast, right? function duplicate naked cdecl (byval inbyte as long) as integer asm .align 4 mov edx, [esp+4] xor eax, eax mov ecx, -1073741824 L0: rol ecx, 2 shr edx, 1 je L1 jnc L0 or eax, e...
by jj2007
Feb 16, 2019 3:03
Forum: General
Topic: PCG32II Help file
Replies: 36
Views: 4518

Re: PCG32II Help file

deltarho[1859] wrote:nobody is as dumb as me.
So you think you are unique?? No way...
by jj2007
Feb 15, 2019 12:36
Forum: General
Topic: Checking if a computer is ON on the network
Replies: 11
Views: 1910

Re: Checking if a computer is ON on the network

dodicat wrote:You want it in FreeBASIC code, then use the freeBASIC website to tell you.
(As a bonus you get an IP address)
Hey, that works much better than IcmpSendEcho, even for my 'TheOtherNotebook'! Thanxalot, dodicat...
by jj2007
Feb 15, 2019 12:16
Forum: General
Topic: Checking if a computer is ON on the network
Replies: 11
Views: 1910

Re: Checking if a computer is ON on the network

xbgtc wrote:thanks but I'm aware of ping but wanna see if there's a coding way
There is: IcmpSendEcho