Search found 4985 matches

by dodicat
Aug 20, 2018 9:52
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 13
Views: 197

Re: Saving space when drawing rectangles

jj2007 Works well on both compilers. Regarding #ifdef __FB_64BIT__ Yea, I shall remember dash dash FB dash 64BIT dash dash I have forgotten already. rdx and rcx and the mmx registers I note for 64 bit. Aside, non mmx cpu's don't work properly with fb since about version 18 I tested on my old Pentium...
by dodicat
Aug 20, 2018 8:35
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 13
Views: 197

Re: Saving space when drawing rectangles

Or I find easier to remember:

Code: Select all

#if sizeof(integer)=8
print "64"
#else
print"32"
#endif
sleep 
by dodicat
Aug 20, 2018 0:34
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 13
Views: 197

Re: Saving space when drawing rectangles

Instead of the asm, perhaps:

Code: Select all

sub SmallRectToRect(byref pDest as rect ptr, pSrc as small_rect ptr)
       pdest->left=pSrc->left
       pdest->top=pSrc->top
       pdest->right=pSrc->right
       pdest->bottom=pSrc->bottom
end sub

So it runs in 64 bit as well.
by dodicat
Aug 19, 2018 23:26
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 13
Views: 197

Re: Saving space when drawing rectangles

I think that is very nice code jj2007
by dodicat
Aug 19, 2018 22:45
Forum: General
Topic: Squares
Replies: 5956
Views: 332533

Re: Squares

Hi Richard. If you byval your input strings then a switch from original to bin back to original then = original. Albert, not as fast as Richard's, but I have a new method. dec to hex then hex to bin. The dec to hex I have to speed up. The hex to bin is very fast. I have yet to make hex to dec. Funct...
by dodicat
Aug 18, 2018 15:37
Forum: Community Discussion
Topic: titles for posters?
Replies: 39
Views: 712

Re: titles for posters?

freeBASIC can handle old style line numbers. -gen gas is best 64 bit is useless 'rem prime factors #lang "fblite" 0 option gosub 1 lowers%=30000000 2 uppers%=30000100 10 For counts% = lowers% To uppers% 20 number% = counts% 30 40 Print number%;"= "; 50 divisor% = 2 60 if divisor%...
by dodicat
Aug 18, 2018 2:20
Forum: General
Topic: Two Ulongs to Double
Replies: 30
Views: 911

Re: Two Ulongs to Double

You can do a straight map using 0.. 2^31 -> 0...5 I am not sure how to incorporate the second parameter n2. The asm looks like an or then a subtraction. Function UlongToDouble( n1 As Ulong, n2 As Ulong = 0 ) As Double Asm movd xmm1, dword Ptr [n1] movd xmm0, dword Ptr [n2] punpckldq xmm0, xmm1 psrlq...
by dodicat
Aug 18, 2018 0:15
Forum: Tips and Tricks
Topic: Rect_t - optimized type definition
Replies: 36
Views: 857

Re: Rect_t - optimized type definition

In an image pointer there are three reserved spaces: [5],[6] and [7] These can be used to store the x,y co-ordinates of a rectangle position and the fill option. So all the information aforementioned as being required in a type can stored in the image, thus within the type. type rectangle as any ptr...
by dodicat
Aug 17, 2018 20:48
Forum: Beginners
Topic: How to close a window
Replies: 6
Views: 167

Re: How to close a window

..
by dodicat
Aug 17, 2018 15:14
Forum: Tips and Tricks
Topic: sub-pixel NN blit
Replies: 6
Views: 235

Re: sub-pixel NN blit

Paul Doe. Could you repair your model slightly. Press any key to refresh, esc to end. Function resize(im As Any Ptr,Wdth As Single,Hght As Single) As Any Ptr Dim As Integer iw,ih,imx,imy Imageinfo im,iw,ih Dim As Any Ptr OutImage=Imagecreate(Wdth,Hght) For y As Long=0 To Hght-1 imy= ih*y\(Hght-1) Fo...
by dodicat
Aug 16, 2018 23:20
Forum: Community Discussion
Topic: programming for fun
Replies: 42
Views: 1478

Re: programming for fun

Actually deltarho[] ... In the UK we had 'O' levels, at age 16, and 'A' levels, at age 18. ... Scotland had O grades and Highers. We must not forget the UK is composed of four countries and a few independent islands. Each with different educational systems. Nice story. Basiccoder2 Hard labour? We ca...
by dodicat
Aug 16, 2018 11:32
Forum: General
Topic: Squares
Replies: 5956
Views: 332533

Re: Squares top up

Hi Albert I'll have a fiddle around later. But, as you know, during all these years of bigint, I have kept to string[48] to string[57] only. Yourself and Richard have been using ulong steps, so I kept mine strictly to my own. So, I have always have the headache of speed. Maybe I'll branch out. In th...
by dodicat
Aug 15, 2018 19:53
Forum: General
Topic: Squares
Replies: 5956
Views: 332533

Re: Squares

Albert Here is a slightly faster base2 Function base2(DecimalNumber As String) As String Dim As String starter=DecimalNumber,ans,m,b=string(4*len(DecimalNumber),32) static as byte a(48 to 57)={0,10,0,10,0,10,0,10,0,10} Dim As long c,lens #macro reverse(s) lens=Len(s) For n As Integer=0 To Int((lens-...
by dodicat
Aug 15, 2018 16:58
Forum: Tips and Tricks
Topic: Rect_t - optimized type definition
Replies: 36
Views: 857

Re: Rect_t - optimized type definition

Thanks Mr Swiss. I am fed up now of trying to get a rectangle in one byte or less. I'll try another day not too soon. In the meantime a full blown mega Monte. Type point As short x,y Declare Constructor(As short=0,As short=0) End Type Declare Function shortline(fp As point,p As point,length As Long)...
by dodicat
Aug 15, 2018 13:02
Forum: General
Topic: Anyone done Knuth & Plass text wrapping routine?
Replies: 4
Views: 141

Re: Anyone done Knuth & Plass text wrapping routine?

Need a happier ending. function wrap(s as string,z as long) as string dim as string res dim as long ct for n as long=0 to len(s)-1 ct+=1 res+=chr(s[n]) if ct>z and s[n]=32 or s[n]=asc(".") then ct=0 res+=chr(13,10) end if next return res end function dim as string tale = " In olden ti...

Go to advanced search