Would something like this work for you:
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
If Is64bitOS() : Protected *Item = @ItemB.StructB : Else : Protected *Item = @ItemA.StructA : EndIf
CompilerElse
Protected *Item = @ItemA.StructA
CompilerEndIf
If it is memory space that you ...
Search found 13 matches
- Fri Feb 14, 2014 5:35 am
- Forum: Coding Questions
- Topic: Declaring & Variable already declared.. Message
- Replies: 16
- Views: 2205
- Wed Jan 15, 2014 10:52 pm
- Forum: Coding Questions
- Topic: [5.21 LTS x86, Linux, XP] Apparent compiler bug re: SizeOf
- Replies: 9
- Views: 2429
Re: [5.21 LTS x86, Linux, XP] Apparent compiler bug re: Size
Does this work for you?
Structure udtAbc
xFixed.s{8}
EndStructure
Structure strMain
uAbc.udtAbc
EndStructure
Procedure subProcName(*rMain.strMain)
Protected *T1
*rMain\uAbc\xFixed = LSet("", Len(*rMain\uAbc\xFixed), "x")
*T1 = @*rMain\uAbc\xFixed
*rMain\uAbc\xFixed = LSet("", SizeOf ...
Structure udtAbc
xFixed.s{8}
EndStructure
Structure strMain
uAbc.udtAbc
EndStructure
Procedure subProcName(*rMain.strMain)
Protected *T1
*rMain\uAbc\xFixed = LSet("", Len(*rMain\uAbc\xFixed), "x")
*T1 = @*rMain\uAbc\xFixed
*rMain\uAbc\xFixed = LSet("", SizeOf ...
- Wed Dec 11, 2013 6:57 pm
- Forum: Coding Questions
- Topic: PB5.20 bug: 'Swap' does not swap pointers
- Replies: 24
- Views: 7176
Re: PB5.20 bug: 'Swap' does not swap pointers
I apologize ahead of time as I know this thread is old but I have two items, one that might help and the second item are some questions:
Here is my suggestion to do this using 64 bit registers and not the FPU:
Macro I_Swap(a,b) ; New Macro
!mov r8 ,qword[a_#a]
!mov r9 ,qword[a_#b]
!mov [a_#a ...
Here is my suggestion to do this using 64 bit registers and not the FPU:
Macro I_Swap(a,b) ; New Macro
!mov r8 ,qword[a_#a]
!mov r9 ,qword[a_#b]
!mov [a_#a ...
- Tue May 21, 2013 2:34 pm
- Forum: Tricks 'n' Tips
- Topic: Bits manipulation
- Replies: 15
- Views: 6467
Re: Bits manipulation
Demivec,
WOW, learn something new everyday!!!!
So..... What did I learn from this?
1. When using ASM the following must be used:
1.a. The nomenclature of '[v.<PB_VAR>] is used for variables defined/used in the main section of code (not in a procedure)
1.b. The nomenclature of '[p_v.<PB_VAR>] is ...
WOW, learn something new everyday!!!!
So..... What did I learn from this?
1. When using ASM the following must be used:
1.a. The nomenclature of '[v.<PB_VAR>] is used for variables defined/used in the main section of code (not in a procedure)
1.b. The nomenclature of '[p_v.<PB_VAR>] is ...
- Mon May 20, 2013 3:57 pm
- Forum: Tricks 'n' Tips
- Topic: Bits manipulation
- Replies: 15
- Views: 6467
Re: Bits manipulation
Jassing,
The line of code '[p.v_#ByteTarget]' is not defining a constant but the nomenclature for how to use concatenation in a Macro ([p.v_#ByteTarget] turns in to [p.v_<PB Var>] instead of [p.v_ByteTarget]).
This is how you pass a PB variable to in-line assembler when using the ! directive ...
The line of code '[p.v_#ByteTarget]' is not defining a constant but the nomenclature for how to use concatenation in a Macro ([p.v_#ByteTarget] turns in to [p.v_<PB Var>] instead of [p.v_ByteTarget]).
This is how you pass a PB variable to in-line assembler when using the ! directive ...
- Mon May 20, 2013 1:46 pm
- Forum: Tricks 'n' Tips
- Topic: Bits manipulation
- Replies: 15
- Views: 6467
Re: Bits manipulation
First post in a long time!
I have an issue with trying to convert this code to use ASM in different fashion.
Probably due to something stupid I am doing (or not doing) BUT I can't see it.
Given the above code I have been trying to use the alternative calling nomenclature (code example below ...
I have an issue with trying to convert this code to use ASM in different fashion.
Probably due to something stupid I am doing (or not doing) BUT I can't see it.
Given the above code I have been trying to use the alternative calling nomenclature (code example below ...
- Mon Sep 19, 2011 2:09 pm
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit reversal
- Replies: 14
- Views: 12051
Re: Bit reversal
From the Flat Assembler doc's:
bswap reverses the byte order of a 32-bit general register: bits 0 through 7 are swapped with bits 24 through 31, and bits 8 through 15 are swapped with bits 16 through 23. This instruction is provided for converting little-endian values to big-endian format and vice ...
bswap reverses the byte order of a 32-bit general register: bits 0 through 7 are swapped with bits 24 through 31, and bits 8 through 15 are swapped with bits 16 through 23. This instruction is provided for converting little-endian values to big-endian format and vice ...
- Sun Sep 18, 2011 1:16 am
- Forum: Assembly and C Programming in PureBasic
- Topic: Bit reversal
- Replies: 14
- Views: 12051
Re: Bit reversal
What about the BSWAP instruction?
- Fri Jan 07, 2011 12:13 am
- Forum: Coding Questions
- Topic: pointer to constant string?
- Replies: 16
- Views: 3088
Re: pointer to constant string?
Now I might have misunderstood what you wanted (I am not a C programmer) but is this what you are looking for?
;
;- Constants
;
#Test_1 = "Hello"
#test_2 = "Goodbye"
Define String_Var_1.s
Define String_Var_2.s
Procedure Filter1String(*sss.s)
Protected x.i, y.i
x = 0
Y = Len(*SSS)
If Y > 0 ...
;
;- Constants
;
#Test_1 = "Hello"
#test_2 = "Goodbye"
Define String_Var_1.s
Define String_Var_2.s
Procedure Filter1String(*sss.s)
Protected x.i, y.i
x = 0
Y = Len(*SSS)
If Y > 0 ...
- Thu Dec 16, 2010 3:31 pm
- Forum: Coding Questions
- Topic: Array index out of bounds (array in a structure)
- Replies: 4
- Views: 1577
Re: Array index out of bounds (array in a structure)
The explaination doesn't make sense.
If it works with a constant then why not a variable as both are defined (and set) before the structure/array is defined.
And why would the ReDim work with a variable and not a Dim?
Also, I found the the issue with my hang and it was not related to this issue ...
If it works with a constant then why not a variable as both are defined (and set) before the structure/array is defined.
And why would the ReDim work with a variable and not a Dim?
Also, I found the the issue with my hang and it was not related to this issue ...
- Thu Dec 16, 2010 6:03 am
- Forum: Coding Questions
- Topic: Array index out of bounds (array in a structure)
- Replies: 4
- Views: 1577
Array index out of bounds (array in a structure)
I am getting this error = (Array index out of bounds) when I try to set an array element that is with-in a structure.
Sample code below:
QDN.i = 5
Structure Date_Items
DOE.l
DOW.b
DOM.b
DOY.w
WOY.b
MOY.b
EndStructure
Structure Base_Record
DI.Date_Items
Array Ball_G1.b(QDN)
Ball_G2.b ...
Sample code below:
QDN.i = 5
Structure Date_Items
DOE.l
DOW.b
DOM.b
DOY.w
WOY.b
MOY.b
EndStructure
Structure Base_Record
DI.Date_Items
Array Ball_G1.b(QDN)
Ball_G2.b ...
- Wed Sep 08, 2010 9:07 pm
- Forum: Tricks 'n' Tips
- Topic: Folder archiver (pretty quick)
- Replies: 28
- Views: 6663
Re: Folder archiver (pretty quick)
I actually use a program from IBM called CDP.
The main two features are that it backs up files when they are closed (so when you close a source file, it gets backed up immediately) and does this to two places.
For example, on my laptop, I back up to the local drive (20 versions and use no more than ...
The main two features are that it backs up files when they are closed (so when you close a source file, it gets backed up immediately) and does this to two places.
For example, on my laptop, I back up to the local drive (20 versions and use no more than ...
- Thu May 08, 2008 2:33 am
- Forum: Tricks 'n' Tips
- Topic: [Crossplatform] MySQL Wrapper
- Replies: 26
- Views: 49087
This might help!
akj,
If you haven't already solved this, the following mught be of some help.
in the line
If mysql_real_connect(*hDB,"127.0.0.1","root","password","",3306,"NULL",#Null)
The second parameter is the IP address of the MySQL server you are trying to connect to.
You should be able to change that ...
If you haven't already solved this, the following mught be of some help.
in the line
If mysql_real_connect(*hDB,"127.0.0.1","root","password","",3306,"NULL",#Null)
The second parameter is the IP address of the MySQL server you are trying to connect to.
You should be able to change that ...