Giter VIP home page Giter VIP logo

eratosthenes's Introduction

解説

MakefileはFreeBSD(AMD64)用です。

時折見掛ける、「N(なんらかの定数)以下の素数を全て出力せよ」というような問題に対する、アセンブラマクロによるメタプログラミングで事前に必要な素数を求めておく、という解の例です。アセンブラにはNetwide Assembler(NASM)を使っています。

基本的なアイディアは、ホーテンス・S・エンドウ(遠藤諭)さんの、月刊Ascii連載「近代プログラマの夕」1987年6月号「アセンブル中毒者のためのエラトステネス」(単行本『近代プログラマの夕』 pp. 88~93「素数を求める世界最速プログラム」)が基で、主にNASMのマクロに合わせた書き直しをおこなったものです。元のコードはMS MASM用のAMSCLSというマクロセットを使って書かれており、同マクロセットの配布物( http://www.vector.co.jp/soft/dos/prog/se001158.html )の中にサンプルとして入っていますので、そちらから入手できます。

NASMには(これの原型を私が書いた時には)整数値を文字列にしてくれる便利マクロとかありませんでしたので、itoaというマクロを追加しています。

eratosthenes's People

Contributors

metanest avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.