Search found 364 matches

by SMaag
Sat Jan 31, 2026 3:54 pm
Forum: Coding Questions
Topic: Search MAP, List, Array value in runtime
Replies: 9
Views: 466

Re: Search MAP, List, Array value in runtime

why don't you transfer your Map Keys into a List, then you can sort it.

If you want to search Kcc with additional character like Kccc, you can use phonetic functions like soundex.

If you put your individual debug functions in a seperate module, it do not blow up your functional code that much.
by SMaag
Sun Jan 25, 2026 11:42 am
Forum: Coding Questions
Topic: Long bug when negative bit is set
Replies: 11
Views: 517

Re: Long bug when negative bit is set

As freak said, It's by design not a bug. It's the PB arithmtic shift. That's often a problem!
You have to mask out the the upper Bits after the shift.

But here is a full solution for the BSWAP



Procedure.q BSWAP64(value.q)

CompilerIf #PB_Compiler_Backend = #PB_Backend_Asm

CompilerIf #PB ...
by SMaag
Fri Jan 23, 2026 8:15 pm
Forum: Announcement
Topic: PureBasic 6.40 alpha 3 is ready, surprise inside !
Replies: 113
Views: 6827

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Amazing! If you did not manuiplate the ElapsedMilliseconds()!!!

I can't belive that the speed plus is only the change of String library.

I use prototyped String functions to prevent PB from creating string copies.

I'm working on a X-Reference Tool with a lot of Character and String functions ...
by SMaag
Fri Jan 23, 2026 5:34 pm
Forum: Announcement
Topic: PureBasic 6.40 alpha 3 is ready, surprise inside !
Replies: 113
Views: 6827

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

At 1st congratulation to this desiccion!

I do a lot of crazy String manipulations what will probably fail with the new String System.

So I have some questions about it works under the hood:

1. Where the length information is saved?
2. How to read out directly?
3. And finally how to manipulate ...
by SMaag
Wed Jan 21, 2026 11:25 pm
Forum: The PureBasic Editor
Topic: Colouring variables
Replies: 4
Views: 273

Re: Colouring variables

But what you are telling : "... would require a live compilation of the code to determine..." gives me an idea that only Fred can do, is to create a sort of line compiler.

C$ = LineCompile(line$) and would return a sort of compiled code with tokens for each element of the line. With that, it would ...
by SMaag
Wed Jan 21, 2026 9:50 pm
Forum: Announcement
Topic: CX compiler + VM (All Platforms)
Replies: 15
Views: 1009

Re: CX compiler + VM (All Platforms)

Just to understand it right what this software is able to do!
Please correct me when I'm wrong!

It is a runtime compiler, what compiles a very simple C-Like Syntax in an intermediate Byte-Code.
This Bytecode is interpreted by the Virtual Machine.

- Can we say it's a simple Script language?

- We ...
by SMaag
Wed Jan 21, 2026 6:11 pm
Forum: Announcement
Topic: CX compiler + VM (All Platforms)
Replies: 15
Views: 1009

Re: CX compiler + VM (All Platforms)

I tried to learn a bit from it! Wow! At the moment it's to hard for me! But for sure, if I have more time I will study it in detail - I guess I will learn a lot from that code!
Many tanks for sharing!!!

First I analysed the scanner: I'm wondering you use String operations for all. I'm very sure ...
by SMaag
Mon Jan 19, 2026 3:37 pm
Forum: Game Programming
Topic: 2D Zone Check Functions
Replies: 18
Views: 814

Re: 2D Zone Check Functions

nice work!

here are 2 Links if you need more geometric functions.

John Burkardt, Florida State University - Department of scientific computing

https://people.sc.fsu.edu/~jburkardt/f_src/triangle/
https://people.sc.fsu.edu/~jburkardt/f_src/geometry/
by SMaag
Tue Jan 13, 2026 12:06 am
Forum: Coding Questions
Topic: Simpliest method compare numbers [Resolved]
Replies: 29
Views: 1751

Re: Simpliest method compare numbers


Is it always 4 numbers? Or do you want to have a code working for N numbers?
For 4 numbers the easiest solution is that:
Procedure min4(a, b, c, d)
Protected min = a
If b < min: min = b: EndIf
If c < min: min = c: EndIf
If d < min: ProcedureReturn d: EndIf
ProcedureReturn min
EndProcedure ...
by SMaag
Mon Jan 12, 2026 9:28 pm
Forum: Coding Questions
Topic: Simpliest method compare numbers [Resolved]
Replies: 29
Views: 1751

Re: Simpliest method compare numbers [Resolved]

Just to see if it works! The 'crazy' Assembler versions!


EnableExplicit

; works at x32 and x64
; min of 4 Long

; SSE PackedMin support only up to 32 Bit
Procedure Min4l(a.l, b.l, c.l=2147483647, d.l=2147483647)

CompilerIf #PB_Compiler_Backend = #PB_Backend_Asm

CompilerIf #PB_Compiler ...
by SMaag
Mon Jan 12, 2026 6:03 pm
Forum: Coding Questions
Topic: How to Get the Pointer of a Map to pass it to a Prototype
Replies: 2
Views: 253

How to Get the Pointer of a Map to pass it to a Prototype

I try to use the PB SDK Functions from Map.h
But I can't get the Pointer of the Map correctly.

Here is the code what shows what I try to do! (It's just a proof of concept to learn what is possible!)



EnableExplicit

Prototype Map_Hash(*Str)
Global Map_Hash.Map_Hash

Prototype Map ...
by SMaag
Mon Jan 12, 2026 6:00 pm
Forum: Coding Questions
Topic: Simpliest method compare numbers [Resolved]
Replies: 29
Views: 1751

Re: Simpliest method compare numbers


Macro Min(_v1, _v2)
(_v1*Bool(_v1 <= _v2) + _v2*Bool(_v1 > _v2))
EndMacro

; Get the highest value from 2 values
; use it : result = Max(3,2)
Macro Max(_v1, _v2)
(_v1*Bool(_v1 >= _v2) + _v2*Bool(_v1 < _v2))
EndMacro

Macro MinOf3(_VarResult, _v1, _v2, _v3)
If _v3 < _v2
If _v3 < _v1 ...
by SMaag
Fri Jan 09, 2026 8:46 am
Forum: Coding Questions
Topic: casting issue 6.30b6
Replies: 8
Views: 861

Re: casting issue 6.30b6

All of them are integers, the function wants floats as input but It shouldn't be an issue, the promotion to float should only happen at the end of the evaluation when it passes the parameter to the function.

Now I understand. To make it clear for all!

In PB6.30 the variable type for Sprite ...
by SMaag
Tue Jan 06, 2026 3:42 pm
Forum: Coding Questions
Topic: casting issue 6.30b6
Replies: 8
Views: 861

Re: casting issue 6.30b6

@idle
which of your variable is float?

The documentation says x,y of DisplayTransparentSprite(#Sprite, x, y) is an Integer.
There is no reason for the Compiler to switch to Float if your variables are not float.

maybe

Code: Select all

DisplayTransparentSprite(spriteNumber,Int(cx)-(ct1&2),INt(cy)-(ct1&1)