mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-12 05:58:15 -04:00
Improve k_print_line support
This commit is contained in:
parent
d4bc8e490e
commit
af50f683ce
@ -23,7 +23,15 @@ void k_print(const char* string, uint64_t end);
|
||||
void k_print(uint64_t number);
|
||||
void k_printf(const char* fmt, ...);
|
||||
|
||||
void k_print_line();
|
||||
void k_print_line(const char* string);
|
||||
template<typename... Arguments>
|
||||
typename enable_if<(sizeof...(Arguments) == 0), void>::type k_print_line(Arguments... args){
|
||||
k_print('\n');
|
||||
}
|
||||
|
||||
template<typename... Arguments>
|
||||
typename enable_if<(sizeof...(Arguments) > 0), void>::type k_print_line(Arguments... args){
|
||||
k_print(args...);
|
||||
k_print('\n');
|
||||
}
|
||||
|
||||
#endif
|
||||
|
16
kernel/include/enable_if.hpp
Normal file
16
kernel/include/enable_if.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef ENABLE_IF_H
|
||||
#define ENABLE_IF_H
|
||||
|
||||
template<bool B, class T = void>
|
||||
struct enable_if {};
|
||||
|
||||
template<class T>
|
||||
struct enable_if<true, T> { typedef T type; };
|
||||
|
||||
template<bool B, class T = void>
|
||||
struct dsable_if {};
|
||||
|
||||
template<class T>
|
||||
struct disable_if<false, T> { typedef T type; };
|
||||
|
||||
#endif
|
@ -62,18 +62,6 @@ long get_line(){
|
||||
return current_line;
|
||||
}
|
||||
|
||||
void k_print_line(){
|
||||
current_column = 0;
|
||||
++current_line;
|
||||
}
|
||||
|
||||
void k_print_line(const char* string){
|
||||
k_print(string);
|
||||
|
||||
current_column = 0;
|
||||
++current_line;
|
||||
}
|
||||
|
||||
uint64_t digits(uint64_t number){
|
||||
if(number < 10){
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user