Revision history for ProPgPtrArithmetic


Revision [22770]

Last edited on 2019-07-04 00:31:46 by fxm [merged the page POINTER (KeyPgPointer) within page PTR (KeyPgPtr)]
Additions:
will assign the values "##1##" and "##2##" to each integer in the array pointer to by ##//p//##. Since ##//p//## is an ##[[KeyPgInteger|Integer]] [[KeyPgPtr|Pointer]]##, the expression "##*(p + 1)##" is saying to dereference an ##[[KeyPgInteger|Integer]]## four/eight (4/8 on 32/64bit systems) bytes from ##//p//##; the "##1##" indicates a distance of "##1 * the size of an [[KeyPgInteger|Integer]]##", or four/eight (4/8 on 32/64bit systems) bytes.
Deletions:
will assign the values "##1##" and "##2##" to each integer in the array pointer to by ##//p//##. Since ##//p//## is an ##[[KeyPgInteger|Integer]] [[KeyPgPointer|Pointer]]##, the expression "##*(p + 1)##" is saying to dereference an ##[[KeyPgInteger|Integer]]## four/eight (4/8 on 32/64bit systems) bytes from ##//p//##; the "##1##" indicates a distance of "##1 * the size of an [[KeyPgInteger|Integer]]##", or four/eight (4/8 on 32/64bit systems) bytes.


Revision [21468]

Edited on 2016-05-14 01:16:46 by fxm [Updated description]
Additions:
will assign the values "##1##" and "##2##" to each integer in the array pointer to by ##//p//##. Since ##//p//## is an ##[[KeyPgInteger|Integer]] [[KeyPgPointer|Pointer]]##, the expression "##*(p + 1)##" is saying to dereference an ##[[KeyPgInteger|Integer]]## four/eight (4/8 on 32/64bit systems) bytes from ##//p//##; the "##1##" indicates a distance of "##1 * the size of an [[KeyPgInteger|Integer]]##", or four/eight (4/8 on 32/64bit systems) bytes.
( cast(byte ptr, a) - cast(byte ptr, b) ) / sizeof(T)
Deletions:
will assign the values "##1##" and "##2##" to each integer in the array pointer to by ##//p//##. Since ##//p//## is an ##[[KeyPgInteger|Integer]] [[KeyPgPointer|Pointer]]##, the expression "##*(p + 1)##" is saying to dereference an ##[[KeyPgInteger|Integer]]## four (4) bytes from ##//p//##; the "##1##" indicates a distance of "##1 * the size of an [[KeyPgInteger|Integer]]##", or four (4) bytes.
[[KeyPgAbs|Abs]](cast(byte ptr, a) - cast(byte ptr, b)) / [[KeyPgSizeof|Sizeof]](T)


Revision [21225]

Edited on 2016-03-13 14:20:48 by fxm [Formatting]

No Differences

Revision [21223]

Edited on 2016-03-13 14:15:01 by fxm [Formatting]
Additions:





Revision [20657]

Edited on 2016-02-10 16:13:21 by DkLwikki [Update link format]
Additions:
It is often useful to iterate through memory, from one address to another. Pointers are used to accomplish this. While the type of a pointer determines the type of variable or object retrieved when the pointer is dereferenced (using ##[[KeyPgOpValueOf|Operator * (Value of)]]##), it also determines the //distance//, in bytes, its particular type takes up in memory. For example, a ##[[KeyPgShort|Short]]## takes up two (2) bytes in memory, while a ##[[KeyPgSingle|Single]]## needs four (4) bytes.
will assign the values "##1##" and "##2##" to each integer in the array pointer to by ##//p//##. Since ##//p//## is an ##[[KeyPgInteger|Integer]] [[KeyPgPointer|Pointer]]##, the expression "##*(p + 1)##" is saying to dereference an ##[[KeyPgInteger|Integer]]## four (4) bytes from ##//p//##; the "##1##" indicates a distance of "##1 * the size of an [[KeyPgInteger|Integer]]##", or four (4) bytes.
The distance between two pointers is retrieved with ##[[KeyPgOpSubtract|Operator - (Subtract)]]##, and is measured in values, not bytes. For example, the following,
[[KeyPgAbs|Abs]](cast(byte ptr, a) - cast(byte ptr, b)) / [[KeyPgSizeof|Sizeof]](T)
- ##[[KeyPgOpAdd|Operator + (Add)]]##
- ##[[KeyPgOpSubtract|Operator - (Subtract)]]##
- ##[[KeyPgOpAt|Operator @ (Address of)]]##
- ##[[KeyPgOpValueOf|Operator * (Value of)]]##
- [[CatPgOpPoint|Pointer Operators]]
Deletions:
It is often useful to iterate through memory, from one address to another. Pointers are used to accomplish this. While the type of a pointer determines the type of variable or object retrieved when the pointer is dereferenced (using ##[[KeyPgOpValueOf Operator * (Value of)]]##), it also determines the //distance//, in bytes, its particular type takes up in memory. For example, a ##[[KeyPgShort Short]]## takes up two (2) bytes in memory, while a ##[[KeyPgSingle Single]]## needs four (4) bytes.
will assign the values "##1##" and "##2##" to each integer in the array pointer to by ##//p//##. Since ##//p//## is an ##[[KeyPgInteger Integer]] [[KeyPgPointer Pointer]]##, the expression "##*(p + 1)##" is saying to dereference an ##[[KeyPgInteger Integer]]## four (4) bytes from ##//p//##; the "##1##" indicates a distance of "##1 * the size of an [[KeyPgInteger Integer]]##", or four (4) bytes.
The distance between two pointers is retrieved with ##[[KeyPgOpSubtract Operator - (Subtract)]]##, and is measured in values, not bytes. For example, the following,
[[KeyPgAbs Abs]](cast(byte ptr, a) - cast(byte ptr, b)) / [[KeyPgSizeof Sizeof]](T)
- ##[[KeyPgOpAdd Operator + (Add)]]##
- ##[[KeyPgOpSubtract Operator - (Subtract)]]##
- ##[[KeyPgOpAt Operator @ (Address of)]]##
- ##[[KeyPgOpValueOf Operator * (Value of)]]##
- [[CatPgOpPoint Pointer Operators]]


Revision [11950]

The oldest known version of this page was created on 2007-12-21 14:57:01 by ElSairon [Update link format]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode