Changeset 26579 for platform/mysql

Show
Ignore:
Timestamp:
12/12/08 17:36:01 (5 years ago)
Author:
kazuho
Message:

add negative order mode

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/mysql/top-n-sort/top-n-sort.c

    r26578 r26579  
    185185  int idx = (int)*(long long*)args->args[0]; 
    186186   
     187  if (idx < 0) { 
     188    idx += info->count; 
     189  } 
    187190  return 0 <= idx && idx < info->count ? info->items[idx].id : 0; 
    188191} 
     
    215218  int idx = (int)*(long long*)args->args[0]; 
    216219   
     220  if (idx < 0) { 
     221    idx += info->count; 
     222  } 
    217223  return 0 <= idx && idx < info->count ? info->items[idx].value : 0; 
    218224}