vpp icon indicating copy to clipboard operation
vpp copied to clipboard

Stable/2009

Open NUAAwanghe opened this issue 4 years ago • 0 comments

vec.h vec_cmp has a bug my machine is 64 bit, _v(cmp) is signed long type, so vec_len(v1) - vec_len(v2) is a big number here is my test code: int * v1 = vec_new(int, 10); int * v2 = vec_new(int, 10); vec_set(v1, 1); vec_set(v2, 1);

vec_alloc(v2, sizeof(int)*10); _vec_len(v2) = vec_len(v2) + 10; int val = vec_cmp(v1, v2);

the val should be -1, but due to the bug it is 1, v1 always more than v2

NUAAwanghe avatar Mar 29 '21 09:03 NUAAwanghe