LLVM API Documentation

Host.h

Go to the documentation of this file.
00001 //===- llvm/System/Host.h - Host machine characteristics --------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // Methods for querying the nature of the host machine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_SYSTEM_HOST_H
00015 #define LLVM_SYSTEM_HOST_H
00016 
00017 #include <string>
00018 
00019 namespace llvm {
00020 namespace sys {
00021 
00022   inline bool isLittleEndianHost() {
00023     union {
00024       int i;
00025       char c;
00026     };
00027     i = 1;
00028     return c;
00029   }
00030 
00031   inline bool isBigEndianHost() {
00032     return !isLittleEndianHost();
00033   }
00034 
00035   /// getOSName() - Return the name of the host operating system or "" if
00036   /// unknown.
00037   std::string getOSName();
00038 
00039   /// getOSVersion() - Return the operating system version as a string or
00040   /// "" if unknown.
00041   std::string getOSVersion();
00042 }
00043 }
00044 
00045 #endif