Use references as an attempt to optimize.

This commit is contained in:
Matias De lellis
2020-04-14 10:26:26 -03:00
parent 4a2e4ff112
commit 75adc6f801
2 changed files with 11 additions and 5 deletions

View File

@@ -2,8 +2,8 @@
#define PHP_DLIB_VECTOR_H
ZEND_BEGIN_ARG_INFO_EX(dlib_vector_length_arginfo, 0, 0, 2)
ZEND_ARG_INFO(0, x_arg)
ZEND_ARG_INFO(0, y_arg)
ZEND_ARG_INFO(1, x_arg)
ZEND_ARG_INFO(1, y_arg)
ZEND_END_ARG_INFO()
PHP_FUNCTION(dlib_vector_length);

View File

@@ -4,9 +4,15 @@ Basic tests for dlib_vector_length
<?php if (!extension_loaded("pdlib")) print "skip"; ?>
--FILE--
<?php
var_dump(dlib_vector_length([0.0, 0.0], [1.0, 0.0]));
var_dump(dlib_vector_length([0.0, 0.0, -1.0], [0.0, 0.0, 1.0]));
var_dump(dlib_vector_length([0.0, 2.5, 1.0], [0.0, 1.0, 1.0]));
$vectorAL = [0.0, 0.0];
$vectorAR = [0.0, 1.0];
var_dump(dlib_vector_length($vectorAL, $vectorAR));
$vectorBL = [0.0, 0.0, -1.0];
$vectorBR = [0.0, 0.0, 1.0];
var_dump(dlib_vector_length($vectorBL, $vectorBR));
$vectorCL = [0.0, 2.5, 1.0];
$vectorCR = [0.0, 1.0, 1.0];
var_dump(dlib_vector_length($vectorCL, $vectorCR));
?>
--EXPECT--
float(1)