Here is a fast und small ASM Solution. Give it a try.
Feedback are welcome ! :wink:
;Remove unnecessary spaces in a String
;
Procedure RemoveSpaces(*string)
EnableASM
Protected string = *string
MOV esi, [p.v_string]
MOV edi, esi
!firstspaces:
LODSW
CMP al, " "
JE firstspaces
STOSW ...
Search found 26 matches
- Sat Jun 22, 2024 12:19 pm
- Forum: Coding Questions
- Topic: StringField
- Replies: 14
- Views: 2019
- Thu Jun 20, 2024 6:07 pm
- Forum: Coding Questions
- Topic: StringField
- Replies: 14
- Views: 2019
Re: StringField
@Axolotl:
your code Check for 10 spaces down to 2
on found replace with #CRLF$.
It's simple and very good solution.
@marc56us:
This works like it should, but i can't full understand it.
Can you explain what the Trick is, please.
- - > CreateRegularExpression(0, "(.+?)(?:[ ]{2,}|$)")
your code Check for 10 spaces down to 2
on found replace with #CRLF$.
It's simple and very good solution.
@marc56us:
This works like it should, but i can't full understand it.
Can you explain what the Trick is, please.
- - > CreateRegularExpression(0, "(.+?)(?:[ ]{2,}|$)")
- Thu Jun 20, 2024 3:19 pm
- Forum: Coding Questions
- Topic: StringField
- Replies: 14
- Views: 2019
Re: StringField
But what is if i want to seperate only word's with two or more spaces between it?
My Car is Red__cool_yes_____the_house_is_blue___dog__food
Result should be:
My Car is Red
cool yes
the house is blue
dog
food
My Car is Red__cool_yes_____the_house_is_blue___dog__food
Result should be:
My Car is Red
cool yes
the house is blue
dog
food
- Mon Jun 17, 2024 6:00 pm
- Forum: Coding Questions
- Topic: StringField
- Replies: 14
- Views: 2019
StringField
Say i have a String with words separated by spaces.
But the spaces between the word's have a different amount.
mystring="Mouse car Apple four purebasic"
How can i separate the word's with Stringfield.
Or is there a better solution?
But the spaces between the word's have a different amount.
mystring="Mouse car Apple four purebasic"
How can i separate the word's with Stringfield.
Or is there a better solution?
- Sat Feb 18, 2023 12:39 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
Hello Demivec,
thank you very very much for the brilliant Source you have made.
This was exactly what i want.
It's amazing what all is possible with so called bit twiddling.
I have try to convert the routine to assembly,
Can you take a look on it and check for some optimization or errors please ...
thank you very very much for the brilliant Source you have made.
This was exactly what i want.
It's amazing what all is possible with so called bit twiddling.
I have try to convert the routine to assembly,
Can you take a look on it and check for some optimization or errors please ...
- Sun Feb 12, 2023 9:54 am
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
Bitwise compare of Values
- Sat Feb 11, 2023 5:13 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
Hello again,
here is a slow Procedure permutation recursive example
of that "bit shift sequence" what i need.
But in Assembler and like that Procedure NBP_PB
for a max speed.
XIncludeFile "time.pbi"
initTime(10000)
Procedure NBP_PB(v) ;Next Bit Permutation
highestBit.i
!BSF rcx, [p.v_v ...
here is a slow Procedure permutation recursive example
of that "bit shift sequence" what i need.
But in Assembler and like that Procedure NBP_PB
for a max speed.
XIncludeFile "time.pbi"
initTime(10000)
Procedure NBP_PB(v) ;Next Bit Permutation
highestBit.i
!BSF rcx, [p.v_v ...
- Thu Feb 09, 2023 3:59 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
I can only imagine you mean something like this:
EnableExplicit
Procedure highestBit(i.i)
i | (i >> 1)
i | (i >> 2)
i | (i >> 4)
i | (i >> 8)
i | (i >> 16)
ProcedureReturn i & ~(i >> 1)
EndProcedure
Define a = %100011111
Define hb
While a
Debug RSet(Bin(a), 32, "0")
hb = highestBit(a ...
- Wed Feb 08, 2023 11:25 am
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
Here is what i want but with the permutations sequence from my last Post's.
Define QPC_TICKS_PER_SECOND.l
Define QPC_Time_freq.q
Define QPC_Time_start.q
Procedure.l initTime(ticks_per_second.l=1000)
Shared QPC_TICKS_PER_SECOND.l
Shared QPC_Time_freq.q
Shared QPC_Time_start.q
If Not ...
Define QPC_TICKS_PER_SECOND.l
Define QPC_Time_freq.q
Define QPC_Time_start.q
Procedure.l initTime(ticks_per_second.l=1000)
Shared QPC_TICKS_PER_SECOND.l
Shared QPC_Time_freq.q
Shared QPC_Time_start.q
If Not ...
- Wed Feb 08, 2023 9:11 am
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
I want do calculate all posibble combinations for the given
set of Bit's.
This is for a Lottery Programm i want do programming.

- Wed Feb 08, 2023 9:08 am
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
; 6 out 49
Procedure BitSet(VAR, NR)
EnableASM
MOV rbx, [p.v_NR]
DEC rbx
MOV rax, [p.v_VAR]
BTS rax, rbx
DisableASM
ProcedureReturn
EndProcedure
Procedure BitClear(VAR, NR)
EnableASM
MOV rbx, [p.v_NR]
DEC rbx
MOV rax, [p.v_VAR]
BTC rax, rbx
DisableASM
ProcedureReturn
EndProcedure ...
- Tue Feb 07, 2023 9:36 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
Is this possible without loops?
In my opinion you either need recursion or some sort of self built stack and a loop. Because as you already found out you need more and more nested loops to make this work with higher bit counts. Now try to use static arrays which hold the values of the start ...
- Tue Feb 07, 2023 9:04 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
I have made a quick and dirty example to show what i want in Assembly.
Here i only have 6 Bit's permutation, but with more the sequence is the same.
Start with all Bit's on the right side.
Is this possible without loops?
Procedure BitSet(VAR, NR)
EnableASM
MOV rbx, [p.v_NR]
DEC rbx
MOV rax ...
Here i only have 6 Bit's permutation, but with more the sequence is the same.
Start with all Bit's on the right side.
Is this possible without loops?
Procedure BitSet(VAR, NR)
EnableASM
MOV rbx, [p.v_NR]
DEC rbx
MOV rax ...
- Tue Feb 07, 2023 7:17 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
Up to the 50's Bit Position and up to N (1-26) Bit's set to 1
- Tue Feb 07, 2023 6:49 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit Shifting
- Replies: 33
- Views: 20834
Re: Bit Shifting
Does the sequence always start with n · zeros and m · ones concatenated with another and stops in m · ones and n · zeros, so the whole thing reversed in principle? And in between you want to see all possible values you can create using these bits but it has to be in that specific sequence ...