Search found 3447 matches

by MichaelW
Aug 05, 2015 6:48
Forum: General
Topic: ASM translation from PB to FB
Replies: 20
Views: 1770

Re: ASM translation from PB to FB

I downloaded and installed Version 1.02.0 (04-05-2015), built for win32 (32bit), and corrected the errors in the first 12 lines of assembly code so the code will compile (and assemble) without errors. SUB ALPHA_C(BYREF SRC AS LONG PTR, BYREF DEST AS LONG PTR, _ BYVAL W AS LONG, BYVAL H AS LONG, _ BY...
by MichaelW
Jul 31, 2015 4:03
Forum: General
Topic: BitScanForward
Replies: 35
Views: 3795

Re: BitScanForward

The popcnt() example compiles okay, and without any special _FB_SSE directives. Do you think a CUPID test is necessary for 64-bit compilation? Wouldn't a 64-bit processor already have a resident popcnt() instruction? My quick search shows the POPCNT instruction being introduced in the 2007/2008 ran...
by MichaelW
Jul 31, 2015 0:45
Forum: General
Topic: BitScanForward
Replies: 35
Views: 3795

Re: BitScanForward

I just posted a 64-bit version of my Aligned Malloc tests here that uses BSF to determine the alignment of a pointer. And here is a version of the 64-bit POPCNT code from here , modified so it will compile with Version 1.03.0 (07-01-2015): ''----------------------------------------------------------...
by MichaelW
Jul 31, 2015 0:38
Forum: Windows
Topic: CRT Aligned Malloc functions
Replies: 1
Views: 1464

Re: CRT Aligned Malloc functions

Here is a 64-bit version, tested with Version 1.03.0 (07-01-2015): #include once "crt/stddef.bi" extern "c" declare function _aligned_malloc(byval as size_t,byval as size_t)as any ptr '' parameters: size, alignment declare function _aligned_realloc(byval as any ptr,byval as size_...
by MichaelW
Jul 26, 2015 4:54
Forum: General
Topic: Making compact number representation
Replies: 13
Views: 1156

Re: Making compact number representation

The CRT _itoa,_i64toa,...functions are reliable and reasonably speed optimized, and can encode values in base 36.

Code: Select all

#include "crt.bi"
dim as zstring * 100 buffer
_itoa(1234567890,@buffer,36)
print buffer
sleep

Code: Select all

kf12oi
by MichaelW
Jul 26, 2015 4:13
Forum: Beginners
Topic: Ubyte and negative step in 'For' loop [Solved]
Replies: 21
Views: 1188

Re: Ubyte and negative step in 'For' loop [Solved]

Tourist Trap wrote:Unless you tell me that from the start I should have prohibited ubyte as an index type.

The larger and slower code problem likely also applies for indexing.
by MichaelW
Jul 26, 2015 3:44
Forum: Beginners
Topic: Ubyte and negative step in 'For' loop [Solved]
Replies: 21
Views: 1188

Re: Ubyte and negative step in 'For' loop [Solved]

This subject keeps coming up. There is no good reason to use anything smaller than a 32-bit integer as a loop counter, because if you do so the resulting code is larger and slower. And if you need to exceed the signed range of the loop counter, you need a larger loop counter. Now you could argue tha...
by MichaelW
Jul 25, 2015 7:36
Forum: Community Discussion
Topic: Abstract/Virtual destructor/method behaviour
Replies: 229
Views: 37452

Re: Abstract/Virtual destructor/method behaviour

Compiled with Version 1.02.0 (03-23-2015), built for win64 (64bit):

Code: Select all

5MYUDT

N11MYNAMESPACE5MYUDTE

N11MYNAMESPACE17MYNAMESPACENESTED5MYUDTE
by MichaelW
Jul 23, 2015 14:05
Forum: Community Discussion
Topic: Boolean Data Type in freebasic
Replies: 121
Views: 13756

Re: Boolean Data Type in freebasic

Considering only code efficiency, using a byte as a logic element in 32/64-bit code makes little sense. I don't know that any more for current CPUs. The old rule (till core2) was that Intel favoured simple, aligned code, and AMD tightly packed everything. Is a movzbl really slower than a plain mov ...
by MichaelW
Jul 23, 2015 10:59
Forum: Beginners
Topic: Does "Randomize Timer" have a speed limit?
Replies: 13
Views: 1471

Re: Does "Randomize Timer" have a speed limit?

I did not test this, but frequent reseeding of a PRNG from what is effectively a sequential counter seems likely to reduce the randomness of the generated numbers.
by MichaelW
Jul 23, 2015 9:03
Forum: Community Discussion
Topic: Boolean Data Type in freebasic
Replies: 121
Views: 13756

Re: Boolean Data Type in freebasic

For Windows BOOL is defined as an integer, see Windows Data Types. Considering only code efficiency, using a byte as a logic element in 32/64-bit code makes little sense.
by MichaelW
Jul 23, 2015 2:43
Forum: Community Discussion
Topic: Version 1.03.0
Replies: 39
Views: 4951

Re: Version 1.03.0

caseih wrote:Is GoRC.exe something that ships with fbc? What is GoRC.exe?

GoRC is Jeremy Gordon's resource compiler, part of his Go tools for
Windows + Assembler
, and AFAIK is included with his permission.
by MichaelW
Jul 18, 2015 8:49
Forum: General
Topic: About sharing data between running executables
Replies: 24
Views: 2126

Re: About sharing data between running executables

grindstone wrote:It's nearly foolproof.

Without some sort of synchronization, how does the receiving process know that the write operation is complete, and how does the emitting process know that the read operation is complete?
by MichaelW
Jul 18, 2015 8:04
Forum: General
Topic: About sharing data between running executables
Replies: 24
Views: 2126

Re: About sharing data between running executables

Starting with the memory-mapped file examples I linked earlier in this thread, I created cut-down versions (with no error handling) that time access to the mapped memory. In actual practice you would probably need to synchronize access to the mapped memory, and one simple method of doing this is to ...
by MichaelW
Jul 14, 2015 20:03
Forum: General
Topic: About sharing data between running executables
Replies: 24
Views: 2126

Re: About sharing data between running executables

There is an example that uses memory mapped files here: http://www.freebasic.net/forum/viewtopic.php?p=130623#p130623 Although I did not use the term, the example uses a "named" file mapping object, so other apps can use the same object by specifying the name. And note that you can arrange...

Go to advanced search