~ubuntu-branches/ubuntu/trusty/libclc/trusty-proposed

« back to all changes in this revision

Viewing changes to generic/lib/shared/clamp.inc

  • Committer: Package Import Robot
  • Author(s): Michael Gilbert
  • Date: 2013-09-02 17:56:00 UTC
  • Revision ID: package-import@ubuntu.com-20130902175600-yzwtm29jme08wzs5
Tags: upstream-0~git20130819
ImportĀ upstreamĀ versionĀ 0~git20130819

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE clamp(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z) {
 
2
  return (x > z ? z : (x < y ? y : x));
 
3
}
 
4
 
 
5
#ifndef __CLC_SCALAR
 
6
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE clamp(__CLC_GENTYPE x, __CLC_SCALAR_GENTYPE y, __CLC_SCALAR_GENTYPE z) {
 
7
  return (x > (__CLC_GENTYPE)z ? (__CLC_GENTYPE)z : (x < (__CLC_GENTYPE)y ? (__CLC_GENTYPE)y : x));
 
8
}
 
9
#endif