Sha256: 45b008b2b4aa727ab1a683a31b26f9ebb2c31504838de719e5deb7886add61f8

Contents?: true

Size: 752 Bytes

Versions: 7

Compression:

Stored size: 752 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 sum = 0, count = 1;
  while(count <= input) {
    sum += count++;
  }
  return sum;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adhearsion-0.7.0 new_projects/helpers/factorial.alien.c
adhearsion-0.7.1 new_projects/helpers/factorial.alien.c
adhearsion-0.7.2 new_projects/helpers/factorial.alien.c
adhearsion-0.7.3 new_projects/helpers/factorial.alien.c
adhearsion-0.7.4 apps/default/helpers/factorial.alien.c
adhearsion-0.7.5 apps/default/helpers/factorial.alien.c
adhearsion-0.7.6 apps/default/helpers/factorial.alien.c