Sha256: ef9054023b46548dddd44687f4dd1f6e886a1f8106fdbaa64f0a03a9955364e7

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

/*
=begin Adhearsion metadata

  name: Native Factorial
  author:
    name: Jay Phillips
    blog: http://jicksta.com
    email: Jicksta -at- Gmail.com
  gems:
    - soap4r
    - rubyinline: >= 0.8.2
  instructions: >
      Yes, this is a pure C file!!!
      This is an example of writing Adhearsion extensions in
      other languages. The first time this file is executed
      it will be compiled and the binary form will be cached.

      If your Adhearsion system is heavily dependent on
      an intensive helper, it may be advantageous to rewrite
      it in a language such as C or C++ and use it like this.

=end
*/

int fast_factorial(int input) {
  int prod = 1, count = 1;
  while(count <= input) {
    prod *= count++;
  }
  return prod;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adhearsion-0.7.7 apps/default/helpers/factorial.alien.c