Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/pure-cfg/src/include/Diderot/inline-vec4.h
ViewVC logotype

View of /branches/pure-cfg/src/include/Diderot/inline-vec4.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 756 - (download) (as text) (annotate)
Thu Apr 7 15:06:23 2011 UTC (11 years, 2 months ago) by jhr
File size: 844 byte(s)
  Added lerp functions
/*! \file inline-vec4.h
 *
 * \author John Reppy
 *
 * \brief inline functions for 4D vectors
 */

/*
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 */

#ifndef _DIDEROT_INLINE_VEC4_H_
#define _DIDEROT_INLINE_VEC4_H_

#ifndef _DIDEROT_TYPES_H_
#include "Diderot/types.h"
#endif

STATIC_INLINE vec4f_t vec4f (float a, float b, float c, float d)
{
    return __extension__ (vec4f_t){ a, b, c, d };
}

STATIC_INLINE vec4f_t scale4f (float s, vec4f_t v)
{
    return vec4f(s, s, s, s) * v;
}

STATIC_INLINE vec4f_t lerp4f (vec4f_t a, vec4f_t b, float t)
{
    return a + scale4f(t, b - a);
}

STATIC_INLINE float dot4f (vec4f_t u, vec4f_t v)
{
    union4f_t uv = __extension__ (union4f_t)(u*v);
    return uv.r[0] + uv.r[1] + uv.r[2] + uv.r[3];
}

#endif /* !_DIDEROT_INLINE_VEC4_H_ */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0