diff options
author | unknown <andrey@lmy004.> | 2005-12-02 13:07:02 +0100 |
---|---|---|
committer | unknown <andrey@lmy004.> | 2005-12-02 13:07:02 +0100 |
commit | 4d891eb91cd0556e05a2022c4120d776ca772f69 (patch) | |
tree | 7152e34323e50a0845f559f1477316b2b57c7737 /mysys/array.c | |
parent | dad8c66501f097491690ee3098594c1a0844b3f4 (diff) | |
download | mariadb-git-4d891eb91cd0556e05a2022c4120d776ca772f69.tar.gz |
WL1034 update for latest 5.1 sources
BUILD/SETUP.sh:
for now no optimizations in debug build - get rid of "value optimized out"
Diffstat (limited to 'mysys/array.c')
-rw-r--r-- | mysys/array.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysys/array.c b/mysys/array.c index 6d00585f24d..a50d8b78178 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -278,3 +278,28 @@ void freeze_size(DYNAMIC_ARRAY *array) array->max_element=elements; } } + + +/* + Get the index of a dynamic element + + SYNOPSIS + get_index_dynamic() + array Array + element Whose element index + +*/ + +int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element) +{ + uint ret; + if (array->buffer > element) + return -1; + + ret= (element - array->buffer) / array->size_of_element; + if (ret > array->elements) + return -1; + + return ret; + +} |