1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![no_std]
#![forbid(missing_docs)]
#![cfg_attr(test, allow(bad_style))]

//! A library for hekkin vectors.
//!
//! * The crate is oriented towards use for simulation and graphics, so
//!   dimensions above 4 are not supported.
//! * Generics are avoided to keep incremental build times as low as possible.
//! * Each type has methods appropriate to that type: length of a vector,
//!   discriminant of a matrix, and so on.
//! * If the `free_functions` cargo feature is enabled (on by default) then
//!   there are _also_ top level functions provided that are generic over
//!   anything that can support that operation. For example, [`abs`] can be used
//!   on "anything that you can take an absolute value on", so it works equally
//!   with `f32`, `f64`, all Vector types, and all Matrix types. Some are
//!   concerned about having a fully consistent code base style, so you can turn
//!   this feature off if you don't want to be tempted by alternate versions.

/// re-export our dependency on `lokacore` in case others want to simply match
/// our version.
pub use lokacore;

#[cfg(all(target_arch = "x86", target_feature = "sse"))]
use lokacore::arch::x86::*;
#[cfg(all(target_arch = "x86_64", target_feature = "sse"))]
use lokacore::arch::x86_64::*;
use lokacore::*;

macro_rules! if_sse {
  ($sse_yes:block else $sse_no:block) => {
    #[cfg(target_feature="sse")]
    $sse_yes
    #[cfg(not(target_feature="sse"))]
    $sse_no
  }
}

mod vec2;
pub use vec2::*;
mod vec3;
pub use vec3::*;
mod vec4;
pub use vec4::*;

#[cfg(feature = "free_functions")]
mod free;
#[cfg(feature = "free_functions")]
pub use free::*;