mirror of
https://github.com/Chuyu-Team/VC-LTL5.git
synced 2026-10-18 13:50:46 +08:00
26 lines
319 B
C++
26 lines
319 B
C++
//
|
|
// labs.cpp
|
|
//
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//
|
|
// Defines labs(), which computes the absolute value of a number.
|
|
//
|
|
#include <stdlib.h>
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
#pragma function(labs)
|
|
|
|
|
|
|
|
long __cdecl labs(long const number)
|
|
{
|
|
return number >= 0 ? number : -number;
|
|
}
|
|
|
|
|
|
|
|
} // extern "C"
|