On Sunday, 30 September 2012 at 06:20:56 UTC, jerro wrote:
The second one uses fstp twice, then fld twice. I don't know,
maybe
this could be a bug.
You're right the lack of one fst/fld in the first case is a
bug. x87 floating point registers are 80 bit. This:
fstpdword [ebp-0CH]
Conver
// Tell me about this sutation, may be it is a bug?
import std.math;
import std.stdio;
struct Vector(int size)
{
union
{
float[size] array = 0;
struct
{
static if (size == 2) float x, y;
On Tuesday, 4 September 2012 at 23:51:49 UTC, bearophile wrote:
Ivan Agafonov:
(otherwise I'll get link errors for some vector functions),<
What errors and in what cases?
Error 42: Symbol Undefined
_D4time4math6vector16__T6VectorTfVi4Z6Vector8toStringMFZAya
hello.obj(hello)
On Wednesday, 5 September 2012 at 01:49:50 UTC, Mike Parker wrote:
On 9/5/2012 7:46 AM, Ivan Agafonov wrote:
I have my library module:
module mylib.vector;
// alias Vector!(float, 4) Vector4f;
struct Vector(T, uint size)
{
T[size
I have my library module:
module mylib.vector;
// alias Vector!(float, 4) Vector4f;
struct Vector(T, uint size)
{
T[size] array = 0;
...
}
And I have client module:
On Tuesday, 4 September 2012 at 07:32:47 UTC, Zhenya wrote:
But why it doesn't convert uint to int correctly?
I dont know, small positive uint and int must have the same
binary representation, and no need to conversion. Strangely...
O! May be problem is here:
glOrtho(-width,width,-height,hei
On Monday, 3 September 2012 at 15:21:59 UTC, Zhenya wrote:
Why this simple program don't show white square?
import std.stdio;
import derelict.opengl3.gl;
import derelict.glfw3.glfw3;
const uint width = 200;
const uint height = 200;
void init()
{
glViewport(0,0,width,height);
g
Note that opBinary operators uses op= instead of op :
Vector opBinary(string op) (Vector rhs) if(isMathOp(op))
{ return Vector(mixin("array.dup[] "~op~"= rhs.array[]")); }
Vector opBinary(string op) (T rhs) if(isMathOp(op))
{ return Vector(mixin("array.dup[] "~op~"= rhs")); }
Note that opBinary operators uses op= instead of op :
Vector opBinary(string op) (Vector rhs) if(isMathOp(op))
{ return Vector(mixin("array.dup[] "~op~"= rhs.array[]")); }
Vector opBinary(string op) (T rhs) if(isMathOp(op))
{ return Vector(mixin("array.dup[] "~op~"= rhs")); }
Yeah! I did it!
How about this solution? What do you think?
static assert(size >= 2 && size <= 4);
static assert(__traits(isFloating, T));
/// Vector components
union
{
T[size] array = 0;
struct
{
On Monday, 3 September 2012 at 02:40:09 UTC, Ali Çehreli wrote:
In general, yes, you can construct and return at the same time.
As you said, in a language like D where source code is almost
always visible, the compiler can apply many optimization
techniques.
However, some of your operators en
struct Vector(T, uint size)
{
static assert(size >= 2 && size <= 4);
static assert(__traits(isFloating, T);
/// Vector components
union
{
T[size] array = 0;
struct
{
static if(s
On Sunday, 2 September 2012 at 07:44:12 UTC, Philippe Sigaud
wrote:
Problem solved:
alias Vec!(T, size) V;
// This works fine
ref V opOpAssign(string op)(V rhs)
{
mixin("array[] "~op~"= rhs.array[];");
return this;
}
Inside a template, you can refer to the current (lo
On Sunday, 2 September 2012 at 04:10:39 UTC, Ivan Agafonov wrote:
There are 3 separated versions of opOpAssign
first version must be the same as the second for Vec!(sometype,
4)
why it doesn't work?
Simplified code:
struct Vec(T, uint size)
{
this(T rhs) { array[]
Hmm, strange...
z.opOpAssign!"+"(z); works with both first and second versions
There are 3 separated versions of opOpAssign
first version must be the same as the second for Vec!(sometype, 4)
why it doesn't work?
Simplified code:
struct Vec(T, uint size)
{
this(T rhs) { array[] = rhs; }
// It doesn't work but compiles
ref Vec!(T, size) opOpA
16 matches
Mail list logo