Search found 3447 matches

by MichaelW
Nov 02, 2015 6:54
Forum: General
Topic: Random Numbers
Replies: 40
Views: 2832

Re: Random Numbers

your RDRAND returns just about the same as regular INT(RND*GarbageBits) Define "just about the same". RDRAND returns a hardware-generated random number. https://en.wikipedia.org/wiki/RdRand While I could not access reference 7 on the Wikipedia page, reference 6 includes a description of t...
by MichaelW
Oct 31, 2015 17:24
Forum: Tips and Tricks
Topic: High-precision CPU clock speed routine, 64-bit Windows only
Replies: 0
Views: 1105

High-precision CPU clock speed routine, 64-bit Windows only

#include "windows.bi" function ClockSpeed() as double dim as LARGE_INTEGER pf, pc1, pc2, cc1, cc2 dim as DWORD_PTR processAffinityMask, systemAffinityMask dim as DWORD priorityClass dim as long threadPriority dim as double freq, giga = 1000000000.0 GetProcessAffinityMask( GetCurrentProces...
by MichaelW
Oct 30, 2015 23:22
Forum: General
Topic: Random Numbers
Replies: 40
Views: 2832

Re: Random Numbers

How do you getit to pick from a range, like : pick 100 numbers between 1 and 4096. This appears to work correctly, substituted into the above code: ''-------------------------------------------------------------------------- '' This function returns a 64-bit cryptographic random number, generated b...
by MichaelW
Oct 30, 2015 0:15
Forum: General
Topic: Random Numbers
Replies: 40
Views: 2832

Re: Random Numbers

[code file=cpufeature.bi:5lxeq8rv] ''----------------------------------------------------------------------------- '' This assigns symbols to the bit index values for the ECX and EDX registers '' as returned by CPUID Function 1. The names are from the Intel manual with '' "-", "."...
by MichaelW
Oct 29, 2015 23:11
Forum: Community Discussion
Topic: Version 1.04.0
Replies: 89
Views: 9453

Re: Version 1.04.0

For the 1.04.0 Win64 zip I downloaded today, libuser32 is missing. I was able to correct the problem by adding the libuser32 from the 1.03.0 archive. Edit: The above fixed the problem for only one of the two source files I am working on. For the other libversion was missing, and again I was able to ...
by MichaelW
Oct 27, 2015 2:34
Forum: General
Topic: Random Numbers
Replies: 40
Views: 2832

Re: Random Numbers

Why not use a source of cryptographic random numbers, from CryptGenRandom for example, or the RDRAND instruction, and forget about "conditioning" the numbers.
by MichaelW
Oct 27, 2015 2:18
Forum: General
Topic: Address of variable
Replies: 4
Views: 660

Re: Address of variable

For local (stack based) variable references in inline assembly the compiler substitutes an expression of the form ebp-N, which unless it is enclosed in square brackets is not a valid memory operand. And for an instruction with two operands, only one can be a memory operand. dim a as integer dim b as...
by MichaelW
Oct 27, 2015 1:42
Forum: Windows
Topic: unable to compile in Windows 10
Replies: 24
Views: 2992

Re: unable to compile in Windows 10

The data contains c0000409 in several places, which is STATUS_STACK_BUFFER_OVERRUN.
by MichaelW
Oct 25, 2015 20:38
Forum: Windows
Topic: unable to compile in Windows 10
Replies: 24
Views: 2992

Re: unable to compile in Windows 10

If your program is failing, you can get an idea of what is happening from the system event logs. I don't have Windows 10, but in Windows 8.1, 7, XP and 2000, you go to Control Panel->Administrative Tools->Event Viewer. Your app is probably triggering an exception, likely an access violation exceptio...
by MichaelW
Oct 14, 2015 1:33
Forum: Beginners
Topic: where is the type FILE defined?
Replies: 9
Views: 896

Re: where is the type FILE defined?

The structure is actually named _iobuf, and for MinGW defined in stdio.h: #ifndef _FILE_DEFINED struct _iobuf { char *_ptr; int _cnt; char *_base; int _flag; int _file; int _charbuf; int _bufsiz; char *_tmpfname; }; typedef struct _iobuf FILE; #define _FILE_DEFINED #endif In my quick search I did no...
by MichaelW
Sep 26, 2015 2:03
Forum: Community Discussion
Topic: second rnd sequence
Replies: 8
Views: 1376

Re: second rnd sequence

I'm not sure I understand the question fully, but you can use the randomize seed argument to specify a sequence. randomize 1 for i as integer = 1 to 10 print int(rnd*100);chr(9); next randomize 2 for i as integer = 1 to 10 print int(rnd*100);chr(9); next randomize 3 for i as integer = 1 to 10 print ...
by MichaelW
Sep 26, 2015 1:44
Forum: Beginners
Topic: UDT = UDT
Replies: 11
Views: 1521

Re: UDT = UDT

At least within limits, you can do it with the CRT memcpy function. #include "crt.bi" type ttest fname as string age as integer bbb as double end type dim as ttest aa(3), bb(3) aa(0).fname = "david" aa(0).age = 63 aa(0).bbb = 1.234 aa(3).fname = "dufus" aa(3).age = 19 a...
by MichaelW
Sep 26, 2015 0:36
Forum: Documentation
Topic: => operator
Replies: 18
Views: 2431

Re: => operator

It is documented on the DIM page as an alternate for the = assignment operator, but the wording is strange, "the => sign" and "the (=) equal sign", and there is no mention of the word "operator". It is an operator, so it should be documented as such.
by MichaelW
Sep 15, 2015 15:09
Forum: Windows
Topic: setenviron not permanent?
Replies: 2
Views: 758

Re: setenviron not permanent?

Your program is modifying a copy of the environment that it receives from the command processor. To make the change permanent you must change the command processor's environment, see Environment Variables.
by MichaelW
Sep 09, 2015 20:13
Forum: General
Topic: How initialize a data memory area as quickly as possible?
Replies: 37
Views: 2847

Re: How initialize a data memory area as quickly as possible

@MichaelW, regarding the article you've pointed to ... the code for calling the function reads: mov dword ptr [rsp+0x20], 5 ; output parameter 5 mov r9d, 4 ; output parameter 4 mov r8d, 3 ; output parameter 3 mov edx, 2 ; output parameter 2 mov ecx, 1 ; output parameter 1 call SomeFunction ; Go Spe...

Go to advanced search