~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/math/ord.cc

  • Committer: Monty Taylor
  • Date: 2009-04-25 20:45:19 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 1003.
  • Revision ID: mordred@inaugust.com-20090425204519-lgrl7mz2r66v0jby
Blackhole.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
22
22
#include <drizzled/function/math/ord.h>
23
23
 
24
 
namespace drizzled
25
 
{
26
 
 
27
24
int64_t Item_func_ord::val_int()
28
25
{
29
26
  assert(fixed == 1);
35
32
  }
36
33
  null_value=0;
37
34
  if (!res->length()) return 0;
 
35
#ifdef USE_MB
38
36
  if (use_mb(res->charset()))
39
37
  {
40
38
    register const char *str=res->ptr();
45
43
      n=(n<<8)|(uint32_t)((unsigned char) *str++);
46
44
    return (int64_t) n;
47
45
  }
 
46
#endif
48
47
  return (int64_t) ((unsigned char) (*res)[0]);
49
48
}
50
49
 
51
 
} /* namespace drizzled */