Search found 3447 matches

by MichaelW
Jan 20, 2017 20:13
Forum: Sources, Examples, Tips and Tricks
Topic: MacroTimersQPC.inc
Replies: 21
Views: 6766

Re: MacroTimersQPC.inc

You could improve the repeatability, cutting the uncertainty in the timed period in half, by synchronizing with the timer counter before you start the timed period. In case what I mean by synchronizing is not clear, you implement a loop that delays until the counter value changes. You can get an ide...
by MichaelW
Dec 04, 2016 6:51
Forum: Community Discussion
Topic: lack of response
Replies: 16
Views: 4308

Re: lack of response

I think in some cases the problem is that the OP is one of the majority of humans not suited for programming, and so cannot understand the answer well enough to recognize it as such :)
by MichaelW
Dec 03, 2016 2:58
Forum: General
Topic: Seems impossible to rnd*(ulongint range)
Replies: 7
Views: 2133

Re: Seems impossible to rnd*(ulongint range)

There is (64-bit, Windows only) code here that will return a 64-bit cryptographic random number, hardware-generated if the CPU supports the RDRAND instruction, or otherwise generated by the default Cryptographic Service Provider. I forgot to add that the function is relatively slow when returning ra...
by MichaelW
Nov 27, 2016 7:58
Forum: General
Topic: QSort 32 bit vs 64 bit FB
Replies: 28
Views: 5739

Re: QSort 32 bit vs 64 bit FB

The qsort routine lies deep within a C compiler or a C runtime. It lies mysteriously out of our reach (or most of our reaches anyways)... Yes, but the C source code for it is included in the src\crt directory of the Microsoft Platform SDKs, at least up through the Windows Server 2003 SP1 version, a...
by MichaelW
Nov 26, 2016 5:40
Forum: General
Topic: Can't get error code
Replies: 6
Views: 1793

Re: Can't get error code

Using:

Code: Select all

print err, erl
in the error handler, I get: 6 6
by MichaelW
Nov 24, 2016 9:09
Forum: General
Topic: QSort 32 bit vs 64 bit FB
Replies: 28
Views: 5739

Re: QSort 32 bit vs 64 bit FB

For the CRT qsort, when sorting numeric arrays the comparison function need only return the result of a subtraction operation: #include "crt.bi" ''----------------------------------------------- '' Long instead of integer so the code will work '' without alteration on 32-bit and 64-bit FB....
by MichaelW
Nov 22, 2016 13:14
Forum: General
Topic: QSort 32 bit vs 64 bit FB
Replies: 28
Views: 5739

Re: QSort 32 bit vs 64 bit FB

qsort and bsearch are CRT functions exported from msvcrt.dll:

qsort

bsearch

The functions require a type-specific external comparison function which, because it is called from an inner loop, makes the functions relatively slow.

A type-specific sort function would be more efficient.
by MichaelW
Nov 16, 2016 3:05
Forum: Community Discussion
Topic: [offtopic]How can you be proud in future of your country with clinton or trump ?
Replies: 28
Views: 6543

Re: How can you be proud in future of your country with clinton or trump ?

Checks and Balances??? You must be joking ... - President: REP. - Senate: REP. (majority) - Congress: REP. (majority) Where are there any "Checks and Balances" left ??? - Justice? (Federal-Judges require "PRESIDENTIAL" approval) Majorities in the Senate and House are the result ...
by MichaelW
Nov 14, 2016 7:14
Forum: Beginners
Topic: Windows GUI
Replies: 145
Views: 31994

Re: Windows GUI

Assuming I understand what you are trying to do, after you finish drawing the image use InvalidateRect to add the client area to the window's update region so the client area will be redrawn on the next WM_PAINT message. You can use GetClientRect to copy the coordinates of the client area to a RECT ...
by MichaelW
Nov 12, 2016 16:18
Forum: General
Topic: BitScanForward
Replies: 35
Views: 8381

Re: BitScanForward

caseih wrote: And regarding your example, &b11111110 is actually -2 in a signed 8-bit integer if I'm not mistaken.
Yes, thank you.
by MichaelW
Nov 11, 2016 21:43
Forum: General
Topic: BitScanForward
Replies: 35
Views: 8381

Re: BitScanForward

What is the reasoning for the -1? For FreeBASIC, like the Microsoft QuickBASIC it is based on, the operators AND, OR, NOT, and XOR are bitwise operators. I suspect that the -1 value for TRUE was to ensure that NOT TRUE would produce FALSE. To illustrate, using 8-bit signed integers, and assuming th...
by MichaelW
Nov 11, 2016 17:01
Forum: General
Topic: BitScanForward
Replies: 35
Views: 8381

Re: BitScanForward

I ran the above code on different machines, but it returns -1 no matter what hardware it is tested with. What value should it return? It should return -1 if POPCNT is supported, otherwise 0. Per the Intel instruction set reference available here , for CPUID function 1 (EAX=1), support for the POPCN...
by MichaelW
Nov 11, 2016 16:22
Forum: Beginners
Topic: Windows GUI
Replies: 145
Views: 31994

Re: Windows GUI

GDI+ can do the conversion, Microsoft example here.
Sorry, no time to code an example.
by MichaelW
Nov 08, 2016 20:24
Forum: Beginners
Topic: Dim
Replies: 7
Views: 2027

Re: Dim

Because local variables are allocated from the stack, and the stack is constantly being accessed, local variables are more likely to be in the cache.
by MichaelW
Nov 08, 2016 13:25
Forum: Beginners
Topic: Windows GUI
Replies: 145
Views: 31994

Re: Windows GUI

Provoni,

Perhaps what you need is a Windows API window that uses the GFX_NULL driver, example here.