Search found 7936 matches

by dodicat
Dec 29, 2023 16:08
Forum: Beginners
Topic: DIM-ing a constant string
Replies: 6
Views: 578

Re: DIM-ing a constant string

This works also: function MakePair(pair as const string) as const string dim as ubyte u(511) for n as long=0 to 511 if n mod 2=0 then u(n)=pair[0] else u(n)=pair[1] next return *cast(zstring ptr,@u(0)) end function dim as const string * 512 a=MakePair("Er") dim as const string * 512 b=Make...
by dodicat
Dec 17, 2023 10:56
Forum: Windows
Topic: Win 11 console
Replies: 26
Views: 2192

Re: Win 11 console

Yes, thanks srvaldez, I did see your post but I cannot get For developers and terminal from privacy settings here, I have to go through settings/system which goes to show that Win 11 does not seem consistent through continents. Thanks caseih Although perhaps changing font sizes or gdi stuff in the t...
by dodicat
Dec 16, 2023 20:02
Forum: Windows
Topic: Win 11 console
Replies: 26
Views: 2192

Win 11 console

Looks like you can easily change to the old console now: Open the start menu on the taskbar (the 4 blue squares) settings system For developers In the terminal drop down list choose Windows Console Host. Tester code: #include "windows.bi" Shell "color f0" Sub changefontsize(w As ...
by dodicat
Dec 15, 2023 18:29
Forum: General
Topic: slow to execute after compiling source code
Replies: 11
Views: 1213

Re: slow to execute after compiling source code

I have Avast antivirus here on win 11. If I run code via quickrun in fbide (I don't have fbidetemp.exe set as an exception), I get a beautiful little console called Avast Cybercapture, which is an intermediate console to test for viruses e.t.c. After I click off this capturing console when the progr...
by dodicat
Nov 24, 2023 1:47
Forum: Sources, Examples, Tips and Tricks
Topic: Sorting Algorithms
Replies: 12
Views: 1617

Re: Sorting Algorithms

I don't think it matters which sort method. Capture the swaps in an array, and apply the array to unsort. Both the sorted text and the array can be saved to file and retrieved from file. Example, combsort: type pair as long n1,n2 end type sub sortstring(_string as string,begin as long,finish as long...
by dodicat
Nov 21, 2023 22:05
Forum: Sources, Examples, Tips and Tricks
Topic: Data Compression Different Methods
Replies: 26
Views: 5704

Re: Data Compression Different Methods

Hi neil. If you do pairs, it remains fast, only two numbers are required for the decode, the total count and a concatenation. Any known seed. example: Dim As Ulongint i,x,cnt,c1,c2,f1,f2,tot Dim As Ubyte n1,n2,n3,n4 Dim As Ubyte a,b,c,d Function mkulongint(n1 As Ulong,n2 As Ulong) As Ulongint Dim As...
by dodicat
Nov 20, 2023 12:22
Forum: Sources, Examples, Tips and Tricks
Topic: Data Compression Different Methods
Replies: 26
Views: 5704

Re: Data Compression Different Methods

Slightly faster method, any seed. Dim As Uinteger i,x,cnt Dim As Ubyte n1,n2,n3,n4 Dim As Ubyte a,b,c,d 'my numbers n1 = 33:n2 = 207:n3 = 94:n4 = 70 'seed number randomize timer dim as long seed=rnd*50 randomize seed dim as byte fa,fb,fc,fd Do if fa=0 then a = (rnd * 256) if fb=0 then b = (rnd * 256...
by dodicat
Nov 14, 2023 13:25
Forum: Windows
Topic: Icon cache corruption
Replies: 22
Views: 4915

Re: Icon cache corruption

First off, thank you all for your messages in missing in action thread. And to D.J. Peters and TJF I send my condolences. Deltarho, I don't think I'll ever get hot and bothered by fb forum chit chat again. Certainly not to the point throwing towels in. The forum certainly had more buzz a while back,...
by dodicat
Sep 26, 2023 16:51
Forum: Community Discussion
Topic: Missing in action.
Replies: 28
Views: 4392

Re: Missing in action.

Thanks deltarho/Lothar/srvaldez. I am still here, but only half. My wife died on Sept 7 after an horrific but short illness. (a few weeks). She was buried on Sept 18 in Stoneykirk Cemetery, a few hundred yards from our home. Sorry I missed the first "Missing in action" post, I am a little ...
by dodicat
Jul 14, 2023 22:59
Forum: Beginners
Topic: cc1.exe and __builtin functions
Replies: 20
Views: 2956

Re: cc1.exe and __builtin functions

Here is a faster popcounter. #cmdline "-gen gcc -O 2" #include "crt.bi" function popcnt64(x as ulongint) as ulong if x=-1 then return 64 x -= ((x shr 1) and &h5555555555555555) x = (((x shr 2) and &h3333333333333333) + (x and &h3333333333333333)) x = (((x shr 4) + x) ...
by dodicat
Jul 10, 2023 17:37
Forum: General
Topic: can function's identifier serve as UDT instance?
Replies: 2
Views: 427

Re: can function's identifier serve as UDT instance?

You could do it this way type t_buffer a as integer b as string *50 end type declare function thisBuffer(s as string) as t_buffer dim r as t_buffer r = thisBuffer("this is a buffer") print r.b print r.a sleep end function thisBuffer(s as string) as t_buffer thisbuffer=type(1,s) end functio...
by dodicat
Jul 08, 2023 18:06
Forum: General
Topic: QB64 faster than FB ?
Replies: 41
Views: 2351

Re: QB64 faster than FB ?

srvaldez
I think perhaps ulong is big enough .
There is a multiplication which can overspill.
by dodicat
Jul 08, 2023 15:15
Forum: General
Topic: QB64 faster than FB ?
Replies: 41
Views: 2351

Re: QB64 faster than FB ?

Here is my div from first principles, not very fast. Function div(number As Ulongint, divisor As Ulongint) As Ulongint Dim As Ulongint flag,k=1 Dim As Ulongint d,t if number<divisor then return 0 if number=divisor then return 1 Do t+=k d+=divisor*k If d>=number Then If flag=0 Then d-=divisor*k t-=k ...
by dodicat
Jul 08, 2023 14:22
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 270
Views: 26084

Re: Freebasic 1.20.0 Development

On the new win 11 console locate and color work OK. Print also works, but it is buggy and the console vertical scroll is not active. I get about 9000 lines in the default factory buffer in both legacy and Win 11 consoles. I have a setup where I can do cmd /c "<$file>" <$param> & pause ...
by dodicat
Jul 06, 2023 23:20
Forum: General
Topic: QB64 faster than FB ?
Replies: 41
Views: 2351

Re: QB64 faster than FB ?

I see integer in the code,
For a fair comparison integer<64> could be better (so both use the same size datatype)
I tested here with integer<64>
32 bits: 37.4 seconds
64 bits: 12.9 seconds